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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
46608a352379dda9e04a17994526158072788e22 | C++ | apache/trafficserver | /plugins/esi/lib/Expression.h | UTF-8 | 3,255 | 2.78125 | 3 | [
"TCL",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"ISC",
"OpenSSL",
"MIT",
"HPND",
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"Licen... | permissive | /** @file
A brief file description
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you und... | true |
794db9a95ebf4f7b693043e541e2b7fa99c212f2 | C++ | Asa-to/c-prac | /atcoder/old/abc140c.cpp | UTF-8 | 348 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(void){
int n;
cin >> n;
vector<int> a(n-1);
int sum = 0;
for(int i = 0; i < n-1; i++){
cin >> a[i];
if( i == 0){
sum += a[i];
}else{
sum += min(a[i], a[i-1]);
}
}
cout << sum + a[n... | true |
59c32574b3015a20492b4fc1023c0b4bd88cd844 | C++ | HaozheGuAsh/Undergraduate | /Visual Studio/Projects/ECS165BPROJECT/ECS165BPROJECT/rewriter.cpp | UTF-8 | 8,645 | 2.5625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "stdlib.h"
#include <stdio.h>
#include "string.h"
#include <vector>
#include "errno.h"
#include "unistd.h"
#include "fcntl.h"
#include <inttypes.h>
#include "HW6-expr.h"
//#include "HW4-expression.h"
using namespace std;
#define OP_VAR 257
#define MAXRULES 100
exprnode *lhs[MAXRULES], *rh... | true |
79079cf31a9aa50ed1179fbe1a0d397b3009c096 | C++ | Mthomas3/Bomberman | /include/commons/IS/Map/Tile.hpp | UTF-8 | 1,388 | 2.65625 | 3 | [] | no_license | #pragma once
#include <cstdint>
#include <functional>
#include <iostream>
#include <utility>
#include <IS/Map/Map.hpp>
namespace IS
{
struct Map::Tile
{
Tile() : _type(None), _upos(0, 0), _init(nullptr) { throw std::exception(); }
Tile(TileType type, f_init const &init, insT *construtor)
: _typ... | true |
4701ed9f564d1c1b3fec15ffe5714ebfe5bcfd46 | C++ | qingswu/Transim | /Transims60/SysLib/Utility/Smooth_Data.cpp | UTF-8 | 9,032 | 2.921875 | 3 | [] | no_license | //*********************************************************
// Smooth_Data.cpp - data smoothing class
//*********************************************************
#include "Smooth_Data.hpp"
//---------------------------------------------------------
// Smooth_Data constructor
//--------------------------------... | true |
608d72ce6776d79f9c9113bec8d0b2ba097ee02e | C++ | arpitsangwan/Friendly-contests | /15 Fifteenth/72. Edit Distance.cpp | UTF-8 | 804 | 2.71875 | 3 | [] | no_license | //https://leetcode.com/problems/edit-distance/
class Solution {
public:
vector<vector<int>> dp;
string s,t;
int minop(int i,int j){
if(i==s.length()){return t.length()-j;}
if(j==t.length()){return s.length()-i;}
if(dp[i][j]!=-1){return dp[i][j];}
i... | true |
07365cbacdcccd65e89b617a4224317574475094 | C++ | alex-mitrevski/text_classifier | /include/PerceptronTrainer.hpp | UTF-8 | 1,050 | 2.6875 | 3 | [
"MIT"
] | permissive | #ifndef PERCEPTRON_TRAINER_HPP
#define PERCEPTRON_TRAINER_HPP
#include "FrequencyHashTable.hpp"
#include "WordHashTable.hpp"
#include <vector>
#include <string>
#include <fstream>
using std::vector;
using std::string;
using std::ofstream;
class PerceptronTrainer
{
public:
PerceptronTrainer(vector<string>, vector<str... | true |
3a6395aeec6c46ca2fae121b6327d4be15cb38e0 | C++ | karolbogdanski/uczelnia | /aisd/listy/1&2.cpp | UTF-8 | 674 | 3.65625 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct node{
int val;
node *next;
};
void push(node *&H, int x){
node *p = new node;
p->val = x;
p->next = H;
H = p;
}
void show(node *H){
node *p = H;
cout << "Head->";
while(p != NULL){
cout << p->val << "->";
p=p->next;
}
cout << "NULL" << endl ... | true |
71883117c70c1e3449c9ee4e293eb2a9abc7c322 | C++ | natural7/cpp-concurrent-test | /03/people/people.h | UTF-8 | 547 | 2.96875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <stdint.h>
using namespace std;
class people
{
public:
people(string name, uint32_t age):age(age),name(name)
{
cout<<"hello people"<<endl;
};
people(void);
~ people(void);
people(const people &p);
void set_age(uint32_t age)... | true |
a1ec5ac45c81b8ff4cda399dfa814ee58632fd4b | C++ | BossOfCreeps/NeuroHackathon-NSK-2019 | /Arduino/arduino_v1.ino | UTF-8 | 378 | 2.703125 | 3 | [] | no_license | #include <Servo.h>
Servo myservo;
void setup() {
Serial.begin(9600);
myservo.attach(9);
myservo.write(90);
}
void loop() {
if(Serial.available() > 0) {
char data = Serial.read();
char str[2];
str[0] = data;
if (data=='0')
myservo.write(100);
if (data=='1')
myservo.writ... | true |
d543a0f7dcfb261e1d1048cb952ed2c36048bc9f | C++ | wojcu/STLRaycast | /math/vec4.cpp | UTF-8 | 1,878 | 3.15625 | 3 | [] | no_license | #include "vec4.hpp"
#include <cmath>
vec4::vec4(double x, double y, double z, double w) {
m_components[0] = x;
m_components[1] = y;
m_components[2] = z;
m_components[3] = w;
}
vec4::vec4(const vec3 &v, double w) : vec4(v.at(0), v.at(1), v.at(2), w) {}
vec4::vec4(const vec2 &v, double z, double w) : ... | true |
a5f33dd89897e0ba25fecc3e112e1c2196c52dc0 | C++ | kohn/leetcode-sol | /HIndexII.cpp | UTF-8 | 1,110 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
void print(vector<int> &v){
for(auto i:v){
cout << i << " ";
}
cout << endl;
}
class Solution {
public:
// int hIndex(vector<int>& citations) {
// int h = 0;
... | true |
8763579b3a3a01d081aee433adf5b399203e4bcb | C++ | StevenChenZJU/myshell | /manual.cpp | UTF-8 | 5,148 | 3.171875 | 3 | [] | no_license | #include "manual.h"
using namespace std;
// raw string literal和unicode结合
// 前缀u8R
// 并且raw string 需要用括号()括起来
extern const string HELP =
u8R"(Myshell用户手册
基本介绍
Myshell是一个C++实现的简化版的shell,具备Linux操作系统用户接口的基本交互功能。Myshell类似于bash,支持内部指令,外部程序/指令调用,IO重定向(仅支持内部指令的输出重定向),文件作为命令行输入,管道操作以及**作业控制**。同时,Myshell还支持变量赋值,并且echo... | true |
c4e5450d91b93f3beb20567ff288ff229cb620fd | C++ | kaycbas/dslib_bastoul-master | /hw5/speedtest/plusonearraylist.h | UTF-8 | 446 | 3.109375 | 3 | [] | no_license | using namespace std;
template <class T>
class PlusOneArrayList : public ArrayList<T>
{
private:
T* temp;
public:
PlusOneArrayList();
bool resize ();
};
template <class T>
PlusOneArrayList<T>::PlusOneArrayList()
{
}
template <class T>
bool PlusOneArrayList<T>::resize()
{
int size = this->getSIZE();
T* te... | true |
80e2f90e846ab55ac27db2ec0ad22d480b716cb5 | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/33/127.c | UTF-8 | 540 | 2.546875 | 3 | [] | no_license | int main()
{
int n,i,j,k,m;
char str2[256]={0};
char str1[256];
cin>>n;
for(i=0;i<n;i++)
{
cin>>str1;
str2[255]=0;
for(j=0;j<255&&str1[j]!='\0';j++)
{
if(str1[j]==65)
{
str2[j]=84;
}
if(str1[j]==84)
{
str2[j]=65;
}
if(str1[j]==67)
{
str2[j]=71;
... | true |
feaceeafbe4d02cac9671d31a8e7e84943037e94 | C++ | parduman/lovebabbar450 | /C++/function/classForDiagonalMatrix.cpp | UTF-8 | 1,057 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
class Diagonal{
private:
int *A;
int n;
public:
Diagonal(){
this->n = 2;
A = new int[2];
}
Diagonal(int n){
(*this).n = n;
this->A = new int[n]... | true |
8f358091a27f3a7f0117eb06824ad56ffca5a37d | C++ | anmoldp7/SPOJ-List | /POCRI/pocri.cpp | UTF-8 | 696 | 2.9375 | 3 | [] | no_license | //A problem on Josephus Algorithm.
#include<bits/stdc++.h>
using namespace std;
int josephus(int n,int k){
if(n==1)
return 1;
else
return ((josephus(n-1,k)+k-1)%n+1);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int arr[101],n;
for(int i=0;i<13;i++)
... | true |
59d21e6f2ffef1d7de87f665e199df22ba800d43 | C++ | 8847870981/lab-4b | /CPP15.cpp | UTF-8 | 702 | 4.3125 | 4 | [] | no_license | #include <iostream>
using namespace std;
//C++ program to determine the maximum and minmum of all array elements using recursion.
void min_max(int numbers[],int c,int size,int min,int max)
{
if(c<size)
{
if(numbers[c]<min)
min=numbers[c];
if(numbers[c]>max)
max=numbers[c];
min_max(numbers,++c,size,min,m... | true |
0e338d647819ce8b86caa6acfef6ca983d26b8e9 | C++ | AdityaKarn/cp-cpp | /codechef/may 18/plus.cpp | UTF-8 | 676 | 2.90625 | 3 | [] | no_license | #include<iostream>
#include<climits>
using namespace std;
int main(){
int T; cin>>T;
for(int k = 0; k< T; k++){
int n, m, sum;
cin>>n>>m;
int arr[n][m];
for(int i = 0; i< n ; i++){
for(int j=0; j< m; j++){
cin>>arr[i][j];
}
}
... | true |
76da71abcb38cdd27003366dd5b4c9ea865a5710 | C++ | shossjer/fimbulwinter | /code/src/utility/lookup_table.hpp | UTF-8 | 4,345 | 3 | 3 | [
"ISC"
] | permissive |
#ifndef UTILITY_LOOKUP_TABLE_HPP
#define UTILITY_LOOKUP_TABLE_HPP
#include "concepts.hpp"
#include "type_traits.hpp"
#include <array>
#include <tuple>
namespace utility
{
namespace detail
{
template <typename Key, std::size_t N>
struct lookup_table_keys
{
std::array<Key, N> keys;
template <typename .... | true |
2c298af890cff761a778f6169378458beba24fec | C++ | DataYI/cplusplus | /OJ/acm.nyist.net/01语言入门/0025.cpp | UTF-8 | 563 | 2.984375 | 3 | [
"AFL-2.0"
] | permissive |
#include<iostream>
#include<string>
using namespace std;
string trans(string a) {
string b = "";
if (a[1] == '#') {
b += char((a[0] - 'A' + 1) % 7 + 'A');
b += 'b';
} else {
b += char((a[0] - 'A' + 6) % 7 + 'A');
b += '#';
}
return b;
}
int main() {
string a, ... | true |
454f5bfcd1cdabbab1c530e055c619c1c555bc96 | C++ | Sebanisu/tonberry | /D3D9CallbackSC2/ext/Engine/Simple Mesh/BaseMeshBounding.cpp | UTF-8 | 3,073 | 3.171875 | 3 | [
"MIT"
] | permissive | /*
BaseMeshBounding.cpp
Written by Matthew Fisher
BaseMesh is an abstract mesh class that defines basic mesh functionality. It also includes source for most
of the manipulation (shape generation, file loading, etc.) that is possible under this generic structure.
Each mesh must be associated with a graphics device bef... | true |
ccc7ba5a9d848cd7a0e1e505bef5421d96c37517 | C++ | a16620/P2PNet | /Utils.h | UTF-8 | 876 | 3.625 | 4 | [] | no_license | #pragma once
#include <atomic>
template <class K, class V>
class Minimum {
K initialKey;
V initialValue;
public:
Minimum(K&& key, V&& value) {
initialKey = move(key);
initialValue = move(value);
}
void Update(K&& key, V&& value) {
if (key < initialKey) {
initialKey = std::move(key);
... | true |
5b1d715afecf0e0d4a72a4077c94cbd590dfd4ee | C++ | kingkellingson/project-5-git | /IDAutomaton.h | UTF-8 | 2,349 | 3.265625 | 3 | [] | no_license | //
// Created by Kyle Ellingson on 5/5/21.
//
#ifndef PROJECT_0_IDAUTOMATON_H
#define PROJECT_0_IDAUTOMATON_H
#include "Automaton.h"
class IDAutomaton : public Automaton
{
private:
void S1(std::string& input);
public:
IDAutomaton() : Automaton(TokenType::ID) {} // Call the base constructor
void S0(std... | true |
a8c97e6c39af23bbad3ab4e5ab9c796ced157572 | C++ | matbot/Monster-Arena | /monsterArena/creatureStack.hpp | UTF-8 | 734 | 3.234375 | 3 | [] | no_license | /***********************************************
* *Author: Mathew McDade
* *Date: Sat Nov 19 20:48:37 PST 2016
* *Description: Stack-like, LIFO, class for
* storing pointers to Creature class objects.
* *********************************************/
#ifndef MMCD_CREATURESTACK_HPP
#define MMCD_CREATURESTACK_HPP
#... | true |
33f5235130d2177d5aa7d50fc9ee918f1095d69b | C++ | yifeng-pan/competitive_programming | /kattis/solutions/conundrum.cpp | UTF-8 | 255 | 2.546875 | 3 | [
"Unlicense"
] | permissive | /*
https://open.kattis.com/problems/conundrum
*/
#include <iostream>
int main() {
char p, e, r;
int sum = 0;
while(std::cin >> p >> e >> r){
if(p != 'P') sum += 1;
if(e != 'E') sum += 1;
if(r != 'R') sum += 1;
}
std::cout << sum;
return 0;
} | true |
70b71af431d73d1cebdd23660a1e6567733b7173 | C++ | Nurzhan011/acmp | /acmp 324.cpp | UTF-8 | 295 | 3.109375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a1 = n % 10;
int a2 = n / 10 % 10;
int a3 = n / 100 % 10;
int a4 = n / 1000 % 10;
if(a1==a4 && a2==a3)
cout << "YES";
else
cout << "NO";
}
| true |
0ef77c305af03005e79b685db1526382ec25641d | C++ | sanjaykazi/My-Random-Learnings | /Sorting/ExperimentaltimeAnalysis.cpp | UTF-8 | 1,817 | 3.140625 | 3 | [] | no_license | #include<iostream>
#include <sys/time.h>
using namespace std;
long getTimeInMicroSeconds(){
struct timeval currentTime;
gettimeofday(¤tTime, NULL);
return currentTime.tv_sec * (int)1e6 + currentTime.tv_usec;
}
void mergeArrays(int x[],int y[],int a[],int s,int e){
int mid = (s+e)/2;
int i=s;
... | true |
7a5dce7173ad78a78905dcf57c21163b6749f597 | C++ | Tandaradei/conrast | /src/render/Framebuffer.hpp | UTF-8 | 1,526 | 2.734375 | 3 | [] | no_license | #ifndef FRAMEBUFFER_HPP
#define FRAMEBUFFER_HPP
#include <vector>
#include "utils/Vec.hpp"
#include "color/Color.hpp"
namespace conrast { namespace render {
class Framebuffer
{
public:
Framebuffer(const utils::Vec2i size, const float near, const float far);
color::RGB8 getColor(utils::Vec2i position) const;
voi... | true |
e1525bf0b2a9c3a68692880f01fa78974edaf6ee | C++ | DanielRibble/RelationalDataBase | /Scheme.h | UTF-8 | 322 | 2.90625 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
using namespace std;
class Scheme: public vector<string>{
/*
private:
vector<string> name_list;
public:
Scheme (vector<string> name_list){
this->name_list = name_list;
}
~Scheme(){}
string at(unsigned pos){
return name_list[pos];
}
*/
... | true |
d1f8908514d20b50c5c9aaf7a29467f81e502462 | C++ | djh-sudo/Stone-Interpreter | /source/ASTList.h | GB18030 | 1,277 | 2.78125 | 3 | [] | no_license | #pragma once
#include "ASTree.h"
#include <ostream>
#include <string>
// ̳AST Ҷ
/*
ASTList [Base]
-> Postfix
-> ArrayLiteral
-> ParameterList
-> BinaryExpr
-> NegExpr
-> PrimaryExpr
-> BlockStmt
-> ClassBody
-> ClassStmt
-> DefStmt
-> IfStmt
-> WhileStmt
-> NullStmt
-> ForStmt
*/... | true |
edfc890c75a42bf6dbf3f72e614fafeb5e54862c | C++ | HekpoMaH/Olimpiads | /codeforces/round171/e.cpp | UTF-8 | 1,171 | 2.921875 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
string s;
int br0,br1;
string ff;
bool cmp(string x,string y)
{
if(x.size()>y.size())return true;
if(x.sise()<y.size())return false;
for(int i=0;i<x.size();i++)
{
if(x[i]<y[i])return true;
if(x[i]>y[i]) return false;
}
}
int su... | true |
7fe9648b9423696229ca7afad7b5fa78f3bd400f | C++ | Manan-jn/CoDing-Problems | /painters_problem.cpp | UTF-8 | 1,555 | 3.375 | 3 | [] | no_license | //Under Progress
#include <iostream>
using namespace std;
bool isPossible(int time, int painters, int boardsLength[], int sum, int n)
{
//need to check if it is possible to paint
//all the boards in "mid" amount of time
int boards = 0;
//will bring painters one by one
//will give them time and count... | true |
ac1e748dcddc2e7b932daf2ea6ddafffe24dbd35 | C++ | JulianLiao5/cpp_basics | /boost/connection/test_connection.cpp | UTF-8 | 824 | 2.9375 | 3 | [] | no_license | /*************************************************************************
> File Name: test_boost.cpp
> Author:
> Mail:
> Created Time: 2019年04月08日 星期一 15时04分52秒
************************************************************************/
#include <iostream>
using namespace std;
#includ... | true |
c3b43e274e6c5da6033ce3aef00a9c5ad1ac7422 | C++ | Yaamani/compression-algorithms | /my_tree.h | UTF-8 | 758 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <string>
#include <list>
//#define INITIAL_DICTIONARY_SIZE 65536 // total number of all chars a 'wchar_t' can hold
#define INITIAL_DICTIONARY_SIZE 166416 // wchar_t on mac and linux is 32bits not 16bits, so there're some chars > 65536 on my labtop
struct DictionaryTree;
struct Node
{
Dicti... | true |
b757fea78c45349217b7fc3e365e61346be74dfb | C++ | w18600843158/FPAnalysis | /src/fpUtil.cpp | UTF-8 | 8,210 | 2.9375 | 3 | [] | no_license | #include "fpUtil.h"
double fpUtil::i64ToDouble(uint64_t i) {
return *(double*)(&i);
}
uint64_t fpUtil::doubleToI64(double d) {
return *(uint64_t*)(&d);
}
float fpUtil::i32ToFloat(uint32_t i) {
return *(float*)(&i);
}
uint32_t fpUtil::floatToI32(float f) {
return *(uint32_t*)(&f);
}
uint64_t fpUtil:... | true |
f93ab54c49a25b1dba8034813d1b3e88ee2f026b | C++ | yvs314/dp-monster | /src/spinlock.h | UTF-8 | 470 | 2.90625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <thread>
class spinlock_t {
std::atomic_flag lock_flag;
public:
spinlock_t() { lock_flag.clear(); }
bool try_lock() { return !lock_flag.test_and_set(std::memory_order_acquire); }
void lock() { for (size_t i = 0; !try_lock(); ++i) if (i % 100 == 0) std::this_thread::yield(); }
... | true |
3e48e25e10c28965559ef489b88e2b2cfea80635 | C++ | zerg-ga/zerg | /UserOperators.cpp | UTF-8 | 1,841 | 2.640625 | 3 | [] | no_license | #include "UserOperators.h"
#include <iostream>
#include <stdlib.h>
using namespace std;
using namespace zerg;
UserOperators::UserOperators(int pop_size, int number_parameters)
:BasicOperators(pop_size, number_parameters)
{
// number_of_creation_methods = 6;
// tol_similarity = 1.0e-2;
}
UserOperators::~UserOperato... | true |
dc47d966dc920ffc77727ee7996f4d76df46a428 | C++ | raj075512/Coding-Questions | /Climbing_the_Leaderboard.cpp | UTF-8 | 1,691 | 4.03125 | 4 | [] | no_license | /*
Alice is playing an arcade game and wants to climb to the top of the leaderboard and wants to track her ranking.
The game uses Dense Ranking, so its leaderboard works like this:
The player with the highest score is ranked number on the leaderboard.
Players who have equal scores receive the same ranking numbe... | true |
ef6f0dcc04af26f65aa76f4da02357a5fc57cc10 | C++ | AbhishekChahar/Concept_Building_All | /5Searching-Sorting/Sorting/7_Merge.cpp | UTF-8 | 773 | 2.578125 | 3 | [] | no_license | // #include<bits/stdc++.h>
// using namespace std;
// int main(){
// int n,m;
// cin>>n>>m;
// int arr1[n];
// int arr2[m];
// for(int i =0 ; i< n ; i++){
// cin>>arr1[i];
// }
// for(int i =0 ; i< m ; i++){
// cin>>arr2[i];
// }
// int merge[n+m];
// int first=0, second=0;
// for(int i=... | true |
248ff4f6720b60f7038e1465cbf0172e71256c29 | C++ | RevealMind/itmo | /algorithms_and_data_structures/term_3/lab_3/a.cpp | UTF-8 | 1,144 | 2.859375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
std::string s;
using std::size_t;
using std::vector;
void solve() {
size_t k, a, b, c, d;
std::cin >> s >> k;
size_t n = s.size();
vector<long long> pow(n);
vector<long long> hash(n);
pow[0] = 1;
for (int i = 1; i < n; ++i) {
pow[i] = pow[i ... | true |
ca9acb920891b2803f37c1119d8b282008c7604e | C++ | ethankuehler/image_Maker | /image_maker/image_maker/Main.cpp | UTF-8 | 1,062 | 3.4375 | 3 | [
"BSD-3-Clause"
] | permissive | #include <iostream>
#include "easybmp.h"
#include <memory>
#include <functional>
const float PI = 3.14159265359;
const float DTOR = PI / 180;
std::unique_ptr<BMP> Make_Image(std::function<RGBApixel(int,int)> Func, int width, int hight);
int main(int argc, char* argv[]) {
auto func = [](int x, int y) -> RGBApixel {
... | true |
eea382c48672a4cb1b7b4b4617c9748e32f16949 | C++ | VanshikaSingh10/DataStructures-Algorithms | /Leetcode Daily Challenge/May-2021/07. Delete Operation for Two Strings.cpp | UTF-8 | 1,045 | 3.71875 | 4 | [
"MIT"
] | permissive | /*
Delete Operation for Two Strings
================================
Given two strings word1 and word2, return the minimum number of steps required to make word1 and word2 the same.
In one step, you can delete exactly one character in either string.
Example 1:
Input: word1 = "sea", word2 = "eat"
Output: 2
Explanatio... | true |
73ef7d37ee67190da727611e03963bad15b309b2 | C++ | PeterXUYAOHAI/basic_algo | /cpp/include/Stack_dynamic.h | UTF-8 | 657 | 3 | 3 | [] | no_license | //
// Created by XU YAOHAI on 4/2/2018.
//
// this stack uses dynamic memory to store references of the objects
#ifndef CPP_STACK_DYNAMIC_H
#define CPP_STACK_DYNAMIC_H
#include <cstdio>
template<typename T>
class Stack_dynamic{
public:
Stack_dynamic(size_t size); //constructor
Stack_dynamic(const Stack_d... | true |
7ce91c09fbc17f6e7ff53bff8b073e662a780392 | C++ | eitos/RTOS | /EiTOS/examples/mutexes.cpp | UTF-8 | 1,797 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #include <avr/io.h>
#include <util/delay.h>
#include <OS.hpp>
#include <avr/interrupt.h>
#include "../drivers/serial.hpp"
Serial serial;
mutex mutex1;
mutex serialMutex;
void Task1() {
static uint8_t count = 0;
while (1) {
serialMutex.take();
serial.printf("Test %d\r\n", count++);
se... | true |
996fcc3a27eec0f11d1ac26255caa2ece3d7a553 | C++ | svetthesaiyan/uni-projects-1st-year-2nd-trimester | /2021.02.19 Exercise 3/exercise_3.cpp | UTF-8 | 1,187 | 3.328125 | 3 | [] | no_license | // Да се сортира масив от 10 случайно генерирани цели числа в интервала от 0 до 100 във възходящ ред като се използва сортиране чрез вмъкване. Да се напишат функции за генериране на числата, извеждане на елементите на масива и за сортиране.
#include <iostream>
#include <ctime>
using namespace std;
void InsertionSort(in... | true |
8aab5d64da457d6022449da656604b0e2b12b262 | C++ | jagadeeshnelaturu/codeforces_solutions | /556A.cpp | UTF-8 | 287 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
int main() {
int n;
std::cin >> n;
int numOnes = 0, numZeros = 0;
char temp;
while(n--) {
std::cin >> temp;
if(temp == '0') ++numZeros;
else if(temp == '1') ++numOnes;
}
std::cout << std::abs(numOnes - numZeros) << '\n';
}
| true |
7b1f4de92bd37ce24d2f0d7d7d1fa77afb9191bd | C++ | jiangqn/algorithm_problems_and_templates | /problems_classified_by_sources/codeforces/Round#477(div2)/A/A.cpp | UTF-8 | 1,049 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int maxn = 1005;
struct Node{
int h, m;
}E[maxn], F[maxn];
int diff(const Node& a, const Node& b){
return (b.h * 60 + b.m) - (a.h * 60 + a.m);
}
Node inc(Node a, int b){
a.h += b / 60;
a.m += b % 60;... | true |
dda5eb7540b49b9696d9c8b5fb015b77253388df | C++ | asandler/mipt | /code/algorithms_oop/semester_4/06_bwt.cpp | UTF-8 | 2,636 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string bwt_encode(const string& source) {
int p[1000] = {0}, c[1000] = {0}, cnt[1000] = {0}, pn[1000], cn[1000], n = source.length() + 1, classes = 1;
string s = source + '~';
for (int i = 0; i < n; i++) {
cnt[s[i]]++;... | true |
af977980dcbb03a9ae7b5688fa4e10eb3dc06093 | C++ | demonsheart/C- | /rongyu/homework1/file/2017047011_1182_正确_439.cpp | UTF-8 | 596 | 2.90625 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#define N 100
using namespace std;
char *strAdd(char *s1, char *s2)
{
char *s3;
s3=new char[200];
int i,j;
i=j=0;
while(*(s1+j)!='\0')
{
s3[i]=s1[j];
j++;
i++;
}
j=0;
while(*(s2+j)!='\0')
{
s3[i]=s2[j];
j++;
i++;
}
return s3;
}
int main()
{
int ... | true |
1b48d625610882cac0441abe6edecb1af6fa367f | C++ | Meaha7/DSA-Marathon | /Graphs/component_detection.cpp | UTF-8 | 945 | 3.234375 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int get_comp(vector<vector<int>>&adjlst, int visited[], int curr)
{
if(visited[curr])
return 0;
visited[curr]=1;
int ans=1;
for(auto i : adjlst[curr])
{
if(visited[i]==0)
{
ans+=get_co... | true |
0d1fa1e9839cdd7b31bfc550f54554d796247f48 | C++ | AmrARaouf/algorithm-detection | /graph-source-code/416-E/7359875.cpp | UTF-8 | 2,261 | 2.765625 | 3 | [
"MIT"
] | permissive | //Language: GNU C++0x
#include <iostream>
#include <vector>
int IntMaxVal = (int) 1e20;
#define minimize(a, b) { a = min(a, b); }
using namespace std;
template <typename T> vector<T> readVector(int n) { vector<T> res(n); for (int i = 0 ; i < n ; i++) cin >> res[i]; return res; }
const int MAXN = 500;
... | true |
c39484ce8aeaed59d99d5ef7b23a061d11c65528 | C++ | staddy/IntelligentDesign | /entitycontainer.h | UTF-8 | 672 | 2.6875 | 3 | [] | no_license | #ifndef ENTITYCONTAINER_H
#define ENTITYCONTAINER_H
#include <memory>
#include <functional>
#include "entity.h"
namespace evol {
class EntityContainer {
public:
EntityContainer() = default;
virtual ~EntityContainer() = default;
virtual void clear() = 0;
virtual bool emplace(std::shared_ptr<Entity>&&... | true |
2a9ca3d12736d272e8fb02f2a6a53b4ea0fd80a9 | C++ | songxinjianqwe/CppPrimerCode | /Charpter16/src/600templateParameterInference.cpp | GB18030 | 17,631 | 3.734375 | 4 | [] | no_license | /*
* 600templateParameterInference.cpp
*
* Created on: 2016929
* Author: songx
*/
#include <iostream>
#include <string>
#include <type_traits>
using namespace std;
//ģʵƶ
//ںģ壬õеĺʵȷģӺʵȷģʵεḺ́Ϊģʵƶϡ
//ģʵƶϹУʹúеʵѰģʵΣЩģʵɵĺ汾ĺΪƥ
//
//תģͲ
//
//ֻкļתԶӦЩʵΡͨǶʵνתһµģʵ
//constᱻ
//תУڵӦںģİ
//constת:constתconstáָ룩
//ָתתΪԪ... | true |
c2d02b2cb8eff86f4d6c24fdf29db9cd0b2d36b7 | C++ | DarkMaguz/rpr01 | /rpr01/src/direct_io_test.cpp | UTF-8 | 3,126 | 2.6875 | 3 | [
"FSFAP"
] | permissive | /*
* direct_io_test.cpp
*
* Created on: 05/12/2015
* Author: magnus
*/
//
// How to access GPIO registers from C-code on the Raspberry-Pi
// Example program
// 15-January-2012
// Dom and Gert
// Revised: 15-Feb-2013
#define PI_VERSION 2
// Access from ARM Running Linux
#if PI_VERSION == 1
#define BCM... | true |
488f0fce9a311770b8f8896c3fd48787804321dc | C++ | mkuthan/example-arduino | /DigitalReadSerial/DigitalReadSerial.ino | UTF-8 | 274 | 2.671875 | 3 | [] | no_license | int pushButton = 2;
int led = 13;
void setup() {
Serial.begin(9600);
pinMode(pushButton, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
int buttonState = digitalRead(pushButton);
int ledState = (buttonState == 1) ? HIGH : LOW;
digitalWrite(led, ledState);
}
| true |
e49c1fc2f13ec2c5c29cbf946a217dab741e5319 | C++ | RocketfarmAS/iot-examples | /vibration/vibration.ino | UTF-8 | 672 | 2.84375 | 3 | [] | no_license |
const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 400; // threshold value to decide when the detected sound is a knock or not
int sensorReading = 0; // variable to store the value read from the sensor pin
int ledState = LOW; // variable used to store the last L... | true |
db89414205953d48eb7cf585fc6971f5b62b80ed | C++ | se-prashant/Data-Structures-And-Algorithms | /Maths And Array/13_SearchIn2DMatrix.cpp | UTF-8 | 548 | 2.9375 | 3 | [] | no_license | class Solution {
public:
bool searchMatrix(vector<vector<int>>& mat, int target) {
int N = mat.size();
int M = mat[0].size();
int s = 0;
int e = (N*M)-1;
while(s<=e){
int mid = (s+e)/2;
int row = mid/M;
int col = mid%M;
if(mat[r... | true |
75233b5f9fb8bd7f0a1df2c78514cc292e777d1b | C++ | mayankagg9722/Placement-Preparation | /leetcode/bottomLeftMostTree.cpp | UTF-8 | 1,159 | 3.5625 | 4 | [] | no_license | /**
513. Find Bottom Left Tree Value
Given a binary tree, find the leftmost value in the last row of the tree.
Example 1:
Input:
2
/ \
1 3
Output:
1
Example 2:
Input:
1
/ \
2 3
/ / \
4 5 6
/
7
Output:
7
Note: You may assume the tree (i.e., the given r... | true |
8e021389f91e220b9753243de8f8f60211ebb8d3 | C++ | yolunghiu/algo_code | /nowcoder/class5/10_NodeNumber.cpp | UTF-8 | 1,376 | 3.71875 | 4 | [] | no_license | #include <iostream>
#include <BinaryTreeUtils.h>
#include <cmath>
using namespace std;
// 已知一棵完全二叉树, 求其节点个数, 要求时间复杂度低于O(n)
int getHeight(Node *root)
{
int height = 0;
Node *p = root;
while (p != nullptr)
{
height++;
p = p->left;
}
return height;
}
int getNodeNumber(Node *roo... | true |
ba6885a7072e76b421045ce59f4c15dc8e3f3d33 | C++ | rezwanh001/Image-Processing-using-Opencv-in-Cpp | /(09,10)Min_Max_Filter.cpp | UTF-8 | 1,391 | 2.890625 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
/*
(09,10)Min_Max_Filter.cpp
*/
int main(int argc, char const *argv[])
{
Mat img = imread("blurry_moon.tif", CV_LOAD_IMAGE_G... | true |
ed751fcd89bb3e70def89e4be0b2455a113880b5 | C++ | sivikt/memoria | /include/memoria/core/packed/sseq/small_symbols_buffer.hpp | UTF-8 | 4,213 | 2.546875 | 3 | [
"BSD-3-Clause",
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive |
// Copyright 2015 Victor Smirnov
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... | true |
805e42629b5f5d356395d7aba7ac71acc5ea3175 | C++ | charitha22/workspace | /kd_tree/main.cpp | UTF-8 | 1,464 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include "kd_tree.h"
int main(int, char**) {
srand (time(NULL));
// generate a set of 2d points
std::cout << "generate a set of points :" << std::endl;
std::vector<point<int,2>> points_2d;
generate_points<2>(points_2d,5);
std::for_each(points_2d.begin(), points_2d.end... | true |
813372ee5f1ebe42cecef3a27ca2af63748541ba | C++ | kerozou/kyopuro | /Atcoder解答/ARC解答/ARC002 C - コマンド入力.cpp | UTF-8 | 1,613 | 2.875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second... | true |
7782244a935e71dee20a7808bd2e1498b641face | C++ | zee7985/LeetCode | /DP/416. Partition Equal Subset Sum.cpp | UTF-8 | 1,332 | 3.359375 | 3 | [] | no_license | 416. Partition Equal Subset Sum
Medium
Given a non-empty array nums containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.
Example 1:
Input: nums = [1,5,11,5]
Output: true
Explanation: The array can be partitioned as [1, 5, 5]... | true |
8201e1407333232fbe9d93b034b4ffd1360666aa | C++ | fjand5/arduino-tutorial | /struct_code/main/rtc.ino | UTF-8 | 747 | 2.53125 | 3 | [] | no_license |
// ============================== rtc.ino ==================================================
#include <Wire.h>
#include <RTC.h>
static DS1307 RTC;
void setupRTC() {
RTC.begin();
RTC.startClock();
}
String cvt2num(int num){
return num<10?String("0")+num:String(num);
}
String getDays(){
String day = cvt2num(RTC... | true |
886d4bfc51cfb9d1ea92341ec4285f48f1935a25 | C++ | Ewenwan/ZJU_PAT | /Advanced_Level/1042. Shuffling Machine (20).cpp | UTF-8 | 869 | 3.203125 | 3 | [] | no_license | #include<iostream>
using namespace std;
const int M = 54;
/*
题意:按照给定交换规则排序。基础逻辑题
思路:比较简单,用两个数组a,b
a存储交换前的,b存储交换后的。
*/
int main(void)
{
freopen("in.txt", "r", stdin);
int a[M], b[M], ord[M];
int n;
char ch[5] = { 'S', 'H', 'C', 'D', 'J' };//为了便于输出
cin >> n;
for (int i = 0; i < M; i++)//初始化
a[i] = i;
for (int ... | true |
d7556127bd7ed37568e21487ff8516200e4820fe | C++ | Ferrari95/AI-Lab | /homework1/src/min_distance.cpp | UTF-8 | 1,069 | 2.5625 | 3 | [] | no_license | #include "ros/ros.h"
#include "stdlib.h"
#include "string.h"
#include "std_msgs/String.h"
#include "sensor_msgs/LaserScan.h"
typedef const boost::function < void(const sensor_msgs::LaserScan::ConstPtr&) > callback;
class minimumClass {
public:
ros::Publisher pub;
void minimum(const sensor_msgs::LaserScan::ConstP... | true |
98feb999f598c1b0177ed82035672a83c7e4b2b6 | C++ | rahul2412/C_plus_plus | /exceptcalc.cpp | UTF-8 | 337 | 2.96875 | 3 | [] | no_license | #include<iostream>
using namespace std;
main()
{ int a,b;
cin>>a>>b;
int i;
cout<<"choose operation";
cin>>i;
switch(i)
{case 1:
cout<<a+b;
break;
case 2:
cout<<a-b;
break;
case 3:
cout<<a*b;
break;
case 4:
try{
if(b==0)
throw "error as b=0";
else
cout<<a/b;
}
catch(const char *msg)
... | true |
af34fa50c5e8b87579b76831426a7ca2fa45bff0 | C++ | CIEProject/Electric-Circuit | /Actions/ActionAddGround.cpp | UTF-8 | 1,359 | 2.578125 | 3 | [] | no_license | #include "ActionAddGround.h"
#include "..\ApplicationManager.h"
#include "..\UI\UI.h"
ActionAddGround::ActionAddGround(ApplicationManager* pApp) :Action(pApp)
{
}
ActionAddGround::~ActionAddGround(void)
{
}
void ActionAddGround::Execute()
{
//Get a Pointer to the user Interfaces
UI* pUI = pManager->GetUI();
//Pr... | true |
9056931e5527ad7e9e8012d42875c68f4b29518c | C++ | kimxyz/cocos2dx-dev | /MagicalTree/Classes/PlayerGround.cpp | UHC | 9,174 | 2.578125 | 3 | [] | no_license | #include "PlayerGround.h"
#include "Player.h"
#include "PlayerFSM.h"
#include "GameLayer.h"
PlayerGround::PlayerGround(Player* pPlayer)
: PlayerState(pPlayer, PLAYER_GROUND)
{
m_dir = 0;
}
PlayerGround::~PlayerGround()
{
}
bool PlayerGround::IsValidGroundPos(CCPoint pos)
{
Player* pOwner = GetOw... | true |
1ac732330e1a74850493f4b80a578fc767738be1 | C++ | kaushikacharya/binarysearch | /src/tree_with_distinct_parities.cpp | UTF-8 | 1,285 | 3.5 | 4 | [] | no_license | /**
* https://binarysearch.com/problems/Tree-with-Distinct-Parities
* Dec 27, 2020
*/
#include <tree_with_distinct_parities.hpp>
using namespace std;
int solve(Tree* root) {
if (root == nullptr){
return 0;
}
pair<int, int> result = compute_parities(root);
return result.second;
}
pair<int, i... | true |
63d0a3a6bad85b66ac5a0368d1cba5f3e2e3bd7b | C++ | zie87/sdl2_cxx | /src/test/detail/type_traits_test.cxx | UTF-8 | 1,237 | 2.859375 | 3 | [] | no_license | /**
* @file type_traits_test.cxx
* @Author: zie87
* @Date: 2017-10-09 20:21:14
* @Last Modified by: zie87
* @Last Modified time: 2017-10-18 22:08:51
*
**/
#include <sdl2_cxx/detail/type_traits.hxx>
#include <catch.hpp>
enum class enum_test_a : unsigned char
{
zero =0b00000000,
one =0b00000001,
... | true |
5354ef073602c93ce0f1f8b80b43bad20bd34799 | C++ | hamko/sample | /wu_method/poly.cpp | UTF-8 | 7,904 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <assert.h>
#include <string>
#include <limits.h>
#include <vector>
#include "poly.hpp"
#include "util.hpp"
#include <stdio.h>
using namespace std;
/* Poly */
void Poly::addMonoPoly(const MonoPoly* mono)
{
MonoPoly tmp = *mono;
m_func.push_back(tmp);
}
void Po... | true |
d78ed0e275304e6ee8fc173dfbdb8c8fc1f84758 | C++ | sayanel/luminolGL | /src/lights/Light.cpp | UTF-8 | 10,022 | 2.546875 | 3 | [] | no_license |
#include "lights/Light.hpp"
#define DEBUG 0
namespace Light{
LightHandler::LightHandler(){
}
void LightHandler::addPointLight(glm::vec3 pos, glm::vec3 color, float intensity, float attenuation, PointLightBehavior type, int lastChangeDir, float multVelocity){
_pointLights.push_back(PointLight(pos,color,inte... | true |
2764d95675ac869a5e9a727e0525608808b2218d | C++ | AlexMaz99/WDI | /lab9,10/zad24'.cpp | UTF-8 | 1,971 | 3.9375 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct node {
int w;
node *next;
};
// with guard
//1 2 5 8 9
//9 2 12 7 1
int remove(node *&first, node *&second) {
if (first == NULL || second == NULL) return 0;
node *f = new node;
f->next = first;
first = f;
node *s = new node;
s->next = ... | true |
aa7496252c456f94a6eebdbc027b27fe95a003b1 | C++ | dhruv7294/DataStructure | /DFS/Search_Sorting/Programs/MERGESOR.CPP | UTF-8 | 772 | 2.890625 | 3 | [] | no_license |
#include<iostream.h>
#include<conio.h>
#define SIZE 20
void main()
{
int A[SIZE],B[SIZE],C[SIZE];
int i,j,k,n1,n2,n3;
clrscr();
cout<<"\n\tEnter n for Array A :-->";
cin>>n1;
for(i=0;i<n1;i++)
{
cout<<"Enter No "<<i+1<<":-->";
cin>>A[i];
}
cout<<"\n\tEnter n for Array B :-->";
cin>>n2;
... | true |
977b1d268074d46d5130a2317003caca13aa8c64 | C++ | Nagan0/vision | /task4/task4_2/sobel.cpp | UTF-8 | 2,234 | 2.671875 | 3 | [] | no_license | #include <opencv2/opencv.hpp>
#include <iostream>
#include <fstream>
using namespace std;
using namespace cv;
int main(int argc, const char* argv[])
{
double gain = 0.2;
int offset = 127;
int kernel_size = 3;
double kernel[2][3][3] = {
{ {-2, -4, -2},
{0, 0, 0},
{2, 4, 2}},
{ {-2, 0, 2}... | true |
9059a8fb417880326666ed1983f4370e85a455ba | C++ | mophy1109/code_learning | /prim.cpp | UTF-8 | 323 | 3.25 | 3 | [] | no_license | //分解质因数算法
#include <iostream>
using namespace std;
void prim(int m, int n = 2)
{
if (m >= n) {
while (m % n)
n++;
m /= n;
prim(m, n);
cout << n << endl;
}
}
int main(int argc, char const *argv[])
{
int m;
cin >> m;
prim(m,3);
return 0;
}
| true |
c8b0e137ef18d692d7b5955f0bcb4e0b08cb84ac | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/41/657.c | UTF-8 | 829 | 3.3125 | 3 | [] | no_license | /*
* 4.cpp
*
* Created on: 2012-11-9
* Author: AK
*/
int main(){
int a,b,c,d,e;
for(a=1;a<=5;a++)
for(b=1;b<=5;b++)
{
if(a==b) continue;
for(c=1;c<=5;c++)
{
if(c==a||c==b) continue;
for(d=1;d<=5;d++)
{
if(d==a||d==b||d==c) continue;
for(e=1;e<=5;e++)
... | true |
33351e92ed61689e4a9f75cd8f57998b46fa877c | C++ | leehn5/The_Final-Station | /FadeInAndOut.h | WINDOWS-1252 | 767 | 2.828125 | 3 | [] | no_license | #pragma once
class FadeInAndOut
{
private:
float alpha;
Callback_Function_Parameter _cbFP;
bool isStart;
bool isFadeInEnd;
bool isFadeOutEnd;
private:
static void FadeIn(void* obj);
static void FadeOut(void* obj);
public:
FadeInAndOut()
: alpha(0.f), isStart(false), isFadeInEnd(false), isFadeOutEnd(false... | true |
b2b62c4ea170d22185acb3da23b996da8cffa590 | C++ | n-inja/kyoupro | /src/other/scr1h.cpp | UTF-8 | 1,589 | 2.953125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>
const long long PRIME = 1000000007;
using namespace std;
struct segtree {
int N, dat[800001];
segtree() {}
segtree(... | true |
47b55975af282eec3425aa590da5bb69875ae137 | C++ | vastus/chanchan | /test/chanchan_test.cpp | UTF-8 | 1,338 | 3.015625 | 3 | [] | no_license | #include "chanchan/chanchan.h"
#include <assert.h>
#include <iostream>
#include <memory>
#include <optional>
#include <type_traits>
namespace chan = chanchan;
using namespace std;
template <int I = 0, typename T, typename F>
constexpr void for_each(const T& t, F f) {
if constexpr (I < tuple_size<T>::value) {
f(... | true |
57901f0671676203c1e93504472d389602fa0e92 | C++ | SEDS/mangrove-catalog | /alloc-using-property/alloc-using-property.cpp | UTF-8 | 695 | 2.5625 | 3 | [] | no_license | // Juliet CWE680_Integer_Overflow_to_Buffer_Overflow__new_listen_socket_84_goodG2B.cpp
// Structure: alloc-using-property
#include "alloc-using-property.h"
#include <stdio.h>
AllocUsingProperty::AllocUsingProperty()
{
data = 20;
}
AllocUsingProperty::~AllocUsingProperty()
{
int i;
size_t da... | true |
c77838e1d1c7ad43bbb5e699948d89a8e5fc8726 | C++ | Adityasharma15/Agorithms | /DigitsinFactorial.cpp | UTF-8 | 259 | 2.703125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n;
cout << "Enter no to find digits in factorial of" << endl;
cin >> n;
long long int fac = 1;
for(int i=1;i<=n;i++)
{
fac*=i;
}
cout << floor(log10(fac)) + 1 << endl;
}
| true |
bd2fb69f6f7428a328b8c9ab53425510f622355a | C++ | wartech0/ablative | /AblativeGL/Icosphere.h | UTF-8 | 815 | 2.75 | 3 | [
"MIT"
] | permissive | #ifndef ICOSPHERE_H
#define ICOSPHERE_H
#include <vector>
#include <map>
#include <math.h>
#include <stdint.h>
#include <glm\glm.hpp>
struct Indices
{
int v1;
int v2;
int v3;
Indices(int v1, int v2, int v3)
{
this->v1 = v1;
this->v2 = v2;
this->v3 = v3;
}
};
class Icosphere
{
public:
Icosphere(int iter... | true |
3cb698f7fbf85082bf46bf6a7e57e8212cb3f6ec | C++ | LuisJorgeLozano/CodeforcesSoluciones | /A. Hulk - Problem 705A/main.cpp | UTF-8 | 821 | 3.40625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int a;
string firstWord = "I hate ";
string secondWord = "I love ";
string stringResult = "";
bool flag = true;
cin >> a;
for(int i=0; i < a; i++){
if(i != a-1){
if(flag){
stringResult = stringRe... | true |
b0e85b85bec717ebd0c6524ad4ea385e92694be0 | C++ | gerard-geer/Tile2D | /src/Framebuffer.cpp | UTF-8 | 4,860 | 2.78125 | 3 | [] | no_license | #include "Framebuffer.h"
Framebuffer::Framebuffer()
{
this->width = 0;
this->height = 0;
this->framebuffer = 0;
this->renderbuffer = 0;
this->depthbuffer = 0;
}
Framebuffer::~Framebuffer()
{
}
const char * getFramebufferError(GLenum e)
{
switch(e)
{
case GL_FRAMEBUFFER_UNDEFINED :... | true |
82e55cf4a915c383fbeaf2727c0e784bf532333b | C++ | harleenp/MyTunes-Library | /UI.cpp | UTF-8 | 433 | 3.015625 | 3 | [] | no_license |
#include <iostream>
#include <iomanip>
#include <string>
#include "UI.h"
#include <vector>
using namespace std;
void UI::promptForStr(string prompt, string& str)
{
cout << prompt << ": ";
getline(cin, str);
}
void UI::printMessage(string message)
{
cout << message << endl;
}
void UI::printParsedCommand(ve... | true |
a82f18f5a12bcb1b536c7991420589de52cb5400 | C++ | BiermanM/Data-Structures-Projects | /Project 2/HW 3.cpp | UTF-8 | 19,611 | 3.6875 | 4 | [] | no_license | /*
Assignment: Homework #3
Author: Matthew Bierman
Course: CS 3345.502 (Data Structures and Introduction to Algorithmic Analysis)
Instructor: Professor Kamran Khan
Date Due: October 8, 2017 at 11:30pm
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#inclu... | true |
5bcc94eea28e9e4568727d863d98f45c0cc42220 | C++ | ivon99/Raster_Graphics_Project | /Pixel.cpp | UTF-8 | 1,090 | 3.5625 | 4 | [] | no_license | #include "Pixel.hpp"
#include <iostream>
using namespace std;
Pixel::Pixel(unsigned char R,unsigned char G,unsigned char B)
{
m_R=R;
m_G=G;
m_B=B;
}
Pixel& Pixel::operator=(const Pixel& other)
{
m_R=other.m_R;
m_G = other.m_G;
m_B= other.m_B;
return *this;
}
bool Pixel::isWhite() const
{
if((m_R==255... | true |
9deeeccdec6f61b47309304ce1a459d53bba655d | C++ | mugisaku/liboat | /gramk/gramk_painter.hpp | UTF-8 | 2,120 | 2.59375 | 3 | [] | no_license | #ifndef GRAMK_PAINTER_HPP_INCLUDED
#define GRAMK_PAINTER_HPP_INCLUDED
#include"oat.hpp"
#include"gramk_card.hpp"
constexpr int number_of_colors = 8;
constexpr oat::Color
palette[number_of_colors] =
{
oat::Color(0x1F),
oat::Color(0x3F),
oat::Color(0x5F),
oat::Color(0x7F),
oat::Color(0x9F),
oat::Colo... | true |
7425f93c72176ee074bf4cd510ed275e2593de91 | C++ | jw2528783/WatermanJustin_CSC5_40717 | /Hmwk/Assignment2-3/Gaddis_7thEd_Chap3_Prob19/main.cpp | UTF-8 | 1,628 | 3.65625 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Justin Waterman
* Created on January 14, 2015, 8:14 AM
* Purpose: Problem 19 How Many Pizzas?
* Number of pizzas needed for a party.
*/
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
const float PI=3.14159; //the value for Pi.
int... | true |
caa51f1e35a92a1ebab47ecad956fc7b2d669244 | C++ | AlbertBartalis/Covid-Vaccination-Schedule | /Proiect final/main.cpp | UTF-8 | 1,436 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include "queue.h"
#include "utils.h"
using namespace std;
pr_queue persoane;
void loadDatabase() {
ifstream in("input.txt");
while (!in.eof())
{
string n;
int a;
int s;
string c;
in >> n;
if (n.empty()) {
... | true |
31ccaa8ef8e98b175c894f42cf01b55a7aeb785b | C++ | AmefuriTell/NN-GA | /GA/Individual.cpp | UTF-8 | 1,643 | 3.15625 | 3 | [] | no_license | #include "Individual.hpp"
#include "my_random.hpp"
//流用する際書き換えるポイント
/*
1. 染色体の型
2. 染色体の初期値
3. 染色体の突然変異
4. 評価値計算
*/
//コンストラクタ
Individual::Individual()
{
init(1000, 1000, 1, 1000, 0.1);
}
Individual::Individual(int gen_max, int pop_size, int elite, int chromo_size, long double mutate_prob)
{
init(gen_max, pop_s... | true |
b336bac67e5ed8e9430a9c02a2053d0358b6e416 | C++ | hannachoi24/Data_Structure | /Week7_List/includes/LineHnSLinkedList.h | UTF-8 | 3,719 | 4.09375 | 4 | [] | no_license | #pragma once
#include <iostream>
#include <string>
class line
{
protected:
std::string data;
public:
line(std::string line = "") { data = line; }
void read(std::istream *is = &std::cin)
{
std::getline(*is, data); // 한 줄씩 받음
}
void display(std::ostream *os = &std::cout)
{
... | true |
a3338f230602f57fe1fe085acef7ae47bc6e1fd4 | C++ | KowalskiThomas/SemiNumericalAlgorithms | /cpp_large_integer_factorising/kroot.cpp | UTF-8 | 1,757 | 2.875 | 3 | [] | no_license | #include"kroot.h"
size_t get_size(const entier x)
{
return std::abs(x.get_mpz_t()->_mp_size);
}
entier power(entier a, int k)
{
if (k == 0)
return entier(1);
else if (k == 1)
return entier(a);
else if (k%2==0)
return power(a, k/2)* power(a,k/2);
else
return power(a, k/2) * power(a,k/2) *... | true |
4a18cf259f1a40c3d9d60800d16d658f815fe5ab | C++ | RyanParker196/Zombie_Survival | /background.h | UTF-8 | 937 | 2.65625 | 3 | [] | no_license | //
// Created by Harry Makovsky on 5/2/19.
//
/*
This class is used ot create the city backgrouond city for the entire game. This class
also moves the background left to right as the man character moves away fromt the
zombies.
Constructor;
Background();
Method that draw the road, and the buildings
void draw();
... | true |
090fca3b7c9b45d5864da06cde23e650adb7dff5 | C++ | teotwaki/latency-testruino | /latency-testruino.ino | UTF-8 | 3,745 | 2.515625 | 3 | [] | no_license | #include <LiquidCrystal.h>
#include <util/atomic.h>
#include "pin_config.hpp"
#include "config.hpp"
#include "typedefs.hpp"
#include "pressbutton.hpp"
#include "display.hpp"
#include "latencytest.hpp"
// Variables
TestResult test_result;
Display display(&test_result);
LatencyTest latency_test(&test_result);
PressButto... | true |
c718215754df56bd8b3cb685c809feae8aeb9378 | C++ | luciedtigerhart/irrBoardGameEngine | /primevalion/PrimePlayState.cpp | UTF-8 | 103,101 | 2.71875 | 3 | [] | no_license | #include "PrimePlayState.h"
PrimePlayState::PrimePlayState() {};
PrimePlayState::~PrimePlayState() {};
void PrimePlayState::AgentACT(int ordering, IrrToken* token, IrrBoard* board)
{
//Set up animation
SetupAnimationAI(token, board, agent.move);
//Complete movement
if (ordering == 1) firstTokenMovedAI... | true |