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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3511b7be339195b92e287172043d841ea95ee0af | C++ | s-nandi/contest-problems | /graph-theory/network-flow/maximal-matching/transportation_delegation.cpp | UTF-8 | 4,705 | 2.875 | 3 | [] | no_license | // max flow (maximal matching)
// https://open.kattis.com/problems/transportation
// 2015 East-Central NA Regional
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1231231234;
struct edge{int to, id;};
typedef vector<vector<edge>> graph;
typedef int flowT;
struct dinic
{
int ... | true |
c970c58b74a835464cb3d8478f71d96b75cd4c5d | C++ | tymonali/CPlusPlus | /Tree/Main.cpp | WINDOWS-1251 | 797 | 3 | 3 | [] | no_license | #include"Tree.h"
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
system("color B0");
srand(time(0));
Tree tree;
//
tree.insert(100);
tree.insert(50);
tree.insert(90);
tree.insert(88);
tree.insert(11);
tree.insert(7);
tree.insert(-10);
tree.insert(13);
tree.insert(222);
tree.insert(136);
... | true |
350336a6a9371ef3449810b709ebb8eef049c5ce | C++ | thigiacmaytinh/TGMTcpp | /ConvertJpgToPng/WinMain.cpp | UTF-8 | 622 | 2.65625 | 3 | [] | no_license | // Test.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <opencv2/opencv.hpp>
void main(int argc, char** argv)
{
cv::Mat mat = cv::imread("dog.jpg");
cv::Mat matGRBA;
cv::cvtColor(mat, matGRBA, CV_BGR2BGRA);
for (int y = 0; y < matGRBA.rows; y++)
{
for (int x = 0;... | true |
eaa212bc245989ed6bd7b749acf8cb42582c29b4 | C++ | chisom360/C | /Homework/KarelRobotAndWorld/KarelWorld.h | UTF-8 | 994 | 2.671875 | 3 | [] | no_license | #ifndef KarelWorld_H
#define KarelWorld_H
#include "Intersect.h"
#include <vector>
#include <algorithm>
class karelWorld
{
private:
//std::vector<Intersection> list; //container for the newly created world(Karel intersection container)
public:
//karelWorld();
karelWorld();
std::vector<Intersection> list; //co... | true |
d972396adaa31fb82fc74624631da1387998e26d | C++ | kingsamchen/Eureka | /run-child-process/rcp/unique_handle.h | UTF-8 | 2,647 | 3.078125 | 3 | [
"MIT"
] | permissive | #pragma once
#ifndef RCP_UNIQUE_HANDLE_H_
#define RCP_UNIQUE_HANDLE_H_
#include <cstddef>
#include <memory>
#include "rcp/macros.h"
#if defined(OS_WIN)
#include <Windows.h>
#else
#include <unistd.h>
#endif
namespace rcp {
// unique_handle doesn't actually own the `handle_`, instead, its unique_ptr specialization
... | true |
801a29ae3a4f6fe991a361b621bddef8e95ac31f | C++ | Vinicius0li/dalacorte.github.io | /C++/Faculdade/Exemplo/Segundo Semestre/Exemplo3.cpp | UTF-8 | 154 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
int main()
{
int dia, mes, ano;
dia = 1;
mes = 1;
ano = 2000;
printf("Hoje eh dia: %d/%d/%d. \n", dia, mes, ano);
return 0;
}
| true |
4fee5f5c44ed72dd30b3df4f33444c8cf580f22a | C++ | dliang5/CS109_MachineReader | /sArgsException.cpp | UTF-8 | 244 | 2.609375 | 3 | [] | no_license | #include "sArgsException.h"
using namespace std;
s_ArgsException::s_ArgsException(int x) : num(x){
}
void s_ArgsException::print(){
std::cout << "why you gotta use " << num << " args?" << std::endl;
}
s_ArgsException::~s_ArgsException(){} | true |
232b66a64d79e5d86b0f6eb32b0249c225883809 | C++ | lip23/growing | /数据结构/队列的顺序实现.cpp | GB18030 | 1,694 | 3.75 | 4 | [] | no_license | #include <iostream.h>
#include <malloc.h>
typedef struct //еԴ洢ṹ
{
int* elem;
int size;
}sqqueue;
void initsqqueue(sqqueue &q,int n)//ʼСΪnĶ
{
q.elem=(int*)malloc((n+10)*(sizeof(int)));
if(!q.elem)
cout<<"гʼʧ"<<endl;
q.size=n;
cout<<"ʼеԪ"<<endl;
for(int i=1;i<=n;i++)
cin>>q.elem[i];
cou... | true |
c974bdb375d6d75cec1410b8d4cf192b1ad4752d | C++ | hardikhere/competitive-programming | /Vectors/(GEEKSFORGEEKS)Print the left element.cpp | UTF-8 | 359 | 2.5625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
//code
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
for(int i=0; i<n; i++)
{
cin>>arr[i];
}
sort(arr,arr+n);
if(n%2==0){
cout<<arr[(n/2)-1]<<endl;
}
else{
cout<... | true |
cdb887f8a1728d15cb81b16ebed7dbc4403dac91 | C++ | mke01/BasicC- | /Day 14_15/06 Virtual Destructor/Source01.cpp | UTF-8 | 921 | 3.15625 | 3 | [] | no_license | #include <crtdbg.h>
#include<iostream>
using namespace std;
class Base
{
public:
Base()
{
cout<<"Base Constructor"<<endl;
}
~Base()
{
cout<<"Base Destructor"<<endl;
}
};
class Derived:public Base
{
char *p;
public:
Derived()
{
p = new char;
p[0] = 'a';
cout<<"Derived Constructor"<<endl;
}
~Deri... | true |
841d6f4fadf7859d934792dcc3465b2e947faa1e | C++ | Kartik-Mathur/StAndrews-CPP | /Lecture-18/RatInMazeAdvance.cpp | UTF-8 | 1,466 | 3.484375 | 3 | [] | no_license | // RatInMazeAdvance
#include <iostream>
using namespace std;
bool RatInMaze(char maze[][10],bool visited[][10],int sol[][10],int n,int m,int i,int j){
// base case
if( i == n-1 and j == m-1){
sol[i][j] = 1;
// Print the solution
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < m ; j++){
cout<<sol[i][j]... | true |
20f9e0de7b7ab80ba9ef8f0d1121dfb6a03e34eb | C++ | nurlingo/Codeforces | /BadSequence.cpp | UTF-8 | 721 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int n, openCount, closedCount, outOfOrderCount;
cin >> n;
openCount = 0;
closedCount = 0;
outOfOrderCount = 0;
string answer = "Yes";
for (int i = 0; i < n; i++) {
char bracket;
cin >> bracket;
... | true |
58c5a30a6e67db27faae3f84c020161c4caa3b66 | C++ | osmarbraz/lista_sequencia_oo_cpp | /main.cpp | UTF-8 | 7,220 | 3.9375 | 4 | [
"MIT"
] | permissive | /**
* Implementação de Lista Sequencial de forma orientada a objeto.
*
*/
//Declaração de bibliotecas
#include <cstdlib>
#include <iostream>
#include <string>
//Inclui o cabeçalho da classe Lista
#include "Lista.h"
using namespace std;
/**
* Realiza a leitura dos dados dos nós.
*
* @return O... | true |
94e40e54e3103ce2f1641f523b4422e502598c81 | C++ | dmzld/algorithm | /BOJ/samsung/19236_청소년상어.cpp | UTF-8 | 2,184 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
pair<int, int> map[4][4]; // <number of fish, direction>
pair<int, int> dir[8] = { { -1, 0 }, { -1, -1 }, { 0, -1 }, { 1, -1 }, { 1, 0 }, { 1, 1 }, { 0, 1 }, { -1, 1 } }; // <dy, dx>
int ans = 0;
void rotateFish(int sy, int sx){ // curr... | true |
81e25cda9b68725412ec854ea49e27fc7aa58078 | C++ | irfansofyana/cp-codes | /04 - Competitions/ngoding_Seru/C.cpp | UTF-8 | 987 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int idx,spasi,n,i,j;
string s,temp,ans;
bool cek(string s){
int it,angka;
int kcl;
angka = 0; kcl = 0;
for (it = 0; it<s.size(); it++) {
if (s[it]>='0' && s[it]<='9') angka++;
else if (s[it]>='a' && s[it]<='z') kcl++;
}
if (kcl>=3 && angka>=1) ret... | true |
fff06368956a1e1535b523ad62cc7fd73fa1a907 | C++ | vivekmalik2609/Golf-Cart | /Arduino Codes/Speed_Control_Rotary_Encoder_ROS/Speed_Control_Rotary_Encoder_ROS.ino | UTF-8 | 2,854 | 2.765625 | 3 | [] | no_license | #include<SPI.h>
#include <ros.h>
#include <geometry_msgs/Twist.h>
//Encoder interupt attachments
int EncoderR_A = 0; //pin 2
int EncoderR_B = 5; //pin 18
int EncoderL_A = 1; //pin 3
int EncoderL_B = 4; //pin 19
volatile int CountR = 0;
volatile int CountL = 0;
float CountAvg = 0;
//sampling rate
int T = 10; //(mi... | true |
7a5c81a7c73cb6a993397053f692a8635fbdd2e7 | C++ | zerozez/metricspp | /include/metricspp/modifier.hpp | UTF-8 | 1,617 | 3.265625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef L_METRICSPP_MODIFIER_HPP
#define L_METRICSPP_MODIFIER_HPP
#include <list>
#include <memory>
#include <string>
// \brief Library namespace
namespace metricspp {
class MetricsModifierPrivate;
/** MetricsModifier class
*
* Class for configuring a data queue for sending in databases. It allows
* to ... | true |
70c5deb9bb685155ea29f71202991cec1f0ef243 | C++ | NorieM/tictactoe | /ttt.cpp | UTF-8 | 295 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "functions.hpp"
int main()
{
bool play_game=true;
std::string play_again;
while (play_game) {
start_game();
std::cout<<"Do you want to play again (Y/N)?";
std::cin>>play_again;
play_game = tolower(play_again[0])=='y';
}
} | true |
5372c62fcea53ee8455c11f4927ed68e26c57f5d | C++ | jnxyatmjx/LeetCode | /submit/450.delete-node-in-a-bst.cpp | UTF-8 | 1,792 | 3.609375 | 4 | [] | no_license | /*
* @lc app=leetcode id=450 lang=cpp
*
* [450] Delete Node in a BST
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(... | true |
363498874d3b8a6571245f0bb83d4875aa2e9eac | C++ | Sadia1116/CG | /CG lab/learn/main.cpp | UTF-8 | 6,998 | 2.640625 | 3 | [] | no_license | /*
* GLUT Shapes Demo
*
* Written by Nigel Stewart November 2003
*
* This program is test harness for the sphere, cone
* and torus shapes in GLUT.
*
* Spinning wireframe and smooth shaded shapes are
* displayed until the ESC or q key is pressed. The
* number of geometry stacks and slices can be adjusted
* u... | true |
f80f45925df371a05a666d8d6f34ba05437409ec | C++ | Khairul-Anam-Mubin/LightOJ-Solutions | /Number Theory/1109 - False Ordering.cpp | UTF-8 | 839 | 2.703125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std ;
#define mxN 1000
long long v[mxN + 5] ;
void DivSieve() {
for(int i = 1 ; i <= mxN ; i++) {
for(int j = i ; j <= mxN ; j += i) {
v[j]++ ; // counting number of divisors of j
}
}
}
bool cmp(pair<int, int> &a , pair<int , int> &b) {
... | true |
7c6f7c5e14855fe4342065fa35726687262f3cd7 | C++ | schiebermc/CP_Lib | /HackerRank/Practice/InterviewPrep/DynamicProgramming/MaxArraySum/code.cpp | UTF-8 | 1,224 | 2.75 | 3 | [] | no_license | //#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <map>
#include <set>
#include <climits>
using namespace std;
typedef long long int ll;
void solution(ll n, vector<ll> a){
map<ll, ll> stuff;
// init the first two.
if(n >= ... | true |
94b76f5efcf7a21edb0b44ce13e4b16b75ea236c | C++ | gunner14/old_rr_code | /main_project/feed/cwf_feed/dynalib.h | UTF-8 | 409 | 2.546875 | 3 | [] | no_license | #ifndef CWF_DYNAMIC_LIBRARY_H__
#define CWF_DYNAMIC_LIBRARY_H__
#include <string>
namespace cwf {
struct DynamicLibrary {
public:
DynamicLibrary(const std::string& filename)
: filename_(filename)
, handle_(0) {}
bool Load();
void Close();
void* GetProc(const char* name);
private:
... | true |
9c92c0435c71be46f33b2146d5c68170e58c8a9f | C++ | joseAugustoCR/CG-T4 | /src/Carro.h | ISO-8859-1 | 2,350 | 2.921875 | 3 | [] | no_license | /**
TRABALHO 4 DE COMPUTACAO GRFICA: AUTORAMA USANDO BPLINE 3D
JOS AUGUSTO COMIOTTO ROTTINI - 201120279
ENGENHARIA DE COMPUTAO - UFSM
Classe para criao e configurao carro.
**/
#include <gl/glut.h> //gl utility toolkit
#include <gl/gl.h> //gl utility
#include <math.h>
#include "Ponto3D.h"
#include "V... | true |
03454231921d38bb8638afd9a6ec5da7aa548150 | C++ | DNovotny1/CIS2013_Week3_Quiz01 | /quiz1.cpp | UTF-8 | 493 | 4.40625 | 4 | [] | no_license | /* ask for 2 numbers, ask if + or*, print output, repeat*/
#include<iostream>
using namespace std;
int main()
{
//hold numeric values and sign for operator
int num1, num2;
char sign;
while(true)
{
cout << "Enter first digit.";
cin >> num1;
cout << "Enter Second digit.";
cin >> num2;
cout << "Would you... | true |
5e99bad63a009737cf79783dd27f99a11b0b1d49 | C++ | GSGroup/stingraykit | /stingraykit/string/StringUtils.cpp | UTF-8 | 732 | 2.625 | 3 | [
"ISC"
] | permissive | #include <stingraykit/string/StringUtils.h>
namespace stingray
{
std::string::size_type EditDistance(const std::string& s1, const std::string& s2)
{
if (s1 == s2)
return 0;
if (s1.empty())
return s2.size();
if (s2.empty())
return s1.size();
std::vector<std::string::size_type> v0(s2.size() + 1);
... | true |
72606cd8395e6c32eee9fa75111356a251ab8529 | C++ | GregWagner/Modern-Cplusplus-Programming-with-Test-Driven-Development | /Chapter_02_Test_Driven_Development_A_First_Example/oldSoundex/src/Soundex.hpp | UTF-8 | 1,045 | 2.90625 | 3 | [] | no_license | #ifndef SOUNDEX_H
#define SOUNDEX_H
#include <string>
#include <unordered_map>
class Soundex {
public:
std::string encode(const std::string &word) const;
std::string encodedDigit(char letter) const;
private:
static size_t const MAX_CODE_LENGTH{4};
const std::string NOT_A_DIGIT{"*"};
std::str... | true |
6cd6cab494076009f6b5d6c955e17fba4f8cb68a | C++ | connor-brooks/Wobbler | /midi.cpp | UTF-8 | 905 | 2.59375 | 3 | [] | no_license | #include <rtMidi.h>
#include "midi.h"
Midi::Midi() {
has_connection = false;
midi_in = new RtMidiIn();
num_ports = midi_in->getPortCount();
if(num_ports == 0) {
has_connection = false;
return;
}
else {
midi_in->openPort(0);
midi_in->ignoreTypes(false, false, false);
has_connection = tru... | true |
1c9caf961ac3b3cfe073d77c32a18070f5c79177 | C++ | liulin2012/myLeetcode | /PalindromePartitioning.cpp | UTF-8 | 922 | 3.15625 | 3 | [] | no_license | class Solution {
public:
vector<vector<string>> partition(string s) {
vector<vector<string>> res;
if (s.empty()) return res;
BFS(s, 0, res, {});
return res;
}
void BFS(string s, int begin, vector<vector<string>>& res, vector<string> one) {
if (begin == s... | true |
ff8619e191b64355c0d5ce8827cd2984fff9f5eb | C++ | bjut-hz/basics | /leetcode_c++/230.kth-smallest-element-in-a-bst.cpp | UTF-8 | 1,363 | 3.640625 | 4 | [] | no_license | /*
* @lc app=leetcode id=230 lang=cpp
*
* [230] Kth Smallest Element in a BST
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
clas... | true |
5b76540f11c69e2a443adcce9d76da2b38cdb02d | C++ | yay/cpp | /lambdas_adv/main.cpp | UTF-8 | 1,312 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <functional>
#include <array>
#include <cstdlib> // for malloc() and free()
// On clang++ the size of all std::function is always 48 bytes (used to be 32 as of early 2016).
// It uses what is called `small size optimization`, much like std::string does on many
// implementations. This basi... | true |
722443468297268ab10cf177c8e16e3dafbcc11a | C++ | Tijovanth/CompetitiveProgramming | /BinarySearchTreeUsingLinkedList.cpp | UTF-8 | 6,351 | 3.8125 | 4 | [] | no_license | # include <iostream>
# include <stdio.h>
using namespace std;
struct Node{
int data;
struct Node * leftchild;
struct Node * rightchild;
}*root = NULL;
struct Stack{
Node ** data;
int top;
int size;
};
int isStackEmpty(struct Stack st){
if(st.top == -1)
return 1;
else
... | true |
615f63ce96ecf9ea0eec83556e8f82e6b210893f | C++ | nicokinazoko/prak-algo-lanjut | /Record-Struct/program-2-4.cpp | UTF-8 | 606 | 3.40625 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct data_tgl
{
int tanggal, bulan, tahun;
};
void cetak_info_tgl(struct data_tgl unit_tgl);
int main()
{
struct data_tgl saat_proses = {13, 1, 1987};
cetak_info_tgl(saat_proses);
}
void cetak_info_tgl(struct data_tgl unit_tgl)
{
static char const *nama_bln... | true |
91473a8065d25899674c005a618560130472ad71 | C++ | Bygius/OOP_arcade_2019 | /core/include/Error.hpp | UTF-8 | 1,089 | 2.515625 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2020
** OOP_nanotekspice_2019
** File description:
** Error
*/
#ifndef ERROR_HPP_
#define ERROR_HPP_
#include <exception>
#include <string>
class Error: public std::exception
{
public:
Error(const std::string &msg);
virtual ~Error() throw(){}
virtual const char *wha... | true |
1bf54b3058437828415867c17cd62259d745db2c | C++ | qigaiwangguilai/Algorithm-Description | /Sort_Algorithm/HeapSort.cpp | UTF-8 | 491 | 3.53125 | 4 | [] | no_license | //堆排序
inline int childIndex(int i)
{
return 2*i+1;
}
void percolateDown(int a[],int hole,int N)
{
int tmp;
int child;
for(tmp=a[hole];childIndex(hole)<N;hole=child)
{
child=childIndex(hole);
if(child!=N-1&&a[child]<a[child+1])
child++;
if(tmp<a[child])
a[hole]=a[child];
else
break;
}
a[hole]=t... | true |
202a99110601f0d3de8dcf91f242c3b32381790e | C++ | QinHaoChen97/VS_C | /Hot100/399.除法求值.cpp | UTF-8 | 2,825 | 3.328125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=399 lang=cpp
*
* [399] 除法求值
*/
// @lc code=start
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
class Union //因为题解的
{
private:
vector<int> parent;
vector<double> weight;
public:
//构造函数
Union(int n)
{
parent.resize(n);
... | true |
2bdf36f26b536ce75e24b118eacb9a9c6d850bdc | C++ | mrpandya/DBMS_from_scratch | /constants/tokenizeQuery.cpp | UTF-8 | 488 | 3.046875 | 3 | [] | no_license | using namespace std;
vector<string> tokenizeString(string query, string del = " ")
{
int start = 0;
int end = query.find(del);
vector<string> tokens;
while (end != -1) {
tokens.push_back(query.substr(start, end - start));
start = end + del.size();
end = query.find(del, start);
... | true |
904ef91c4aa540fc4643d746d0ab55024d6ae41e | C++ | arpitarik/arpita.lab5 | /lab5_q25.cpp | UTF-8 | 205 | 2.9375 | 3 | [] | no_license | //using library
#include<iostream>
using namespace std;
//using main function
int main (){
//declaring variables
int a = 1,b;
//using loop
while (a < 100){
if (a % 2 == 0){
cout << a << endl;
}
a++;
}
}
| true |
dae2bbc62aa1e6ab5fa3a5afdf11b5dbadd761fd | C++ | edenhub/SwordOffer | /CPPImple/inter20.cpp | UTF-8 | 950 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
void dumpMatrix(int* data,int rows,int cols){
for(int i=0;i<cols;i++){
for(int j=0;j<rows;j++)
cout<<*(data+cols*i+j)<<" ";
cout<<endl;
}
}
void dump(int* data,int rows,int cols){
int n = cols-1;
int s1 = 0, e1 = n;
int s2 = 1, ... | true |
0a1d50ce9944cb6eeb2e6a95e952f478712ffc9b | C++ | EdgrFA/Algoritmia | /EjerciciosEstructuras/listas/reverseLinkedList.cpp | UTF-8 | 579 | 3.390625 | 3 | [] | no_license | //https://www.hackerrank.com/challenges/reverse-a-linked-list/problem
#include <bits/stdc++.h>
using namespace std;
struct SinglyLinkedListNode {
int data;
SinglyLinkedListNode* next;
};
SinglyLinkedListNode* reverse(SinglyLinkedListNode* head) {
if(head == NULL)
return head;
SinglyLi... | true |
247e20e8a68059b9dbc86b74fcbe87c715d8920c | C++ | tfcpanda/cBaseExercises | /cBasicExercises13/ecperiment_1.cpp | GB18030 | 924 | 3.671875 | 4 | [] | no_license | #include <stdio.h>
#include<math.h>
/*
ҪʵһжһλNǷ
ȫƽλͬ144676ȡ
*/
int IsTheNumber ( int n);
int main()
{
int n1, n2, i, cnt;
scanf("%d %d", &n1, &n2);
cnt = 0;
for ( i=n1; i<=n2; i++ )
{
if ( IsTheNumber(i)!=0)
cnt++;
}
printf("%d\n",cnt);
return 0;
}
int IsTheNumbe... | true |
dcaabf3ea33d458120ea0369a3eb224a7e71d650 | C++ | SeanArmstrong/GameDev | /GameDev/ShaderManager.cpp | UTF-8 | 869 | 2.859375 | 3 | [] | no_license | #include "ShaderManager.h"
ShaderManager::ShaderManager()
{
}
ShaderManager::~ShaderManager()
{
for (map<string, Shader*>::iterator i = shaders.begin(); i != shaders.end(); ++i){
delete i->second;
}
}
Shader* ShaderManager::GetShader(const std::string shaderName){
map<string, Shader*>::iterator i = shaders.fi... | true |
d9ca89482b368dac27f5d11d3202e58d01fda3d6 | C++ | jacobhmurphy/cpp-esst-careerchangers | /oddnumbers.cpp | UTF-8 | 222 | 2.546875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
for (auto i = 0; i <= 100; i++)
{
if (i % 2 != 0)
{
cout << i << " ";
}
}
return 0;
}
| true |
8e337590166bf0862a4fc6b5a9c52cea519dda48 | C++ | heyzqq/Cpp-Back-Syntax | /3Class/27 - 动态绑定 .cpp | UTF-8 | 920 | 3.84375 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*
动态绑定(多态)
* 从派生类到基类的转换
* 引用或指针既可以指向基类对象, 也可以指向派生类对象
* 只有通过引用或指针调用虚函数才会发生动态绑定
*/
class Father
{
public :
void func_1(){
cout << "Father: func_1" << endl;
}
virtual void Func_2(){
cout << "Father: func_2" << endl;
}
};
class ... | true |
311722a571721f6f2589a94d912ec4fc0102da15 | C++ | RedOni3007/Itsukushima | /Itsukushima/Resource/Model.h | UTF-8 | 1,322 | 2.5625 | 3 | [] | no_license | /*
* mesh + material + other data for rendering
* todo:write a better description, it's hard
*
* @author: Kai Yang
*/
#ifndef MODEL_H
#define MODEL_H
#include <Core/CoreHeaders.h>
#include <Game/GameObjectComponent.h>
#include <Resource/Mesh.h>
#include <Render/RenderManager_Defines.h>
class Model : public GameObjec... | true |
f22359ad7edafe49b8865fbb9663d56fe83fd2ce | C++ | yw14218/C-Compiler | /include/Function_call/functioncall.hpp | UTF-8 | 4,863 | 2.671875 | 3 | [] | no_license | #ifndef FUNCTIONCALL_HPP
#define FUNCTIONCALL_HPP
#include"Statement.hpp"
#include"Statementlist.hpp"
extern std::string Funcnameadd;
extern std::vector<std::string> Funcname;
extern int NumVariables;
extern bool mainflag;
class functioncall : public Statement{
public:
virtual ~functioncall(){};
func... | true |
ad94c5925bdcc41a861936c7d1cb0f53e4456748 | C++ | harnen/airtnt | /client-ocr/isv_app/processing.h | UTF-8 | 1,724 | 2.9375 | 3 | [] | no_license | // ============================================================================
// processing.h
// Image processing / OCR functions.
//
// ============================================================================
#ifndef PROCESSING_H_
#define PROCESSING_H_
#include <vector>
#include "Letter.h"
using namespace std;... | true |
b26c75bb61aff385accf6319d82ae7e5ee467605 | C++ | grant-cai/cs16projects | /vowels.cpp | UTF-8 | 1,037 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
using namespace std;
int countVowels(string s)
{
int len = s.length();
if(s.empty()){
return 0;
}
else
{
return (toupper(s[0]) == 'A' || toupper(s[0]) == 'E' || toupper(s[0]) == 'I' || toupper(s[0]) == 'O' ... | true |
3286a4805dcf183bc93a3d69be8992369ecd2f24 | C++ | vslavik/poedit | /deps/boost/libs/log/test/run/util_formatting_ostream.cpp | UTF-8 | 15,472 | 2.6875 | 3 | [
"GPL-1.0-or-later",
"MIT",
"BSL-1.0"
] | permissive | /*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file util_formatting_ostream.cpp
* \author Andrey Semashev
* \date 26.05.2013
*... | true |
032acf1813e8eceac75b1e519ed2d0116cc46023 | C++ | dave98/2019_01 | /RC_1_Basic_Chat/client.cpp | UTF-8 | 1,446 | 2.6875 | 3 | [] | no_license | /* Client code in C */
#include <iostream>
#include <string>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#includ... | true |
02eb8ae4fdaa85260ed6799084c9556890db6b36 | C++ | yull2310/book-code | /www.cplusplus.com-20180131/reference/unordered_set/unordered_set/load_factor/load_factor.cpp | UTF-8 | 416 | 2.875 | 3 | [] | no_license | // unordered_set hash table stats
#include <iostream>
#include <unordered_set>
int main ()
{
std::unordered_set<int> myset;
std::cout << "size = " << myset.size() << std::endl;
std::cout << "bucket_count = " << myset.bucket_count() << std::endl;
std::cout << "load_factor = " << myset.load_factor() << std::end... | true |
fec0e268c763cdf0186c26bbbc3a01bdf1533d19 | C++ | beunprogrammeur/basic-nes-emulator | /lib/nes/include/nes/cpu/instructions/iinstruction.h | UTF-8 | 1,141 | 2.921875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <nes/cpu/registers.h>
#include <nes/cpu/bus/bus.h>
#include <string>
namespace nes::cpu::instructions
{
enum class AddressingMode
{
// Unknown: not defined. No addresing mode.
UNK,
// Absolute addressing
ABS,
// Absolute indexed X addressing
ABSX,
// Absolute indexed ... | true |
a8fa91d535baaa1195be191ca23c180ac4ab7ecc | C++ | ikraduya/tubes-oop | /products/HorseMeat.cpp | UTF-8 | 440 | 2.875 | 3 | [] | no_license | /**
* @file HorseMeat.cpp
* @author Al Terra
* @date 2019-03-20
*/
#include "HorseMeat.h"
const long HorseMeat::price = 20000;
/**
* @brief Kelas HorseMeat yang diturunkan dari FarmProducts
*/
/**
* @brief ctor default
*/
HorseMeat::HorseMeat() : FarmProducts("Horse Meat"){}
/**
* @brie... | true |
40c2abc33d7c2a497d10afa97ae9bbdabe05545a | C++ | cth103/toast | /src/util.cc | UTF-8 | 2,603 | 2.6875 | 3 | [] | no_license | #include "util.h"
#include "toast_socket.h"
#include "config.h"
#ifdef TOAST_HAVE_WIRINGPI
#include <wiringPi.h>
#endif
#include <cstring>
using std::string;
using std::shared_ptr;
using std::pair;
void
put_int16(uint8_t*& p, uint8_t* e, int16_t v)
{
assert(e > (p + 2));
*p++ = v & 0xff;
*p++ = (v & 0xff00) >> 8;
... | true |
c82d510809c57f1d1974be8636fc2ae806bf931a | C++ | Vancasola/DataStructure | /exam/2017冬/3.cpp | UTF-8 | 1,135 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstring>
#include <cmath>
#include <map>
#include <stack>
#include <unordered_map>
#include <set>
#include <algorithm>
using namespace std;
int n;
int in[50005],pre[50005];
struct node{
int x;
node... | true |
c5419e6eaf0466458b9d35b4f87a969c2ad39175 | C++ | fossabot/InnocenceEngine | /source/engine/component/BaseComponent.h | UTF-8 | 461 | 2.515625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "interface/IComponent.h"
#include "entity/InnoMath.h"
class BaseComponent : public IComponent
{
public:
BaseComponent() :
m_parentEntity(nullptr) {};
virtual ~BaseComponent() {};
IEntity* getParentEntity() const override;
void setParentEntity(IEntity* parentEntity) override;
const object... | true |
00068e39bd835fdc35640c5b5ad33014706387e3 | C++ | matzmz/pfs | /sample/enum_fd.cpp | UTF-8 | 3,013 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2020-present Daniel Trugman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... | true |
947014743245bc0b0b24a652a9277ebd3b808219 | C++ | vital228/Algorithm | /ifmo c/ifmo c/dfs.cpp | UTF-8 | 2,202 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include<vector>
#include<queue>
using namespace std;
vector<int> gr[100000];
queue<pair<int, int>> q;
int a[1000][1000];
int main() {
ifstream fin("input.txt");
ofstream fout("output.txt");
int n, m;
fin >> n >> m;
for (int i = 0; i < 1000; i++) {
for (int j = 0; j < 1000... | true |
697a3e3a6b0bb871377eea44d4d06cb7e6beac4b | C++ | dpinol/SDL_test | /model/Jewel.h | UTF-8 | 828 | 2.578125 | 3 | [] | no_license | /**************************************************************************
** Qt Creator license header template
** Special keywords: dpinol 03/03/2014 2014
** Environment variables:
** To protect a percent sign, use '%'.
**************************************************************************/
#ifndef JEWEL_... | true |
f585e07d0d04f3b450eb5588677f61ff2b1cd4c8 | C++ | Sciencegeek123/AntColonyEvolution | /testing/compilertest/helloworld.cpp | UTF-8 | 194 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <memory>
using namespace std;
int main() {
shared_ptr<int> id(new int(0));
while (*id < 10) {
(*id)++;
}
cdebug << "Hello world!" << endl;
} | true |
bd4f8c4270cee864c352b7aff0f1921880858da9 | C++ | Adarshkumarmaheshwari/SI-AlgoDS-Practice | /C++ Practice(DSalgo)/DP/EqualSubsetSum.cpp | UTF-8 | 1,215 | 3.15625 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
bool isSubsetSum(int set[], int n, int sum)
{
if (sum % 2 != 0)
{
return false;
}
else if(sum%2==0)
{
sum = sum / 2;
bool subset[n + 1][sum + 1];
for (int i{0}; i < n; i++)
{
subset[i]... | true |
332d86cf27c3d794b15a9acdb0d86dfca376f101 | C++ | manjurulhoque/problem-solving | /Codeforces/1271A.cpp | UTF-8 | 625 | 2.890625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c, d, e, f, sum = 0;
cin>>a>>b>>c>>d>>e>>f;
if(f > e)
{
int second = min({b, c, d});
sum += (second * f);
d -= second;
if(d > 0)
{
int first = min(a, d);
sum += (first *... | true |
2671f65b896960ab9b1a1db9f42a9ffad8e3d879 | C++ | gilzilberfeld/tic-tac-toe | /cpp/T3Cpp/Code/Game.cpp | UTF-8 | 800 | 2.9375 | 3 | [] | no_license | #include "..\pch.h"
#include "PlayerType.h"
#include "IllegalMove.h"
#include "IMoveHandler.h"
#include "Player.h"
#include "Board.h"
#include "Game.h"
Game::Game()
{
playerX = new Player(X, (IMoveHandler*) this);
playerO = new Player(O, (IMoveHandler*) this);
nextPlayer = playerX;
}
bool Game::IsOver()
{
return ... | true |
13f1488e8f814e534e3148a9379497b879bb9198 | C++ | TruVortex/Competitive-Programming | /DMOJ/pwindsor18p3.cpp | UTF-8 | 346 | 2.671875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool prime(int n)
{
for (int x = 2; x <= sqrt(n); x++)
if (n%x == 0)
return false;
return true;
}
int main()
{
int n;
scanf("%i", &n);
int cnt = 0, a;
while (n--)
{
scanf("%i", &a);
cnt += !prime(a);
}
... | true |
3c40b9fc609ce6785d82febc6c4b160caf1037b1 | C++ | arangodb/arangodb | /3rdParty/V8/v7.9.317/src/base/flags.h | UTF-8 | 5,978 | 2.640625 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode... | permissive | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_BASE_FLAGS_H_
#define V8_BASE_FLAGS_H_
#include <cstddef>
#include "src/base/compiler-specific.h"
namespace v8 {
namespace base {
// The ... | true |
3b47e78411a3913203f327eab6c6fbffd66bef2c | C++ | AmrHendy/http-protocol | /HTTP Server/src/server.cpp | UTF-8 | 5,268 | 3.109375 | 3 | [
"MIT"
] | permissive | //
// Created by Amr Hendy on 11/16/2018.
//
#include "server.h"
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <thread>
#include <mutex>
using namespace std;
// Steps:
// 1) init the server with the hos... | true |
ac917f0dc44d27f66a3ea24246d38d585bb176ea | C++ | biggysmith/advent_of_code_2019 | /src/day13/day13.cpp | UTF-8 | 5,200 | 2.625 | 3 | [] | no_license | #include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <set>
#include <emmintrin.h>
#include <smmintrin.h>
#include <chrono>
#include <conio.h>
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <thread>
s... | true |
a1458ccdc381a8ccf9c788fd6ceb195aa16b80e2 | C++ | 946336/Watchdog | /src/main.cpp | UTF-8 | 1,035 | 2.734375 | 3 | [
"MIT"
] | permissive | #ifndef WATCHDOG_DEBUG
#define WATCHDOG_DEBUG true
#endif
#include <watchdog.hpp>
#include <iostream>
void usage(const std::string &invokedAs)
{
std::cerr << "Usage: " << invokedAs << " [path]\n";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
usage(argv[0]);
return 0;
}
std::s... | true |
f8c07388a6cfca7d4443987a13ea5153da84cb4b | C++ | cqw5/CodingTraining | /LeetCodeOJ/Solution/061/rotateRight.cpp | UTF-8 | 1,950 | 3.765625 | 4 | [] | no_license | /*! Source: https://leetcode.com/problems/rotate-list/
*! Author: qwchen
*! Date : 2016-12-07
* Solution 为该文件最优的方案
* test数据只用于测试是否语法错误,完整的测试见LeetCode。
*/
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
ListNode(int x, L... | true |
3aad3eae63b59d935268ba7adeb72f9834a2c95c | C++ | gastonorqueda/AyE | /.vscode/Modulo5/Ejercicio 9.cpp | UTF-8 | 1,146 | 3.671875 | 4 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
struct Nodo
{
int info;
Nodo *sgte;
};
Nodo *obtenerUltimo(Nodo *lista)
{
while (lista && lista->sgte)
lista= lista->sgte;
return lista;
}
void sacarCola(Nodo *&cola,int &n){
Nodo *aux = cola;
n = aux->info;
cola = aux->sgte;
delet... | true |
add47c618f78f6d1b7f5366e2e930797dc6ad534 | C++ | aabedraba/tabu-and-local-search | /src/Greedy.cpp | UTF-8 | 2,473 | 2.609375 | 3 | [] | no_license | //
// Created by aabedraba on 23/10/19.
//
#include "Greedy.h"
Greedy::Greedy(Airport *airport) :
_airport(airport) {
auto start = std::chrono::steady_clock::now();
initializeVectors();
quickSort(_fluxSum, _fluxIndex, 0, _sizeVectors);
quickSort(_distanceSum, _distanceIndex, 0, _sizeVectors);
... | true |
6e5bf9775a5ebb58f64edeb19557e42a37791908 | C++ | julianferres/concuSat | /logger/Logger.cpp | UTF-8 | 2,226 | 3.109375 | 3 | [] | no_license | //
// Created by julian on 10/27/20.
//
#include "Logger.h"
using namespace std;
//Declaro las variables de clase
string Logger::rutaArchivoLog = "concuSat.log";
ofstream Logger::outstream;
vector<string> Logger::stringsLoggerType;
int Logger::modoDebug;
void Logger::iniciar(int _modoDebug) {
stringsLoggerType ... | true |
23c882c9d295c2aafa5c6f09d726be407364816e | C++ | uselessboy-7/laba3_Akhmaev | /AVLTree.hpp | UTF-8 | 13,088 | 3.34375 | 3 | [] | no_license | #ifndef LAB3_CLION_AVLTREE_HPP
#define LAB3_CLION_AVLTREE_HPP
#include <utility>
#include <stdexcept>
template<typename T>
T max(T &&a, T &&b) {
return a > b ? a : b;
}
template<typename T, typename V>
class AVLTree {
public:
using traversalType = void (*)(void *&, void *&, void *&);
private:
... | true |
07a8baca87dc63909c99602a150bc687a24ffe9a | C++ | MaxMade/ARMOS | /inc/kernel/cpu_local.h | UTF-8 | 1,048 | 2.9375 | 3 | [] | no_license | #ifndef _INC_KERNEL_CPU_LOCAL_H_
#define _INC_KERNEL_CPU_LOCAL_H_
#include <cstdlib.h>
#include <kernel/cpu.h>
#include <kernel/config.h>
/**
* @file kernel/cpu_local.h
* @brief CPU local data
*/
/**
* @class cpu_local
* @brief CPU local data
*/
template<typename T>
class cpu_local {
private:
/**
* @var ... | true |
2311426408da57a8ec8af09db39b037d5b9e2dba | C++ | Computer-engineering-FICT/Computer-engineering-FICT | /V семестр/Паралельне програмування/Редько/labs/palevo/3/Dima7/Dima7/funcs.cpp | WINDOWS-1251 | 3,796 | 2.65625 | 3 | [] | no_license | /* * , -91
* . 7. MPI
* 1.16 d=(A+B)*C
* 2.17 a = MAX(MA - MB)
* 3.11 D = SORT(A - M)*TRANS(MC)*/
#include "StdAfx.h"
#include "funcs.h"
#include <iostream>
#include <fstream>
int* PLUS(int ARG1[], int ARG2[]){
static int RESULT[N];
for(int i=0; i < N; i++)
... | true |
ba0784ff576ea08ac9b41733d81a615b11ce8f57 | C++ | skishore/skewed | /skewed/basic_server_factory.h | UTF-8 | 575 | 2.859375 | 3 | [
"MIT"
] | permissive | // If your protocol has a default constructor, you can use BasicServerFactory:
// class MyProtocol : Protocol { ... }
// BasicServerFactory<MyProtocol> server;
// server.run(8000);
#ifndef LIB_SKEWED_BASIC_SERVER_FACTORY
#define LIB_SKEWED_BASIC_SERVER_FACTORY
#include "protocol.h"
#include "server_factory.h"
... | true |
b48c8592f529beb2026510b04a7ace265c21358d | C++ | 0x1F9F1/mem | /include/mem/hasher.h | UTF-8 | 2,473 | 2.65625 | 3 | [
"MIT"
] | permissive | /*
Copyright 2018 Brick
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribut... | true |
f365c1aa28867b1d384384e6b51223c67736a0ab | C++ | danache/coding | /剑指offer/二叉搜索树与双向链表/二叉搜索树与双向链表/main.cpp | UTF-8 | 1,150 | 3.109375 | 3 | [] | no_license | //
// main.cpp
// 二叉搜索树与双向链表
//
// Created by 萧天牧 on 17/5/16.
// Copyright © 2017年 萧天牧. All rights reserved.
//
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(N... | true |
ea91b547446f265f370d07079073877a402524dc | C++ | XinweiC/Small-Projects | /ThreadsTransform2D/threadDFT2d.cc | UTF-8 | 6,521 | 3.265625 | 3 | [] | no_license | // Threaded two-dimensional Discrete FFT transform
// Xinwei Chen
// ECE8893 Project 2
#include <iostream>
#include <string>
#include <math.h>
#include <pthread.h>
#include "Complex.h"
#include "InputImage.h"
// You will likely need global variables indicating how
// many threads there are, and a Complex* that point... | true |
5736421a76f1d1e0a5001eb7fd2de32293d27699 | C++ | doughodson/mat4-utils | /src/writer.cpp | UTF-8 | 1,640 | 2.765625 | 3 | [] | no_license |
//-------------------------------------------------------
// writes a valid matlab version 4 file
//-------------------------------------------------------
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstdint>
#include "utils.hpp"
int main(int argc, char** argv)
{
std::co... | true |
9fa04bb55ffb1178d0e4e8c5d04b64c0b7fec4d6 | C++ | ChrisYoungGH/LeetCode | /tag/Tree/SameTree.cc | UTF-8 | 2,407 | 3.859375 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
using namespace std;
/**
* Definition for a binary tree node.
*/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
void preorder(TreeNode... | true |
65ccfbc93d7eb4edac7d5f23fd4921afb42143df | C++ | amadues2013/Arduino | /Heatbeat/applet/Heatbeat.cpp | UTF-8 | 4,391 | 2.90625 | 3 | [] | no_license | /*
Heartbeat :: I <3 Lilypad
This is the code for creating a Heartbeat using textile buttons and blinking it back with a textile Perfboard heart.
by troykyo
http://www.troykyo.net
*/
#include "WProgram.h"
void setup();
void loop ();
void loop ();
const int buttonPin1 = 15; // the number of the pushbutton pin
... | true |
68f7a2fa184a0dad83a2297c61618d7307328ce3 | C++ | Lemmibl/TCPChatServer | /TCPChatServer/Network/PacketTypes/UserDataPacket.cpp | UTF-8 | 2,295 | 2.90625 | 3 | [
"MIT"
] | permissive | #include "UserDataPacket.h"
UserDataPacket::UserDataPacket(CEGUI::String text, CEGUI::argb_t color, UserID senderID)
: Packet(PacketType::USER_DATA, (sizeof(color)+text.size()), senderID)
{
Serialize(text, color);
}
UserDataPacket::UserDataPacket(char* inData, int dataSize, UserID senderID)
: Packet(PacketType::U... | true |
d4693565db5bbf668d0ca023660e1e24ca20451d | C++ | sshjj/note | /leetcode/剑指offer/48最长不含重复字符的子字符串.cpp | UTF-8 | 708 | 3.65625 | 4 | [] | no_license | 请从字符串中找出一个最长的不包含重复字符的子字符串,计算该最长子字符串的长度。
示例 1:
输入: "abcabcbb"
输出: 3
解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。
示例 2:
输入: "bbbbb"
输出: 1
解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。
class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_map<char,int>hash;
int res = 0;
for(int i =0 ,j =0;j<... | true |
85818aba3db85e47be38e070de93fce4c988d241 | C++ | heis125/Grafy | /Grafy/Grafy.cpp | UTF-8 | 1,600 | 2.53125 | 3 | [] | no_license | //
//
#include "pch.h"
int main()
{
clock_t start;
long double czas_trwania;
srand((int)time(NULL));
double gestosc = 0.5; // gestość grafu watrość od 0 do 1 !
int ile_wierzcholkow = 25; // ilosc wierzchołków grafu
int ile_krawedzi = (int)((ile_wierzcholkow*(ile_wierzcholkow - 1))*gestosc); // liczenie ile je... | true |
1d7fc3fd741e5f9e40f29ef9ec6fbe53d01dfafd | C++ | avinashvrm/Data-Structure-And-algorithm | /Dynamic Programming/Minimum Cost to Cut a Stick.cpp | UTF-8 | 2,094 | 3.75 | 4 | [] | no_license | /*Given a wooden stick of length n units. The stick is labelled from 0 to n. For example, a stick of length 6 is labelled as follows:
Given an integer array cuts where cuts[i] denotes a position you should perform a cut at.
You should perform the cuts in order, you can change the order of the cuts as you wish.
The co... | true |
3557830949e02057066d6a5b03cc48d1d7f59bb0 | C++ | roiser/libcxx | /test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp | UTF-8 | 2,274 | 2.875 | 3 | [
"NCSA",
"MIT"
] | permissive | //===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------... | true |
5920b9495f3bac752db833dd8c524944b4332e4d | C++ | Johannyjm/c-pro | /AtCoder/abc/abc187/old/e2.cpp | UTF-8 | 1,831 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
int n;
vector<vector<int>> g;
vector<bool> seen;
vector<int> rooted_tree(){
vector<int> ret(n);
ret[0] = -1;
seen.assign(n, false);
seen[0... | true |
1b43648187e60bf6399105bc04a36434357caf67 | C++ | baxton/test | /test_lr.cpp | UTF-8 | 4,457 | 2.625 | 3 | [] | no_license |
//
// g++ -DTESTS --std=c++0x -W -Wall -Wno-sign-compare -O2 -s -pipe -mmmx -msse -msse2 -msse3 proto.cpp -o proto.exe
// g++ -DEMUL --std=c++0x -W -Wall -Wno-sign-compare -O2 -s -pipe -mmmx -msse -msse2 -msse3 proto.cpp -o proto.exe
//
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#incl... | true |
cd0c102a30bbc683865ef9d8eb0e831b43835dfc | C++ | waxsf/ctci | /1_21.cpp | UTF-8 | 282 | 3.359375 | 3 | [] | no_license | #include<iostream>
using namespace std;
void reverse(char *s)
{
char *p = s,*q = s;
char c;
while(*q)
{
q++;
}
q--;
while(p < q)
{
cout<<c<<endl;
c = *p;
*p = *q;
*q = c;
q--;
p++;
}
}
int main()
{
char s[] = "1234567";
reverse(s);
cout<<s<<endl;
}
| true |
fbd360aa4520afb930a513ac777b9c62374c4589 | C++ | AaronBui-gif/GroupAssn2SED | /GroupAssn2SED/AccountList.h | UTF-8 | 710 | 2.671875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#include <vector>
#include "Account.h"
using namespace std;
enum AccountType {
Regular,
Guest,
Vip
};
class AccountList {
private:
vector<Account*> accountList;
int numAccount;
string filename;
AccountType accountType;
int id;
public:
AccountList();
Account... | true |
95c80f97dd93e337fdb921cb7543bbaeda28e0ab | C++ | ledungsbacken/linkedList | /LinkedList.cpp | UTF-8 | 1,370 | 3.515625 | 4 | [] | no_license | #include "LinkedList.h"
void LinkedList::add(string data) {
this->cursor = new Node(data);
if(this->getNumberOfNodes() > 0) {
this->tail->setNext(this->cursor);
} else {
this->head = this->cursor;
}
this->tail = this->cursor;
this->numberOfNodes++;
}
void LinkedL... | true |
c31c3c5936d5bcee5c0a42f92046eaa694623335 | C++ | jasy/gcj | /gcj2010QRA.cpp | UTF-8 | 290 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <string>
int main () {
int T;
std::cin >> T;
for (int x=1; x<=T; ++x) {
unsigned long N,K;
std::cin >> N >> K;
unsigned long l = (1ul<<N)-1;
std::string y = (K & l)==l? "ON": "OFF";
std::cout << "Case #" << x << ": " << y << "\n";
}
return 0;
}
| true |
28ac880ab90d329d92256c6c1ba8193ae627a0db | C++ | WhiZTiM/coliru | /Archive2/fa/759f6207e206a2/main.cpp | UTF-8 | 769 | 4.0625 | 4 | [] | no_license | #include <iostream>
int main( int, char** )
{
using namespace std;
// The lambda function is what appears on the right side of the equals
// sign, but the type of "fn" is called a closure. Important to remember
// what a closure is.
auto fn1 = []{};
// We can call it like a regular fu... | true |
7fcf78145088895f6bde619e9a4ce387d6d8e350 | C++ | sailesh2/CompetitiveCode | /2020/lcContest147B.cpp | UTF-8 | 1,638 | 2.984375 | 3 | [] | no_license | class Solution {
private:
pair<int,int> getPos(char alphabet){
return make_pair((alphabet-'a')/5,(alphabet-'a')%5);
}
public:
string alphabetBoardPath(string target) {
int r=0,c=0;
string ans="";
for(int i=0;i<target.length();i++){
pair<int,int> dest=g... | true |
9040e960201e2a078b6824e35a3ca40c7c69c096 | C++ | vgeirnaert/arduino_test | /TickableService.cpp | UTF-8 | 479 | 2.8125 | 3 | [] | no_license | #include "TickableService.h"
void TickableService::setInterval(unsigned int tickIntervalMillis) {
interval = tickIntervalMillis;
}
void TickableService::tick(Context context) {
// handle overflow after x time
if(context.currentTime < previousTickMillis) {
previousTickMillis = 0;
}
// trigger onTick onl... | true |
dafe86315aa3bfeff532d464614d280fbbe9fac6 | C++ | shrey/templates_cpp | /ConceptsAndQuestions/graphs/shortest_path_prime.cpp | UTF-8 | 2,565 | 3.03125 | 3 | [] | no_license | //https://www.geeksforgeeks.org/shortest-path-reach-one-prime-changing-single-digit-time/
//Shrey Dubey
//Contact Me at wshrey09@gmail.com
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<list>
#include<iomanip>
#include<queue>
... | true |
6f23e03f378a13cacca5434f99df22b653b22305 | C++ | Lukaviy/problem-agitator | /engine.h | UTF-8 | 10,215 | 3.140625 | 3 | [] | no_license | #pragma once
#include <vector>
#include <ostream>
template <typename T>
T constrain(T min, T max, T val) {
return val > max ? max : val < min ? min : val;
}
template <typename T>
int cmp_range(T min, T max, T val) {
return val > max ? 1 : val < min ? -1 : 0;
}
namespace GameEngine {
class GameEngineException {}... | true |
f636e7a48822e0c97d6d1254b1ef2f6ffc000965 | C++ | VictorAlvizo/Ventura | /Ventura/src/Camera.h | UTF-8 | 1,291 | 3.265625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Vendor/glm/glm.hpp"
#include "Vendor/glm/gtc/matrix_transform.hpp"
#include "Entity.h"
class Camera {
public:
//Default constructer of the camera, should not use it if planning to use
Camera();
//Provide the position, the window size, and an entity to follow (if there is one)
Camera(glm::vec... | true |
41fc0c12f9232ad24be3816bcf274943ef047ba2 | C++ | jameskr97/etterna | /src/archutils/Darwin/DarwinThreadHelpers.h | UTF-8 | 814 | 3.0625 | 3 | [
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef DARWIN_THREAD_HELPERS_H
#define DARWIN_THREAD_HELPERS_H
/**
* @brief Attempt to suspend the specified thread.
* @param threadHandle the thread to suspend.
* @return true if the thread is suspended, false otherwise. */
bool
SuspendThread(uint64_t threadHandle);
/**
* @brief Attempt to resume the specified t... | true |