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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6d7af5d4c8aeb39bd1d8c8041b73f35f209231a5 | C++ | marek-cel/mscsim | /tests/models/test_fdm_atmospheretest.cpp | UTF-8 | 5,714 | 2.59375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #include <QString>
#include <QtTest>
#include <iostream>
#include <fdm/models/fdm_Atmosphere.h>
////////////////////////////////////////////////////////////////////////////////
#define NUM 9
////////////////////////////////////////////////////////////////////////////////
using namespace std;
////////////////////... | true |
55f9f7265a6b45ae1091592f0cddbc475f99f319 | C++ | lvningyuan/pdlbox | /名字相似度判断.cpp | UTF-8 | 494 | 2.6875 | 3 | [] | no_license | class Solution {
public:
bool isLongPressedName(string name, string typed) {
int len = typed.size();
int j =0;
for(int i =0; i < len; ++i)
{
if(typed[i] == name[j])
++j;
else if(typed[i] != name[j] &&
typed[i] == typed[i-... | true |
162cbe381179ddf4f7f33f1372eb8cb93b245cb0 | C++ | Top0201/RayTracer | /raytrace_hw/light.cpp | GB18030 | 2,655 | 2.984375 | 3 | [] | no_license | #include"light.h"
#include<sstream>
#include<string>
#include<cmath>
#include<cstdlib>
#define ran() ( double( rand() % 32768 ) / 32768 )
Light::Light() {
sample = rand();
next = NULL;
lightPrimitive = NULL;
}
void Light::Input( std::string var , std::stringstream& fin ) {
if ( var == "color=" ) color.Input( fin ... | true |
e94fb3a6cc5305eb78021a3b16dd1c68c0b97694 | C++ | SherlockThang/sidecar | /Algorithms/ncintegrate/NCIntegrate.cc | UTF-8 | 12,651 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <cmath>
#include <iterator>
#include "Utils/VsipVector.h"
#include <vsip/math.hpp>
#include "boost/bind.hpp"
#include "Logger/Log.h"
#include "NCIntegrate.h"
#include "NCIntegrate_defaults.h"
#include "QtCore/QString"
using namespace SideCar;
using namespace SideCar::Messages;
using namespace SideCar::Al... | true |
978cb5544dbe2401f051ca108ff5e158502983c8 | C++ | jebouin/Infected-Pipes | /gui/Skill.cpp | UTF-8 | 853 | 2.734375 | 3 | [] | no_license | #include "Skill.h"
#include "IP.h"
#include "SkillIcon.h"
Skill::Skill(IP& ip, sf::Vector2i skillPos, sf::Vector2f iconPos, string name, string description, int maxLevel) {
_icon = new SkillIcon(ip, skillPos, name, description, *this);
_icon->setPosition(iconPos);
_maxLevel = maxLevel;
_level = 0;
}
S... | true |
53b35350b74dad0fe17b6390aca9b526c7739c01 | C++ | arcreane/c-game-errorphp | /Adventure/Adventure/Sources/Potion.cpp | UTF-8 | 738 | 3.03125 | 3 | [] | no_license | #include "Potion.h"
#include <random>
#include <stdio.h>
#include <iostream>
using namespace std;
void Potions::setPotionType() {
std::random_device rd;
std::mt19937 mt(rd());
auto dist = std::uniform_int_distribution<int>(0, 2);
ePotionType rPotionType = ePotionType(dist(mt));
mPotionType = rPotionType;
... | true |
4f857ef0298d64d10255f901b35068843515b32f | C++ | sb565/Algorithms_Implementation | /Codes/GraphColoring.cpp | UTF-8 | 1,138 | 3.109375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int x[50],g[50][50],n,i,j,m;
void next_value(int k)
{
while(1)
{
x[k]=(x[k]+1)%(m+1);
if(x[k]==0)
return;
for(j=1;j<=n;j++)
{
if(g[k][j]!=0&&(x[k]==x[j]))
break;
}
if(j==n+1)
return;
}
}
int coloring(int k)
{
int c=0;
do
{
next_value(k);
if(x[... | true |
52e72ca52dc6f01ac410a35e0901b6202a24f481 | C++ | chiumax/CMSC-140 | /Hw4/Hw4_part1.cpp | UTF-8 | 1,349 | 3.734375 | 4 | [
"MIT"
] | permissive | /*
Hw4_part1.cpp
CMSC 140, CRN 24381, Dr. Kuijt
Max C.
A software company sells a package that retails for $99. Quantity discounts are given according to the following table.
Quantity discount
------------------------------
10-19 20%
20-49 30%
50-99 ... | true |
b2926031731aa2c4cb2ff356d82e8a1698a6e4d0 | C++ | xxning/Algorithm | /PRO4/ex1/source/EdgeGen.cpp | UTF-8 | 1,202 | 2.625 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
int main(){
FILE *input;
srand((unsigned)time(NULL));
int i,j,k;
int n,e,v1,v2;
char Filename[6][28]={"./ex1/input/size1/input.txt",
"./ex1/input/size2/input.txt",
"./ex1/input/size3/input.txt",
"./ex1/i... | true |
a8cf084981779b4b0550aa24c55898ab5e08f604 | C++ | izzyreal/vmpc-unreal-plugin | /VmpcPlugin/Source/ThirdParty/include/mpc/src/ui/NameGui.cpp | UTF-8 | 1,559 | 2.59375 | 3 | [] | no_license | #include <ui/NameGui.hpp>
#include <lang/StrUtil.hpp>
#include <Mpc.hpp>
#include <Util.hpp>
using namespace mpc::ui;
using namespace std;
NameGui::NameGui()
{
}
void NameGui::setName(string name)
{
this->name = moduru::lang::StrUtil::padRight(name, " ", 16);
nameLimit = 16;
}
void NameGui::setNameLimit(int i)
{
... | true |
e75af1d2068b7f3b901c87c6ef526e66679bd3fd | C++ | rizky-bagus/Tsunemori-Akane | /CQU/CQU Monthly May 2016/G.cpp | UTF-8 | 1,572 | 2.53125 | 3 | [] | no_license | #include <set>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int T;
int n, f[100005], rk[100005];
set<int> s[100005];
int find(int x) {
if (f[x] == x) return x;
s[f[x]].erase(x);
f[x] = find(f[x]);
s[f[x]].insert(x);
return f[x];
}
void merge(... | true |
cdc81e82c2524a5adfb2124e545ec4f94b269335 | C++ | saderholm/SeniorDesign19 | /motortest/motortest.ino | UTF-8 | 3,411 | 2.90625 | 3 | [] | no_license | #include <Wire.h>
#include <Adafruit_MotorShield.h>
// Create the motor shield object with default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *m0 = AFMS.getMotor(1); // connect DC motor to port 0
Adafruit_DCMotor *m1 = AFMS.getMotor(2); // connect DC motor to port 1
Ada... | true |
31c0251293708211b9c19f26034fa301f8647076 | C++ | Xangis/magma | /editors/de310/source/obj/objhere.cpp | UTF-8 | 13,430 | 2.640625 | 3 | [] | no_license | //
// File: objhere.cpp originally part of dikuEdit
//
// Usage: functions related to objectHere structures in general
//
// Copyright 1995-98 (C) Michael Glosenger
//
#include <iostream>
#include "../fh.h"
#include "../types.h"
#include "objhere.h"
#include "../room/room.h"
#include "object.h... | true |
13635bcba6eba9571d3c244f2198376d5553b440 | C++ | MIMFaisal/Codeforces | /266B.cpp | UTF-8 | 439 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
int i,n,t,j,l;
scanf("%d %d ",&n,&t);
char q[n+1];
gets(q);
l=strlen(q);
for(i=1;i<=t;i++)
{
for(j=1;j<l;j++)
{
if(q[j-1]=='B'&&q[j]=='G')
{
... | true |
ac14f95fcddf7e4fb7ccb70ccd2396db08012ca0 | C++ | EdwardDeaver/ControlMyLights | /OLD/Arduino/ArduinoColor/ArduinoColor.ino | UTF-8 | 3,301 | 3.328125 | 3 | [] | no_license | //https://learn.adafruit.com/rgb-led-strips/arduino-code
int Red,Green,Blue; // Red, Green, Blue value from the hex conversion
String color;
int FADESPEED = 30;
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
... | true |
11d34ac332b0c25ba023c9e81278c864b91c7964 | C++ | dinhtuyen3011/cpp | /OOP Concepts/Resources/31_5_Applications_of_Pointers/Practice09.cpp | UTF-8 | 319 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(void) {
char *str= "IMIC Technology";
char *pc = str;
cout<<str<<endl;
cout << str[0] <<' '<< *pc <<' '<<pc[3]<<"\n";
pc = pc + 3;
cout<<*pc<<endl;
cout <<*pc<<' '<< pc[2] <<' '<< pc[5];
return 0;
}
/* Output *//*
I I C
C Technology
C T h
*/
| true |
d1364e199eda82ce99665575b42f3866ffb159e6 | C++ | jayparekhjp/openCV-Facial-Recognition | /openCV/sources/samples/cpp/connected_components.cpp | UTF-8 | 2,102 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
Mat img;
int threshval = 100;
static void on_trackbar(int, void*)
{
Mat bw = threshval < 128 ? (img < threshval) : (img > threshval);
vector<vector<Point> ... | true |
9c136f0b97d895e7b8ed6f229f0f08ed40ff91b0 | C++ | fredfeng/PDB | /branches/v0.1.3-scons/DBServerBackEnd/headers/BackEndNewStorageLocationWork.h | UTF-8 | 698 | 2.625 | 3 | [] | no_license |
#ifndef BACKEND_NEW_STORAGE_WORK_H
#define BACKEND_NEW_STORAGE_WORK_H
#include "PDBCommWork.h"
#include "PDBBuzzer.h"
#include "PDBWork.h"
#include "SimplePDB.h"
#include <string>
using namespace std;
// tells the database to use a new storage location
class BackEndNewStorageLocationWork : public PDBCommWork {
pu... | true |
761638fbc11c53ee162dac8e8ad289cf8885ca5c | C++ | Cowerling/CRESTInCPP | /Base/Cell.h | UTF-8 | 2,119 | 3.03125 | 3 | [] | no_license | //
// Created by cowerling on 17-4-18.
//
#ifndef CREST_CELL_H
#define CREST_CELL_H
#include "Tier.h"
#include "StatusResultType.h"
namespace CREST {
class Cell {
public:
Cell();
virtual ~Cell();
void RunoffGenerationProcess(float precipitation, float potential_evaporation, float max... | true |
a23fb2a69fe8caaebb697512d1eda89ed551c521 | C++ | green-fox-academy/Amberhaart | /week-03/day-04/printParams/main.cpp | UTF-8 | 1,197 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <string>
void printParams (std:: string x);
void printParams (std:: string x, std:: string y);
void printParams (std:: string x, std:: string y, std:: string z);
void printParams (std:: string x, std:: string y, std:: string z, std:: string w);
int main(int argc, char* args[]) {
// -... | true |
a49e221d702866a2ba5312d77c5690033d1d502d | C++ | MregXN/Leetcode | /Array/849.cpp | UTF-8 | 2,394 | 3.671875 | 4 | [] | no_license | // 在一排座位( seats)中,1 代表有人坐在座位上,0 代表座位上是空的。
// 至少有一个空座位,且至少有一人坐在座位上。
// 亚历克斯希望坐在一个能够使他与离他最近的人之间的距离达到最大化的座位上。
// 返回他到离他最近的人的最大距离。
// 示例 1:
// 输入:[1,0,0,0,1,0,1]
// 输出:2
// 解释:
// 如果亚历克斯坐在第二个空位(seats[2])上,他到离他最近的人的距离为 2 。
// 如果亚历克斯坐在其它任何一个空位上,他到离他最近的人的距离为 1 。
// 因此,他到离他最近的人的最大距离是 2 。
// 示例 2:
// 输入... | true |
c49fc531a03da7234c5ef2e3303896ed07e30a9a | C++ | priyanto14/tugas-dasar-pemrograman | /Latihan 1.CPP | UTF-8 | 348 | 2.625 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
main() {
int nilai,tugas;
printf("Masukan Sebuah Nilai:"); scanf("%d",&nilai);
printf("Masukan Nilai Tugas:"); scanf("%d",&tugas);
if(nilai>80)
printf("Anak Baik \n");
else if(nilai>70)
printf("Bagus \n");
else if(nilai>60)
printf("Cemen \n");
else
printf("Dodo... | true |
951a2e8ac2e920507199d3de03c8f15fa90f4896 | C++ | andrefmrocha/MIEIC_18_19_AEDA | /src/Company.h | UTF-8 | 7,006 | 3.3125 | 3 | [] | no_license | /*
* Company.h
*
* Created on: 30/10/2018
* Author: joaomartins
*/
#ifndef SRC_COMPANY_H_
#define SRC_COMPANY_H_
#include "Calendar.h"
#include "Court.h"
#include "Date.h"
/**
* The company itself, operation all of the rest
*/
class Company
{
private:
std::vector<Court> tennisCourts; /**< vector with ... | true |
91a10b631f719959e2d582d267d6a91222210b8e | C++ | derekniess/3D-Physics-Engine-Framework | /ResourceManager.h | UTF-8 | 1,536 | 2.53125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <string>
#include <utility>
#include <vector>
#include <memory>
#include "Observer.h"
#include "Resource.h"
#include "DebugVertex.h"
#include "Reflection.h"
#include "Texture.h"
class Renderer;
class Mesh;
class Engine;
class GameObject;
enum AccessType
{
READ,
WRITE,
APPEND,
AccessTypeEnd
... | true |
87cf00e776af66f5e32f4c3cf8a8c755d36e4a2f | C++ | r00nster/sclx_c7042 | /sclx_in.h | UTF-8 | 1,424 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef SCLX_IN_H_
#define SCLX_IN_H_
#include <tasks/serial/term.h>
#include <cstring>
#include "crc.h"
class sclx_in {
public:
struct __attribute__((__packed__)) packet_t {
std::uint8_t status;
std::uint8_t handset[6];
std::uint8_t aux_current;
std::uint8_t carid_sf;
s... | true |
7128bc60f7869ce4ec537a2c7e93d8260eca2fee | C++ | alanrpfeil/Computer-Graphics | /sig program/include/sigkin/kn_joint_st.h | UTF-8 | 4,669 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | /*=======================================================================
Copyright (c) 2018-2019 Marcelo Kallmann.
This software is distributed under the Apache License, Version 2.0.
All copies must contain the full copyright notice licence.txt located
at the base folder of the distribution.
======... | true |
53f6867fcf0b1c6788f989c8c82b4a337a26eb7d | C++ | longlongwaytogo/Learning.test | /C++/c11/thread.cpp | UTF-8 | 329 | 2.84375 | 3 | [
"MIT"
] | permissive | #include<iostream>
#include <atomic>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <future>
int g_int = 1;
void thread_task()
{
std::cout<< "hello thread :" << g_int++ << std::endl;
}
int main ()
{
for(int i = 0; i < 10; ++i)
{
std::thread t(thread_task);
t.join();
}
re... | true |
9e95ae3fdb8f370b2bdb644ed65a1db30d3ef754 | C++ | amartin11/robot-code-public | /muan/wpilib/pcm_wrapper.h | UTF-8 | 1,577 | 2.53125 | 3 | [
"MIT"
] | permissive | #ifndef MUAN_WPILIB_PCM_WRAPPER_H_
#define MUAN_WPILIB_PCM_WRAPPER_H_
#include <array>
#include <atomic>
#include <cstdint>
#include "WPILib.h"
namespace muan {
namespace wpilib {
class PcmWrapper {
public:
explicit PcmWrapper(int32_t module);
PcmWrapper();
~PcmWrapper();
// Create a solenoid on the spec... | true |
dc5dd8d0226cc4a83989b1c3f32ac3c2de43d02e | C++ | dwmkFD/AtCoderSubmit | /ProconLibrary/SuccinctBitVector.cpp | SHIFT_JIS | 5,576 | 2.6875 | 3 | [] | no_license | template<typename T = uint64_t> constexpr T NOTFOUND = 0xffffffffffffffffLLU;
template<typename T = uint64_t> struct SuccinctBitVector {
public:
explicit SuccinctBitVector(const T n) : size(n) {
const T s = (n + blockBitNum - 1) / blockBitNum + 1; // ceil(n, blockSize)
this->B.assign(s, 0);... | true |
8fd829ff00e1fe91343ad9c7b6d4f389cf7f0ec3 | C++ | Tmliu06/libdex | /src/insttype.cpp | UTF-8 | 38,953 | 2.5625 | 3 | [] | no_license | #include "insttype.h"
namespace {
enum Format {
op00,
opAA,
opBA,
op00AAAA,
opAABBBB,
opAACCBB,
opBACCCC,
op00AAAAAAAA,
op00AAAABBBB,
opAABBBBBBBB,
opAABBBBCCCC,
opAGBBBBDCFE,
opAABBBBCCCCHHHH,
opAGBBBBDCFEHHHH,
opAABBBBBBBBBBBBBBBB,
_10t,
_20t,
... | true |
6bfd98a7e4a779a052446fb4b2771e184b2f1275 | C++ | Ars-eniy-Cheis/ProgramLanguages | /Figures/Rectangle.cpp | UTF-8 | 315 | 3.078125 | 3 | [] | no_license |
#include "Rectangle.h"
Rectangle::Rectangle()
{
a = 0;
b = 0;
}
Rectangle::Rectangle(float new_a, float new_b)
{
a = new_a;
b = new_b;
}
Rectangle::Rectangle(float new_a)
{
a = new_a;
b = new_a;
}
float Rectangle::Area()
{
return a * b;
}
Figure* Rectangle::Clone()
{
return new Rectangle(a, b);
}
| true |
5fc973fc8590f4c8b69c4cdc1dbc8ea5bda27654 | C++ | learn-it/system | /snippets/negcache/neg_cache.cc | UTF-8 | 3,017 | 2.65625 | 3 | [] | no_license | #include <map>
#include <algorithm>
#include <string>
#include <time.h>
#include <pthread.h>
#include <errno.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <string.h>
#include <iostream>
using namespace std;
// items are stored until this count of seconds
static size_t cache_ttl = 2;
struct data_byname
{... | true |
b3cee51c98f87ed392a077fd62efd5274440bf11 | C++ | Algomorph/surfelwarp | /apps/hash_app/check_compact_probe_table.cpp | UTF-8 | 1,789 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "check_compact_probe_table.h"
#include "common/common_types.h"
#include "common/sanity_check.h"
#include "hashing/CompactProbeTable.h"
#include <iostream>
void surfelwarp::check_probe_compaction(const unsigned test_size, const unsigned test_iters)
{
for(auto i = 0; i < test_iters; i++) {
check_probe_compac... | true |
c590c7a8b681e6916a83bd3fd48359939123a9d0 | C++ | zlvb/zcelib | /src/commlib/zcelib/zce_socket_addr_in6.h | GB18030 | 5,214 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef ZCE_LIB_SOCKET_ADDR_IN6_
#define ZCE_LIB_SOCKET_ADDR_IN6_
//IPV6һ
//IPv6ṹ
class ZCE_Sockaddr_In6 : public ZCE_Sockaddr
{
public:
//ĬϹ캯
ZCE_Sockaddr_In6 (void);
//sockaddr_in죬
ZCE_Sockaddr_In6 (const sockaddr_in6 *addr);
//ݶ˿ںţIPַַ,ipv6_addr_strӦ<40ֽڵij
ZCE_Sockaddr_In6 (const char *i... | true |
1d6e0e05b712229c82228cd7aae6b6e04c455c50 | C++ | liqiang311/oj | /offer2017/2017_09_21_xiecheng_1.cpp | UTF-8 | 1,887 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
#define max(a,b) (a>b?a:b)
int fun1(vector< vector<int> > &arr, int ii, int jj)
{
vector< vector<int> > f;
f.resize(arr.size());
for (int i = 0; i < f.size(); i++)
{
f[i].resize(arr[i].size());
for (int j = 0; j < arr[i].size(); j++)... | true |
dde3aaa622a98bcd050e7919f17d064bc2ecb485 | C++ | socc-io/algostudy | /baekjoon/smilu/1557.cpp | UTF-8 | 867 | 2.625 | 3 | [] | no_license | #include <cstdio>
typedef long long ll;
const int MAX = 100010;
int mob[MAX];
ll f(ll x) {
ll ret = 0;
for (int i = 1; i*i <= x; i++)
ret += mob[i] * (x/(i*i));
return ret;
}
void set_mob() {
for (int i = 0; i < MAX; i++) mob[i] = 1;
for (int i = 2; i*i < MAX; i++) {
if (mob[i] != 1) continue;
... | true |
050af52136dfcaca7548a14fcfcb2ade80605805 | C++ | fifilyu/zguide-examples-cpp-with-cmake | /src/mdcliapi2.hpp | UTF-8 | 4,111 | 2.53125 | 3 | [
"MIT"
] | permissive | #ifndef __MDCLIAPI_HPP_INCLUDED__
#define __MDCLIAPI_HPP_INCLUDED__
#include "zmsg.hpp"
#include "mdp.h"
// Structure of our class
// We access these properties only via class methods
class mdcli {
public:
// ---------------------------------------------------------------------
// Constructor
mdcli (s... | true |
50592e6223c0a0b110d760e9568fe9d0c1935e8b | C++ | alriddoch/tardis | /SDL_and_opengles/SDL_and_opengles.cpp | UTF-8 | 8,770 | 2.5625 | 3 | [] | no_license | /*This source code copyrighted by Lazy Foo' Productions (2004-2014)
and may not be redistributed without written permission.*/
//Using SDL, SDL OpenGL, GLEW, standard IO, and strings
#include <SDL.h>
// #include <GL/glew.h>
#include <SDL_opengl.h>
#include <GLES2/gl2.h>
#include <stdio.h>
#include <string>
//Screen d... | true |
06d8698ba4d965bdf1061cdb9b10ab24d1f6d653 | C++ | simjaemun2/uva | /ch6/6.4/uva10298.cpp | UTF-8 | 1,158 | 2.53125 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <memory.h>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <stack>
#include <sstream>
#include <math.h>
using namespace std;
string line;
vector<int>... | true |
3931c191030849748a1ba38c2014eb4a1ab166cc | C++ | linzhongkai/HowToLearnCPP | /LeetCode-Middle/multiplyString1.cpp | UTF-8 | 1,637 | 3.28125 | 3 | [] | no_license | class Solution {
public:
string multiply(string num1, string num2) {
string result1 = "", result2 = "";
int carry =0;
int count = 0;
for(int i = num2.size() - 1; i >= 0; i--, count++){
result1.clear();
int carry =0;
int y = num2[i] - '0';
... | true |
88e4d2404d57bcb26600323edfe3a3580da79c5f | C++ | bdumitriu/playground | /university-work/utcn/sisteme de operare/linux/so/include/driver/BlockMap.h | UTF-8 | 11,555 | 2.921875 | 3 | [] | no_license | /*
* Project: File System Simulator
* Author: Bogdan DUMITRIU
* E-mail: bdumitriu@bdumitriu.ro
* Date: Sat Nov 9 2002
* Description: This is the interface of the BlockMap class.
*/
/***************************************************************************
* ... | true |
d84c0f1d23fae672b1f1b3efbbc6276c19859858 | C++ | sriharishekhar/Codeforces | /SinglePush.cpp | UTF-8 | 687 | 3.421875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void CheckEqual(int a[0], int b[0]) {
}
void SinglePush(int n) {
int size;
for (int i = 0; i < n; i++) {
cout << "Enter Size of array" << endl;
cin >> size;
int a[size];
int b[size];
for (int j = 0; j < size; j++) {
cin >> a[j];
}
... | true |
133a56dc4dbef3fe04601e868f5f445ba34f97e0 | C++ | oha-yashi/cpplibs | /modpow.cpp | UTF-8 | 514 | 3.171875 | 3 | [] | no_license | /*
modpow(a, n, p) = a^n mod(p)
繰り返し2乗法
*/
#include <bits/stdc++.h>
using namespace std;
#define LIMIT 1000000007 //10^9+7
long long modpow(long long a, long long n, long long p){
if(n==1) return a % p;
if(n%2 == 1) return (a * modpow(a, n-1, p)) % p;
long long t = modpow(a, n/2, p);
return t * t % p;
}
/*
使... | true |
0a9d6e3ced1120b722cd212a7f3b7b05e1b842d6 | C++ | bg1bgst333/Sample | /winapi/PathFindFileName/PathFindFileName/src/PathFindFileName/PathFindFileName/PathFindFileName.cpp | SHIFT_JIS | 953 | 2.8125 | 3 | [
"MIT"
] | permissive | // wb_t@C̃CN[h
#include <windows.h> // WWindowsAPI
#include <tchar.h> // TCHAR^
#include <stdio.h> // Wo
#include <shlwapi.h> // VFAPI
// _tmain̒`
int _tmain(int argc, TCHAR *argv[]){ // mainTCHAR.
// R}hC̐.
_tprintf(_T("argc = %d\n"), argc); // argco.
if (argc != 2){ // 2ȊO̓G[.
_tprintf(_T("error: argc != 2... | true |
b79fce98086a0e9335b62d362511b1b601294bfe | C++ | Eddie02582/Leetcode | /C++/1779. Find Nearest Point That Has the Same X or Y Coordinate.cpp | UTF-8 | 613 | 2.875 | 3 | [] | no_license | class Solution {
public:
int nearestValidPoint(int x, int y, vector<vector<int>>& points) {
ios::sync_with_stdio(false); cin.tie(nullptr);
int index = -1;
int distance = 9999;
for(int i = 0; i < points.size();i++){
if(x == points[i][0] || y == points[i][1]){
... | true |
542d486d978d48134cd3325ed531edc21495c13b | C++ | tarvainen/rodent | /src/EEPROMWriter.cpp | UTF-8 | 404 | 2.828125 | 3 | [] | no_license | #include "EEPROMWriter.h"
/*
Reads an Rodent status object from EEPROM memory.
*/
StatusObject EEPROMWriter::read() {
StatusObject status;
EEPROM.get(0, status);
return status;
}
/*
Writes the given Rodent status object to the EEPROM memory.
*/
void EEPROMWriter::write(StatusObject statusObject) {
EEPROM.put(0, s... | true |
44c7d3d3eac997d815b3d8ddf1c06e2b6dbaf175 | C++ | rheineke/cpp-iem | /test/iem/message_test.cpp | UTF-8 | 2,293 | 3.015625 | 3 | [
"MIT"
] | permissive | // Copyright 2016 Reece Heineke<reece.heineke@gmail.com>
#include "iem/message.hpp"
#include "gtest/gtest.h"
namespace iem {
TEST(TraderMessageTest, MessageType) {
// Serialization
EXPECT_EQ(to_string(MessageType::ORDER), "Order");
EXPECT_EQ(to_string(MessageType::ORDER_RESOLUTION), "Order Resolution");
//... | true |
96f71bc8b8f1a7dffbd15181e8c817968cd22a8b | C++ | ArnaudValensi/2d-game-engine-cpp-opengl | /src/Spritesheet.cpp | UTF-8 | 1,462 | 2.90625 | 3 | [] | no_license | #include "Spritesheet.h"
#include "debug.h"
#include <fstream>
#include <iostream>
#include <map>
#include <nlohmann/json.hpp>
void Spritesheet::Create(std::string file) {
std::string texture_path = file + ".png";
std::string json_path = file + ".json";
m_Texture = std::make_unique<Texture>("./assets/spriteshee... | true |
cc16854be42528aaf881fe7baf35762f3101e6cf | C++ | Honza0297/ETUAR | /src/release/University(VS)/Done/trilobot/display.h | UTF-8 | 2,516 | 2.828125 | 3 | [] | no_license | /************************************************ */
/* Educational tutorial for Arduino in robotics */
/* Vyukovy Tutorial pro pouziti Arduina v robotice*/
/* File: display.h */
/* Author: Jan Beran */
/* Date: March 2020 ... | true |
5f2d1b84f6c46d40883a7859847d4ffe1c88f511 | C++ | Bkohler93/hunt_the_wumpus | /adventurer.h | UTF-8 | 928 | 3.34375 | 3 | [] | no_license | #ifndef ADVENTURER_H
#define ADVENTURER_H
#include <iostream>
class Adventurer
{
private:
int map_size;
int num_arrows;
bool has_gold;
int x, y;
public:
/* constructors */
Adventurer(int map_size, int x, int y) :
map_size{map_size}, num_arrows{3}, has_gold{false}, x{x}, y{y} {}
Adventurer() : map_size{0},... | true |
28492ed4997e3ed426b73861934c3e1d74eeaeed | C++ | xoyowade/solutions | /leetcode/63_unique_paths2.cpp | UTF-8 | 1,276 | 2.8125 | 3 | [] | no_license | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int> > &obstacleGrid) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
vector<vector<int> > &grid = obstacleGrid;
vector<vector<int> > count_grid;
int num_rows = grid.size();
... | true |
163808b0b155a717b67db37cade2e9ad9cdc52b8 | C++ | SammyEnigma/Soc-Performance-Evaluation | /mainwindow.cpp | UTF-8 | 19,254 | 2.546875 | 3 | [] | no_license | /*
* @Author: MRXY001
* @Date: 2019-11-27 18:00:02
* @LastEditors : MRXY001
* @LastEditTime : 2019-12-23 10:00:17
* @Description: 主窗口
*/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "xlsxdocument.h"
#include "xlsxworksheet.h"
#include "xlsxcellrange.h"
#include "xlsxsheetmodel.h"
#include <QScroll... | true |
d37091503656588af9b99d7f6ad24e4296dc16be | C++ | fieldkit/firmware | /fk/storage/memory_page_store.cpp | UTF-8 | 833 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | #include "storage/memory_page_store.h"
namespace fk {
FK_DECLARE_LOGGER("pages");
MemoryPageStore::MemoryPageStore(DataMemory *target) : target_(target) {
}
int32_t MemoryPageStore::load_page(uint32_t address, uint8_t *ptr, size_t size) {
auto page_size = target_->geometry().page_size;
auto page_address = (... | true |
770e3be8a3e0dfda3155496d3aa58ab84fade5da | C++ | TissueFluid/Algorithm | /LintCode/Copy Books.cc | UTF-8 | 1,517 | 3.484375 | 3 | [] | no_license | // Copy Books
// dp[i][j] : time of j books copied by i workers
// dp[i][j] = min{max(dp[i-1][k from 0 to j-1], sum(pages[k+1 to j]))}
#include <iostream>
#include <vector>
#include <limits>
using namespace std;
class Solution {
public:
/**
* @param pages: a vector of integers
* @param k: an integer
... | true |
5de0950399b72048439b9abc5235b04d52071029 | C++ | emadar22/Project-2-OOP | /BeverageItem.h | UTF-8 | 1,068 | 3.4375 | 3 | [] | no_license | //
// Created by daraw on 20/04/2020.
//
#ifndef HW2_OOP_BEVERAGEITEM_H
#define HW2_OOP_BEVERAGEITEM_H
#include <iostream>
#include <string>
namespace OOP_Hw2 {
class BeverageItem {
std::string name; // string of the name of the item
double price; // the price of the item
bool Alcoholic; /... | true |
5dcb0db20d33d51d0d9ce5481da81843d49a9d8f | C++ | youbingchenyoubing/sort_algorithm | /src/quick_sort.h | UTF-8 | 1,713 | 3.296875 | 3 | [] | no_license | #ifndef QUICK_SORT_H
#define QUICK_SORT_H
# include <iostream>
# include <ctime>
using namespace std;
class quickSort
{
public:
quickSort( int data[], int dataSize ): length( dataSize )
{
this->data = new int[dataSize];
for ( int i = 0; i < length; ++i )
{
this... | true |
5cf5f218e918088bb31fef97f2bacb6ae62ed742 | C++ | KKtiandao/DataStructAndAlgorithm | /include/dataStruct/quene/quene.h | UTF-8 | 580 | 2.859375 | 3 | [] | no_license | #ifndef QUENE_H
#define QUENE_H
#include "../list/list.h"
template <class T> class Quene : public List<T> {
public:
Quene(): List<T>(){}
Quene(T a): List<T>(a) {}
bool Push(T a);
Node<T>* Pop();
// void Dump();
// int Size();
};
template <class T> bool Quene<T>::Push(T a) {
auto pNode = new Node<T>(a);
return... | true |
42a5a4eeaff2dd69b70a35517e61afcc09f394b0 | C++ | aoibird/pc | /cpc/example36_lower_bound.cpp | UTF-8 | 587 | 3.046875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#define MAXN 10000
using namespace std;
int a[MAXN];
int n;
int x;
void input()
{
cin >> n >> x;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
}
void lower_bound()
{
int lb = -1, ub = n;
while (ub - lb > 1) {
int mid = (lb+ub)/2;
if (a[mid] >= x) ub = mid;
else lb = mid;... | true |
73401d278b324fbe70759454d1f74adefd56eb96 | C++ | koha13/All-code | /C-Thay_Son/BT6/Cau6.1.cpp | UTF-8 | 1,178 | 3.171875 | 3 | [] | no_license | #include<stdio.h>
struct phanso{
int tu;
int mau;
};
int ucln(int a,int b){
while(b!=0){
a=a%b;
int tg=a;
a=b;
b=tg;
}
return a;
}
void rutgon(int &a,int &b){
int d=ucln(a,b);
a/=d;
b/=d;
}
void quydong(int &a,int &b,int &c,int &d){
long long uc=a*b/ucln(a,b);
c=c*uc/a;
d=d*uc/b;
a=uc;
b=uc;
}
void... | true |
6c402a41446af06f75b8032397e69b06e5b55a01 | C++ | tony-space/WingSimulator | /Simulation/libCpuSimulation/CLineSegment.cpp | UTF-8 | 1,394 | 2.9375 | 3 | [] | no_license | #include "pch.hpp"
#include "CLineSegment.hpp"
using namespace wing2d::simulation::cpu;
CLineSegment::CLineSegment(const glm::vec2& a, const glm::vec2& b) : m_ray()
{
auto delta = b - a;
m_length = glm::length(delta);
m_first = a;
m_second = b;
if (m_length > 1e-16f)
m_ray = delta / m_length;
else
m_length... | true |
4683cdeff0af3903e87ecb853f5aea20121dbc34 | C++ | LuminousLee/ECPlugin | /src/ECModel.cpp | UTF-8 | 1,819 | 2.734375 | 3 | [] | no_license | #include "ECModel.hpp"
using namespace std;
ECModel::ECModel(){
}
ECModel::~ECModel(){
}
vector<string> ECModel::event_list = vector<string>();
bool ECModel::init(){
ECModel::event_list.push_back("cycles");
ECModel::event_list.push_back("instructions");
ECModel::event_list.push_back("cache-misses"... | true |
c31e77b4c43c25611ac1d7ad670208bd3261e290 | C++ | theperfectstorm/arduino_relay_timer | /relay2.ino | UTF-8 | 1,712 | 2.921875 | 3 | [] | no_license | #define OUT1 8 //set your pin numbers here
#define OUT2 9
#define OUT3 10
int to_blink=0;
unsigned long previousMillis = 0; // will store last time LED was updated
unsigned long delay1=1800000; //30min*60sec*1000ms=1800000ms
unsigned long delay2=900000; //15mins*60sec*1000ms=900000ms
unsigned long delay3... | true |
980f20bdfdc91016440085e6acd414df8758e9d4 | C++ | jschueths/Evolutionary-Algorithm-Practice | /config.hpp | UTF-8 | 2,314 | 2.65625 | 3 | [] | no_license | /////////////////////////////////////////////////////////////////////
/// @file config.hpp
/// @author Joshua McCarville-Schueths CS348 Fall 2011
/// @brief Implementation for config data type, Assignment 1b.
/////////////////////////////////////////////////////////////////////
void config::init(ConfigFile &confile)
{... | true |
ed0d8e1d2bc1cd4a5bee85bc1ee236a8fb0ff2ef | C++ | TheDaleks/data | /include/data/queue/functional_queue.hpp | UTF-8 | 4,958 | 2.90625 | 3 | [] | no_license | // Copyright (c) 2019 Daniel Krawisz
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef DATA_MAP_QUEUE
#define DATA_MAP_QUEUE
#include <data/list.hpp>
#include <data/tools/iterator_list.hpp>
#include <data/queue.hpp>
#incl... | true |
e4fe3d1d97e0f7584f2dc8317eb7b0a4c868275c | C++ | AGraber/ed7hook_switch | /source/skyline/logger/SdLogger.cpp | UTF-8 | 955 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "skyline/logger/SdLogger.hpp"
#include "nn/fs.h"
namespace skyline::logger {
nn::fs::FileHandle fileHandle;
s64 offset;
SdLogger::SdLogger(std::string path) {
/*nn::fs::DirectoryEntryType type;
Result rc = nn::fs::GetEntryType(&type, path.c_str());
if (rc == 0x202) { // Path does not exist
... | true |
1ce68541de917997933bb1fb0caeeb04e72e5a69 | C++ | Ourgaht/prog3d | /src/plane.cpp | UTF-8 | 767 | 2.734375 | 3 | [] | no_license | #include "plane.h"
#include <cmath>
Plane::Plane()
{
}
Plane::Plane(const PropertyList &propList)
{
m_position = propList.getPoint("position",Point3f(0,0,0));
m_normal = propList.getVector("normal",Point3f(0,0,1));
}
Plane::~Plane()
{
}
bool Plane::intersect(const Ray& ray, Hit& hit) const
{
float ddn =... | true |
fa0d6977d8be32153d14a2b7acafc6587831a534 | C++ | glindsey/game-project-potential | /src/StageChunkCollection.cpp | UTF-8 | 8,704 | 2.8125 | 3 | [] | no_license | #include "StageChunkCollection.h"
#include "MathUtils.h"
#include "Stage.h"
#include "StageChunk.h"
#include "StageComponentVisitor.h"
struct StageChunkCollection::Impl
{
inline int calc_chunk_index(int chunk_x, int chunk_y, int chunk_z)
{
return (chunk_z * (int)num_of_chunks.x * (int)num_of_chunks.y) +
... | true |
8a32fd77207eabb050a259a69adcb6299640414e | C++ | qcoh/dmgb | /dmgb_test/cpu_test.cpp | UTF-8 | 36,955 | 2.796875 | 3 | [] | no_license | #include "test.h"
#include "cpu.h"
#include "mmu.h"
#include "rw_ref.h"
struct test_mmu : public read_writer {
u8& operator[](const u16 addr) noexcept { return m_mmu[addr]; }
u8 read(const u16 addr) const noexcept override { return m_mmu[addr]; }
void write(const u16 addr, const u8 v) noexcept override { m_mm... | true |
090ebc9ca9ccaaf99f001f427c749f2cdc98ed29 | C++ | VZIKL/leetcode-test | /excel-sheet-column-title.cpp | UTF-8 | 371 | 3.046875 | 3 | [] | no_license | // File Name: excel-sheet-column-title.cpp
// Author:
// Mail:
// Created Time: 2016年12月19日 星期一 02时10分07秒
#include <iostream>
#include <string>
class Solution {
public:
std::string covertToTitle(int n) {
std::string result;
while (n) {
result = char((n - 1) % 26 + 'A') + result;
n = (n - 1) / 26;... | true |
1e23964caa54e71b82084efd9fe80fda92e75e5f | C++ | GDDXH/First-year-of-University | /hdu.cpp/杭电2060.cpp | UTF-8 | 582 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string>
#include<cstring>
#include<cstdlib>
#include<vector>
using namespace std;
int main()
{
int amout,billiard,score1,score2,i,j;
cin>>amout;
while(amout--)
{
bool flag=false;
cin>>billiard>>score1>>score2;
... | true |
f70b1495d4679e3e723f2d1d50180ce07e1ed230 | C++ | li3939108/leetcode | /partitionList.cpp | UTF-8 | 932 | 3.484375 | 3 | [] | no_license | #include <iostream>
using namespace std ;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode *partition(ListNode *head, int x) {
ListNode *lh = NULL, *gh = NULL, *ghead = NULL, *lhead = NULL;
while(head != NULL){
if(head->val < x){
ListNode *h = new ListNode(head... | true |
19fd19fab5cd7b714512c06f03ba7cc485ed846c | C++ | nancysolanki/hash-map.cpp | /highest freq.cpp | UTF-8 | 323 | 2.921875 | 3 | [] | no_license | #include<unordered_map>
int highestFrequency(int arr[], int n)
{
unordered_map<int,int>hm;
for(int i=0;i<n;i++)
{
hm[arr[i]]++;
}
int max=hm[arr[0]];
for(int i=0;i<n;i++)
{
if(hm[arr[i]]>hm[max])
{
max=arr[i];
return arr[i];
}
}
... | true |
8a4b201fb0f63ebbbd4f4c5090fd2fabf3c74859 | C++ | 808wzrd/D4--Texted-Based-Game | /ProjectV2/player.hpp | UTF-8 | 549 | 2.796875 | 3 | [] | no_license | #include <string>
using namespace std;
class Player
{
public:
Player(string, int, string, string, int);
string showName();
string showWeapon();
string showGender();
void pickWeapon(string newWeapon);
int showHP();
void decreaseHP(int decrease);
void increaseHP(int increase);
int showAttack();
void setAttack... | true |
833c72c733653871e6454a3e19b19383c589d711 | C++ | krre/qosg | /src/osg/ShapeDrawable.cpp | UTF-8 | 555 | 2.578125 | 3 | [] | no_license | #include "ShapeDrawable.h"
void ShapeDrawable::classBegin() {
if (osgObj == nullptr) {
osgObj = new osg::ShapeDrawable;
}
Drawable::classBegin();
}
void ShapeDrawable::setShape(Shape* shape) {
if (this->shape == shape) return;
this->shape = shape;
toOsg()->setShape(shape->toOsg());
... | true |
05de24cbd7528d08a5cac69d602ed18b2ef28bee | C++ | ROHITKUCHERIA/Cpp_Programming_Basics | /C++/tut28.cpp | UTF-8 | 564 | 3.28125 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Y; // forword diclaration
class X{
int data;
public:
void setValue(int value){
data= value;
}
friend void add(X,Y);
};
class Y{
int num;
public:
void setValue(int value){
num=value;
}
friend ... | true |
0d277393691b6ce38b39b64b2ebc7e97c5d13ec6 | C++ | yogomi/tiny-examples | /thread/src/main.cc | UTF-8 | 2,301 | 3.015625 | 3 | [] | no_license | // Copyright 2015 Makoto Yano
#include <iostream>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <chrono>
#include <list>
class HydraHead {
public:
HydraHead():counter_(0), beat_(false) {
hart_beats_.push_back(&beat_);
}
void Beat();
void HartBeat();
bool Continue() {return !... | true |
d3c0ef85adb0bcff7a22a9a3933e0a1371138b5c | C++ | TarunSinghania/Prewritten-code | /Graphs/weightedgraph.cpp | UTF-8 | 1,343 | 2.609375 | 3 | [] | no_license | #include <bits/stdc++.h>
//birdirectional weighted
using namespace std;
#define fr(i,a,b) for(int i =a ; i < b; i++)
#define mkp make_pair
#define pb push_back
#define pii pair<int,int>
#define speed ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
//unidirected
//addedge
//veector array passed as refernce... | true |
53a83a25639db29e11c88bf85b2732b5cf90a0f1 | C++ | gaohank/cxx-coding-project | /05_example/01_mystring/mystring.h | UTF-8 | 569 | 2.90625 | 3 | [] | no_license | #ifndef MYSTRING_H
#define MYSTRING_H
#include <stdio.h>
class mystring
{
public:
mystring(const char *str = "");
mystring(const mystring &another);
~mystring();
char *c_ptr();
void display();
mystring &operator=(const mystring &another);
mystring operator+(const mystring &another);
c... | true |
541b7d60cbfe254591e35e6760c63b26f919974c | C++ | XavierFox12/CodingPortfolio | /Hocking College C++/Xavier_Fox_Chp_4_Exercise_4/Xavier_Fox_Chp_4_Exercise_4/Xavier_Fox_Chp_4_Exercise_4.cpp | UTF-8 | 1,702 | 3.640625 | 4 | [] | no_license | /* Program: Xavier_Fox_Chp_4_Exercise_4.cpp
Programmer: Xavier Fox
Date: 29 Sep. 2014
Purpose: To determine what shape the user entered
and determine its area, or circumference.
*/
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
const dou... | true |
2e1b54c5aa6b4cd2508b7cbb25b538ba66cd5530 | C++ | andrewjianyoudai/Tutorial_Cpp | /Section4.1/CustmObjAsMapval/Source.cpp | UTF-8 | 1,103 | 4.09375 | 4 | [] | no_license | #include <iostream>
#include<map>
#include<string>
using namespace std;
class Person {
private:
string name;
int age;
public:
// Copy Constructor
Person(const Person &other) {
cout << "Copy constructor running !"<< endl;
name = other.name;
age = other.age;
}
// constructor with Nonparameter : d... | true |
2e6e5083ef69ace68687812dbfa0a6151de3e75a | C++ | SebMenozzi/FPS | /client/src/gui/menu.h | UTF-8 | 737 | 2.59375 | 3 | [] | no_license | #ifndef MENU_H_INCLUDED
#define MENU_H_INCLUDED
#include <vector>
#include <string>
#include <SDL2/SDL.h>
#include "../types.h"
#include "widget.h"
#include "../texturesContainer.h"
class Menu
{
public:
Menu(SDL_Window* window, std::string backgroundImage);
~Menu();
void draw(bool8 force = FALSE);
v... | true |
594ae0c3d3a23fc527447a3e1f1d7a6ad7d929df | C++ | ttzztztz/leetcodeAlgorithms | /Lintcode/1504. Shortest Path to Get All Keys.cpp | UTF-8 | 2,109 | 2.578125 | 3 | [] | no_license | class Solution {
public:
/**
* @param grid:
* @return: The lowest number of moves to acquire all keys
*/
int N, M;
bool pointValid(int i, int j) {
return i >= 0 && j >= 0 && i < N && j < M;
}
int shortestPathAllKeys(vector<string> &grid) {
int startX = 0, startY = 0, ... | true |
914320e7b9d8ede74197cf8a13f7b2f33d848501 | C++ | hhvyas/-365DaysOfCodes | /Day4(Heap).cpp | UTF-8 | 3,133 | 3.421875 | 3 | [] | no_license | /* Today I learnt about Heaps, and heap sort from https://www.youtube.com/watch?v=g9YK6sftDi0 it's very introductory video for learning about heap, and heap sort
After that to clear my doubts I refered to
https://www.youtube.com/watch?v=B7hVxCmfPtM&t=113s&ab_channel=MITOpenCourseWare (MIT) and https://www.geeksfor... | true |
bd5f3f02e4d18e36f9b5416dae12e565dae320e9 | C++ | j-jorge/tweenerspp | /include/tweeners/detail/slot_component.hpp | UTF-8 | 2,132 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef TWEENERS_DETAIL_SLOT_COMPONENT_HPP
#define TWEENERS_DETAIL_SLOT_COMPONENT_HPP
#include <vector>
namespace tweeners
{
namespace detail
{
/**
* \brief Associative container with fallback value for non existent keys.
*
* The intent of this container is to associate an optional value to a
... | true |
77ad27d948cbbd827683d0636f785e395c566e90 | C++ | SneakerMa/CppLearning | /Chapter_2/Sample_3.cpp | UTF-8 | 712 | 3.28125 | 3 | [] | no_license | #include <iostream>
int main() {
int ival = 1024;
int &refVal = ival; // refVal refers to (is another name for) ival
//int &refVal2; // error: a reference must be initialized
refVal = 2; // assigns 2 to the object to which refVal refers, i.e., to ival
int ii = refVal; // same as ii = ival
// ok: refVal3 ... | true |
2056cdb1563664724865ac86cd4855b79c6bc223 | C++ | dcheng0/os-spring-2019 | /data_structures/queue/bound_buffer.h | UTF-8 | 1,026 | 2.734375 | 3 | [] | no_license | #ifndef DOCUMENTS_BOUND_BUFFER_H
#define DOCUMENTS_BOUND_BUFFER_H
#include <vector>
namespace data_structures {
template<typename ValueType>
class BoundBuffer {
public:
private:
const int max_size_;
int size_;
int nextIn_;
int nextOut_;
typedef std::vector<int> BufferList;
typedef std::unique_... | true |
0b4ee4c71c0d772493d15712a4ffc727b2fb3c0a | C++ | Chaitanya142/Win32-COM | /Project/ChemDll/Source.cpp | UTF-8 | 7,029 | 2.625 | 3 | [] | no_license | #include "ChemDllHeader.h"
class CGayLussacsLawCalculator :public ICIP, ICIT, ICFP, ICFT {
private:
long m_cRef;
public:
CGayLussacsLawCalculator();
~CGayLussacsLawCalculator();
HRESULT __stdcall QueryInterface(REFIID, void **);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall Ca... | true |
6fa2865dbf28246595cf6e4a0b3d4075dfaa2600 | C++ | dhawt/Immerse | /Code/GeomMngr/imr_gm_figure.cpp | UTF-8 | 14,287 | 2.625 | 3 | [] | no_license | /****************************************************************\
iMMERSE Engine
(C) 1999 No Tears Shed Software
All rights reserved
Filename: IMR_GM_Figure.hpp
Description: Figure module
\****************************************************************/
#include "IMR_GM_Figure.hpp"
/**********************... | true |
8f74eb3945dd5bb18d67167544018bf95256f8b1 | C++ | alerodriguezz/teacher_grading_system | /project3_rodriguez.cpp | UTF-8 | 11,305 | 3.6875 | 4 | [] | no_license | /*
Title: Project 3
Abstract: This program will read a file that reads a student's name, id, five quiz scores, two midterm scores, and one final scores. This program and calculate the numeric average, letter grade, and ranking of each student. After that,
your program should display the course result in order of num... | true |
ead4ca160bdcc51429863226ea4669ff0cbfe4ac | C++ | realn/CodeBox | /src/CBCore/StringConvert.cpp | UTF-8 | 1,972 | 2.953125 | 3 | [
"BSL-1.0"
] | permissive | #include "stdafx.h"
#include "utf8.h"
#include <sstream>
#include <CBCore/StringConvert.h>
#include <CBCore/StringFunctions.h>
namespace cb {
using namespace std::string_literals;
auto const STR_BOOL_TRUE = L"true"s;
auto const STR_BOOL_FALSE = L"false"s;
auto const STR_BOOL_TRUE_CAP = L"True"s;
auto con... | true |
5f21ed9d61323baf24419b2e94649f9297455599 | C++ | bbetsey/cppPiscine | /cpp03/ex01/ScavTrap.cpp | UTF-8 | 1,188 | 3.296875 | 3 | [] | no_license | #include "ScavTrap.hpp"
//MARK: - Class Constructor
ScavTrap::ScavTrap( std::string name ) : ClapTrap( name, 100, 50, 20) {
std::cout << "ScavTrap Default Constructor called" << std::endl;
}
//MARK: - Class Distructor
ScavTrap::~ScavTrap( void ) {
std::cout << "ScavTrap Class Distructor called" << std::endl;
}
... | true |
77e523d18ad390ba36e171c005fefa1f5763b0fc | C++ | scofieldfirst/meteor | /utilities/collections/Queue.h | UTF-8 | 2,777 | 3.578125 | 4 | [
"LicenseRef-scancode-public-domain"
] | permissive | #ifndef QUEUE_H
#define QUEUE_H
#include <new>
#include <stddef.h>
template<typename T>
class Queue
{
private:
T* buffer;
size_t capacity;
size_t front, rear;
public:
explicit Queue(size_t capacity):
capacity(capacity),
front(0),
rear(0)
{
buffer = (T*) ::operator new[](sizeof(T) * capacity);
}
~Que... | true |
6d9611d15d4e4786fa8abd0d20dcd44546d7affe | C++ | CraigBarryDev/PBRShading | /backdrop.cpp | UTF-8 | 1,494 | 2.609375 | 3 | [] | no_license | #include "backdrop.h"
Backdrop::Backdrop() {}
Backdrop::Backdrop(Loader* loader, ModelTexture* tex, BackdropShader* bShader) {
vector<GLfloat> vPositions(std::begin(vertices), std::end(vertices));
vector<GLfloat> vNormals(std::begin(normals), std::end(normals));
vector<GLfloat> vTexCoords(std::begin(texCoords), st... | true |
3d060caf7a1eb69e4f3e4c9bbcf3606ef7bfc1d2 | C++ | baterobeto/TP1-Ciclista | /SegundaParte/GregoEjercicioProductoria.cpp | UTF-8 | 725 | 3.984375 | 4 | [] | no_license | #include <iostream>
using namespace std;
void leer(string mensaje, int &valor)
{
cout << mensaje << endl;
cin >> valor;
}
void calculo(int numero, int &producto, int resultado)
{
while (numero != 0)
{
producto = numero * producto;
resultado = producto;
leer("Ingrese un numer... | true |
57e88b42a7f2cc9a2fa1778999b15e78fbbd0f81 | C++ | XEnDash/ProjectTemplate | /src/str.cpp | UTF-8 | 6,893 | 3.203125 | 3 | [] | no_license | #include "defines.h"
#include "import_std.h"
String::String()
{
num_of_string_objects++;
this->length = 0;
this->c_str = 0;
this->allocated = false;
}
String::~String()
{
num_of_string_objects++;
if(this->allocated)
{
this->Deallocate();
}
this->length = 0;
this->c... | true |
b2e831302e6961991573eca8798353ee296cb80c | C++ | soulsystem00/bj_2798 | /bj_2798/bj_1934.cpp | UTF-8 | 364 | 2.765625 | 3 | [] | no_license | //#include <iostream>
//
//using namespace std;
//
//int main(void)
//{
// int loop;
// cin >> loop;
// for (int i = 0; i < loop; i++)
// {
// int N, M;
// cin >> N >> M;
// if (N > M)
// {
// swap(N, M);
// }
// int j = N;
// for (;; j--)
// {
// if (N % j == 0 && M % j == 0)
// {
// break;
// }
// ... | true |
b6d6ce786f0ed804b6c5588cd7b7988db3d0096c | C++ | 18600130137/leetcode | /LeetCodeCPP/207. Course Schedule/main.cpp | UTF-8 | 1,415 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | //
// main.cpp
// 207. Course Schedule
//
// Created by admin on 2019/6/12.
// Copyright © 2019年 liu. All rights reserved.
//
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
class Solution {
public:
bool canFinish(int n, vector<pair<int, int>>& p) {
//1、直接满足条件
int m... | true |
1480d451e740b5688344b1a93a0186d62d3e11fa | C++ | arcbot-id/arduino | /Servo_Distance_Indicator/servo_distance_indicator.ino | UTF-8 | 845 | 3.15625 | 3 | [] | no_license | //import library Servo
#include <Servo.h>
//import library NewPing
#include <NewPing.h>
//declare constants
const int ServoPin = 10;
const int TriggerPin = 6;
const int EchoPin = 7;
//declare a NewPing object called sonar with TriggerPin as trigger, EchoPin as echo, and 100 cm as max distance
NewPing sonar (TriggerPi... | true |
82bcb9deb437a7a5482fe2eb2fd80ebe8e3f2f73 | C++ | 15831944/BeijingEVProjects | /小浪底泥沙三维/EV_Xld/jni/src/EV_XldManager/RenderLibDataType.h | GB18030 | 1,049 | 2.609375 | 3 | [] | no_license | #ifndef RENDERLIBDATATYPE_H_
#define RENDERLIBDATATYPE_H_
namespace EarthView
{
namespace Xld
{
namespace RenderLib
{
/// <summary>
/// öָʾɵ״̬
/// </summary>
enum CMousePickState
{
/// <summary>
/// ɵһ
/// </summary>
ToFirst = 1,
/// <summary>
/// ɵڶ
/// </summary>
... | true |
65e2a82c92ad54aba41c8708c34081717e1e46be | C++ | edisonhello/waynedisonitau123 | /Codebook/string/KMP.cpp | UTF-8 | 800 | 3.203125 | 3 | [] | no_license | vector<int> Failure(const string &s) {
vector<int> f(s.size(), 0);
// f[i] = length of the longest prefix (excluding s[0:i]) such that it coincides with the suffix of s[0:i] of the same length
// i + 1 - f[i] is the length of the smallest recurring period of s[0:i]
int k = 0;
for (int i = 1; i < (int)s.size()... | true |