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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f36eefb0a7348087ffc465bc1cc1828dd24647e2 | C++ | AshwathVS/Programming | /ctci/check_balanced.cpp | UTF-8 | 764 | 3.765625 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
Node(int val, Node *left, Node *right)
{
this->val = val;
this->left ... | true |
c4b46a2e019a1005133e439d96146465b51cada8 | C++ | P79N6A/workspace | /test.code/cpp_test/unorder_map.cpp | UTF-8 | 860 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #include <string>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#include <unordered_map>
using namespace std;
using namespace tr1;
using namespace std::tr1;
void myfunc(const std::pair<std::string,std::string>& obj)
{
std::cout << "first=" << obj.first << "second=" << obj.second <<std::... | true |
d86828f68684fce556c84579fc36b4b4a4277559 | C++ | fit-uifs/vtapi | /include/vtapi/data/method.h | UTF-8 | 4,118 | 2.71875 | 3 | [] | no_license | /**
* @file
* @brief Declaration of Method class
*
* @author Vojtech Froml, xfroml00 (at) stud.fit.vutbr.cz
* @author Tomas Volf, ivolf (at) fit.vutbr.cz
*
* @licence @ref licence "BUT OPEN SOURCE LICENCE (Version 1)"
*
* @copyright © 2011 – 2015, Brno University of Technology
*/
#prag... | true |
f71ff935fe4c3ae32c32beadb69c8e7999099809 | C++ | sanuguladurgaprasad/Codes | /GRAPHS/scomp2.cpp | UTF-8 | 2,434 | 2.625 | 3 | [] | no_license | #include<fstream>
#include<iostream>
#include<cctype>
using namespace std;
struct adj
{
int **a;
};
struct node
{
char data;
int vis;
int dg;
int low;
int pn;//postorder numbering;
};
int min(int p,int q)
{
if(p>q){return q;}
else {return p;}
}
int deg(node n[],adj A,int d,int c)
{int y=0;
for(int i=0;i<d;i++){... | true |
60208572689251ba011faca570ac7432492a4825 | C++ | SpatialTranscriptomicsResearch/st_viewer | /src/data/Spot.cpp | UTF-8 | 2,775 | 3.1875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "data/Spot.h"
Spot::Spot()
: m_coordinates(0,0)
, m_visible(false)
, m_selected(false)
, m_color(Qt::black)
, m_name()
, m_totalCount(0)
{
}
Spot::Spot(const QString name)
: m_coordinates(0,0)
, m_adj_coordinates(0,0)
, m_visible(false)
, m_selected(false)
, m_col... | true |
f0508681cd77768e5319e2c91ff40e6bff3970c9 | C++ | MylesAdams/ApolloTradingBot | /src/TradingSession.h | UTF-8 | 947 | 2.53125 | 3 | [] | no_license | //
// Created by Myles Adams on 3/8/18.
//
#ifndef APOLLOTRADINGBOT_TRADINGSESSION_H
#define APOLLOTRADINGBOT_TRADINGSESSION_H
#include <string>
#include <cpprest/asyncrt_utils.h>
namespace Apollo{
class TradingSession
{
private:
time_t start_time_;
time_t end_time_;
double currency_start_amount_;
... | true |
03a60e52a9ec1eb420507531fd4614adff4a9a49 | C++ | siljawalenius/LibraryBooks-CPP | /main.cpp | UTF-8 | 3,766 | 3.25 | 3 | [] | no_license | // Student Name: Silja Walenius
// Student Number: 20710274
//
// SYDE 121 Lab: 07 Assignment: 01
// Filename: Lab07_01
//
// I hereby declare that this code, submitted for credit for the course
// SYDE121, is a product of my own efforts. This coded solution has
// not been plagiarized from other sources and has not be... | true |
791c291d798450e12b924c688ece5c8d5177db92 | C++ | dmarget/introduction-to-oop-in-CPP | /cpp03/ex01/FragTrap.cpp | UTF-8 | 3,271 | 3.125 | 3 | [] | no_license | //
// Created by Duncan Marget on 5/31/21.
//
#include "FragTrap.hpp"
FragTrap::FragTrap(){}
std::string FragTrap::getName() const
{
return name;
}
FragTrap::FragTrap(std::string inName)
: name(inName), hitPoints(100),
maxHitPoints(100), maxEnergyPoints(100),
energyPoints(100), level(1), meleeAttackDamage(30),
r... | true |
9b73d4ce0fb446c3a2bf2e981f4e4cec9266166e | C++ | LittleChimera/rala | /src/timer.cpp | UTF-8 | 734 | 3.03125 | 3 | [
"MIT"
] | permissive | /*!
* @file timer.cpp
*
* @brief Timer class source file
*/
#include <stdio.h>
#include "timer.hpp"
namespace rala {
Timer::Timer()
: paused_(false), time_(0), timeval_() {
}
void Timer::start() {
gettimeofday(&timeval_, nullptr);
paused_ = false;
}
void Timer::stop() {
if (paused_) {
... | true |
023b88a9c2fb89702a236041b7de1132672e5d82 | C++ | pconrad/hof-c | /hof05.cpp | UTF-8 | 1,409 | 3.640625 | 4 | [
"MIT"
] | permissive | // hof05.cpp A simple illustration of "higher order functions" in C++
// MUST BE COMPILED WITH -std=c++0x
#include <iostream>
using namespace std;
// repeatNTimes takes an integer n, and f, which is a
// a pointer to a function that takes void as argument, and returns void.
int summarizeArray(int n, int *a, in... | true |
74b3112db70f9cc84d41c4bf987bda9d8d53a50e | C++ | myunyui22/TeachableMachine | /wifi_shield/time/1-_success/1-_success.ino | UTF-8 | 2,812 | 2.5625 | 3 | [] | no_license | #include <ESP8266WiFi.h>
const char* ssid = "ACSLab2.4G";// 본인 스마트 폰 핫스팟의 ID
const char* password = "acsl0103";// 본인 스마트 폰 핫스팟의 비밀번호
int ledPin = 13; //
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// Set WiFi to sta... | true |
cae2cd5fd858b8879579e16d4e68320729e99065 | C++ | Alexxigang/LeetCode | /【LeetCode】144-二叉树的前序遍历/solution2.cpp | UTF-8 | 1,169 | 3.71875 | 4 | [] | 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 {
//迭代方法一:先将根节点保存在栈中,然后在while循环中取出栈顶点,保存该节点的值到res中,然后将右结点保存到栈中,最后保存左节点到栈中
public:
vector<int> preorderTra... | true |
2789b01cef0a4105fd9bab270d73a3a40f62deb8 | C++ | zbream/school-work | /EECS2510/HuffmanEncoding/HuffmanEncoding/Program.cpp | UTF-8 | 483 | 2.734375 | 3 | [] | no_license | /* Ream, Zack - Lab 2 Huffman Trees
EECS 2510 - 03/10/2015 */
#include <iostream>
#include <string>
#include "Huffman.h"
using namespace std;
int main()
{
string src = "Shakespeare.txt";
string enc = "Shakespeare.enc";
string dec = "Shakespeare.dec";
Huffman hf;
hf.InitializeFromFile(src);
... | true |
07cd6d6856cbe980daf49ab2981acd8b63f7fe76 | C++ | proback01/UselessPrograms-School-stuff- | /C++ (OpenMP)/prefixScan/main.cpp | UTF-8 | 1,337 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <cmath>
#include <omp.h>
using namespace std;
void debugPrintArray(int *array,int arraySize)
{
for(int i = 0; i < arraySize; i++)
{
cout << " " << array[i];
}
cout << endl;
}
int main()
{
int arraySize = 0;
int *array;
int y = 0;
... | true |
93e4c480e2e54f50d1e599e977c44c7cafd878c7 | C++ | chenBright/AOAPC | /Chapter 6/Examples/6-7.cpp | UTF-8 | 2,559 | 3.453125 | 3 | [] | no_license | // 题目 UVA 122 :https://cn.vjudge.net/problem/UVA-122
/**
* TODO
* 输出有问题 => 提交OJ显示"Wrong answer"
*/
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
struct Node
{
bool haveValue;
int val;
Node *leftNode, *rightNode;
Node() : haveValue(false), leftNode(n... | true |
4c944e7f0a5115e7822a6b5ec8af58add58c870e | C++ | villeh987/Pirkanmaa-Conquest-Game | /Game/styles.cpp | UTF-8 | 23,620 | 2.84375 | 3 | [] | no_license | #include "styles.hh"
namespace Game {
void getStyle(int tile_x,
int tile_y,
std::string type,
QPainter& painter,
QRectF boundingRect,
QColor player_color,
std::vector<std::shared_ptr<Course::WorkerBase> > workers,
std... | true |
7c36117aebe14686c8f689352954cfd525b0a3a7 | C++ | FirebirdSQL/firebird | /src/isql/PtrSentry.h | UTF-8 | 2,754 | 2.75 | 3 | [] | no_license | /*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distri... | true |
f9e7fede0aea1372a8f4a49188be9ed2867969e6 | C++ | AmazingCaddy/acm-codelab | /HDU/hdu_3817.cpp | UTF-8 | 1,060 | 2.65625 | 3 | [] | no_license | /*
author: AmazingCaddy
time:
*/
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
const int maxn = 100... | true |
c0aca0930358f6d8675a0072eb114605f4139992 | C++ | Levintsky/topcoder | /cc/leetcode/array/769_max_chunks.cc | UTF-8 | 612 | 2.65625 | 3 | [] | no_license | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
// vector<int> arr2 = arr;
// sort(arr2.begin(), arr2.end());
unordered_set<int> s1, s2;
int n = arr.size();
int res = 0;
int i = 0, j;
while (i < n) {
j = i;
while (j <... | true |
961ff2bbbb8ccc0baef559f42e04bc0ce6e33d4f | C++ | stArl23/onlineJudgeExam | /牛客网上交/Fibonacci.cpp | UTF-8 | 235 | 2.609375 | 3 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
int f[31];
int main(){
int num=0;
memset(f,0,sizeof(f));
f[1]=1;
for(int i=2;i<=31;i++){
f[i]=f[i-1]+f[i-2];
}
while(cin>>num){
cout<<f[num]<<endl;
}
return 0;
}
| true |
effb2b93242bea303696e64d336f08faad0002e3 | C++ | rovinbhandari/Programming_Scripting | /ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/A/cpp/00002225_A_PAIRSOCKS_amicpc120199.cpp | UTF-8 | 624 | 2.515625 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<deque>
using namespace std;
int main(){
//freopen("input.in","r",stdin);
//freopen("output.out","w",stdout);
int t;
scanf("%d",&t);
while(t--){
string... | true |
8e9767c247760549e8fece01ce189d16b37a2f9f | C++ | sagniknitr/sensor_nodes_ROS2 | /c_cpp_experiments/static_class_variables.cpp | UTF-8 | 385 | 3.5625 | 4 | [
"MIT"
] | permissive |
// C++ program to demonstrate static
// variables inside a class
#include<iostream>
using namespace std;
class GfG
{
public:
static int i=0;
GfG()
{
// Do nothing
};
};
//int GfG::i = 1;
int main()
{
GfG obj1;
GfG obj2;
obj1.i =2;
obj2.i = 3;
... | true |
9b64a2d9b0af77ac8de2b41c5803aa8c7c877af1 | C++ | OnlyFuture/Dagor-Brushless-Controller | /Master_ESPNOW/Master_ESPNOW.ino | UTF-8 | 4,454 | 2.640625 | 3 | [
"MIT"
] | permissive | //Sparkfun: 24:6F:28:51:ED:A4
//ESP-DEVKIT Grey Yuneec: CC:50:E3:AF:D2:8C
//Devkit 2: FC:F5:C4:31:80:70
#include <esp_now.h>
#include <WiFi.h>
float target = 0;
float i = 0;
// REPLACE WITH YOUR RECEIVER MAC Address
uint8_t broadcastAddress[] = {0xFC, 0xF5, 0xC4, 0x31, 0x80, 0x70};
// Structure example to send data... | true |
364cc25561561dfbaa040627e4e931a4c03298b9 | C++ | alexandraback/datacollection | /solutions_5658571765186560_1/C++/goldwin/D.cpp | UTF-8 | 1,413 | 2.515625 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define FOR(a,b,c) for(int (a) = (b), _n = (c); (a) <= _n ; (a)++)
#define FORD(a,b,c) for(int (a) = (b), _n = (c) ; (a) >= _n ; (a)--)
#define FOR_N(a,b,c,n) for(int (a) = (b), _m = (n), _n = (c) ; (a) <= ... | true |
c533a30e9d2f348c5bdd03fdfbabdcd474fd112a | C++ | DesignPatternWorks/hf_design_patterns | /07a - Adapter/WildTurkey.h | UTF-8 | 288 | 2.625 | 3 | [] | no_license |
#ifndef WILDTURKEY_H
#define WILDTURKEY_H
#include "Turkey.h"
#include <iostream>
class WildTurkey : public Turkey {
public:
void fly() {
std::cout << "I'm a turkey flying a little\n";
}
void gobble() {
std::cout << "I'm a turkey gobbling\n";
}
};
#endif | true |
2926129e3728b414f3393151c55e332bee438965 | C++ | toiinnn/Programming-Language-I | /3th_Laboratory/src/task_three/in_checking_account.cpp | UTF-8 | 1,482 | 3.125 | 3 | [] | no_license | /**
* @file in_checking_account.cpp
* @brief Implementing functions described in checking_account.h
* @author Lucas Gomes Dantas (dantaslucas@ufrn.edu.br)
* @since 20/10/2017
* @date 21/10/2017
*/
#include "task_three/in_checking_account.h"
#include <iostream>
Checking_Account::Checking_Account() {}
Che... | true |
f1d35703d0586d034d71b30f1654581f2adaf1c5 | C++ | Risca/dgate_resource_manager | /sleeper.h | UTF-8 | 325 | 2.65625 | 3 | [] | no_license | #ifndef SLEEPER_H
#define SLEEPER_H
#include <QThread>
class Sleeper : public QThread
{
public:
static void usleep(unsigned long usecs){QThread::usleep(usecs);}
static void msleep(unsigned long msecs){QThread::msleep(msecs);}
static void sleep(unsigned long secs){QThread::sleep(secs);}
};
#endif // SLEEP... | true |
aa9790e096c1d7f7609f5307a4c9a65f4a09cf10 | C++ | daviddoria/Helpers | /Tests/TestContainerInterface.cpp | UTF-8 | 1,495 | 3.296875 | 3 | [] | no_license | #include "ContainerInterface.h"
#include <iostream>
static bool TestScalar();
static bool TestSTLVector();
int main()
{
bool allPass = true;
allPass &= TestScalar();
allPass &= TestSTLVector();
if(allPass)
{
return EXIT_SUCCESS;
}
else
{
return EXIT_FAILURE;
}
}
bool TestScalar()
{
b... | true |
731d3ddba7b7ee5256d210c3f7fa161368719e77 | C++ | hammad13060-zz/computer_graphics_assignments | /Assignment01_2013060 2/CgPaint/Triangle.cpp | UTF-8 | 3,315 | 3.109375 | 3 | [] | no_license | //
// Created by Hammad Akhtar on 04/08/16.
//
#include "Triangle.h"
#include "Line.h"
#include "glm/ext.hpp"
#include "iostream"
Triangle::Triangle(glm::vec3 pos1, glm::vec3 pos2, glm::vec3 color, int mode) : pos1(pos1), pos2(pos2), mode(mode), color(color), pos3Present(false) {}
Triangle::Triangle(glm::vec3 pos1, ... | true |
03b273e79ba6501f46228ec31c7de79799af476f | C++ | tataRinaz/shar | /client/src/channels/sink.hpp | UTF-8 | 279 | 2.71875 | 3 | [] | no_license | #pragma once
#include <optional>
namespace shar::channel {
// fake sender which is always connected and never full
template <typename T>
struct Sink {
std::optional<T> send(T /* value */) {
return std::nullopt;
}
bool connected() const {
return true;
}
};
} | true |
5cb4305a9e447c2b90d76cbe265a639f4b49fc27 | C++ | tonglin0/Algorithm-Problems | /UVA-Online-Judge/uva1298.cpp | UTF-8 | 2,954 | 2.59375 | 3 | [] | no_license | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#define eps 1e-17
#define M 10000.0
using namespace std;
struct point{double x,y;point(double x=0,double y=0):x(x),y(y){}};
typedef point vec;
vec operator - (vec a,vec b){return vec(a.x-b.x,a.y-b.y);}
vec operator + (vec a,vec b)... | true |
c6eaab78c82f4193f8e8afe3cf7c91f2c0eeb015 | C++ | Loptt/cplus-programs | /CTCI/Chapter4/Graph.h | UTF-8 | 279 | 2.65625 | 3 | [] | no_license | #include <vector>
#include "GraphNode.h"
class Graph
{
private:
std::vector<GraphNode *> nodes;
int size;
public:
Graph();
~Graph();
void addEdge(GraphNode *a, GraphNode *b);
};
Graph::Graph() : size(0)
{
}
Graph::~Graph()
{
}
| true |
c03c4f5b528bcb898c611ec44b24fa775dd05e60 | C++ | isaka11/GameEngineTK | /ClearScene.cpp | UTF-8 | 452 | 2.5625 | 3 | [] | no_license | #include "ClearScene.h"
SceneBase* Clear::m_base = nullptr;
Clear::Clear()
{
}
Clear::~Clear()
{
Dispose();
}
void Clear::Initialize()
{
GetInstance();
}
void Clear::Update(CGame* scene)
{
}
void Clear::Render()
{
}
SceneBase* Clear::GetInstance()
{
if (m_base == nullptr)
... | true |
c4332fdec0bd6c9c16ab5972715aa8c838a86221 | C++ | ETCLabs/LuminosusEosEdition | /src/core/block_data/FixtureBlock.cpp | UTF-8 | 3,020 | 2.609375 | 3 | [
"MIT"
] | permissive | #include "FixtureBlock.h"
#include "core/MainController.h"
#include "core/Nodes.h"
FixtureBlock::FixtureBlock(MainController *controller, QString uid, int footprint)
: InOutBlock(controller, uid)
, m_footprint(footprint)
, m_address(this, "address", 1, 1, 8193 - m_footprint)
, m_gamma(this, "gamma", 1... | true |
c873170e1d5f127a0996f4a8753bc87e34cf3dfd | C++ | wpilibsuite/allwpilib | /wpilibcExamples/src/main/cpp/examples/Encoder/cpp/Robot.cpp | UTF-8 | 3,471 | 3.109375 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <numbers>
#include <frc/Encoder.h>
#include <frc/TimedRobot.h>
#include <frc/smartdashboard/SmartDashboard.h>
... | true |
6c15e31918309c5375eebabc8a3102b326c8de73 | C++ | NicoG60/QDmxLib | /src/_udmx/src/QDmxUDmxPlugin.cpp | UTF-8 | 2,117 | 2.515625 | 3 | [] | no_license | #ifdef Q_OS_WIN
#else
#include <usb.h>
#endif
#include "QDmxUDmxPlugin.h"
QDmxUDmxPlugin::QDmxUDmxPlugin(QObject* parent) :
QDmxIO(parent)
{
}
QDmxUDmxPlugin::~QDmxUDmxPlugin()
{
foreach (QDmxUDmxDevice* dev, _deviceList)
{
dev->quit();
dev->wait();
}
qDeleteAll(_deviceList);
}... | true |
b5021b05139e1a4aa9a34ef17fe304349e061686 | C++ | luckyxuanyeah/Algorithm_Practice | /PAT/code/fifth/5.4/5.4 2 B1007(2)(20)/5.4 2 B1007(2)(20)/5.4 2 B1007(2)(20).cpp | GB18030 | 492 | 2.984375 | 3 | [] | no_license | // 5.4 2 B1007(2)(20).cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include "stdio.h"
#include "math.h"
bool isPrime(int n)
{
if (n <= 1) return false;
int sqr = (int)sqrt(1.0*n);
for (int i = 2; i <= sqr; i++)
{
if (n%i == 0)
return false;
}
return true;
}
int main()
{
int n, count = 0;
scanf("%d", &n);
for (int ... | true |
13474231914446d0659e0475166236f3f079c9ff | C++ | ZekkenToushi/TS_Game01 | /Game/tsCamera.cpp | SHIFT_JIS | 2,549 | 2.796875 | 3 | [] | no_license | #include "stdafx.h"
#include "tsCamera.h"
#include "Game.h"
tsCamera::tsCamera()
{
m_position.Set(m_toCameraPos);
//Z[uB
m_oldtoCameraPos = m_toCameraPos;
}
tsCamera::~tsCamera()
{
}
void tsCamera::Update()
{
//J̃r[s擾B
CMatrix viewMatrix = g_camera3D.GetViewMatrix();
//r[s̋tsvZB
viewMatrix.Inverse(viewMatrix... | true |
92885559c2d58ce808935b414aebd5b127a35996 | C++ | chrisbibiano/helloworld | /src/main.cpp | UTF-8 | 1,048 | 2.515625 | 3 | [] | no_license | #include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SoftwareSerial.h>
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
// OLED display TWI address
#define OLED_ADDR 0x3C
#define OLED_RESET -1
Ad... | true |
6ea57b090007eec9c7ff977315e31c4486aa5f2e | C++ | AndreicaRadu/Infoarena-and-Codeforces-Problems | /trapez.cpp | UTF-8 | 566 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
double a[1000000];
struct punct
{
double x,y;
}v[1010];
int main()
{
ifstream fin("trapez.in"); ofstream fout("trapez.out");
int N,i,j,k=0,c=1,trap=0;
fin>>N;
for(i=1;i<=N;i++) fin>>v[i].x>>v[i].y;
fo... | true |
a18cdb230fc5b727a9cb9bcea5e220b1c90c78b8 | C++ | kaiyuan5277/software-testing-debugging | /modified_test.cpp | UTF-8 | 45,935 | 3.03125 | 3 | [] | no_license | /**************************************************************************************************************************
Purpose: A simple student data manager that the Software Testing class can use to keep a record of student performance
throughout the course. See documentation for additionally re... | true |
590867c7d3d343906fe70e82584923bb04ef7f1f | C++ | dwax1324/baekjoon | /code/3976 역습.cpp | UTF-8 | 1,475 | 2.796875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// dp나 다익스트라로 해결 가능 (n log n)인
// naive -> 2**n 가지, 너무느림
// b[i] = min(a[i-1] + passTob[i-1], b[i-1], bDribble[i-1])
// 다익스트라로 풀다가 포기 노드설정해주는데 홀/짝으로 나누면 될듯?
// 구현하다가 떄려침 dp로 해결
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;... | true |
b5b8f9a1a6758984c7aaec1cb10976df8c7d2a10 | C++ | kk-katayama/com_pro | /atcoder/CodeFormula/CodeFormula2014a/CodeFormula2014_d.cpp | UTF-8 | 1,955 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define F first
#define S second
using namespace std... | true |
2e778a7f67590e5279d296854ca29fee295878d5 | C++ | ParvezAhmed111/Data-Structure-and-Algorithms-with-cpp | /32. GRAPHS/11_Floyd_Warshall_Algorithm.cpp | UTF-8 | 1,372 | 2.96875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
const int INF=1e9;
int main(){
vector<vector<int>> graph= { {0, 5, INF, 10},
{INF, 0, 3, INF},
{INF, INF, 0, 1},
{INF, INF, INF, 0},
... | true |
ded2c980ffb9d3b702a2cfae676a5308ddd18789 | C++ | joych97/Leetcode_May_Challenge | /leetcode_15.cpp | UTF-8 | 1,127 | 3.734375 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
/*
In this we are just interchanging the odd->next... | true |
0b78cc817a530a85b69ce36a32439c11b8ff1233 | C++ | mine691/procon-library | /Number theory/Millar-Rabin/Millar-Rabin Test.cpp | UTF-8 | 915 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
using ll = long long;
ll pow_mod(ll x, ll N, ll M) // return x^N mod M
{
ll res = 1LL;
while (N > 0)
{
if (N & 1)
(res *= x) %= M;
(x *= x) %= M, N >>= 1;
}
return res;
}
bool check(ll a, int s, ll d, ll N)
{
ll x = pow_mod(a, d, N);
if (x == 1... | true |
9c6e1be6c29597f09a290513a9dc54339940dec5 | C++ | LeeYunSung/Algorithm | /BOJ/4963_섬의개수.cpp | UHC | 1,653 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <cstring> //memset
using namespace std;
const int MAX = 50;
void SearchMap(int, int);
int width, height; // ־ μ ũ
int map[MAX][MAX]; //
int visited[MAX][MAX]; //湮ߴ üũϴ
int direction[8][2] = { {0,-1}, {0,1}, {-1,0}, {1,0}, {-1,-1}, {-1,1}, {1,-1}, {1,1} }; //, , , , 밢
int main() {
... | true |
9a5648649b97df187150d4f38e37a84dea37be41 | C++ | jeremie1112/TEXT-SIMILARITY | /Programming assignment 2019/newmain.cpp | UTF-8 | 7,989 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <ostream>
#include <fstream>
#include "Sentences.h"
using namespace std;
int main() {
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<" TEXT SIMILARITY "<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~... | true |
4b69dc97a7506851321779d80ec59bd566235b88 | C++ | pateljainilanilbhai/cpp_programs | /6.cpp | UTF-8 | 2,222 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
using namespace std;
class measure
{
int metre;
int cm;
public:
void get()
{
cout<<"enter metre:";
cin>>metre;
cout<<"enter centimetre:";
cin>>cm;
start:
if(cm>100)
{
int x;
x=cm/100;
... | true |
5f542f647be1e9f1191097113ff756e89f282319 | C++ | sustcoderboy/competitive-programming-archive | /uri/beginner/age_in_days.cpp | UTF-8 | 492 | 3.28125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <iostream>
using namespace std;
inline
void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main()
{
use_io_optimizations();
unsigned int time;
cin >> time;
unsigned int years {time / 365};
unsigned int months {time % 365 / 30};
unsigned ... | true |
e0217af3b9105e02f4a3422be24e3dbecc5fb70e | C++ | vividos/MultiplayerOnlineGame | /src/Client/RenderEngine/IRenderable.hpp | UTF-8 | 976 | 2.6875 | 3 | [] | no_license | //
// MultiplayerOnlineGame - multiplayer game project
// Copyright (C) 2008-2014 Michael Fink
//
/// \file IRenderable.hpp Interface for renderable objects
//
#pragma once
// forward references
class RenderOptions;
/// \brief interface for renderable objects
class IRenderable
{
public:
/// dtor
virtual ~IRende... | true |
1bb380390413e55da64465e5b89867cb8c0f8b54 | C++ | LeeMungu/Programing26.1 | /Kirbies/01_WinMain/Trap.cpp | UHC | 1,095 | 2.671875 | 3 | [] | no_license | #include "pch.h"
#include "Trap.h"
Trap::Trap(const string & name, float x, float y, float sizeX, float sizeY, PlayerState state) : GameObject(name)
{
mX = x;
mY = y;
mSizeX = sizeX;
mSizeY = sizeY;
mState = state;
}
void Trap::Init()
{
mRect = RectMake(mX, mY, mSizeX, mSizeY);
}
void Trap::Update()
{
vector<... | true |
148ebd3733ce93a37aa5717c8c28ade47c7e756e | C++ | TinyWhiteCat/Programming-Abstractions | /InvertKey.cpp | UTF-8 | 710 | 3.359375 | 3 | [] | no_license | #include "stdafx.h"
#include "std_lib_facilities.h"
#include<string>
using namespace std;
string invertKey(string key, string str);
int main() {
string str, key;
cout << "Letter substitution chiper." << endl;
while (true) {
cout << "Enter a 26-letter key: ";
getline(cin, key);
if (key == "") break;
cout <<... | true |
9dc46a3a0050e9a0d1bbb97c111d2057a5eb4838 | C++ | DeretsunGit/RType | /Proj/RType/client/PlayButton.cpp | UTF-8 | 1,032 | 2.53125 | 3 | [] | no_license | #include "PlayMenu.h"
#include "PlayButton.h"
PlayButton::PlayButton(SpriteManager *sprmgr)
{
if (!this->_font.loadFromFile("assets/arial.ttf"))
{
}
this->setSprite(sprmgr->getSpritebyId(MENU_PLAY));
this->setSpriteOn(sprmgr->getSpritebyId(MENU_PLAY_ON));
this->_sprmgr = sprmgr;
this->_connectError = false;
}
... | true |
cef22c86f7247b8577fa107189805b47d8715640 | C++ | treque/cg | /TP3/TP3/TP3/Quadrique.cpp | UTF-8 | 8,148 | 2.765625 | 3 | [] | no_license | #include "Quadrique.h"
#include <algorithm>
using namespace Scene;
using namespace Math3D;
///////////////////////////////////////////////////////////////////////////////
/// public overloaded constructor CQuadrique \n
/// Description : Constructeur par défaut
///
/// @return None
///
/// @author Olivier Dionne... | true |
b66423fbc95d343d8b37e1a847a53784e35c0069 | C++ | green-fox-academy/nemethricsi | /week-04/day-1/TheGardenApplication/Plant.cpp | UTF-8 | 584 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include "Garden.h"
#include "Plant.h"
#include "Flower.h"
#include "Tree.h"
Plant::Plant(Type type, const std::string &color) : _type(type), _color(color), _currentWaterAmount(0)
{}
std::string Plant::typeToString(Type type)
{
switch (type) {
case Type::TREE:
return "tree"... | true |
ec6dd12452a078243e724cf8da4f151bf2655958 | C++ | mzsrkeen10/cplibrary | /src/graph/topological_sort_indegree.cpp | UTF-8 | 1,073 | 3.65625 | 4 | [] | no_license | /*
トポロジカルソート (入次数)
時間計算量 O(|V|+|E|)
Usage:
graphにグラフを入れ,topological_sort()を呼び出す.
戻り値はトポロジカルソート後の頂点の番号
res.size()が頂点数に達しなければ,閉路が存在する.
Verified:
ABC 139 E League
*/
#include <stack>
#include <vector>
using Graph = vector<vector<int>>;
std::vector<int> topological_sort(... | true |
132c56ef144e131dc6ce7ab1d07ba93c51e3280c | C++ | Sahana-YS/parallel-computing | /Memset/memset-basic example.cpp | UTF-8 | 732 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <omp.h>
using namespace std;
int main()
{
int A[100000], i;
clock_t tic, toc;
tic = clock();
//Normal way of initialising
for (int j=0; j<10000; j++) for (i=0; i<100000; i++) A[i]=j;
toc = clock();
cout << "Without memset:"<< (toc-tic)*1.0/CLOCKS_PER_SEC << endl;
ti... | true |
1d5af67ff5b995f0a1da3d24159aec344d5c1d1f | C++ | miyamotok0105/python_sample | /cpp_sample/cpp_programming_book/005.cpp | UTF-8 | 1,425 | 2.8125 | 3 | [] | no_license | #include <cv.h>
#include <highgui.h>
#include <math.h>
//005:回転移動のためのピクセルサンプリング cvGetQuadrangleSubPix
//g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` 005.cpp -o 005
int
main (int argc, char **argv)
{
int angle = 45;
float m[6];
IplImage *src_img = 0, *dst_img = 0;
CvMat M;
// (1)画像の読み込み,出力用画像領... | true |
4a8aafd3938b898e74166c2aa3b96d45fce828f1 | C++ | garrylachman/QtRestClient | /tests/auto/restclient/testlib/jphpost.cpp | UTF-8 | 1,579 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | #include "jphpost.h"
JphPost::JphPost(QObject *parent) :
QObject(parent),
id(0),
userId(0),
title(),
body()
{}
JphPost::JphPost(int id, int userId, QString title, QString body, QObject *parent) :
QObject(parent),
id(id),
userId(userId),
title(std::move(title)),
body(std::move(body))
{}
bool JphPost::equals... | true |
e19f78373a84c6634e2c360d6017bde19ca2d625 | C++ | vslavik/poedit | /deps/boost/libs/compute/test/test_equal_range.cpp | UTF-8 | 3,120 | 2.5625 | 3 | [
"GPL-1.0-or-later",
"MIT",
"BSL-1.0"
] | permissive | //---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// 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
//
// See http://boostorg.gi... | true |
2c45c44b45971c5d4aea6b4b6bcc73edc1202d12 | C++ | istudyatuni/lessons | /4-term/lab8/prog1/main.cpp | UTF-8 | 2,331 | 3.828125 | 4 | [] | no_license | //комплексное число a = x + y * i
#include <iostream>
#include <cmath>
using namespace std;
class complx {
// a = x + y * i
double x, y;
complx conjugate() {//сопряженное
complx res(x, -y);
return res;
}
public:
complx(double a = 0, double b = 0) {
x = a;
y = b;
... | true |
32b11b8907f14d1d175a602183ea9ba4e84a3a45 | C++ | drismailari/cs409-2019-20-fall | /project-solution-1.cpp | UTF-8 | 6,858 | 3.71875 | 4 | [] | no_license | // Güneş Büyükgönenç S011975 Department of Computer Science
#include <iostream>
#include <vector>
#include <utility>
/* Tiny Ranges Implementation by Furkan KIRAC
* as part of CS409/509 - Advanced C++ Programming course in Ozyegin University
* Supports transforming and filtering ranges and,
* to<CONTAINER>() metho... | true |
30bbbe722432169a065696df32d952b8d18c9b68 | C++ | tractis/xades_library | /commons/src/XmlElement.h | UTF-8 | 3,615 | 2.578125 | 3 | [] | no_license | /*
* (C) Copyright 2006 VeriSign, Inc.
* Developed by Sxip Identity
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless re... | true |
b56df83f2c4aa836c98083bd2834febf808eb425 | C++ | ytz12345/2019_ICPC_Trainings | /Opentrains_Contest/10293/K.cpp | UTF-8 | 842 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int t, n;
int main() {
ios::sync_with_stdio(false);
cin >> t;
while (t --) {
cin >> n;
if (n == 3) {
printf("%d\n", 3);
for (int i = 0; i < 3; i ++) {
printf("%d %d\n", i, 0);
}
}
... | true |
bbc28e2cbd70cbd6b46f742d99447b98b4feb1db | C++ | jinpyojeon/TRIN_EARL | /do_not_builds/turtlebot_apps/software/pano/pano_core/include/pano_core/Projector.h | UTF-8 | 6,633 | 2.65625 | 3 | [] | no_license | #ifndef PANO_PROJECTOR_H_
#define PANO_PROJECTOR_H_
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
namespace pano {
class Projector {
friend class SparseProjector;
cv::Mat K, Kinv;
cv::Size outimage_size,input_image_sz;
cv::Mat spherical_coords;
cv::... | true |
f08295201c5656b8920d2929cebbbbb0597f8240 | C++ | Goldenboycoder/NetPrint | /User.h | UTF-8 | 1,022 | 3.328125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
#include <string>
class User {
private:
int m_id; //Idenftification Number
std::string m_password; //Password
short m_priority; //Printing Priority (Low 1, Medium 2, High 3)
short m_privLevel; //Privileges (Limited User 1 / Normal User 2 / Admin 3)
public:
... | true |
daa8cf0ede9349ba48e3660e49bd8e4f05c33cfc | C++ | linsallyzhao/earlyobjects-exercises | /2015/chapter_6/examples/6_4.cpp | UTF-8 | 384 | 3.390625 | 3 | [] | no_license | #include <iostream>
void deeper()
{
std::cout << "I am now inside the function deeper. \n";
}
void deep()
{
std::cout << "I am now inside the function deep. \n";
deeper();
std::cout << "Now I am back in deep. \n";
}
int main()
{
std::cout << "I am starting in function main. \n";
deep();
s... | true |
e18c10be7b6f03ca6b93423a754541c91a4f3c9f | C++ | timi-liuliang/echo | /thirdparty/mlpack/core/optimizers/sgd/update_policies/gradient_clipping.hpp | UTF-8 | 3,540 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* @file gradient_clipping.hpp
* @author Konstantin Sidorov
*
* Gradient clipping update wrapper.
*
* mlpack is free software; you may redistribute it and/or modify it under the
* terms of the 3-clause BSD license. You should have received a copy of the
* 3-clause BSD license along with mlpack. If not, see... | true |
7e37c64660af9936c8766fe571f50b7153c3f1ea | C++ | bjut-hz/basics | /leetcode_c++/306.additive-number.cpp | UTF-8 | 1,672 | 3.359375 | 3 | [] | no_license | /*
* @lc app=leetcode id=306 lang=cpp
*
* [306] Additive Number
*/
// @lc code=start
class Solution {
public:
// bool isAdditiveNumber(string num) {
// for (int i = 0; i < num.size(); ++i) {
// if (i >= 1 && '0' == num[0]) continue;
// for (int j = i + 1; j < num.size(); ++j) {
// if (j -... | true |
eb9f013ab7c8a74452bd6297f56ae90d1bf24622 | C++ | ShadowNicky/Lerning-C | /4 function (a,b)/4.1 function (a,b)/function/function.cpp | UTF-8 | 1,800 | 3.421875 | 3 | [] | no_license | #include <iostream> //Потоковый ввод/вывод
#include <iomanip> //Форматный ввод/вывод
#include <cmath> //Математическая библиотека
#include "stdio.h" //Включение директив процессора
using namespace std; //Стандартное пространство имен
constexpr auto PI = 3.1415926535; //Спецификатор constexpr, с помощью н... | true |
b6b82a04b27408b0f155f6376458fa860e34742b | C++ | ZigorSK/Pract | /Matrix.cpp | WINDOWS-1251 | 2,012 | 2.984375 | 3 | [] | no_license | #include"Matrix.h"
Matrix::Matrix()
{
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
Matr[i][j] = 0;
}
Matrix::~Matrix()
{
// F2
ofstream out("F2.txt", ios::app);
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
out << setw(20) << Matr[i]... | true |
d883fa652bd4d723a114e26210dd56269fcc51ad | C++ | oonarici/xstream | /abstractwriter.cpp | UTF-8 | 1,709 | 3.078125 | 3 | [] | no_license | #include "abstractwriter.h"
void AbstractWriter::write(const bool &v)
{
const void *ptr = &v;
this->writeBase(ptr, sizeof(bool));
}
void AbstractWriter::write(const char &v)
{
const void *ptr = &v;
this->writeBase(ptr, sizeof(char));
}
void AbstractWriter::write(const unsigned char &v)
{
const vo... | true |
f24bd1777d49447ed6a7391aac0d9bf8080b7be9 | C++ | qianl15/PDC-2016-project | /baseline/SA_TSP.cpp | UTF-8 | 5,940 | 2.921875 | 3 | [] | no_license | /*
Simulated Annealing algorithm for Traveling Salesman Problem
@@ baseline version: no parallel optimization, single thread
Input: xxx.tsp file
Output: optimal value (total distance)
& solution route: permutation of {1, 2, ..., N}
*/
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.... | true |
b4cbc0a672283e8b7d80eb33205d4ad4addfd382 | C++ | wwllww/LiveStream_MultiIntance | /UltraLiveApi/V1.1/Parry.cpp | GB18030 | 2,887 | 2.90625 | 3 | [] | no_license | #include "PArry.h"
#include "Error.h"
#include "OperatNew.h"
#ifdef OPERATOR_NEW
#define new OPERATOR_NEW
#pragma message("new(__FILE__,__LINE__)")
#endif
#ifndef MAX_SIZE
#define MAX_SIZE 2000
#endif
CPArry::CPArry(int DynamicFree):m_DynamicFree(DynamicFree)
{
m_Data = new void *[MAX_SIZE];
size = 0;
}
CPArr... | true |
103e8afd56cb57c27e9120bdbd23aa9a203baa3d | C++ | dimchanov/Prac_sem04 | /Prac05/mz04.cpp | UTF-8 | 927 | 2.78125 | 3 | [] | no_license | #include <algorithm>
#include <vector>
#include <utility>
#include <iostream>
template <typename It1, typename It2>
auto myremove(It1 begin_idx, It1 end_idx, It2 begin_elem, It2 end_elem) {
std::vector<int> copy_idx(begin_idx, end_idx);
std::sort(copy_idx.begin(), copy_idx.end());
auto nunq = std::unique(c... | true |
eb57bb966138133b4ea870bc451fdd491e16cbcd | C++ | manu05X/ProgramFiles | /InterviewBit/Two Pointer/CountingTriangles.cpp | UTF-8 | 938 | 3.546875 | 4 | [] | no_license | /*
Counting Triangles
You are given an array of N non-negative integers, A0, A1 ,..., AN-1. Considering each array element Ai as the edge length of some line segment, count the number of triangles which you can form using these array values. Notes:
You can use any value only once while forming each triangle. Order of c... | true |
cfa54b06bad5df450692794b10aa42f971b3fd82 | C++ | JakobYde/Codewars | /C++/4/Square into Squares. Protect trees!/Solution.cpp | UTF-8 | 1,238 | 3.71875 | 4 | [] | no_license | #include <vector>
#include <math.h>
class Decomp
{
public:
static std::vector<long long> decompose(long long n) {
long long nSquared = n * n;
std::vector<long long> decomposition;
int startIndex = 0;
//If a decomposition exists, return it in reverse, else return {}.
if (findDecomp(nSquared, n - 1, decompos... | true |
b516165791e48b8e4a7090d77789b3995f39f8f7 | C++ | Mikalai/punk_project_a | /source/badziaha/time_dependent.h | UTF-8 | 342 | 2.625 | 3 | [] | no_license | #ifndef _H_TIME_DEPENDENT
#define _H_TIME_DEPENDENT
#include <chrono>
class TimeDependent {
public:
TimeDependent();
virtual ~TimeDependent();
virtual void update();
float getTimeStep() const {
return m_dt;
}
private:
std::chrono::high_resolution_clock::time_point m_last_update;
float m_dt{ 0 };
};
#endi... | true |
85e6d481a0ef771a817b4357ebfc88a2e34aed07 | C++ | kathteng/Calculus_Calculator | /Function.cpp | UTF-8 | 3,594 | 3.203125 | 3 | [] | no_license | #include "Function.h"
char Function::variable;
Function::Term::Term()
{
coefficient = 0;
varIndex = 0;
power = 0;
powerSignIndex = 0;
hasVariable = true;
}
Function::Term::Term(std::string term_)
{
term = term_;
hasVariable = true;
FindCoefficient();
FindPower();
}
void Function::Term::Fin... | true |
36e51ebffd86722c7169a7ca6cc7aa86e0c842dc | C++ | ranjiewwen/QuickLookCameraForCMOS | /QquickLookCamera/QData/ImageProcessing.cpp | GB18030 | 6,336 | 3.390625 | 3 | [] | no_license | #include "ImageProcessing.h"
#include "math.h"
#include <memory>
ImageProcessing::ImageProcessing(int height, int width)
{
m_height = height;
m_width = width;
}
ImageProcessing::~ImageProcessing()
{
}
void ImageProcessing::Transposition(unsigned char* dst, const unsigned char* src, int& width, int& height)
{
wid... | true |
776665ae6ad9e7605b47c2d4234b6decde5353f4 | C++ | AbdullahAZaidi/Algorithms_in_Cpp | /ExceptionHandling_helper.cpp | UTF-8 | 428 | 2.8125 | 3 | [] | no_license | /******************************************************************************
Exception handling
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
int p = -1;
try {
if (p < 0){
throw 88;
... | true |
f12b50852315a3650285f3b444b02f2f8654a284 | C++ | uvic-auvic/Software_Sandbox | /vision/src/colorDetection/colorDetectionSample.cpp | UTF-8 | 2,602 | 3.203125 | 3 | [] | no_license | //Author: Keifer Edelmayer
/*
Program Description: With use of webcam, program is able to perform color detection on objects placed before the webcam. An additional control window with sliders
for the RGB values has been created to allow for color detection of desired color.
*/
#include <iostream>
#include "opencv2/ope... | true |
af91e072af9d887d8810b8f4f2963a70e8634097 | C++ | king7282/algorithm | /codeforces/671Div2C.cpp | UTF-8 | 554 | 2.640625 | 3 | [] | no_license | #include <stdio.h>
#include <algorithm>
int input[1010];
int main(void) {
int test;
scanf("%d", &test);
for (int t = 0; t < test; t++) {
int n, x;
scanf("%d %d", &n, &x);
bool flag = false;
int sum = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", input + i);
sum += input[i] - x;
if (input[i... | true |
7ae04ef808fc5d2737b826347a13812389b8f52c | C++ | Junxen/biotracker_backgroundsubtraction_tracker | /Src/helper/CvHelper.cpp | UTF-8 | 10,397 | 3.015625 | 3 | [] | no_license | #include "CvHelper.h"
#include "StringHelper.h"
cv::Point CvHelper::subtractTwoCvPoints(cv::Point a, cv::Point b)
{
return cv::Point(a.x - b.x, a.y - b.y);
}
cv::Point CvHelper::addTwoCvPoints(cv::Point a, cv::Point b)
{
return cv::Point(a.x + b.x, a.y + b.y);
}
cv::Point CvHelper::multCvPoint(double scalar, cv::... | true |
c48669cc34af59f478512670cea424b8973030ce | C++ | kirencaldwell/StateEstimation | /src/Models/system_model.cc | UTF-8 | 1,233 | 2.859375 | 3 | [] | no_license | #include "system_model.h"
void SystemModel::SetModelName(std::string model_name) {
_name = model_name;
std::cout << "Setting model name: " << _name << "\n";
}
void SystemModel::AddMeasurement(VectorXd y) {
_y = y;
// std::cout << "yii = " << _y << "\n\n";
}
VectorXd SystemModel::GetMeasurement() {
... | true |
14f1f8eff4bb80cda3005c03f4e05d97e0b072d2 | C++ | y2kiah/project-griffin | /project-griffin/project-griffin/vendor/clReflect-0.4/inc/clutl/Module.h | UTF-8 | 2,471 | 2.515625 | 3 | [
"MIT"
] | permissive |
//
// ===============================================================================
// clReflect, Module.h - Interface/implementation support
// -------------------------------------------------------------------------------
// Copyright (c) 2011-2012 Don Williamson & clReflect Authors (see AUTHORS file)
// Released... | true |
2d590bcfc7470cfa2414a754d56cae34bb252fa2 | C++ | RealJiShi/MeshSimplification-Mobile | /app/src/main/cpp/MeshSimplifcation/OffFileHelper.h | UTF-8 | 2,885 | 3.171875 | 3 | [] | no_license | #pragma once
#include <fstream>
#include <sstream>
#include <vector>
class OffFileHelper
{
public:
static bool load(const std::string &file_path,
std::vector<double> &vertices,
std::vector<uint16_t> &indices)
{
std::ifstream fin(file_path);
if (!fin)
... | true |
96abab07adcc8d0a158db66992775ccd6afe6f0f | C++ | mapleyustat/tensor-1 | /src/random.cc | UTF-8 | 513 | 3.328125 | 3 | [] | no_license |
#include "random.h"
static uint w = 1;
static uint z = 2;
void
random_seed(uint seed)
{
if (seed > 0) {
w = seed + 1;
z = w + w + 1;
}
}
/* http://en.wikipedia.org/wiki/Random_number_generator */
uint
random_marsaglia()
{
z = 36969 * (z & 65535) + (z >> 16);
w = 18000 * (w & 65535) + (w >> 16);
re... | true |
0cf6b39a90c91864278947cecdd9e20cd49cd6df | C++ | emonansar/URI-Problem-Solution | /1071.cpp | UTF-8 | 220 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
int X,Y,sum=0;
cin>>X>>Y;
for(int i=Y+1;i<=X-1;i++)
{
if(i%2!=0)
{
sum=sum+i;
}
}
cout<<sum<<endl;
}
| true |
600ddb08c8e10dee601cf8c13d22ceb5fec365c6 | C++ | Winded/conways-unreal-game-of-life | /Source/UEGameOfLife/LifeSimulator.cpp | UTF-8 | 6,110 | 2.515625 | 3 | [] | no_license | #include "UEGameOfLife.h"
#include "LifeSimulator.h"
#include "LifeCell.h"
ALifeSimulator::ALifeSimulator()
: mGenerated(false), mGrid(0), mGridNextState(0), mSize(0), mLastSimulation(0.0f)
{
Simulating = false;
Spacing = 10.0f;
SimulationInterval = 0.1f;
ActivationStatus = AS_None;
Repeating =... | true |
de2627d2d830870d7f7e0801dcfb36bf056f592c | C++ | nevaeh511/personal_projects | /scrabble_words.cpp | UTF-8 | 978 | 3.4375 | 3 | [] | no_license | #include<string>
#include<vector>
#include<iterator>
#include<fstream>
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
int main(){
string word;
unordered_map<string, string> dictionary;
ifstream dictFile("scrabble_dictionary2.txt");
while(dictFile){
dictFile >> word;
dicti... | true |
def89b10eca52801bf07a08f762931b2831c5a2a | C++ | nirmalthomas2609/One-Pass-Assembler-for-SIC | /one_pass_assembler.cpp | UTF-8 | 11,245 | 2.625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<fstream>
#include<algorithm>
#include<sstream>
#include<math.h>
using namespace std;
class Assembler
{
int locctr, starting_address, obj_rec_no, obj_address;
map<string, vector<int> > symtab;
map<int, vector... | true |
b080018896b068ff8873ab2fd59400337c6a98bb | C++ | SamNormcoreWayne/AdhocQueryProcessing | /MFQueryInputParser/src/ParserClass.hpp | UTF-8 | 2,903 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <string>
#include <vector>
#include "ParserClassException.hpp"
#include "inputStruct.hpp"
#include "parsedStruct.hpp"
#include "nlohmann/json.hpp"
/**
* INPUT:
* SELECT ATTRIBUTES
* NUMBER OF GROUPING VARIABLES(n)
* GROUPING ATTRIBUTES(V)
* F-VECT([F])
* SELECT CONDITION-VECT([σ])
* HAVING... | true |
12f85b4773f12b5069bf8c0df34416b7353ce5ae | C++ | jveezy/robot_hand | /slave/slave/motor.cpp | UTF-8 | 2,062 | 2.890625 | 3 | [] | no_license | //============================================================================================================
/** \file motor.h
* This file contains program for an ATtiny2313 motor driver that outputs to a L293D motor driver chip. The
* ATtiny2313 will output a PWM signal and two directional signals to determine the... | true |
77a18878236d3371b69876610ba65933d50bce02 | C++ | cfy-github/LeetCode | /PalindromeNumber/palindromeNumber.cpp | UTF-8 | 335 | 2.734375 | 3 | [] | no_license | class Solution {
public:
bool isPalindrome(int x) {
if(x<0) return false;
int tmp=x, div=1;
while(tmp/=10) div*=10;
while(x>=10) {
if(x/div!=x%10) return false;
x=(x%div)/10;
div/=100;
}
if(div>1&&x!=0) return false;
return ... | true |
caebc8bd94412697be6cb2d4be9beb976f048fb6 | C++ | leebohee/problem-solving | /leetcode/42.cpp | UTF-8 | 613 | 2.90625 | 3 | [] | no_license | class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
if(n <= 1) return 0;
int volume, total_volume = 0;
int left_max[n];
int right_max[n];
left_max[0] = height[0];
for(int i=1; i<n; i++) left_max[i] = max(left_max[... | true |
f824bffc152ed9635a8b430bc7c234cadb66a4b2 | C++ | bar4488/Game | /game/src/graphics/gl_utils.cpp | UTF-8 | 351 | 2.71875 | 3 | [] | no_license | #include "gl_utils.h"
unsigned int glutls::GetSizeOfType(unsigned int type) {
switch (type) {
case GL_FLOAT:
return sizeof(float);
case GL_UNSIGNED_INT:
return sizeof(unsigned int);
case GL_INT:
return sizeof(int);
case GL_UNSIGNED_BYTE:
return sizeof(unsigned char);
case GL_BYTE:
... | true |
5dc122a2f64cd2c311aeee087716f73d6e1fd354 | C++ | hogehogei/Mary_SDCard | /src/drv/spi.cpp | UTF-8 | 2,561 | 2.703125 | 3 | [] | no_license |
#include <drv/spi.h>
#include "LPC1100.h"
#include "drv/systick.h"
#include "drv/uart.h"
SPI SPI_Drv::m_SPI[k_SPI_Channels];
bool SPI_Drv::Initialize( const SPI_Drv::Settings& settings )
{
// channel 0 しか対応しない
if( settings.channel > 0 ){
return false;
}
// 1回でやり取りするデータ長
// 4bit から 16bit まで設定可能
if( settings.... | true |
100309daf624a982cb5b2c6397afb03ea05d849e | C++ | YulianStrus/Examples-of-academic-homeworks | /MVSProg/Task04/Project20/Project20/Task1.cpp | UTF-8 | 266 | 2.9375 | 3 | [] | no_license | #include "iostream"
using namespace std;
void main()
{
float a, b;
cout << "Enter the distance in miles ";
cin >> a;
a *= 1.609344;
b = a * 0.539956803;
cout << "Distance in kilometers = " << a << "\nDistance in sea miles = " << b << endl;
system("pause");
}
| true |