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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
200088635e14a884674f08ad75fe096a46f58de1 | C++ | Jerrydepon/C_plus_plus_Practice | /Chapter 14/14-3/main.cpp | UTF-8 | 473 | 3.59375 | 4 | [] | no_license | #include <iostream>
using namespace std;
int numChars(char, char[], int);
int main()
{
char array[] = "adbcdddef";
cout << "The letter d appears " << numChars('d', array, 0) << " times.\n";
return 0;
}
int numChars(char search, char str[], int subscript)
{
if (str[subscript] == '\0')
retur... | true |
78cbdc5192bd8517a3cf9641d6f0b659b3d58bdb | C++ | Ashish-k-1997/C-ENCRYPT-DECRYPT | /main.cpp | UTF-8 | 1,972 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <conio.h>
#include <fstream>
#include <string.h>
#include <stdlib.h>
using namespace std;
char pass[50];
void encrypt()
{
char ch;
int z[50], i;
ifstream ifile;
ofstream ofile;
ifile.open("input.txt");
ofile.open("output.txt");
cout << "\n\n\tPASSWORD CAN... | true |
1f38188a365b6d34146e85380d30a2b0aaf9b051 | C++ | Voyager2718/Bug-Analyser | /src/Report.cpp | UTF-8 | 944 | 2.984375 | 3 | [] | no_license | #include<memory>
#include<string>
#include<vector>
#include<map>
#include"Report.h"
using std::string;
using std::map;
using std::vector;
using std::shared_ptr;
void Report::add_report(map< string, string > report){
reports.push_back(report);
}
void Report::add_reports(vector< map< string, string > > report) {
... | true |
ddd7108525f6115fa22fe5f5ebf5b8e0f8c47b82 | C++ | tpl2go/ProjectEuler | /src/12.cpp | UTF-8 | 2,897 | 3.765625 | 4 | [] | no_license | /*
* 12.cpp
*
* Created on: Jul 9, 2016
* Author: tpl
*/
# include <vector>
# include <math.h>
# include <iostream>
using namespace std;
#include <stdexcept>
//The sequence of triangle numbers is generated by adding the natural numbers.
//So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.
//... | true |
1ace25fb2f1e157d918a5f698a8f5a77d95c9ed0 | C++ | pedroleite21/20162 | /AulaSobrecarga/circulo.cpp | UTF-8 | 1,675 | 3.390625 | 3 | [] | no_license | #include "circulo.h"
float Circulo::area_circulo() {
float area1;
area1 = 3.14 * (raio * raio);
return area1;
}
float Circulo::distancia_centros(Circulo outro) {
float x2, y2, Xquadr, Yquadr;
outro.getCentro(x2,y2);
Xquadr = (x2 - x) * (x2 - x);
Yquadr = (y2 - x) * (y2 - y);
return sqrt(Xquadr + Yquadr);
... | true |
abea73ac712caaadaf6645238b3a1f654d3c7c0a | C++ | roberchenc/homework_oop | /homework_oop/oop2_queue.cpp | GB18030 | 1,261 | 3.625 | 4 | [] | no_license | #include "oop2_queue.h"
template <class T>
MyQueue<T>::MyQueue()
{
index = 0;
tail = 0;
size = 10;
header = new T[size];
}
template <class T>
int MyQueue<T>::getElementNum()
{
if ((tail+1) % size == index)
return size;
else
return (tail-index+size) % size;
}
template <class T>
void MyQueue<T>::push(T t)
{... | true |
45acb349a95c4e531131f0cf898c463eced5fcd8 | C++ | TurtleMan64/SAB2 | /NewSonicThing/src/menu/Button.cpp | UTF-8 | 3,839 | 2.875 | 3 | [] | no_license | #include <string>
#include "button.hpp"
#include "../engineTester/main.hpp"
#include "../fontMeshCreator/guitext.hpp"
#include "../fontMeshCreator/fonttype.hpp"
#include "../guis/guimanager.hpp"
#include "../guis/guiimage.hpp"
#include "../renderEngine/display.hpp"
/*
Basic button with normal/highlight texture and ... | true |
ccc546f9233137b350ec243d0f887096a0c74cd2 | C++ | zxc0115/parallel_project | /project/openMP_inv.cpp | UTF-8 | 2,152 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <algorithm>
#include "omp.h"
using namespace std;
/** matrix inverse */
void inv(float** matrix, int row_dim, int col_dim,float** inverse)
{
// check square matrix
if(col_dim == row_dim)
{
for(int j = 0;j < col_dim; j++)
{
//find max magnitude
float tmp = 0;
... | true |
3ef25754002d605b766bfaf7e8e8ac06a8ad82c3 | C++ | whatiskeptiname/Air-Play | /Air-Play.ino | UTF-8 | 2,858 | 3.203125 | 3 | [] | no_license | #define trig1 22 // pin declaration for ultrasonic sensor 1
#define echo1 23
#define trig2 24 // pin declaration for ultrasonic sensor 2
#define echo2 25
#define trig3 26 // pin declaration for ultrasonic sensor 3
#define echo3 27
#define trig4 28 // pin declaration for ultrasonic sensor 4
#define echo4 29
#define... | true |
95eeaea151c13b97b5bb1addb6503302da791fb6 | C++ | dackerson/project-absent-lambda | /src/mesh.h | UTF-8 | 2,213 | 2.828125 | 3 | [] | no_license | // 3D mesh code from Figs. 6.13, 6.15, 6.78 on pp.296, 298, 348
// of Hill, F.S. "Computer Graphics Using
// OpenGL", 2nd edition, Prentice Hall, NJ, 2001.
// Modified Oct. 2006 by B.G. Nickerson.
#include<GL/glut.h>
#include<math.h>
#include <iostream>
#include <fstream>
using namespace std;
//@@@@@@@@@@@@@@@@@@ Ve... | true |
b62f82dbdb64192e136c9910934a5f910d5c8029 | C++ | makredzic/strukturepodataka-zadaca2 | /zadatak1/main.cpp | UTF-8 | 1,900 | 3.609375 | 4 | [] | no_license | #include "stack_arr.hpp"
#include "stack_interface.h"
#include "stack_linked.hpp"
template<typename T>
static void printDim(const StackArr<T>& s) {
std::cout << "Capacity: " << s.capacity() << std::endl;
std::cout << "Size: " << s.size() << std::endl;
}
template <typename T>
static void fillNumeric(stack_interface... | true |
5c82762d663c99e2651cb6c05677cbf2927a21f7 | C++ | 0702Keeprunning/C_Basic_knowledge | /数据类型/数据类型/008 new操作符.cpp | GB18030 | 855 | 3.671875 | 4 | [] | no_license | //#include <iostream>
//#include <string>
//using namespace std;
//
////newĻ
//int *func()
//{
// //ڶһ
// //صǸ͵ָ
// int *p = new int(10);
// return p;
//}
//void test01()
//{
// int *p = func();
// cout << *p << endl;
// cout << *p << endl;
// cout << *p << endl;
// //ɳԱͷ delet
// delete p;
// //cout << *p << endl; /... | true |
292c96b00562ab636c30d9ed0a84b16b2c9debeb | C++ | RPG-NJU/NJU-AdvancedProgramming | /Homework 3/PersonManage/main.cpp | WINDOWS-1250 | 749 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "Manager.h"
#include "Member.h"
#include "Student.h"
#include "Teacher.h"
using namespace std;
int main()
{
Manager m; //Manager
m.add(new Teacher(1069, "Cai", 2018, "Economics", "Prof"));
m.add(new Student(161011, "Alice", 2016, "CS", "CS"));
m.add(new Student(150886, ... | true |
ffbbd1f9a64ddc805c61e8b45a596850ca7807b2 | C++ | esadakcam/CPP-OOP | /assignment3/Dwarves.cpp | UTF-8 | 1,797 | 3.25 | 3 | [] | no_license | /*Author: Mehmed Esad AKÇAM
150190725
*/
#include "Dwarves.h"
#include <iostream>
// since there are not any different attributes in Dwarves faction, body part of constructor is empty
Dwarves::Dwarves(string name , int numberOfUnits, int attackPoint, int healthPoint, int regen):Faction(
name, numberOfUnits, at... | true |
9421e8a5d5f3297d2bed70eb2f3aaba817105b9c | C++ | nemzutkovic/Coding-Challenges | /HackerRank/BasicDataTypes.cpp | UTF-8 | 437 | 3.25 | 3 | [] | no_license | // Basic Data Types
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
// Complete the code.
int integer;
long num;
char character;
float decimal;
double complex;
cin >> integer >> num >> character >> decimal >> complex;
printf("%d \n",integer);
printf("%ld \n"... | true |
7e5c5c4c6fe439f60a58286fde9fa4fbaeb77057 | C++ | Tresky/bearded-wookie | /inc/tile_engine/sf_world.hpp | UTF-8 | 1,275 | 2.859375 | 3 | [] | no_license | #ifndef SF_WORLD_H
#define SF_WORLD_H
#include <string>
using std::string;
#include <map>
using std::map;
#include <memory>
using std::shared_ptr;
#include <SFML/Graphics.hpp>
#include "sf_tilemap.hpp"
#include "sf_loader.hpp"
namespace sftile
{
class World
{
public:
// Default constructor
expl... | true |
ceee78b838eef5a23471b7841bca4ae97ca3c21e | C++ | Han8464/PTA-code | /1017/1017/solution.cpp | UTF-8 | 2,361 | 3.140625 | 3 | [] | no_license | /*
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef struct Time
{
int h, m, s;
}time;
typedef struct Customer
{
time t;
int p;
}customer;
customer customers[10010] ;
bool com(customer c1, customer c2)
{
if(c1.t.h > c2.t.h)
{
return false;
}else if(c1.t.h == c2.t.h)
{
if... | true |
222e9a6db9790aca042610ccd7cb783e23b5fc45 | C++ | vulnerabivoro/deadbeef | /deadbeef/deadbeef.cpp | UTF-8 | 2,978 | 2.90625 | 3 | [] | no_license | #include <bitset>
#include <string>
#include <iomanip>
#include <iostream>
#include <sstream>
#include "deadbeef.h"
void cipher32b_WORD(uintptr_t input, std::string key, std::string& output)
{
std::string hexkey = "";
std::string xoredBinString = "";
std::string xoredHexString = "";
stream2hex(key, hexkey, fa... | true |
8a48f8506a86bfc409305ff9376b860676e87d91 | C++ | jsphLim/algorithms | /hdoj/hdu2009.cpp | UTF-8 | 369 | 2.59375 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
int main(){
int m,n;
int flag=0;
int i;
while(scanf("%d%d",&n,&m)!=EOF){
if(n>m){
int t=n;
n=m;
m=t;
}
for(i=n;i<=m;i++){
if(i==pow(i/100,3)+pow(i%100/10,3)+pow(i%100%10,3)){
if(i==m) printf("%d",i);
else printf("%d ",i);
flag=1;
}
}
if(!f... | true |
32432579061dbde24985103982476a25329c676d | C++ | shandaming/Martial_arts | /Smjy/src/server/database/update/update_fetcher.cpp | UTF-8 | 11,760 | 2.59375 | 3 | [] | no_license | /*
* Copyright (C) 2019
*/
#include <chrono>
#include <fstream>
#include <sstream>
#include "update_fetcher.h"
#include "db_update.h"
#include "field.h"
#include "query_result.h"
#include "log.h"
#include "sha1.h"
struct update_fetcher::directory_entry
{
directory_entry(const fs::path& path_, state state_) : path... | true |
ba792db1103195d2249c14a1f8050074cc978b66 | C++ | aFleetingTime/Cpp | /13.CopyControl/28/BinStrTree.cpp | UTF-8 | 910 | 3.390625 | 3 | [] | no_license | #include "BinStrTree.h"
BinStrTree::BinStrTree() : root(nullptr)
{
;
}
BinStrTree::~BinStrTree()
{
delete root;
root = nullptr;
}
BinStrTree::BinStrTree(const BinStrTree &tree) : root(new TreeNode(*tree.root))
{
;
}
BinStrTree& BinStrTree::operator=(const BinStrTree &tree)
{
auto temp = new TreeNode(*tree.root... | true |
0618f2fb017aadc4f5c8a871ee5d35b473346a6e | C++ | chenyilin0110/EasyAttendSystem | /EasyAttendSystem_c++/macversion/total.cpp | UTF-8 | 849 | 2.5625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char* argv[])
{
FILE *fptr;
char num[10] = {},empty[] = "EOF";
int all = 0,count = 0,i,j,total = 0;
long long int array[1000][2]={};
int fl = 0;
fptr = fopen("noattend.txt","r");
while(fscanf(fptr,"%s",num) != EOF)
{
if(strcmp(n... | true |
e806fabf60140afd672c0b8c199fb7f004162afd | C++ | pyc-ycy/ClassicalSample | /ClassicalSample/Horse.h | UTF-8 | 1,167 | 3.5 | 4 | [] | no_license | #pragma once
#include <iostream>
#include <string>
using namespace std;
class Horse
{
protected:
int weight;
int speed;
int age;
public:
Horse()
{
this->weight = 0;
this->speed = 0;
this->age = 0;
cout << "use the constructor of Horse" << endl;
}
Horse(int weight, int speed, int age)
{
this->weight =... | true |
ad26d5635dcf83338e7311d1de93ae3d8ebd456f | C++ | ihsonnet/DIU-ACM-PC-Green-Division | /DIU-PC Weekly Contest-02/D.cpp | UTF-8 | 434 | 2.859375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
long long int f91(int n)
{
if(n==91)
return 91;
else if(n<=100)
return f91(f91(n+11));
else if(n>=101)
{
return n-10;
}
}
int main()
{
int n;
long long int res;
while(cin>>n)
{
if(n==0)
break;
... | true |
53ac765b69e5e7e6981d67c4910e7580c9cd4289 | C++ | ARM-software/armnn | /src/backends/tosaReference/TosaRefMemoryManager.cpp | UTF-8 | 2,157 | 2.75 | 3 | [
"BSD-3-Clause",
"CC0-1.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "TosaRefMemoryManager.hpp"
#include <armnn/utility/Assert.hpp>
#include <algorithm>
namespace armnn
{
TosaRefMemoryManager::TosaRefMemoryManager()
{}
TosaRefMemoryManager::~TosaRefMemoryManager()
{}
T... | true |
b871d5ff2e70063a4c2b8f7d32dbc1ddba097dd7 | C++ | jjocram/sydevs | /src/examples/test_systems/basic/basic_double_processor_node.h | UTF-8 | 3,312 | 2.765625 | 3 | [
"BSL-1.0",
"Apache-2.0"
] | permissive | #pragma once
#ifndef SYDEVS_EXAMPLES_BASIC_DOUBLE_PROCESSOR_NODE_H_
#define SYDEVS_EXAMPLES_BASIC_DOUBLE_PROCESSOR_NODE_H_
#include <examples/test_systems/basic/basic_processor_node.h>
#include <sydevs/systems/composite_node.h>
#include <sydevs/systems/function_node.h>
namespace sydevs_examples {
using namespace syd... | true |
9dd5558b5f12b585179b225fc721772cd33631cd | C++ | amgregoi/School | /K-State/CIS308/Projects/Proj8/proj8/rational.h | UTF-8 | 1,353 | 3.546875 | 4 | [] | no_license | #include "real.h"
#ifndef RATIONAL_H
#define RATIONAL_H
class Rational: public Real {
protected:
int num;
int denom;
public:
/**
* Constructs the rational num/denom.
*
* num: the numerator
* denom: the denominator
*/
Rational(int num, int denom);
/**
* Cleans up memory for this number
... | true |
d908612f2b14f888f539d56470771ed1aed29313 | C++ | bautrey37/Parallelized-Graph-Algorithms | /OpenMP_examples/helloworld_openmp.cpp | UTF-8 | 603 | 2.578125 | 3 | [] | no_license | // Helloorld_openmp.cpp : Defines the entry point for the console application.s
//
#include "stdafx.h"
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main(int argc, char* argv[])
{
// Get the number of processors in this system
int iCPU = omp_get_num_procs();
printf("Number of p... | true |
e2bf3e5bd990d65c12933317449ccf0de733f6e6 | C++ | theAdamBader/flyAway | /flyAway/flyAway/flyAway/src/inGameObjects.h | UTF-8 | 642 | 2.53125 | 3 | [] | no_license | //Run Away (Term 2 Coursework)
//
//inGameObjects.h
//
//Created by Adam M Bader 19.03.2017
#ifndef inGameObjects_h
#define inGameObjects_h
#include <stdio.h>
#include "ofMain.h"
class inGameObjects {
public:
int health = 1;
int points = 1;
bool dead = false;
ofRectangle * boundingBox;
ofVec2f pos, vel; //ta... | true |
efdbd74baffaeab410bdb587aa7725b02db54df9 | C++ | zinsmatt/Programming | /LeetCode/easy/Longest_Substring_Without_Repeating_Characters.cxx | UTF-8 | 758 | 2.96875 | 3 | [] | no_license | class Solution {
public:
int lengthOfLongestSubstring(string s) {
if (s.size() == 0) return 0;
std::unordered_set<char> arr;
int a = 0;
int b = 0;
int max = 0;
while (b < s.size())
{
if (arr.find(s[b]) == arr.end())
{
ar... | true |
918f44a829bba671a02524843fdad260be950a03 | C++ | SJRLL/leetcode2 | /leetcode-682-棒球比赛/Test.cpp | UTF-8 | 3,712 | 3.65625 | 4 | [] | no_license | 你现在是棒球比赛记录员。
给定一个字符串列表,每个字符串可以是以下四种类型之一:
1.整数(一轮的得分):直接表示您在本轮中获得的积分数。
2. "+"(一轮的得分):表示本轮获得的得分是前两轮有效 回合得分的总和。
3. "D"(一轮的得分):表示本轮获得的得分是前一轮有效 回合得分的两倍。
4. "C"(一个操作,这不是一个回合的分数):表示您获得的最后一个有效 回合的分数是无效的,应该被移除。
每一轮的操作都是永久性的,可能会对前一轮和后一轮产生影响。
你需要返回你在所有回合中得分的总和。
示例 1:
输入 : ["5", "2", "C", "D", "+"]
输出 : 30
解释 :
第1轮:你可以得到5分。总... | true |
fca707901de776f46fc4781d62c6a644e02682ae | C++ | infinixco/WAY-TO-PLACEMENT | /coin_change.cpp | UTF-8 | 738 | 3.34375 | 3 | [] | no_license | def numberOfWays(coins,numberOfCoins,value):
ways=[0]*(value+1)
'''
We declare an array that will contain the number of--
ways to make change for all values from 0 to value
This is done as we are working from bottom up. So, obviously, we need to make change for smaller values--
before we c... | true |
072fd4116467773eaca65f5f8340eb81e884d376 | C++ | goldsail/Leetcode | /Leetcode/Q1171.cpp | UTF-8 | 1,288 | 3.078125 | 3 | [
"Unlicense"
] | permissive | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* removeZeroS... | true |
673afb81b62e9602b6f2122c4ea9c6a0895ad491 | C++ | Mondiegus/Cpp_Learning | /My_Tasks/5/T5_7.cpp | UTF-8 | 763 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
struct carsDoc
{
string model;
uint16_t prodYear;
};
int main()
{
int carAmount = 0;
cout << "How many cars do you want to save?" << endl;
cin >> carAmount;
cin.get();
carsDoc *carsTab = new carsDoc[carAmount];
for(int... | true |
6900b81791853fb9da164d0e0938a61007bb1568 | C++ | Muha113/6-th-term-labs | /osis/lab10/mainwindow.cpp | UTF-8 | 1,623 | 2.515625 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::mousePressEvent(QMouseEvent *event)
{
x = event->pos().x();
... | true |
a41f3cc9bfef7eeef969c0789f6c0ca3664689fe | C++ | Saprsuu6/Sapper | /Sapper/Main.cpp | WINDOWS-1251 | 3,773 | 2.671875 | 3 | [] | no_license | //
#include"Header.h"
int main() {
static bool first = true; //
setlocale(0, "C"); //
int enter = 13; //
int space = 32; //
int esc = 27; //
HANDLE h = GetStdHandle(-11); //
Setings(h);
if (first) { //
Sponsor(h, 10, 4);
first = false;
}
system("cls"); //
system("color... | true |
7a00a84914de0c3aec359e804eaee13974b7e5a7 | C++ | tati2327/Gladiators_Project2 | /Tati/A*/List.h | UTF-8 | 1,548 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef A_LIST_H
#define A_LIST_H
#include <iostream>
#include "Node.h"
template<typename T>
class List {
public:
Node<T> *first; /*!< Primer elemento de la lista*/
Node<T> *last; /*!< Ultimo elemento de la lista*/
Node<T> *curr; /*!< Nodo que funciona para facilitar recorrer la lista en ciertas funciones... | true |
ae1a9a7c85221120929bddb0baa86327d8fdf4f1 | C++ | yanbai1990/lintcode | /C++/find_min_in_rotated_sorted_array.cpp | UTF-8 | 543 | 3.328125 | 3 | [] | no_license | class Solution {
public:
/**
* @param num: a rotated sorted array
* @return: the minimum number in the array
*/
int findMin(vector<int> &num) {
// write your code here
int start=0;
int end=num.size()-1;
while(start+1<end) {
int mid=start+(end-start)/2;
... | true |
0983e1074f121807f2322320ab6c88742a34b744 | C++ | vicentegro/LabPercepcion | /Neurona.h | UTF-8 | 1,163 | 3 | 3 | [] | no_license | #include <stdio.h>
#include <math.h>
class Neurona{ //inicio de la clase Neurona
public:
//atributos
float w[5];
float x[5];
float normx[5];
float fx, sum;
float bias;
//metodos
void setpesos(float valuep){
//para asignar los pesos en la neurona y guardarlos en un arreglo w
... | true |
4284f6639329325b0081daa373f08ab0986c214d | C++ | swift1719/SPPU-data-structures-assignments | /assignment17.cpp | UTF-8 | 3,429 | 3.328125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
void linearsearch()
{
int arr[100], i, num, n, c=0, pos;
cout<<"Enter the array size : ";
cin>>n;
cout<<"Enter Array Elements : ";
for(i=0; i<n; i++)
{
cin>>arr[i];
}
cout<<"Enter the number to be search : ";
cin>>num;
for(i=0;... | true |
af98029055f990e4e017a67c1d443719a21294b8 | C++ | chankruze/challenges | /sololearn/SecretMessage/SecretMessage.cpp | UTF-8 | 735 | 2.71875 | 3 | [] | no_license | /*
Author: chankruze (chankruze@geekofia.in)
Created: Sun Aug 09 2020 21:23:42 GMT+0530 (India Standard Time)
Copyright (c) Geekofia 2020 and beyond
*/
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
string encodeWord(string str) {
string enc = "";
string alphabets = "ab... | true |
31ac252872095a3322bb191be29b0ef3b3f88be5 | C++ | CRI-MotionLab/movuino-firmware | /firmware/Timer.cpp | UTF-8 | 1,318 | 2.921875 | 3 | [] | no_license | #include <Arduino.h>
#include "Timer.h"
void
Timer::setPeriod(unsigned long p) {
period = p;
}
void
Timer::start(unsigned long t) {
if (!running) {
timeout = t;
nextPeriod = period;
startDate = lastDate = millis();
running = true;
// callback();
}
}
void
Timer::stop() {
if (running) {
... | true |
71871f08800bd65cc4800510f07631e07cc3b017 | C++ | GustavPS/X-runner | /states/abstract/state.cc | UTF-8 | 574 | 2.640625 | 3 | [] | no_license | #include "state.h"
State::~State()
{
for (auto &kv : textures)
delete kv.second;
for (auto *object : objects)
delete object;
}
const sf::Sprite& State::get_background() const
{ return background; }
const std::vector<const Object*>& State::get_texturated_objects() const
{ return textu... | true |
312326a69075e72b4fc20feeee95a447f86a150c | C++ | Comp208-Antism/Antism | /zone.cpp | UTF-8 | 597 | 2.671875 | 3 | [] | no_license | #include "zone.h"
Zone::Zone(int width, int height)
{
this->setSize(sf::Vector2f(width, height));
}
Zone::~Zone()
{
}
int Zone::update(sf::Vector2f mousePos) {
if (mousePos.x > this->getGlobalBounds().left && mousePos.x < this->getGlobalBounds().left + this->getGlobalBounds().width
&& mousePos.y > this->getGl... | true |
03faa80f407d5b80c145d81207552f1823079194 | C++ | samuelokrent/virtual_socket | /src/client_proxy.cpp | UTF-8 | 1,104 | 2.90625 | 3 | [] | no_license | #include <string>
#include <unistd.h>
#include "client_proxy.h"
#include "network_util.h"
using std::cout;
using std::endl;
using std::string;
#define CLIENT_PORT "6071"
ClientProxy::ClientProxy(string id) {
this->id = id;
}
void ClientProxy::start() {
cout << "Starting client proxy" << endl;
// Create conn... | true |
0161410b5cc2fc3bb370f9db731face82cbf3082 | C++ | Natador/2playerSocketSnake | /source/server/serves.cpp | UTF-8 | 5,798 | 2.78125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <string.h>
#include <unistd.h>
#include <iostream>
#include "server.h"
#include "../include/SnakeFood.h"
#include "../include/SnakeHead.h"
bool looper(int m... | true |
e882de56975e22a680232b7aca0d9e6047025bfb | C++ | kshigedomi/RFSE | /src/Util.h | UTF-8 | 3,535 | 2.9375 | 3 | [] | no_license | #ifndef UTIL_H_
#define UTIL_H_
/*
* Util.h
*
* Created on: 2012. 11. 27.
* Author: chaerim
*/
#ifndef COMMON_H_
#include "Common.h"
#endif
#include <setjmp.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
namespace MyUtil {
// For IO
string numberToRation... | true |
e072fa997c243c94f735df4d86b1b42ff861769e | C++ | VanishRan/leetcode | /RanLeetCode/RanLeetCode/树/145二叉树的后序遍历.cpp | UTF-8 | 1,452 | 3.3125 | 3 | [] | no_license | //
// 145二叉树的后序遍历.cpp
// RanLeetCode
//
// Created by mahuanran on 2020/8/17.
// Copyright © 2020 mahuanran. All rights reserved.
//
#include "common.h"
class Solution {
public:
vector<int> postorderTraversal(TreeNode* root) {
vector<int> res;
if (root == NULL) {
return res;
... | true |
795c322ae96e6fbaddceb0a11686c3d3a1f94d4a | C++ | broune/mathic | /src/mathic/PackedKDTree.h | UTF-8 | 23,315 | 2.59375 | 3 | [] | no_license | #ifndef MATHIC_PACKED_K_D_TREE_GUARD
#define MATHIC_PACKED_K_D_TREE_GUARD
#include "stdinc.h"
#include "DivMask.h"
#include "KDEntryArray.h"
#include <memtailor.h>
#include <ostream>
namespace mathic {
template<class C>
class PackedKDTree {
public:
typedef typename C::Monomial Monomial;
typedef typename... | true |
504172da1e516b3186f0bc2c956f977a51c60254 | C++ | nevern00b/SHUMP | /src/Rendering/ParticleSystem.h | UTF-8 | 540 | 2.59375 | 3 | [] | no_license | #pragma once
#include "ObjectPool.h"
class Mesh;
class Material;
class ParticleSystem : public ObjectPool
{
public:
ParticleSystem(uint size, Mesh* mesh, Material* material);
virtual ~ParticleSystem();
void createRadial(float x, float y, uint count);
};
class Particle : public PoolObject
{
public:
Particle();
... | true |
da45347c3ecfa91c3d3b315630bf368c2b89fdfc | C++ | shyamnathp/Competitive_Coding_C-17 | /Top_k_frequent/Search_Suggestions_SearchWord_Products.cpp | UTF-8 | 1,097 | 2.90625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<map>
#include<queue>
using namespace std;
vector<string> suggestedProducts(vector<string>& products, string subWord) {
int subWordSize = subWord.size();
vector<string> suggestions;
auto i = std::find_if(products.beg... | true |
cf85f18bd480ed43958a14f4405c74ebfcdf945d | C++ | sivangisingh/leet-code | /DP Standard Problems/Target Sum.cpp | UTF-8 | 477 | 2.8125 | 3 | [] | no_license | int main() {
vector<int> arr = {1, 2, 7, 1};
int target = 3, sum = 0, n = arr.size();
unordered_map <int, int> curr;
curr.insert(make_pair(0, 1));
for(auto item: arr){
unordered_map <int, int> newh;
for(auto i = curr.begin(); i != curr.end(); i++){
newh[((*i).fi... | true |
77a6588208a34ad63f6a7dd80616b03e9bfd9a00 | C++ | Dgame/Ikarus | /include/Expression/LowerEqualExpression.hpp | UTF-8 | 515 | 2.59375 | 3 | [] | no_license | #ifndef IKARUS_LOWER_EQUAL_EXPRESSION_HPP
#define IKARUS_LOWER_EQUAL_EXPRESSION_HPP
#include "BinaryExpression.hpp"
class LowerEqualExpression : public BinaryExpression {
public:
using BinaryExpression::BinaryExpression;
LowerEqualExpression* clone() const override {
return new LowerEqualExpression(t... | true |
18129b8f789196ac5170623b238716b64a5bdfa2 | C++ | lixiang2017/leetcode | /cpp/1160.0_Find_Words_That_Can_Be_Formed_by_Characters.cpp | UTF-8 | 1,649 | 3.296875 | 3 | [] | no_license | /*
hash table
执行用时:40 ms, 在所有 C++ 提交中击败了92.97% 的用户
内存消耗:20 MB, 在所有 C++ 提交中击败了56.93% 的用户
通过测试用例:36 / 36
*/
class Solution {
private:
vector<int> freq;
public:
Solution(): freq(26) {};
int countCharacters(vector<string>& words, string chars) {
int ans = 0;
for (char ch: chars) {
... | true |
61338b964f7a5d8911ed24bfcca8b69a8cf33345 | C++ | pescoboza/Genesia | /HeightMap.cpp | UTF-8 | 4,677 | 3.046875 | 3 | [] | no_license | #include "HeightMap.h"
////////////////////////////////////////////////////////////
HeightMap::HeightMap(unsigned t_w, unsigned t_h, const std::vector<double>& t_values) :
m_height{ t_h }, m_width{ t_w }, m_heights{ t_values }{
if (m_heights.size() > t_w* t_h) {
while (m_heights.size() > t_w* t_h)
m_heights.p... | true |
f14756ca0c27ec1a256f621fcafa2630131af234 | C++ | 20-1-SKKU-OSS/2020-1-OSS-7 | /C-Plus-Plus/BOJ/15879.cpp | UTF-8 | 735 | 2.515625 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
#define MOD 100000007
int V, E, C, s;
bool chk[110];
vector<int> graph[110];
void dfs(int node){
chk[node] = true; ++s;
for(auto next : graph[node]){
if(chk[next]) continue;
dfs(next);
}
}
int pow2(int x){
if(x<=0) return 1;
int ret=1;
... | true |
2b23f295e42bc931f2550a6e93ec9ce2c1a03ef6 | C++ | iamjatin08/DATA-STRUCTURES | /dp 1/numof_BT.cpp | UTF-8 | 860 | 3.109375 | 3 | [] | no_license | #include<iostream>
#include<math.h>
using namespace std;
int balancedBTs(int h, int* dp){
if(h<=1 ) return 1;
if(dp[h]!=(-1)) return dp[h];
int mod = pow(10,9)+7;
int x = balancedBTs(h-1,dp);
int y = balancedBTs(h-2,dp);
int temp1 = (int)(((long)(x)*x)%mod);
int temp2 = (int)((2*(long)(x)*y)%mod)... | true |
e3c857b2bdc842b550878c5eccdcf9fd9979bd7f | C++ | demeiyan/algorithm | /cc/hh.cpp | UTF-8 | 1,412 | 2.75 | 3 | [] | no_license | /*void quickSelect(double a[],int l,int r,int rank){
int i=l,j=r;
double mid=a[(l+r)/2];
do{
while(a[i]<mid)++i;
while(a[j]>mid)j--;
if(i<=j){
swap(a[i],a[j]);
++i;--j;
}
}while(i<=j);
if(l<=j&&rank<=j-l+1)quickSelect(a,l,j,rank);
if(i<=r&&rank>=i-l+1)quickSelect(a,i,r,rank);
}
double quick_selec... | true |
cf26be37da643e8094618ab68a6a6eb6d94ffc17 | C++ | bikash-das/cppPrograms | /BeginningC++17/PointerAndRef/stringSwap.cpp | UTF-8 | 316 | 3 | 3 | [] | no_license | #include <iostream>
int main(){
const char *s1 = {"hello it's me Bikash"};
const char *s2 = {"And I'm from Siliguri"};
//swap
const char *temp = s1;
std::cout << "\n" << *temp << "\n";
std::cout << "Swapped\n";
s1 = s2;
s2 = temp;
std::cout << s1 << std::endl;
std::cout << s2 << std::endl;
}
| true |
0d665b32ccf7738ff1589880ee83d34b547ac121 | C++ | IndieLightAndMagic/wolf | /src/texture/fastclampedtexturedata.cpp | UTF-8 | 919 | 2.671875 | 3 | [] | no_license | #include "fastclampedtexturedata.h"
QQE::FastClampedTextureData::FastClampedTextureData(int w, int h):QQE::FastTextureData(w,h){
resetTexture();
updateTexture();
}
void QQE::FastClampedTextureData::resetTexture() {
data = new float[m_sz]();
for (auto index = 0; index < m_sz; ++index){
data[in... | true |
e6f345323a7ed200971ef406763c1543d5b5cebe | C++ | Samhenry97/BulletBash | /BulletBash/bullet.h | UTF-8 | 1,456 | 2.609375 | 3 | [] | no_license | #pragma once
#include "gameobject.h"
class Bullet : public GameObject {
protected:
float speed, moveAngle, homingSpeed, homingDeadzone;
float maxDist, dist = 0;
public:
bool splash, homing, bouncy;
int damage, type;
Bullet(int type, vec2 pos, float speed, float angle);
virtual void render();
virtual void upd... | true |
9e279f1d34cb94de92d2927fb82a698d9640e443 | C++ | FeiiYin/acm | /poj/3321 BIT+DFS序+前向星优化.cpp | UTF-8 | 2,172 | 2.671875 | 3 | [] | no_license | /*
* @Samaritan_infi
*/
/// 前向星优化了一倍的速度
//#include<bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 200000 + 5;
int tree[maxn];
int n;
int low_bit(int x) { return x & (-x); }
void add(int x, int val) {
for( ; ... | true |
4f42da4beab30c0cbe33182f87cc2c5b012f415a | C++ | QuantumGorilla/Benchmark | /CalculatePI.cpp | UTF-8 | 1,091 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
const int n = 250000;
const int m = ((10 * n) / 3);
int main (void){
int n;
std::cout << "Digite la cantidad de digitos de PI que quiere mostrar: ";
std::cin >> n;
int resto, digant, nueves, aux;
int pi [m + 1];
for (int i=1;i<= m;i++) pi[i]=2;
... | true |
ed43dec0754c5ff6c3ddcf7200d404dd10c7d8c8 | C++ | ChristopherMurray194/OpenGL_assignment | /GameWorld.cpp | UTF-8 | 740 | 2.53125 | 3 | [] | no_license | /*
* GameWorld.cpp
*
* Created on: 21 Apr 2015
* Author: cmurray
*/
#include "GameWorld.h"
GameWorld::GameWorld() {
game_manager = boost::make_shared<GameManager>();
std::string earth_texture = "textures/earth_texture.png";
std::string moon_texture = "textures/moon_texture.jpg";
game_manager->AddAsset... | true |
ab7b4d39b8526834d7f4c5c87d80bcf3548a7633 | C++ | Sukarnapaul1893/Code-for-Popular-Topics-of-Contest-Programming | /DP/Bit Mask DP/bitmask dp.cpp | UTF-8 | 408 | 2.53125 | 3 | [] | no_license | // Sample problem codeforces contest Hello 2019 problem B
unordered_map<int,int>dp;
void Calc(int mask){
if(dp.count(mask)!=0)return;
//.. calculate ans here...//
for(int i=0;i<n;i++){
//if(mask&(1<<i)) ....;
//else ....;
}
dp[mask] = ans;
for(int i=0;i<n;i++){... | true |
a82a423061bf4cad7f4d7f718fa8fb2564113c86 | C++ | kgasniko/ZeeD2p76 | /ZeeDHist/src/ZeeDEffHistManager.cxx | UTF-8 | 6,138 | 2.546875 | 3 | [] | no_license | #include "ZeeDHist/ZeeDEffHistManager.h"
#include <TMath.h>
//------------------------------------------------------
ZeeDEffHistManager::ZeeDEffHistManager(TString name) : ZeeDHistManager(name)
{
// The Named Constructor
}
//------------------------------------------------------
ZeeDEffHistManager::~ZeeDEffHistM... | true |
7e96dedad4fb88c4aab372321d538a1ad590b2c9 | C++ | renyajie/Learning | /Algorithm/基础/数学知识/拓展欧几里得/exgcd.cpp | GB18030 | 470 | 3.390625 | 3 | [] | no_license | // չŷ㷨x,yʹax + by = gcd(a, b) (1)
// ŷԼĻϣ˳x, yֵ
// ֻΪһ(1)
// ax + by = dǷн⣬ȼdDzgcd(a,b)ı
// x, yʹax + by = gcd(a, b)
int exgcd(int a, int b, int &x, int &y)
{
if(!b)
{
x = 1, y = 0;
return a;
}
int d = exgcd(b, a % b, y, x);
y = y - (a / b) * x;
return d;
}
| true |
2b5c6a123468866270c6091510e46c2413f6e42b | C++ | TaeBeomShin/1day-1ps | /6. 구현(Simulation)/PGM_실패율.cpp | UHC | 1,025 | 3.03125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
/*
https://programmers.co.kr/learn/courses/30/lessons/42889
ؼ ؼ ȯϴ .
c++ compare ǿ.
*/
double arr[502]={0,};
bool compare(const pair<int,double> & a,const pair<int,double> &b){
if(a.second!=b.second)
return a.second>b.second;
else
return a.firs... | true |
befda229a5e88e71d29f233e23b87ad6463b1b15 | C++ | Cryrivers/SPA | /SPA/FollowsTest.cpp | UTF-8 | 6,064 | 3.28125 | 3 | [] | no_license | /*
* FollowsTest.cpp
*
* Created on: 30 Oct 2012
* Author: ray
*/
#include <iostream>
#include "Follows.h"
void printVector(vector<int> );
void f1()
{
Follows f;
//case 1a, should print false
vector<int> va;
vector<int> vb;
cout << f.follows(&va, &vb, 0) << endl;
f.addFollows(1, 2);
f.addFollows(... | true |
8fc975f6dfe7eabeb90ecc902616d7dae769f802 | C++ | shivam2146/Learning-C- | /templates_class.cpp | UTF-8 | 474 | 3.75 | 4 | [] | no_license | #include<iostream>
using namespace std;
template<class T,class U=char>
class test{
T mem1;
U mem2;
public:
test(T a,U b);
void display();
};
template<class T,class U>
test<T,U>::test(T a,U b){
mem1 = a;
mem2 = b;
}
template<class T,class U>
void test<T,U>::display(){
cout << "members are: " << mem1 << " "... | true |
dedd4b1eed6c5471530d1eac67277f09aafbf4a5 | C++ | alexeyprov/MyStuff | /CryptoSign/CryptCtx.h | UTF-8 | 1,327 | 2.828125 | 3 | [] | no_license | #pragma once
class CCryptoContext
{
public:
CCryptoContext()
{
m_pKey = NULL;
m_hProv = NULL;
if (!CryptAcquireContext(&m_hProv, NULL, NULL, PROV_RSA_FULL, 0))
{
throw CCryptoException(CCryptoException::fnAcquireContext);
}
m_pKey = new CKey(m_hProv, true);
m_pKey->CreateKey(_T("if you want to f$... | true |
0061f7d8110d5b2bf4c565fc17f2627aef7a0cbb | C++ | tallerify/app-server | /src/api/controllers/PlayController.h | UTF-8 | 1,212 | 2.625 | 3 | [] | no_license |
#ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_PLAYCONTROLLER_H
#define FIUBA_TALLER2_TALLERIFY_APP_SERVER_PLAYCONTROLLER_H
#include <regex>
#include "Controller.h"
#include "../networking/JSONResponse.h"
/**
* @file PlayController.h
*/
class PlayController : public Controller {
public:
/**
* Constructor
... | true |
2d3bc488e31bd4776f474d7740bf90048a59acba | C++ | GF2595/HW_First_Semester | /06.10/06.10 (3)/06.10 (3)/main.cpp | WINDOWS-1251 | 1,068 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
int main()
{
setlocale(LC_ALL, "rus");
ifstream file("../text.txt", ios::in);
if (!file.is_open())
{
cout << " " << endl;
return EXIT_FAILURE;
}
const int n = 50;
int numberOfStrings = 0;
... | true |
6c22e89a90a887c6d1376b6f85ab24d3132239b2 | C++ | DeepBlue14/rqt_ide | /modules/ide_old/src/MsgFileDat.cpp | UTF-8 | 1,700 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "MsgFileDat.h"
MsgFileDat::MsgFileDat()
{
//msgFileNameStrPtr = new QString();
msgFileHeaderStrPtr = new QString();
//msgFieldDatPtrVecPtr = new QVector<MsgFieldDat*>();
}
void MsgFileDat::setMsgFileNameStrPtr(QString msgFileNameStrPtr)
{
this->msgFileNameStrPtr = msgFileNameStrPtr;
}
... | true |
e08e2c9e459af2ada63db6c666092941e04e288c | C++ | wahidulalamriyad/Pharmacy_Management_System | /PCPP/Extra/Pharmacy-master/Users/Manager.cpp | UTF-8 | 20,064 | 2.515625 | 3 | [] | no_license | //
// Created by houss on 4/26/2017.
//
#include "Manager.hpp"
#include "../Headers/DBMS.hpp"
#include <iostream>
#include <sstream>
#include <algorithm>
using namespace std;
//Products
const std::string Manager::insertProduct = "INSERT_PRODUCT";
const std::string Manager::changeProductPriceByName = "CHANGE_PRODUCT_... | true |
79b1e7e781d5c02f1da8c327ca7b79b7642347b0 | C++ | MatthewASimonson/C-fundamentals | /Referencing Data/rd.cpp | UTF-8 | 616 | 3.375 | 3 | [] | no_license | /*
* rd.cpp
*
* Created on: Mar 3, 2010
* Author: Matthew Simonson
*/
# include <iostream>
using namespace std;
int main()
{
int num;
int& rnum=num;// At the address in memory of rnum, a value is stored, this value is num
rnum=400;
cout<<"Value direct: "<<num<<endl;
cout<<"Value via reference: "<<rnum... | true |
12c781dc3cc7165d241efaa72a0c486e6cc36f55 | C++ | AmitShmuel/FileSystem-June16 | /Folder.h | UTF-8 | 604 | 2.796875 | 3 | [] | no_license | #ifndef _FOLDER_
#define _FOLDER_
#include "FileComponent.h"
#include <list>
using namespace std;
class Folder : public FileComponent { // acts as the composite
// implements clone() as part of the prototype pattern
list<FileComponent*> files;
public:
Folder(string fileName = "new file") : FileComponen... | true |
c150c155dea2dfae39016c54c94f75490105cd9a | C++ | denys-hrulov/ToDOlist | /src/core/utils/data_transfer/TaskDTOConverter.h | UTF-8 | 955 | 2.75 | 3 | [] | no_license | //
// Created by denis on 03.08.20.
//
#ifndef TODOLIST_TASKDTOCONVERTER_H
#define TODOLIST_TASKDTOCONVERTER_H
#include "core/memory_model/api/RepositoryTaskDTO.h"
#include "core/memory_model/data/Task.h"
#include "core/memory_model/structure/TaskNode.h"
/*
* Class providing some conversions between Task, TaskNode,... | true |
b9418a9279eef9771f603f4c5b85900c144aa172 | C++ | msk4862/DS-Algo | /Practice/EulerProject/smallestMult.cpp | UTF-8 | 529 | 3.15625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int smallestMult(int n) {
long num = 2*n;
bool divisible = true;
while(true) {
divisible = true;
for (int i = 2; i <= n; i++)
{
if(num%i != 0) {
divisible = false;
break;
}
}... | true |
2b469817c10d156417aacc6b44647c33803a0660 | C++ | 18292677162/TextSimilarity | /TextSimilarity/TextSimilarity/test.cpp | UTF-8 | 2,301 | 2.515625 | 3 | [] | no_license | #include "TextSimilarity.h"
#include <fstream>
#include <cassert>
#include <string>
#include <Windows.h>
using namespace std;
//const char* const DICT_PATH = "jieba.dict.utf8";
//const char* const HMM_PATH = "hmm_model.utf8";
//const char* const USER_DICT_PATH = "user.dict.utf8";
//const char* const IDF_PATH = "idf.... | true |
1b4b7361da5993d121167f4e97b0308554dac494 | C++ | rodrigobmg/ECSE | /ECSETest/TestInputManager.cpp | UTF-8 | 13,413 | 3.140625 | 3 | [
"MIT"
] | permissive | #include "gtest/gtest.h"
#include "ECSE/InputManager.h"
class InputManagerTest : public ::testing::Test
{
public:
ECSE::InputManager manager;
InputManagerTest()
{
manager.setRequireFocus(false);
}
};
class InputManagerRunTest : public InputManagerTest
{
public:
InputManagerRunTest()
{... | true |
710e8e241739f9130f0de9be53591a9cf81aa2de | C++ | Akeepers/algorithm | /leetcode/240.cpp | UTF-8 | 549 | 3.0625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
bool searchMatrix(vector<vector<int>> &matrix, int target)
{
int m = matrix.size();
if (m == 0)
return false;
int n = matrix.front().size();
int i = 0, j = n - 1;
while (i < ... | true |
9229b49a4c18683578e0762fa6bf5da7e6ff52f3 | C++ | JeffLiuGar/gitPractice | /binaryGap/ConsoleApplication1/ConsoleApplication1.cpp | GB18030 | 3,479 | 2.84375 | 3 | [] | no_license | // ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include<iostream>
using namespace std;
//1
//2
//3 admended
//4
//2-5
//1-6
//2-7
//1-8
class Solution {
public:
bool judgeCircle(string moves) {
int x=0, y = 0;
for (int i = 0; i<moves.size... | true |
b01fb7fbfbd6a9886c0ce14eb9a8025b560f01a6 | C++ | kshitij86/code-examples | /prac/del_nHead.cpp | UTF-8 | 1,360 | 3.0625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> veci;
typedef vector<string> vecs;
typedef vector<long> vecl;
typedef vector<vector<int>> vecvi;
typedef vector<vector<string>> vecvs;
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
void print_arr(int ... | true |
efd891268e71384e616da7cd5d065410108a6954 | C++ | utkarshlath/Programs | /InterviewBit/Arrays/NextPermutation.cpp | UTF-8 | 549 | 2.953125 | 3 | [] | no_license | vector<int> Solution::nextPermutation(vector<int> &A) {
vector<int> ans = A;
sort(ans.begin(),ans.end(),greater<int>());
if(ans==A)
{
sort(A.begin(),A.end());
return A;
}
int n = A.size();
int index=-1;
for(int i=n-2;i>=0;i--){
if(A[i]<A[i+1]){
index=i... | true |
c2f40764e92288da61463639fd619ca19c9c365b | C++ | kuonanhong/UVa-2 | /437 - The Tower of Babylon.cpp | UTF-8 | 1,565 | 3.03125 | 3 | [] | no_license | /**
UVa 437 - The Tower of Babylon
by Rico Tiongson
Submitted: September 20, 2013
Accepted 0.015s C++
O(3n^2) time
*/
#include<iostream>
#include<cstring>
#include<vector>
#include<set>
#include<algorithm>
#define MX 35
using namespace std;
struct block{
private:
int x, y, z;
public:
int le... | true |
88e21ffb666a164e04cc2958750d0776f0cca3ca | C++ | jamesdorevski/CV | /CSCI251 (C++)/Assignment 3/Braille.cpp | UTF-8 | 551 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <map>
#include "Latin.h"
#include "Braille.h"
using namespace std;
map<string, char> Braille::brailleToLatinRules;
Braille::Braille(char _brailleBit) {
brailleBit = _brailleBit;
}
bool operator< (const Braille& lhs, const Braille& rhs) {
return lhs.brailleBit < rhs.br... | true |
ae506f353d32ef937a410dfa81a5c670c3b51836 | C++ | samuelassis/TPs-2020 | /Algoritmos1/TP2/graphCP.cpp | UTF-8 | 2,403 | 3.09375 | 3 | [] | no_license | #include "graph.h"
using namespace std;
Graph::Graph(int n){
this-> n_vertex = n;
this-> graph = new vector<Vertex>[n];
this-> tourist_values = new int [n];
}
void Graph::add_edge(int A,int B,int ec){
Vertex vA,vB;
int tv = tourist_values[A] + tourist_values[B];
vA.index = A;
vB.index = B;
vA.edge_cost = vB.e... | true |
03f6c078a7db398823583efc99e9b77ccc045488 | C++ | gakarak/UAV_Projects | /TrajectoryVisualizer/model/entities/trajectory.h | UTF-8 | 2,198 | 2.78125 | 3 | [] | no_license | #ifndef TRAJECTORY_H
#define TRAJECTORY_H
#include <vector>
#include <opencv2/features2d.hpp>
#include "map.h"
namespace modelpkg
{
struct Trajectory
{
Trajectory() {}
void pushBackFrame(const Map &frame);
void removeFrame(int frame_num);
void setFrameKeyPoints(int frame_num, const std::vector<cv::KeyPoint... | true |
64db358a40ed2aefaf3c3fbbf2b9bcc86b694725 | C++ | OscarShiang/QtChess | /button.cpp | UTF-8 | 1,154 | 2.75 | 3 | [] | no_license | #include "button.h"
#include <QPen>
#include <QBrush>
#include <QFont>
Button::Button(QString label_name, int width, int height, int size) : font_size(size) {
setAcceptHoverEvents(true);
rect = new QGraphicsRectItem();
rect->setRect(0, 0, width, height);
QPen pen;
pen.setColor(Qt::red);
pen.s... | true |
18b81a336f70bd0056c82f2db3f15963fbd1c727 | C++ | spiderxm/Competitive-Coding | /Kickstart/1.cpp | UTF-8 | 742 | 2.53125 | 3 | [] | no_license | //
// Created by Mrigank Anand on 19/04/20.
//
//shuru apni marzi se kiye the ab fhodne ka man kar raha hai
#include<iostream>
#include <maps>
#define ll long long
#define sq(a) (a)*(a)
#define endl "\n"
#define boost ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int main() {
//Hello world... | true |
3e0ac31c2d5d93be0b4f96574e8d90bed2b16d66 | C++ | xQQsHia/AyDA-B2018 | /week_1/homework_solution.cpp | UTF-8 | 755 | 2.984375 | 3 | [
"MIT"
] | permissive | # include <iostream>
# include <vector>
using namespace std;
using ull = unsigned long long int;
bool filter(int a)
{
return a > 9 and a < 27;
}
ull test_char(vector<ull> &v, int i, string s)
{
string conv;
conv = s[i - 2];
conv += s[i - 1];
if(filter(atoi(conv.c_str())))
return v[i - 2];
else
retur... | true |
6c589f3d578c71508ed2b0a77dc251a4ae367706 | C++ | mbachm/CarND-PID-Control-Project | /src/PID.cpp | UTF-8 | 2,184 | 2.9375 | 3 | [] | no_license | #include "PID.h"
#include <math.h>
#include <iostream>
using namespace std;
/*
* TODO: Complete the PID class.
*/
PID::PID() {}
PID::~PID() {}
void PID::Init(double Kp, double Ki, double Kd) {
p_error = 0.0;
i_error = 0.0;
d_error = 0.0;
p = {Kp, Ki, Kd};
dp = {0.2, 0.2, 0.2};
step_ = 0;
numb... | true |
aff7b4e0db79ee9d135e94a3ac230807e8baba00 | C++ | georgy-schukin/rage-rts | /src/Rage/expression.h | UTF-8 | 353 | 2.59375 | 3 | [] | no_license | #pragma once
#include "codeargs.h"
namespace rage {
class Expression
{
public:
enum Type
{
BINARY = 0,
UNARY,
DATA_ITEM,
CONST_ITEM
};
public:
virtual Type getType() const = 0;
virtual int evalInt(const CodeArgs &args) = 0;
virtual bool evalBoolean(const CodeArgs &args) = 0;
virtual string evalData(... | true |
4870ca9e3c1b5260657628306912cd7c038ff265 | C++ | abdarker/Divide-and-Concure | /Untitled2.cpp | UTF-8 | 939 | 3.484375 | 3 | [] | no_license | #include<bits/stdc++.h>
void DivnCon(int arr[],int i,int j,int& min,int& max)
{
if (i==j)
{
if (max<arr[i])
max=arr[i];
if (min>arr[j])
min=arr[j];
return;
}
if (j-i==1)
{
if (arr[i]<arr[j])
{
if (mi... | true |
034732ff20b388d7c1813c8d697d10a61c788bbf | C++ | soni-sachin/CP1_CIPHERSCHOOLS | /leetcode2/single no .cpp | UTF-8 | 245 | 2.890625 | 3 | [] | no_license | class Solution {
public:
int singleNumber(vector<int>& nums) {
if(nums.empty()) return 0;
int ptr = nums[0];
for(int i = 1; i<nums.size();i++) {
ptr = ptr ^ nums[i];
}
return ptr;
}
};
| true |
a52e65d660f8f4535af4b3fa409f6c2a8db4a60b | C++ | Robofever/AutoBot | /serial_comm/serial_comm.ino | UTF-8 | 812 | 2.890625 | 3 | [] | no_license | void setup(){
Serial.begin(9600); // same baud rate (bits per second) for proper serial communication
pinMode(LED_BUILTIN, OUTPUT); // LED built-in at digital pin 13 and ground pin besides it
}
// run the below command in pi terminal to list out all the ports with the beginning of "tty"
// ls /dev/tty*
/... | true |
aa6e45130eae99e86888930260c40f563146afc9 | C++ | BioroboticsLab/pipeline | /pipeline/util/opencv_fill_poly/lines_impl.h | UTF-8 | 1,389 | 2.96875 | 3 | [] | no_license | /*
* lines_impl.h
*
* Created on: Mar 2, 2015
* Author: tobias
*/
#ifndef LINES_IMPL_H_
#define LINES_IMPL_H_
namespace heyho {
template<typename F>
inline F hline(F f, no_boundaries_tag, int x_left, int x_right, int y)
{
for(; x_left <= x_right; ++x_left) {
f(cv::Point(x_left, y));
}
return s... | true |
e6922f662f9d26a8730585494d5016809c0945c6 | C++ | Marcel1804/comp3801 | /CollisionDetection.cpp | UTF-8 | 6,788 | 2.875 | 3 | [] | no_license | #include <stdio.h>
#define SENSOR_LIMIT 2.60 // maximum reading distance of sensor in meters
#define LEFT_SECTION 0
#define RIGHT_SECTION 1
#define FRONT_SECTION 2
#define BACK_SECTION 3
#define FpinBuzzer 5
#define BUZZER_PIN FpinBuzzer
// global variables
//previous times
unsigned long prevTime[4] = { 0 };
// pre... | true |
7b8fcaea8420a46b2c1482d9c3db1f29154d04a5 | C++ | zuhalpolat/hackerrank-algorithms-solutions | /WarmUp/Compare the Triplets.cpp | UTF-8 | 339 | 3.15625 | 3 | [] | no_license | // Complete the compareTriplets function below.
vector<int> compareTriplets(vector<int> a, vector<int> b) {
vector<int> sumOfArrays = { 0, 0 };
for (int i = 0; i < a.size(); i++) {
if (a[i] > b[i])
sumOfArrays[0]++;
else if (b[i] > a[i])
sumOfArrays[1]++;
}
re... | true |