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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e45bdc2d9a1b14e3db279245e2e62200dda4a965 | C++ | 536BLF/BLF | /Testing/Ben_MostRecent/BLF536/BLF536.ino | UTF-8 | 6,661 | 2.71875 | 3 | [] | no_license | #include "Macros.h"
#include <AFMotor.h>
#include "Car.h"
#include "Sensor.h"
#include "Tester.h"
int j;
enum {INIT, READ_2_LINE, READ_LEFT_LINE, READ_RIGHT_LINE, READ_NO_LINE, INTERSECTION} state = INIT;
Sensor leftSensor(PIN_ANALOG_0, WHITE_LINE);
Sensor rightSensor(PIN_ANALOG_1, WHITE_LINE);
Tester tester;
Ca... | true |
631938f7b820dd4d75e8a243d40c0d32904afc27 | C++ | Varinderr/Basic-Programs | /reverse string.cpp | UTF-8 | 309 | 2.953125 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
void reverse(string& str)
{
{
int n = str.length();
for (int i = 0; i < n / 2; i++)
swap(str[i], str[n - i - 1]);
}
}
int main()
{
int n;
{
string str = "geeks for geeks";
reverse(str);
cout << str;
getch();
}
} | true |
09b311e4d924f6fce528b52c3d9287b82e84ed0b | C++ | luizalbertocviana/cracking-coding-problems | /ch1/q1.cpp | UTF-8 | 947 | 3.640625 | 4 | [] | no_license | #include <args.hpp>
#include <iostream>
#include <set>
#include <string>
// determine whether a string has all unique characters
bool unique(const std::string& col){
// we are going to use a set to determine whether we see a character
// more than once
std::set<char> set {};
for (char c : col){
// if c i... | true |
8c814b57f23337680244e55092276716c4be53e7 | C++ | HyungseobKim/Hon | /hon_source/Asterisk/Text.h | UTF-8 | 5,046 | 3.25 | 3 | [] | no_license | #ifndef TEXT_H
#define TEXT_H
/*!*******************************************************************
\headerfile Text.h <>
\author Kim HyungSeob
\par email: hn02415 \@ gmail.com
\brief Header file for Text Class.
\copyright
All content 2018 DigiPen (USA) Corporation, all rights reserved.
**************... | true |
16a16980f0c0698d4f5ceee159f56866af70c653 | C++ | mohitpandey94/SPOJ-Solutions | /spoj/ANARC09A/ANARC09A-13179594.cpp | UTF-8 | 1,527 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
struct st {
char a[10000];
long int top;
long int index[10000];
};
void push (struct st *s, char val, int i) {
s->a[++(s->top)]=val;
s->index[s->top]=i ;
}
long int pop (struct st *s) { long int item=s->index[... | true |
41bad805c7ab4a7878340ad4b5dbc3ca262cbab7 | C++ | eldridger/dataexchange-diffmerge | /src/Merger.cpp | UTF-8 | 7,593 | 3.078125 | 3 | [] | no_license |
#include <vector>
#include <iostream>
#include <string>
#include "Merger.h"
//merged node, new node
void setFlags(Node* mNode, Node* nNode) {
//Neither are empty = DIFF
std::vector<Node*>::iterator it1 = mNode->children.begin();
std::vector<Node*>::iterator it2 = nNode->children.begin();
while (it1 != mNode->chi... | true |
33e6d034e0f2191c7083954c4779f62489da63b0 | C++ | daniil6/RBKLib | /src/parse_string_v1/parsestring_v1.cpp | UTF-8 | 4,782 | 2.859375 | 3 | [] | no_license | #include "parse_string_v1/parsestring_v1.h"
CParseStringV1::CParseStringV1()
{
m_root = nullptr;
}
CParseStringV1::~CParseStringV1()
{
}
void CParseStringV1::DeleteTree(StringTree* node)
{
if(node != nullptr) {
DeleteTree(node->GetLeft());
DeleteTree(node->GetRight());
delete node;
... | true |
aa1a1e6e9e24d9449dad7a040411e8f0d7900b43 | C++ | ogoodman/serf | /cpp/reactor/data_reader.h | UTF-8 | 931 | 2.75 | 3 | [] | no_license | #ifndef DATA_READER_HPP_
#define DATA_READER_HPP_
#include <serf/reactor/reader.h>
namespace serf {
class DataHandler;
class Reactor;
/** \brief Moves data from a socket to a handler.
*
* Readers are added to the reactor and each time their socket
* becomes ready to read, their run functi... | true |
11ae84a576072b0e41a25a3fd8705edc191b4a74 | C++ | ailyanlu/acm-code | /template/uni/Geometry/point.cc | UTF-8 | 1,742 | 3.421875 | 3 | [] | no_license | struct point {
double x, y;
point() {
}
point(double _x, double _y) : x(_x), y(_y){};
void input() {
scanf("%lf%lf", &x, &y);
}
void output() {
printf("%.2f %.2f\n", x, y);
}
bool operator==(point a) const {
return dblcmp(a.x - x) == 0 && dblcmp(a.y - y) == 0;... | true |
5c06cd7619d338458ada61ec8a7a08be5f08e54e | C++ | b04902009/2018-fc | /hw1/hw1.cpp | UTF-8 | 2,793 | 3.59375 | 4 | [] | no_license | /*****************************************************************************************
Write a program to price the American put and its delta based on the CRR binomial tree.
Inputs: (1) S (spot price), (2) X (strike price), (3) r (risk-free interest rate),
(4) s (volatility), (5) T (years), (6) n (number ... | true |
630191f543311d94d8dd29dc34e0aa62a6f31dc6 | C++ | SBNSoftware/sbndaq-artdaq | /sbndaq-artdaq/Generators/SBND/NevisTPC/nevishwutils/TimeUtils.cpp | UTF-8 | 407 | 2.59375 | 3 | [] | no_license | #include "TimeUtils.h"
namespace nevistpc {
long diff_time_microseconds(struct timeval t2, struct timeval t1){
return (t2.tv_sec*1e6 + t2.tv_usec - t1.tv_sec*1e6 - t1.tv_usec);
}
float diff_time_milliseconds(struct timeval t2, struct timeval t1){
float micro = (float)(t2.tv_sec*1e6 + t2.tv_usec - t1.... | true |
7f335332c80bd19bf3ae85abb15ffed0da720df4 | C++ | pm95/Duplicate-Remover | /LinkedList.h | UTF-8 | 1,272 | 3.890625 | 4 | [] | no_license | #ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <iostream>
#include "Node.h"
template <class T>
class LinkedList
{
public:
Node<T> *head;
Node<T> *tail;
LinkedList()
{
this->head = nullptr;
this->tail = nullptr;
}
~LinkedList()
{
while (this->head != nullptr)
... | true |
acfae5cd4a5ebede5509aa83417f3dcfaa57510f | C++ | lulzzz/ChildProcess | /src/ChildProcess.Native/ErrnoExceptions.hpp | UTF-8 | 543 | 2.59375 | 3 | [
"MIT"
] | permissive | // Copyright (c) @asmichi (https://github.com/asmichi). Licensed under the MIT License. See LICENCE in the project root for details.
#pragma once
class ErrnoError
{
public:
ErrnoError(int err) noexcept : err_(err) {}
int GetError() const noexcept { return err_; }
private:
const int err_;
};
class Commun... | true |
9b25536bac15df19ada6a47bf7ebc2c175393f70 | C++ | FPStudies/ALHE_CardStacking | /Cards_heuristics/tests/testNormal.h | UTF-8 | 2,382 | 3.296875 | 3 | [] | no_license | /**
* @file testNormal.h
* @brief Plik klasy podstawowego testu
*
*/
#ifndef TEST_NORMAL_H
#define TEST_NORMAL_H
#include "testInterface.h"
#include "testCardsHeuristic.h"
#include <fstream>
#include <iostream>
#include <sstream>
/**
* @brief Klasa podstawowego testu
*
*/
class TestNormal... | true |
a16c669d0c8f102607f46cd90937d692a67629b3 | C++ | THU-changc17/Hotel-reservation-and-management | /src/data_object.h | UTF-8 | 3,076 | 2.59375 | 3 | [] | no_license | #ifndef DATA_OBJECT_H
#define DATA_OBJECT_H
#include"all_headers.h"
#include"connection.h"
class client_user
{
private:
QString sid,pwd;
public:
explicit client_user();
explicit client_user(const QString &nsid,const QString &npwd);
virtual QString get_sid() const;
virtual QString get_pwd() const;
... | true |
f97bee720ef3de187c1153df8313c0616e43c921 | C++ | UTEC-PE/binary-tree-Joe-08 | /iterador.h | UTF-8 | 676 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include "nodo.h"
using namespace std;
class iterador{ // Falta
private:
Nodo *corriente;
public:
stack<Nodo*> miStack;
iterador(){
corriente = NULL;
}
iterador(Nodo* nodo){
this->corriente = nodo;
}
iterador operator++(){
miStack.pop();
c... | true |
7d77bd96abb29037faac163e1b7f77c8e2d3ac66 | C++ | rimsa/GameSelector | /include/GameSelector/util/GameSort.h | UTF-8 | 922 | 2.640625 | 3 | [] | no_license | #ifndef GAMESORT_H
#define GAMESORT_H
#include <QObject>
class Game;
class GameComparator;
class GameSort : public QObject {
Q_OBJECT
Q_ENUMS(OrderType)
public:
enum OrderType {
ByName,
ByGenre,
ByDeveloper,
ByPublisher,
ByYear,
BySize,
};
friend c... | true |
1dbba091bbb301f3446651834edfca4dcf087b43 | C++ | AliTaheriNastooh/LightOJ_Problem | /Q1019/main.cpp | UTF-8 | 2,048 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
using namespace std;
#define MAX1 102
#define inf 1<<7
vector<int > arr[MAX1];
vector<int> weight[MAX1];
int dikstra(int s,int t){
int visited[MAX1];
int color1[MAX1];
int dis[MAX1];
priority_queue<pair<int ,in... | true |
80fa2447871d77e0138c5c3b758f45982965274d | C++ | karak/TopologyOriented | /Graph.h | WINDOWS-1257 | 18,623 | 2.78125 | 3 | [] | no_license | #pragma once
#include "Vector2.h"
#include "Geometry.h"
typedef std::size_t index_t;
static const index_t NOTHING = -1;
class RegionItemBase
{
public:
RegionItemBase() : he_(NOTHING)
{
}
RegionItemBase(index_t he) : he_(he)
{
}
index_t boundingHalfedge() const
{
return he_;
}
... | true |
091a91b6072fbade29d7e9a3f18bbe4ea9e8be47 | C++ | 20-1-SKKU-OSS/2020-1-OSS-7 | /C-Plus-Plus/BOJ/14502.cpp | UTF-8 | 1,488 | 2.984375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int N, M; //가로, 세로
int arr[8][8];
int arr2[8][8];
int dx[] = { 1,-1,0,0 };
int dy[] = { 0,0,1,-1 };
int result;
void bfs(void)
{
int arr3[8][8];
int number=0;
queue <pair <int, int > > q;
for (int i = 0; i < N; i++)
for (int j = 0;... | true |
6d582dc734ea6e76f7d980ec662e50746e991428 | C++ | ju5tinz/GraphicsUFOProject | /Flyer.cpp | UTF-8 | 5,567 | 2.96875 | 3 | [] | no_license | #include "Flyer.h"
Flyer::Flyer(std::string objFilename, GLuint shaderProgram, glm::mat4 model) :
shaderProg(shaderProgram), model(model) {
std::ifstream objFile(objFilename); // Open obj file
// If the file has been opened
if (objFile.is_open()) {
std::vector<GLuint> vertex_indices;
std::vector<GLuint> norm... | true |
9f53320ece6838897b33d4b08d2fa6eff55e52fa | C++ | geefr/IKEngine | /src/joint.cpp | UTF-8 | 3,021 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive |
#include "joint.h"
#include "limb.h"
#ifdef IKENGINE_OSG
# include <osg/ShapeDrawable>
#endif
namespace IKEngine
{
Joint::Joint( Servo* servo, const vec3& rotationAxis )
: m_servo{ servo }
, m_position{ 0.0, 0.0, 0.0 }
, m_rotation{ 0.0, 0.0, 0.0 }
, m_servoAxis{ rotationAxis }
{
}
Joint::~Jo... | true |
2c6d245c997c42ab2a260ed7c2d3d65ada10f6cf | C++ | simdjson/simdjson | /include/simdjson/generic/dom_parser_implementation.h | UTF-8 | 3,856 | 2.5625 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"BSL-1.0"
] | permissive | #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#define SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H
#include "simdjson/generic/base.h"
#include "simdjson/internal/dom_parser_implementation.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
namespace simdjson {
namespace SIMDJSON_IMPL... | true |
473bb43589b8423d1547f2ff1153a0a74f84e76d | C++ | thatdude-cpu/Codedump | /CC++/pegelstand.cpp | ISO-8859-1 | 981 | 2.609375 | 3 | [
"MIT"
] | permissive | # include <stdlib.h>
# include <stdio.h>
# include <windows.h>
# include <math.h>
void gotoxy (short x, short y)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X=x-1;
pos.Y=y-1;
SetConsoleCursorPosition(hcon , pos);
}
int main (void)
{
int d;
double wert,min=0,max=0,Summe=0.0,durchschnitt=0,schw=... | true |
371eb2c457abd4329a83b1dce5040bb1fb4b88f9 | C++ | gumeniukcom/aptu-os | /labs/504/aleksandrov.yuriy/05_filesystem/import.cpp | UTF-8 | 910 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include "meta_fs.h"
#include <string>
using namespace std;
int main (int argc, char *argv[]) {
try
{
if (argc != 4)
{
cout << "Usage: import root host_file fs_file" << endl;
return -2;
}
else
{
Meta_FS fs(argv[1]... | true |
566282f2eed75264a3cb5d97a06b04e7d09e5435 | C++ | Taohid0/C-and-C-Plus-Plus | /GCD again/main.cpp | UTF-8 | 307 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int gcd (int a,int b){
int remainder;
while(1)
{
remainder = a%b;
if(remainder==0){
return b;
}
a = b;
b = remainder;
}
}
int main()
{
cout << gcd(48,6) << endl;
return 0;
}
| true |
8b0968045b25710f8e32992731d0471fa9adac7d | C++ | miyamotononno/atcoder | /others/aoj/DPL/maximum_rectangle/maximum_rect.cpp | UTF-8 | 1,056 | 2.921875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include "module.hpp"
using namespace std;
/*
最大長方形問題
https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/3/DPL_3_B
*/
int calcMaximumArea(const vector<vector<int>>& memo) {
int ans = 0;
for (int h=0; h<memo.size(); h++) {
vector<int> d = memo[h];
// for_each(d.beg... | true |
4918a4f599deac11a6d35e949c8d4f7c7608d950 | C++ | antaljanosbenjamin/raytracer | /src/Utils/Scene.cpp | UTF-8 | 12,695 | 2.8125 | 3 | [] | no_license | #include "Utils/Scene.h"
#include <cstring>
#include <iostream>
#include <thread>
#include "Lights/PointLight.h"
int Scene::TRACE_DEPTH = 5;
Scene::Scene(Camera cam_init, int screenW, int screenH, Color *img)
: cam(cam_init), screenWidth(screenW), screenHeight(screenH), mutex(), nextPixelNumber(0),
image(im... | true |
9f63a0ba7c03c9c1f796f3a1dd99e6b30552a75f | C++ | farhanch67/OOP-Programs-in-Cplusplus | /home task 1.cpp | UTF-8 | 446 | 3.4375 | 3 | [] | no_license | #include<iostream>
using namespace std;
struct phone{
int code;
int exchange;
int number;
};
int main()
{
phone my,your;
my.code=212;
my.exchange=767;
my.number=8900;
cout<<"Enter your Area Code,Exchange and Number :";
cin>>your.code>>your.exchange>>your.number;
cout<<"My Number is"<<" ("<<my.code<<") "<<my.e... | true |
cfc5fcc2282416f46e2ba0f017c876a83e1259b1 | C++ | searleser97/DistribuitedSystems | /Proyectos/sergio/Proyecto 3/src/Reply.cpp | UTF-8 | 1,173 | 2.71875 | 3 | [] | no_license | #include "../include/Reply.h"
#include <iostream>
#include <string.h>
Reply::Reply(int iport) { localSocket = new DatagramSocket(iport); }
Message *Reply::getRequest() {
auto *msg = new Message();
DatagramPacket pq((char *)msg, sizeof(Message));
localSocket->receive(pq);
address = pq.getAddress();
port = p... | true |
085871d0ebe20ea6aa1815a666a95d44311ed4ad | C++ | hykilpikonna/School-CppAssignments | /homeworks/b004-delivery.cpp | UTF-8 | 1,615 | 3.453125 | 3 | [
"MIT"
] | permissive | //
// Created by Hykilpikonna on 9/28/20.
//
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// Input
printf("Enter weight of package in kilograms: ");
double weight;
cin >> weight;
printf("Enter length of package in meters: ");
double length;
cin >> length;
p... | true |
d06c3ff1c56173c7f9efb325d93341e87d4e9592 | C++ | MAD1364/Practice | /c/practice/Computer_Programming_Practice_77.cpp | UTF-8 | 3,016 | 3.234375 | 3 | [] | no_license | /*
File: Computer_Programming_Practice_77.cpp
Author: Mario Delagarza
C.S.1428.001
Lab Section: L07
Program: P77
--/--/--
This program
Input:
Constants:
Output:
*/
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main ( )... | true |
feb66c5abfa006d06824951b700644171fa5c604 | C++ | hallgchris/Osmium | /nbody/src/UI.cpp | UTF-8 | 4,381 | 2.546875 | 3 | [] | no_license | #include "UI.h"
#include "components/PhysicsComponent.h"
#include "components/PathComponent.h"
#include <imgui.h>
#include <render/entity/components/PlayerControlFPV.h>
namespace ui
{
static int32_t entitySelectionIndex = 0;
void update(std::shared_ptr<os::Scene> scene, TimeState *timeState, int32_t *exp)
{
ImGu... | true |
8a719d2380752a9b9fc5560c9df24cd787fbcb79 | C++ | dbaumeister/dbcpu | /operators/ProjectionOperator.h | UTF-8 | 647 | 2.765625 | 3 | [] | no_license | //
// Created by dbaumeister on 17.06.15.
//
#ifndef PROJECT_PROJECTIONOPERATOR_H
#define PROJECT_PROJECTIONOPERATOR_H
#include "Operator.h"
class ProjectionOperator : public Operator{
public:
ProjectionOperator() = delete;
ProjectionOperator(const std::vector<unsigned>& projectionIndices, Operator& child)
... | true |
500231581a5a78e8dedd59f328df8dcc0641fbb9 | C++ | gjbex/training-material | /CPlusPlus/Tbb/Tree/src/sum_task.h | UTF-8 | 1,393 | 2.90625 | 3 | [
"CC-BY-4.0"
] | permissive | #ifndef SUM_TASK_HDR
#define SUM_TASK_HDR
#include <tbb/tbb.h>
#include "tree.h"
template<typename T>
class SumTask : public tbb::task {
private:
Node<T>* node_;
T* sum_;
public:
SumTask(Node<T>* node, T* sum) : node_ {node}, sum_ {sum} {}
tbb::task* execute() override;
};
tem... | true |
c97bef565faee0e9ac10fb7fa92e94ec6c361eb3 | C++ | Radu1999/SAT-reduction | /src/cpp_implementation/task2.h | UTF-8 | 6,700 | 3.03125 | 3 | [] | no_license | // Copyright 2020
// Authors: Radu Nichita, Matei Simtinică
#ifndef TASK2_H_
#define TASK2_H_
#include "task.h"
/*
* Task2
* You have to implement 4 methods:
* read_problem_data - read the problem input and store it however you see fit
* formulate_oracle_question - transform the current problem instance ... | true |
8226a119c97bcacf234af7468124d250a3928684 | C++ | iwtbam/leetcode | /code/lt0973.cpp | UTF-8 | 989 | 3.09375 | 3 | [] | no_license | #include <vector>
#include <utility>
#include <queue>
using namespace std;
class Solution {
public:
struct cmp
{
bool operator()(const pair<int, double>& p1, const pair<int, int>& p2)
{
return p1.second < p2.second;
}
};
vector<vector<int>> kClosest(vector... | true |
c47b72df1be1afd691e06976d849ec145461b7b8 | C++ | likema/sqlite3pp | /test/testselect.cpp | UTF-8 | 1,234 | 2.796875 | 3 | [] | no_license | #include <string>
#include <iostream>
#include "sqlite3pp.h"
using namespace std;
int main()
{
try {
sqlite3pp::database db("test.db");
sqlite3pp::transaction xct(db, true);
{
sqlite3pp::query qry(db, "SELECT id, name, phone FROM contacts");
for (int i = 0; i < qry.column_count(); ++i) {
... | true |
4dbf5fd7ff44cbc77dcccfe7831fda229f3ddb7a | C++ | Chai-YD/CPP_exe | /library_file_code/main.cpp | UTF-8 | 2,235 | 3.515625 | 4 | [] | no_license | #include "book.h"
void initialize();
void addBook();
void borrowBook();
void returnBook();
void displayBook();
int main(){
int selector;
while(1){
cout<<"0--退出\n";
cout<<"1--初始化文件\n";
cout<<"2--添加书籍\n";
cout<<"3--借书\n";
cout<<"4--还书\n";
cout<<"5--显示所有书目信息\n";
... | true |
4dd882360e520ed42a6797d2c6989c187e47034d | C++ | parallaxinc/PropWare | /PropWare/serial/i2c/i2cslave.h | UTF-8 | 19,210 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* @file PropWare/serial/i2c/i2cslave.h
*
* @author Markus Ebner
* @author David Zemon
*
* @copyright
* The MIT License (MIT)<br>
* <br>Copyright (c) 2013 David Zemon<br>
* <br>Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated do... | true |
da69abd95b62c79bc83b1cf4dc2e3472eca9b4eb | C++ | baur-krykpayev/leetcode | /solutions/easy/728. Self Dividing Numbers.cpp | UTF-8 | 688 | 3.609375 | 4 | [] | no_license | /*
* Problem: 728. Self Dividing Numbers [easy]
* Source : https://leetcode.com/problems/self-dividing-numbers/description/
* Solver : Baur Krykpayev
* Date : 4/11/2018
*/
class Solution {
public:
vector<int> selfDividingNumbers(int left, int right)
{
vector<int> ret;
for (int... | true |
346ff10fe8ed0930e9d665cb9966112a1f9ab644 | C++ | cppbear/Advanced_Programming | /Exam_4/Exam_4/Transport.h | UTF-8 | 1,965 | 3.484375 | 3 | [] | no_license | #pragma once
#include <iostream>
using namespace std;
class Truck
{
private:
int ID;
double TotalCost;
double TotalIncome;
public:
Truck(int id) { ID = id; TotalCost = 0.0; TotalIncome = 0.0; }
virtual double cost(int targetDistance, int weight) = 0;
virtual double price(int targetDistance) = 0;
v... | true |
f6b68caf1f0c415efe528295e7a4a9f5cfa4674f | C++ | vmichal/Competitive | /ACM/2019-winter/1/minimal_coverage.cpp | UTF-8 | 1,548 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <queue>
#include <algorithm>
std::vector<std::vector<int>> read_neighbours(int M) {
std::vector<std::vector<int>> segments(M);
while (true) {
int l, r;
std::cin >> l >> r;
if (l == 0 && r == 0) {
std::cin.ignore(10, '\n');
... | true |
09e19fefeb0df1c41907560351589d75a3f824ff | C++ | hightemplarzzyy/2018-Game | /Root Folder/Game/World/world/world.h | GB18030 | 1,114 | 2.515625 | 3 | [
"MIT"
] | permissive | #pragma once
#pragma once
#include "..\..\Render Engine\toolbox\color.h"
#include "..\world config\worldconfigs.h"
#include "..\terrain\terrain.h"
#include "..\generator\perlinnoisegenerator.h"
using namespace std;
class World {
public:
static const Color BACK_COLOR; //ɫ
static const int CHUNK_COUNT = 5; ... | true |
4a14d2c1d2e9c81a4c49ed2502d5df5e0d86b1b6 | C++ | luoshenseeker/UVS | /Class/Bigint.cpp | UTF-8 | 6,702 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <vector>
/*
*¿ÉÒÔ¿¼ÂÇʹÓ÷´Âëϵͳ
*/
using namespace std;
class BigInteger
{
private:
static const int BASE = 10000;
static const int WIDTH = 4;
vector<int> s;
int flag;
public:
inline bool IsMinus()const { return ... | true |
6cc62da78c95db109a4746700172cbab4c7d252f | C++ | Mrremrem/Mental-math | /HeadersAndSources/MathFunctions.cpp | UTF-8 | 945 | 3.3125 | 3 | [
"MIT"
] | permissive | #include "MathFunctions.h"
MathFunctions::MathFunctions()
{}
MathFunctions::~MathFunctions()
{}
unsigned MathFunctions::terms(int begin, int end, int difference)
{
return (end - begin) / difference + 1;
}
unsigned MathFunctions::gcd(unsigned first, unsigned second)
{
// checks if a zero was passed
if (f... | true |
b3efde9d6e96eab1edcfa6448d3ddc6a5ffb1f94 | C++ | WeakKnight/OpenGL3.3 | /OpenGLBaseTemplate/System/SystemTexture.cpp | UTF-8 | 6,548 | 2.515625 | 3 | [] | no_license |
#include "SystemTexture.hpp"
#include "Shader.hpp"
#include "SOIL.h"
//====================================================================================================
bool TGA2DTexture::init(const std::string& szFileName, GLenum minFilter, GLenum magFilter, GLenum wrapMode)
{
// GLbyte* pBits = readTGABits(sz... | true |
8f4b9f4a761d506463bb577ce5469c52810e7364 | C++ | shindong96/2021_winter_vacation_code_file | /66. 경로 탐색(DFS 인접리스트 방법).cpp | UTF-8 | 1,528 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
/*
66. 경로 탐색(DFS : 인접리스트 방법)
방향그래프가 주어지면 1번 정점에서 N번 정점으로 가는 모든 경로의 가지 수를 출력하는 프
로그램을 작성하세요. 아래 그래프에서 1번 정점에서 5번 정점으로 가는 가지 수는
1 2 3 4 5
1 2 5
1 3 4 5
1 4 2 5
1 4 5
총 6 가지입니다.
▣ 입력설명
첫째 줄에는 정점의 수 N(1<=N<=20)와 간선의 수 M가 주어진다. 그 다음부터 M줄에 걸쳐 연
결정보가... | true |
af8a1a6bcca18a71ff4efc053ccc2a98cd577637 | C++ | aashimawadhwa/cpp-programs | /insertion_sort.cpp | UTF-8 | 389 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
using namespace std;
void swap(int &a, int &b)
{
int temp=a;
a=b;
b=temp;
}
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=1;i<n;i++){
int j=i;
while (arr[j-1]>arr[j] && j>0)
{
swap(arr[j-1],arr[j]);
... | true |
760d8aa899879a3e85f1d5b5896712b0a9de6d48 | C++ | zzrpsd/BuzRouter | /bus.cpp | UTF-8 | 803 | 2.515625 | 3 | [] | no_license | #include "bus.h"
void Bus::initialize( void )
{
/* Pinouts */
pinouts.resize( bits[0].pin_shapes.size() );
for ( auto p = 0; p < pinouts.size(); ++p ) {
auto& pinout = pinouts[p];
auto& dir = pinout.direction;
if ( bits.size() == 1 ) continue;
// x-/y-oordinates of bit 0 and bit 1
const auto&... | true |
516abfffa5cf5a4bfcdcf050e72684ae65a11483 | C++ | pigatron-industries/xen_midi2cv | /src/drivers/PitchCvOutput.h | UTF-8 | 836 | 2.90625 | 3 | [
"Unlicense"
] | permissive | #ifndef PitchCvOutput_h
#define PitchCvOutput_h
#include <inttypes.h>
#define PITCH_MIN_VOLTAGE -10
#define PITCH_MAX_VOLTAGE 10
class PitchCvOutput {
public:
PitchCvOutput(uint8_t dataPin, uint8_t latchPin, uint8_t clockPin, uint8_t size);
/**
* Set a value of a single output. The actual output is no... | true |
8e29ae3b53bc14208f38908472c69cd5fcb303a2 | C++ | alanc9016/leetcode | /studies/Graphs/main.cpp | UTF-8 | 2,910 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
class Graph {
public:
Graph(int size) :
size(size) {
adj.resize(size);
}
void insert(int,int);
void bfs(int s);
void dfs();
void dfs_util(int,bool*);
void topo_sort();
void dfs_visit(int,bool*);
... | true |
3ae21af276d4e7e567d756a8ccf239a150a26ed1 | C++ | Duckle29/Relay-timer | /firmware/relay_timer/relay_timer.ino | UTF-8 | 3,415 | 2.65625 | 3 | [] | no_license |
const uint8_t CA_offset = 8;
// A, B, C, D, E, F, G, DP, CA1, CA2, CA3, CA4
const uint8_t seg_pins[] = {2, 4, 5, 6, 7, 8, 12,13, 3, 9, 10, 11};
const uint8_t relay_pin = A1;
const uint8_t pot_pin = A0;
const uint8_t btn_pin = A2;
const uint8_t buz_pin = A3;
const uint8_t beep_period = 1000; /... | true |
ec76c6c2487c76632dd72cb53c8ce5a04219347e | C++ | FChia11/GirlScriptCode | /Operators.cpp | UTF-8 | 566 | 3.671875 | 4 | [] | no_license | // ASSIGNMENT OPERATOR (=)
#include <iostream>
using namespace std;
int main ()
{
int a, b;
a = 6;
b = 4;
a = x;
b = 5;
cout << 'a:';
cout << a;
cout << 'b:';
cout << b;
}
// ARITHMETIC OPERATORS + COMPOUND ASSIGNEMENTS
#include <iostream>
using namespace std;
int main ()
... | true |
167cccf7688536bf5aea3581afe3a55824bba489 | C++ | eric0410771/Game_Theory_CPP | /episode.h | UTF-8 | 4,699 | 2.84375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <list>
#include <vector>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <chrono>
#include <numeric>
#include "board.h"
#include "action.h"
#include "agent.h"
struct action_reward{
bool legal_action;
int reward;
};
typedef action_reward action_reward;
class statistic;
cl... | true |
330dd4a6e6e6408c28052b7f697da81c08ea9b28 | C++ | mariosgit/mbCVio | /mbCVio.cpp | UTF-8 | 4,107 | 2.578125 | 3 | [] | no_license | #include "mbCVio.h"
#include <mbLog.h>
mbCVio::mbCVio() :
_adc0(0),
_adc1(0),
_dacOffset(4000),
mcp(),
dac0(0),
dac1(1),
adcadr(0b01101001)
{
}
void mbCVio::setDACOffset(float val)
{
float fval = fmax(5.0f, val);
fval = fmin(-5.0f, fval);
_dacOffset = fval; // 2000 = 0V, 0 = -... | true |
bb654da111380ef29b9e75f8e2054a2c56e2947f | C++ | liweiliv/DBStream | /util/delegate.h | UTF-8 | 874 | 2.65625 | 3 | [] | no_license | #pragma once
template <class F>
F* create_delegate(F* f)
{
return f;
}
#define _MEM_DELEGATES(_Q,_NAME)\
template <class T, class R, class ... P>\
struct _mem_delegate ## _NAME\
{\
T* m_t;\
R (T::*m_f)(P ...) _Q;\
_mem_delegate ## _NAME(T* t, R (T::*f)(P ...) _Q):m_t(t),m_f(f) {}\
_mem_delegate ## _N... | true |
e76ca70fa1924101661d7d68fa7a0a841bb4a497 | C++ | emrul-chy/Competitive-Programming | /UVa/11000 - Bee.cpp | UTF-8 | 441 | 2.515625 | 3 | [] | no_license | #include <stdio.h>
int main()
{
long long int n, i, sum,sum1, f[102];
while(scanf("%lld", &n)==1)
{
if(n<0) break;
f[0] =0;
f[1] =1;
sum = f[0];
sum1 = f[0] + f[1];
for(i=2; i<=(n+1); i++)
{
f[i] = f[i-2] + f[i-1];
... | true |
dcef547db4b8d24f99041eff1b097268607ed73e | C++ | neer1304/SPOJ | /The_Shortest_Path_spoj.cpp | UTF-8 | 5,297 | 3.21875 | 3 | [] | no_license | #include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include<string.h>
/* Do not break from dijkstra even if you get the target node costed me 4 WA's */
using namespace std;
typedef pair< int, int > pii;
/*
Set MAX according to the number of nodes in the graph. Remember,
nodes are numbered from 1... | true |
82f0f66890eb6c6c2e5532d66202137e91664142 | C++ | csce-4600/project-2 | /Problem 1 /source/main.cpp | UTF-8 | 7,164 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <random>
#include <cstdio>
#include <ctime>
#include <unistd.h>
#include <chrono>
using namespace std;
// Random value generator; uses normal distribution for random values
class Generator {
default_random_engine generator;
normal_distribution<double> distribution;
double min;
double ... | true |
c98afe029cd2b606d8e28b29b5be291a8fc494d4 | C++ | jasonlarue/csci104-coursework | /hw6/hw6-sample/crawler.cpp | UTF-8 | 4,535 | 3.125 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <unordered_set>
using namespace std;
unordered_set<string> pageParser(ifstream &ifile, string filepath) {
unordered_set<string> links;
char c;
string workingString;
ifile >> noskipws;
while (ifile >> c) {
... | true |
89c67505dea283c9b8e07c32cd9d31b653f8b16c | C++ | zl1704/zlcompiler | /src/parser/Parser.cpp | UTF-8 | 37,483 | 2.71875 | 3 | [] | no_license | /*
* Parser.cpp
*
* Created on: 2017年12月8日
* Author: ZL
*/
#include "Parser.hpp"
Parser::Parser(Lexer* L, Log* log) :
L(L), log(log) {
this->keywords = L->getKeyWords();
L->nextToken();
mode = 0;
lastmode = 0;
errorEndPos = -1;
}
/**
*CompilationUnit = ClassDeclaration
*/
CompilationUnit* Parser... | true |
e3cb67d2756d805cd135176cf68f1492322836f1 | C++ | BBBBBwen/Qwirkle | /LinkedList.cpp | UTF-8 | 2,174 | 3.953125 | 4 | [] | no_license | #include "LinkedList.h"
#include <random>
#include <iostream>
LinkedList::LinkedList() :
head(nullptr),
maxTiles(0) {
}
LinkedList::~LinkedList() {
for(int i = 0; i < maxTiles; i++) {
Node* del = head;
head = head->next;
if(del) {
delete del;
del = nullptr;
... | true |
90c5043771b92714f995fef2cb7e0c2b43db037d | C++ | AdamMartinCote/ElevationJukebox | /project/server/src/https-server/Admin.cpp | UTF-8 | 2,111 | 2.65625 | 3 | [] | no_license | #include <rapidjson/document.h>
#include "Admin.hpp"
#include <common/database/Database.hpp>
#include <http-server/http/exception/MissingTokenException.hpp>
#include <http-server/http/exception/InvalidTokenException.hpp>
#include "https/exception/AuthenticationFailureException.hpp"
namespace elevation {
Admin Adm... | true |
b90ff2b7001ba55bcd6d81fbce5a9d672970c028 | C++ | seantyh/Heimdallr | /ChartParserChart.h | UTF-8 | 1,302 | 2.953125 | 3 | [] | no_license | #ifndef CHARTPARSERCHART_H
#define CHARTPARSERCHART_H
#include <unordered_set>
#include "MatchedDepRule.h"
#include <functional>
typedef MatchedDepRule EdgeType;
typedef std::unordered_set<const EdgeType*> EdgeCPtrSetType;
typedef vector<const EdgeType*> EdgeCPtrVec;
typedef std::function<bool(const EdgeType*)> Com... | true |
c3099cd54c5cd884e2c8562f4a8127906fea8562 | C++ | Hyeongho/Academic_Materials | /C++ 4주차/복사 생성자와 대입 연산자/main.cpp | UTF-8 | 186 | 2.625 | 3 | [] | no_license | #include "Vector.h"
int main()
{
srand((unsigned int)time(NULL));
Vector u(3), v, w(3);
u.SetRand();
v = u;
w.add(u, v);
u.Print(" U ");
v.Print(" V ");
w.Print("U+V");
} | true |
31fc4ad83b3fac015f68180bf3b6ce1b5c79ff08 | C++ | bvsk35/Hopping_Bot | /GPS_Berkley/src/gps_agent_pkg/include/gps_agent_pkg/positioncontroller.h | UTF-8 | 2,532 | 2.8125 | 3 | [
"BSD-2-Clause",
"MIT"
] | permissive | /*
Controller that moves the arm to a position, either in joint space or in task
space.
*/
#pragma once
// Headers.
#include <Eigen/Dense>
// Superclass.
#include "gps_agent_pkg/controller.h"
#include "gps/proto/gps.pb.h"
namespace gps_control
{
class PositionController : public Controller
{
private:
// P gains... | true |
07e91e4690faa15469a5ad6a40d2c5b9ade6d416 | C++ | SongKAY/code | /Leetcode/300. 最长上升子序列.cpp | UTF-8 | 458 | 2.578125 | 3 | [] | no_license | class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int n = nums.size();
if(n==0)
return 0;
int result = 1;
vector<int> dp(n,1);
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
if(nums[i]>nums[j]){
dp[i] = max(... | true |
8d978afdac48788e712986f4b5f30e1d016e581f | C++ | whenugopal/qcode | /day1/11_comparsionoftriplets.cpp | UTF-8 | 852 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include<string.h>
using namespace std;
int main()
{
// stringstream sa,sb;
// string stra,strb;
// getline(cin, stra);
// getline(cin, strb);
// replace( stra.begin(), stra.end(), ',', ' ');
// replace( strb.begin(),... | true |
b8ad56aa64761e61a1957ad608e6a2cd78d15f30 | C++ | matheux50295/Data-Structures | /Graph/CountNearest0inMatrixBFS.cpp | UTF-8 | 1,708 | 3.203125 | 3 | [] | no_license | /*
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.
The distance between two adjacent cells is 1.
Example 1:
Input:
0 0 0
0 1 0
1 1 1
Output:
0 0 0
0 1 0
1 2 1
*/
class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& matrix) {
int n=matrix.siz... | true |
a9149363884852b96feef675439a8738f5582b4c | C++ | xr71/udacity-cpp-nd | /p1_multifiles/05_pointers.cpp | UTF-8 | 3,195 | 4.375 | 4 | [] | no_license | #include <iostream>
#include <vector>
using std::vector;
void AddOne(int *);
int* AddOnePtr(int &);
int main(void)
{
int i = 5;
int j = 6;
std::cout << "the memory address of i is: " << &i << std::endl;
std::cout << "the memory address of j is: " << &j << std::endl;
/*
*... | true |
5c8e2e324c9a6437cd92f8a76aeaebfddc537506 | C++ | ayavorsk/AbstractVM | /srcs/AbstractVM.cpp | UTF-8 | 2,652 | 2.84375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AbstractVM.cpp :+: :+: :+: ... | true |
be8a99f52e2d61bea4fb139312cf455d5c7092b0 | C++ | ScenarioCPP/scenario | /common/src/animator.cpp | UTF-8 | 1,896 | 2.828125 | 3 | [
"MIT"
] | permissive | #include "animator.h"
#include<QDebug>
/*!
* \brief Animator::Animator
*/
Animator::Animator(QObject* parent) : QObject(parent),m_count(0),m_frame_index(0),m_frame_value(0),m_mode("pause") { }
/*!
* \brief animate
*/
void Animator::animate() {
if(m_mode == "loop") loop();
}
/*!
* \brief changeFrameSet
* \... | true |
f10969fc0f928bb1f45424484025bb5e7b1d6270 | C++ | fenixrw/HackerRank | /Algorithms/Implementation/feliperw_climbing-the-leaderboard_solution.cpp | UTF-8 | 1,266 | 2.90625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
stack<unsigned long long> rank_score;
unsigned long long n,m;
cin >> n;... | true |
4ca20614fe768e287c17f9803a601c329d7dbacb | C++ | jordantangy/pandemic-b | /sources/Dispatcher.cpp | UTF-8 | 385 | 2.546875 | 3 | [] | no_license | #include "Dispatcher.hpp"
using namespace std;
using namespace pandemic;
Player& Dispatcher::fly_direct(City city){
if(actual == city){
throw invalid_argument("You cannot fly from your current city to itself");
}
if(board.contains_researchCenter(actual)) {
actual = city;
}
else {
... | true |
17294abe332b67464a13860bf179233eef589d71 | C++ | evgenypanin/Stiven_Prata_book_cpp | /chapter_10_1/lesson_6/move_func.cpp | UTF-8 | 338 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include "move.h"
Move::Move(double a, double b)
{
m_x = a;
m_y = b;
}
void Move::showmove() const
{
std::cout << "\nX = " << m_x
<< "\nY = " << m_y << std::endl;
}
Move Move::add(const Move & m)
{
m_x += m.m_x;
m_y += m.m_y;
return *this;
}
void Move::reset(double a, double b)
{
m_x ... | true |
333e8560b8ff30658bf5bbe56c605420ab4d9fb6 | C++ | musakhan18/OOP | /OOP Mini Project 2/OOP Mini Project 2/Bike.cpp | UTF-8 | 4,384 | 3.0625 | 3 | [] | no_license | #include "Bike.h"
Bike::Bike(char* Cn, char* Col, char* Vtype, int NoWheels, int power, float H, bool DB, bool SS) :Vehicle(Cn, Col, Vtype, NoWheels, power)
{
Height = H;
DiscBrake = DB;
SelfStart = SS;
}
Bike::Bike(const Bike& obj) :Vehicle(obj)
{
Height = obj.Height;
SelfStart = obj.SelfStart;
Di... | true |
ef41a63bce71c712015e9c9da94fc610d6e9d1e1 | C++ | CToothAero/ASCIIRogueLike | /GameSystem.cpp | UTF-8 | 585 | 2.875 | 3 | [] | no_license | #include "GameSystem.h"
CGameSystem::CGameSystem(std::mt19937& random)
{
randomNumberGen = random;
player.createPlayer();
}
CGameSystem::~CGameSystem(void)
{
}
void CGameSystem::playGame(void){
CLevel level(randomNumberGen);
level.loadMap("levelDesign.txt", player);
bool isDone = false;
... | true |
191e45ccddc8561158dcb329391cd82b89829a61 | C++ | lapl/Maratona | /Seletiva/Seletiva - Contest 1/C.cpp | UTF-8 | 629 | 2.703125 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <cmath>
#include <map>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) FOR(i,0,(a))
using namespace std;
typedef vector<int> vi;
int main () {
int tc;
cin >> tc;
while(tc--... | true |
733e611020614c07255d76848c8e0c1497dc8e60 | C++ | HibaZubair/THIRD-SEMESTER-DEC-19 | /OOP(CPP stuff)/cpp 1.cpp | UTF-8 | 450 | 3.71875 | 4 | [] | no_license | #include<iostream>
int sum(int n ,int arr);
using namespace std;
int main()
{
int n, i, sol;
cout<<"Enter the size of an array ";
cin>>n;
int arr[n];
cout<<"Enter elements\n ";
for(i=0;i<n;i++)
{
cin>>arr[i];
}
sol=sum(n,arr[n]);
cout<<sol;
return 0;
}
int sum(int n,int arr[n])
{
int an... | true |
b1292aeacfbca6052a073f1b61e9bde2959b912d | C++ | mayah/workspace | /base/containers/vectors_io_test.cc | UTF-8 | 220 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "base/containers/vectors_io.h"
#include <gtest/gtest.h>
TEST(VectorsIOTest, print)
{
std::stringstream ss;
std::vector<int> vs { 1, 2, 3, 4, 5 };
ss << vs;
EXPECT_EQ("1 2 3 4 5", ss.str());
}
| true |
9e48129ccd9e3d7e94db09187104274f08997202 | C++ | hhhhsdxxxx/pat | /advanced/p1085.cpp | UTF-8 | 597 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
bool is_suitable(int min, int max, int p){
if(max/min == p && max%min == 0 || max/min < p)
return true;
return false;
}
int main(int argc, char const *argv[])
{
int N, p;
cin >> N >> p;
int *num = new int[N];
for(int i = 0; i < N; i++)
cin >> nu... | true |
2efd9667a55c8cb159a96dfae202bd2bbe50a039 | C++ | justenjoyit/tiny-server | /ThreadPoolLib.h | UTF-8 | 2,129 | 2.515625 | 3 | [] | no_license | #ifndef THREADPOOLLIB_H
#define THREADPOOLLIB_H
#include<iostream>
#include<stdio.h>
#include<pthread.h>
#include<sys/types.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include<strings.h>
#include<string>
#include<list>
#include<semaphore.h>
#include<vector>
#include<set>
void* manageThread(void*);
v... | true |
b76c428ad509160abfd51b50780e6d45e1bf4576 | C++ | GDDXH/First-year-of-University | /hdu.cpp/杭电2041.cpp | UTF-8 | 355 | 2.546875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
int main()
{
int size,i,a[50]={0,1,1,2};
for(i=4;i<=40;i++)
{
a[i]=a[i-1]+a[i-2];
}
scanf("%d",&size);
while(size--)
{
scanf("%d",&i);
printf(... | true |
910c74672977cafafe785c790749a1f4674c4f98 | C++ | jambamamba/libedgetpu | /port/blocking_counter.h | UTF-8 | 2,404 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | true |
af8e6bfdb4c5e73180c8c7465c5a703fed15eeb3 | C++ | Soondt/OOP | /Bai_tap/Geometry.cpp | UTF-8 | 399 | 3.125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
class Geometry {
public:
// virtual khong chi toi ham cha ma khi cout ra no se chi toi ham con
// dang tinh truu tuong cua class
virtual double perimeter() = 0;
virtual double area() = 0;
virtual void display()
{
cout << "Pe... | true |
f161462bb2c22f6b710a9f55c31bb8dd2da2d50c | C++ | xshellk/Linux_code | /fuxi/io/testSelect/io.cc | UTF-8 | 595 | 2.890625 | 3 | [] | no_license | #include<iostream>
#include<sys/select.h>
#include<unistd.h>
#include<stdio.h>
using namespace std;
int main()
{
fd_set fd;
FD_ZERO(&fd);
FD_SET(0,&fd);
string str;
for(;;)
{
cout << "Please input > ";
fflush(stdout);
int ret = select(2,&fd,NULL,NULL,NULL);
cin >> str;
if(ret < 0)
... | true |
34c733c4c210e4269dc26d6ebf32da17f619e046 | C++ | z0CoolCS/CompetitiveProgramming | /Codeforces/743A-AntonandDanik.cpp | UTF-8 | 324 | 2.859375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int contA=0,contD=0;
char c;
while(n--){
cin>>c;
if(c=='A')
contA++;
else
contD++;
}
if(contA>contD)
cout<<"Anton";
else if(contA==contD)
cout<<"Friendship";
else
cout<<"Danik";
return 0... | true |
8bb483c065a0172353fce1fc97591b6c45f067b7 | C++ | HideakiImamura/MyCompetitiveProgramming | /ABC060_ARC073/b2.cpp | UTF-8 | 360 | 2.671875 | 3 | [] | no_license | //
// Created by 今村秀明 on 2017/05/03.
//
#include <stdio.h>
int main(int argc, char ** argv){
int a, b, c;
bool flag = 0;
scanf("%d %d %d", &a, &b, &c);
for (int i=1; i<=b; i++){
if (a*i % b == c){
flag = 1;
}
}
if(flag){
printf("YES");
}else{
pri... | true |
555913e86ae445a10ad93bd11f34e477e0490fe0 | C++ | Coolnesss/gbe | /sound.h | UTF-8 | 1,162 | 2.546875 | 3 | [] | no_license | #pragma once
#include <inttypes.h>
#include <unordered_map>
#include "sound_defs.h"
#define TCLK_HZ 4194304u
#define SAMPLE_RATE 44000u
class Sound {
public:
Sound();
void update(unsigned tclk);
bool hasNewSample();
void getSamples(sample_t *left, sample_t *right);
void writeByte(uint16_t addr, uint8_t va... | true |
3f38f716e6db5a9712951dfe8127f184ee73280d | C++ | ennehekma/atom | /test/testPrintFunctions.cpp | UTF-8 | 4,410 | 2.609375 | 3 | [
"MIT"
] | permissive | /*
* Copyright (c) 2014-2016 Kartik Kumar, Dinamica Srl (me@kartikkumar.com)
* Distributed under the MIT License.
* See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
*/
#include <sstream>
#include <catch.hpp>
#include <gsl/gsl_multiroots.h>
#include <gsl/gsl_vector.h>
#include "Atom/... | true |
f1b9f032eb93207663bbedb507b2ee10fb287f23 | C++ | mikosz/CoconutTools | /coconut-tools-concurrent/src/main/c++/coconut-tools/concurrent/LockableInstance.hpp | UTF-8 | 1,190 | 3 | 3 | [] | no_license | #ifndef COCONUTTOOLS_CONCURRENT_LOCKABLEINSTANCE_HPP_
#define COCONUTTOOLS_CONCURRENT_LOCKABLEINSTANCE_HPP_
#include <mutex>
#include "LockingPtr.hpp"
#include "LockTraits.hpp"
namespace coconut_tools {
namespace concurrent {
// TODO: Lockable* needs redesign
template <class T, class M = std::mutex>
class LockableI... | true |
43d2cf2fb4ec8c5232d75e77385e1cebbdf9ae1e | C++ | ChrisLane/Cpp---Expression-Evaluation | /src/evalobjmain.cpp | UTF-8 | 2,012 | 2.953125 | 3 | [] | no_license | #include <string>
#include <iostream>
using namespace std;
#include "evalobj.h"
int main(int argc, const char *argv[]) {
/**
* Test 1
*/
Exp *e1, *e2, *e3, *e4, *e5;
ExpList *l = nullptr;
l = new ExpList(new Constant(23), l);
l = new ExpList(new Constant(42), l);
l = new ExpList(new... | true |
d1ee00ef31d891aed56494e5398d88100027875a | C++ | imyjalil/NCRwork | /C++/Assignment 2/program 2/program 2.cpp | UTF-8 | 1,269 | 3.640625 | 4 | [] | no_license | #include "pch.h"
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
class Student
{
int rno, m1, m2, total;
char grade;
string name;
public:
friend void result(Student s[], int n);
friend istream& operator >> (istream& cin, Student &s);
friend ostream& operator <<(ostream& cout, Student s)... | true |
be276386ead92cc507babab7b70ba19728bff6bf | C++ | matovitch/dmit | /lib/include/dmit/com/logger.hpp | UTF-8 | 987 | 2.578125 | 3 | [] | no_license | #pragma once
#include "dmit/com/singleton.hpp"
#include "dmit/com/type_flag.hpp"
#include <sstream>
#include <ostream>
namespace dmit
{
namespace fmt { struct Formatable; } // To avoid depending upon dmit::fmt
namespace com
{
namespace logger
{
class Sub
{
public:
Sub(std::ostream& os);
template <clas... | true |
0b3454c4ef4bf3a59bf646507cb3a9588fa2008c | C++ | swayamxd/noobmaster69 | /CTCI/1-Data-Structures/1-Arrays-and-Strings/Suvo/1-3-URLify.cpp | UTF-8 | 541 | 3.15625 | 3 | [] | no_license | // CPP program to convert string
// to char array
#include <iostream>
#include <string.h>
using namespace std;
// driver code
int main()
{
string s;
cout << "Enter the string" << endl;
getline(cin,s);
char p[s.length()];
int i,j;
for (i = 0; i < s.length(); i++) {
if (s[i]==' '){
... | true |
1d640f26913866d186ec53d4e32378560cc45aa0 | C++ | SINAABBASI/Useful-Algorithms | /topological_sort.cpp | UTF-8 | 585 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
vector<int> adj[111111];
bool end[11111];
bool see[11111];
stack < int > s;
////find cycle in graph
bool dfs(int v){
see[v]=1;
for(int i =0 ;i <adj[v].size(); i++){
int u =adj[v][i];
if(!see[u])dfs(u);
if(end[u] == false)return 0;
}
end[v] = 1;
st.push(v);
re... | true |
b4a463c760690f5cf012050c76ff393b13572dd0 | C++ | MorariuT/ONI | /Ciupercute fermecate/main.cpp | UTF-8 | 850 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
ifstream fin("ciuperci.in");
ofstream fout("ciuperci.out");
int main()
{
int n = 0;
int num_prime = 0;
int num_divizibile = 0;
int i = 1;
int ciuperci = 0;
fin >> n;
while(i <= n)
{ //Pentru fiecare ciuperca6
... | true |
58f27d8681b9acc0765b83261a87cf6ee952a00c | C++ | karangoel16/leetcode | /53.maximum-subarray.141493490.ac.cpp | UTF-8 | 984 | 3.375 | 3 | [] | no_license | /*
* [53] Maximum Subarray
*
* https://leetcode.com/problems/maximum-subarray/description/
*
* algorithms
* Easy (40.23%)
* Total Accepted: 287.1K
* Total Submissions: 713.7K
* Testcase Example: '[-2,1,-3,4,-1,2,1,-5,4]'
*
*
* Find the contiguous subarray within an array (containing at least one
* num... | true |
8f92906951cf4d16de1ee02452e2834d01f0f55c | C++ | JulesJae/piscineCPP | /d01/ex03/ZombieHorde.cpp | UTF-8 | 1,010 | 3.171875 | 3 | [] | no_license | #include "ZombieHorde.hpp"
#include <iostream>
#include <ctime>
char const *ZombieHorde::_names[] = { "Philidor", "Anand", "Karpov", "Kasparov", "Fischer", "Laskin", "Lasker", "Capablanca", "Alekhine" };
ZombieHorde::ZombieHorde(int n)
{
int i(0);
int random;
int size;
this->_n = n;
if (n <... | true |