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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4280295a4e35b8921b41d6572032aeff635836c8 | C++ | ajanani85/algorithms | /sudoku_solver/sudoku_solver.cpp | UTF-8 | 5,958 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <string>
#include <fstream>
#include <opencv2/ml/ml.hpp>
using namespace std;
int loadSudokuFromStr(int ***sudoku, const std::string &src);
void printSudoku(int **sudoku);
bool solve(int ***sudoku, int row, int col);
int ... | true |
a35a70ffe0c1e043e46ea31897c6a75f49bde8c0 | C++ | Jacob10383/2021_Summer_CSC_CIS_5 | /Class/Gaddis_9thEd_Chap5_Prob22_Square_V2_Aspect_Ratio/main.cpp | UTF-8 | 1,085 | 3.46875 | 3 | [] | no_license | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Created on July 8th, 2021, 10:27 AM
* Purpose: Display a Square using loops
*/
//System Libraries
#include <iostream> //Input/Output Library
using namespace std; //STD Name-space where Library is compiled
//User Libraries
//Global Constants not Variables
/... | true |
48f32be8ff854472f995a95ec54265b4a994e0b7 | C++ | xiaowei0828/LeetCode | /LeetCode-easy-tree/ValidBST.h | UTF-8 | 414 | 3.15625 | 3 | [] | no_license | #include "CommonType.h"
#include <limits>
class ValidBST {
public:
bool visit(TreeNode* node, long long min, long long max)
{
if (!node)
return true;
if (node->val <= min || node->val >= max)
return false;
return visit(node->left, min, node->val) && visit(node->right, node->val, max);
... | true |
ee93ab01b50add4581e8b75d6897b499c2742740 | C++ | Kujanenj/OhSunnittelu | /Application/App/Model/datamodel.h | UTF-8 | 2,873 | 2.5625 | 3 | [] | no_license | #ifndef DATAMODEL_H
#define DATAMODEL_H
#include <QDebug>
#include "requester.h"
#include "../Data/database.h"
#include "calculator.h"
namespace Model {
/**
* @brief The DataModel class is a facade for all model modules.
*/
class DataModel
{
public:
/**
* @brief DataModel
* Constructor for dat... | true |
05236fb20791025c1c64b4c80079b138e0db703c | C++ | CeliaBenquet/Neuron | /main.cpp | UTF-8 | 739 | 2.609375 | 3 | [] | no_license | #include "Neuron.hpp"
#include "Constantes.hpp"
#include <iostream>
#include <fstream>
using namespace std;
//pour le temps : 1 double = 1 ms
int main()
{
double time(Tstart);
Neuron n (tau, potential_reset, c);
while (time <= Tstop){
n.update(ext_current, time);
time += step;
}
//envoyer les deux ... | true |
cba721c4afa0c92afc398cfcc5365b7e7853a23f | C++ | juane619/Early-Parser | /EarlyParser/Gramatica.h | UTF-8 | 1,288 | 2.8125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Gramatica.h
* Author: juane
*
* Created on 12 December 2017, 11:07
*/
#ifndef GRAMATICA_H
#define GRAMATICA_H
#in... | true |
449a3756bfa69fb771a45e6790887742aae5e79f | C++ | nikeshD10/Medical-Management-System | /Medical Management/Appointment.cpp | UTF-8 | 2,368 | 3.484375 | 3 | [
"CC0-1.0"
] | permissive | #include <iostream>
#include "Appointment.h"
using namespace std;
Appointment::Appointment(long appId, int patientID, string appText, string dateApp, int cost) : Service(appId, dateApp, cost) {
diagonis = appText;
patient_id = patientID;
}
bool Appointment::operator<(const Appointment& a) const {
... | true |
fa9baffad4377a13a887990ad4aa529055157715 | C++ | tmusale/Coding | /String/longest_common_prefix_in_array.cpp | UTF-8 | 3,250 | 3.765625 | 4 | [] | no_license | /*
Longest Common Prefix in an Array
Given a array of N strings, find the longest common prefix among all strings present in the array.
Input:
The first line of the input contains an integer T which denotes the number of test cases to follow. Each test case contains an integer N.
Next line has space separated N stri... | true |
29104565260548f4b50812dee64210919054990c | C++ | aliabbas299792/2dGame | /Game/Game Client/Network/gameNetwork.cpp | UTF-8 | 1,256 | 2.75 | 3 | [] | no_license | #include <game.h>
void gameNetwork::listenData() {
sf::Packet packet;
sf::IpAddress sender;
unsigned short port;
while (!exiting) {
socket.receive(packet);
std::string output = "";
packet >> output;
if (output == "die" && gameReference != nullptr) {
gameReference->networkObj->active = false; //will br... | true |
46b610483d2de88eb8aeb271bbc8c2c6c29a00ad | C++ | z364012341/bubbleDragonSecondLua | /src/client/frameworks/runtime-src/Classes/StageDataManager.h | GB18030 | 1,623 | 2.625 | 3 | [] | no_license | //*******************************************************************************
// : StageDataManager
// : <ϷؿϢ>
//-------------------------------------------------------------------------------
//ע : <,ײʹĻص>
//÷ : <>
//-------------------------------------------------------------------------------
// :... | true |
a71a9160d732768dd99f981d95b0db6a1a896646 | C++ | scikit-hep/boost-histogram | /include/bh_python/vector_string_caster.hpp | UTF-8 | 2,372 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2018-2019 Hans Dembinski and Henry Schreiner
//
// Distributed under the 3-Clause BSD License. See accompanying
// file LICENSE or https://github.com/scikit-hep/boost-histogram for details.
#pragma once
#include <bh_python/pybind11.hpp>
#include <cstddef>
#include <string>
#include <vector>
namespace ... | true |
afdd5c0cc4f36a639978c7be8629146ac5303e8a | C++ | robo8080/M5Stack_TinyBasicPlus_UsbKbd | /M5Stack_TinyBasicPlus_UsbKbd/UsbKbd.cpp | UTF-8 | 3,757 | 2.515625 | 3 | [
"MIT"
] | permissive | #include <M5Stack.h>
#include <hidboot.h>
#include <usbhub.h>
#include <QueueArray.h>
// create a queue of characters.
QueueArray <char> queue;
// Satisfy the IDE, which needs to see the include statment in the ino too.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#endif
#include <SPI.h>
class KbdRptParser : publi... | true |
284888f2cade662d846118ce3389c3ce176ce4e6 | C++ | lewellen/proceduralEnvironment | /src/Neighborhood.h | UTF-8 | 724 | 2.953125 | 3 | [] | no_license | #ifndef __Neighborhood_H__
#define __Neighborhood_H__
#include<vector>
#include "House.h"
#include "Renderable.h"
#include "RenderableCollection.h"
#include "Terrain.h"
// A collection of houses.
class Neighborhood : public RenderableCollection {
private:
Terrain* terrain;
House* lastHouse;
protected:
// Inherit... | true |
f8197c49d2aa632ec1f80a6c20166de946acc5d4 | C++ | JUNK-CHUAN/eclipse-workspace | /ClassicEclipse/List/Pair.h | UTF-8 | 774 | 3.140625 | 3 | [] | no_license | /*
* KVpair.h
*
* Created on: Dec 22, 2018
* Author: junk_chuan
*/
#ifndef PAIR_H_
#define PAIR_H_
template<typename Coeft, typename Index>
class KVpair
{
private:
Coeft k;
Index e;
public:
// Constructors
KVpair() {}
KVpair(Coeft kval, Index eval) {
k = kval;
e = eval;... | true |
e8d08f2de200aae8b1734146422abf74d736d080 | C++ | kuangrenxuezhe/primary-election | /deps/include/util/UC_VarByte.h | UTF-8 | 3,863 | 2.578125 | 3 | [] | no_license | #ifndef __VARBYTE_H__
#define __VARBYTE_H__
#include "UH_Define.h"
class UC_VarByte
{
public:
// compress 32bits
static inline var_u1* encode32_ptr(var_u4 v, var_u1*& target)
{
while((v & ~0x7F) != 0)
{
*(var_u1*)(target++) = ((var_u1)((v & 0x7F) | 0x80));
v >>= 7;
}
... | true |
5c6e35bd66072bf3c9a5e62ee9f0fe97eca0350b | C++ | hkwan003/Interview-Question-Practice | /C++/Chapter_1/1.2_check_permutation/main.cpp | UTF-8 | 645 | 3.734375 | 4 | [] | no_license | #include <iostream>
using namespace std;
void compareString(string a, string b)
{
sort(a.begin(), a.end());
sort(b.begin(), b.end());
if(a.size() == b.size())
{
for(int x = 0; x < a.size(); x++)
{
if(a.at(x) != b.at(x))
{
return;
}
... | true |
dbce65e32fbc513e363b15c76c79c0afef374a89 | C++ | jeowf/competitive-programming | /05/Figureful/q.cpp | UTF-8 | 452 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map< pair<int, int>, string > girls;
for (int i = 0; i < n; ++i) {
pair<int, int> code;
string name;
cin >> code.first >> code.second;
cin >> name;
girls[code] = name;
}
int t;
cin >> t;
for (int i = 0; i < t; ++i) {
... | true |
38b7361ffa42b30cf909dbc36a82436c51c7ca81 | C++ | feleio/words-with-friends-exhaustive-cheater | /WordsCheater/trunk/PlacedTileInfo.cpp | UTF-8 | 560 | 3 | 3 | [] | no_license | #include "PlacedTileInfo.h"
PlacedTileInfo::PlacedTileInfo()
{
m_row = -1;
m_col = -1;
m_placedChar = 0;
}
PlacedTileInfo::PlacedTileInfo(int row, int col, int ch )
{
m_row = row;
m_col = col;
m_placedChar = ch;
}
bool PlacedTileInfo::operator==( const PlacedTileInfo& rhs ) ... | true |
29baf7fabc1d8319dd8eef0fe386e34d7007d581 | C++ | RadoslawRusiniak/qtdiaballik | /turn.cpp | UTF-8 | 2,762 | 3.15625 | 3 | [] | no_license | #include "turn.h"
Turn::Turn(PlayerTeam player, QObject *parent) :
QObject(parent)
{
whos_turn = player;
moves_made = 0;
holder_moves_made = 0;
passes_made = 0;
moves = new QList<Move *>();
}
/** sprawdza czy ruch pilka/zawodnikiem jest dozwolony pod wzgledem liczby ruchow w turze */
bool Tur... | true |
9ac0686a85a5ec40d3d2c04ce445213d8cdd2399 | C++ | tonyshenkk/leetcode | /searchRange.cpp | UTF-8 | 1,032 | 3.171875 | 3 | [] | no_license | //#include <vector>
//#include <iostream>
//
//using namespace std;
//
//vector<int> searchRange(int A[], int n, int target) {
// // Start typing your C/C++ solution below
// // DO NOT write int main() function
// int low = -1, high = n;
// int mid = -1;
// vector<int> v;
//
// while(low + 1 < high)
// {
// mid = (low... | true |
6b20471e7b97982e8c7833d037bc7fbcd9d20a89 | C++ | mendozanmartin/Capstone-Project | /Final Code/libraries/SimpleWifi/SimpleWifi.cpp | UTF-8 | 2,755 | 2.859375 | 3 | [] | no_license | /*
SimpleWifi.cpp a wrapper for WifiEsp and PubSubClient for MQTT.
Martin Mendoza
martinmendoza.ca
*/
#include "SimpleWifi.h"
static int status = WL_IDLE_STATUS;
SimpleWifi::SimpleWifi()
{
WiFiEspClient wifiClient;
WiFiEspClass wifiEsp;
this->wifiClient = wifiClient;
this->wifiEsp = wifiEsp;
}
void ... | true |
1227b8c7113cdd26bf5a1e89124dec276da9e14e | C++ | Konstantin-Shishin/Align_Tech | /Zadanie2/Zadanie2.cpp | UTF-8 | 2,595 | 3.15625 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <time.h>
using namespace std;
double DoubleRand(double _max, double _min)
{
return _min + double(rand()) / RAND_MAX * (_max - _min);
}
struct point {
double x;
double y;
double r;
double a... | true |
68fc1f83afa2ad7f6dee5c160e177bb3d838c394 | C++ | Birger9/TDDD86 | /lab3/tiles/TileList.cpp | UTF-8 | 1,984 | 3.375 | 3 | [] | no_license | /*
* This class contains all the logic for TileList
*/
#include "TileList.h"
TileList::TileList()
{
tileList = new Tile[size]; // Point to address for new array
}
TileList::~TileList()
{
delete [] tileList;
}
void TileList::addTile(const Tile tile)
{
if (count != size) {
tileList[count] = ti... | true |
5c37e2485a5f062c43a33f5c645c1aec99809072 | C++ | Niruz/vigilant-happiness | /test/test/XMLLayer.h | UTF-8 | 483 | 2.734375 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
struct XMLLayer
{
XMLLayer(const std::string& identifier, const std::string& type, const std::string& width, const std::string& height)
: myName(identifier), myType(type), myWidth(width), myHeight(height)
{
}
void SetData(std::vector<std::string> data) { myData ... | true |
b8ed179e8bee359780dcbf60102d14ad069f8a50 | C++ | mfkiwl/rspf_v2.0 | /src/rspf/support_data/rspfRpfCompressionLookupOffsetRecord.cpp | UTF-8 | 2,309 | 2.640625 | 3 | [] | no_license | #include <rspf/support_data/rspfRpfCompressionLookupOffsetRecord.h>
#include <rspf/base/rspfEndian.h>
#include <rspf/base/rspfErrorCodes.h>
ostream& operator <<(ostream &out,
const rspfRpfCompressionLookupOffsetRecord& data)
{
data.print(out);
return out;
}
rspfRpfCompressionLookupOffse... | true |
ae382703e67609b9f14870c9e362a794a669cf7e | C++ | cainiao22/lintcode-cpp | /longest-substring-without-repeating-characters.cpp | UTF-8 | 1,296 | 3.4375 | 3 | [] | no_license | /**
* @projectName lintcode-cpp
* @author yanpf
* @date 2019-04-28
* @brief 最长无重复字符的子串
* @description 给定一个字符串,请找出其中无重复字符的最长子字符串
*
* @example
* 样例 1:
*
* 输入: "abcabcbb"
* 输出: 3
* 解释: 最长子串是 "abc".
* 样例 2:
*
* ... | true |
69842545b6a5e19d614da34e8a504032fb76bc4d | C++ | KDE/knotifications | /src/knotificationreplyaction.h | UTF-8 | 4,983 | 2.53125 | 3 | [] | no_license | /*
This file is part of the KDE Frameworks
SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef KNOTIFICATIONREPLYACTION_H
#define KNOTIFICATIONREPLYACTION_H
#include <knotifications_export.h>
#include <QObject>
#include <memory>
class QSt... | true |
9d6cc6cec032ee6f1e86b52cbae43a0822686d52 | C++ | SayaUrobuchi/uvachan | /UVa/109.cpp | UTF-8 | 1,590 | 2.796875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
int num[25];
char dead[25];
struct point
{
int x, y;
};
struct point p[105], ch[25][105];
int comp(const void *p, const void *q)
{
if(((struct point*)p)->x != ((struct point*)q)->x)
{
return ((struct point*)p)->x - ((struct point*)q)->x;
}
return ((struct point*)p)->y -... | true |
3ef2c1e26cc98157bb63613ae12ecf78eb968cee | C++ | orihalalmit/Project | /Project/GameClock.h | UTF-8 | 418 | 2.734375 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
#include <string>
#include <map>
using std::string;
class GameClock
{
public:
//Singleton getInstance
static GameClock& getInstance();
//Restart the game clock
float restart();
//Get the elapsed time
float getElapsedTime();
//Returns if the time passed from las... | true |
3a23ced37dcb3df6b89eb0b8f64d1afcf4def609 | C++ | doitsujin/dxvk | /src/dxbc/dxbc_common.h | UTF-8 | 1,313 | 2.828125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Zlib"
] | permissive | #pragma once
#include "dxbc_include.h"
namespace dxvk {
/**
* \brief DXBC Program type
*
* Defines the shader stage that a DXBC
* module has been compiled form.
*/
enum class DxbcProgramType : uint16_t {
PixelShader = 0,
VertexShader = 1,
GeometryShader = 2,
HullShader ... | true |
4b5bea952b5ef7a8e29dd7ca3d681395b3272a27 | C++ | ComsaAna/Seminar2 | /SeminarAufgaben2.cpp | UTF-8 | 2,288 | 3.28125 | 3 | [] | no_license | // SeminarAufgaben2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string.h>
//#include <cassert>
#include "KlasseAccount.cpp"
using namespace std;
const char* strfind(const char* s1, const char* s2)
{
while (*s1) //*s1!=0
{
... | true |
666c6bf61edaed1cbe195e188c7f5d579e5490cc | C++ | MOMOJMOGG/Leetcode-Practice-Library | /Easy/0009# Palindrome Number/PalindromeNumber.cpp | UTF-8 | 1,320 | 3.515625 | 4 | [] | no_license | /**** Leetcode-Easy 0009# Palindrome Number *****/
/***
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Follow up: Could you solve it without converting the integer to a string?
***/
/***
■ Example 1:
Input: x = 121
Output: true
■ Example 2:
Inp... | true |
1bd5670f634965ffadd1e010214ff3aa1f24fd29 | C++ | aretw0/compiler-works | /src/lexer.h | UTF-8 | 1,115 | 2.875 | 3 | [] | no_license | #include <fstream>
#include <unordered_map>
#include <string>
#include <cstdio>
using namespace std;
enum Tag { EXPRESSION = 256, TYPE, NUM, ID};
struct Token
{
int tag;
Token() : tag(0){}
Token(int t) : tag(t) {}
};
struct Num : public Token
{
float value;
Num() : Token(Tag::NUM), value(0) {}
Num(float v) : T... | true |
162ac213f580d9b08c346505a3e25a9944e34dbc | C++ | SeanHostetter/DataBase1 | /gitgud-football/database.h | UTF-8 | 2,095 | 2.921875 | 3 | [] | no_license | /**
* @file database.h
*/
#ifndef DATABASE_H
#define DATABASE_H
#include <QDialog>
#include "stadium.h"
/**
*@namespace Ui
*@brief namespace declaring a DataBase object
*/
namespace Ui {
class DataBase;
}
/**
* @class DataBase
* @brief class representing database window
*/
class DataBa... | true |
f8d20f8f792ca7bde706c63ae8215d19d622f953 | C++ | Jersonmp/ExercisesArrays | /pro/Modif/src/Buscador.cpp | WINDOWS-1250 | 1,237 | 3.21875 | 3 | [] | no_license | #include "Buscador.h"
#include<cstdlib>
#include<iostream>
#include<fstream>
#include <string>
#include<string.h>
using namespace std;
void Buscador::Buscar(char nequipo[20], char nombre[15]){
ifstream lectura;
strcat(nequipo, ".txt");
lectura.open(nequipo, ios::out|ios::in);
encontrado=false;
if(lectur... | true |
d038f1b6c664eb75c8d2872245de3be23eac3bb5 | C++ | chonlon/net_base | /include/base/print_helper.h | UTF-8 | 6,405 | 3.09375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <list>
#include <map>
#include <string>
#include <type_traits>
#include <vector>
// cpp17 required.
///////////////////////////////////////////////
// micros
///////////////////////////////////////////////
#define PRINT_INVOKED() std::cout << "was invoked: " << __FUNCTION__... | true |
e479cfbff66994305188b99bcd97ea4cbb575e49 | C++ | ybai62868/Coursera | /Data-Structure_ZJU/2.1.cpp | UTF-8 | 1,659 | 3.640625 | 4 | [] | no_license | //线性表的顺序存储实现
# include <cstdio>
# include <iostream>
# include <cmath>
using namespace std;
# define MAX 123456
# define ElementType int
typedef struct {
ElementType Data[MAX];
int last;
}List;
List L, * Ptrl;
/*
访问下标为i的元素:L.Data[i], Ptrl->Data[i]
线性表的长度:L.last+1,Ptrl->last+1
*/
//初始化(建立空的顺序表)
List * MakeEmpty()
{... | true |
8d9d5d3cdb8ff6c54f2bcadbab512addde4d382e | C++ | stepanstefan/Operating-systems | /client-server/client.cpp | UTF-8 | 1,472 | 2.578125 | 3 | [] | no_license | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "erproc.h"
#include <string.h>
#include <signal.h>
#define BFSIZE 10000
int fd;
void sigHandler(int sig) {
printf("%c",'\n');
close(fd);
exit(EXIT_FAILURE);
};
void... | true |
65d58aeeb12a36a4259450ec6232b4842c8c4026 | C++ | MantiS33/studentcpp | /lab4/second version/second version.cpp | UTF-8 | 3,212 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct aeroflot
{
char* point_of_arrival;
int flight_number;
char* airplane;
};
struct list
{
aeroflot data;
list* next, * prev;
};
list* head = NULL;
list* tail = NULL;
void add(aeroflot elem)
{
list* Temp = head;
list* temp = new list;
temp->data = elem;
temp->ne... | true |
b7ba1a94bb1469c63b1b40d62354862e0c68b9ce | C++ | glastonbridge/fullSpectrum | /ofxBlender/src/ofxBlenderScene.cpp | UTF-8 | 873 | 2.515625 | 3 | [] | no_license | #include "ofxBlenderScene.h"
#include "ofxBlender.h"
ofxBlenderScene::ofxBlenderScene()
{
activeCamera = NULL;
}
ofxBlenderScene::~ofxBlenderScene()
{
}
void ofxBlenderScene::draw(){
if(activeCamera != NULL)
activeCamera->begin();
vector<ofxBlenderObject*>::iterator it = objectList.begin();
while(it != obj... | true |
73a228ea6831d36a77bef043d4702f4f6e5bee90 | C++ | dishankkheni/billingSoftware | /bill.cpp | UTF-8 | 44,921 | 2.578125 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<fstream>
#include<string.h>
#include<time.h>
#include<iomanip>
#define systemc system("cls");
using namespace std;
int checkgst(char*);
int checkmono(char*);
void putsf(char*);
struct date
{
int dd,mm,yy;
};
c... | true |
4b0202d8dddbb22c4b196b6424bd07c409f534ec | C++ | Chrrojas514/TestGame | /TestGame/src/GameApp.cpp | UTF-8 | 3,025 | 2.65625 | 3 | [] | no_license | #include "GameApp.h"
GameApp::GameApp(): mFlySwatter("assets/unknown.png", 6),
mTitle("assets/title.png"),
mInstructions("assets/howToPlay.png"),
mBackground("assets/woodenWall.png"),
mScore(0),
mGameOverMessage("assets/GameOver.png"),
mFlySwatterAction(Action::Forward),
mFrameNumb... | true |
cda62796f69b8d84cb797be6c3674b7c8e8d01b7 | C++ | YuHaitaoGithub/ALGM2 | /Algorithm/Algorithm/Str/08_HammingWeight.cpp | GB18030 | 553 | 3.265625 | 3 | [] | no_license | #include "..\Include\08_HammingWeight.h"
///*һѭȡ*/
//int HammingWeight(uint32_t n)
//{
// if (n == 0)return 0;
// int i = 0;
// int times = 0;
// while (n)
// {
// if (n % 2 == 1)
// times++;
// n = n / 2;
// }
// return times;
//
//}
int HammingWeight(uint32_t n)
{
n = (n & 0x55555555) + ((n >> 1) & 0x55555555)... | true |
eec8f452a7e681711638101fc47c5657866324dc | C++ | HodakaNiwa/-Employment-work | /boxCollider.h | SHIFT_JIS | 2,584 | 2.6875 | 3 | [] | no_license | //*****************************************************************************
//
// 蔻pf̏[boxCollider.h]
// Auther:Hodaka Niwa
//
//*****************************************************************************
#ifndef _BOXCOLLIDER_H_
#define _BOXCOLLIDER_H_
//**************************************************... | true |
101d6ef270ae4ce84269ebb0e93bc5334365aefa | C++ | bayoumim/MTBDD | /RequestBucket.h | UTF-8 | 19,406 | 2.796875 | 3 | [] | no_license | #ifndef _REQUEST_BUCKET_CLASS
#define _REQUEST_BUCKET_CLASS
// this class is used as the basic building block for Queue (hashQueue.h class). it represent a single bucket in the Queue
#include "BDDPointer.h"
#include "BDDNode.h"
#include "Request.h"
template<typename T,typename V,typename L,typename FLG>
// T: is the t... | true |
ceceb3b18e77585db4bde6770f01f49fb9dcf864 | C++ | 6clc/Codeforces | /education/e65/C/main.cpp | UTF-8 | 1,085 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int MAXN = int(5e5+5);
int root[MAXN];
int cnt[MAXN];
int find_root(int r){
while (r!=root[r]){
root[r] = root[root[r]];
r = root[r];
}
return r;
}
void unit(int u, int v){
int ra = find_root(u);
int rb = find_... | true |
6d86fdd291116842500cb571571609b6e817ccca | C++ | trbhakta/BhaktaTejash_48102 | /Hmwrk/Assignment3/Gaddis_8thEd_Chpt4_ProgrammingChallenges_Q23_GeometryCalculator/main.cpp | UTF-8 | 3,039 | 4.21875 | 4 | [] | no_license | /*
File: main
Author: Tejash Bhakta
Created on October 4, 2016, 8:41 PM
Purpose: Calculate the area of circle, rectangle or Triangle depending on user
*/
//System Libraries
#include <iostream> //Input/Output objects
#include <cMath> //Math Library
using namespace std; //Name-space used in the ... | true |
d51da59befc1c2ef3930ac9a6b1cdd29197afe1d | C++ | trol98/SlimeSimulation | /SlimeSimulation/src/TextureHelper.h | UTF-8 | 3,234 | 3.015625 | 3 | [] | no_license | #pragma once
#include <glad/glad.h>
#include <iostream>
#include "vendor/stb_image/stb_image.h"
class TextureHelper
{
public:
static unsigned int loadEmptyTexture(unsigned width, unsigned height, unsigned numberChannels)
{
unsigned int textureID;
glGenTextures(1, &textureID);
GLenum ... | true |
7a558a68d6cbfe8fa5ec844c524034a72fe00e47 | C++ | YvesBell42/Particle-Collision-Simulation | /Particle.cpp | UTF-8 | 1,711 | 3.03125 | 3 | [] | no_license | #include "Particle.h"
particle::particle(int id, sf::Vector2f pos, sf::Vector2f vel, float m, int d) {
ID = id;
position = pos;
velocity= vel;
mass = m;
size = d;
body = sf::CircleShape(size);
body.setFillColor(sf::Color(255, 255, 255));
body.setPosition(sf::Vector2f(position.... | true |
c84bb960aa77617ad97b3de85d8e1bc16a30e848 | C++ | Freddy08/C-plus-plus | /programa profesor bernardo/programa 4.cpp | UTF-8 | 603 | 3.234375 | 3 | [] | no_license | /*Programa union3.c*/
#include<stdio.h>
#include<stdlib.h>
main()
{
union tipos
{
unsigned char car[6];
int entero;
};
union tipos t;
t.entero=256;
system("cls");
printf("\n\nEl espacio reservado para \"CADA variable ASOCIADA");
printf(" a la UNION\" es de %d bytes.\n\n",sizeof(union tipos));
printf("Las d... | true |
af2967418bff7ce165195d866cdac400e0bfb209 | C++ | upstream335/upstream | /jonathanD.h | UTF-8 | 4,297 | 2.734375 | 3 | [] | no_license | // Author: Jonathan Dinh
// Date written: 4/18/2016
// Last modified: 5/03/2016
// Purpose: This file holds the structure definition of the lilypads
//
#ifndef _LILLY_
#define _LILLY_
#include <GL/glx.h>
#include "ppm.h"
#include "game.h"
#include <string>
#include <sstream>
typedef double Vec[3];
struct Lilypad {
V... | true |
8c6cd1d5a4313bedeb9b6c8127cef1be7730dfea | C++ | ppdog0/poj | /AtCoder/ABC/61-70/61/61D.cpp | UTF-8 | 2,240 | 3.265625 | 3 | [] | no_license | // bellman-ford算法
// 1. 判断是否有负圈 2. 更新最长路径
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const long long INF = -1e9-5;
const int MAX_N = 1005;
struct edge {
int u, v;
long long cost;
};
int N, M;
long long d[MAX_N];
edge graph[MAX_N];
bool find_negative_loop() {
fill(d, d +... | true |
aa03cc2e9dad70a28040fce4fd59709d06ab797a | C++ | davara13/algoritmicToolbox | /semana3/change.cpp | UTF-8 | 276 | 3.15625 | 3 | [] | no_license | #include <iostream>
int get_change(int m) {
int n;
int resto = m%10;
m = m - resto;
n = m / 10;
if(resto>=5){
n = n + 1 + resto - 5;
}else{
n = n + resto;
}
return n;
}
int main() {
int m;
std::cin >> m;
std::cout << get_change(m) << '\n';
}
| true |
00b4307f5f6ffabd10b9bc49cfcfe60b0adf120c | C++ | alexandraback/datacollection | /solutions_2449486_1/C++/denehs/B.cpp | UTF-8 | 1,369 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
typedef struct {
int up;
int left;
int down;
int right;
}M;
int main () {
int cases;
cin >> cases;
for (int c=1; c<=cases; c++) {
cout << "Case #" << c << ": ";
int n, m;
cin >> n >> m;
int data[110][110];
for (int i=0; i<n; i++) {
f... | true |
f02b00d394e6651117aa6be61a009d0066d27e89 | C++ | Amartaivan/nest_coding | /online_judge_systems/RGB8/timesort.cpp | UTF-8 | 975 | 3.765625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class timestamp{
public:
int hours;
int minutes;
int seconds;
int seconds_total;
bool operator> (timestamp operand){
return seconds_total > operand.seconds_total;
}
bool operator< (timestamp operand){
return seconds_total < o... | true |
3f026b612a5c5dbdc97c2e5020380d30b5318442 | C++ | etienne-p/ArduinoHexapod | /Hexapod/SocketSettings.cpp | UTF-8 | 2,554 | 2.578125 | 3 | [] | no_license | #include "SocketSettings.h"
void SocketSettings::setup()
{
configChanged = false;
steeringChanged = false;
// Here SSID and PWD are defined in an external header file,
// Provide your own credentials
WiFiMulti.addAP(MY_SSID, MY_PWD);
while (WiFiMulti.run() != WL_CONNECTED)
{
delay(100);
}
webSo... | true |
9d22352245147a4a14f0f8f9b09a80b2d5468d94 | C++ | s4914790/Programming-3 | /scene.h | UTF-8 | 6,453 | 2.6875 | 3 | [] | no_license | #ifndef SCENE_H
#define SCENE_H
#include "glinclude.h"
#include <QOpenGLWindow>
#include <QElapsedTimer>
#include <ngl/Transformation.h>
#include "texturepack.h"
#include "character.h"
struct InputAxis
{
float forward = 0.0f;
float right = 0.0f;
};
struct Light
{
ngl::Vec3 position = ngl::Vec3();
ngl::Vec... | true |
56af19b7b371b25290476bb99832c6afd950a15e | C++ | crystalhd/codes_and_notes | /167_add-two-numbers/add-two-numbers.cpp | UTF-8 | 1,513 | 3.28125 | 3 | [] | no_license | /*
@Copyright:LintCode
@Author: holiday_0802
@Problem: http://www.lintcode.com/problem/add-two-numbers
@Language: C++
@Datetime: 16-05-28 17:16
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solu... | true |
e99d2ac80bc2f21f7c11d3eca94beba6c75fa612 | C++ | hmishra609/GEEKS-FOR-GEEKS-PROBLEMS | /Hashing/problems on hashing/find_if_sum_is_zero.cpp | UTF-8 | 552 | 3.46875 | 3 | [] | no_license | #include<iostream>
#include<unordered_set>
using namespace std;
bool subarrayExists(int arr[],int n)
{
unordered_set<int> us;
int prefix_sum=0;
for(int i=0;i<n;i++)
{
prefix_sum+=arr[i];
if(prefix_sum==0||us.find(prefix_sum)!=us.end())
return true;
us.insert(prefix_sum);
}
return false;
}
int main... | true |
0a6c83c5f3699bc56a3081d3f046c7f9002ef8d1 | C++ | ucr-proyecto-integrador-redes-oper/etapa-4-redes-oper-electric-sharks | /examples/client.cpp | UTF-8 | 766 | 3.09375 | 3 | [] | no_license | #include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include "socket.h"
#define MSG_LEN 1024
using namespace std;
int main(int argc, char* argv[])
{
if(argc < 3)
return cout << "Usage: " << argv[0] << " ip_addr port" << endl, -1;
char* ip_addr = argv[1];
int port = atoi(argv[2]);
... | true |
4d4f382bc5bd2b34d83981eeab369374e43375de | C++ | scially/LintCode | /167.h | UTF-8 | 1,181 | 3.421875 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
/*
* @param l1: the first list
* @param l2: the second list
* @return: the sum list of l1 and l2
*/
ListN... | true |
9d58d4630845e749203f4cf46054a2a6dbb82a87 | C++ | bkio/BKServiceFramework | /Source/BKEngine/BKQueue.h | UTF-8 | 1,275 | 3.078125 | 3 | [] | no_license | // Copyright Burak Kara, All rights reserved.
#ifndef Pragma_Once_BKQueue
#define Pragma_Once_BKQueue
#include "BKEngine.h"
#include <queue>
template <class T>
class BKQueue
{
public:
BKQueue() : q()
{
}
virtual ~BKQueue() = default;
// Add an element to the queue.
virtual void Push(T t)
... | true |
97bd39e349a34cfe807f04ccaffbc580ffd8f84f | C++ | yitati/LCProject | /Leetcode/FindAllNumbersDisappearedInArray.cpp | UTF-8 | 1,403 | 3.796875 | 4 | [] | no_license | /******************************************************************************/
/*
* Question: #448 Find All Numbers Disappeared In an Array
* Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
* Find all the elements of [1, n] inclusive that do not a... | true |
8ea120e1ddb75d03661fcff140a764a83395f4b4 | C++ | 1raviprakash/Lab-5 | /lab5_q22.cpp | UTF-8 | 210 | 2.890625 | 3 | [] | no_license | //Library
#include <iostream>
using namespace std;
//Main function
int main()
{
int i,n;
cout << "give the last number" << endl;
cin >> n;
// loop
i=0;
while(i<n){
i++;//a=a+1
cout << i << endl;
}
return 0;
}
| true |
0335ff5c7884bdbb77ca45dd250c9299e8f4b0b5 | C++ | Jujulego/othello | /src/minmaxia.cpp | UTF-8 | 2,501 | 2.734375 | 3 | [] | no_license | // Importations
#include <limits>
#include <map>
#include <memory>
#include <iostream>
#include <string>
#include <vector>
#include "etat.h"
#include "ia.h"
#include "pion.h"
#include "minmaxia.h"
// Macros
#define VAL_COINS 1
// Constructeur
MinMaxIA::MinMaxIA(unsigned prof, COULEUR c) : IA(), m_prof(prof), m_coule... | true |
cd43378a5157ee45e3545619e6ff8dd4f0a6e1bf | C++ | sword2ya/XCard | /Dependence/Include/appframe/basetools/IScriptManager.h | GB18030 | 14,989 | 2.703125 | 3 | [] | no_license | /********************************************************************
created: 2011/11/16 19:30
file base: IScriptManager
file ext: h
author:
purpose: űӿ, ֽű
*********************************************************************/
#pragma once
namespace basetools
{
class IResScript2;
class IResObject2;
cla... | true |
48892b7f19895c5cbbc8de9685ae6eaec8a61203 | C++ | jbhayven/Fibo | /fibo.cc | UTF-8 | 9,151 | 3.6875 | 4 | [] | no_license | #include <vector>
#include <string>
#include <iostream>
#include <typeinfo>
#include <algorithm>
using std::ostream;
class Fibo {
using fibitset = std::vector<bool>;
private:
// Normalized, Fibonacci-based number.
// 0th bit = 1, 1st = 2, 2nd = 3, 3rd = 5, etc.
fibitset bits_;
// P... | true |
f4e5e3c1ae2f3adeb83549f5a9bbd3b9379ac9b6 | C++ | JoshTheLion/PlotScript | /interpreter.hpp | UTF-8 | 1,972 | 3.484375 | 3 | [] | no_license | /*! \file interpreter.hpp
The interpreter can parse from a stream into an internal AST and evaluate it.
It maintains an environment during evaluation.
*/
#ifndef INTERPRETER_HPP
#define INTERPRETER_HPP
// system includes
#include <iostream>
#include <fstream>
#include <istream>
#include <sstream>
#include <string>
... | true |
9c10110390cf6bc985250001158d3e0eba61db3b | C++ | jnoxro/joker | /src/timer.cpp | UTF-8 | 857 | 2.90625 | 3 | [] | no_license | //============================================================================
// Name : timer.cpp
// Author : Jack Orton
// Version :
// Copyright : MIT License
// Description : basic timer to make code cleaner
//============================================================================
#include <... | true |
3537879eaf35ef6b458b1b6cd53467096f975662 | C++ | tecentwenping/Controller_Atcsim | /ATCSIM_Controller_Map/ATCSIM_Controller_New/public/log/wlogappender.cpp | UTF-8 | 1,668 | 2.78125 | 3 | [] | no_license | #include "wlogappender.h"
#include <ctime>
WLogAppender::WLogAppender() : m_dispatcher(0)
{
}
WLogAppender::~WLogAppender()
{
delete m_dispatcher;
}
void WLogAppender::ResetDispatcher()
{
delete m_dispatcher;
m_dispatcher = 0;
}
WLogAppender::_Myt& WLogAppender::operator<<(_Myt& (*pfn)(_Myt&))
{
#ifdef _USE_LOG... | true |
b8f8b31ab6c857485435358b896adeba4ecb33da | C++ | kikiotsuka/ReBreakout | /Ball.cpp | UTF-8 | 2,358 | 3.09375 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include <cmath>
#include "Ball.h"
#include "Meta.h"
#include <iostream>
Ball::Ball(sf::Vector2f loc) {
s = new sf::CircleShape(10.0f);
set_position(loc.x, loc.y);
angle = 0.0f;
velocity = 0.0f;
s->setFillColor(sf::Color::White);
}
sf::Vector2f Ball::calc... | true |
3d33583a1d4c9c3c9f9ebba5f2f2d890b9679e21 | C++ | ouega1732619/GameEngine | /Projet1/Manager/InputManager.cpp | UTF-8 | 1,015 | 2.90625 | 3 | [] | no_license | #include "InputManager.h"
namespace GameView
{
InputManager::InputManager(){}
InputManager::~InputManager(){}
bool InputManager::isSpriteClicked(Sprite object, Mouse::Button button, RenderWindow &window)
{
if (Mouse::isButtonPressed(button))
{
// create a temp rect to check the collision
IntRect co... | true |
71eee4c38c8775aa94554b9fa499472b24d53874 | C++ | Ian-An/CS172 | /HW1/Socialites.cpp | UTF-8 | 2,298 | 2.984375 | 3 | [] | no_license | //
// Socialites.cpp
// HW#1
//
// Created by AnYi on 4/12/16.
// Copyright © 2016 Yi An. All rights reserved.
//
#include <stdio.h>
#include <iostream>
#include <string>
#include "Socialites.h"
using namespace std;
/**default constructor*/
Socialites::Socialites()
{
lastname_="";
firstname_="";
... | true |
cbf8984970239518afb7306b3ac997f09666c1bb | C++ | suchith720/MITAlgorithms | /include/myString.h | UTF-8 | 484 | 2.671875 | 3 | [] | no_license | #ifndef __MY_STRING__
#define __MY_STRING__
#include <iostream>
#include <cstring>
using namespace std;
class MyString
{
char* m_string;
int m_length;
void initialize();
public:
MyString();
MyString(const char* str);
MyString(const MyString &str);
void clear();
void operator... | true |
f404fa9f01e9c655f8443da0306a820d11a423a5 | C++ | jtliso/File-Locker | /sources/test_inputs.cpp | UTF-8 | 7,246 | 2.6875 | 3 | [] | no_license | // Richard Riedel, J.T. Liso, Sean Whalen
// CS 583 Fall 2017
// Programming Assignment 2
// This file tests key sizes that are stored int he directory tests/public_keys, tests/private_keys.
// It uses inputs stored in tests/inputs. The file names will be stored in numerical format with
// whatever file extension.
// ... | true |
da3661a4e4bb5207c505f9d401638f4fbfad47bb | C++ | EnricoGiordano1992/Algoritmi | /Piastrelle/piastrelle.cpp | UTF-8 | 1,050 | 3.453125 | 3 | [] | no_license |
#include <iostream>
#include <cstring>
#include <string>
#include <assert.h>
#include <fstream>
using namespace std;
typedef basic_string<char> string;
int read_file(string NomeFile)
{
int N;
string line;
ifstream myfile;
myfile.open(NomeFile.c_str());
if (myfile.is_open())
{
while ( getline (... | true |
1b9b558dc2e22ef54fe1be6aec06c9cdfe000688 | C++ | geegatomar/Algorithms | /Stack/stock_span_consecutive_smaller_equal.cpp | UTF-8 | 475 | 2.921875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> arr{100, 80, 60, 70, 60, 75, 85};
int i, j, n = arr.size();
vector<int> res(n, 0);
stack<pair<int, int>> st; //stack to keep element and its index
for(i = 0; i < n; i++)
{
while(!st.empty() && st.top().first <= arr[i])
st.pop();
if... | true |
0096f4138e18eb56287919ad93be7065681a50d8 | C++ | dp-manit/Codes-From-My-Blog-posts | /118/template_class_as_function_parameters.cpp | UTF-8 | 629 | 3.953125 | 4 | [] | no_license | #include <iostream>
template<class Type>
class Other {
public:
Type x;
Other(Type y){
x = y;
}
};
void first(const Other<int>& o) {/*One way of specifying the formal parameter*/
std::cout << o.x << '\n';
}
template<typename T> void second(const Oth... | true |
09c245151e573d8896197b82dcdacf69311e7ee5 | C++ | msk4862/DS-Algo | /Practice/LeetCode/30DayChallenge/week_1/Day6.cpp | UTF-8 | 554 | 3.109375 | 3 | [] | no_license | /*
Group Anagrams
*/
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
vector<vector<string>> groups;
unordered_map<string, vector<string>> mapping;
for(int i = 0; i<strs.size(); ++i) {
string cur = strs[i];
sort(cur.be... | true |
6c76274704dffbcf3b261c2e84972a08bf5ca964 | C++ | Renaultivo/RNI | /src/Animations/Transition/Transition.hpp | UTF-8 | 1,289 | 2.796875 | 3 | [] | no_license | #ifndef TRANSITION_HPP
#define TRANSITION_HPP
#include "../Animation.hpp"
#include "../../UI/UIComponent/UIComponent.hpp"
#include <thread>
typedef struct TransitionProps {
float initialValue = 0;
float targetValue = 0;
float currentValue = 0;
Animation::milliseconds currentTime = 0;
Animation::milliseconds ... | true |
fd1bedbcff64935253597c84fbe0525cba4da29b | C++ | wangweihao/CloudBackup | /Server/WServer/workerServer/logger/2.cpp | UTF-8 | 448 | 2.796875 | 3 | [] | no_license | /*======================================================
> File Name: 2.cpp
> Author: wwh
> E-mail:
> Other :
> Created Time: 2015年12月26日 星期六 12时32分35秒
=======================================================*/
#include<iostream>
#include <vector>
int main()
{
std::vector<char> ivec;
i... | true |
9fbdb7364c011cf99c6768550d174a039235b355 | C++ | ezyang/pytorch | /torch/csrc/deploy/unity/xar_environment.cpp | UTF-8 | 6,066 | 2.59375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"BSL-1.0",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | #include <dirent.h>
#include <dlfcn.h>
#include <fmt/format.h>
#include <sys/stat.h>
#include <torch/csrc/deploy/Exception.h>
#include <torch/csrc/deploy/elf_file.h>
#include <torch/csrc/deploy/unity/xar_environment.h>
namespace torch {
namespace deploy {
XarEnvironment::XarEnvironment(std::string exePath, std::strin... | true |
e935a75b0e99ad5dd81ce8ba7abd2c2e28542d6f | C++ | RoboJackets/robocup-software | /soccer/src/soccer/optimization/gradient_ascent_1d_test.cpp | UTF-8 | 594 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #include <tuple>
#include <gtest/gtest.h>
#include "gradient_1d_config.hpp"
#include "gradient_ascent_1d.hpp"
using namespace std;
// Inverted parabola
static tuple<float, float> eval_function(float x) { return make_tuple(1 - x * x, -2 * x); }
// Tests general execution
TEST(GradientAscent1D, execute) {
functi... | true |
33cebe848e9edd9fcbaa5a31ab12e310539da35c | C++ | juan-barragan/CS1156x | /Line.cpp | UTF-8 | 1,023 | 3.203125 | 3 | [] | no_license | #include "Line.h"
#include<sstream>
ML::Line::Line(const Point& X1, const Point& X2)
: a(X2.y - X1.y), b(X1.x - X2.x), c(-b*X1.y - a*X1.x)
{
}
ML::Line::Line(double x1, double x2, double x3)
:a(x1), b(x2), c(x3)
{}
ML::Line::Line(const std::vector<Point>& points)
{
double x_mean(0.);
double y_mean(0.);
do... | true |
771a999138cbe5843a2f651147b6de7f686b2c8b | C++ | Qzhenlong/SwordtoOffer | /35_FirstNotRepeatingChar.cpp | GB18030 | 977 | 3.734375 | 4 | [] | no_license | #include<iostream>
#include<vector>
#include<map>
#include<string>
using namespace std;
/*
Ŀַҳһֻһεַ롱abaccdeff",b
˼·ŹϣһŴ洢ֵַĴһŴ洢ֵַ꣬ҳִΪ1ΪСֵַ
ռO(n),ʱO(n)
*/
class Solution{
public:
char fun(string s){
map<char, int> num;
map<char, int> index;
for(int i = 0; i < s.size(); i++){
num[s[i]] = 0;
index[s[i]] = i... | true |
ad7d6061b424bfcc6ec404d9c546554a815f7d15 | C++ | LynnShaw/MyAlgorithm | /code_for_interview/6.从尾到头打印链表.cpp | UTF-8 | 945 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {}
};
class Solution {
public:
vector<int> printListFromTailToHead(ListNode *head) {
vector<int> v;
stack<int... | true |
3c1c9697e8a472b2c4bbd99f3b08a685c964e8ee | C++ | tazbia-fatima/ncrwork | /C++/C++-assignment1/question7-matrix/matrix.cpp | UTF-8 | 1,724 | 3.609375 | 4 | [] | no_license | #include<iostream>
#include<math.h>
using namespace std;
class Matrix {
int rows, cols, **p;
public:
Matrix() {
rows = cols = 0;
p = NULL;
}
Matrix(int r,int c) {
rows = r;
cols = c;
p = (int **)malloc(sizeof(int*)*r);
for (int i = 0; i < r; i++) {
p[i] = (int *)malloc(sizeof(int)*c);
}
}
void se... | true |
e30cb3492a956cd598548b5bcb215ae28962da04 | C++ | leeeeeeo/face_lls | /headpose/github/2dMorphing-master/util.h | UTF-8 | 1,590 | 2.78125 | 3 | [] | no_license | /* ======================================================================
* util.h - Utility functions: image I/O and memory management.
* Copyright (C) 1993 by George Wolberg
*
* Written by: George Wolberg, 1993
* Editted by: Joseph Pan, 2013
* =====================================================================... | true |
42230221a61fae77c510e925a138ea6539599cd8 | C++ | Yagrini/HackerRank-Solutions | /Algorithms/Strings/Sherlock-and-Anagrams.cpp | UTF-8 | 931 | 3.328125 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
bool anagram(string s1 , string s2){
int tab1[26] = {};
int tab2[26] = {};
for(int i=0 ; i<s1.size() ; i++){
tab1[s1[i]-'a']++;
tab2[s2[i]-'a']++;
}
fo... | true |
f5d81357dcd7b8fcb4e17da3dbd6c46fd7bbe33f | C++ | dipendughosh/programs | /class11&12/string/PALLINDR.CPP | UTF-8 | 399 | 2.890625 | 3 | [] | no_license | #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{ clrscr();
char string[80];
int i,j,len,c=1;
cout<<"ENTER A STRING :";
gets(string);
len=strlen(string);
for(i=len-1,j=0; i>=0;i--,j++)
{ if (string[j]==string[i])
c=1;
else
{ c=0;
break;
}
}
if... | true |
aaf843ea5dc638a7a91a3545fcdcd366645c8db0 | C++ | beet-aizu/library | /toptree/distancesum.cpp | UTF-8 | 2,616 | 2.578125 | 3 | [] | no_license | #ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#define call_from_test
#include "toptree.cpp"
#undef call_from_test
#endif
//BEGIN CUT HERE
struct Vertex{
void* handle;
// 0: dead, 1: alive
int color;
Vertex(int color=0):handle(nullptr),color(color){}
};
template<typename T>
struct Dist... | true |
e1071dc7cacd32bd7a92a8badf4692b50cfb83a6 | C++ | leon196/VJOF | /src/Elements/Surface.cpp | UTF-8 | 777 | 2.546875 | 3 | [] | no_license | #include "Surface.h"
Surface::Surface()
{
Translate(ofVec3f(0, 0, -0.5));
width = 0.7;
height = 0.5;
fboWidth = 512;
fboHeight = 512;
fbo.allocate(fboWidth, fboHeight, GL_RGBA32F_ARB);
fbo.begin();
ofClear(255,255,255, 0);
fbo.end();
shader.load("shaders/screen.vert", "shader... | true |
c7dd406a33ccdf80a6cd957e34d923e095b4dd7e | C++ | giriSatyansh/CPP | /DSA/circularlistADTpractice.cpp | UTF-8 | 3,285 | 4.03125 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct Node{
int data;
Node* prev ,*next;
};
class circularList{
private:
Node* first;
Node* last;
Node* temp1;
Node* temp2;
int count;
public:
circularList(){
first =NULL;
last= NULL;
count= 0;
}
void insert_front( int data){
if(firs... | true |
f8785440e02d1d71edcd2509d07f5e65c34f107c | C++ | ZiadAhmedShawky/array-based-list | /list.h | UTF-8 | 739 | 3.171875 | 3 | [] | no_license | #pragma once
#include<iostream>
template<class elemType>
class List
{
protected:
int* list;
int length;
int maxSize;
public:
bool isEmpty()const;
bool isFull()const;
int listSize()const;
int maxsize()const;
void print();
bool isItemEqual(int location, const elemType& item)const;
void insertA... | true |
f880e696bc151742bda5d2e32513b396da14674f | C++ | k28207429/basic-homework--20 | /20.cpp | WINDOWS-1252 | 617 | 2.96875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
struct phone
{
char brand[10],size[10];
int year,price;
};
int main(void)
{
int j;
printf("c\n");
struct phone p[5]={
"APPLE", "5s", 2013, 18900,
"Samsung", "S10", 2019, 30000,
"Huawei", "P30 Pro", 2019, 32000,... | true |
eab0dabdadb3b748ab1ec50a692b2af5b63a0e02 | C++ | Joncarre/CPlusPlus-language | /Estructuras de datos y Técnicas algorítmicas/Árboles de búsqueda/1. Árbol de Huffman/main.cpp | ISO-8859-1 | 5,777 | 3.171875 | 3 | [] | no_license | //
// Created by Jonathan Carrero.
// Copyright (c) Jonathan Carrero. All rights reserved.
//
#include <iostream>
#include <string>
#include <fstream>
#include <queue>
#include <vector>
#include "arbin.h"
using namespace std;
const int MAX = 128;
const string FCodificar = "codi.txt";
const string FDeco... | true |
c5454277e490bfa57192f51012ae590283a7f234 | C++ | nevet/lintcode-cpp-solutions | /Permutation Sequence.cpp | UTF-8 | 491 | 3 | 3 | [] | no_license | class Solution {
public:
/**
* @param n: n
* @param k: the kth permutation
* @return: return the k-th permutation
*/
string getPermutation(int n, int k) {
char f[n + 1];
for (int i = 0; i < n; i ++) f[i] = i + '1';
do {
k --;
if... | true |
6107e9ad90f689a7b801e08f270852107fa45a16 | C++ | cowtony/ACM | /LeetCode/1500-1599/1524. Number of Sub-arrays With Odd Sum.cpp | UTF-8 | 514 | 2.953125 | 3 | [] | no_license | class Solution {
public:
int numOfSubarrays(vector<int>& arr) {
int dp_odd = 0, dp_even = 0; // Store the number of odd/even sum ending with current index. (memory compressed)
int res = 0;
for (int i = 0; i < arr.size(); i++) {
if (arr[i] % 2 == 0) {
dp_even++;
... | true |
46a1a4282121e7b1ba1b2c2f6fb7ce307316c845 | C++ | devlee77/Algorithm | /1225.cpp | UTF-8 | 293 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(void) {
char a[10001];
char b[10001];
cin >> a;
cin >> b;
int i, j;
long long sum;
i = 0;
sum = 0;
while (a[i]) {
j = 0;
while (b[j]) {
sum += ((a[i] - '0') * (b[j] - '0'));
j++;
}
i++;
}
cout << sum;
return 0;
} | true |
51b04c14cdd15a981462884398cc471dd2e193aa | C++ | mradzikowski/surface-2019-20 | /src/simulation/Simulation/src/graphics/RenderView.cpp | UTF-8 | 1,349 | 2.734375 | 3 | [
"MIT"
] | permissive | #include "RenderView.h"
void RenderView::create()
{
float vertices[] =
{
-1.0, 1.0, -1.0, 0.0, 1.0,
-1.0, -1.0, -1.0, 0.0, 0.0,
1.0, 1.0, -1.0, 1.0, 1.0,
1.0, -1.0, -1.0, 1.0, 0.0
};
m_vertices.init();
m_vertices.createBuffer(GL_ARRAY_BUFFER, vertices, sizeof(vertices));
m_vertices.bindAttribute(0, 0, ... | true |