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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ae00007e70820a787eb32fc8cbfd7e01bb43f430 | C++ | zeroch/Planning | /src/main/mainwindow.cpp | UTF-8 | 4,385 | 2.609375 | 3 | [] | no_license | #include "mainwindow.h"
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QWidget *widget = new QWidget();
QVBoxLayout *m_mainLayout = new QVBoxLayout;
setWindowTitle(tr("GTRI"));
creatList();
creatDisplay();
creatButtonGroup();... | true |
b979b2b7c53d12212653c1d3e94df50290bf40b7 | C++ | dborysen/pool_c- | /day04/ex02/TacticalMarine.cpp | UTF-8 | 1,848 | 2.71875 | 3 | [] | no_license | // ************************************************************************** //
// //
// ::: :::::::: //
// TacticalMarine.cpp :+: :+: :+: ... | true |
c7441d9d45f3bbe87a8a7527588c1d8576be7f92 | C++ | silky/repobuild | /repobuild/env/resource.h | UTF-8 | 2,158 | 2.875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | // Copyright 2013
// Author: Christopher Van Arsdale
#ifndef _REPOBUILD_ENV_RESOURCE_H__
#define _REPOBUILD_ENV_RESOURCE_H__
#include <iosfwd>
#include <vector>
#include <set>
#include <string>
namespace repobuild {
class Resource {
public:
static Resource FromRootPath(const std::string& root_path);
static Res... | true |
3910ad1d792f189083878cd2aea1466cfccf6018 | C++ | Soogyung1106/Algorithm-Study | /백준/그리디/[1541]잃어버린 괄호/길형.cpp | UTF-8 | 891 | 3.375 | 3 | [] | no_license | #include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#pragma warning(disable:4996)
using namespace std;
int main(void)
{
freopen("input.txt", "r", stdin);
string str;
cin >> str;
int sum = 0;
int temp = 0;
bool flag = false;
for (int i = 0; i < str.... | true |
c84b9aab620c49f84e851ba8163329e24ee06e31 | C++ | lilla021/GraphicsProject | /Plane.cpp | UTF-8 | 824 | 2.953125 | 3 | [] | no_license | #include "Plane.h"
Plane::Plane()
{
}
Plane::~Plane()
{
}
void Plane::setNormal(glm::vec3 norm)
{
normal = norm;
}
void Plane::setPosition(glm::vec3 pos)
{
position = pos;
}
void Plane::setAmbient(glm::vec3 amb)
{
ambient = amb;
}
void Plane::setDiffuse(glm::vec3 diff)
{
dif... | true |
80b827f9a32edf092d41193da97650bce335d59e | C++ | hiroki252/BT_1000 | /BT_64.cpp | UTF-8 | 1,702 | 2.84375 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float a, b, c,X;
int k;
printf("\nNHAP SO THICH HOP");
printf("\n1. GAI PHUONG TRINH BAC 1");
printf("\n2.GIAI PHUONG TRINH BAC 2");
scanf("%d", &k);
switch (k)
{
case 1:
{
printf("\nCHUONG TRIN... | true |
76b0c8fa72ba5e782a154554dd6d469518ab5f99 | C++ | oneapi-src/oneAPI-samples | /DirectProgramming/C++SYCL_FPGA/include/streaming_qri.hpp | UTF-8 | 11,589 | 2.96875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef __STREAMING_QRI_HPP__
#define __STREAMING_QRI_HPP__
#include "constexpr_math.hpp"
#include "tuple.hpp"
#include "unrolled_loop.hpp"
namespace fpga_linalg {
/*
QRI (QR inversion) - Given two matrices Q and R from the QR decomposition
of a matrix A such that A=QR, this function computes the inverse of A.
... | true |
ae845b86ffb5988fe6fcf9b3501fd0592e1d28b5 | C++ | algoriddle/cp | /uva/11292.cc | UTF-8 | 645 | 2.890625 | 3 | [
"MIT"
] | permissive | #include <algorithm>
#include <iostream>
using namespace std;
int d[20000], k[20000];
int main() {
ios::sync_with_stdio(false);
for (int n, m; cin >> n >> m && n && m; ) {
for (int i = 0; i < n; i++) {
cin >> d[i];
}
for (int i = 0; i < m; i++) {
cin >> k[i];
}
sort(d, d + n);
... | true |
f29e53b2cfa499d5806e2156e43cb18285efed74 | C++ | ggandycong/program | /cpp/eventtest/main.cpp | UTF-8 | 3,357 | 2.65625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <event.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#define SERVER_PORT 8000
#ifndef null
#define null 0
#endif
int debug = 0;
struct client
{
int fd;
... | true |
d9de46e62524ce134b3e272ddad47350a46c2bd0 | C++ | oraoto/pulsar-client-phpcpp | /src/MessageId.cpp | UTF-8 | 1,456 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "MessageId.h"
#include <string>
#define MESSAGE_ID_CLASS_NAME "Pulsar\\MessageId"
MessageId::MessageId(pulsar::MessageId messageId) { this->messageId = messageId; }
static Php::Value earliest()
{
auto messageId = new MessageId(pulsar::MessageId::earliest());
return Php::Object(MESSAGE_ID_CLASS_NAME,... | true |
1d4fa0eb8c0f3e77a478bd1fa061108970ea9890 | C++ | TheKrzyko/SokobanSDL | /SDLProjekt/Vector2.h | UTF-8 | 1,465 | 3.375 | 3 | [
"MIT"
] | permissive | #pragma once
template <typename t>
class Vector2
{
public:
static Vector2<t> lerp(Vector2<t> start, Vector2<t> end, double progress)
{
if (progress >= 1)
return end;
if (progress <= 0)
return start;
return (end - start)*progress + start;
}
Vector2()
{
}
Vector2(t X, t Y)
{
x = X;
y = Y;
}
V... | true |
e18e768fb83c5383df5d8c326d9e3498b98df219 | C++ | hleal18/libraries | /Press/Examples/Pressure with PCF8591/main.cpp | UTF-8 | 788 | 2.71875 | 3 | [] | no_license | #include <Arduino.h>
#include "Press.h"
#include "PCF8591.h"
// PCF configuration
#define PCF_ADDRESS 0x48
#define PCF_SDA_PIN D2
#define PCF_SCL_PIN D1
PCF8591 pcf48(PCF_ADDRESS, PCF_SDA_PIN, PCF_SCL_PIN);
// pressure sensor configuration
// Pin number should correspond to an
// available pin at PCF8591.
#define P... | true |
a49daf16cd204b277e6d461cbd779181f01391e7 | C++ | Linyxus/game-system | /game-system/manager.cc | UTF-8 | 8,964 | 2.53125 | 3 | [] | no_license | #include "manager.h"
#include <cmath>
#include <fstream>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
Random::Random()
{
generator = default_random_engine(time(NULL));
pointDis = uniform_int_distribution<int>(1,6);
probDis = uniform_int_distribution<int>(1,100);
}
int Random::randP... | true |
069788d4bd3f83cc09630fd3549b9b916b508744 | C++ | benharri/cs201 | /PG5/ArrayLL.h | UTF-8 | 1,669 | 3.453125 | 3 | [] | no_license | //Ben Harris
//Template for an linked list that can be used as a array.
#ifndef _ARRAYLL_
#define _ARRAYLL_
#include <iostream>
#include <string>
#include <cstdlib>
#include "ArrayLLN.h"
using namespace std;
template <class T> class ArrayLL{
private:
ArrayLLN<T> * head;
public:
ArrayLL(){ head = nu... | true |
7e86f2d69ca49b189da7ed6e4c750e377a99bd64 | C++ | Mustafiz48/Programming_Codes | /DSA/merge sort diye devide and coquer shikhi.cpp | UTF-8 | 1,364 | 3.484375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int arr[123456];
void mergeit(int arr[],int l,int m,int r)
{
int n1=m-l+1; //left array size
int n2=r-m; //right array size
int temp1[n1];
int temp2[n2];
for(int i=0;i<n1;i++)
{
temp1[i]=arr[l+i];
}
for(int i=0;i<n2;i++)
{
... | true |
191b1f3ee06de198c8f3dd18969586b0a4d30640 | C++ | ahmamani/CCOMP-Verano | /12_estructura_de_datos/pila/main.cpp | UTF-8 | 262 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include "MyStack.h"
using namespace std;
int main() {
MyStack<int> s, r;
s.push(1);
s.push(2);
s.push(3);
r.push(4);
r.push(5);
r.push(6);
MyStack<int> t = s + r;
cout << t << endl;
return 0;
} | true |
2f98be62fc5204791878c2004667581bb16d7e61 | C++ | iTXCode/Review | /cpp_base/day13_template_plus/test/template.cc | UTF-8 | 658 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
struct TrueType{
static bool Get(){
return false;
}
};
struct FalseType{
static bool Get(){
return false;
}
};
template <class T>
struct TypeTraits{
typedef FalseType IsPODType;
};
template<class T>
void Copy(T* dst, const T* src, size_t si... | true |
4ba3cbd6315b0699e06708e9161e21581449b574 | C++ | Ritesh-saini/NASSCOM-MHRD-IOT-Practical-Module_1-2 | /Submissions/Radhika_Mishra/Practial 1/Fading.ino | UTF-8 | 352 | 2.90625 | 3 | [
"CC0-1.0"
] | permissive | int brightness = 0;
void setup()
{
pinMode(9, OUTPUT);
}
void loop()
{
for(brightness = 0; brightness <= 255; brightness += 5)
{
analogWrite(9, brightness);
delay(50); // Wait for 50 millisecond(s)
}
for(brightness = 255; brightness >0; brightness -= 5)
{
analogWrite(9, brightness);
delay(50); // W... | true |
23e54c81337b26c1540cf2a21cde320ef1ef1022 | C++ | ahmadner/100Questions_cpp | /3.cpp | UTF-8 | 183 | 3.1875 | 3 | [] | no_license | // 3. Write C++ Program to print your name 100 times.
#include <iostream>
using namespace std;
int main (){
for (int count=1 ; count<=100;count++){
cout<<count<<". Ahmad\n";
}
} | true |
121708b232e5283eaf4221de140b6fdaf41677cd | C++ | benahedron/scanahedron | /src/scanner/scanservice.cpp | UTF-8 | 2,794 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "scanservice.h"
#include "iscannerinterface.h"
#include <png.hpp>
#include <iostream>
ScanService::ScanService(IScannerInterfacePtr interface_)
: interface(interface_)
{
if (!interface)
{
throw std::runtime_error("No scanner interface given!");
}
if (!interface->init())
{
... | true |
7b91b2ebe3e1c843e10234c251545e94be09ecb1 | C++ | HWMooo/Black_Jack | /Game.cpp | UTF-8 | 7,953 | 2.984375 | 3 | [] | no_license | //
// Created by Harry Moore
//
#include <iostream>
#include <vector>
#include "Game.h"
#include "Card.h"
Game::Game(const std::vector<std::string>& names)
{
std::vector<std::string>::const_iterator ThePlayerNames;
for (ThePlayerNames = names.begin(); ThePlayerNames != names.end(); ++ThePlayerNames)
_... | true |
e1ce6415843648f8fcfb78b570a800d5d029d0e4 | C++ | FeronCompany/MyObject | /ObjectManager/tools/MemberFuncRegister.h | UTF-8 | 1,163 | 2.546875 | 3 | [] | no_license |
#pragma once
#include <map>
#include <string>
#include "CommSingleton.h"
#include "BaseObject.h"
class RegFuncManager
{
friend CommSingleton<RegFuncManager>;
public:
void addFunc(const std::string& key, void* func);
void* getFunc(const std::string& key);
private:
RegFuncManager() {}
private:
std::map<std::s... | true |
157ca1f87271fba47b9bae9c5bd0dd925802c286 | C++ | DCurro/gtmiami | /src/ZombieMind.cpp | UTF-8 | 1,738 | 2.734375 | 3 | [] | no_license | #include "ZombieMind.hpp"
ZombieMind::ZombieMind() {
}
ZombieMind::~ZombieMind() {
}
void ZombieMind::setup(PlayContext* playContext, Animal* controllingAnimal) {
Mind::setup(playContext, controllingAnimal);
float animalDiameter = this->mAnimal->getBodyFixture()->GetShape()->m_radius*2;
mR... | true |
73667f9cea9f7940be1f7ff34e00a118670ace65 | C++ | harikulendran/AntSimulation | /AntSimulation/Cell.cpp | UTF-8 | 421 | 2.765625 | 3 | [] | no_license | #include "Cell.h"
#include <random>
#include <time.h>
Cell::Cell(int percent, int richness) {
srand(time(NULL));
if (rand() % 100 < percent)
source = richness;
}
void Cell::evaporate() {
pLevel *= (1.0 - EVAPORATION_RATE);
}
void Cell::add(double amount) {
pLevel += amount;
}
bool Cell::isFull() {
return pop... | true |
473bdce7e3577de5913f15c531bce3295cf6a537 | C++ | hstefan/Restaurant-Tycoon | /src/Parking.cpp | UTF-8 | 3,331 | 2.5625 | 3 | [
"MIT"
] | permissive | /*
* Copyright (c) 2010
* Hugo Stefan Kaus Puhlmann <hugopuhlmann@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the ... | true |
cfdd1584b9b7f879375e4ace8ba333d4b28de7c5 | C++ | GaigeKinsey/GAT350 | /GAT350/core/ref_count.h | UTF-8 | 280 | 3.140625 | 3 | [] | no_license | #pragma once
class ref_count
{
public:
ref_count() {}
ref_count(const ref_count&) = delete;
ref_count& operator = (const ref_count&) = delete;
void add_ref() { m_count++; }
void release() { m_count--; }
size_t count() { return m_count; }
private:
size_t m_count = 0;
}; | true |
0edf309c9bc0c8092eeb0b264df9a283c96731a5 | C++ | nachodz/tpdatos2do2012 | /Ocurrencia/Ocurrencia.h | UTF-8 | 750 | 2.703125 | 3 | [] | no_license | #ifndef OCURRENCIA_H_
#define OCURRENCIA_H_
#include <list>
#include <string>
using namespace std;
class Ocurrencia{
private:
string palabra;
int idPalabra;
string codigoGammaDocumento;
int idDocumento;
list <int> posiciones;
public:
Ocurrencia();
~Ocurrencia(){}
int getIdPalabra();
void setIdPal... | true |
4911eb01d431f2048e8646e9d615b72df7b93bc9 | C++ | charto/nbind-examples | /2-classes.cc | UTF-8 | 411 | 2.984375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #include <iostream>
class ClassExample {
public:
ClassExample() {
std::cout << "No arguments\n";
}
ClassExample(int a, int b) {
std::cout << "Ints: " << a << " " << b << "\n";
}
ClassExample(const char *msg) {
std::cout << "String: " << msg << "\n";
}
};
#include "nbind/nbind.h"
NBIND_CLAS... | true |
c0d07abf9dd1361e1dd669fd68618296b679ca04 | C++ | mrBymax/simpleShipGame | /header/Bullet.h | UTF-8 | 612 | 2.515625 | 3 | [] | no_license | //
// Created by Federico Bertossi on 07/07/21.
//
#ifndef BULLET_H
#define BULLET_H
#include <SFML/Graphics.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
class Bullet {
private:
sf::Sprite shape;
sf::Vector2f direction;
float movement... | true |
ea07b138433e4476a9b6eff1f6c8d19185404f6d | C++ | ruandaniel/R-LC | /459. Repeated Substring Pattern.cpp | UTF-8 | 502 | 2.625 | 3 | [] | no_license | class Solution {
public:
bool repeatedSubstringPattern(string s) {
int n = s.size();
for (int i = 1; i <= n/2; i++){
if (n % i) continue;
bool isRpt = true;
string rpt = s.substr(0, i);
for (int j = 1; j < n/i; j++){
if (rpt != s.substr... | true |
0d9035492cff1f12f467908e0dd29f78c6f76012 | C++ | Mionger/LeetCode | /PASS2/containsDuplicate.cpp | UTF-8 | 755 | 3.421875 | 3 | [] | no_license | #include<iostream>
#include<vector>
// #include<algorithm>
using namespace std;
class Solution {
public:
bool containsDuplicate(vector<int> &nums);
};
bool Solution::containsDuplicate(vector<int> &nums)
{
if(nums.empty())
{
return false;
}
sort(nums.begin(), nums.end());
for (int i = 0... | true |
3e0888fe0b7f0ba7cb62b4ff906b567b83366710 | C++ | dikdack009/Labs_2course | /Murov_labs_3sem/lab2/Chain_line.cpp | WINDOWS-1251 | 1,598 | 2.859375 | 3 | [] | no_license | #include <strstream>
#include <iostream>
#include <Windows.h>
#include <stdlib.h>
#include <math.h>
#define graphic(x,a) (a*cosh(x / a)) //
#include "Chain_line.h"
namespace Chain {
// 0, -
Chain::Chain(double x)
{
if (x == 0)
throw std::exception("invalid param a");
a = x;
}
Chain& Chain:... | true |
d95e470a8e7f7718455f9d961e7e3ddbe78af22e | C++ | Aryanagarwala/CodeForces | /1269-C/1269-C-67346568.cpp | UTF-8 | 1,012 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <fstream>
#include <stack>
#include <vector>
#include <set>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <map>
#define int long long
using namespace std;
int n, k;
bool big(string s, string s1){
bool big =... | true |
954b96f7f7030d857ea2c036ffa55331c1571676 | C++ | liguomin9496/chuxuezhedechangshi | /AlgorithmCompetition/蓝桥杯赛题/第七届省赛/第七届蓝桥杯大赛个人赛省赛(软件类)真题/C语言B组源码/6.cpp | GB18030 | 914 | 3.125 | 3 | [] | no_license | #include<iostream>
#include<math.h>
using namespace std;
int Map[3][4]={0,1,1,1,1,1,1,1,1,1,1,0};
int vis[3][4];
int res=0;
void Dfs(int step,int x,int y){
if(step==9){
res++;
return;
}
for(int i=0;i<3;i++){//ﱾڱλãԲҵλãһıң
for(int j=0;j<4;j++){
if(abs(j-y)<=1 && abs(i-x)<=1)//xƽߺyƽཻɵķ
co... | true |
08b3a89fb1e72fa9821fdd377b2ad102aca23f89 | C++ | drewag/Flurry | /core/inc/FL_ObjectList.h | UTF-8 | 2,132 | 3.15625 | 3 | [] | no_license | #ifndef FL_ObjectList
#define FL_ObjectList
#include <set>
namespace Flurry
{
class Object;
class Category;
class ObjectList
{
public:
typedef std::set<Object>::iterator iterator;
typedef std::set<Object>::const_iterator const_iterator;
public:
//! Constructor
ObjectList();
... | true |
8dc48c4d6fea0c78e8949e5421a3be47247279aa | C++ | r-o-b-o-t-o/podracer | /window/src/TextureLoader.cpp | UTF-8 | 1,042 | 2.890625 | 3 | [
"MIT"
] | permissive | #include <vector>
#include "TextureLoader.h"
namespace Window {
TextureLoader::TextureLoader() {
std::vector<std::string> texturePaths = {
};
for (int i = 1; i <= 3; ++i) {
texturePaths.push_back("walls/brown" + std::to_string(i) + ".png");
texturePaths.push_back("... | true |
ba28f2dc210ce4a71f960e901d9b73df1b62095f | C++ | 0xTaoL/COP3503 | /Project 3/pa3.cpp | UTF-8 | 6,004 | 3.390625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <fstream>
#include <string>
#include "pa3.h"
#include <vector>
using namespace std;
int main() {
cout << "Please enter the name of the input file: ";
string input;
cin >> input;
ifstream file(input);
if(!file){
cout << "Invalid File.";
return 1;
}... | true |
893c1ecdc3861a9a44758633412184c5a23a6c0e | C++ | jeffason/JrsCheckers | /src/Application.h | UTF-8 | 1,849 | 2.890625 | 3 | [] | no_license | /////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Application.h
//
// DESCRIPTION:
// Our core application singleton which manages global access to our polymorphic Engine and our
// global application configuration.
//
// jrs051413 - created
//
////////////////... | true |
e732f9585b906defab2aaddeddde770c90938ed6 | C++ | A2andil/Algorithms | /Sorting/02- Insertion Sort.cpp | UTF-8 | 410 | 2.921875 | 3 | [] | no_license | // in the name of God
#include <iostream>
#include <vector>
using namespace std;
vector<int> sort_by_insertion(vector<int> v) {
for (int i = 1; i < (int)v.size(); i++) {
for (int j = i; j > 0; j--) {
if (v[j] < v[j - 1]) {
swap(v[j], v[j - 1]);
}
... | true |
892efb8e92831ddd636a9d70d1f339fb1925e19b | C++ | pirtwo/Arcade-Games | /Pong/src/Paddle.cpp | UTF-8 | 721 | 2.859375 | 3 | [
"MIT"
] | permissive | #include "Paddle.h"
#include <SFML/Graphics.hpp>
Paddle::Paddle(float w, float h, sf::Color color)
{
_sp = sf::RectangleShape(sf::Vector2f(w, h));
_sp.setFillColor(color);
}
Paddle::~Paddle()
{
//
}
sf::FloatRect Paddle::getBody()
{
return sf::FloatRect(
getPosition().x,
getPosition()... | true |
a047e5d39cd338201ab8dd01f1dab86fde48b261 | C++ | CCEP16Fa/3DEngineCpp | /src/freeLook.h | UTF-8 | 579 | 2.640625 | 3 | [] | no_license | #ifndef FREELOOK_H
#define FREELOOK_H
#include "math3d.h"
#include "gameComponent.h"
class FreeLook : public GameComponent
{
public:
FreeLook(const Vector2f& windowCenter, float sensitivity = 0.5f, int unlockMouseKey = Input::KEY_ESCAPE) :
m_sensitivity(sensitivity),
m_unlockMouseKey(unlockMouseKey),
m_mouseLo... | true |
bd86f271ced9aba0ffc58d2fb6d8ee5a42ab2bd7 | C++ | z-a-f/Fun-Codes | /primeChecks.cpp | UTF-8 | 2,516 | 3.8125 | 4 | [] | no_license |
/* Assumption:
* Every prime number reversed in binary is either a
* prime, or a square of a prime
*/
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
bool isPrime(unsigned num) {
// return 0 if not prime
// return 1 if prime
// return 2 if square of a prime
if (num == 2) retur... | true |
5827d92d7eab17c2a277405d59aa84665058ba7e | C++ | 9sheng/leetcode | /790.domino-and-tromino-tiling.cpp | UTF-8 | 2,157 | 3.59375 | 4 | [] | no_license | /**
* 790. Domino and Tromino Tiling
*
* We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated.
*
* XX <- domino
*
* XX <- "L" tromino
* X
* Given N, how many ways are there to tile a 2 x N board? Return your answer modulo 10^9 + 7.
*
* (In a tiling, every s... | true |
f58e443de8f52d5bdbecb90cba9f9eeeff6cc15d | C++ | bedomarci/EasyLCDMenu | /src/menuitem/CommandMenuItem.hpp | UTF-8 | 1,708 | 2.828125 | 3 | [] | no_license | //
// Created by m4800 on 10/4/2019.
//
#ifndef EASYLCDMENU_COMMANDMENUITEM_HPP
#define EASYLCDMENU_COMMANDMENUITEM_HPP
#include "ValueMenuItemTemplate.hpp"
class CommandMenuItem : public MenuItemTemplate<EasyLCDMenuFunction> {
public:
CommandMenuItem(EasyLCDMenuFunction value, const char *label, const char *des... | true |
3c1ccc91502864351e473732f7d1a0747a5cf532 | C++ | flameshimmer/leet2019.io | /Leet2019/WiggleSort.cpp | UTF-8 | 589 | 3.390625 | 3 | [] | no_license | #include "stdafx.h"
//Given an unsorted array nums, reorder it in-place such
//that nums[0] <= nums[1] >= nums[2] <= nums[3]....
//
//Example:
//
//Input: nums = [3,5,2,1,6,4]
//Output: One possible answer is [3,5,1,6,2,4]
namespace Solution2019
{
namespace WiggleSort
{
void wiggleSort(vector<int>& nums) {
int... | true |
5b31d819de5a6b80547d6e08f3994b9216516dcc | C++ | OKullmann/oklibrary | /ComputerAlgebra/Matroids/Lisp/Greedoids/plans/general.hpp | UTF-8 | 1,564 | 2.59375 | 3 | [] | no_license | // Oliver Kullmann, 1.8.2008 (Swansea)
/* Copyright 2008, 2012 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation and included in this library; either vers... | true |
2ce526d852687cba0447ebb1705f31bbe3d4a50f | C++ | odilonafonso/IOT | /GenericBoards/testmacaddress/testmacaddress.ino | UTF-8 | 1,288 | 3.078125 | 3 | [] | no_license | /*
* Retrieve the MAC address from a Microchip 24AA125E48 I2C ROM, and report it
* to the serial console at 57600bps. The I2C address of the ROM is set to 0x50,
* which assumes both the address pins are tied to 0V.
*/
#define I2C_ADDRESS 0x50
#include <Wire.h>
static uint8_t mac[] = { 0x00, 0x00, 0x00, 0x00, 0x00... | true |
e9ec3d0b9d9b232c9e3c636a4d1b97eff54acab9 | C++ | caogtaa/OJCategory | /ProjectEuler/1_100/0046.cpp | UTF-8 | 971 | 2.875 | 3 | [] | no_license | #include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <iostream>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "helper.h"
using namespace std;
c... | true |
ebd631720c6effd9ac903dadc8121da8f60e0670 | C++ | Nammur/projetoEDB1 | /src/main.cpp | UTF-8 | 14,419 | 3 | 3 | [] | no_license | #include "../include/includeGeral.h"
int main(){
srand (time(NULL));
std::ofstream myfile;
int vetorPos = 0;
int selecaoVetor;
std::cout << "Selecione como deseja o vetor inicialmente\n"
"1) Ordem Crescente\n"
"2) 50% ordenado\n"
... | true |
239091a6504a2c06f66eb6c151a0c894380a475b | C++ | BENIMALS9/Fifth_GIS | /工程/FIfth_Gis/FIfth_Gis/Geometry.h | GB18030 | 12,552 | 2.671875 | 3 | [] | no_license | #pragma once
#include "framework.h"
#include "FIfth_Gis.h"
#include <json/json.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cassert>
#include <errno.h>
#include <string.h>
#include <vector>
#include <cmath>
using namespace std;
// Ҫ࣬ͬID
class Geometry
{
protected:
string ID;
public:
Geomet... | true |
595c81486dbe7c52f553d38e72f97cc643987b6e | C++ | vjkholiya123/Library-Management-System | /Library Management System.cpp | UTF-8 | 3,478 | 2.71875 | 3 | [] | no_license | #include<iostream>
#include<string.h>
#include<string>
#include<conio.h>
#include<fstream>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
bool checkiflogin=false;
int choice=0;
class check
{
public:
string a;
int b;
void add1()
{
cout<<"\n\t\tenter the book name you want to ... | true |
285bb7006b34fe715313f2b9e91080b112747d3a | C++ | wlmwang/hnet-src | /core/wMisc.cpp | UTF-8 | 16,120 | 2.671875 | 3 | [] | no_license |
/**
* Copyright (C) Anny Wang.
* Copyright (C) Hupu, Inc.
*/
#include <algorithm>
#include "wMisc.h"
#include "wAtomic.h"
#include "wLogger.h"
namespace hnet {
namespace coding {
void EncodeFixed8(char* buf, uint8_t value) {
if (kLittleEndian) {
memcpy(buf, &value, sizeof(value));
} else {
... | true |
ed289e1347423458c0a50e3f9dadc42131754752 | C++ | AlanSavushkin/something | /template_matching.cpp | UTF-8 | 1,344 | 2.71875 | 3 | [] | no_license | //
// main.cpp
// ObjFind
//
// Created by Алан Савушкин on 06.03.17.
// Copyright © 2017 Алан Савушкин. All rights reserved.
//
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
using namespace std;
using namespace cv;
void obj_find(Mat &image, Mat &temp);
int main(int argc, const ch... | true |
ba6b7a02bf386322d6ab123db7c9b0010e16586a | C++ | alexandraback/datacollection | /solutions_1484496_0/C++/Squarefk/cc.cpp | UTF-8 | 1,413 | 2.5625 | 3 | [] | no_license | #include <cstdio>
using namespace std;
int list1[550],list2[550],hh[2002000];
int t,n,data[550],st[2002000];
bool can;
void make(int now,int before)
{
list1[0]=0;int temp;
temp=now;
while (temp) {list1[++list1[0]]=hh[temp];temp-=hh[temp];}
list2[0]=1;list2[1]=before;
temp=now-before;
while (temp... | true |
f7e4f6a7a6ad8fe9fd9c1b8df596d0ba42caa9ff | C++ | thanhtungdp/export-csv-to-html-cplusplus | /Source/libs/read_csv.h | UTF-8 | 3,396 | 3.375 | 3 | [] | no_license | //
// Created by Phan Tùng on 4/1/16.
//
#ifndef DO_AN_CUOI_KY_READ_CSV_H
#define DO_AN_CUOI_KY_READ_CSV_H
#include <iostream>
#include <fstream>
#include "memory.h"
using namespace std;
const string file_src = "data/students.csv";
const char file_string_delimiter = ',';
const char file_string_quote = '\"';
/**
* ... | true |
0c03ae784c44c4032f9ead3a622e4350d14585cc | C++ | Sazanaizu33/RangeKutta4thOrder | /Runge-Kutta 4th order/Runge-Kutta 4th order/RungeKutta4.cpp | UTF-8 | 1,239 | 3.234375 | 3 | [] | no_license | #include <math.h>
#include <iostream>
#include "RungeKutta4.h"
RungeKutta4::RungeKutta4()
{
}
RungeKutta4::~RungeKutta4()
{
}
/*This function is responsible for the 4th-order Runge-Kutta method. It returns the calculated value at each t.*/
double RungeKutta4::DoRungeKutta4(const double N, const double h, const doubl... | true |
8f5c3a15489d0542dc61e6066ac62ffcd1ee237c | C++ | EnricoGiordano1992/TesiMagistrale | /rechannel/old/src/sommatore.cc | UTF-8 | 284 | 2.703125 | 3 | [] | no_license | // file sommatore.cpp
#include "sommatore.hh"
// Implementazione del metodo somma dichiarato nel modulo
void sommatore::somma() {
if(is_ready.read() == 1) {
cout.write(static_cast< sc_int<32> >( a.read() ) + static_cast< sc_int<32> >( b.read() ));
result_isready.write(1);
}
} | true |
ccb02785886b83d5ee5dec26574728e057491c03 | C++ | Can1210/Team16_DxLib | /Team16/Actor/Enemies/Array.h | SHIFT_JIS | 527 | 3.125 | 3 | [] | no_license | #ifndef INCLUDED_ARRAY_1D_H
#define INCLUDED_ARRAY_1D_H
//1zNX
template< class T > class Array {
public:
Array() : mArray(0) {}
~Array() {
delete[] mArray;
mArray = 0; //|C^0
}
void setSize(int size0) {
if (mArray) {
delete[] mArray;
mArray = 0;
}
mSize0 = size0;
mArray = new T[size0];
}
T& op... | true |
7100750d15c833f4c93f65006bff22ff423bee5f | C++ | Harrix/Harrix-MathLibrary | /src/Непараметрика/HML_NonparametricEstimatorOfDerivative2.cpp | UTF-8 | 3,807 | 3.078125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | double HML_NonparametricEstimatorOfDerivative2(double x, double *X, double *Y, int VHML_N, double C, int V, bool *b)
{
/*
Непараметрическая оценка производной при равномерном законе распределения элементов
выборки в точке. Рассматривается одномерный случай: 1 вход и 1 выход.
Отличается от HML_NonparametricEstimatorOfDe... | true |
09ab687adf54b1fc3a34df297c28aacdf4a9e336 | C++ | alexander-koval/HelloWorld | /Grafit/include/Grafit/Graphics/BlendMode.hpp | UTF-8 | 2,147 | 2.90625 | 3 | [] | no_license | #ifndef BLENDMODE_HPP
#define BLENDMODE_HPP
namespace gf {
struct BlendMode {
enum Factor {
Zero, ///< (0, 0, 0, 0)
One, ///< (1, 1, 1, 1)
SrcColor, ///< (src.r, src.g, src.b, src.a)
OneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a)... | true |
a88ee8c21ee0d06b9288cc642b577b146e691658 | C++ | huchong0/TinySTL | /TinySTL/stack.h | UTF-8 | 466 | 3.015625 | 3 | [] | no_license | #pragma once
#ifndef STACK
#define STACK
#include"deque.h"
namespace TinySTL
{
template <class T>
class stack
{
deque<T> buffer;
public:
void push(const T& value)
{
buffer.push_back(value);
}
void pop()
{
buffer.pop_back();
}
T top()
{
return buffer.back();
}
void clear()
{
b... | true |
8b08ea0c5fc84ba11412fab25efc424136cd1068 | C++ | searleser97/DistribuitedSystems | /SocketMulticast/MulticastSocket.cpp | UTF-8 | 1,536 | 2.65625 | 3 | [] | no_license | #include "MulticastSocket.h"
#include "DatagramSocket.h"
#include <arpa/inet.h>
#include <string.h>
MulticastSocket::MulticastSocket() : DatagramSocket() {}
MulticastSocket::MulticastSocket(uint16_t iport) : DatagramSocket(iport) {}
MulticastSocket::~MulticastSocket() {}
void MulticastSocket::joinGroup(uint16_t ipo... | true |
8c6f8a396be12c3b11d587ca87675fe6b138a87d | C++ | rhaeus/basic_raytracer | /src/Cube.cpp | UTF-8 | 3,355 | 2.875 | 3 | [] | no_license | #include "Cube.h"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/transform.hpp>
#include <glm/gtx/euler_angles.hpp>
inline
float deg2rad(const float °)
{ return deg * M_PI / 180.0f; }
Cube::Cube(glm::vec3 center, std::shared_ptr<Material> material_, glm::vec3 scale, float roll_, float pitch_, float yaw_)
: ... | true |
fd3cb6940a95b103e70e6abb309e3e87dfcc62e7 | C++ | tomasClavijo/A1-Obligatorios | /Obligatorio 2/ListaOrdIntImp.cpp | UTF-8 | 2,876 | 2.96875 | 3 | [] | no_license | #include "ListaOrdInt.h"
#ifdef LISTA_ORD_INT_IMP
struct _cabezalListaOrdInt {
NodoListaInt* ppio;
unsigned int largo;
};
/* AUXILIARES */
// PRE:
// POS: Agrega el dato ordenado creando un nuevo nodo
void agregar(NodoListaInt*& l, int dato) {
if (l == NULL) {
l = new NodoListaInt(dato);
}
else if (dato <= l... | true |
acb4fc3bde0052e41df91e05023cfe648b631558 | C++ | DEVECLOVER/LeetCodeFighting_CPP | /LeetCode101-200/132.分割回文串-ii.cpp | UTF-8 | 3,710 | 3.125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=132 lang=cpp
*
* [132] 分割回文串 II
*/
// @lc code=start
class Solution {
public:
//暴力回溯 超时 这个方法是借用 前一题的思路
bool IsSym(string str)
{
int left = 0;
int right = str.size() - 1;
while(left < right)
{
if(str[left] != str[r... | true |
aad4202ab5a1ca9df0d7634409d2760af3551e60 | C++ | JJRWalker/ChaosEngine | /ChaosEngine/src/Chaos/Debug/Timer.h | UTF-8 | 1,243 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef _TIMER_H
#define _TIMER_H
#include <chrono>
#ifndef CHAOS_PROFILE
#define PROFILED_FUNC() Timer t(__FUNCTION__)
#else
#define PROFILED_FUNC()
#endif
namespace Chaos
{
class Timer
{
public:
Timer(const char* name) : mName(name) {
mStartPoint = std::chrono::high_resolution_clock::now();
}
~Timer()... | true |
31366b3bcc81c9427b022bdc68c63431b23a53ba | C++ | verymadjack/automatic-spork | /asasasasasasasasasasasas/main.cpp | UTF-8 | 1,222 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream U1;
int b=0;
int i = 0;
int a = 0;
int c = 0;
int ii=0;
int howMany=1;
string firstLetter;
int pages;
string word;
int numberOfNames;
int namesPerPage;
U1.open("U1.txt");
U1>>numberO... | true |
324b66a1e31fedaf473df1ddbce3379b77fafa48 | C++ | rupav/cp | /competitive_coding/contests/602_virtual/C.cpp | UTF-8 | 1,264 | 2.53125 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll mod = 1e9+7;
void solve(){
int ... | true |
cd864299e33faa5b5ed906439d185b4e652aa77f | C++ | lehuyngo/game_plane | /Common_Function.cpp | UTF-8 | 3,184 | 2.90625 | 3 | [] | no_license | #include "Common_Function.h"
SDL_Surface* ComFunc:: LoadImage(std::string file_path)
{
SDL_Surface* load_image = NULL;
SDL_Surface* optimize_image = NULL;
//lưu ý: vị trí lưu ảnh phải cùng với vị trí lưu chương trình chính của các bạn để hàm IMG_Load đọc được ảnh
load_image = IMG_Load(file_path.c_str());
if (lo... | true |
7c74d36325670499ebc68d22df4f1a55f5f44679 | C++ | vcahlik/pa2-pacman | /src/Model/GameTimer.cpp | UTF-8 | 2,307 | 3.078125 | 3 | [
"MIT"
] | permissive | #include "GameTimer.h"
#include "Config.h"
#include "Game.h"
#include <stdexcept>
GameTimer::GameTimer(const Game *game)
: game(game) {}
void GameTimer::requestTimer(const TimeoutEvent timeout) {
if (isActive(timeout)) {
return;
}
timeoutsCounter[timeout] = 0;
}
void GameTimer::stopTimer... | true |
51dcedc18808ca9429cdca1a2d74df7f75558aec | C++ | pemami4911/projecteuler.net | /projecteuler.net/Problem12.cpp | UTF-8 | 3,008 | 3.625 | 4 | [] | no_license | /*
Patrick Emami
Problem 12
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. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1: 1... | true |
04d47dd160f9a710762d074e7063defa034727a0 | C++ | tushargosavi/cpp-learn | /algo/heap.h | UTF-8 | 2,376 | 3.578125 | 4 | [
"MIT"
] | permissive | #ifndef __HEAP_H
#define __HEAP_H
#include <vector>
#include <iostream>
#include <functional>
#include <algorithm>
#include <iterator>
template <typename T, typename Cmp = std::less<T> >
class Heap {
private:
std::vector<T> heap_arr;
int len;
inline int pidx(int n) { return (n-1) / 2; }
inline int c1idx(int ... | true |
9f78ec0a0d50b58017b26b07d784bb10b1072283 | C++ | R-O-C-K-E-T/cosc363-assignment-1 | /src/aabb.h | UTF-8 | 782 | 2.96875 | 3 | [] | no_license | #pragma once
#include <vector>
#include <glm/glm.hpp>
struct AABB {
AABB(glm::vec3 lower, glm::vec3 upper) : lower(lower), upper(upper) {}
AABB(const std::vector<glm::vec3>& points);
AABB make_union(const AABB& other) const;
AABB expand(float radius) const;
AABB apply_transform(const glm::mat4&... | true |
e1b5be6b8bda005cca543d1e75afbda651478cf9 | C++ | sanstwy777/Leetcode | /MySolutions/485. Max Consecutive Ones/485.cpp | UTF-8 | 883 | 3.1875 | 3 | [] | no_license | //============================================================================
// Name : Leetcode.485. Max Consecutive Ones
// Author : sanstwy27
// Version : Version 1.0.0
// Copyright :
// Description : Any %
// Reference :
//========================================================================... | true |
e892666ac3080ab3905ce793f038409bb0e418c0 | C++ | dlwjdqls/monke | /source/monke/main.cc | UTF-8 | 1,915 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | // averysumner - monke
// main.cc
// contains entry point
// Copyright 2021 averysumner
//
// 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 / LICENS... | true |
7c66472caa4d34feaa92b27951e65da26c2e34e9 | C++ | AStockinger/Cpp-Projects | /Labs/Lab1/determinant.cpp | UTF-8 | 846 | 3.359375 | 3 | [] | no_license | /********************************************************************************
** Program Name: Matrix Calculator
** Author: Amy Stockinger
** Date: 9/20/18
** Description: returns determinant of a 2x2 or 3x3 matrix based on size
*********************************************************************************/
#in... | true |
1443b863fd1585fcb846507ea74db152307795fb | C++ | mirsking/mirsking_patest | /basic1020_mooncake/basic1020_mooncake/basic1020_mooncake.cpp | GB18030 | 1,250 | 3.171875 | 3 | [] | no_license | // basic1020_mooncake.cpp : ̨Ӧóڵ㡣
//
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;
bool cmp(const vector<float>& left, const vector<float>& right)
{
return left[1] >= right[1];
}
int main(int argc, char* argv[])
{
int n, need;
cin >> n >> need;
vector< vect... | true |
2ddc508661b4d45eeb1f1631500682e849cb6f2a | C++ | monikagopisetti/mrnd_set_1 | /type of triangle/type of triangle/type of triangle.cpp | UTF-8 | 1,737 | 3.265625 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
#include<malloc.h>
#define CASES 4
#define MAX 2
#define RANGE 20
// Write test cases
char* equilateral = "equilateral";
char* isoceles = "isoceles";
char* scalen = "scalen";
typedef struct coordinates
{
double x;
double y;
}Coordinates;
typedef struc... | true |
a912aa01daef435014525c02e6716eaa8cdd1709 | C++ | amross/GameDemo | /card.h | UTF-8 | 682 | 2.65625 | 3 | [] | no_license | #pragma once
#include <Symbols/coloredSymbol.h>
#include <Modifiers/modifysymbol.h>
#include <QObject>
// Represents a card with symbol on face and modifier on back
// Can be draw into a QObject
class Card
{
public:
Card();
Card(const ColoredSymbol* pFaceSymbol, const ModifySymbol* pModifier);
void Flip()... | true |
62eb74537567a9829fb25c688d0a1a788da79eaa | C++ | yczheng-hit/gensim | /support/libgvnc/inc/libgvnc/Keyboard.h | UTF-8 | 524 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /* This file is Copyright University of Edinburgh 2018. For license details, see LICENSE. */
#pragma once
#include <stdint.h>
#include <functional>
namespace libgvnc
{
struct KeyEvent {
bool Down;
uint32_t KeySym;
};
using KeyboardCallback = std::function<void(const KeyEvent&) >;
class Keyboard
{
public:
... | true |
4e38f3309f143010cb189e471a88c988cd21ffdd | C++ | jiangshen95/UbuntuLeetCode | /PathSumII2.cpp | UTF-8 | 2,539 | 3.453125 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
vector<vector<int> > pathSum(TreeNode* root, int sum) {
vector<vector<int> > result;
... | true |
e29b35e4cf03f6af2202cf74f989b1f59318db20 | C++ | codgician/Competitive-Programming | /POJ/3667/segment_tree_lazy.cpp | UTF-8 | 5,150 | 2.53125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <iomanip>
#include <climits>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define SIZE 80100
#define leftSon ((segPt << 1) + 1)
#define rightSon ((segPt << 1) + 2)
using namespac... | true |
fa8a1cd3e438a6dc2f77a7390a960ced6052491e | C++ | pankhuri-52/Data-Structures-Codes | /Graphs/adjacency_list.cpp | UTF-8 | 790 | 3.4375 | 3 | [] | no_license | #include<iostream>
#include<list>
#include<iterator>
using namespace std;
void displayAdjList(list<int> adj_list[], int v) {
for(int i = 0; i<v; i++) {
cout << i << "--->";
list<int> :: iterator it;
for(it = adj_list[i].begin(); it != adj_list[i].end(); ++it) {
cout << *it << " ";
}
... | true |
0febf92273d589617b99b22ad4d0ad83f0e7175c | C++ | sirAdarsh/CP-files | /ALGORITHMS/3. Ax + By = C (solutions)/One Solution(prac).cpp | UTF-8 | 634 | 2.890625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int gcdExtended(int a,int b,int *x,int *y){
if(a==0){
*x=0;
*y=1;
return b;
}
int x1,y1;
int gcd=gcdExtended(b%a,a,&x1,&y1);
*x=y1-(b/a)*x1;
*y=x1;
return gcd;
}
bool solve(int a,int b,int c,int *x,int *y){
int g=gcdExtended(abs(a),abs(b),x,y);
if(c%g){
... | true |
a9c9bfbe96fb6ecb2040c630533a8f5b7191093a | C++ | yashkapoor007/geeksforgeeks | /btreevc.h | UTF-8 | 190 | 2.71875 | 3 | [] | no_license | template <typename T>
class Btree
{
public:
T data;
int vc;
Btree<T> *left;
Btree<T> *right;
Btree(T data)
{
this->data=data;
vc=0;
left=NULL;
right=NULL;
}
};
| true |
a40a96ada029b0f8f9c7233c1749542724954c14 | C++ | wwwwodddd/Zukunft | /codechef/CLRL.cpp | UTF-8 | 573 | 2.5625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int t, n, r;
int low, high;
int main() {
scanf("%d", &t);
for (int tt = 0; tt < t; tt++) {
scanf("%d%d", &n, &r);
low = high = -1;
bool ok = true;
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
if (x > r) {
if (high == -1) {
high = x;
... | true |
5fabb2049f5fc7b75e653199cfccfa4649deb464 | C++ | xueyinglu/BiotSystem_EG | /source/data/RightHandSide.cc | UTF-8 | 1,206 | 2.90625 | 3 | [] | no_license | #include "../include/RightHandSide.h"
RightHandSide::RightHandSide ()
:
Function<dim> (dim)
{}
inline
void RightHandSide::vector_value (const Point<dim> &p,
Vector<double> &values) const
{
Assert (values.size() == dim,
ExcDimensionMismatch (... | true |
6d4dfea5e353a7265a2340eb6c1be131e1332c8a | C++ | sasaki-seiji/ProgrammingLanguageCPP4th | /part2/ch12/12-5-pointer-to-overloaded-function/src/pointer_to_overloaded_function.cpp | UTF-8 | 1,012 | 3.453125 | 3 | [] | no_license | /*
* pointer_to_overloaded_function.cpp
*
* Created on: 2016/05/11
* Author: sasaki
*/
#include <iostream>
using namespace std;
void f(int);
int f(char);
void (*pf1)(int) = &f;
int (*pf2)(char) = &f;
//void (*pf3)(char) = &f;
// error: no matches converting function 'f' to type 'void (*)(char)'
void ff... | true |
46118939248c150c3cd9cd1b3648964889522840 | C++ | Paresh-Wadhwani/Competitive_Programming | /GeeksforGeeks/Ways To Tile A Floor/Solutions/C++/numberOfWays.cpp | UTF-8 | 728 | 3.390625 | 3 | [
"MIT"
] | permissive | long long numberOfWays(long long N)
{
long long modulo = 1000000007;
// This is nothing but fibonacci series in modulo 10^9 + 7.
// For N = 1 or 2, we return N itself.
if (N == 1 || N == 2)
return N;
// In other cases, we calculate the Nth fibonacci number using Dynamic Programming.
long long fb_minus_1 = 2... | true |
599f1d6b96d9ee9e40e4262cb249031b775a4a2b | C++ | ayushoo6/Data-Structure-And-Algorithms-Code-In-c- | /insertion sort.cpp | UTF-8 | 589 | 3.578125 | 4 | [] | no_license | #include<iostream>
using namespace std;
int insertionSort(int a[])
{
int key=0;
int j=0;
for(int i=1;i<5;i++)
{
key=a[i];
j=i-1;
while(j>=0 && a[j]>key)
{
a[j+1]=a[j];
j=j-1;
}
a[j+1]=key;
}
}
int main()
{
int arr[5];
cout<<"enter 5 integer element :"<<endl;
for... | true |
aa2d702875162efcbb93509207b4e9375ce2e077 | C++ | felipefoschiera/Competitive-Programming | /URI Online Judge/AD-HOC/2366 - Maratona/maratona.cpp | UTF-8 | 421 | 2.671875 | 3 | [] | no_license | /**
* URI 2366 - Maratona
* Felipe G. Foschiera
*/
#include <stdio.h>
int main(){
int N, M;
scanf("%d %d", &N, &M);
int pos[N];
scanf("%d", &pos[0]);
bool can = true;
for(int i = 1; i < N; i++){
scanf("%d", pos+i);
if(pos[i] - pos[i-1] > M){
can = false;
... | true |
151d10b14922e51a5ee2048e08b863020bbe2337 | C++ | dianatibre/School | /Parallel and distributed programming/training/threadedPermutation.cpp | UTF-8 | 1,614 | 3.25 | 3 | [] | no_license | //
// Created by potra on 23.01.2019.
//
#include <iostream>
#include <thread>
#include <vector>
#include <mutex>
#include <atomic>
#include "util.hpp"
using namespace std;
const int N = 7;
atomic<int> count(0);
bool predicate(const vector<int>& perm) {
return true;
}
/**
* Calculates all the permutations ... | true |
dd5c02a4e105b9fd6fa7b1d45727eaa8b5d31ce7 | C++ | tdragon00/CS1C | /assignment 13/main.cpp | UTF-8 | 307 | 2.515625 | 3 | [] | no_license | /*
* main.cpp
*
* Created on: Dec 2, 2019
* Author: Slickback
*/
#include <node.h>
#include <linkedlist.h>
using std;
int main()
{
std::cout<<"Part one";
int arr = {1,2,3,4,5};
int size =5;
List<int>intLList;
for (int i=0; i<= size-1; i++)
{
intLList.insertNewNode(arr<i>);
}
}
| true |
b35ed2fa671dba8ab3aa1dff20d4e395cb380f80 | C++ | aldebaran/libqi | /src/messaging/url.cpp | UTF-8 | 8,048 | 2.921875 | 3 | [] | permissive | /*
** Copyright (C) 2012 Aldebaran Robotics
** See COPYING for the license
*/
#include <qi/url.hpp>
#include <sstream>
#include <qi/type/typeinterface.hpp>
qiLogCategory("qi.url");
namespace qi {
class UrlPrivate {
public:
UrlPrivate();
UrlPrivate(const UrlPrivate* url_p);
UrlPrivate(const std::str... | true |
1a05d284215509ce9840f510d739bcfdab162106 | C++ | intel/riggingtools | /kp2rig/src/SmoothFactory.cpp | UTF-8 | 1,129 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <sstream>
#include <unordered_map>
#include "SmoothFactory.hpp"
// Include implemented smooth classes here
#include "Smooth_lpfIpp.hpp"
SMOOTH_TYPE SmoothFactory::SmoothType( std::string type )
{
static std::unordered_map< std::string, SMOOTH_TYPE > map = {
{ "none", SMOOTH_TYPE_NONE },
{... | true |
e53348697c23dd12a4ce017e073e7ae53df62409 | C++ | crazygao/study | /leetcode/31_next_permutation/next_permutation.cpp | UTF-8 | 1,364 | 3.421875 | 3 | [] | no_license | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int k = -1;
int l = -1;
int numK = 0;
if (nums.size() < 2) {
return;
}
for (auto iter = nums.begin() + 1; ite... | true |
0b045d5055b6d85201e0cfb340e7ef3ccd209f27 | C++ | CaoHaoyuan/ECE17-CPPandOOP | /HW6 Text Compression/ProcessController.cpp | UTF-8 | 10,145 | 3.375 | 3 | [] | no_license | //
// STLWordProcessor.cpp
// assignment6
//
// Created by rick gessner on 11/12/19.
// Copyright © 2019 rick gessner. All rights reserved.
//
#include "ProcessController.hpp"
#include <fstream>
#include <iostream>
#include <sstream>
#include <list>
#include <map>
#include <ctype.h>
using std::cout;
using std::end... | true |
410248afeddfc88bd11d51aaadc36eaedd881324 | C++ | EricJWest/sandbox | /C++/lesson_17/listing17.6/listing17.6.cpp | UTF-8 | 992 | 4.4375 | 4 | [] | no_license | /* Listing 17.6: Using 'vector::pop_back()' to Delete the Last Element
Teach Yourself C++ in One Hour a Day (8th edition)
by Siddhartha Rao */
#include <iostream>
#include <vector>
using namespace std;
template <typename T>
void DisplayVector(const vector<T>& inVec)
{
for (auto element = inVec.cbegin(); // a... | true |
e764b7b2cf9606e589874780fa2a54f66d1039fe | C++ | braeden-kurz/Black-Jack-Program | /Card.cpp | UTF-8 | 7,402 | 3.8125 | 4 | [] | no_license | #ifndef CARD_H
#define CARD_H
#include "Card.h"
#endif
/*******************************
* CARD CLASS
*******************************/
/*
* Card::Card(): Initializes the card object to null characters and sets
* the weight to an abitrary value (-999 in this case)
*
* Return value: N/A
*/
Card::Card() {
sui... | true |
1b51b4ea67332915795122ede682eda4eaa89f08 | C++ | CaptainSlowWZY/OI-Code | /XJOI/pigeon.cpp | UTF-8 | 3,495 | 2.6875 | 3 | [] | no_license | // pigeon
#include <cstdio>
#include <algorithm>
#ifdef DEBUG_MD
#define debug(format, ...) fprintf(stderr, format, __VA_ARGS__)
#else
#define debug(format, ...)
#endif
const int MAXN = 2e5 + 10;
struct Opt {
int tp, op1, op2, op3;
Opt() { tp = 1; }
Opt(int v_) : tp(2), op1(v_) {}
Opt(int l_, int r_, int k_) ... | true |