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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5390d525dcd34e1deccedd033d1a9b21325b3d67 | C++ | princejaydai/Rockit_project | /Rockit-project/项目源码/Rockit-master/src/rt_base/rt_dequeue.cpp | UTF-8 | 3,477 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | #include "rt_dequeue.h"
#include "rt_header.h"
#include "rt_mem.h"
RT_Deque* deque_create() {
RT_Deque* list = (RT_Deque*)rt_mem_malloc(__FUNCTION__, sizeof(RT_Deque));
if(RT_NULL != list) {
list->size = 0;
list->head = RT_NULL;
list->tail = RT_NULL;
}
list->entries = RT_NULL;... | true |
d86c259fc17e9381e3ba44496423957f17b9f09e | C++ | makuto/horizon | /src/agent/needProcessor.hpp | UTF-8 | 1,324 | 2.59375 | 3 | [
"MIT"
] | permissive | #ifndef NEEDPROCESSOR_HPP
#define NEEDPROCESSOR_HPP
#include <map>
#include <base2.0/ept/eptParser.hpp>
#include "agent.hpp"
#include "need.hpp"
#include "../world/time.hpp"
#include "../object/objectManager.hpp"
#include "../object/object.hpp"
/* --NeedProcessor--
* NeedProcessors perform all the logic for a type of... | true |
e6394dc020bcaa56b8c54832fb64683fe3ac136f | C++ | pratham-0094/100DaysOfCode | /Day-41/BipartGraph.cpp | UTF-8 | 990 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> adj;
vector<int> col;
vector<bool> vis;
bool bipart;
void color(int u, int curr)
{
if (col[u] != -1 && col[u] != curr)
{
bipart = false;
return;
}
col[u] = curr;
if (vis[u])
{
... | true |
49f70708cb8502ae8bd5174233dc7485cc71a0ab | C++ | volzkzg/Tempus-Fugit-Code-Machine | /TeamTraining/7_24/J.cpp | UTF-8 | 1,124 | 2.578125 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int Maxn = 1100;
char s[Maxn][600];
int len[Maxn];
const int p = 131;
unsigned long long hash[Maxn];
unsigned long long rhash[Maxn];
unsigned long long pow[Maxn * 2];
void getHash(int pos, unsigned long long &h)
{
h = 0;
for(in... | true |
66189c5f6669d3fac2f8099a6cf6f414bb2edfe2 | C++ | findobj/HelloAndroid | /jni/findobj/train/Tile.cpp | UTF-8 | 393 | 3.359375 | 3 | [] | no_license | #include "Tile.h"
Tile::Tile(int index)
{
this->index = index;
x = 0;
y = 0;
}
Tile::Tile(int x, int y)
{
this->x = x;
this->y = y;
index = 0;
}
Tile::~Tile()
{
}
bool Tile::equals(Object *obj)
{
if(obj != NULL) {
Tile *tile = (Tile*)obj;
if(index == tile->index &&
x == tile-... | true |
7e89fc28e3a5dd20651815232fa835449528b607 | C++ | zn-ansari/domotics_iot | /finalCode/finalCode.ino | UTF-8 | 4,450 | 2.515625 | 3 | [] | no_license |
#include <Ethernet.h>
#include <PubSubClient.h>
byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02};
IPAddress server(192, 168, 1, 101);
EthernetClient ethClient;
PubSubClient client(ethClient);
//ultrasonic
int trig = 9;
int echo = 8;
int LED =7;
float t = 0, h = 0, hp = 0;
//energy
float sample1=0; // for voltage
fl... | true |
9c30c69f5270b0a267ca354969d5a417c98337a0 | C++ | subuju/interview | /reverse_link.cpp | UTF-8 | 3,551 | 4.09375 | 4 | [] | no_license | /* C++实现链表逆序打印,链表反转
*如何实现链表逆序,取决于题目的要求。如果面试官只要求打印,一般不改动链表结构为
*好,如果要求改变链表的方向,则需要改变结构,再顺序打印。
*
*方法1:只逆序打印,不改变结构。采用递归,到达尾结点时打印输出,否则进入下一个
*结点的递归,当递归一层层退出的时候,便可以实现从尾到头的打印。
*
*方法2:头插法:改变结构。从第二个结点开始往后,依次把每个结点移至链表头部,要注
*意最后链表不要是断裂的
*
*方法3:改变指针方向。从头结点开始,依次把结点的next指针断开并指向该结点的前结点
*要注意保存好前结点,当前结点和下一个结点
*
*方法4:只逆序打印,不改变结构... | true |
dcc9bcd57f663c290a2552602970ef76b744e210 | C++ | LineageOS/android_frameworks_native | /libs/vr/libdvr/include/dvr/dvr_deleter.h | UTF-8 | 3,262 | 2.5625 | 3 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | #ifndef ANDROID_DVR_DELETER_H_
#define ANDROID_DVR_DELETER_H_
#include <sys/cdefs.h>
#include <memory>
// Header-only C++ helper to delete opaque DVR objects.
__BEGIN_DECLS
// Use forward declarations to avoid dependency on other headers.
typedef struct DvrBuffer DvrBuffer;
typedef struct DvrReadBuffer DvrReadBuff... | true |
5ca52900430ff9ca13102495fccaa389cb6fd2ac | C++ | sankalpjain99/LeetCode-July-Challenge | /Week2/Day3-FlattenAMultiLevelDLL.cpp | UTF-8 | 737 | 2.96875 | 3 | [] | no_license | /*
// Definition for a Node.
class Node {
public:
int val;
Node* prev;
Node* next;
Node* child;
};
*/
class Solution {
public:
Node* flatten(Node* head) {
if(!head)
return NULL;
Node* curr=head;
while(curr){
if(curr->child){
... | true |
5882b9b7239519fed87cfaa32333b729eae31b22 | C++ | dipta-dhar/Algorithm-and-DataStructure | /Algorithms/dpAlgorithms/O1_Knapsack.cpp | UTF-8 | 687 | 2.984375 | 3 | [
"MIT"
] | permissive | #include<cstdio>
#define max(a,b) ((a)>(b) ? (a):(b))
using namespace std;
int knapSack(int MW, int weight[], int price[], int N) {
int i,w;
int K[N+1][MW+1];
for(i=0; i<=N; i++) {
for(w=0; w<=MW; w++) {
if (i==0 || w==0) K[i][w] = 0;
else if (weight[i-1] <= w) K[... | true |
0f6eca895eedec18ae215677861fba98fbcaeba7 | C++ | MasterJH5574/CS158-DS-Project | /vector/data/two.memcheck/code.cpp | UTF-8 | 451 | 2.515625 | 3 | [] | no_license | #include "vector.hpp"
#include <iostream>
#include <vector>
int main()
{
sjtu::vector<long long> v;
for (long long i = 0; i < 1LL << 10; ++i) {
v.push_back(i);
}
std::cout << v.back() << std::endl;
for (long long i = 0; i < 1LL << 10; ++i) {
v.insert(v.begin(), i);
}
for (... | true |
86fad4ad8b5c0056cbdb00097258fcf26e4dccac | C++ | treejames/arrayfire | /include/af/blas.h | UTF-8 | 5,347 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | /*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
**********************************************... | true |
e7754e4cb13844d5a3bdd646d68252afdc071ef6 | C++ | johnbower2012/devel | /scripts/calculations/emulator/observables_class.cpp | UTF-8 | 10,718 | 2.859375 | 3 | [] | no_license | #include<iostream>
#include<fstream>
#include<cmath>
#include "armadillo"
void tilde_function(const arma::mat &matrix, const arma::vec &error, arma::vec &mean, arma::mat &tilde);
void tilde_function(const arma::mat &matrix, arma::mat &covariance, arma::vec &mean, arma::mat &tilde);
void covariance_function(const arma:... | true |
c1fe2d1cb6dc2114180b7eac59e1c942cbc14dfd | C++ | zoyanhui/leetcode | /2013/Reverse Integer.cpp | UTF-8 | 498 | 2.90625 | 3 | [] | no_license | class Solution {
public:
int reverse(int x) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(x == 0) return x;
bool isPos = true;
if(x<0) { isPos = false; x = -x;}
int ans = 0;
while(x)
{
ans *= ... | true |
ce85d5d7fa0ae26f87e0aee9b4a4eaedd73051e2 | C++ | mahongquan/java-jni | /src2/DownloadModule.h | GB18030 | 766 | 2.53125 | 3 | [] | no_license | #ifndef DOWNLOAD_MODULE_H
#define DOWNLOAD_MODULE_H
#include <string>
#include "curl/curl.h"
using namespace std;
class DownLoadModule
{
public:
DownLoadModule();
virtual ~DownLoadModule();
static void Init();
static void Cleanup();
public:
static size_t DownLoadPackage(void *ptr, size_t size, size_t nmemb,
v... | true |
e1cdb492926330354a38ea895aa5391171cd0caa | C++ | himanshudangre/CPP-Codes | /remove_duplicates_in_link_list.cpp | UTF-8 | 936 | 3.546875 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
struct node
{
int daa;
struct node *next;
}*first = NULL;
//fun for creating a lik=nked list
void create ( int A[],int n)
{
int i;
struct node *t,*last;
first = (struct node*)malloc(sizeof(struct node));
first->data=A[0];
first ->next=NULL;
last =first;
... | true |
2ea32cce43f4f23ba480961292577eacfe67ef69 | C++ | alex-tifrea/Review_summarizer | /IO.h | UTF-8 | 1,141 | 2.859375 | 3 | [] | no_license | #ifndef __IO_H__
#define __IO_H__
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
struct WordInfo_t {
unsigned int frequency;
std::string partOfSpeech;
};
typedef struct WordInfo_t WordInfo;
struct WordPosition{
int review_nr, word_nr;
WordPosition(... | true |
54aa8f381b9962c7432a4b407af72967a75c146b | C++ | amitchhajer/interviewstreet | /cs3/ncr.cc | UTF-8 | 675 | 2.5625 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
#include <iostream>
using namespace std;
int main()
{
unsigned long long int t,i,n,r,c,num = 1,den = 1,temp;
cin>>t;
for(i=0;i<t;i++)
{
cin>>n;
cin>>r;
if(r > n) cout<<"\n0";
if(n == 0) cout<<"\n0";
c = n-r;
if(c > r)
... | true |
640372889421207db0d541dfc24797e0c549470f | C++ | myrealMVP/Compilers | /Token.cpp | GB18030 | 35,369 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <deque>
#include <cmath>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#define INPUT_PATH "testfile.txt"
#define OUTPUT_PATH "output.txt"
using namespace std;
/* Ķǹؼֺͽ
ӹؼֺͽ
1.K / P ӦĹؼֺͽ
2. KEY_NUM / PRA_NUM
*/
#define KEY_NUM 20
#d... | true |
f9519e4432390e0561f7a7db8efb543114a424a1 | C++ | fchurca/fiuba-7542-20152 | /src/main/socket/winSocket/winSocket.cpp | ISO-8859-1 | 3,432 | 2.75 | 3 | [] | no_license | //-----------------------------------------------------------------------------
#include "winSocket.h"
//-----------------------------------------------------------------------------
using namespace std;
shared_ptr<Socket> Socket::create() {
//return make_shared<WinSocket>();
return nullptr;
}
WinSocket::WinSocket(... | true |
4db485319313e4e5da43a634770df6768ac6d814 | C++ | ToonLunk/ArithmeticTrainer | /main.cpp | UTF-8 | 7,862 | 3.875 | 4 | [] | no_license | /* This game was finished by Chase Brock on May 4th, 2021. This program will generate
two random numbers, and either mutliply, divide, subtract, or add them together. It will
prompt the user with the two numbers, and the user must enter the correct answer. If a correct answer
is entered, points are added to the score, ... | true |
c1684d53d91130001cad1167999702aa6fddbedf | C++ | molvin/Planets-OpenGL | /ShaderMathAssignment/src/Graphics/Texture.cpp | UTF-8 | 1,863 | 3.046875 | 3 | [] | no_license | #include "Texture.h"
#include <SOIL.h>
Texture::Texture(const float* pixels, const int width, const int height) : _width(width), _height(height)
{
glCreateTextures(GL_TEXTURE_2D, 1, &TextureId);
glBindTexture(GL_TEXTURE_2D, TextureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _width, _height, 0, GL_RGBA, GL_FLOAT, p... | true |
13b459e7e6bd888dfc89a7b9a1977bcfe9dc39d6 | C++ | hoang-khoi/tksort | /TaskNode.cpp | UTF-8 | 645 | 3.21875 | 3 | [] | no_license | #include "TaskNode.h"
#include <ostream>
#include <utility>
TaskNode::TaskNode(std::string name) : name(std::move(name)) {}
void TaskNode::depends(TaskNode &other) {
other.dependant.push_back(this);
}
std::ostream &operator<<(std::ostream &out, const TaskNode &taskNode) {
out << "Task: " << taskNode.name << ... | true |
b82b20f3e29249eb9c7dc40d78d25bc39f089dd9 | C++ | CJHMPower/Fetch_Leetcode | /data/Submission/651 4 Keys Keyboard/4 Keys Keyboard_1.cpp | UTF-8 | 1,478 | 2.875 | 3 | [] | no_license | //-*- coding:utf-8 -*-
// Generated by the Fetch-Leetcode project on the Github
// https://github.com/CJHMPower/Fetch-Leetcode/
// 651 4 Keys Keyboard
// https://leetcode.com//problems/4-keys-keyboard/description/
// Fetched at 2018-07-24
// Submitted 5 months, 1 week ago
// Runtime: 3 ms
// This solution defeats 9.69... | true |
124898b6d59ec586e66968fa949945d4858b8ab1 | C++ | pabloarizaluna/unreal-course | /Section_2/TripleX.cxx | UTF-8 | 1,900 | 3.296875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <random>
void PrintIntroduction(const int&);
bool PlayGame(const int&);
int main()
{
bool bLevelComplete;
int LevelDifficulty = 1;
const int MaxDifficulty = 5;
while (LevelDifficulty <= MaxDifficulty) // Loop game until all levels completed
{
bLevelComplete = PlayGame(Level... | true |
6c55b4172a70299b00c67e1df75ad872ee3e8e31 | C++ | YernurSFU/libflow | /include/flow/op/reverse.hpp | UTF-8 | 1,491 | 3.125 | 3 | [] | no_license |
#ifndef FLOW_OP_REVERSE_HPP_INCLUDED
#define FLOW_OP_REVERSE_HPP_INCLUDED
#include <flow/core/flow_base.hpp>
namespace flow {
namespace detail {
template <typename Flow>
struct reverse_adaptor : flow_base<reverse_adaptor<Flow>> {
constexpr explicit reverse_adaptor(Flow&& flow)
: flow_(std::move(flow))... | true |
45561e3e105be1fbe1cbbfe24d7bf783f548e64a | C++ | liuxinyu123/socket | /socket7/server_client/client.cpp | UTF-8 | 1,019 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <cstring>
#include <unistd.h>
#include <cstdio>
using std::cout;
using std::endl;
using std::cerr;
int main (int argc, char *argv[])
{
int sock = socket (PF_INET, SOCK_STREAM, 0);
if (-1 == so... | true |
ed0b8191f1ec0f85dd6e61f5c165ac582af76623 | C++ | objective-audio/audio_engine | /audio/graph/yas_audio_graph_connection.cpp | UTF-8 | 2,219 | 2.640625 | 3 | [
"MIT"
] | permissive | //
// yas_audio_connection.cpp
//
#include "yas_audio_graph_connection.h"
#include <cpp_utils/yas_stl_utils.h>
#include "yas_audio_graph_node.h"
using namespace yas;
using namespace yas::audio;
graph_connection::graph_connection(graph_node_ptr const &src_node, uint32_t const src_bus,
... | true |
388bcfc2da9f5c16bfe198af7a95d37294e26105 | C++ | soulaim/worldofapo | /src/graphics/camera.cpp | UTF-8 | 5,544 | 2.71875 | 3 | [] | no_license |
#include "graphics/frustum/matrix4.h"
#include "graphics/camera.h"
#include "world/objects/unit.h"
#include "misc/apomath.h"
#include "algorithms.h"
Camera::Camera():
BasicCamera(),
default_direction(-30.0f, 0.0f, 0.0f),
unit(0),
mode_(THIRD_PERSON)
{
cur_sin = 0.0f;
cur_cos = 0.0f;
cur_upsin = 0.0f;
cur_upco... | true |
742d5a8dc3da5d10c229499c8aeb3c41d8481d07 | C++ | perichere/c-_kurs_od_60_epizoda | /kalkulator.cpp | UTF-8 | 337 | 2.625 | 3 | [
"CC0-1.0"
] | permissive | #include <iostream>
using namespace std;
int main() {
int prvi_broj = 5;
int drugi_broj = 20;
int zbir = prvi_broj + drugi_broj;
cout << zbir << endl;
return 0;
}
drugi nacin je
#include <iostream>
using namespace std;
int main() {
int zbir = 5 + 3 + 4 + 6 + 9;
cout << zbir << endl;
... | true |
c483331cf10a8e6d2461fc96f48ee84ad91eaff3 | C++ | boingboomtschak/cpsc-projects | /cpsc1430/player.h | UTF-8 | 631 | 2.84375 | 3 | [] | no_license | // Devon McKee
// player.h
// Header file for player class for Chutes & Ladders Redux (p1)
// 2019-1-17
#include <iostream>
#ifndef PLAYER_H
#define PLAYER_H
class Player
{
public:
Player();
Player(std::string str);
std::string getName() const;
int getSpace() const;
bool incrementChutes();
bool increment... | true |
bcbfce1dbf5f9ee717916fb4641008e6fc9a45a7 | C++ | saulpower/CodaTime | /CodaTime/chrono/ISOChronology.cpp | UTF-8 | 4,742 | 2.953125 | 3 | [] | no_license | //
// ISOChronology.cpp
// CodaTime
//
// Created by Saul Howard on 12/16/13.
// Copyright (c) 2013 Saul Howard. All rights reserved.
//
#include "ISOChronology.h"
CODATIME_BEGIN
/**
* Gets an instance of the ISOChronology.
* The time zone of the returned instance is UTC.
*
* @return a singleton UTC instance... | true |
dd35755ccb1f51881adbba121ef8187b0db7008b | C++ | aakashvarshney23/Singly-Linked-List-Main- | /main.cpp | UTF-8 | 5,346 | 4.15625 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct node {
int val;
node *next;
node(int x) : val(x), next(nullptr) {}
};
class MyLinkedList {
private:
node *head;
public:
/** Initialize your data structure here. */
MyLinkedList() {
head = nullptr;
}
/** Get the value of the i... | true |
974dd121db50779a37a45eaf5a7b0c69c87b76b8 | C++ | dynamiquel/The-Game | /TheGame/TheGame.cpp | UTF-8 | 2,230 | 2.984375 | 3 | [
"MIT"
] | permissive | // TheGame.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "Game.h"
#include <iostream>
int main()
{
std::cout << "Welcome to a C++ implementation of 'The Game' by Liam HALL.\n";
std::cout
<< "\nGuide\n"
<< "=================================... | true |
dbe3e7c77c50862b47b3557ea348a8f564f46639 | C++ | stevenj/ControLeo2 | /ReflowWizard/ControLeo2_LCD.h | UTF-8 | 2,984 | 2.953125 | 3 | [] | no_license | // Written by Peter Easton
// Released under WTFPL license
//
// Change History:
// 14 August 2014 Initial Version
// 1 August 2017 Steven Johnson
// Rewritten to act like a refreshed frame buffer.
// Provide an ability to show scrolling long messages on one li... | true |
ece348a9447d6170d3e880592b554f3223687270 | C++ | voladoddi/ctci | /ch4_Graphs/leetcode133_cloneGraph.cc | UTF-8 | 1,327 | 3.5625 | 4 | [] | no_license | /**
* Definition for undirected graph.
* struct UndirectedGraphNode {
* int label;
* vector<UndirectedGraphNode *> neighbors;
* UndirectedGraphNode(int x) : label(x) {};
* };
*/
class Solution {
public:
// typedef for easier
typedef UndirectedGraphNode udgNode;
UndirectedGraphNo... | true |
89feb58a17fe649e95ef615dae4e9c92e7e5c8f4 | C++ | Sabila-Nawshin/CodeForces | /96A. Football.cpp | UTF-8 | 454 | 3.046875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
string s;
cin >> s;
int maxm = 0, count = 1;
for (int i = 0; i < s.size() - 1; i++){
if(s.at(i) == s.at(i + 1)) ++count;
else {
maxm = max(count, maxm);
count = 1;
}
}
maxm = ma... | true |
6eedab787ebcbe8de0abaf6de040709c16e30d09 | C++ | edisondev/Energia-Libraries | /MatrixMath.h | UTF-8 | 2,600 | 2.765625 | 3 | [] | no_license | ///
/// @file MatrixMath.h
/// @brief Library header
/// @details Matrix library
/// @n
/// * Modified by Edison Developers on 16/02/2015 by adding the following functions:
/// * void normalizeVec(float* vector)
/// * float dotProduct(float* vector_one, float* vector_two)
/// * void scalar_product(float* m... | true |
64da37a1f8aa878df42d92abbdea7d58ee6bff93 | C++ | lollor/orologio-sveglia | /Arduino/Versione_1.0/Versione_1.0.ino | UTF-8 | 536 | 2.875 | 3 | [] | no_license | void setup(){
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop(){
String parola = leggiParola();
//Serial.println(parola);
//Serial.write("picio");
if (parola == "Suona"){
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("Sto illuminando");
delay(5000);
digitalWrite(LED_BUILTIN,... | true |
16952a43ed4d70679c9f866470dc0593957ff729 | C++ | ggilbert108/algorithms-for-runekir | /Letter Cubes/Letter Cubes/cubes.cpp | UTF-8 | 2,754 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <assert.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
typedef map<char, set<char>> CharMap;
void findIncompatibles(CharMap& incompatible, char a, char b)
{
if (incompatible.find(a) == incompatible.end())
... | true |
f3a14dc8e8385acb122e1707f0fabc8bc021c74f | C++ | JonnyKong/LeetCode | /7_Reverse_Integer.cpp | UTF-8 | 539 | 3.125 | 3 | [] | no_license | //
// 7.Reverse Integer.h
// Project 1
//
// Created by Jonny Kong on 2/22/16.
// Copyright © 2016 Jonny Kong. All rights reserved.
//
int reverse(int x) {
int sign = 1;
int i = 0;
if (x < 0) {
sign = -1;
i++;
} else if (!x)
return 0;
char number[20] = {0};
sprintf(number, "%d", x);
long ... | true |
769ac389c7cc113befbe65a2d32087439adc8b8d | C++ | angieshu/Space_Shooter | /src/Enemy.class.cpp | UTF-8 | 397 | 2.59375 | 3 | [] | no_license | /**
* @Author: Anhelina Shulha <angieshu>
* @Date: Jul-25-2017
* @Email: anhelina.shulha@gmail.com
* @Filename: Enemy.class.cpp
* @Last modified by: angieshu
* @Last modified time: Jul-26-2017
*/
#include "Enemy.class.hpp"
Enemy::Enemy(int x) {
setWidth(ENEMY_WIDTH);
setHeight(ENEMY_HEIGHT);
setX(x);
... | true |
94d431eb04fe58c1fd2b80e9c20ffc025a9805d1 | C++ | Ashray11/InterviewBit | /Tree/Vertical Order Traversal.cpp | UTF-8 | 915 | 2.984375 | 3 | [] | no_license | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
vector<vector<int> > Solution::verticalOrderTraversal(TreeNode* A) {
vector <vector <int>> v;
if(A==NULL){
retu... | true |
e81b6af4b00e3b33a4654d164903f03c56287ec0 | C++ | matthhan/statnlp | /exercise3/exercise03.1/class_counter.hh | UTF-8 | 453 | 2.765625 | 3 | [] | no_license | #ifndef CLASS_COUNTER_HH
#define CLASS_COUNTER_HH
#include <map>
#include <vector>
#include <string>
class ClassCounter {
public:
void addToCount(std::string className);
ClassCounter();
double relativeFrequency(std::string className);
std::vector<std::string> getVectorOfClasses();
... | true |
29645986642207d9efb460f724dda3b4bff4b8d9 | C++ | braham517/DSA | /Algorithm/Sorting/4. MergeSort.cpp | UTF-8 | 713 | 3.15625 | 3 | [] | no_license | #include <iostream>
using namespace std;
void mergesort(int arr[],int l,int m,int r)
{
int n1=m-l+1;
int n2=r-m;
int left[n1];
int right[n2];
for(int i=0;i<n1;i++)
left[i]=arr[l+i];
for(int i=0;i<n1;i++)
right[i]=arr[m+1+i];
int i=0,j=0,k=l;
while(i<n1&&j<n2)
{
if(left[i]<right[j])
arr[k++]=left[i++];
... | true |
4afe7ed751f00fa2bacfe854cd31b9f5ebbf60b0 | C++ | 719400737/LeetCode | /剑指offer/39.cpp | UTF-8 | 534 | 2.578125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int majorityElement(vector<int>& nums) {
pair<int,int> res;
res=make_pair(nums[0],0);
for(auto i:nums){
if(i==res.first){
res.second++;
continue;
}
if(res... | true |
dfb2cc18f6e45a3fa23545a5b9651a90fb7eeacb | C++ | kremena1993/Yanev--Kremena--Assignments--48969 | /assignment 4/exmpl 13.4.cpp | UTF-8 | 2,014 | 3.78125 | 4 | [] | no_license | /*
Kremena Yanev
Chapter 13, Problem 4
*/
#include <iostream>
#include<string>
using namespace std;
class Info{
private:
std::string name, address;
long long int age, number; //Reason for long long int is to be able to hold 10 digits
public:
void getinfo();
std::string getname(){ return name; };
std::string geta... | true |
5de34448b989b2fc7c3407116a9dc3b3ffff387c | C++ | OliveOld/PetTrack | /Bean/Filter.ino | UTF-8 | 3,117 | 3.171875 | 3 | [] | no_license | // ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
//
// Author
// - Park Dong Ha (luncliff@gmail.com)
//
// Note
// 가속도 센서의 값을 읽고, Low Pass Filter를 적용하여
// 측정값(MA), 중력 가속(G), 신체 가속(LA)를 분리한다.
// MA = LA + G
//
// Note
// Low Pass Filter
// 낮은 주파수(Low Frequenc... | true |
c5d95fc9f09e787b2815e7424db3d075aaa44de7 | C++ | BYOUINZAKA/LeetCodeNotes | /354.cpp | UTF-8 | 1,170 | 3.03125 | 3 | [
"MIT"
] | permissive | /*
* @Author: Hata
* @Date: 2020-07-10 13:03:05
* @LastEditors: Hata
* @LastEditTime: 2020-07-10 13:47:40
* @FilePath: \LeetCode\354.cpp
* @Description: https://leetcode-cn.com/problems/russian-doll-envelopes/
*/
#include <bits/stdc++.h>
class Solution
{
template <class T>
constexpr bool fitInto(T &&bas... | true |
8804d1d5c61d05f7f991d442cf2dbd40692bbc80 | C++ | angelicaalemanc/ProyectoIntegradorTC1030_E3 | /Pelicula.cpp | UTF-8 | 962 | 3.4375 | 3 | [] | no_license | #include "Pelicula.h"
// Constructor default
Pelicula::Pelicula(){
id = 0;
nombre = "";
duracionH = 0;
genero = "";
calificacionPelicula = 0.0;
}
// Constructor
Pelicula::Pelicula(int Id, string Nombre,float DuracionH, string Genero, float CalificacionPelicula){
id = Id;
nombre = Nombre;
duracionH = Du... | true |
06105402f9199ac373e2b7078bc5d4b52ca0eab8 | C++ | Bpara001/CS_UCR | /cs100/assn2/main2.cpp | UTF-8 | 2,907 | 3.5 | 4 | [] | no_license | //=================================================
//
// Name: wong, christopher
// Login id: wongc
// Email: cwong030@student.ucr.edu
//
// Assignment name: assn1
// Lab section: 022
// TA: Busra Celikkaya
//
// I hereby certify that the contents of this file
// re ENTIRELY my own original work.
//
//================... | true |
c0488d18bb6f524081b0fb4c74156d248677e025 | C++ | ArmanTapayev/Urok5_Module5_LR | /Urok5_Module5_LR/Urok5_Module5_LR/Source.cpp | UTF-8 | 3,714 | 3.0625 | 3 | [] | no_license | #include<stdio.h>
#include<iostream>
#include<locale.h>
#include<math.h>
#include<time.h>
using namespace std;
void main()
{
setlocale(LC_ALL, "Rus");
srand(time(NULL));
int i, j, n, m;
/* Разработать программу, реализующую обработку числового
двухмерного произвольного массива тремя методами сортировки
... | true |
f5a36013f0ad666232326be7f309e9728c5f4bd1 | C++ | dlaststark/machine-learning-projects | /Programming Language Detection/Experiment-2/Dataset/Train/C++/long-multiplication-1.cpp | UTF-8 | 2,912 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <sstream>
//--------------------------------------------------------------------------------------------------
typedef long long bigInt;
//--------------------------------------------------------------------------------------------------
using namespace std;
//------------------------------... | true |
958d819011915ddb1dd81a32ebd259ee29d111f3 | C++ | morganstanley/binlog | /include/mserialize/visit.hpp | UTF-8 | 1,013 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #ifndef MSERIALIZE_VISIT_HPP
#define MSERIALIZE_VISIT_HPP
#include <mserialize/detail/Visit.hpp>
#include <mserialize/cx_string.hpp>
#include <mserialize/string_view.hpp>
namespace mserialize {
/**
* Visit the serialized objects in `istream`.
*
* @requires `visitor` to model the Visitor concept, see Vistor.hpp
... | true |
6b5d4606939a75afe29ed602b27d13236ae24428 | C++ | beaupletga/Tetrahedra_Into_Diamonds | /Tetraedres_en_diamants/src/step4.cpp | UTF-8 | 6,048 | 2.8125 | 3 | [] | no_license | #include "../include/step4.h"
int id_to_index(vector<Diamond> &diamond_list,Diamond* ref)
{
for(int i=0;i<diamond_list.size();i++)
{
if (&diamond_list[i]==ref)
return i;
}
assert(true==false);
return -1;
}
// this function reads all diamond and create the adjacency array
// t... | true |
3eb834d20c645cc286d5a90e3ec5688cf58d1bdf | C++ | jackdongrepo/3081W-Bus-Simulation | /project/src/data_structs.h | UTF-8 | 2,070 | 3.078125 | 3 | [] | no_license | /**
* @file data_structs.h
*
* @Copyright 2019 3081 Staff, All rights reserved.
*/
#ifndef SRC_DATA_STRUCTS_H_
#define SRC_DATA_STRUCTS_H_
/*******************************************************************************
* Includes
******************************************************************************/
#in... | true |
3d80f0ded22005ed3161bc0531a4cff48f313e15 | C++ | JeffersonCarvalh0/uri-problems | /maratonas/icpc-sa-2016/back-to-the-future/main.cpp | UTF-8 | 1,748 | 2.578125 | 3 | [] | no_license | # include <iostream>
# include <vector>
# include <list>
# include <set>
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m, a, b, v1, v2, ans;
set<pair<int, int>> s;
cin >> n >> m >> a >> b;
vector<list<int>> adj_list(n);
vector<int> deg(n);
... | true |
143eb789e80c7a05efd8eb67b9ecef6115eb3cc0 | C++ | sungbin-kang/CPlusPlus_Data-Structure | /Stacks/StackL.cpp | UTF-8 | 1,123 | 3.359375 | 3 | [] | no_license | // *********************************************************
// Implementation file StackL.cpp for the ADT stack.
// ADT list implementation.
// *********************************************************
#include "StackL.h" // header file
template <typename StackItem>
Stack<StackItem> :: Stack()
{
}
templ... | true |
e8f7aa55f08fe1e14ec6d2dceaa96ca7efb1a424 | C++ | BogdanJWK/Assignments_UBB | /1st Year/Semester 2/SDA/Lab5/MultiMap.cpp | UTF-8 | 3,480 | 3.453125 | 3 | [] | no_license | #include "MultiMap.h"
#include "MultiMapIterator.h"
#include <exception>
#include <iostream>
using namespace std;
//O(1)
int MultiMap::hash(TElem tuple, int m) const
{
int rez = tuple.key;
while (rez < 0) rez += m;
return rez % m;
}
void MultiMap::freeNode(node* x)
{
if (x->next != NULL) freeNode(x->next);
del... | true |
3c1f30edebcb7857dddd048944c202655df5ad65 | C++ | bijooos/QtDesktop | /Day1/valueWidgets/main.cpp | UTF-8 | 1,350 | 2.828125 | 3 | [] | no_license | #include <QtWidgets>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *window = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
/* Sliders */
QSlider *slider = new QSlider(Qt::Horizontal, window);
/* Setting range for slider */
slider->setRange(0,99);... | true |
ac1e1fce980a74de18674fb9cca4a5b83a181ce0 | C++ | myhhx/nfw | /src.2262/nfw_head.h | UTF-8 | 3,452 | 2.796875 | 3 | [] | no_license | #ifndef nfw_head_h
#define nfw_head_h
#include <string.h>
#include <array>
#include <string>
#include <boost/asio.hpp>
#include <boost/utility.hpp>
#include <nfw_assert.h>
#include <nfw_socket.h>
#include <nfw_timeout.h>
namespace nfw { namespace head {
template <typename raw_t>
struct socket_t : boost::nonc... | true |
3065114365face5709d8d6dc05db904a85d9ea71 | C++ | cdeln/cpp_enum_set | /test/test_common.cpp | UTF-8 | 4,298 | 3.3125 | 3 | [
"MIT"
] | permissive | #include "testing.hpp"
#include <enum_set/common.hpp>
using namespace ::enum_set;
TEST_CASE("all returns true only if all arguments are true")
{
STATIC_CHECK(detail::all(), "All with no arguments is always true");
STATIC_CHECK(detail::all(true), "All of one true is true");
STATIC_CHECK(!detail::all(false... | true |
331790f1bf40319d545e0e2d707cd8844e8a5c80 | C++ | Layty/CppPrimer | /9th/9.34.cpp | UTF-8 | 553 | 3.171875 | 3 | [] | no_license | /*假定vi是一个保存int的容器,其中有偶数值也要奇数值,分析下面循环的行为,然后编写程序验证你的分析是否正确。*/
#include "include.h"
int main(int argc, const char** argv) {
vector<int> v1={1,2,3,4,5,6,7,8,9};
auto iter=v1.begin();
while(iter!=v1.end())
{
if(*iter%2)
{
iter=v1.insert(iter,*iter);
... | true |
b28fbf71be17463dbd6994b2655b6158ed76ba24 | C++ | pozharus/cpp_yellow_belt | /VectorPart/main.cpp | UTF-8 | 2,892 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
//#include "test_framework.h"
using namespace std;
void PrintVectorPart(const vector<int>& numbers) {
vector<int> result;
//get it on first negative num from vector or it on last elem
auto negative_num = find_if(begin(numbers), end(numbers),
... | true |
d0ecc1baff679f6658c5bce550845832f82dae29 | C++ | kkoala0864/LeetCode | /0394_Decode_String/Solution.cpp | UTF-8 | 1,011 | 3.140625 | 3 | [] | no_license | #include <Solution.h>
#include <iostream>
#include <stack>
using namespace std;
string Solution::decodeString(string s) {
if (s.empty()) return s;
stack<int> times;
string ret;
for (int i = 0 ; i < s.size() ;) {
if (s.at(i) >= '0' && s.at(i) <= '9') {
string time;
while (s.at(i) >= '0' && s... | true |
e834bb2e9b9ad808600587e7ebe2ab78dca3a92a | C++ | LionsWrath/maratona-treino | /URI1253/1253.cpp | UTF-8 | 1,045 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <map>
using namespace std;
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
map<char, int> charToInt = { {'A', 0}, {'B', 1}, {'C', 2}, {'D', 3},
{'E', 4}, {'F', 5}, {'G', 6}, {'H', 7},
{'I', 8}, {... | true |
5da5f2e02aaedb2c2e493295954cd18986f2e7fb | C++ | brychrwolf/Cuda-One-Ring | /sandbox/readPLY.cpp | UTF-8 | 3,120 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <vector>
#include <iterator>
template<typename T>
std::vector<T> split(std::string line){
std::istringstream iss(line);
std::vector<T> results(std::istream_iterator<T>{iss},
std::istream_iterator<T>());
return results;
}
t... | true |
f05e6a48568c8a856a1167084938546bbfb3f1ba | C++ | perryleung/leetcode | /code/222.完全二叉树的节点个数.cpp | UTF-8 | 1,614 | 3.515625 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=222 lang=cpp
*
* [222] 完全二叉树的节点个数
*
* https://leetcode-cn.com/problems/count-complete-tree-nodes/description/
*
* algorithms
* Medium (76.49%)
* Likes: 413
* Dislikes: 0
* Total Accepted: 73.9K
* Total Submissions: 96.6K
* Testcase Example: '[1,2,3,4,5,6]'
*
* 给出一个完全二叉树... | true |
79dd4d1a713ed270ccfabc0a6f70e169635e926b | C++ | franceschi/CECS2222 | /Exam_II/Exam_II/Student.cpp | UTF-8 | 3,170 | 3.328125 | 3 | [] | no_license | #include "Student.h"
Student::Student():firstName("Jesus"),lastName("Christ"),id("777"),birthDate(),phone(),tests(){}
Student::Student(const MyString & tempFirstName, const MyString & tempLastName, const MyString & tempID,
const StudentDate & tempBirthDate, const StudentPhone & tempPhone)
{
setFirstName(tempFirst... | true |
436f837c4138f7fb773a72ceb88549ed2e026f88 | C++ | VIWER-S/VIWER-S_OFFLINE_CPP | /Source/DisplaySources.h | UTF-8 | 1,616 | 2.515625 | 3 | [] | no_license | /*
==============================================================================
DisplaySources.h
Created: 23 Nov 2020 7:21:46pm
Author: Ulrik
==============================================================================
*/
#pragma once
#include "JuceHeader.h"
#include "Constants.h"
class Displ... | true |
4f3ff0aa6e689c7ef0efe2101e143cdb893c2dda | C++ | x0t1c-01/po | /ProvaScritta/IBRAHEM MOUSTAFA 203798/LezioneMagistrale.h | UTF-8 | 399 | 2.640625 | 3 | [] | no_license | #ifndef LEZIONE_MAGISTRALE_H
#define LEZIONE_MAGISTRALE_H
#include "Lezione.h"
class LezioneMagistrale : public Lezione {
public:
LezioneMagistrale(string d, string a, int p) : Lezione(d,a,p) {}
int calcolaDistanziamento(){return partecipanti*4;}
//Implementare qui il metodo calcolaDistan... | true |
08083673cf303fcc367a82e6614ce6092d42994b | C++ | yameenjavaid/Online-Judge-Solutions | /UVa/uva12190.cpp | UTF-8 | 1,131 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// Electric Bill
#define num long long int
num A, B;
inline num f(num x){
if(x <= 100)
return x * 2;
if(x <= 10000)
return 2 * 100 + (x - 100) * 3;
if(x <= 1000000)
return 2 * 100 + 3 * 9900 + (x - 10000) * 5;
return 2 * 100 + 3 *... | true |
6927f332e0eb19f5dc12915433e8b6e137a3e468 | C++ | xiangtian/leetcode | /ValidateBinarySearchTree.cpp | UTF-8 | 2,816 | 3.6875 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
bool isValidBST(TreeNode *root) {
// null tree is BST
if(root == NULL) {
return true;
... | true |
19ca227d9025f47b2cffbf4649c55f848977064d | C++ | winniezhou0/gpu-cache-model | /src/tracer/tracer.cpp | UTF-8 | 6,293 | 2.65625 | 3 | [
"MIT"
] | permissive | //////////////////////////////////
//
// == A reuse distance based GPU cache model
// This file is part of a cache model for GPUs. The cache model is based on
// reuse distance theory extended to work with GPUs. The cache model primarly
// focusses on modelling NVIDIA's Fermi architecture.
//
// == More information on ... | true |
fe9d0afeb0414a2b4b2a20952b6ca8933f323dc6 | C++ | zhouqqhh/VLSI_project | /src/polish/verify.hpp | UTF-8 | 1,427 | 3.1875 | 3 | [] | no_license | #pragma once
#include <algorithm>
#include <vector>
#include "polish_node.hpp"
namespace polish {
namespace detail {
inline bool overlap(meta_polish_node::dimension_type lo0,
meta_polish_node::dimension_type hi0,
meta_polish_node::dimension_type lo1,
meta_polish_node... | true |
174c51a125cde1acea72fa7d59dae0ca02ca7a02 | C++ | bmanga/VDB | /src/core/Breakpoint.cpp | UTF-8 | 2,805 | 3.09375 | 3 | [] | no_license | #include "Breakpoint.hpp"
// DEBUG: Move these functions to their own dedicated file.
void procmsg(const char *format, ...);
unsigned getChildInstructionPointer(pid_t child_pid);
Breakpoint::Breakpoint(void *addr, uint64_t line_number, std::string file_name)
{
this->addr = addr;
this->line_number = line_number;
th... | true |
292e21e452812d6960cea4c1daa9af98f6b57049 | C++ | inigomanuel/Abstracta_Codigos | /Protocolo/src/Enigma.cpp | UTF-8 | 3,153 | 2.6875 | 3 | [] | no_license | #include "Enigma.h"
Enigma::Enigma(int a,int b,int c,string clave){
this->a=a;
this->b=b;
this->c=c;
this->clave=clave;
srotor(rtr1,a,l1);
srotor(rtr2,b,l2);
srotor(rtr3,c,l3);
cout<<"l1= "<<l1<<"l2= "<<l2<<"l3= "<<l3<<endl;
}
int Enigma::modulo(int a){
int n=alfabeto... | true |
88c9313430b18174119ed1e83644a2df1110da7e | C++ | Pravesh-Jamgade/code | /dp/couuntStepsN.cpp | UTF-8 | 721 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
#include<functional>
using namespace std;
#define vi vector<int>
#define fi first
#define se second
#define pb push_back
typedef long long ll;
const int mxN = 1e3;
int dp[mxN] = {-1};
int minF(int a, int b, int c){
if(a>b){
if(b>c) return c;
else return b;
}else{
if(a>c) return c;
... | true |
dd5ad7e57c139a42ba3cc9e85962f7bbf1274aeb | C++ | HannahTin/Leetcode | /二叉树/二叉搜索树/235_Lowest Common Ancestor of a Binary Search Tree.cpp | UTF-8 | 1,757 | 3.953125 | 4 | [] | no_license | /*
235. 二叉搜索树的最近公共祖先
给定一个二叉搜索树, 找到该树中两个指定节点的最近公共祖先。
百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p、q,最近公共祖先表示为一个结点 x,满足 x 是 p、q 的祖先且 x 的深度尽可能大(一个节点也可以是它自己的祖先)。”
例如,给定如下二叉搜索树: root = [6,2,8,0,4,7,9,null,null,3,5]
*/
using namespace std;
#include <vector>
#include <stack>
struct TreeNode {
int val;
TreeNode *left;
TreeN... | true |
41ecd250385a0c34edd3c578031ca9142ae63904 | C++ | shinobi-wonji/CURSO-ARDUINO | /CLASE_7_DebounceLCDShield/CLASE_7_DebounceLCDShield.ino | UTF-8 | 3,766 | 2.921875 | 3 | [] | no_license | /*
* Ejemplo utilizacion LCD Shield
*
* Conexiones DHT22 (Visto de frente, de izquiera a derecha)
*
* DHT22, pin 1, to 5V
* DHT22, pin 2, to digital pin 2 (A eleccion)
* DHT22, pin 3, No coneccted
* DHT22, pin 4, to ground.
*
* Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor.
*
* Con... | true |
51109018d924f042ed1da7ead47fc7a6c3e83628 | C++ | Tiryoh/radial_menu_ros | /radial_menu_model/include/radial_menu_model/item.hpp | UTF-8 | 6,842 | 2.703125 | 3 | [
"MIT"
] | permissive | #ifndef RADIAL_MENU_MODEL_ITEM_HPP
#define RADIAL_MENU_MODEL_ITEM_HPP
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include <radial_menu_model/xml_element.hpp>
#include <ros/console.h>
namespace radial_menu_model {
// pointer types
class Item;
typedef std::shared_ptr< Item > ItemPtr;
ty... | true |
13e628aa607d699f40fa3165b56ed8bf4da59582 | C++ | zabeli571/TowerDefense | /GameField.h | UTF-8 | 1,513 | 2.609375 | 3 | [] | no_license | #ifndef GAME_FIELD_H
#define GAME_FIELD_H
#include <iostream>
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include "MainObject.h"
#include <cstdlib>
#include <ctime>
using namespace std;
class GameField: public MainObject
{
friend class GameObject;
private:
static const int CREATOR_... | true |
13e911e2fa4cee6cee36e9edb5772ffb647378b6 | C++ | Zzzode/myLeetCode | /5635. 构建字典序最大的可行序列.cpp | UTF-8 | 625 | 2.796875 | 3 | [] | no_license | #include "Header.h"
class Solution {
public:
vector<int> constructDistancedSequence(int n) {
vector<int> ans(2 * n - 1, 0);
vector<int> v(n + 1, 0);
int l = 0, r = l + n, tmp = n;
while (tmp > 1) {
ans[l] = ans[r] = tmp;
l++, r--;
tmp -= 2;
}
tmp = n;
if (r - l == 3) {... | true |
e929d61e1c5c7074db92da3e516f2fbdca7aec3e | C++ | Alxndr-GG/client_serverd | /client/main.cpp | UTF-8 | 3,631 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include "libs.h"
// Прототипы функций с проверкой на ошибки
int Socket(int domain, int type, int protocol);
void Bind(int sockfd, const sockaddr* addr, socklen_t addrlen);
void Listen(int sockfd, int backlog);
int Accept(int sockfd, sockaddr* addr, socklen_t* addrlen);
void... | true |
4eb095102e47381eac56f8a24e0ade9d44f3befe | C++ | rosen90/GitHub | /Projects/AMineva/Ex1_File_Bonus/src/Ex1_File_Bonus.cpp | UTF-8 | 777 | 3.203125 | 3 | [] | no_license | //============================================================================
// Name : Ex1_File_Bonus.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#in... | true |
b27c233d6b79eb4132b480b8c7a746c0e00a2bed | C++ | bootchk/embeddedDutyCycleOld | /src/RTC/timeConverter.h | UTF-8 | 854 | 2.625 | 3 | [] | no_license |
/*
* Knows how to convert time formats.
*
* !!! With many subtle omissions.
*
* Goal here is to use Unix std implementations when possible.
*/
/*
* A library similar to Unix std library
*
* If the platform support Unix std library:
* #include <ctime> // C time.h
*/
#include "timeTypes.h"
// Depends on ty... | true |
45ebf4c6c2b1d8f63a3165017bd9654ff90d5152 | C++ | ChaitanyaTimmaraju/Thesis | /AmbientOcclusion/modelloader.cpp | UTF-8 | 3,485 | 2.640625 | 3 | [] | no_license | #include "modelloader.h"
#include <QFile>
#include <QTextStream>
#include <QDebug>
ModelLoader::ModelLoader() {
m_indicesID = new QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
}
ModelLoader::ModelLoader(QString fileName) : ModelLoader() {
loadObjectAndSetBuffers(fileName);
}
void ModelLoader::loadObjec... | true |
7cf75eb9fd98dfd650f46f73fc29da83f826b9e1 | C++ | bl4ckp4nther/cpp-codes | /printsubsetsumtok.cpp | UTF-8 | 821 | 3.140625 | 3 | [] | no_license | #include<iostream>
using namespace std;
void printSubsetSumToKHelper(int input[],int size1,int si,int output[],int size2,int sum,int tempsum)
{
if(size1==0)
{
if(tempsum==sum)
{
for(int i=0;i<size2;i++)
{
cout<<output[i]<<" ";
}
cout<<e... | true |
49130420592322e9c1b4f8e473d2d92696d1d093 | C++ | tophack-16/LogParser | /cerrLogParser.cpp | UTF-8 | 1,504 | 2.75 | 3 | [] | no_license | //
// Created by zhanghuimeng on 19-3-24.
//
#include <string>
#include <fstream>
#include "json/json.h"
#include <vector>
#include "Board.h"
using namespace std;
static void cerrLogParser(const vector<string>& log) {
int round;
int turn = 0;
Json::Reader reader;
Json::Value value;
string json;
... | true |
fc96fe280f8b2e872db36b750605be0df4569850 | C++ | wkcn/leetcode | /0501-0600/0520.detect-capital.cpp | UTF-8 | 486 | 2.765625 | 3 | [] | no_license | class Solution {
public:
bool detectCapitalUse(string word) {
const int n = word.size();
if (n < 2) return true;
if (islower(word[1])) {
for (int i = 2; i < n; ++i) {
if (isupper(word[i])) return false;
}
} else {
if (islower(word[0... | true |
b68a89f035098df0f65430f84bd34ed4a1d1a907 | C++ | lizixroy/CANOpenRobotController | /src/apps/X2DemoMachine/X2DemoMachine.h | UTF-8 | 1,818 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | /**
* \file X2DemoMachine.h
* \author Emek Baris KUcukabak
* \version 0.1
* \date 2020-07-06
* \copyright Copyright (c) 2020
*
* /brief The <code>X2DemoMachine</code> class represents an example implementation of an X2 state machine.
*
*/
#ifndef SRC_X2DEMOMACHINE_H
#define SRC_X2DEMOMACHINE_H
#include <sys/... | true |
2abe45d6bfee841bd1c6ac3ae766cb0420b95b3c | C++ | akash19jain/COMPETITIVE-PROGRAMMING | /CODECHEF/CRAWLER/EID-19859168.cpp | UTF-8 | 865 | 3.234375 | 3 | [] | no_license | // C++ program to find minimum difference between
// any pair in an unsorted array
#include <bits/stdc++.h>
using namespace std;
// Returns minimum difference between any pair
int findMinDiff(long long arr[], long long n)
{
// Sort array in non-decreasing order
sort(arr, arr+n);
// Initialize difference as... | true |
174916a50448fc0bdfbd60286871acfa1cb4b154 | C++ | Babelz/EUS | /EUS/PlayerCursor.h | UTF-8 | 370 | 2.515625 | 3 | [] | no_license | #pragma once
#include "Entity.h"
#include "SpriteAnimator.h"
// Class for controlling units and interactions.
class PlayerCursor : public Component {
private:
SpriteAnimator* animator;
protected:
void onInitialize() override;
virtual void onDestroyed() override;
public:
PlayerCursor(Game& game, Entity& owner);
... | true |
87db652b0e273b916505b9d8fd1d38b3709e3a23 | C++ | ss6364/practice-CP | /contest-520-problem-B.cpp | UTF-8 | 891 | 2.59375 | 3 | [] | no_license | // https://codeforces.com/problemset/problem/520/B
// Two balloons
#include<bits/stdc++.h>
using namespace std ;
#define Fors(n) for(int i=1;i<=n;i++)
#define For(n) for(i=0;i<n;i++)
#define ll long long
#define vint(s) vector<int> s
#define pb(x) push_back(x)
#define mpair(x,y) make_pair(x,y)
#define IOS ios::syn... | true |
afa2ab0f60508e3eaba7da417eeb13ca15a788b8 | C++ | HaoYang0123/LeetCode | /Min_Number_of_Steps.cpp | UTF-8 | 392 | 2.828125 | 3 | [] | no_license | //Leetcode 1347
class Solution {
public:
int minSteps(string s, string t) {
vector<int> c1(26, 0);
vector<int> c2(26, 0);
for(int i=0;i<s.length();++i) {
c1[int(s[i]-'a')]++;
c2[int(t[i]-'a')]++;
}
int res = 0;
for(int i=0;i<26;++i) {
... | true |
05847cddef2f9736379e7412341ecba56ba9c129 | C++ | vijayalaxmi777/CPP | /Object oriented programming in CPP/13.cpp | UTF-8 | 670 | 3.390625 | 3 | [] | no_license | //13.Array of object
#include<iostream>
#include<conio.h>
#include<String.h>
using namespace std;
class Customer
{
int id;
char name[30];
public :
void getInfo()
{
cout<<"Enter Id "<<endl;
cin>>id;
cout<<"Enter name"<<endl;
cin>>name;
}
void dispInfo()
{
cout<<"Id = "<<id<<endl;
cout<<"Na... | true |
8bf343d27359d91fbdb6aa0cba671ddef6f5c587 | C++ | JanFSchulteDummy/cmssw | /PhysicsTools/MVATrainer/interface/LeastSquares.h | UTF-8 | 1,542 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #ifndef PhysicsTools_MVATrainer_LeastSquares_h
#define PhysicsTools_MVATrainer_LeastSquares_h
#include <string>
#include <vector>
#include <TMatrixD.h>
#include <TVectorD.h>
#include <xercesc/dom/DOM.hpp>
namespace PhysicsTools {
class LeastSquares {
public:
LeastSquares(unsigned int n);
virtual ~Least... | true |
c58cc3df7d8121f1dab26d538541cb3062855f70 | C++ | Antik98/PA2 | /hash_zkouska/main.cpp | UTF-8 | 2,833 | 3.640625 | 4 | [] | no_license | #include <string>
#include <iostream>
#include <cassert>
using namespace std;
struct TItem {
TItem(string key, string val, TItem* nextHash,TItem* nextOrd, TItem * prevOrd)
:m_Key(key),m_Val(val),m_NextHash(nextHash),m_NextOrder(nextOrd),m_PrevOrder(prevOrd){}
string m_Key,m_Val;
TItem * m_Nex... | true |
84def5e25784ccc22300bd9438ed2a860949ace1 | C++ | jonathan140/LaboratoriosFunda | /labo4/ejercicio5.cpp | UTF-8 | 431 | 3.53125 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main()
{
string palabra;
char letrafinal;
cout << "Ingrese una palabra: ";
cin >> palabra;
if (palabra.front()==palabra.back())
{
cout << palabra << " inicia y termina con la misma letra" << endl;
}
else
{
... | true |
d30d39375acbf4f3b8b040a4805b3432ece46c71 | C++ | jstopyra/JSEngine | /Source/Logic/Components/CameraComponent.cpp | UTF-8 | 2,721 | 2.734375 | 3 | [] | no_license | #include "CameraComponent.h"
#include "../GameObject/GameObject.h"
#include "../../Utilities/EventSystem/Events/EventsInclude.h"
extern EventSystem* g_pEventSystem;
CameraComponent::CameraComponent(int cameraWidth, int cameraHeight, GameObject* pParent)
: Component(pParent)
, m_cameraWidth(cameraWidth)
, m_camera... | true |