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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5ac34af8c3093bc2ef1dc5342fee76a13e66bcb9 | C++ | ShiqiHe000/DG_wave_c | /src/dg_unit.cpp | UTF-8 | 1,855 | 2.734375 | 3 | [] | no_license | #include "dg_unit.h"
#include "dg_param.h"
#include <vector>
/// @brief
/// constructor (default).
/// default: level = 0, n = min poly order, m = max poly order
/// index = {0, 0, 0}, mpi_f = false, x/ycoords = {0.0, 0.0}
/// solution = nullptr.
Unit::Unit() : n(grid::nmin), m(grid::nmin)
{
facen = std::vector<std... | true |
53cf6df3c8dfe45c62c9a1f0ab06897091465aba | C++ | JPedroSilveira/projeto-robotica-para-a-vida | /Clube de Robótica - Botão e Buzzer/Clube de Robica - Bot苚 e Buzzer/botao_basico/botao_basico.ino | UTF-8 | 475 | 2.765625 | 3 | [
"MIT"
] | permissive | const int botao = 7;
const int led = 13;
int leitura_botao = 0;
void setup() {
Serial.begin(9600);
pinMode(botao, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
leitura_botao = digitalRead(botao);
Serial.println(leitura_botao);
if(leitura_botao == 1){
digitalWrite(led, HIGH);
//se o botao... | true |
fd487b1568cde3a473812f0892cfa4ec4efd1372 | C++ | wyattwhiting/CS162 | /programs/program05/LinkedList.cpp | UTF-8 | 12,925 | 3.671875 | 4 | [] | no_license | /******************************************************
** File: LinkedList.cpp
** Author: Wyatt Whiting
** Date: 2020-12-02
** Description: linked list class implementation
******************************************************/
#include <iostream>
#include <stdlib.h>
#include <ctime>
#include <cstring>
#i... | true |
63cba1512a7b33adc145f09671e7b214d4542aa1 | C++ | zoozooll/glsamples | /sampleB_8_3/src/main/jni/hellocpp/MyCompoundShape.cpp | GB18030 | 3,416 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #include "MyCompoundShape.h"
MyCompoundShape::MyCompoundShape(
btDynamicsWorld* dynamicsWorld,
btScalar mass,
btVector3 pos,
float restitutionIn,
float frictionIn,
int texId_capusleSide,//Ҳid
int texId_buttomBall,//ײԲid
int texId_topBall,//Բid
int texId_bottomCircle,//ײԲεid
int texId_topCircle,//Բε... | true |
a6648432d60b584c2c0b0a01733cd6a1287e5fa4 | C++ | gaolichen/contest | /homework/p279_3/p279_3.cpp | UTF-8 | 434 | 3.125 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
double f(double x,double y){
return x+y;
}
void runge_kutta(int n,double x,double y,double h,double (*f)(double,double)){
double k1,k2,k3,k4;
printf("y(%.1lf) = %.2lf\n",x,y);
if(n==0)return ;
k1=f(x,y);
k2=f(x+h*0.5,y+h*0.5*k1);
k3=f(x+h*0.5,y+h*0.5*k2);
k4=f(x+h,y+h*k3);
... | true |
1d250ee5673b6739d70176ea2bd187e199690f13 | C++ | francoisludewig/MecaSolid | /Tests/Solid/TestSolid.cpp | UTF-8 | 8,757 | 2.765625 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <cmath>
#include <fstream>
#include "../Resource/DoublePrecision.h"
#include "Solid/Solid.h"
#include "Basis.h"
using namespace std;
using namespace Luga::Meca::Solid;
TEST(Solid,UpdatePositionTranslation){
Solid s;
Vector v(M_PI,M_PI/2,M_PI/4);
double dt = 0.0001;
s.Velocity(v... | true |
4c5f942f096745d258cd345097223914ecfabc95 | C++ | vasoov/arduino-dht11-ldr-lcd | /arduino-dht11-lcd2004-ldr.ino | UTF-8 | 1,722 | 2.890625 | 3 | [
"MIT"
] | permissive | //Read temperature, humidity and brighness sensors
#include <dht.h>
#include <LiquidCrystal_I2C.h>
//LCD display is defined as device number 0x27 on the I2C bus
LiquidCrystal_I2C lcd(0x27, 20, 4);
//DHT11 is connected to pin 8
dht DHT;
#define sensorPinDHT11 8
//Light sensor is connected to analog 0
#d... | true |
d8468a06006b4a39f35a1788655f7b06781a534d | C++ | houjing1/Example | /crazyflie_sim/src/motorDynamics.cpp | UTF-8 | 693 | 2.609375 | 3 | [] | no_license | /*
* motorDynamics.cpp
*
* Created On : 28/06/18
* Author : Jingyuan Hou
* Email : jingyuan.hou@mail.utoronto.ca
*/
#include "crazyflie_sim/motorDynamics.h"
// Static data memeber
Parameter MotorDynamics::param;
// Compute 4 motor output rpm from 4 motor ouput pwm
// Input: motor_pwm as 4 by 1 [moto... | true |
94d862c0c4d21ae7f64bf309f6660e98ff6639b2 | C++ | KamikazeChan/Contest | /Regional 2014/2014 Beijing Online/HDU 5037 Frog.cpp | UTF-8 | 1,432 | 2.71875 | 3 | [] | no_license | /*
** HDU 5037 Frog
** Created by Rayn @@ 2014/09/22
*/
#include <cmath>
#include <cstdio>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
inline int nextInt()
{
char ch = getchar();
bool flag = false;
while((ch < '0'... | true |
49266bf9d3c3c0906859e9d1b9859306c5d8a8a8 | C++ | thegamer1907/Code_Analysis | /Codes/AC/534.cpp | UTF-8 | 715 | 2.671875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <iostream>
using namespace std;
bool perfect(int x) {
... | true |
a1e86356f8be23af5469ea43ddb69110d0c9fc2e | C++ | touhiduzzaman-tuhin/computer-graphics-C-Plus-Plus-projects-university-life | /blink1/main.cpp | UTF-8 | 1,501 | 2.71875 | 3 | [] | no_license |
#include <windows.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <stdio.h>
#include <math.h>
float p = -10;
int state = 1;
bool direction=true;
int k;
void circle(GLfloat rx, GLfloat ry, GLfloat cx, GLfloat cy)
{
glBegin(GL_TRIANGLE_FAN);
glVertex2f(cx, cy);
for(int i = 0; i <= 101; i++)
{
... | true |
cefd84dd6f00e9896430aebaee112ef6b5982dd1 | C++ | Blawker/Kassiopeia | /KEMField/Source/Math/Array/include/KFMPointwiseArrayMultiplier.hh | UTF-8 | 1,885 | 2.75 | 3 | [] | no_license | #ifndef KFMPointwiseArrayMultiplier_H__
#define KFMPointwiseArrayMultiplier_H__
#include "KFMBinaryArrayOperator.hh"
namespace KEMField
{
/**
*
*@file KFMPointwiseArrayMultiplier.hh
*@class KFMPointwiseArrayMultiplier
*@brief
*@details
*
*<b>Revision History:<b>
*Date Name Brief Description
*Fri Sep 28 15:39:37 EDT ... | true |
bde20444f3468b0aa790ce667333384a6dfb66b1 | C++ | heyzwming/HumanHungry | /HumanHungry/myskill/src/Shoot.cpp | UTF-8 | 10,216 | 2.953125 | 3 | [] | no_license | /********************************************************************
* *
* 射门函数函数名: Shoot *
* 实现功能: 射门,朝向位置是按照场上球门的位置做相应的逻辑获得的 *
* *
* *
* 返回参数 无 *
* *
********************************************************************/
#in... | true |
4e6051eba814fe6cef67fbe0543ba2bf8144be20 | C++ | sturdevant/736_p2 | /nodes/Cluster.h | UTF-8 | 913 | 2.609375 | 3 | [] | no_license |
#ifndef _CLUSTER_H_
#define _CLUSTER_H_
#include <string.h>
#include <float.h>
#include <vector>
#include "Point.h"
#include <iostream>
#define N_DIMENSION 2
class Point;
class Cluster {
public:
Cluster(Point* pt, unsigned long id);
Cluster(unsigned long id);
~Cluster();
void addPt(Point* pt);
void ... | true |
e0d9ef25eb499ee15ed1e32ec1dc7ed430431959 | C++ | CS231/c-primer-plus | /chcount.cpp | UTF-8 | 258 | 3.1875 | 3 | [] | no_license | #include<stdio.h>
#define PERIOD '.'
int main(void)
{
int ch;
int charcount = 0;
while((ch = getchar()) != PERIOD)
{
if(ch != '\"' && ch != '\'')
charcount++;
}
printf("There are %d non-quote characters.\n", charcount);
return 0;
}
| true |
3769cdd8532b4d266fa771fecfab312f3fc338a1 | C++ | ldionne/sandbox | /static_optional.hpp | UTF-8 | 2,952 | 2.890625 | 3 | [] | no_license | /*!
* @file
* This file defines `dyno::detail::static_optional`.
*/
#ifndef DYNO_DETAIL_STATIC_OPTIONAL_HPP
#define DYNO_DETAIL_STATIC_OPTIONAL_HPP
#include <boost/operators.hpp>
#include <boost/spirit/include/classic_safe_bool.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace dyno {
namespace det... | true |
6f65eb723e27a3b1a3e4e1b7f8e9d5ad1826f2ff | C++ | nischay123/cplusplusprograms | /recursion/mersort.cpp | UTF-8 | 916 | 3.296875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void merge(int a[] ,int s,int mid ,int e){
int n1 = mid-s +1;
int n2 = e-mid;
int n =e-s+1;
int temp[n];
int i=s;
int j=mid+1 ;
int k=0;
while(i<=mid && j<=e){
if(a[i]<a[j]){
temp[k] = a[i];
i++;
k++;
}
else if(a[i]>=a[j]){
temp[k] = a[j];
j+... | true |
fd66fd1a3ebfb965a8f8500faf636174ef4f84b9 | C++ | rowensimpson/5th_Group_Project | /Serial.ino.ino | UTF-8 | 465 | 2.953125 | 3 | [] | no_license | // arduino serial feeder code
int data[500];
int bob = 0;
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
// set up the time range
for(int n = 0; n <= 499; n++)
data[n] = n;
// passing the data through
for(int i = 0; i <= (sizeof(data)/sizeof(int))-1; i++)
{
i... | true |
7a7516650311b2817ac0d459c9ff7b5761328d04 | C++ | Childcity/MultithreadedUdpReceiver | /Common/Protocol/Message.cpp | UTF-8 | 1,603 | 2.6875 | 3 | [
"MIT"
] | permissive | //
// Created by childcity on 14.09.20.
//
#include "Message.h"
#include "packing.h"
#include "../Utils.hpp"
void Message::Pack(Message &inMsg, unsigned char *outBuff)
{
inMsg.MessageSize = sizeof(Message);
packi16(outBuff, (uint16_t)inMsg.MessageSize);
*(outBuff + 2) = (uint8_t)inMsg.MessageType;
p... | true |
f980b79875ef004f217f1c42cc188ba53017dd1a | C++ | MrJiu/eBox_Framework | /example/5.uart/5.command_frame.cpp | GB18030 | 2,486 | 2.625 | 3 | [
"MIT"
] | permissive | /**
******************************************************************************
* @file main.cpp
* @author shentq
* @version V1.2
* @date 2016/08/14
* @brief ebox application example .
******************************************************************************
* @attention
*
* No par... | true |
8689135b95b9dc039487fbfb4cb6f7fb2556085e | C++ | NaioTechnologies/MMeteo | /src/DHT.cpp | UTF-8 | 5,618 | 2.890625 | 3 | [] | no_license | /* DHT library
MIT license
written by Adafruit Industries
*/
#include "DHT.h"
#include "Logger.h"
#include "Types.h"
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count)
{
_pin = pin;
_type = type;
_count = count;
firstreading = true;
oldhum = 666;
oldtemp = 666;
}
void DHT::begin(void)
{
// set up the pins... | true |
c9291f7cfd97e9860ceb48ac3cfe69f292f47f7a | C++ | nibalizer/cs162 | /program3.cpp | UTF-8 | 1,863 | 3.21875 | 3 | [] | no_license | // Spencer Krum
// CS162
// Karla Fant
// Program 3
// DBAD License
// Oct 23, 2010
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "file.cpp"
#include "index.cpp"
#include "program3.h"
using namespace std;
int main () {
intro();
/* file file1;
file file2;
file1.readfile();
f... | true |
46fcf33f2c39e0db6e8c14230d41bb27129f5a89 | C++ | AlexeiVazquez/Funciones | /Introduccion/suma.cpp | UTF-8 | 304 | 3.4375 | 3 | [] | no_license | #include <iostream>
void suma(int,int);
using namespace std;
int main(){
int a,b;
cout<<"Introduce el valor 1:";
cin>>a;
cout<<"Introduce el valor 2:";
cin>>b;
suma(a,b);
return 0;
}
void suma(int a,int b){
int c=a+b;
cout<<"El resultado de "<<a<<"+"<<b<<" es:"<<c<<endl;
}
| true |
f266a0533b39b54ad4204cb3bbbe307fd9d56c58 | C++ | Bab95/Programs | /LeetCode/Problems/769.Maximum_Chunks_to_Make_Sorted.cpp | UTF-8 | 854 | 2.65625 | 3 | [] | no_license | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
int n = arr.size();
vector<int> group(n,-1);
for(int i=0;i<n;++i){
//find min val from right for this..
int val;
if(group[i]!=-1){
val = group[i];
}else{
... | true |
2c85db76f492c31771ae0ccc6abee206a6a9780e | C++ | KFlaga/FlagRTS | /GameCore/UnitWeaponSet.h | UTF-8 | 1,995 | 2.875 | 3 | [] | no_license |
#pragma once
#include <Array.h>
#include "DataTypes.h"
namespace FlagRTS
{
class Unit;
class Weapon;
class WeaponDefinition;
class CommandTarget;
// Set of weapons that unit can use
// Except storing them also determines which weapons to use against target
// Stores and switches active weapon -> attack stat... | true |
e5d5c706d6ff1d3a9bbcc34e6de4958aaa412c89 | C++ | stone725/CompetitiveProgramming | /AtCoder/abc141/abc141_d.cpp | UTF-8 | 496 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<int> a(n);
for (auto &&i : a)
{
cin >> i;
}
priority_queue<int> b(begin(a), end(a));
for (int i = 0; i < m; i++)
{
b.push(b.top... | true |
926c673f33c1108b684dea17da6be739c310a97e | C++ | kyle620/Bluetooth-Windows-App | /BluetoothGUI/BluetoothGUI/bluetoothgui.cpp | UTF-8 | 5,488 | 2.8125 | 3 | [] | no_license | #include "stdafx.h"
#include "bluetoothgui.h"
#include <QtCore>
#include <QString>
#include <QtGui>
using std::find;
using namespace Qt;
BluetoothGUI::BluetoothGUI(QWidget *parent)
: QMainWindow(parent),bled_connectionSatus(false)
{
ui.setupUi(this);
}
BluetoothGUI::~BluetoothGUI()
{
}
/* This method gets calle... | true |
297460c0c8db1c1d3a4d040bd7c3c40c25dd0e2d | C++ | RuiLiu1217/Practice | /move/_0583_DeleteOperationForTwoStrings.cpp | UTF-8 | 3,209 | 3.578125 | 4 | [] | no_license | #include "headers.hpp"
/*
Now, dp[i][j]dp[i][j] refers to the number of deletions required to
equalize the two strings if we consider the strings' length upto (i-1)^{th}
index and (j-1)^{th} index for s1 and s2 respectively. Again, we fill
in the dp array in a row-by-row order. Now, in order to fill the entry
for d... | true |
dd83d5682e441c4d46048fed11a74e3f0f345a3c | C++ | haigaz15/Intro_To_OOP | /C++HomeWork/FirstQuestion/FirstQuestion.cpp | UTF-8 | 393 | 3.34375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int n;
int sum = 0;
cout << "Enter your number: " << endl;
cin >> n;
for (int i = 2; i < n; i++) {
if (i % 2 != 0) {
sum = sum + i;
}
}
cout << "The sum is: " << sum << endl;
system("pause");
return 0;
}
// largest value for n if it is int is... | true |
d8d2fe0f831e849549d417751091d53da483144f | C++ | IITamas/Spoj-Programs | /6694.cpp | UTF-8 | 243 | 2.734375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
/*
Problem:D-playing with Marbles
Programmer:Iles Illes Tamas
Date:2019.04.25
*/
int main()
{
int k;
while (cin>>k&&k!=0)
{
k++;
cout<<(3*k*k-k)/2<<endl;
}
return 0;
}
| true |
ada40bdfada9ff6f66bc027ae03eb4ee1c38b74f | C++ | kkwoo0620/Hello-World | /DataStructure/DataStructure/practice.cpp | UHC | 1,030 | 4.09375 | 4 | [] | no_license | #include<iostream>
using namespace std;
int Factorial(int n)
{
if (n == 1)
return 1;
else
return n * Factorial(n - 1);
}
int Fibonacci(int n)
{
if (n == 0)
return 0;
else if (n == 1)
return 1;
else
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
int BSearchRecur(int ar[], int first, int last, int target... | true |
542448286c3ede49b46464a90a0313282c2c7753 | C++ | Thinker222/EricLearnsDataStructures-Algorithms | /Sequence/SequenceTest.cpp | UTF-8 | 637 | 2.828125 | 3 | [] | no_license | #include "Sequence.cpp"
#include <iostream>
#include <cstdlib>
int main()
{
using namespace Data_Structures;
Sequence seq;
Sequence seq2;
for(int i = 0; i < 20; i++)
{
seq.insert(i);
std::cout << seq2.current() << std::endl;
}
for(int i = 0; i < 20; i++)
{
seq2.attach(i);
... | true |
4d0f41825ef73dc488970a69ad1fa876e5cd00c7 | C++ | InvincibleTyphoon/Qt-ExpressJSLogin | /Qt/Qt-ExpressJSLogin/LoginRequester.cpp | UTF-8 | 1,406 | 2.546875 | 3 | [] | no_license | #include "LoginRequester.h"
#include <QEventLoop>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
//singletone patterns
LoginRequester* LoginRequester::instance = new LoginRequester();
LoginRequester* LoginRequester::getInstance(){
return instance;
}
LoginRequester::LoginRequester()
{
s... | true |
522adb88d047aa67c0d5bae9d919c08e76bf303d | C++ | neta-vega/Tetris-Game | /shape.cpp | UTF-8 | 9,009 | 2.578125 | 3 | [] | no_license | #include "player.h"
#include "human.h"
#include "Computer.h"
#include "board.h"
#include "game.h"
#include "menu.h"
#include "point.h"
#include "shape.h"
#include "utils.h"
#pragma warning (disable:4996)
using namespace std;
#include <iostream>
#include <windows.h>
#include <process.h>
#include <conio.h... | true |
ecf79d983dec270a95adc857ae62df7a7f6ff20d | C++ | lihaosheng123/DirectX3D-Tool-Game | /DirectX9/sound.h | SHIFT_JIS | 1,791 | 2.671875 | 3 | [] | no_license | //=============================================================================
//
// TEh [sound.h]
// Author : AKIRA TANAKA
//
//=============================================================================
#ifndef _SOUND_H_
#define _SOUND_H_
//************************************************************************... | true |
0d9669ead1efa12d3336b1d5fc0275e084b4dd65 | C++ | enigmacodemaster/Algorithms_and_dataStructures | /leetcode/leetcode_104_递归.cpp | UTF-8 | 445 | 3.21875 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int maxDepth(TreeNode* root) {
if(root == nullptr)
return 0;
TreeNode* ptr = root;
TreeNode* left_ptr = ptr->left;
TreeNode* right_ptr = ptr->right;
int left_depth = maxDepth(left_ptr);
int right_depth = maxDepth(right_ptr);
... | true |
4c3d0707abc6fbc7ff37573ee31d27cd8f8c7020 | C++ | davschne/accelerated-cpp | /ch06/ex-6-2.cpp | UTF-8 | 1,559 | 3.296875 | 3 | [] | no_license | // 6-2. Write a program to test the `find_urls` function.
#include <iostream>
using std::cout;
using std::endl;
#include <numeric>
using std::accumulate;
#include <string>
using std::string;
#include <vector>
using std::vector;
using vec = std::vector<string>;
#include <unordered_set>
using set = std::unordered_se... | true |
4a25c586fde55f2891361198b8cbc08406c2363e | C++ | dzhemini/Deykstri | /AlgoritmDeykstri/AlgoritmDeykstri/AlgoritmDeykstri.cpp | UTF-8 | 1,820 | 2.6875 | 3 | [] | no_license | /// \file AlgoritmDeykstri.cpp
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<iomanip>
#include<conio.h>
using namespace std;
void read_from_file(int* n,int* start,int*finish,int* ves) ///chtenie faila
{
ifstream f("deikstra.txt");
if(!f) cout<<"File error!\n";
else
{
f >> *n >> *sta... | true |
f7f9d4b59524dd1c29f61e554e8fb39d1bc1d52c | C++ | diogo23/1D_histogram | /main.cpp | UTF-8 | 691 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include "include/utils/utils.h"
#include "include/Histrogram.h"
int main() {
std::cout << "Starting Algorithm!" << std::endl;
HistogramInitValues histogramInitValues = getHistogramInitValues();
Histrogram Histogram(histogramInitValues.configProbabilities, histogramInitValues.colorVect... | true |
800142decf32d6f1a1af30e02ff9231943690065 | C++ | CiprianBeldean/omega-Y | /src/game/Session.cpp | UTF-8 | 986 | 2.578125 | 3 | [] | no_license | #include "Session.h"
#include "Game.h"
#include "../net/NetHost.h"
#include "../net/NetClient.h"
Session::Session(SessionConfig cfg)
: type_(cfg.type) {
if (type_ == SessionType::HOST)
pNetHost_ = new NetHost(cfg.hostPort);
else
pNetClient_ = new NetClient(cfg.hostAddress, cfg.hostPort);
}
Session::~Session() ... | true |
1002ffa483b78e281e1e49623c9afc1a6d1b8b28 | C++ | eliseyOzerov/school | /huffmanCompression/Huffman.h | UTF-8 | 867 | 2.5625 | 3 | [] | no_license | //
// Created by Elisey on 13/05/2019.
//
#ifndef HUFFMANCOMPRESSION_HUFFMAN_H
#define HUFFMANCOMPRESSION_HUFFMAN_H
#include <vector>
#include <fstream>
#include <queue>
#include <iostream>
#include <unordered_map>
class Huffman {
private:
struct Node{
char c;
int weight = 1;
Node* right =... | true |
c780b9aba158740efcdcd02d1651ca81915b6fdc | C++ | nosnosnosnos/paiza | /POH6_sugoroku/POH6_sugoroku/main.cpp | UTF-8 | 989 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <stack>
using namespace std;
unsigned int N,M;
int List[100];
int GOTO[100];
unsigned short chk[100]; //1:true 2:false
void loop(){
for (unsigned int i = 0; i < N; i++){
GOTO[i] = List[i] + i;
}
stack<unsigned int> st;
unsigned int _i = 0;
for (unsigned int i = N - 1; i > 0; i--... | true |
f88b37454036b3ffab186ba2bf0703142a30e4b8 | C++ | arthurWangSuper/C-primer | /Chapter15/vectorwithinhert.cpp | UTF-8 | 579 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <memory>
#include "Quote.h"
using namespace std;
int main(int argc,char**argv)
{
vector<shared_ptr<Quote>> basket;
//Bulk_quote *pBQ = new Bulk_quote(string("Sting"),19.9,10,0.9);
//basket.push_back(make_shared<Quote>("Sting",19.9));
... | true |
ad5cca7f78d18feaeabea4ff3f18bd234320d87e | C++ | rmartella/opencv_projects | /FingerTipTracking/src/TimeManager.cpp | UTF-8 | 1,096 | 2.953125 | 3 | [] | no_license | /*
* TimeManager.cpp
*
* Created on: 24/11/2015
* Author: rey
*/
#include "TimeManager.h"
TimeManager::TimeManager() {
}
TimeManager::~TimeManager() {
}
double TimeManager::CalculateFrameRate(bool writeToConsole) {
// Variables estaticas que almacenan los incrementos del tiempo
static double framesPerS... | true |
a6f23c8e70c756e8204a50b1c9f823acc1d27465 | C++ | weekend27/OfferAlgs | /src/cpp/FirstNotRepeatingChar.cpp | UTF-8 | 451 | 2.765625 | 3 | [] | no_license | class Solution {
public:
int FirstNotRepeatingChar(string str) {
if (str.length() == 0) {
return -1;
}
int hash[256] = {0};
int i = 0;
while (str[i] != '\0') {
hash[str[i]]++;
i++;
}
i = 0;
while (str[i] != '\0') {
... | true |
db731c3cb015ece184aa45aeddfeac90ac445f5c | C++ | kwokth2016/Smart-garden | /smart/smart.ino | UTF-8 | 2,757 | 2.609375 | 3 | [] | no_license | #include <dht.h>
dht DHT;
#define DHT11_PIN 7
#define light A1
#define water A0
#define water2 A2
#define soil A3
#define pump1 4
#define pump2 5
#define ledstrip 8
#define buzzer 9
#define atomizer 10
#define fan1 11
#define fan2 12
void setup(){
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
pinMode(ledstri... | true |
34f8ca35bff50e255b0a5c94ef8fe0ff81168e0b | C++ | farescom/FTIMSGame | /Game/Parser/Syntax.cpp | UTF-8 | 855 | 2.875 | 3 | [] | no_license | #include<iostream>
#include<cstdlib>
#include<vector>
#include<string>
#include<fstream>
#include<conio.h>
//#include "Key_words.h"
#include "Syntax.h"
using namespace std;
//void otworz_plik(string name, vector<string> &wczytane_slowa)
//{
// string linia;
// fstream plik;
//
// plik.open(name,ios::in);
// if(pli... | true |
91eb06f13af0ed8d8f16b7fbde444d9c11377a6f | C++ | corozco10/StubbornPlayer | /main.cpp | UTF-8 | 401 | 2.90625 | 3 | [] | no_license | //Author:Christian Orozco
#include "SecretDoor/SecretDoor.h"
#include <iostream>
using namespace std;
int main()
{
int timeswon;
int number;
SecretDoor game;
cout<<"How many times do you want to play?\n";
cin>>number;
for(int i=0;i<number;i++)
{
game.newGame();
game.guessDoorC();
game.guessDoorC();... | true |
73fcc7493aca48d74dcd2c5e93dbb1a653f1981f | C++ | kemely2018/ADA | /LABORATORIO 7/punto_medio.cpp | UTF-8 | 1,995 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <ctime>
#define MAX_SIZE 8000
using namespace std;
void swap(int *a, int *b){
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int particion(int* A,int p,int r){
int x,i,j,tmp;
x=A[r];
i=p-1;
for(j=p;j<=r-1;j++){
if(A[j]<=x){
i++;
swap(... | true |
cd1028b5599d609af667ade3f4531043cf8d5475 | C++ | Wizmann/ACM-ICPC | /POJ/2/2983.cc | UTF-8 | 1,251 | 2.734375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #include <cstdio>
#include <cstdlib>
#include <cstring>
int n,ask,num;
typedef struct node
{
int from,to,weight;
void setnode(int a,int b,int c)
{
from=a;to=b;weight=c;
}
}node;
node g[200010];
int dis[1010];
int min,max;
bool bellman_ford()
{
for(int i=min;i<=max;i++) dis[i]=1<<20;
dis[min]=0;
bool over... | true |
317a60800bd641244a793adec75e60e30d439a81 | C++ | TejasPatil80178/LeetCode_Problems | /ConstructBinaryTreeFormInorderPostOrderTraversal.cpp | UTF-8 | 1,073 | 3.25 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | true |
a8f078f1c9664c434ebb5701b9b7fe0df6eceb8e | C++ | MarcoBetance0327/C_plus_plus | /14. Archivos/Ejercicio 2.cpp | UTF-8 | 529 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <fstream>
using namespace std;
void lectura();
int main(){
lectura();
}
void lectura(){
ifstream archivo;
string texto, nombreA;
cout<<"Digite el archivo a buscar: "; getline(cin, nombreA);
archivo.open(nombreA.c_str(),... | true |
b3fcb8c6501afc7e3cde8b1843d85f67aa9b1712 | C++ | wongdu/Alsa | /UtilsPoisx.cpp | UTF-8 | 3,808 | 2.84375 | 3 | [] | no_license |
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#include "UtilsPoisx.h"
struct EventStructure
{
pthread_mutex_t mutex;
pthread_cond_t cond;
volatile bool signalled;
bool manual;
};
struct AtomicBoolStruct
{
pthread_mutex_t mutex;
bool value;
};
int EventInit(EventStru **event, en... | true |
6566c0fc5b2883385d477f5501f9f1a106a3696b | C++ | Diren52/Data-Abstraction-and-structures | /WeatherValue/WeatherValuetest.cpp | UTF-8 | 1,945 | 3.515625 | 4 | [] | no_license | #include "WeatherValue.h"
#include <iostream>
void testplan1();
void testplan2();
void testplan3();
void testplan4();
void testplan5();
void testplan6();
using namespace std;
int main()
{
cout << "Test 1: Defualt constructor";
testplan1();
cout << "Test 2:initializing using the default co... | true |
12ab0d9574abbd8543f0d0939891653ca7f716d5 | C++ | ZainabIftikhar/FileSystem | /Folder.h | UTF-8 | 548 | 2.515625 | 3 | [] | no_license | #pragma once
#include <string>
#include "Item.h"
#include <vector>
using namespace std;
class Folder:public Item
{
public:
Folder(string,string);
string getPath(){
return path;
}
void setPointer(Item*);
void Delete();
void DeleteItem(string);
Item* changeDir(string);
bool ifChanged();
vo... | true |
9d363215397b458a54cf89c1901badb1689ec3e9 | C++ | Richie47/kattis | /conundrum.cpp | UTF-8 | 604 | 3.015625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <iomanip>
#include <string>
using std::cin;
using std::cout;
using std::string;
int main(int argc, char** argv) {
int p = 0, e = 1, r = 2, days = 0;
string s;
cin >> s;
for(int i = 0; i < s.length(); i++) {
if(i == p) {
if(s.at(i) != 'P')
days++;
... | true |
bb50b22c8831af0e80347d68f2ff199c502fa47f | C++ | uncerso/MPP | /usd.cpp | UTF-8 | 1,570 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <string>
#include <unistd.h>
#include <thread>
#include <sys/wait.h>
using namespace std;
void sigChildHandler(int signo) {
int status;
while (1) {
... | true |
f340fb0a87c42d833728bb1b8ba12dfd09ae3127 | C++ | HarshitShukla25/leetcode-solutions | /removekdigitstogetsmallestnumber.cpp | UTF-8 | 883 | 2.734375 | 3 | [] | no_license | class Solution {
public:
string removeKdigits(string num, int k) {
int n = num.size();
stack<char> s;
//removing the peak elements
for(char c : num)
{
while(!s.empty() && k>0 && s.top()>c)
{
s.pop();
k--;
... | true |
6ed70dc59275ad68d4c994248dcb8ecf9767e253 | C++ | Enhex/GUI | /src/gui/text_edit.cpp | UTF-8 | 8,874 | 2.515625 | 3 | [
"LLVM-exception",
"Apache-2.0"
] | permissive | #include "text_edit.h"
#include "../include_glfw.h"
#include "../framework/application.h"
text_edit::text_edit()
{
style = element_name;
auto& input_manager = context->input_manager;
input_manager.mouse_press.subscribe(this, [this](int button, int mods) {
on_mouse_press();
});
input_manager.mouse_release.sub... | true |
2351a4045a7f14107e4b1e2f15c10852582c89e1 | C++ | KrishnaSaiTarun/LeetCode | /0101. Symmetric Tree.cpp | UTF-8 | 732 | 3.296875 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isSymmetric(TreeNode* root) {
if(root == NULL) return true;
... | true |
9bc839e7eaa1ee4b730066ad36b6e7c7b70163b2 | C++ | DanDoge/course_pku | /Practice of Data Structure and Algorithm/practice/001-003.cpp | UTF-8 | 1,359 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int prec[4048];
int size = 2000;
int init(){
for(int i = 1; i < 4048; i += 1){
prec[i] = i;
}
return 0;
}
int get_prec(int idx){
return (prec[idx] == idx) ? idx : (prec[idx] = get_prec(prec[idx]));
}
int main(int argc, char const *argv[]) {
std::i... | true |
b1fd40371621869cdc9746b553c9f67f68d47c86 | C++ | spiricn/Wt | /include/wt/gui/Layout.h | UTF-8 | 2,093 | 2.53125 | 3 | [] | no_license | #ifndef WT_GUI_H
#define WT_GUI_H
#include "wt/stdafx.h"
#include "wt/FrameBuffer.h"
#include "wt/gui/View.h"
#include "wt/gui/ProgressView.h"
#include "wt/gui/Button.h"
#include "wt/gui/SliderView.h"
#include "wt/gui/CircleView.h"
#include "wt/gui/Checkbox.h"
#include "wt/gui/ListView.h"
#include "wt/EventManager.h... | true |
cf179c3e15a3cd581011a14d0c790a1d91345611 | C++ | c-chou7/mapDemo | /main.cpp | GB18030 | 2,700 | 3.59375 | 4 | [] | no_license | /*
1. ӡзĿ
2. ӡȵλáٶȵһڽӵ㺣ζҪ͵ĵ㡣дһΪ isValley
ij
3. ҳӡߵ͵λü亣ΡдһΪ extremes ĺ
ijá
4. ĺ isPeak(), ʹ 8 ڽӵжϷ㣬ֻʹ 4 ڽжϡ
*/
#include<iostream>
#include<Windows.h>
#include<fstream>
#include<string>
#define MAXSIZE 64
void isPeak(int grid[MAXSIZE][MAXSIZE], int r, int c);
void isValley(int grid[MAXSIZE][MAXSIZE], int r, int c);
... | true |
8c474dea48127c69a95766a9b520538d5044d67e | C++ | DemyCode/raytracer | /src/scene/object/plane.cc | UTF-8 | 1,608 | 2.984375 | 3 | [] | no_license | //
// Created by mehdi on 19/02/2020.
//
#include "plane.hh"
Plane::Plane(Vector3 point, Vector3 normal, TextureMaterial* textureMaterial)
{
this->point_ = point;
this->normal_ = normal.normalize();
this->textureMaterial_ = textureMaterial;
}
std::optional<Vector3> Plane::intersect(Ray ray) {
// doubl... | true |
c7d16131f99de62797da587ba991b09e1a05b82d | C++ | leagues58/VigenereBreaker | /findKeyLetter.h | UTF-8 | 617 | 2.65625 | 3 | [] | no_license | /**************************
Project 1, CSCE 557
Author: Eric Reeves
Last Modified: 1/25/2016
Header file for findKeyLetter.cpp
*************************/
#ifndef FINDKEYLETTER_H
#define FINDKEYLETTER_H
#include <iostream>
#include <vector>
#include <string>
#include "printVector.h"
#include "translateLetters.h"
u... | true |
18928c2906b3c83b660e6b2b2f2c4825362b513a | C++ | onievui/Fire-Watch | /Game/Arrow.cpp | SHIFT_JIS | 3,159 | 2.890625 | 3 | [] | no_license | #include "Arrow.h"
#include "ResourceManager.h"
#include "RenderManager.h"
#include "Map.h"
/// <summary>
/// RXgN^
/// </summary>
/// <param name="_pos">oW</param>
/// <param name="_angle">is</param>
Arrow::Arrow(const Vector2& _pos, const float _angle)
: state(ArrowState::NORMAL_ARROW)
, pos(_pos)
, vel(Vector2:... | true |
a5d6cdc5fad898eef2c60d5094fb4a911d7fd35d | C++ | A-World/CPPConceptsInterviewPreparation | /boqian/advancedC++/advanced_023.cpp | UTF-8 | 1,445 | 3.9375 | 4 | [] | no_license | /*
Introduction to C++ :
Video : Advanced C++ Define Implicit Type Conversion
Category C Tryout with two classes.
// This program will not compile.
*/
#include <iostream>
#include <string>
using namespace std;
// Forward declaration.
class Two ;
class One
{
pub... | true |
4d042225af762a80b44df2b70b7b532a66e62481 | C++ | Jiwangreal/learn_cpp_with_me | /P75/Calculator/Exception.h | GB18030 | 2,335 | 3.4375 | 3 | [] | no_license | #ifndef _EXCEPTION_H_
#define _EXCEPTION_H_
#include <exception>
#include <string>
//̳exception
class Exception : public std:exception
{
public:
//Ϊ˷ֹת
explicit expException(const char* message) : message_(message)
{
FillStackTrace();
}
explicit expException(const std::string& mess... | true |
03728e789087ef63064e720ca5f9fef1e964c7e3 | C++ | imharsh94/ALGO-DS | /lcs.cpp | UTF-8 | 520 | 2.6875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
string s,t;
int lcs(int m,int n)
{
int l[m+1][n+1];
for(int i=0; i<=m; i++)
{
for(int j=0; j<=n; j++)
{
if(i==0 || j==0)
l[i][j] = 0;
else if(s[i-1] == t[j-1])
l[i][j] = l[i-1][j-1]+1;
else
l[i][j] = max(l[i][j-1],... | true |
736576a107fec0786f8c1eca536d8bab85216d24 | C++ | Rubentxu/Ilargia | /libIlargia/include/core/logicbrick/sensor/Sensor.h | UTF-8 | 1,077 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef ILARGIA_SENSOR_H
#define ILARGIA_SENSOR_H
#include <core/logicbrick/LogicBrick.h>
#include "mathfu/vector.h">
namespace Ilargia {
enum class Pulse { PM_IDLE, PM_TRUE, PM_FALSE };
enum class TapMode { TAP_OUT, TAP_IN };
struct Sensor : LogicBrick {
// Config Values
float frequency... | true |
9cedbc07ce12d143a8c34e082d4251d927ec2456 | C++ | XB32Z/motor_controllers | /include/motor_controllers/motor/dc_motor_factory.h | UTF-8 | 4,386 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive |
/**
* @file dc_motor_factory.h
* @author Pierre Venet
* @brief Declaration of a helper class to construct DC motors from pins
* directly.
* @version 0.1
* @date 2021-05-09
*
* @copyright Copyright (c) 2021
*
*/
#pragma once
#include <motor_controllers/communication/channel_builder.h>
#include <motor_controll... | true |
e7b8f2a93e840dcd958a08db76a5478cb98c62c8 | C++ | Prichman/galaxy_game | /src/actor.cpp | UTF-8 | 855 | 2.96875 | 3 | [] | no_license | #include "actor.h"
#include <iostream>
Actor::Actor()
: speed_(0, 0) {}
Actor::~Actor() {
}
void Actor::LoadSprite(const std::string &path) {
if(!texture_.loadFromFile(path)) {
std::cout << "Can't load texture from \"" << path << "\"" << std::endl;
return;
}
sprite_.setTexture(texture_);
}
void ... | true |
f0b8a135dbbdcc2e24675315dee455bc3c3b15ac | C++ | wowkin2/test-tasks-summer-2012 | /2/pr3.cpp | WINDOWS-1251 | 3,926 | 3.1875 | 3 | [] | no_license | /**
* @file pr3.cpp
* @brief Task2
* @task 3.
: < >, <>, < >.
,
. .
* @author Volodymyr Spodaryk
* @email spodaryk.volodymyr@i.ua
* ----------------------------------------------------------------------*/
#include <vcl.h>
//#include "stdafx.h"
#include <... | true |
81e7134a25ce937f4f8d5008eb6f1f9c253fbddd | C++ | ItaiOz/Chicken-Invaders | /source/Board.cpp | UTF-8 | 953 | 3.109375 | 3 | [] | no_license | #include "Board.h"
Board::Board()
{
m_file.open("levels.txt");
if (!m_file.is_open())
{
throw std::runtime_error("Can't load file");
}
// test file open
// get current line
for (std::string name; getline(m_file, name, '\n');)
{
m_levels.push_back(name);
}
m... | true |
bda43319ef3754d0615d8e750aef22d72bd0d700 | C++ | dguest/susy-analysis | /analysis/src/BtagBuffer.cxx | UTF-8 | 1,063 | 2.625 | 3 | [] | no_license | #include "BtagBuffer.hh"
#include "TTree.h"
#include <stdexcept>
BtagBuffer::BtagBuffer(TTree* tree, std::string branch):
m_has_err(false)
{
set(tree, branch, &m_scale_factor);
std::string err_branch = branch + "_err";
if (tree->GetBranch(err_branch.c_str())) {
set(tree, branch + "_err", &m_scale_factor_er... | true |
c61370966bfd0fd4a4254f5c529bee16d7f6d705 | C++ | TheGupta2012/Data-Structures | /Stacks, Queues, Linked Lists/qlinks.cpp | UTF-8 | 2,039 | 3.640625 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct node
{
int data;
struct node* next;
};
typedef struct node nd;
nd* rear;
nd* front;
class Q
{
public: void insert(int item)
{
nd* temp;
temp=new node;
temp->data=item;
temp->next=NULL;
//impor... | true |
7b21bc0559f9707f4a0e204a4078cd96fa72dc53 | C++ | SuperLiuYinXin/offer | /数据流中的中位数.cpp | UTF-8 | 1,742 | 3.71875 | 4 | [] | no_license | #include <iostream>
#include <queue>
/*****************************/
/* filename: 数据流中的中位数.cpp */
/* abstract:
如何得到一个数据流中的中位数?
如果从数据流中读出奇数个数值,那么中位数就是所有数值排序之后位于中间的数值。
如果从数据流中读出偶数个数值,那么中位数就是所有数值排序之后中间两个数的平均值。
我们使用Insert()方法读取数据流,使用GetMedian()方法获取当前读取数据的中位数。 */
/* author : liuyinxin */
/* time: 2019-02-20 17:26:4... | true |
a030d12c4b8d6310cdecb4e7f973eb6ee1517174 | C++ | swapnilpathak14/C--VS-CODE | /MY C++ JOURNEY/SearchArr.cpp | UTF-8 | 398 | 2.984375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int linearsearch(int arr[],int n, int key){
for(int x=0;x<n;x++){
if(arr[x]==key){
return x;
}
}
return -1;
}
int main(){
int n;
cin>>n;
int arr[n];
for(int x=0;x<n;x++){
cin>>arr[x];
}
int ... | true |
42c06e9bc85ec6aac3237d5bb2e4516a2ed560d9 | C++ | ViktorYastrebov/practice | /practice_cmake_repo/design_patterns/syb_visitor/Syb/TypeAlias.h | UTF-8 | 6,749 | 2.828125 | 3 | [] | no_license | /**
\brief Implement functionality for aliasing types for overloading.
It's needed then we need to redefine behavior of some generic function
for some particular set of fields but not types.
So the user can make type alias and then use it for specializing templates.
*/
#ifndef SYB_TYPE_ALIAS_H
#define SYB_TYPE_ALIAS_H... | true |
c4c3c5514341a42458788c397c8de876008b665c | C++ | Lammatian/AdventOfCode | /2020/24/sol.cpp | UTF-8 | 3,153 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <set>
#include "util.h"
using namespace std;
// https://www.redblobgames.com/grids/hexagons/
// Cube coordinates
struct HexDir {
int x, y, z;
};
bool operator<(const HexDir& h1, const HexDir& h2) {
return h1.x < h2.x
|| (h1.x == h2.x && h1.y < h2.y)
... | true |
a92d75ce499ce69d6110a6b80ba9ad0379328e2b | C++ | rlj1202/problemsolving | /baekjoon/1704_fish_cake_tycoon/main.cpp | UTF-8 | 308 | 2.59375 | 3 | [] | no_license | #include <iostream>
int M, N;
int grid[20][20];
int main() {
scanf("%d %d", &M, &N);
for (int m = 0; m < M; m++) {
for (int n = 0; n < N; n++) {
scanf("%d", &grid[m][n]);
}
}
for (int m = 0; m < M; m++) {
for (int n = 0; n < N; n++) {
printf("%d", 0);
}
printf("\n");
}
return 0;
}
| true |
efef669b29c6040a4e8259b4436ed39ecf67b297 | C++ | f-tischler/ParallelSystems | /Exercise10/mmul/summa_seq.h | UTF-8 | 8,011 | 2.6875 | 3 | [] | no_license | #ifndef SUMMA_SEQ_H
#define SUMMA_SEQ_H
#include "matrix.h"
#include "gsl/gsl"
#include <iostream>
#include "naive_seq.h"
#include <iomanip>
#include <cmath>
struct summa_sequential { size_t blocks = 4; bool print = false; };
template<typename T>
using block_t = std::array<matrix<T>, 3>;
template<typename T>
using ... | true |
0776dd145a54a84f889657aa5b7f9d1f732f5b75 | C++ | AkritiAgarwal09/DSA | /GeeksForGeeks/DP/6. Count Number of Subset with Given Difference/code.cpp | UTF-8 | 938 | 3.0625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int countSubsetSumWithDifference(int arr[], int n, int diff)
{
int sum = 0;
for(int i=0;i<n;i++)
sum += arr[i] ;
int SubsetSum = (diff+sum)/2 ;
int dp[n+1][SubsetSum+1] ;
for(int i=0;i<=SubsetSum;i++)
dp[0][i] = 0;
for(in... | true |
01b5e24adf845c9aaaa194524efc88be846f310c | C++ | stonedcoldsoup/fungus_libs | /libs/fungus_booster/fungus_concurrency/fungus_concurrency_communication.h | UTF-8 | 2,111 | 2.84375 | 3 | [] | no_license | #ifndef FUNGUSCONCURRENCY_COMMUNICATION_H
#define FUNGUSCONCURRENCY_COMMUNICATION_H
#include "fungus_concurrency_common.h"
namespace fungus_concurrency
{
using namespace fungus_util;
class FUNGUSCONCURRENCY_API comm
{
public:
struct FUNGUSCONCURRENCY_API discard_message_callback
{
... | true |
6017d64d781aa8d41fd3d9f8aa153979707fc002 | C++ | ZibeSun/Oj-C | /有点套路的选择结构题 (20分).cpp | GB18030 | 544 | 3.328125 | 3 | [] | no_license | #include<stdio.h>
int main()
{ int x,y;
scanf("%d",&x);
if(x>=2)
{ y=x*x;
}
else if((-2<=x)&&(x<2))
{ y=2*x;
}
else if(x<-2)
{ y=-x*x;
}
printf("%d",y);
return 0;
}
/*Ŀ
ֶκһֱΪѡṹϰ֣ŴѾĿ··ֶκݸxֵ
һx(-100 <= x <= 100)xֵ
ÿf(x)
-3
-9*/
| true |
309789ed52b361390d281153b8eba1c92e7e3a77 | C++ | HarukaSunada/Game | /DungeonGame/game/Sprite.cpp | SHIFT_JIS | 1,793 | 2.703125 | 3 | [] | no_license | #include "stdafx.h"
#include "Sprite.h"
Sprite::Sprite()
{
m_angle = 0;
m_scale = D3DXVECTOR2(1.0f, 1.0f);
m_backColor = D3DCOLOR_ARGB(255, 255, 255, 255);
}
Sprite::~Sprite()
{
Release();
}
void Sprite::Init()
{
D3DXCreateSprite(g_pd3dDevice, &g_pSprite);
D3DXIMAGE_INFO imgInfo; //摜i[p\
m_angle = 0.0f;
... | true |
3d9463a1961c6db8c36ff21fe89ddd9ef2139caf | C++ | akash37/Programming-Practice | /data structures/pointers.cpp | UTF-8 | 275 | 2.71875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
cout<<"N = "<<n<<endl;
cout<<"location of n"<<&n<<endl;
int *ptr;
cout<<"ptr"<<ptr<<endl;
cout<<"location of ptr"<<&ptr<<endl;
ptr = &n;
cout<<"ptr"<<ptr<<endl;
cout<<*ptr;
int x;
cout<<x;
} | true |
03dc566f89d827e6f6de2dce5b6e55bb3ad0df28 | C++ | JipBoesenkool/CSE167F17_Project4 | /src/renderer/model/Mesh.cpp | UTF-8 | 2,891 | 3.03125 | 3 | [] | no_license | //
// Created by Jip Boesenkool on 26/10/2017.
//
#include "Mesh.h"
//Static (global)
Mesh Mesh::ParseObj(const char* filepath)
{
Mesh mesh;
std::vector<glm::vec3> vertices;
std::vector<glm::vec3> normals;
float vx, vy, vz; // vertex coordinates
float vnx, vny, vnz; // vertex normals
unsigned int vindex[3], ni... | true |
dc6c091db93f64875135fdf2ff93e72db63899d6 | C++ | JackNull/BranchPredictors | /test/2level-automaton-sature-test.cc | UTF-8 | 778 | 2.84375 | 3 | [] | no_license | #include "../sim/predictor_2level.h"
#include "catch.hpp"
TEST_CASE("AutomatonSature next state") {
AutomatonSature automaton(2);
REQUIRE(automaton.nextState(0, true) == 1);
REQUIRE(automaton.nextState(1, true) == 2);
REQUIRE(automaton.nextState(2, true) == 3);
REQUIRE(automaton.nextState(3, true... | true |
2784af4ab5e583fa34778b63f08ee1250f6501d6 | C++ | vudph/basic-cplus | /dp/decorator/VerticalScrollBarDecorator.cpp | UTF-8 | 516 | 2.65625 | 3 | [] | no_license | #include "VerticalScrollBarDecorator.h"
#include <iostream>
VerticalScrollBarDecorator::VerticalScrollBarDecorator(Window *window) : WindowDecorator(window){
}
void VerticalScrollBarDecorator::draw() {
WindowDecorator::draw();
drawVerticalScrollBar();
}
void VerticalScrollBarDecorator::drawVerticalScrollBar(... | true |
163481853ef659ae1e4b0dedc8cb972bdf0f0784 | C++ | cjxgm/cctt | /source/token-tree/error.cpp | UTF-8 | 2,764 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #include "error.hpp"
#include "../util/string.hpp"
#include <fmt/format.hpp>
#include "../util/style.inl"
namespace cctt
{
[[noreturn]] auto throw_scanning_error(
Source_Location loc,
char const* first,
char const* last,
char const* reason
) -> void
{
auto msg = fmt... | true |
b5beeaf29293f5425e8be930f07e315744ac139d | C++ | sl1296/acm-code | /cf-725A-1 Accepted.cpp | UTF-8 | 430 | 2.640625 | 3 | [] | no_license |
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
char s[200100];
int main(){
int n;
while(scanf("%d%s",&n,s)!=EOF){
int l=strlen(s);
int ans=0;
for(int i=0;i<l;i++){
if(s[i]=='>')break;
ans++;
}
for(int i=l-1;i>-1;i--){
... | true |
ff8bba6aecc3d6b8ba8fe327f2f08b52cbc3c5f9 | C++ | zhangq49/JianzhiOffer | /recall/12.path_in_a_matrix.cpp | UTF-8 | 1,976 | 3.78125 | 4 | [] | no_license | #include <vector>
#include <iostream>
using namespace std;
bool has_path_in_matrix_core(const vector<vector<char>>& matrix, const string& path,
vector<vector<bool>>& visited, int& visited_path_length,
int row, int col) {
if (path[visited_path_length] == '\0')
return true;
bool has_path = false;
... | true |
35049a5e0e772dd568b2822749cddc5f8207090c | C++ | arangodb/arangodb | /3rdParty/boost/1.78.0/libs/thread/example/shared_monitor.cpp | UTF-8 | 3,351 | 2.671875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcr... | permissive | // Copyright (C) 2012 Vicente J. Botet Escriba
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include <boost/thread/mutex.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/thr... | true |
f8477400ad36205ffbdf711a255502277d59de98 | C++ | masayano/usefulHacks | /patternHunter/src/analyzeWord.cpp | UTF-8 | 8,127 | 2.75 | 3 | [] | no_license | /*******************************************************
/
/ Copyright 2014, Masahiro Yano
/ Licensed under the BSD licenses.
/ https://github.com/masayano
/
/ What is this?
/
/ [tab separated word count file"s": word, count]
/ -> [tab separated word slope/average file:
/ word,
/ ... | true |
219fa6335fafe44883ce1672db990debe7ce725f | C++ | noriyukit/experimental | /overload/overload.cc | UTF-8 | 796 | 3.453125 | 3 | [] | no_license | #include "overload.h"
#include <iostream>
using namespace std;
using namespace overload;
struct A {
~A() {
cout << __func__ << endl;
}
A() {
}
A(const A&) {
cout << "copy!" << endl;
}
A(A&&) {
cout << "move!" << endl;
}
int operator()() {
cout << "void void" << __func__ << endl;
... | true |
ec51c7a4a4d0731e7ee8dbad7f10091a19293dce | C++ | recurze/ProjectEuler | /14.cpp | UTF-8 | 936 | 2.859375 | 3 | [] | no_license | /**
* File : 14.cpp
* Author : recurze
* Date : 12:35 27.12.2018
* Last Modified Date: 14:45 27.12.2018
*/
#include <cstdio>
#include <algorithm>
const int N = 5050505;
int ans[N] = {0};
int run(long long n) {
if (n == 1 || (n < N && ans[n])) return ans[n];
int x;
... | true |
82c0c2604fe8992afc218dbb0be0067b0177d7fa | C++ | Israel0806/CCOMP-1 | /Clase13/Car.cpp | UTF-8 | 393 | 3.109375 | 3 | [] | no_license | #include "Car.h"
#include <string>
#include <sstream>
using namespace std;
Car::Car(const string &myLicense,const int myYear,const string &myStyle)
: Vehicle (myLicense,myYear), style(myStyle) {}
string Car::getDesc()
{
stringstream ss;
ss<<year;
return "Year: " + ss.str() + "\nStyle: " + style + ... | true |
0eab3f60d00a76680ee4a7abc9d662508e68a4f7 | C++ | yuan-feng/graphics | /tiny_render/main_3_depth_buffer.cpp | UTF-8 | 3,688 | 2.6875 | 3 | [] | no_license | #include "geometry.h"
#include "model.h"
#include "tga_image.h"
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <memory>
#include <vector>
namespace {
constexpr const int kWidth = 800;
constexpr const int kHeight = 800;
} // namespace
Vec3f GetBarycentric(Vec3f A, Vec3f B, Vec3f C, ... | true |
1a4d0994575b4b63ccfff391a6002ddac61a697d | C++ | dustinslade/Sector_TD | /WorldObj.h | UTF-8 | 2,776 | 3.25 | 3 | [] | no_license | #ifndef WORLDOBJ_H
#define WORLDOBJ_H
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
#include "World.h"
class World;
class WorldObj{
public:
/*
Pre-condition: Valid x and y positions are passed
Post-condition: objSprite's initial position is set
Param... | true |