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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5c8234f9ced1d74e5b4df23c96f83f5700b2567c | C++ | tingxueren/acm | /1002_v3.cc | UTF-8 | 1,745 | 2.6875 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: 1002_v3.cc
*
* Description: acm 1002
*
* Version: 1.0
* Created: 10/12/2012 01:30:14 PM
* Revision: none
* Compiler: gcc
*
* Author: Zhang Dongsheng (mar... | true |
53ad55682fa6fdeea3af5013be03e091ffb4cab5 | C++ | yabuta/eating_one | /joins/blockJoin_gpu/disk/cpu_disk/nestLoopJoin.cc | UTF-8 | 4,454 | 2.671875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <error.h>
#include "tuple.h"
#include "debug.h"
int left;
int right;
TUPLE *Tright;
TUPLE *Tleft;
JOIN_TUPLE *Tjoin;
void diffplus(long *total,struct timeval begin,struct timeval end){
*... | true |
c5eca3202019d7d5d479d441ef016b96df18e87f | C++ | Brandon-Ashworth/Physics-Simulation | /Demos/Pysics/Physics Stuff/Physics Stuff/ISE-Demo/Affordance.h | UTF-8 | 317 | 2.859375 | 3 | [] | no_license |
class Affordance
{
public:
Affordance();
Affordance(float eat,float drink, float pickup);
~Affordance(void);
void setEat(float eat);
void setDrink(float drink);
void setPickup(float pickup);
float getEat();
float getDrink();
float getPickup();
private:
float m_Eat;
float m_Drink;
float m_PickUp;
};
| true |
8d513805199f40b1de7751c0a97d5ae0aef6bef4 | C++ | Mike-droid/EjerciciosDeCplusplus | /Funciones en c++/Ejercicio 19 funciones.cpp | WINDOWS-1250 | 691 | 3.875 | 4 | [] | no_license | /*Ejercicio 19: Realice una funcin recursiva que sume los primeros n enteros positivos
Nota: para plantear la funcin recursiva tenga en cuenta que la suma puede expresarse
mediante la siguiente recurrencia:
suma(n)=1 ,si n=1
n+suma(n-1) ,si n>1
*/
#include<iostream>
#include<conio.h>
using namespace std;
int ... | true |
d55667b9fce55798b76dc15a18bb6adcc094af1a | C++ | issaiass/Turtlesim_Simple_Planner | /src/pid/pid.cpp | UTF-8 | 4,059 | 2.6875 | 3 | [] | no_license | /*
*******************************************************************************
* DATA ACQUISITION SYSTEMS, S.A.
* PANAMA, REPUBLIC OF PANAMA
*
* File : pid.cpp
* Progremmer(s) : Rangel Alvarado
* Language : C++
* Description : A simple PID c... | true |
39fa3db106a5517878c10c732ba2b097177893da | C++ | PanYicheng/PlanetSystem | /PlanetSystem/particle_generator.cpp | UTF-8 | 5,894 | 2.515625 | 3 | [] | no_license | /*******************************************************************
** This code is part of Breakout.
**
** Breakout is free software: you can redistribute it and/or modify
** it under the terms of the CC BY 4.0 license as published by
** Creative Commons, either version 4 of the License, or (at your
** option) any la... | true |
bb250d5e6f481051e0ddd1b299a4a175ecc0ab02 | C++ | WorkingXXX/Jexer | /Test_Shader.cpp | UTF-8 | 2,032 | 2.546875 | 3 | [] | no_license |
#include <iostream>
#include "JexerWindow.h"
#include "JexerShaderProgramCreator.h"
using namespace std;
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "glfw3.lib")
#pragma comment(lib, "glew32.lib")
enum VAO_IDs
{
Triangles,
NumVAOs
};
enum Buffer_IDs
{
ArrayBuffer,
NumBuffers
};
enum Attrib_IDs
... | true |
bdb49e594303ad9f7350f45bcb712c5bc13cff75 | C++ | santiago-iturriaga/cloud-cdn | /GlobeTraff/webproxysim/gdnode.h | UTF-8 | 714 | 2.90625 | 3 | [] | no_license | //gdnode.h
#ifndef GDNODE_H
#define GDNODE_H
#include <stdlib.h>
class GDNode {
public:
GDNode(unsigned int initId, unsigned int initSize) //constructor
{ id = initId; size = initSize; right = NULL; }
~GDNode() {} //the destructor
unsigned GetFileId() { return id; }
unsigned GetFileSize() { return siz... | true |
991350865719670f0a00316c9e0645737cc00dd8 | C++ | alisw/AliPhysics | /PWGCF/FEMTOSCOPY/AliFemto/AliFemtoV0Cut.h | UTF-8 | 1,482 | 2.734375 | 3 | [] | permissive | ///
/// \file AliFemtoV0Cut.h
///
#ifndef AliFemtoV0Cut_hh
#define AliFemtoV0Cut_hh
#include "AliFemtoTypes.h"
#include "AliFemtoV0.h"
#include "AliFemtoXi.h"
#include "AliFemtoParticleCut.h"
/// \class AliFemtoV0Cut
/// \brief The pure virtual base class for the V0 cut
///
/// All V0 cuts must inherit from this one... | true |
f26f7376ffe8ce03dfe2ae9638ca0c0f57c06a5a | C++ | SJSU-AD/FusionAD | /arduino/can_gateway/lib/ros_lib/geographic_msgs/GeoPath.h | UTF-8 | 2,334 | 2.546875 | 3 | [
"MIT"
] | permissive | #ifndef _ROS_geographic_msgs_GeoPath_h
#define _ROS_geographic_msgs_GeoPath_h
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "std_msgs/Header.h"
#include "geographic_msgs/GeoPoseStamped.h"
namespace geographic_msgs
{
class GeoPath : public ros::Msg
{
public:
t... | true |
bcad00bedee903aeb9e2e34df02638c00904dab0 | C++ | matanaliz/ShellExt | /core/win/FileImpl.cpp | UTF-8 | 3,113 | 2.671875 | 3 | [] | no_license | #include <sstream>
#include <fstream>
#include <Logger.h>
#include <ThreadPool.h>
#include "FileImpl.h"
FileImpl::FileImpl(const std::wstring& path)
: m_path(path)
, m_date(L"")
, m_size(0)
, m_sizeKb(0)
{
}
FileImpl::~FileImpl()
{
}
unsigned long long FileImpl::computeSum()
{
unsigned long long sum = 0;
std... | true |
a7c8333a873ea3b43e6ade787ea8e86b13d65a77 | C++ | kuangrenxuezhe/primary-election | /deps/include/util/coding_UT_List.h | UTF-8 | 5,399 | 2.796875 | 3 | [] | no_license | // U_List.h
#ifndef _UNIVERSAL_LIST_S_H_
#define _UNIVERSAL_LIST_S_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "UT_Allocator.h"
#define max_val(a,b) (((a) > (b)) ? (a) : (b))
#define min_val(a,b) (((a) < (b)) ? (a) : (b))
template <class T_Key>
struct _Node_... | true |
47390e59939ef4097f87c2ddcce6c8059a3c9e3a | C++ | ryannowen/TNAP | /Client/Light.hpp | UTF-8 | 2,064 | 2.828125 | 3 | [] | no_license | #pragma once
#include "Entity.hpp"
#include "ExternalLibraryHeaders.h"
namespace TNAP {
struct SLightData
{
private:
static unsigned int s_amountOfLightData;
public:
Transform m_transform;
glm::vec3 m_colour{ 1, 1, 1 };
float m_intensity{ 1 };
virtual void sendLightData(const GLuint argProgram)
{
... | true |
bff5cc5cb0e8bfe784a8cf77dc795b9004e22473 | C++ | mattytheb/C-Bjarne-Stroustrup-Exercises | /Chap 4/drill 4.7a.cpp | UTF-8 | 1,332 | 3.296875 | 3 | [] | no_license | #include "std_lib_fac.h"
int main()
{
double value = 0;
double max = 0;
double min = 0;
double conv = 0;
char unit = ' ';
cout << "Enter a value followed by a unit; c, m, i or f: \n";
while (cin >> value >> unit)
switch (unit)
{
case 'c':
{conv = value;}
break;
case 'm'... | true |
942991022a1ada8141ad8c7dd879d3126a12eb8a | C++ | ZongoForSpeed/ProjectEuler | /problemes/probleme390.cpp | UTF-8 | 1,226 | 3.140625 | 3 | [
"MIT"
] | permissive | #include "problemes.h"
#include "arithmetique.h"
#include "utilitaires.h"
#include "racine.h"
typedef unsigned long long nombre;
ENREGISTRER_PROBLEME(390, "Triangles with non rational sides and integral area") {
// Consider the triangle with sides √5, √65 and √68. It can be shown that this triangle has area 9.
... | true |
bb13096663fc65b4a94a2739186ab4c2619bc5e3 | C++ | JeonByeungGeol/BGIocpServer | /BGIOAcceptThread.h | UHC | 604 | 2.546875 | 3 | [] | no_license | #pragma once
#include "BGIOThread.h"
class BGIOObject;
class BGIOAcceptThread : public BGIOThread
{
public:
BGIOAcceptThread(HANDLE hAcceptEvent, BGIOObject* pServer);
virtual ~BGIOAcceptThread();
/** ԼԴϴ.*/
virtual void Run();
/** 尡 ϱ ȣǴ ԼԴϴ.*/
virtual void OnTerminate();
protected:
/**
ù ° sel... | true |
fd162dac49137ae3a47f3c014a4832d8fd8c99de | C++ | zachng1/zftp | /utilities.cpp | UTF-8 | 478 | 2.6875 | 3 | [] | no_license | #include "utilities.hpp"
namespace ZUtil{
std::vector<std::string> stringSplit(std::string string, std::string delim) {
std::vector<std::string> result;
std::string token;
size_t pos;
while (!string.empty()) {
pos = string.find(delim);
if (pos == string.npos) {
result.push_b... | true |
9efb0951e4496c84e1ec9b3d08b17b1237990f3f | C++ | qqbbtt/FlightNight | /Classes/GameEnemy.cpp | UHC | 5,424 | 2.640625 | 3 | [] | no_license | #include "GameEnemy.h"
USING_NS_CC;
/*Scene* GameEnemy::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = GameEnemy::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}*/
//... | true |
5a753fb18710ce62cc9b83cb34196c0d0bf69180 | C++ | Devansh-Sood/Stack_interviewbit | /area_histogram.cpp | UTF-8 | 1,909 | 3.015625 | 3 | [] | no_license | int Solution::largestRectangleArea(vector<int> &A) {
// stack<int> s;
// int max_area = 0;
// int tp;
// int area_with_top;
// int n=A.size();
// int i = 0;
// while (i < n)
// {
// if (s.empty() || A[s.top()] <= A[i])
// s.push(i++);
// ... | true |
d43f8a32c148e75530eb80a4f927127b35b2d193 | C++ | graceli/DRsample | /source/manipulate_force_database.h | UTF-8 | 5,395 | 2.65625 | 3 | [] | no_license | /*
* This header file contains routines that are used by analyze_force_database and joinFDBs
*/
#include "force_database_class.h"
#include "read_input_script_file.h"
int read_in_database(const struct analysis_option_struct *opt, const struct script_struct *script, struct database_struct *db, const struct nominal_s... | true |
826577e5a6be7ebbe6581ec0122e1cd1e5b41a9d | C++ | bryceroni9563/BYU-CS-236-Code | /Parameter.cpp | UTF-8 | 494 | 3 | 3 | [] | no_license | #include "Parameter.h"
Parameter::Parameter() {
type = "";
value = "";
}
Parameter::Parameter(string tokenType, string val) {
type = tokenType;
if (type == "STRING")
isConstant = true;
else
isConstant = false;
value = val;
}
string Parameter::getValue() {
retur... | true |
daa888956838beee274a1f1df228738a170fb3c6 | C++ | JohnnyGuye/TPs | /TP_C++2/sources/TrafficData.h | UTF-8 | 2,379 | 2.984375 | 3 | [] | no_license | /*************************************************************************
TrafficData - description
-------------------
start : 21 octobre 2015
copyright : (C) 2015 by Quentin "Johnny" Guye and Louis Mer
***********************... | true |
f781ff4844d86b7a4722e869e75fd397fede16a3 | C++ | 898311543/worship_stm32 | /实验54 综合测试实验/NES/mapper/086.cpp | UTF-8 | 898 | 2.578125 | 3 | [] | no_license |
/////////////////////////////////////////////////////////////////////
// Mapper 86
void NES_mapper86::Reset()
{
// set CPU bank pointers
set_CPU_banks(0,1,2,3);
set_PPU_banks(0,1,2,3,4,5,6,7);
}
void NES_mapper86::MemoryWriteSaveRAM(uint32 addr, uint8 data)
{
if(addr == 0x6000)
{
uint8 chr... | true |
d9feb63f85b99cbd7e363b4306de9f7d29122866 | C++ | hizani/ShittyEngine2D | /core/src/components/SpriteComponent.h | UTF-8 | 1,363 | 2.578125 | 3 | [] | no_license | #ifndef SPRITECOMPONENT_H
#define SPRITECOMPONENT_H
#include <SDL2/SDL.h>
#include "../TextureManager.h"
#include "../AssetManager.h"
#include "./TransformComponent.h"
#include "../Animation.h"
#include <vector>
#include <string>
class SpriteComponent : public Component
{
private:
TransformComponent... | true |
8ec588e5d04ffe0d8f1ae1502afa5020b90d1fa7 | C++ | nikhiljha261/Algorithm | /BUCKET.cpp | UTF-8 | 1,289 | 2.890625 | 3 | [] | no_license | // a[i]/(t+1) neighbour element
class Solution {
public:
bool containsNearbyAlmostDuplicate(vector<int>& a, int k, int t) {
int n=a.size();
int maxi=INT_MIN;
for(int i=0;i<n;i++)
{
maxi=max(maxi,a[i]);
}
int sz=maxi/(t+1);
vector<int> bucket(sz+1)... | true |
df8839fd1f1bf2f58a8c406fa55a366c09e065b2 | C++ | pedrojfs17/FEUP-MNUM | /Praticas/TP7/GaussJacobi.cpp | UTF-8 | 1,219 | 3.5 | 4 | [] | no_license | #include <iostream>
using namespace std;
double first(double x2, double x3) {
return (7 - x2 - x3) / 3;
}
double second(double x1, double x3) {
return (4 - x1 - 2*x3) / 4;
}
double third(double x2) {
return (5 - 2*x2) / 5;
}
int main()
{
double x1 = 0, x2 = 0, x3 = 0;
double nextx1, nextx2, nextx3;
//Gauss-J... | true |
d939f0b81286e155959c1f04ac61c14feaaeb77b | C++ | bigplik/Arduino_mac | /REBREATHER_NEEDS/testy_menu_z_case/testy_menu_z_case_2_ino/testy_menu_z_case_2_ino.ino | UTF-8 | 2,240 | 2.8125 | 3 | [] | no_license | const int buttonPin = 2; // the pin that the pushbutton is attached to
int ocena1 = 1; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0;
void setup(){
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop(){
button... | true |
c1e50098171c3b509797a8ca3c946f4a2fc14cf3 | C++ | ALasib/Algorithms | /lazy propagation.cpp | UTF-8 | 1,578 | 3.015625 | 3 | [] | no_license | #include<bits/stdc++.h>
#define mx 100015
int arr[mx];
using namespace std;
struct info
{
int prop;
int sum;
}tree[4*mx];
void init(int node,int b,int e)
{
if(b==e)
{
tree[node].sum=arr[b];
tree[node].prop=0;
return;
}
int left=node<<1;
int right=left+1;
int m... | true |
21057ab2c464d0bfb42a3d001622303d9a71ab48 | C++ | notorious94/UVa-solution | /11332 UVA.cpp | UTF-8 | 611 | 2.8125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
char digit[5000];
int sum()
{
int sum=0;
for(int i=0;digit[i]!='\0';i++)
sum+=(digit[i]-'0');
sprintf(digit,"%d",sum);
return sum;
}
int main()
{
//freopen("d:\\in.txt", "r", stdin);
//freopen("d:\\out.txt", "w", stdout);
int s;
... | true |
dca23845009e82a75b61d928756487945ff07f2d | C++ | allenfromu/Spreadsheet | /Client/server.cpp | UTF-8 | 2,914 | 2.734375 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
using namespace std;
int equal(char *first, char* second){
cout<<first[0]<<endl;
cout<<second[0]<<en... | true |
8823a4863165e0c8882349cb961daa79769a2bf4 | C++ | smhx/codelib | /data_structures/range_bit.cpp | UTF-8 | 1,110 | 3.6875 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
template <typename T>
struct bit {
vector<T> b;
bit() {
}
bit(int N) {
b = vector<T>(N + 5);
}
// Returns the sum of all elements in the range [1, x]
T sum(int x) {
T res = 0;
for (; x; x -= x & -x) res += b[x];
... | true |
a590eed2a5d63dc616124abf514ec9ec5d91aff5 | C++ | AH911UA/CPP_Again | /Day11/main.cpp | UTF-8 | 2,705 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
bool IsPolindrom(std::string);
int qVowels(std::string);
std::string GetUpperString(std::string);
std::string LineWithSpace(const std::string[], const int sizeArray);
int GoodDay(const std::string);
int main()
{
std::cout << " Enter the string 1 : ";
... | true |
6657883d6a58a26591ad4f24b44e9fa69b2568b6 | C++ | ellaprogrammer/binaryHeap | /priorityqueue.cpp | UTF-8 | 7,181 | 3.625 | 4 | [] | no_license | /**
* ECS 60 -- Project 2
* Max PriorityQueue Class IMPLEMENTATION
* Author: Kevin Trujillo && Ella Queen
*
* Implemented as an array-based binary heap with the root node at index 1 of the array.
* The keys are non-negative integers
*/
#include "priorityqueue.h"
#include <iostream>
priorityqueue::priorityqueue(int m... | true |
9aa84e5c9ee23f584a1d7cc5459ce31d8e946742 | C++ | Pranshu258/SkylineQuery_Algorithms | /src/bnl.cpp | UTF-8 | 5,842 | 2.953125 | 3 | [] | no_license | // Implements the Block Nested Loop Algorithm for Skyline Queries
// Author: Pranshu Gupta
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <ctime>
#include <list>
#include <chrono>
using namespace std;
using namespace std::chrono;
struct point {
int* attributes;
... | true |
894d1a7420efb787471d6fbc28e6a73ac5681bd0 | C++ | xzrunner/uniaudio | /include/uniaudio/Source.h | UTF-8 | 1,291 | 2.84375 | 3 | [
"MIT"
] | permissive | #ifndef _UNIAUDIO_SOURCE_H_
#define _UNIAUDIO_SOURCE_H_
#include <cu/uncopyable.h>
#include <memory>
namespace ua
{
class Decoder;
class Source : private cu::Uncopyable
{
public:
Source();
Source(const Source&);
Source(const Decoder& decoder);
virtual ~Source() {}
virtual std::shared_ptr<Source> Clone() = 0;... | true |
9192c93c6f8a5047d9f062cc965ad77503be1d34 | C++ | ksw1220/BOJ-Problem-Solving | /2467.cpp | UTF-8 | 845 | 2.8125 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
#define MAX 2000000000
using namespace std;
vector<int> arr;
int ansLeft, ansRight, opt = MAX;
int isOptimal(int left, int right)
{
int re;
int now = re = arr[left] + arr[right];
if (now < 0)
now *= -1;
if (opt > now)
{
opt = now;
ansLe... | true |
466340fc0b832f13238b85937bd46e6e11c8ea0d | C++ | Abbabara/Verkefni-2 | /VerklegtNamskeid_vikuv2/src/models/employee.cpp | UTF-8 | 413 | 3.515625 | 4 | [] | no_license | #include "employee.h"
Employee::Employee(string name, string ssn){
this->name = name;
this->ssn = ssn;
}
string Employee::get_name(){
return this->name;
}
string Employee::get_ssn(){
return this->ssn;
}
ostream& operator << (ostream& out, Employee& employee){
out << "Name: " << e... | true |
16dc19c3a47c3f3b6994187bd10d8dd6779d93ec | C++ | JmirY/Playground | /include/playground/object.h | UTF-8 | 1,995 | 2.78125 | 3 | [
"MIT"
] | permissive | #ifndef OBJECT_H
#define OBJECT_H
#include "geometry.h"
#include "physics/body.h"
#include "physics/collider.h"
#include "graphics/opengl/glm/glm.hpp"
#include "graphics/shape.h"
/* 전방 선언 */
class Playground;
class Object
{
public:
friend class Playground;
protected:
unsigned int id;
Geometry geometry;
... | true |
9b57584fd7f380cfa3e6146815574cfe6554fb6b | C++ | rrti/liquidity | /coor_tuple.hpp | UTF-8 | 2,657 | 3.140625 | 3 | [] | no_license | #ifndef LIQUIDITY_COOR_TUPLE_HDR
#define LIQUIDITY_COOR_TUPLE_HDR
#include <algorithm> // std::{min,max}
#include <cassert>
#include <cmath> // std::{sqrt,sin,cos}
#include <cstring> // mem{set,cpy}
#include <initializer_list>
namespace math {
template<typename type, size_t size>
struct t_tuple {
public:
// note... | true |
ea736f3d952ce66d1f90a72619c5bf0d3e21c494 | C++ | catch4/yisoo | /week_11/7432_디스크-트리.cpp | UHC | 1,207 | 3.28125 | 3 | [] | no_license | // 7432 ũ Ʈ
/*
map ̿
ó \ depth depth ߴ ʰ
-> Ǯ Ͽ ذ.
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
int n;
string path[501];
map<string, bool> m;
vector<string> split(string str) {
vector<string> ret;
string temp;
for (int i = ... | true |
5c64e351f08cb9227b48d5d713ff1a5a5354d6df | C++ | aisenn/avm | /Stack.cpp | UTF-8 | 4,711 | 3.265625 | 3 | [] | no_license | #include "Stack.hpp"
//**********************************************
//* CONSTRUCTOR / DESTRUCTOR *
//**********************************************
Stack::Stack( void ) {}
Stack::~Stack( void ) {
auto rend = this->rend();
for (auto rit = this->rbegin(); rit != rend; rit++)
delete *rit;
}
//***... | true |
40c6bc480ef108ef6c8d5dc308ad9fe0375e1250 | C++ | kzlotekprogrammer/Marian | /Marian/Entity.cpp | UTF-8 | 1,333 | 2.578125 | 3 | [] | no_license | #include "Entity.h"
Entity::Entity(b2World * t_world, sf::Vector2f t_positionSFML, int t_rect_x, int t_rect_y)
{
//data
world = t_world;
rect_x = t_rect_x;
rect_y = t_rect_y;
//singleton data
texture = SingletonData::getSingletonData().getTexture();
if(!(SingletonData::getSingletonData().i... | true |
3425a34bedaeada166c97e847b046c4acbb502f8 | C++ | parvmor/da | /da/link/perfect_link.cc | UTF-8 | 4,687 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <da/link/perfect_link.h>
#include <chrono>
#include <cstring>
#include <functional>
#include <mutex>
#include <shared_mutex>
#include <sstream>
#include <string>
#include <da/executor/scheduler.h>
#include <da/process/process.h>
#include <da/socket/udp_socket.h>
#include <da/util/logging.h>
#include <da/util... | true |
d7de7e76feef8b4d761af4a9f8c6b1ef7be77e4b | C++ | user-ZJ/cpplib | /code/ModernCpp/8_lambda/13_variadic_base.cpp | UTF-8 | 868 | 3.34375 | 3 | [
"MIT"
] | permissive |
#include <iostream>
#include <memory>
#include <vector>
using namespace std;
struct WidgetA{
double x;
};
struct WidgetB{
double y;
double z;
};
struct WidgetC{
double u;
double v;
double w;
};
template<class...Base>
struct Object: Base...{
};
// template<class T1>
// struct Object: T1... | true |
33f171ba55193a6c205ae221378c596e72e54928 | C++ | Bruteforceman/cp-submissions | /codeforces/1078/A.cpp | UTF-8 | 1,043 | 2.9375 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
struct point {
double x, y;
point () {}
point (double x, double y) : x(x), y(y) {}
void in () {
cin >> x >> y;
}
};
double man(point a, point b) {
return fabs(a.x - b.x) + fabs(a.y - b.y);
}
double dist(point a, point b) {
double dx = a.x - b.x;
double dy = a.y ... | true |
30b7b06581e5c453af86fdc7b24bc599cbafc0bb | C++ | Biswajee/Codestore | /Numberofgoodpairs.cpp | UTF-8 | 320 | 2.828125 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int numIdenticalPairs(vector<int>& nums) {
unordered_map<int, int> mp;
for(int x : nums) {
mp[x]++;
}
int good_pairs = 0;
for(auto a : mp) {
good_pairs+=((a.second*(a.second-1))/2);
}
return good_pairs;
}
}; | true |
ad8aa712f28cecb9164a8058433d5b898781781e | C++ | weimingtom/tanuki-mo-issyo | /プログラム/Ngllib/include/Ngl/IXMLFile.h | SHIFT_JIS | 2,070 | 2.640625 | 3 | [] | no_license | /*******************************************************************************/
/**
* @file IXMLFile.h.
*
* @brief XMLt@CC^[tF[X.
*
* @date 2008/07/23.
*
* @version 1.00.
*
* @author Kentarou Nishimura.
*/
/******************************************************************************/
#ifnd... | true |
d40e1f800375c4b4e041270a5795502c5788c8ba | C++ | nishimotz/dmcpp | /facerecog.cpp | UTF-8 | 2,935 | 2.515625 | 3 | [] | no_license | #include "facerecog.h"
bool FaceRecog::loadModels(void)
{
const string cascadeName =
"/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml";
const string nestedCascadeName =
"/usr/local/share/opencv/haarcascades/haarcascade_mcs_eyepair_small.xml";
if( !cascade.load( cascadeName ) ) {
... | true |
394e06e5d46dc2b6edc92b25a955981ceed9805c | C++ | mamepika426/Atcoder | /atcoder_problems/C_数を三つ選ぶマン.cpp | UTF-8 | 343 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
vector<int> num(5,0);
for(int n=0;n<5;n++) cin >> num[n];
if(num[0]+num[3]<num[1]+num[2]) cout << num[1] + num[2] + num[4] << endl;
else cout << num[0] + num[3] + num[4] << ... | true |
7c3494fb7007ee451671cb9062c822970a1dfce5 | C++ | kalejos/CS-200 | /Lab04b-Dynamic Arrays/Lab4bpart3.cpp | UTF-8 | 976 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main()
{
string ears[3] = { " ^ ^ ", " n n ", " * * " };
string heads[3] = { " ( o_o ) ", " ( x_x )" , " ( >_< ) " };
string bodies[3] = { "/( )\\", "\\( )/", "o( )o" };
string feet[3] = { " d b ", ... | true |
38d18c1c911a66667539d069364b6c5ab340c75c | C++ | arximboldi/zug | /zug/transducer/take_nth.hpp | UTF-8 | 1,556 | 2.71875 | 3 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// zug: transducers for C++
// Copyright (C) 2019 Juan Pedro Bolivar Puente
//
// This software is distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
//
#pragma once
#include <zug/compose.hpp>
#include <zug/state_wrapper.hpp>
#inc... | true |
4ccecfc995bf3f8ed934c7ec010274ba359d8338 | C++ | SterbenDa/NYOJ-Linda | /语言入门/就我不坑/Untitled1(1).cpp | WINDOWS-1252 | 3,209 | 3.03125 | 3 | [] | no_license | #include "iostream"
using namespace std;
int main(){
int a[15];
string number[10]={"","Ҽ","","","","","½","","",""};
string wei[]={"","ʰ","","Ǫ"};
string s;
int i,n;
while(cin>>s){
int num=s.length();
bool flag=0;
for(i=0,n=num-1;i<num;i++,n--){
a[n]=s[i]-'0';
}
if(num<=4... | true |
1235148a6d1dfb8858a6f0a538508e83fe69bd46 | C++ | luismoax/Competitive-Programming---luismo | /SPOJ_ACCEPTED/FACTCG2.cpp | ISO-8859-1 | 1,108 | 2.75 | 3 | [] | no_license | /*
Author: Luis Manuel Daz Barn (LUISMO)
Problem: FACTCG2
Online Judge: SPOJ
Idea: Nice Problem. Use Eratostenes' sieve and store in position i the minimun prime number
which divides i.
*/
#include<bits/stdc++.h>
// Types
#define ll long long
#define ull unsigned long long
// IO
#define sf scanf
#defin... | true |
cea2e442758427e54a13e25e8c3dfe97542c5abe | C++ | nishgpt/competitive_programming | /spoj/ADAGAME4.cp | UTF-8 | 1,244 | 2.515625 | 3 | [] | no_license | #include "bits/stdc++.h"
#include<signal.h>
using namespace std;
#define LL long long int
#define MAX 20000007
#define LIM 20000007
//d[i][0] = number of divisors of number i
//d[i][1] = number i after being divided by some prime divisors
//int d[MAX][2];
int ans[MAX];
int numdiv[MAX];
int prime[MAX];
void sieve() ... | true |
3106ea501faacd0c5a21f874773336662d426bb6 | C++ | mastewal/Data-Structure-Labs | /Lab7/main.cpp | UTF-8 | 3,466 | 4.03125 | 4 | [] | no_license | /* Lab#: 7
Course: CS 5123
Name: Mastewal Abawa
A program that will create a hash table using the following collusion handling techniques
- linear probing
- double hashing
- chaining
The program also calculate the number of collisions, the total steps to place each element
and the total number of entry
*/
#include "... | true |
004d798c59884ab645e46351afe58741cba6a0cc | C++ | tudocomp/tudocomp | /include/tudocomp/compressors/lcpcomp/compress/NaiveStrategy.hpp | UTF-8 | 1,961 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <vector>
#include <tudocomp/Algorithm.hpp>
#include <tudocomp/ds/IntVector.hpp>
#include <tudocomp/ds/TextDS.hpp>
#include <tudocomp/compressors/lzss/LZSSFactors.hpp>
namespace tdc {
namespace lcpcomp {
/// A very naive selection strategy for LCPComp.
///
/// TODO: Describe
class NaiveStrateg... | true |
4764c961364440938a0291e241ad7da6861697cd | C++ | umerfarooqpucit/Object-Oriented-Programming | /Assignments/C-String Library assignment/string4.cpp | UTF-8 | 592 | 3.328125 | 3 | [
"MIT"
] | permissive | /* NAME: MUHAMMAD UMER FAROOQ
ROLL NUM: BCSF15M025
*/
#include<iostream>
using namespace std;
int main()
{
//variable for length of string
int len,
//variable for no of words
no_words=1;
//array for string
char st[50];
cout<<"Enter a sentence:";
cin.getline(st,50);
//loop to calculate length of string
for(... | true |
10ef855d5e646bcb6272ecf7dbedd7cfe67e94a4 | C++ | elffer/sdce | /term_2/P4 PID Control Project /src/PID.cpp | UTF-8 | 1,089 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "PID.h"
/**
* TODO: Complete the PID class. You may add any additional desired functions.
*/
PID::PID() {}
PID::~PID() {}
void PID::Init(double Kp_, double Ki_, double Kd_) {
/**
* TODO: Initialize PID coefficients (and errors, if needed)
*/
Kp = Kp_;
Ki = Ki_;
Kd = Kd_;
cte_pre = 0.0;
... | true |
a4ca808f969f551d0e2fd018227d90de45d504c0 | C++ | tal-shadmi/CompHw5 | /AST.hpp | UTF-8 | 9,823 | 2.625 | 3 | [] | no_license | #ifndef _AST_H
#define _AST_H
#include <string>
#include <vector>
#include <memory>
#include <utility>
#include "SymbolTable.hpp"
#include "bp.hpp"
using std::unique_ptr;
using std::move;
using std::vector;
using std::string;
namespace AST {
using Type = SymbolTable::Type;
class Node {
protected:
... | true |
fd25a3f5fa62dc707eda0b678607b26ae7c59239 | C++ | BobKerns/Altoid-Box-MIDI | /lib/Menu/Menu.h | UTF-8 | 947 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* @copyright Copyright (c) 2021 Bob Kerns
* License: MIT
*/
#pragma once
#include "lcdgfx.h"
template<class T>
class Menu {
public:
const uint8_t count;
private:
const char * const * items;
uint8_t selection;
bool wrap_items = false;;
static const uint8_t top = 0... | true |
7ddcd1ed8de1b432a7d3ea48110af9f56fc643f7 | C++ | DPS0340/DoItDataRithm | /01/Q17.cpp | UTF-8 | 249 | 2.984375 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
void spira(int n) {
for(int i=1;i<=n;i++) {
for(int j=0;j<n-i;j++) {
cout << " ";
}
for(int j=0;j<=(i-1)*2;j++) {
cout << "*";
}
cout << endl;
}
}
int main() {
spira(4);
return 0;
} | true |
6b2f2327cc33ad5e7d1b38725f2da35f3d5ededc | C++ | tbarnabas/web_scraper | /datastructure/datastructure_cpuffer.h | UTF-8 | 3,286 | 2.625 | 3 | [] | no_license |
/////////////////////////////////////////////////////////////////////////////
//
// datastructure_cpuffer.h - ::DATASTRUCTURE::CPuffer<T> class header
// --------------------------------------------------------------------------
//
// DATASTRUCTURE
//
///////////////////////////////////////////////////////////... | true |
a8dc9e86bb78d46b1d25bcdb4bb85e6d254748e9 | C++ | mangesh-kurambhatti/Cpp-Programms | /cpp/day2/15. Accept and Input functions using pointers and reference .cpp | UTF-8 | 767 | 3.671875 | 4 | [] | no_license | #include<iostream>
using namespace std;
void AcceptInput(int *ptr); // by address
void Printoutput(const int *ptr);
void AcceptInput(int &ptr); // by reference
void Printoutput(const int &ptr);
int main(void)
{
int no1;
// call by address
AcceptInput(&no1);
Printoutput(&no1);
// call by reference
AcceptInput(no... | true |
716b2f875a10f527ed418c0f44223e63079a9843 | C++ | gwqw/LeetCodeCpp | /Algorithms/medium/355_design_twitter.cpp | UTF-8 | 7,685 | 3.671875 | 4 | [] | no_license | /**
355. Design Twitter
Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in the user's news feed.
Implement the Twitter class:
- Twitter() Initializes your twitter object.
- void postTweet(int userId, int tweetId) Compose... | true |
2b0b69488c14a133ba43ddad2f6a113e4b074711 | C++ | alexandraback/datacollection | /solutions_5688567749672960_0/C++/mikasa/a.cpp | UTF-8 | 1,014 | 2.5625 | 3 | [] | no_license | #include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#define pb push_back
#define mkp make_pair
using namespace std;
const int maxn = 1000001;
int vis[maxn];
int q[maxn];
int rev(int x)
{
int r = 0;
while(x)
{
int t = x%10;
r = 10*r + t;
x/=10;... | true |
8d336ad9e50e153ed25905bb5dbb99ac6523d5fd | C++ | gamehero10/csc305-fall2018-lab3 | /src/process.cpp | UTF-8 | 1,810 | 3.15625 | 3 | [] | no_license | #ifndef PROCESS
#define PROCESS
class Process {
public:
Process(int, int, int, int);
~Process();
/*
GETTERS
*/
int getId();
int getArrival();
int getPriority();
int getExecution();
int getStart();
int getCompletion();
int getTurnaround();
/*
SETTERS
*/... | true |
b9e94341665097839148619dea1c1abd56685ad4 | C++ | carlosgalvezp/DD2425_ht14_ras_utils | /include/ras_utils/ras_utils.h | UTF-8 | 2,904 | 2.84375 | 3 | [] | no_license | #ifndef RAS_UTILS_H
#define RAS_UTILS_H
#include <ctime>
#include <sys/time.h>
#include <vector>
#include <queue>
#include <math.h>
#include "ros/ros.h"
#include <ras_srv_msgs/Command.h>
#include <ras_utils/ras_names.h>
#include <algorithm>
#define PRINT_PADDING 5
namespace RAS_Utils
{
int sign(double a);
double t... | true |
aa9b7026fce1b38eb00607c0833f0c0561985f17 | C++ | ARM-software/armnn | /samples/common/src/Audio/MFCC.cpp | UTF-8 | 11,197 | 2.609375 | 3 | [
"BSD-3-Clause",
"CC0-1.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "MFCC.hpp"
#include "MathUtils.hpp"
#include <cfloat>
#include <cinttypes>
#include <cstring>
MfccParams::MfccParams(
const float samplingFreq,
const int numFbankBins,
const float ... | true |
91cde0ba47b19d1082cc87422639b786cea88e15 | C++ | rvignesh/disk-sim | /main.cpp | UTF-8 | 8,971 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <set>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <map>
#include <fstream>
#include <queue>
#include <cassert>
extern "C" {
#include "genzip.h"
}
#define CACHE_POLICY 0
#define EVICT_POLICY 0
using namespace std;
int find_max_index... | true |
7731763185b4d82a2a74e390ae6e1727217a3199 | C++ | lamlemonpie/EDA | /EDA_Lab3/bTree.h | UTF-8 | 1,949 | 3.25 | 3 | [] | no_license | //
// bTree.h
// EDA
//
// Created by Alejandro Larraondo on 9/4/18.
// Copyright © 2018 Alejandro Larraondo. All rights reserved.
//
#ifndef bTree_h
#define bTree_h
#include "bNode.h"
#include <fstream>
#include <stdio.h>
using namespace std;
template<class T>
class bTree {
bNode<T> * m_pRoot;
public:
... | true |
8e7fffdbe7271c8f8186dbf6168c94dd68dfedae | C++ | bqqbarbhg/adventofcode | /2015/23/jit.cpp | UTF-8 | 2,856 | 2.6875 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include "jit.h"
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <stdint.h>
struct InstReloc
{
uint32_t off;
uint32_t inst;
};
typedef void jitFunc(VM*);
struct JIT
{
char *code;
uint32_t off;
uint32_t *instOff;
uint32_t numInst;
InstReloc *instRelocs;
u... | true |
117007cca35b4d97ca3e3b389eb42c978df395e1 | C++ | commshare/easyhttpcpp | /include/easyhttpcpp/Headers.h | UTF-8 | 2,357 | 2.890625 | 3 | [
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"Zlib",
"OpenSSL",
"BSD-3-Clause",
"BSL-1.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* Copyright 2017 Sony Corporation
*/
#ifndef EASYHTTPCPP_HEADERS_H_INCLUDED
#define EASYHTTPCPP_HEADERS_H_INCLUDED
#include "Poco/AutoPtr.h"
#include "Poco/ListMap.h"
#include "Poco/RefCountedObject.h"
#include "easyhttpcpp/HttpExports.h"
namespace easyhttpcpp {
/**
* @brief A Headers collect request and res... | true |
2ef11b9e9bdcfbf1be118baca30e4572d93df5a2 | C++ | Aman0002/Leetcode | /longest-common-subsequence/longest-common-subsequence.cpp | UTF-8 | 644 | 2.859375 | 3 | [] | no_license | class Solution {
public:
int longestCommonSubsequence(string text1, string text2) {
int n = text1.size();
int m = text2.size();
int **a = new int*[n+1];
for (int i =0 ;i <= n ;i++)
{
a[i] = new int[m+1];
for (int j =0 ;j... | true |
e39a281cbe8fd72f5cffe6c7f379e53b19f48a75 | C++ | simpsont-oci/event_dispatcher | /ProactorSystemTimer.cpp | UTF-8 | 2,541 | 2.53125 | 3 | [] | no_license | #include "ProactorSystemTimer.h"
ProactorSystemTimer::ProactorSystemTimer(ProactorEventDispatcher* ped) : shutdown_(false), timer_id_(INVALID_TIMER), ped_(ped) {}
ProactorSystemTimer::~ProactorSystemTimer() {
std::unique_lock<std::mutex> lock(mutex_);
shutdown_ = true;
if (timer_id_ != INVALID_TIMER) {
ped... | true |
7f67e4f973b65d7dff806290209779cbb3a55a0b | C++ | alexzanderr/ProgrammingProblems | /infoarena/cmmdc/solutie.cpp | UTF-8 | 489 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
typedef unsigned long long ULL;
ULL cmmdc(ULL a, ULL b) {
unsigned long long rest;
while(b) {
rest = a % b;
a = b;
b = rest;
}
return a;
}
int main() {
ifstream in("cmmdc.in");
ULL a, b;
in >> a;
in >> b;
in.close(... | true |
9083997fccbaa346ac4ad235bd4cd838fdb325f9 | C++ | xunzhang/lcode | /leetcode/roman-to-integer.cc | UTF-8 | 670 | 3.125 | 3 | [] | no_license | class Solution {
public:
Solution() {
table['I'] = 1;
table['V'] = 5;
table['X'] = 10;
table['L'] = 50;
table['C'] = 100;
table['D'] = 500;
table['M'] = 1000;
}
int romanToInt(string s) {
if(s.size() == 1) return table[s[0]];
int result = 0;
for(size_t i = 0; i < s.size() ... | true |
ef44c337769dac3a85008fbec953e1e83f25d1ae | C++ | BenjaminDurante/Capstone | /Main_Code/Main_Code.ino | UTF-8 | 3,022 | 2.953125 | 3 | [] | no_license | /*
Main vehicle code
For questions contact: benjamin.durante@ucalgary.ca
*/
//Initializing the various classes used in this main code
#include "Pot.h"
#include "Pressure.h"
#include "SDCard.h"
#include "LoadCell.h"
#include "MotorControl.h"
#include "PIDControl.h"
#include "VtoP.h"
#include "SpeedData.h" //Comme... | true |
aa78c372ceae43b4144ae9a377f67451aee59251 | C++ | marbrb/practice-contest | /URI/1550.cpp | UTF-8 | 1,191 | 2.78125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef vector <int> vi;
int level[10001];
bool vis[10001];
void bfs(int a, int b, vi *adj) {
vis[a] = true;
level[a] = 0;
queue<int> q;
q.push(a);
while(!q.empty()) {
int v = q.front();
q.pop();
for (int i=0; i< adj[v].size(); ... | true |
c644a5f158d0a4855b48a76324674da4371ec4d6 | C++ | kk-katayama/com_pro | /atcoder/abc/abc154/abc154c.cpp | UTF-8 | 398 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
map<int,int> mp;
int n;
bool f = true;
cin >> n;
rep(i,n){
int a;
cin >> a;
if(mp[a]>0) f = false;
mp[a]++;
... | true |
6531eb656880d89fc067972675475bdfd53df0bd | C++ | xchmwang/algorithm | /leetcode/leetcode212/word_searchII.cpp | UTF-8 | 3,391 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
using namespace std;
const int CHSIZE = 30;
typedef struct TrieNode {
bool is_word;
TrieNode *next[CHSIZE];
TrieNode(): is_word(false) {
memset(next, 0, sizeof(next));
}
}TrieNode;
const int dir[][2] = {... | true |
1b0e758f6d700841b1fe425ed609fa8621b0dbbb | C++ | juliano7s/box | /main.cpp | UTF-8 | 1,969 | 2.65625 | 3 | [] | no_license |
#include <iostream>
#include <cstdio>
#include <assert.h>
#include <list>
#ifdef _WIN32
#include <Windows.h>
#define SLEEP Sleep(3000)
#else
#define SLEEP usleep(500000)
#endif
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "Matrix.h"
#include "Vector2.h"
#include "Rectangle.h"
#include "TileBase.h"
#incl... | true |
325d547ea8bae06ec4754cb5e851e44e367ce6c1 | C++ | Awaken0406/network | /socket/socket/multi_thread.cpp | UTF-8 | 641 | 3.109375 | 3 | [] | no_license | #ifndef _WIN32
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int sum = 0;
void* thread_summation(void* arg)
{
int start = ((int*)arg)[0];
int end = ((int*)arg)[1];
while (start <= end) {
sum += start;
start++;
}
return NULL;
}
int main(int argc, char* ar... | true |
c3ae6d389362a7b9c7c859b97a853593e097193f | C++ | ArtemGomer/ProgrammingOnCpp_NSU | /EvmPu/Lab1.cpp | UTF-8 | 811 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <random>
#include <time.h>
using namespace std;
class pi {
private:
static float getNumber() {
return (rand() / (float) RAND_MAX) * (rand() % 2 == 0 ? 1 : (-1));
}
public:
static float printPi(int N) {
unsigned long long inCircle = 0;
for (int i = 0; i ... | true |
db16288e55a158d7bd95a5fb789b7a0e1044bfbf | C++ | AmiArnab/PolyNTT | /CPP/fp.cpp | UTF-8 | 1,425 | 2.90625 | 3 | [] | no_license | #include "fp.h"
mpz_class FP::P = mpz_class{"536903681",10};
FP::FP()
{
this->x.set_str("0",10);
}
FP::FP(mpz_class x)
{
mpz_mod(this->x.get_mpz_t(),x.get_mpz_t(),this->P.get_mpz_t());
}
FP::~FP()
{
this->x.set_str("0",10);
}
FP FP::operator=(FP v)
{
this->x = v.x;
return v;
}
FP FP::operator+... | true |
33977264bf9355ea9bfc8264e00193149c80bdaf | C++ | chencorey/TopCoder | /SRM396/DNAString.cpp | UTF-8 | 1,105 | 3.1875 | 3 | [] | no_license | // https://community.topcoder.com/stat?c=problem_statement&pm=8584&rd=12168
// This problem was used for:
// Single Round Match 396 Round 1 - Division I, Level One
// Single Round Match 396 Round 1 - Division II, Level Two
#include <string>
#include <vector>
using namespace std;
class DNAString
{
public:
int minCh... | true |
2d88b8ca0b2591bd0f5857f11097e84b4b0caf6c | C++ | Palfore/Evolution-WildFire | /src/Simulation/Creatures/Types/StickBall.cpp | UTF-8 | 10,962 | 2.640625 | 3 | [] | no_license | #include "StickBall.h"
#include "utility.h"
#include "Genome.h"
#include "NodeGene.h"
#include "MuscleGene.h"
#include "BoneGene.h"
#include "AxonGene.h"
#include "Logger.h"
#include "Ball.h"
#include "Piston.h"
#include "Shapes.h"
#include <limits>
static Vec* get_head_location(const std::vector<Ball*>& nodes) {
... | true |
db31c25394dbe70f7d6c7b27b20bafb62184d5b3 | C++ | YeonWon123/2019_Winter_Data_Structure | /Week 8/준규/이중연결리스트.cpp | UTF-8 | 1,699 | 3.203125 | 3 | [] | no_license | #include <iostream>
using namespace std;
typedef struct _node {
int data;
struct _node* next;
struct _node* prev;
} Node;
int main(void)
{
Node nodeArr[100];
int N, M; // 2 <= N <= 100, 0 <= M <= 10
cin >> N >> M;
nodeArr[0].prev = NULL;
nodeArr[N - 1].next = NULL;
for (int i = 0; i < N; i++)
{
cin >... | true |
d5bff491283463e653b1f01c8135cbc5903c9e08 | C++ | iiabaloongroup/cutdown_mechanism | /write_zeros_eeprom.ino | UTF-8 | 275 | 2.765625 | 3 | [] | no_license | #include<EEPROM.h>
unsigned int read_bytes = 1000;
void setup()
{
Serial.begin(115200);
delay(5000);
}
void loop()
{
unsigned int i;
for (i=0;i<read_bytes;i++)
{
EEPROM.write(i,0);
delay(10);
}
Serial.print("Done formatting");
while(1);
}
| true |
5191ee45d331a3a14504416d1834e6a90facf379 | C++ | NarutoCoder/CompetitveProgramming | /C++/Fundamentals/SalaryCount.cpp | UTF-8 | 562 | 3.296875 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
int main() {
double basic_Salary;
char allow;
cin>>basic_Salary>>allow;
int grade;
if(allow == 'A'){
grade = 1700;
}else if(allow == 'B'){
grade = 1500;
}else{
grade = 1300;
}
double hra = b... | true |
f2cfba9be5f2177c17b67c7c81e797f84017049c | C++ | Torrizo/C- | /BinaryTree.cpp | WINDOWS-1252 | 2,291 | 3.484375 | 3 | [] | no_license | #include<iostream>
#include<queue>
#include<stack>
using namespace std;
struct BinaryTreeNode
{
int m_value;
struct BinaryTreeNode* m_left;
struct BinaryTreeNode* m_right;
};
struct BinaryTreeNode* CreateBinaryNode(int value)
{
struct BinaryTreeNode*pNode = new BinaryTreeNode();
pNode->m_value = val... | true |
609a8714266bbd4fb98051f19ccfd68ce08f9882 | C++ | alexandraback/datacollection | /solutions_2449486_1/C++/ltaravilse/B.cpp | UTF-8 | 2,269 | 2.53125 | 3 | [] | no_license | #include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<string>
#include<vector>
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define dforn(i,n) for(int i=(int)n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
using namespace std;
in... | true |
2ed3c1c6787d3e2f5e8ceccf5abfbe7d484541bb | C++ | frozenMustelid/pfsb | /src/pfMeta.hpp | UTF-8 | 1,798 | 2.84375 | 3 | [] | no_license | #ifndef PFMETA_HPP
#define PFMETA_HPP
#include <string>
using namespace std;
/* I'd prefer it if all enums are referred to by specifying the enum it came
* from. I think namespace is probably the wrong term for this, and something
* about "scoped" seems like it could be somehow confusing. Whatever the term
* for ... | true |
9c13fd7c47d0df51b7efbd875a948417cd8f0dda | C++ | softdream/robot_underlying | /robot/rikirobot_stm32-keil/RosLibs/riki_msgs/Battery.h | UTF-8 | 1,617 | 2.59375 | 3 | [] | no_license | #ifndef _ROS_riki_msgs_Battery_h
#define _ROS_riki_msgs_Battery_h
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
namespace riki_msgs
{
class Battery : public ros::Msg
{
public:
typedef float _battery_type;
_battery_type battery;
Battery():
battery(0)
... | true |
214af22c705f4ebf78e3295b776a5aa3ca6f2b05 | C++ | prankurgit/PUF_Toolkit | /PUF_Toolkit/PUF_Settings.cpp | UTF-8 | 31,892 | 2.90625 | 3 | [] | no_license | #include "PUF_Settings.h"
/*
* PUF-ToolKit - Settings
*
* Author: Sebastian Schurig
*
* Setting Functions for the PUF-ToolKit
*
*/
unsigned int SetInputLen(struct Item *item)
/*
* Function to calculate the input_length based on the offsets
* make sure the offsets and it1->input_file_name are initialized befo... | true |
7107df0d9cb982bec2cf52fcb0998975e1fa9c21 | C++ | Asega1996/POO | /Segovia_Gallardo_Alejandro/P4/usuario-pedido.hpp | UTF-8 | 766 | 2.65625 | 3 | [] | no_license | #ifndef USUARIO_PEDIDO_HPP_
#define USUARIO_PEDIDO_HPP_
#include "usuario.hpp"
#include "pedido.hpp"
using namespace std;
class Pedido;
class Usuario;
class Usuario_Pedido {
public:
typedef set<Pedido*> Pedidos;
typedef map<Usuario*, Pedidos> UsuarioP;
typedef map<Pedido*, Usuario*> PedidoU;
void asocia(... | true |
bbeacefa154add2d04b686767fa05fc724da9959 | C++ | cyendra/ACM_Training_Chapter_One | /还是汉诺塔/main.cpp | UTF-8 | 359 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int f[50][2]={0};
int n;
f[1][0]=2;
f[1][1]=1;
while (scanf("%d",&n))
{
for (int i=2;i<=n;i++)
{
f[i][0]=(f[i-1][0]+f[i-1][1])*2;
f[i][1]=f[1][0];
}
printf("%d\n",(f[... | true |
310de222b83bff93abb06ab3fc9c7dd4f7d2ea5e | C++ | eytienne/esiee-cpp | /src/tp3/mystring.cpp | UTF-8 | 1,253 | 3.328125 | 3 | [
"MIT"
] | permissive | #include "./mystring.hpp"
#include <cstdio>
#include <cstring>
#include <iostream>
#include <sstream>
mystring::mystring(int len, const char *data) {
this->len = len;
this->data = new char[len];
strncpy(this->data, data, len);
}
mystring::mystring(const char *init) : mystring((int)strlen(init), init) {}
mystring:... | true |
e21ce95bc69d11b923a533b143795ca31b9f33a9 | C++ | Rezarys/ProjetXML_1 | /bus.h | UTF-8 | 562 | 3 | 3 | [] | no_license | #ifndef BUS_H
#define BUS_H
#include <string>
using namespace std;
class Bus
{
private:
string name;
int nb_ports;
int bandwith;
string type;
public:
Bus();
Bus(string name, int nb_ports, int bandwith, string type);
/** Accesseurs et mutateurs **/
string getName() const;
void se... | true |
99508f12341d8fcbdc002d60867ab722f8bb03b0 | C++ | KasiaS999/PO1 | /lab6/src/Sum.cpp | UTF-8 | 236 | 3.21875 | 3 | [] | no_license | #include "Sum.h"
Sum :: Sum( Primitive& A, Primitive& B):_A(A), _B(B){}
void Sum ::print() const {
std::cout<<"(";
_A.print();
std::cout<<"+";
_B.print();
std::cout<<")";
}
float Sum ::v() const {
return _A.v()+_B.v();
} | true |
0106bd6da4634f203cd4c58af0f49fb71b553614 | C++ | Daratrixx/cpp-gl4-engine | /src/ScriptNode.h | UTF-8 | 1,382 | 2.625 | 3 | [] | no_license |
#ifndef SCRIPTNODE_H
#define SCRIPTNODE_H
#include "Types.h"
union ScriptValue {
Integer integer;
Real real;
String str;
Point point;
Region region;
void* object;
};
class ScriptNode {
public:
ScriptNode() {
}
~ScriptNode() {
}
virtual ScriptNode* c... | true |