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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
386389af980021b0ed5e2d3a84cf58d020595f49 | C++ | Gressee/WallpGen | /src/bmp_image.h | UTF-8 | 1,702 | 3.375 | 3 | [] | no_license | /*
Code from
https://www.youtube.com/watch?v=vqT5j38bWGg&t=1142s
*/
#pragma once
#include <vector>
#include <string>
#include <cstdint>
using namespace std;
// strcut that stores th rgb values of a pixel
// The range of rgb is 0.0 - 1.0
struct Pixel {
double r;
double g;
double b;
double a;
};
c... | true |
da18f3ad96f8f27d10bd60795884618c92534366 | C++ | kamomil/Hackerrank-leetcode | /longest-increasing-subsequent/longest-increasing-subsequent.cpp | UTF-8 | 991 | 3.234375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
/*
Solution to https://www.hackerrank.com/challenges/longest-increasing-subsequent/problem
based on: https://stackoverflow.com/questions/2631726/how-to-determine-the-longest-increasing-subsequence-using-... | true |
36a0cbf6127b12d9b85076167acef46c207554f6 | C++ | gitqwerty777/Online-Judge-Code | /categorized/[Simple] 10018-Reverse-And-Add.cpp | UTF-8 | 889 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
int N;
char in[20];
bool check_sym(char* sum){
int len = strlen(sum);
for(int i = 0; i*2 <= len; i++){
if(sum[i] != sum[len-i-1])
return false;
}
return true;
}
void Reverse_And_Add(){
char sum[20];
strcpy(sum, in);
int count = 0;
while(!check_sym(s... | true |
d9d2cf0d4767a1ab79c7fa89c2c90143d747d626 | C++ | spokoynj/OSU-Projects | /CS 162 - Intro to CS II/Assignment 1/main.cpp | UTF-8 | 3,822 | 3.46875 | 3 | [] | no_license | /*********************************************************************
** Program Filename: main.cpp
** Author: Jessica Spokoyny
** Date: 01/14/16
** Description: Assignment 1: Implementation of Conway's Game of Life
** Input:
** Output:
*********************************************************************/
#in... | true |
d91839f4bf082c59e4c02714eb9bd8eacdc3c9cb | C++ | RantNRave31/beladysAnomaly | /b4.cpp | UTF-8 | 3,130 | 3.4375 | 3 | [] | no_license | #include<iostream>
#include<deque>
#include<unordered_map>
#include<vector>
#include<random>
#include<time.h>
void printAnomaly(int i, int j, int faultStorage, int faultCounter){
std::cout << "Anomaly Discovered" << std::endl;
std::cout << "Sequence:" << i << std::endl;
std::cout << "\tPage Faults:" << faultStorage... | true |
0754bb00feb2b4a56afe8a882e17252eefa7b56f | C++ | wwhhh/DX11 | /Codes/Client/DX/Events/EventManager.cpp | UTF-8 | 1,594 | 2.671875 | 3 | [] | no_license | #include "PCH.h"
#include "EventManager.h"
EventManager* EventManager::m_spEventManager = 0;
EventManager::EventManager()
{
if (!m_spEventManager)
m_spEventManager = this;
}
EventManager::~EventManager()
{
for (unsigned int e = 0; e < NUM_EVENTS; e++) {
for (unsigned int i = 0; i < m_EventHan... | true |
dd6b87a5d1346f34a932a62ecec204ef73af10ab | C++ | tajirhas9/Problem-Solving-and-Programming-Practice | /Algorithms/Graph Theory/Lowest Common Ancestor (LCA).cpp | UTF-8 | 1,257 | 3.0625 | 3 | [] | no_license | /*
* The nodes are to be 0-based.
*/
class LowestCommonAncestor {
vector < vector < int > > graph;
int nodes;
vector < int > size , depth , tin , tout;
int timer,max_anc=0;
vector < vector < int > > anc;
vector < bool > vis;
void dfs(int u , int par = 1 , int d = 0) {
vis[u] = true;
depth[u] = d;
tin[... | true |
d4df4d1b0fd06f6c3b20449a8c5d92c7d0463dc0 | C++ | opendarkeden/server | /src/server/gameserver/quest/ActionGiveNewbieItem.cpp | UHC | 9,840 | 2.59375 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////////////////
// Filename : ActionGiveNewbieItem.cpp
// Written By :
// Description :
////////////////////////////////////////////////////////////////////////////////
#include "ActionGiveNewbieItem.h"
#include "Slayer.h"
#include "FlagSet.h"
#incl... | true |
d860c82041364df38bde492410cd668534dce23f | C++ | Jung-Woo-sik/CNU-assistant | /Object_Oriented_Programing/assignment4/asssignment/ShapePattern.cpp | UTF-8 | 236 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #include "ShapePattern.h"
//set up the default pattern as '*' star
ShapePattern::ShapePattern()
{
pattern = '*';
}
void ShapePattern::set_pattern(char c)
{
pattern = c;
}
char ShapePattern::get_pattern() const
{
return pattern;
}
| true |
2b2a101575c4b72a845efcd3fe571fbe5cd4aa9e | C++ | wangoasis/cpp_primer_practice | /ch_12/ex12_20.cpp | UTF-8 | 519 | 3.296875 | 3 | [] | no_license | //Exercise 12.20
//Write a program that reads an input file a line at a time into a StrBlob and uses a StrBlobPtr to point to ench element in that StrBlob
#include <fstream>
#include <iostream>
#include "ch12_StrBlob.h"
int main() {
std::ifstream ifs("ex11_33_inputFile.txt");
StrBlob blob;
for(std::stri... | true |
b549a7b5ad6823a570e9e4cec8c8c851f1028da5 | C++ | Bourns-A/LeetCode | /Dynamic_Programming/518.Coin-Change-2/518.Coin-Change-2.cpp | UTF-8 | 364 | 2.734375 | 3 | [] | no_license | class Solution {
public:
int change(int amount, vector<int>& coins)
{
vector<int>dp(amount+1,0);
dp[0] = 1;
for (int coin: coins)
{
for (int i=1; i<=amount; i++)
{
if (i>=coin)
dp[i] += dp[i-coin];
}
... | true |
5bdddff8d36256e1e73d6374b3a9caaa6deee4c9 | C++ | angelinaserova/aip_lessons | /week1task8d_AiP/task8d_AiP/task8d_AiP.cpp | UTF-8 | 594 | 3.015625 | 3 | [] | no_license | /*Вычислите значение выражения:
(abs(x-5)-sin(x))/3+sqrt(x*x+2014)*cos(2*x)-3
*/
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
std::cout << "vvedite x"<< std::endl;
float x;
std::ofstream fo;
std::ifstream fi;
cin >> x;
std::c... | true |
1e583d1ec08fd4428522654b72b901d7a405537c | C++ | JeffersonLab/sim-recon | /src/programs/Simulation/mcsmear/DRandom2.h | UTF-8 | 4,329 | 2.921875 | 3 | [] | no_license | // $Id$
//
// Random number generator used in mcsmear. All random numbers
// should come from the global "gDRandom" object declared here.
//
// Because we want to record the seeds used for every event,
// we use the TRandom2 class. This one has only 3 seed values
// (as opposed to 24 for TRandom1 and 624 for TRandom3)... | true |
35c90df3bf8902ec3ae03aae7d8de4d7ad791e45 | C++ | wszdwp/algm_practice | /ctci_c++/q4.6.cpp | UTF-8 | 2,800 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <map>
#include <cstring>
using namespace std;
const int maxn = 10;
typedef struct tNode
{
int data;
tNode *lchild;
tNode *rchild;
tNode *parent;
}tNode;
tNode *p, node[maxn];
int cnt;
tNode* init(){
p = NULL;
memset(node, '\0', sizeof(node));
cnt = 0;
}
void create_minimal_t... | true |
8c8666d92859c02d7e6e5351c4f02c7c6c4b6a05 | C++ | IshidaTakuto/Works | /吉田学園情報ビジネス専門学校_石田琢人/ゲーム/05_3Dアクション_チーム制作/開発環境/rain.cpp | SHIFT_JIS | 5,090 | 2.8125 | 3 | [] | no_license | //=============================================================================
//
// J [rain.cpp]
// Author : TAKUTO ISHIDA
//
//=============================================================================
#include "rain.h"
//*****************************************************************************
// }N`
//****... | true |
854003ff335b49e3cc3e7a599bbc23024a6635a0 | C++ | TimHollies/ngraph.native | /src/layout.cc | UTF-8 | 5,344 | 2.703125 | 3 | [
"MIT"
] | permissive | //
// layout.cpp
// layout++
//
// Created by Andrei Kashcha on 5/21/15.
// Copyright (c) 2015 Andrei Kashcha. All rights reserved.
//
#include "layout.h"
#include <iostream>
#include <cmath>
#include <map>
Layout::Layout() :tree(settings) {}
void Layout::init(int* bodyIds, size_t bodyIdSize, int* links, long si... | true |
fafb22ccb0389ec078985eeedc205bdbf21be5f7 | C++ | zeel01/ChristmasLights | /Twinkle.hpp | UTF-8 | 950 | 2.65625 | 3 | [
"MIT"
] | permissive | #ifndef TWINKLE
#define TWINKLE
#include "Animate.hpp"
#include "MacroStrand.hpp"
#include "Star.hpp"
#include "AnimList.hpp"
struct Twinkle : public Animation {
MacroStrand* lights;
AnimList stars;
int density;
int pts;
int temp;
int delay;
int time;
Twinkle(MacroStrand* lts, int d) : lights(lts), densit... | true |
aac6ee403d7345043fd0f69cb990d9a5c75b07bc | C++ | spiralgenetics/biograph | /modules/variants/scaffold.h | UTF-8 | 3,731 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | #pragma once
#include "modules/variants/assemble.h"
namespace variants {
class scaffold {
public:
struct extent {
aoffset_t offset = 0;
dna_slice sequence;
};
class iterator {
public:
iterator() = default;
iterator(const iterator&) = default;
iterator& operator=(const iterator&) = defa... | true |
728090dd979c9ca098df7301bd7a571077d554c7 | C++ | FranklinBF/SocialForceModel | /vecmath/Vector2.h | UTF-8 | 4,573 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | /*
Copyright (C) 1997,1998,1999
Kenji Hiranabe, Eiwa System Management, Inc.
This program is free software.
Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),
conforming to the Java(TM) 3D API specification by Sun Microsystems.
Permission to use, copy, modify, distribute and sell this softwa... | true |
a526bbbf0f61c8198122abfb0f1e73c507bf50da | C++ | AbsoluteNeutral/ZEngine | /ZeroGraphicEngine/ZeroGraphicEngine/HashString.cpp | UTF-8 | 4,108 | 2.6875 | 3 | [] | no_license |
#include "stdafx.h"
#include "HashString.h"
#include "Logging.h"
#include <unordered_map>
static std::unordered_map<size_t, std::string> GLOBAL_HASH_STRING_TABLE;
static std::unordered_map<size_t, std::string> GLOBAL_HASH_STRING_TABLE2;
static std::unordered_map<size_t, std::string> GLOBAL_HASH_STRING_TAB... | true |
55b346529db4ac614aa8887e925d48c331c72550 | C++ | nodamushi/nsvd-reader | /include/nodamushi/svd/normalized/Enumeration.hpp | UTF-8 | 3,493 | 2.75 | 3 | [
"CC0-1.0"
] | permissive | /*!
@brief Normalized enumerationValues element
@file nodamushi/svd/normalized/Enumeration.hpp
*/
/*
* These codes are licensed under CC0.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifndef NODAMUSHI_SVD_NORMALIZED_ENUMERATION_HPP
#define NODAMUSHI_SVD_NORMALIZED_ENUMERATION_HPP
# include <string>
... | true |
7e5b27bacc98d077a36badaae6f6f605f56a7b9a | C++ | wyaadarsh/LeetCode-Solutions | /C++/1518-Water-Bottles/soln.cpp | UTF-8 | 424 | 2.625 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int numWaterBottles(int nfulls, int exchange) {
int nempties = 0;
int ndrinks = 0;
while(nfulls > 0) {
nempties += nfulls;
ndrinks += nfulls;
nfulls = 0;
if(nempties >= exchange) {
nfulls += nempties / e... | true |
5236a1c79382cdc52793dd82dc5f88e7096effc7 | C++ | acctouhou/Introduction-to-Computers-and-Programming | /HW/HW7/1.cpp | UTF-8 | 537 | 2.859375 | 3 | [] | no_license | #include <stdio.h>
#include <ctime>
#include <cstdlib>
int main(){
int die,temp_1=0,temp_2=0,temp_3=0,temp_4=0,temp_5=0,temp_6=0;
srand(time(NULL));
for(int i=1;i<=6000;i++){
die=rand()%6+1;
switch(die){
case 1:
temp_1++;
break;
case 2:
temp_2++;
break;
case 3:
temp_3++;
break;
... | true |
485a0233d41ac99881b7a07004ed4fa9b5ea8e15 | C++ | lukarolak/GameEngine | /EngineCode/Synchronization/SynchronizationObjectsGroup.cpp | UTF-8 | 2,129 | 2.71875 | 3 | [] | no_license | #include <Synchronization/SynchronizationObjects.h>
#include <Debuging/Assert.h>
#include <Synchronization/SynchronizationObjectsGroup.h>
#include <Debuging/Assert.h>
void CSynchronizationObjects::CreateSynchronnizationObjects(const VkDevice& Device)
{
VkSemaphoreCreateInfo semaphoreInfo = {};
semaphoreInfo.sType = V... | true |
0eac5e6ccad5ca9d056feb23533e8e9d24f2fda6 | C++ | jewon/2018-1_DS | /DS_Lab_Assignment/Application.h | UHC | 1,235 | 2.75 | 3 | [] | no_license | #ifndef _APPLICATION_H
#define _APPLICATION_H
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#include "AVL.h"
#include "ConferenceType.h"
#include "MoreFeatures.h"
#include "Admin.h"
#define FILENAMESIZE 1024
/**
* мȸ ø̼ Ŭ
*/
class Application
{
public:
/**
* ⺻
*/
Application... | true |
b80f27bb66001e09d44ee3611e86f4c77840f6cd | C++ | github188/DotaGame | /GameServer/MySql/ConnectionBuilder.h | UTF-8 | 822 | 2.859375 | 3 | [] | no_license | #ifndef _MYSQL_CONNECTION_BUILDER_H_
#define _MYSQL_CONNECTION_BUILDER_H_
#include <string>
namespace MySql
{
#ifdef SetPort
#undef SetPort
#endif
class ConnectionBuilder
{
public:
ConnectionBuilder();
~ConnectionBuilder();
void SetHostName(const std::string& hostname);
const std::string& GetHostName();
void... | true |
ba71ae3175e93f2791eab7fe83ed154e9e4ee685 | C++ | juli27/basaltcpp | /libruntime/basalt/gfx/device_state_cache.h | UTF-8 | 1,945 | 2.5625 | 3 | [] | no_license | #pragma once
#include <basalt/api/gfx/backend/types.h>
#include <basalt/api/shared/color.h>
#include <basalt/api/math/matrix4x4.h>
#include <basalt/api/base/enum_array.h>
#include <basalt/api/base/types.h>
#include <array>
#include <optional>
namespace basalt::gfx {
struct DeviceStateCache final {
DeviceStateC... | true |
486735c05729fd52b0d6237c1825d7d81dcd8ed1 | C++ | KyleLeongZ/Operating-System | /lock_and_multithreading/p2_threads.cpp | UTF-8 | 7,142 | 2.8125 | 3 | [] | no_license | #include "p2_threads.h"
#include "utils.h"
extern pthread_cond_t cond;
extern pthread_mutex_t mutex;
extern int gender_in_que[2];
extern int size_each;
extern int queue_num;
extern int room_gender;
extern int man_used;
extern int woman_used;
extern int man_in_room;
extern int woman_in_room;
extern int occupied_r... | true |
6f2b6a64225456d94eb1c52f83b4ab010aaade36 | C++ | AlexLiuyuren/Graphics | /Graphics/point.h | UTF-8 | 359 | 2.609375 | 3 | [] | no_license | #pragma once
#include "gl/glut.h"
#include "common.h"
class Point {
public:
int x;
int y;
Point(int x, int y) : x(x), y(y) {};
Point() {};
void draw(int color = -1);
Point add(int dx, int dy) const;
Point rotate(const Point &p, double theta) const;
Point scale(const Point &p, double frac) const;
bool valid();... | true |
1c7801088fcc678c24f32e158afe53b20c1ced1a | C++ | Ritikkumar992/DSA-Fundamental- | /C++ Code With Harry/tut15.cpp | UTF-8 | 775 | 4.03125 | 4 | [] | no_license | #include <iostream>
using namespace std;
//Function prototype
//type function_name(arguments);
// int sum(int a, int b);---->> Acceptable
// int sum(int a, b);---->>not acceptacle
// int sum(int,int);---->>Acceptable
int sum(int a, int b);
void g (void);
int main(){
int num1,num2;
cout<<"E... | true |
bdfbfc6fed9845bc66226e590b905cc66290d823 | C++ | shubhamguptaji/CPP | /try_throw.cpp | UTF-8 | 200 | 2.859375 | 3 | [] | no_license | #include<iostream>
using namespace std;
main()
{
int x,y,z;
cin>>x>>y>>z;
try
{
if(x-y!=0)
{
cout<<"Result :"<<z/(x-y);
}
else
throw(x-y);
}
catch(int i)
{
cout<<"Exception Caught\n";
}
cout<<"end";
} | true |
beb19e3b22c91bce0eb9a9a8b87f411c21acbdd7 | C++ | 3232731490/CPP | /数组/输入一个字符串,逆序打印.cpp | UTF-8 | 788 | 3.484375 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main()
{
//字符数组。。。。。
/*char str[80];
cout << "请输入您要输入几个字符:" << endl;
int n;
cin >> n;
cout<<"请输入一个有"<<n<<"个字符的字符串:"<<endl;
for (int i = 0; i < n; i++)
cin >> str[i];
cout << "逆序排列前为:" << endl;
for (int i = 0; i < n; i++)
cout << str[i];
for ... | true |
1ba0c3f9d69bc7a05f32af6d9d21aa85cfd7cab0 | C++ | BalitskyIvan/CPP-modules | /module 05/ex03/RobotomyRequestForm.cpp | UTF-8 | 737 | 2.71875 | 3 | [] | no_license | //
// Created by Lonmouth Mallador on 1/20/21.
//
#include "RobotomyRequestForm.hpp"
RobotomyRequestForm::RobotomyRequestForm(const std::string &name) : Form(name, 72, 45) {}
Form *RobotomyRequestForm::clone(std::string &name) const {
return new RobotomyRequestForm(name);
}
bool RobotomyRequestForm::beSigned(Burea... | true |
7590564fe7055d506958548dfd4585696997a077 | C++ | Matt-Ceck63/GestureControlledCar | /CarReceiverCode/CarReceiverCode.ino | UTF-8 | 6,883 | 2.53125 | 3 | [] | no_license | #include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(7, 8);
const uint64_t writing_pipe = 0xF0F0F0F0E1LL;
//DRV-8833 inputs
// Left motor
int in1 = 3;
int in2 = 5;
// Right motor
int in3 = 6;
int in4 = 9;
int speedLeft = 0;
int speedRight = 0;
void setup() {
Serial.begin(9600)... | true |
18d1d2e43ddc788294e1b2f6c58f24675ab26459 | C++ | IFlowLikeH2O/Johnbui | /Ping_Pong.ino | UTF-8 | 2,632 | 2.875 | 3 | [] | no_license | #include <LedControl.h>
#include <Timer.h>
/* LED board set up */
int DIN = 11, CLK = 9, CS = 10, devices = 1;
LedControl lc = LedControl(DIN, CLK, CS, devices);
/* Definitions */
#define controlPin A2
#define debug 1
/* Creates an instance or event of time */
Timer timer;
/* Variable delcarations */
byte ba... | true |
7b2b325d7ea2a54f16c7557560a0dddd01a37fb4 | C++ | 19and99/ImagenomicProject1 | /BWConverter.cpp | UTF-8 | 557 | 2.890625 | 3 | [] | no_license | #include "stdafx.h"
#include "BWConverter.h"
BWConverter::BWConverter()
{
}
BWConverter::BWConverter(GenericImage* image_)
:GenericFilter(image_)
{
}
void BWConverter::filter() {
pixel pixel;
unsigned char gray = 0;
for (int i = 0; i < image->GetWidth(); ++i) {
for (int j = 0; j < image->GetH... | true |
4b5329010f8ac086b22552bf357fa415ad16ea02 | C++ | KANAIHIROYUKI/STM32 | /ふるい/F103_CanNode_rev1.1/user/user_app/inc/canNodeEncoder.cpp | UTF-8 | 961 | 2.625 | 3 | [] | no_license | #include "canNodeEncoder.h"
int16_t CanNodeEncoder::setup(TIM &enc,CAN &can,uint16_t address){
this->canEnc_can = &can;
this->canEnc_enc = &enc;
canEnc_address = address;
canEnc_can->filterAdd(canEnc_address);
return 0;
}
void CanNodeEncoder::cycle(){
if(canEnc_intervalTimer != 0){
if(canEnc_intervalTimer... | true |
7a7ece7562688a154e7dfd8c825797bf7bea5a44 | C++ | LukasGrudtner/iotAuth | /utils.cpp | UTF-8 | 2,885 | 3.703125 | 4 | [] | no_license | #include "utils.h"
/* Char to Uint_8t
Converte um array de chars para um array de uint8_t.
*/
void CharToUint8_t(char* charArray, uint8_t* byteArray, int size)
{
for (int i = 0; i < size; i++) {
byteArray[i] = uint8_t(charArray[i]);
}
}
/* Uint8_t to Hex String
Converte um array de uint8_t e... | true |
6f46b167e9121473dd961c051e1336e6741592e6 | C++ | sandesh32/DSA-Problems-and-Solutions | /leetcode171.cpp | UTF-8 | 1,062 | 3.484375 | 3 | [] | no_license | /** Given a string columnTitle that represents the column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Input: columnTitle = "A"
Output: 1
Example 2:
Input: columnTitle = "AB"
Output: 28
Example 3:
Input... | true |
19086eaf8aadacc2594bdaacc1c6a54aa4f76af0 | C++ | DhaliwalX/copta | /include/jast/ir/instruction.h | UTF-8 | 6,070 | 2.78125 | 3 | [
"MIT"
] | permissive | #ifndef INSTRUCTION_H_
#define INSTRUCTION_H_
#include "jast/types/type.h"
#include "jast/ir/value.h"
#include "jast/ir/function.h"
#include "jast/types/type-system.h"
namespace jast {
class BasicBlock;
class Function;
enum class OpCode {
#define R(I, _) k##I,
#include "instructions.h"
};
static inline std::string... | true |
b8705993bf4b595e4d5211132d95468f18631c3d | C++ | johnhany/leetcode | /714-Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee/solution.cpp | UTF-8 | 532 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #include "solution.hpp"
static auto x = []() {
// turn off sync
std::ios::sync_with_stdio(false);
// untie in/out streams
cin.tie(NULL);
return 0;
}();
// https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iii/solution/zui-jian-dan-2-ge-bian-liang-jie-jue-suo-71fe/
int Solution::maxProfit(vector<i... | true |
9d23d05561b2716311274da78287f6dbf8637db9 | C++ | salgotrav/my_progs_for_IS-HR | /triquery.cpp | UTF-8 | 1,567 | 2.859375 | 3 | [] | no_license | #include<iostream>
//#include<utility>
//#include<vector>
#include<cstdio>
using namespace std;
//#define DEBUG_MODE
int main()
{
int num_points, queries;
//cin>>num_points>>queries;
scanf("%d%d",&num_points,&queries);
//pair<int, int> xy; //coordinates of point
struct xy_pair {
int first;
int se... | true |
7b578c04d00ce78a9bb73f5afd82e021c01e1505 | C++ | amir5200fx/Tonb | /TnbPtdModel/TnbLib/PtdModel/FormMaker/PtdModel_FormMaker.cxx | UTF-8 | 1,719 | 2.515625 | 3 | [] | no_license | #include <PtdModel_FormMaker.hxx>
#include <PtdModel_Par.hxx>
#include <TnbError.hxx>
#include <OSstream.hxx>
std::shared_ptr<tnbLib::PtdModel_Par>
tnbLib::PtdModel_FormMaker::Parameter(const word & name) const
{
auto iter = theParameters_.find(name);
if (iter IS_EQUAL theParameters_.end())
{
Info << "parameters... | true |
3b85532a6084e4ccb327171332c272e7abbe404b | C++ | TarunSinghania/Algorithms | /Dynammic Programming standard problems/boxstacking.cpp | UTF-8 | 1,680 | 2.671875 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int maxHeight(int height[],int width[],int length[],int n);
int main()
{
int n;
cin>>n;
int A[1000],B[1000],C[10001];
for(int i=0;i<n;i++)
{
int a,b,c;
cin>>a>>b>>c;
A[i]=a;
B[i]=b;
C[i]=c;
}
cout<<maxHeight(A,B,C,n)<<endl;
}
bool cmp(c... | true |
265f290000b00014c287b8e186016db1f0c7889d | C++ | albertoubedamunoz/UncleOwen | /UncleOwenFarm/uncleOwen-p3.cc | UTF-8 | 967 | 3.046875 | 3 | [] | no_license |
#include <iostream>
#include <cstdlib>
using namespace std;
#include "Farm.h"
#include "Util.h"
void menu(int hour)
{
cout << "-----========== Farm manager ==========-----" << endl
<< "1- List farm info" << endl
<< "2- Add field" << endl
<< "3- Add android" << endl
<< "4- Start working... | true |
7f6db0550bbd7c49afab06d41615962219e66d21 | C++ | KrissKry/p2p-proto | /include/TCPConnector.h | UTF-8 | 1,567 | 2.796875 | 3 | [] | no_license | #ifndef TIN_TCPHANDLER
#define TIN_TCPHANDLER
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <iostream>
#include <sys/socket.h>
#include "Constants.h"
#include "Resource.h"
#include "RandomGenerator.h"
class TCPConnector {
public:
... | true |
9aee1dee7ef906c845340446fd4e77c603634877 | C++ | chriswong604/MineSenseAssignment | /Source/filereader.cpp | UTF-8 | 892 | 3.203125 | 3 | [] | no_license | /**
* Class: FileReader
* Purpose: The FileReader class opens a file and stores every line of the file.
*/
#include "filereader.h"
/**
* FileReader Contructor
* @param source - the file to be read
*/
FileReader::FileReader(QString source)
{
readFile(source);
}
/**
* Method: readFile() - Reads the sour... | true |
f6f74b2218cc065e07155a9236f517fc86f87167 | C++ | Brukols/Epitech-Arcade | /lib/sdl/src/ListLibraries/ListLibraries.cpp | UTF-8 | 6,420 | 2.703125 | 3 | [
"MIT"
] | permissive | /*
** EPITECH PROJECT, 2020
** OOP_arcade_2019
** File description:
** ListLibraries
*/
#include "sdl/ListLibraries.hpp"
#include "sdl/Utility.hpp"
arc::ListLibraries::ListLibraries()
{
initRects();
}
arc::ListLibraries::~ListLibraries()
{
}
void arc::ListLibraries::setFont(const std::string &path)
{
_font ... | true |
c0940c2175a69d77888aba127a538d5333d11846 | C++ | linkenwild/CPPlearn | /EssentialCPP/CH2_Ex5.cc | UTF-8 | 1,183 | 3.484375 | 3 | [] | no_license | //Essential CPP Ch2_Ex5
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
template <typename Type>
inline Type max_( Type t1, Type t2 )
{
return t1 > t2 ? t1 : t2;
}
template <typename elemType>
inline elemType max_( const vector<elemType> &vec )
{
return *max_element... | true |
cdeaee7a5b7e27a9f2de19f3a67a91192cee9f4d | C++ | baluselva-ts/Algorithms | /Graph/FloydWarshall.cpp | UTF-8 | 2,040 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <queue>
#include <map>
#include <stack>
#include <set>
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define ll long long
using namespace std;
void getEdges(vector< vector<int> > &adjacencyMatrix, int numberOfEdges) {
cout << "Enter source, destination (0 ind... | true |
198b9366cf0c8ec3188bbfa1e6f5c70fae312b93 | C++ | darksidersstrife/RayTracer | /src/rendering/camera.h | UTF-8 | 1,723 | 3.25 | 3 | [] | no_license | //
// Created by vvlla on 22.03.2021.
//
#ifndef RAYTRACER_CAMERA_H
#define RAYTRACER_CAMERA_H
#include "../geometry/vector.h"
#include "../geometry/point.h"
//template<typename T, size_t size, size_t alignment = alignof(T)>
struct Camera
{
Vec3f up, direction, left ;
Point3f position;
Camera() : direct... | true |
f4c93264a38303b923875a7fc7eb1c4b39e3cc00 | C++ | hhool/ilias_async | /test/threadpool_intf/instantiate.cc | UTF-8 | 1,416 | 2.96875 | 3 | [] | no_license | #include <ilias/threadpool_intf.h>
#include <utility>
class mock_client
{
public:
class threadpool_client
: public virtual ilias::threadpool_client_intf
{
public:
mock_client* m_self;
threadpool_client(mock_client* self) noexcept
: m_self(self)
{
/* Empty body. */
}
bool
has_work() noexcept
{... | true |
518641bec4f04fc0a7f10297b92d0e8d3408cedb | C++ | Vaur/Raytracer | /src/MsgBox.cpp | UTF-8 | 5,857 | 2.921875 | 3 | [] | no_license | //
// MsgBox.cpp for raytracer in /home/vaur/epitech/inprogress/B-VPP-042/vpp_raytracer
//
// Made by vaur
// Login <vaur@epitech.net>
//
// Started on Sat May 24 13:44:59 2014 vaur
// Last update Mon Jun 23 14:32:48 2014 vaur
//
/** \file MsgBox.cpp
* Functions for class MsgBox
*/
/*
** Include
*/
#include <ma... | true |
711110caab04ca5e4924a599ddc09b39b97bb96e | C++ | Doryaakobi/messageboard-b | /Test.cpp | UTF-8 | 2,056 | 3.171875 | 3 | [
"MIT"
] | permissive | #include "doctest.h"
#include "Board.hpp"
#include <string>
#include <iostream>
#include <stdexcept>
using namespace std;
using namespace ariel;
const int max_message = 100;
const int max_rows = 500;
const int max_column = 500;
const int test = 100;
string gen_random()
{
const int ascii_s = 26;
const int asc... | true |
4fdd39990cca252d540edb145913a03d2dea9732 | C++ | josejovian/algorithm-practice | /520A.cpp | UTF-8 | 342 | 2.515625 | 3 | [] | no_license | #include<stdio.h>
int main() {
int L;
scanf("%d",&L);
getchar();
int x = 0;
char c;
int letter[26] = {0};
int unique = 0;
while(c = getchar()) {
if(c == '\n') break;
if(c >= 'a' && 'z' >= c) c -= 32;
letter[c-'A']++;
if(letter[c-'A']==1) unique++;
}
if(unique==26) printf("YES\n");
else printf("N... | true |
9582cc7b62e9df89834a3cd511c4ac684c7cea43 | C++ | CM4all/libcommon | /src/spawn/Mount.hxx | UTF-8 | 3,853 | 2.578125 | 3 | [] | no_license | // SPDX-License-Identifier: BSD-2-Clause
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#pragma once
#include "translation/Features.hxx"
#include "io/FileDescriptor.hxx"
#include "util/IntrusiveForwardList.hxx"
#include <cstdint>
class AllocatorPtr;
class MatchData;
class VfsBuilder;
struct Mou... | true |
9dc2ad8fe7ec6ed00a630d34fdcf6208a9108800 | C++ | abeaumont/competitive-programming | /kattis/pot.cc | UTF-8 | 367 | 2.6875 | 3 | [
"WTFPL",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // https://open.kattis.com/problems/pot
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
ll sum = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
int p = x % 10;
x = x / 10;
ll prod = 1;
for (int j = 0; j < p; j++) {
prod *= x;
}... | true |
62156e2ccfe7e502389e0e29569ebea1be352a4c | C++ | chaimaj/Mini-RLM | /RLM_Application/Frame.cpp | UTF-8 | 955 | 3.421875 | 3 | [] | no_license | /*
* File: Frame.cpp
* Author: PC-Z510
*
* Created on 4 mars 2015, 17:38
*/
#include "Frame.h"
Frame::Frame() {
width = 0;
height = 0;
frame_str = "";
}
/// Create frame of indicated width and height with string.
Frame::Frame(int new_width, int new_height, string frame_str) {
width = new_w... | true |
da458f9dd255a2951a2c4cceaac9877989969b6f | C++ | KinglittleQ/cs144 | /tests/byte_stream_many_writes.cc | UTF-8 | 1,343 | 2.765625 | 3 | [] | no_license | #include "byte_stream.hh"
#include "byte_stream_test_harness.hh"
#include "util.hh"
#include <exception>
#include <iostream>
using namespace std;
int main() {
try {
auto rd = get_random_generator();
const size_t NREPS = 1000;
const size_t MIN_WRITE = 10;
const size_t MAX_WRITE = 2... | true |
3b0e0cab4811a60f95a561bb6c93d070108ec2b0 | C++ | gurnoorsingh8/Pepcoding-Basics | /Foundation/Arrays/rotate.cpp | UTF-8 | 672 | 3.546875 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
void reverse(vector<int>& arr, int i, int j)
{
while(i < j)
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
j--;
}
}
void rotate(vector<int>& arr, int k)
{
int n = arr.size();
k = (k % n + n)... | true |
96a786037ceba42e2a83b5141b3c46d644dd46ae | C++ | Samm07/Code-Library | /longest_increasing_subsequence.cpp | UTF-8 | 627 | 2.59375 | 3 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
FILE *fp;
fp=fopen("input.txt", "r");
int n;
fscanf(fp, "%d\n", &n);
int arr[n];
int i,j;
for(i=0;i<n;i++)
fscanf(fp,"%d ",&arr[i]);
int lis[n];
for(i=0;i<n;i++)
... | true |
b901cf149bd3ee4e2e532232516f3468772b872f | C++ | personalrobotics/chimera | /test/examples/06_template_class/template_class.h | UTF-8 | 397 | 2.59375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #pragma once
#include <vector>
namespace chimera_test
{
template <typename T>
class Vector
{
public:
Vector() = default;
void resize(int dim)
{
m_data.resize(dim);
}
int size() const
{
return m_data.size();
}
private:
std::vector<T> m_data;
};
// Explicit instantia... | true |
58a994546730dd7b066cda80b4782154db3ba0af | C++ | zhongxinghong/LeetCode | /submissions/1442-连通网络的操作次数-88874063.cpp | UTF-8 | 1,616 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* Submission ID: 88874063
* Question ID: 1442
* Question Title: 连通网络的操作次数
* Question URL: https://leetcode-cn.com/problems/number-of-operations-to-make-network-connected/
* Solution Time: 2020-07-18 02:29:03
* Solution Test Result: 36 / 36
* Solution Status: Accepted
* Solution Memory: 59.1 MB
* Solution ... | true |
9da20200b449ee178816a98785394aa94eadd125 | C++ | DimaKolt/github_hw3 | /whatsup_tests/part1test.cpp | UTF-8 | 1,254 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include "PCQueue.hpp"
#include "Semaphore.hpp"
#define N 10
Semaphore s(10);
int x=0;
PCQueue<int>* q = new PCQueue<int>;
void* print_msg(void* i){
s.down();
x++;
for (long j = 0; j <100000000 ; ++j) {
}
if(x > 10)
cout << x << endl;
/*cout << *(int*)i << " and x =... | true |
a888a8a4c6493e9eec04183e442e5f16cdcf8e9a | C++ | qazwsxedc121/leetcode | /cpp/substring_with_concatenation_of_all_words.cpp | UTF-8 | 1,225 | 2.75 | 3 | [] | no_license | class Solution {
private:
bool eq(map<string, int>& m1, map<string, int>& m2){
for(map<string, int>::iterator it = m1.begin(); it != m1.end(); ++it){
if(m2[it->first] != it->second){
return false;
}
}
return true;
}
public:
vector<in... | true |
be3556c1840a77ca387aec015af4b08da4946132 | C++ | HypED-prototyping/navigation | /demo-vector.cpp | UTF-8 | 851 | 3.25 | 3 | [] | no_license | #include "vector.hpp"
#include <iostream>
template <typename T,int N>
void print(Vector<T,N> &v)
{
for(int i=0;i<N;i++)
std::cout << v[i] << '\t';
std::cout << '\n';
}
int main()
{
Vector<int,10> vector1;
Vector<int,10> vector2;
Vector<int,10> vector3;
Vector<double,10> vector4;
print(vector1);... | true |
d98afb4abc97540b28c761627ef4c624b6edcf40 | C++ | JayantGoel001/CodeChef | /Coldplay.cpp | UTF-8 | 187 | 2.65625 | 3 | [] | no_license | #include<iostream>
#include <cmath>
using namespace std;
int main(){
int t;
cin>>t;
while (t--){
float m,s;
cin>>m>>s;
cout<<floor(m/s)<<"\n";
}
} | true |
9565a71962726af7ebf7d53544c34a551f4445e9 | C++ | RaiSW/Crc2Hex2 | /Crc2Hex/CRC16.h | UTF-8 | 242 | 2.578125 | 3 | [] | no_license | #pragma once
#include <iostream>
using namespace std;
class CRC16
{
private:
#define GENERATOR_POLYNOM ((0x8005 / 4) | 0x8000)
public:
uint16_t uiSum;
CRC16(void);
CRC16(uint16_t);
uint16_t Add(uint8_t* pucStart, uint8_t* pucEnd);
};
| true |
36f59d8752cfcb49cef890b11db4d9ccc0f759cc | C++ | reichlab/bayesian_non_parametric | /SIR/.SIR/build_openmp_sse/src/bi/stopper/MinimumESSStopper.hpp | UTF-8 | 2,438 | 2.875 | 3 | [] | no_license | /**
* @file
*
* @author Anthony Lee
* @author Lawrence Murray <lawrence.murray@csiro.au>
*/
#ifndef BI_STOPPER_MINIMUMESSSTOPPER_HPP
#define BI_STOPPER_MINIMUMESSSTOPPER_HPP
#include "../math/constant.hpp"
#include "../math/function.hpp"
namespace bi {
/**
* Stopper based on ESS criterion.
*
* @ingroup method... | true |
41af3a50b0618fb448e7a23098436ada79352af8 | C++ | SrinivasuluCharupally/expert_programming | /module-6/6-13.cpp | UTF-8 | 762 | 3.65625 | 4 | [] | no_license | Question: The probability of a car passing a certain intersection in a 20 minute windows is 0.9. What is the probability of a car passing the intersection in a 5 minute window? (Assuming a constant probability throughout)
Answer: This is one of the basic probability question asked in a software interview. Let’s star... | true |
44af1916d43b68af4dea85a0697a8255a9381185 | C++ | ca-l-eb/networking | /src/http_response.h | UTF-8 | 1,164 | 2.640625 | 3 | [
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"OpenSSL"
] | permissive | #ifndef CMD_HTTP_RESPONSE_H
#define CMD_HTTP_RESPONSE_H
#include <map>
#include <string>
#include <vector>
#include "stream.h"
namespace cmd
{
class http_response
{
public:
http_response();
explicit http_response(cmd::stream &stream);
int status_code();
std::string status_message();
std::string b... | true |
3a0ae8f152ef16a9f0631f438a5bf724d1e22fde | C++ | vicutrinu/pragma-studios | /src/pragma/data/data.cpp | UTF-8 | 13,683 | 2.875 | 3 | [
"MIT"
] | permissive | /*
* data.cpp
* pragma
*
* Created by Victor on 26/12/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include <pragma/types.h>
#include "data.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
namespace pragma
{
//------------------------------------------------------------... | true |
a97abec3635e440106a64f02c8ecbaa8cfb45246 | C++ | dundunnp/answers-to-C-Primer-Plus | /chapter 12 exercise/c12_2/string_c12_2.cpp | UTF-8 | 1,917 | 3.296875 | 3 | [] | no_license | #include "c12_2.h"
#include <cstring>
#include <cctype>
using std::cin;
using std::cout;
String::String(const char* ch)
{
len = strlen(ch);
str = new char[len + 1];
strcpy(str, ch);
}
String::String()
{
len = 0;
str = nullptr;
}
String::String(const String& s)
{
len = s.len;
str = new ch... | true |
f321a52a2b11a1b37e4d4f50757d70be6d0c9037 | C++ | KirilPanika/HardWorkCpp | /...Square.Fibonacci.Maximum.Factorial.cpp | UTF-8 | 1,084 | 3.953125 | 4 | [] | no_license | #include <iostream>
using namespace std;
float square1(float num){
return num * num;
}
float square2(float *num){
return *num * *num;
}
void Fibonacci(int n, int i = 0, int f1 = 0, int f2 = 1){
if (i <= n ) {
if (i == 0) {
cout << 0 << ' ';
Fibonacci(n, i+1, 0, 1);
... | true |
87820533fa482a8ef58c440030212f168c393476 | C++ | feannyn/NAF90_DS2017 | /Assignment_2/List.hpp | UTF-8 | 12,919 | 3.234375 | 3 | [] | no_license | //Nicholas Feanny; Naf16b;
using namespace std;
//helper const iterator constructor (1 parameter)
template<typename T>
List<T>::const_iterator::const_iterator(Node* p )
{
current = p;
}
//helper function retrieve
template<typename T>
T& List<T>::const_iterator::retrieve() const
{
//if I understand this correctly a... | true |
ff04c7eb6ca1c8bc3b87e3371c979ef1343d2e65 | C++ | 1kzpro/international | /Kazybek/COMP 2710/P1/src/project1_Mizam_kzm0099.cpp | UTF-8 | 5,141 | 3.640625 | 4 | [] | no_license | /*
Project 1
@author Kazybek Mizam
@version 08/25/20
Documentation for Pointers: https://www.tutorialspoint.com/cprogramming/c_pointers.htm
Documentation for Prototype: http://www.cplusplus.com/articles/yAqpX9L8/
Documentation for Formatting: https://thispointer.com/c-convert-double-to-string-a... | true |
5375544244aa0f53f13a9a6dc54c958b98e0d87c | C++ | amansaini7999/Data-Structure-and-Algorithms | /fbPrep/interpretations.cpp | UTF-8 | 462 | 3.0625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
void printAllInterpretations(vector<int> v, int pos, string result){
if(pos==v.size()){
cout<<result<<"\n";
return;
}
printAllInterpretations(v, pos+1, result+char(v[pos]+'a'-1));
if(pos+1<v.size() && v[pos]*10+v[pos+1]<=26)
printAllInterpretations(v, ... | true |
59c69405fbec131e7102b03bbde3e4a4611a662e | C++ | Karan-MUJ/InterviewBit-Solutions | /Brackets.cpp | UTF-8 | 854 | 3.375 | 3 | [] | no_license | /*#include <iostream>
#include<stack>
#include<string>
using namespace std;
int main()
{
// your code goes here
string str = "])";
int n = str.size();
stack <char> S;
for (int i = 0; i < n; i++)
{
if (str[i] == '[' || str[i] == '{' || str[i] == '(')
{
S.push(str[i]);
}
else
{
if (S.empty())
... | true |
cdb4b1b3e46931cc91cd0c1cba2611d7d0edbcf9 | C++ | Takagi1/Retribution | /Retribution/Engine/Math/Physics2D.h | UTF-8 | 1,307 | 2.640625 | 3 | [
"MIT",
"BSL-1.0"
] | permissive | #ifndef PHYSICS2D_H
#define PHYSICS2D_H
#include "../Rendering/Component.h"
#include <glm/glm.hpp>
#include <vector>
#include <memory>
class GameObject;
class Physics2D : public Component {
public:
Physics2D(GameObject* parent_);
virtual ~Physics2D();
void Update(const float deltaTime_) override;
//Getters
... | true |
960f3e56f80b6d6d381828178db1995b1647c8b9 | C++ | FangLiu68/OldCode2016 | /LaiOffer/Invert Binary Tree.cpp | UTF-8 | 1,600 | 3.53125 | 4 | [] | no_license | //
// Invert Binary Tree.cpp
// LaiOffer
//
// Created by Fang Liu on 6/18/15.
// Copyright (c) 2015 Fang Liu. All rights reserved.
//
/* invert a binary tree
4
/ \
2 7
/ \ / \
1 3 6 9
invert to
4
/ \
7 2
/ \ / \
9 6 3 1
从最底层向上传值,每次都... | true |
2e6b333b9adcfd008e460d443eb1aa8c5b8e50ed | C++ | constantineg1/Moby | /include/Moby/GeneralizedCCDPlugin.h | UTF-8 | 2,372 | 2.625 | 3 | [] | no_license | /****************************************************************************
* Copyright 2009 Evan Drumwright
* This library is distributed under the terms of the GNU General Public
* License (obtainable from http://www.apache.org/licenses/LICENSE-2.0).
************************************************************... | true |
424caee68b0e731ce9f065b45480818b12e174d2 | C++ | mohammadabdullahjawwad/DSAcpp | /BST/flattenBst.cpp | UTF-8 | 2,002 | 3.9375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class node {
public:
int data;
node* left;
node* right;
node(int d) {
data = d;
left = NULL;
right = NULL;
}
};
node* insert(node* root, int data) {
if(root == NULL) {
return new node(data);
}
if(data <= root->dat... | true |
42188ca8cfe17c4eb80ec4d759f56a66d366709e | C++ | eLRuLL/LeetCode | /maximum-depth-of-binary-tree/a.cpp | UTF-8 | 631 | 3.375 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
int maxDepth(TreeNode *root) {
if(root == NULL){
return 0;
}else{
return 1+ max(maxDepth(root->left),m... | true |
aea089cae23a0485e933751f40e5f03f9dfb720f | C++ | Oureyelet/Chapter-7-Control-Flow-and-Error-Handling--vsCode- | /7.4 — Switch statement basics (vsCode)/first.h | UTF-8 | 2,304 | 4.09375 | 4 | [] | no_license | #include <iostream>
#ifndef FISRT_H
#define FISRT_H
void printDigitName(int x)
{
if(x == 1)
std::cout << "One\n";
else if(x == 2)
std::cout << "Two\n";
else if(x == 3)
std::cout << "Three\n";
else
std::cout << "Unknown\n";
}
/*
C++ provides an alternative condi... | true |
dfe6f8b82e5bb4cc1027b0e81a3394b491681263 | C++ | F1483823457/G5 | /c4/第四章10/第四章10.cpp | UTF-8 | 565 | 2.71875 | 3 | [] | no_license | #include "stdafx.h"
#include<stdio.h>
int main(int argc, char* argv[])
{
int c;
double a;
double b,b1,b2,b3,b4,b5;
scanf("%lf",&a);
b1=100000*0.1;
b2=b1+100000*0.075;
b3=b2+200000*0.05;
b4=b3+200000*0.03;
b5=b4+400000*0.015;
c=a/100000;
if(c>10) c=10;
switch(c)
{
case 0:b=a*0.1;break;
case 1:b=b1+(a-1000... | true |
31fc1a5276eb896649ec40f9a30d229a2a3387b4 | C++ | RazrFalcon/ttf-parser | /testing-tools/font-view/ttfparserfont.cpp | UTF-8 | 3,876 | 2.78125 | 3 | [
"Apache-2.0",
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <QTransform>
#include <QFile>
#include <QDebug>
#include "ttfparserfont.h"
struct Outliner
{
static void moveToFn(float x, float y, void *user)
{
auto self = static_cast<Outliner *>(user);
self->path.moveTo(double(x), double(y));
}
static void lineToFn(float x, float y, void ... | true |
1c71c6f9bb5b9020c4cccba1d7a82e8501ad603c | C++ | mukeshkharita/compiler | /left_recursion_&_fectoring.cpp | UTF-8 | 4,129 | 3.34375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
/*
Given Grammar:
S -> Aa | b
A -> Ac | Sd | ^
*/
#define R 10
vector < string > prod_rules [R]; // stores grammar
map < char, int > rule_no;
int usedChar[26]; // characters already used
int num; // curr num of prod
bool isTerminal(char a)
{
if(a >= 65 && a <= 90)
... | true |
595c8ea8165d1b5124340614e8697cb6666470ee | C++ | lzhpku/leetcode | /round1pass/49. Group Anagrams.cpp | UTF-8 | 521 | 3.015625 | 3 | [] | no_license | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
map<string, multiset<string>> m;
for(int i = 0; i < strs.size(); i ++) {
string s = strs[i];
sort(s.begin(), s.end());
m[s].insert(strs[i]);
}
vector<ve... | true |
373b9ba3c72d3f229ba07c0dad386a9b8bc920b4 | C++ | SKliaznyka/KS.UIP.Cpp.HomeWork | /KS.UIP.Cpp.HomeWork.HW11.CharEnumArrayTask02/KS.UIP.Cpp.HomeWork.HW11.CharEnumArrayTask02.cpp | UTF-8 | 3,029 | 3.1875 | 3 | [] | no_license | // KS.UIP.Cpp.HomeWork.HW11.CharEnumArrayTask02.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//HomeWork 11. Task 02.
//Generate a Password.
//Password rule:
// - 12 symbols;
// - regular letters;
// - capital letters;
// - digits.
//Ask user enter a password. Ask user to ent... | true |
6e38d95c2b579c53a8fc3489f424f610b620cb1f | C++ | ChonQuan/NguyenChonQuan | /PHAN MEM QUAN LY THU VIEN/LibraryObjectData/BorrowReturnData.cpp | UTF-8 | 2,199 | 2.84375 | 3 | [] | no_license | #include "BorrowReturnData.h"
BorrowReturnData::BorrowReturnData() {
_maxID = 0;
_dataBorrowReturn.resize(0);
}
vector<BorrowReturn> BorrowReturnData::GetDataBorrowReturn() {
return _dataBorrowReturn;
}
LibraryObject* BorrowReturnData::GetPointer(int i) {
return &_dataBorrowReturn[i];
}
int BorrowRetur... | true |
52d1f1b486b01470b313a9882b21b4b21f40b9b4 | C++ | CodeOpsTech/DesignPatternsCpp | /cpp/opensourcesrcs/qtchat/src/0.9.7/libwc/wc.h | UTF-8 | 1,867 | 3.109375 | 3 | [] | no_license | #ifndef _WC_H
#define _WC_H
class Word {
public:
Word(const char *str);
Word(const Word &w);
Word(const Word *w);
virtual ~Word();
operator const char *();
bool operator==(const Word &w);
Word& operator=(const Word &w);
bool isNull() const {
return word==0;
}
private:
char *word;
};
extern ... | true |
241e05fd7c53c1280d23f40fc1e1841781f7fdf2 | C++ | kophyogyi12/Exercise2.2 | /Exercise 2.cpp | UTF-8 | 848 | 3.578125 | 4 | [] | no_license | #include <iostream>
class Shape{
protected:
double length, height;
public:
Shape(double l,double h) :length(l), height(h) {}
};
class Rectangle:public Shape {
public:
void GetArea2() {
double Area_rect;
Area_rect = length * height;
std::cout << "Area of Rectangle:" << Area_rect;
}
... | true |
06d71a1bbf2089c0444cf756d1ffe820eecb33c0 | C++ | tgittos/breakout | /src/Paddle.cpp | UTF-8 | 981 | 2.8125 | 3 | [] | no_license | #include "Paddle.hpp"
#include "Dimension.hpp"
#include "Collidable.hpp"
Paddle::Paddle():
_velocity(0.f) {
AddFeature(new Dimension());
AddFeature(new Collidable(this));
};
void Paddle::MoveLeft(const float timestep) {
if (_velocity > 0.f) {
_velocity = 0.f;
}
_velocity -= Paddle::ACCELERATION * time... | true |
96d08e73af6862b8ee883ca87d2d8945ac3f73ed | C++ | playdougher/coding_interviews | /q4_find.cpp | UTF-8 | 806 | 3.421875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool Find(int target, vector<vector<int>> array) {
if (array.empty() || array[0].size() == 0 ) {
return false;
}
int row = array.size();
int col = array[0].size();
int row_i = 0;
int c... | true |
a24df9022a623d4744e75f7d20d0017799f69e4a | C++ | tonyatpeking/SmuSpecialTopic | /Engine/Code/Engine/Renderer/SpriteAnim.cpp | UTF-8 | 2,075 | 2.609375 | 3 | [
"MIT"
] | permissive | #include "Engine/Renderer/SpriteAnim.hpp"
#include "Engine/Math/MathUtils.hpp"
#include "Engine/Renderer/SpriteSheet.hpp"
#include "Engine/Renderer/SpriteAnimDefinition.hpp"
SpriteAnim::SpriteAnim( const SpriteAnimDefinition* definition )
: m_definition( definition )
{
}
void SpriteAnim::Update( float deltaSeco... | true |
accdf0ca8b1fc33cad17ef444e640db737f6e233 | C++ | aNeutrino/livegrep | /src/radix_sorter.h | UTF-8 | 1,852 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | /********************************************************************
* livegrep -- radix_sorter.h
* Copyright (c) 2011-2013 Nelson Elhage
*
* This program is free software. You may use, redistribute, and/or
* modify it under the terms listed in the COPYING file.
**************************************************... | true |
d97df0d41071982214e7ab4d871c01b1cf2a4b83 | C++ | Mostafa-At-GitHub/Educational-Management-System | /assignment_manager.cpp | UTF-8 | 2,739 | 3.21875 | 3 | [] | no_license | #include "assignment_manager.h"
#include "assignment.h"
namespace ES{
assignment_manager::assignment_manager() {}
assignment_manager::assignment_manager(string a,int b) :assignment_inf(a),max_grade(b) { }
void assignment_manager::view_assignment(){
cout << "Please choose one of the following option:" << '\n... | true |
c3d3ba31749760b2bee3db5a9bc0eba253e3bdf4 | C++ | SimulPiscator/goldstard | /src/Player.cpp | UTF-8 | 6,670 | 2.5625 | 3 | [] | no_license | #include "Player.h"
#include "SlaveProcess.h"
#include <atomic>
#include <map>
#include <thread>
#include <signal.h>
static const char* sQueryProperties[] =
{
"file_name",
"audio_samples",
"audio_bitrate",
"audio_codec",
"time_pos",
};
enum { idle, playPending, playing, terminating, };
enum { none, MPlayer... | true |
524f9c25c25e845be3fff900d49059f38b31275d | C++ | A1b1on/Kursovaya_rabota_1_kurs | /Source/myiterator.h | UTF-8 | 879 | 3.34375 | 3 | [] | no_license | #ifndef MYITERATOR_H
#define MYITERATOR_H
#include <stdlib.h>
#include <iterator>
template <typename ValueType>
class MyIterator : public std::iterator<std::input_iterator_tag, ValueType> {
template <typename>
friend class MyContainer;
ValueType* p;
public:
MyIterator(ValueType* p) : p(p){}
MyIt... | true |
ad6ec2f1e0fdaecd2698ba0aec46b288b58ceb1c | C++ | PranabSarker10/CPlusPlus | /44 to 57.Inheritance/44 to 57.INHERITANCE PROGRAMMING/48.2INHERIT PROTECTED MEMBER.cpp | UTF-8 | 454 | 3.609375 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Student
{
protected:
int roll;
int mark;
};
class Result : public Student
{
public:
void set(){cin>>roll>>mark;}
void print(){cout<<roll<<" "<<mark<<endl;}
};
///If we inherit protected members in public or protected mode it will be protected. But if we inh... | true |