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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
96248b8fc51fb044f60529f1326a431c7e442438 | C++ | GritBear/MuSee | /itunesvisualswindowssdk - muSee/CreationCore.h | UTF-8 | 2,072 | 2.59375 | 3 | [] | no_license | /*This is the art creation core
It creates magical art experience through smart probabilistic model
It collects all the objects and related parameter, then assign probability to individual object
It also come with transistion effect core and user drawing core
*/
#pragma once
#include "CreationInterface.h"
#includ... | true |
1897563ec5430400dfa131050d07561c448005ff | C++ | inessousacaldas/exercise_opengl | /include/game/brick.h | UTF-8 | 1,164 | 2.734375 | 3 | [
"MIT"
] | permissive | #ifndef BRICK_H
#define BRICK_H
// std includes
#include <map>
#include <memory>
// external libs includes
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
// project includes
#include "game/game_object.h"
#include "game/animation.h"
class Brick: public GameObject
{
public:
Brick(const glm::vec2& position,
... | true |
adfc3f68770ee6a6b62e8f358bbb58dff54dd3e8 | C++ | UtkarshBhardwaj123/Commit-Ur-Code | /Day - 1/ekta.cpp | UTF-8 | 538 | 3.0625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isPowerOfTwo (long long x)
{
if(x==0)
return false;
return ((x&(x-1))==0);
}
string canJump(long long N) {
if(isPowerOfTwo(N))
return "YES";
el... | true |
29e3decc289f921bd7de88fb2a797307938bc5d9 | C++ | almoreir/algorithm | /cd3/정보올림피아드관련/정보올림피아드관련/문제들/문제/문제모음2/12월13일-4문제/kim/미정/boom/boom.cpp | UHC | 4,547 | 2.796875 | 3 | [] | no_license | #include <fstream.h>
#include <string.h>
#include <iomanip.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <conio.h>
#define MAXM 200
#define MAXN 200
int M, N; //M y, N x
int Arr[MAXM+1][MAXN+1];
int Dy[MAXM+1][MAXN+1][3]; //ڽ ִ 簢 -> Dy[][0=x, 1=y, 2=簢]
int Set[MAXM+1][MAXN+1]; //üũ .
int Cnt... | true |
d79e252f5329136e66a5f873e035cb2d394d1932 | C++ | onikolas/solatlong | /src/envmaker.cpp | UTF-8 | 3,180 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <math.h>
#include "exr.h"
using namespace std;
const float PI = 3.14159265358979323846;
int main(int argc, char** argv)
{
if(argc < 4)
{
cout << "\n Create a latitude longitude HDR environemnt map from a fisheye HDR image \n";
cout << " Usage: envmaker [fishey... | true |
699502993da4039053a15842a915b5bc22364977 | C++ | davschne/accelerated-cpp | /ch14/Handle.h | UTF-8 | 1,179 | 3.3125 | 3 | [] | no_license | #ifndef HANDLE_H
#define HANDLE_H
// 14.1.1/255
// handle that manages memory for polymorphic object
// copying a handle copies the underlying object
template<class T>
class Handle {
public:
Handle(): p {nullptr} { }
Handle(const Handle& s):
p {s.p ? s.p->clone() : nullptr}
{ }
// assignment... | true |
8e5b39c3f19d1b9776b6e99e26504080cc7628d5 | C++ | davega-code/Algorithms | /Strings/Problems/CodChf_ShiftTheString.cpp | UTF-8 | 1,458 | 3.234375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
vector <int> Build_Failure(string pattern)
{
vector <int> F(pattern.size()+1);
F[0] = F[1] = 0; // Empty string and first preffix are always 0
for(int i = 2 ; i <= pattern.size(); i++)
{
int j = F[i - 1]; // lets check if we can expand from the previous index of the... | true |
ca6f0bf296486640a439b3a6f444dde3e0f8400d | C++ | wiwitrifai/competitive-programming | /hackerearth/july-circuits-19/tiredness.cpp | UTF-8 | 3,929 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct point {
int x, y;
point(int x = 0, int y = 0) : x(x), y(y) {};
bool operator==(point p) const { return x == p.x && y == p.y; }
bool operator<(point p) const { return y == p.y ? x < p.x : y < p.y; }
void read() {
scanf("%d %d", &x, &y);
}
};
ostream... | true |
15e53d47495aa6d7240629491a257d746c533533 | C++ | KeiHasegawa/ISO_IEC_14882 | /12_Special_member_functions/1_Constructors/1_ok/test001.cpp | UTF-8 | 520 | 4 | 4 | [] | no_license | /*
* A functional notation type conversion (5.2.3) can be used to create new
* objects of its type. [Note: The syntax looks like an explicit call of the
* constructor.]
*/
#include <stdio.h>
struct complex {
double re;
double im;
complex(double r, double i) : re(r), im(i) {}
};
void cprint(cons... | true |
33d3f746a308fe2c3de27f7ae940879a4b914c87 | C++ | omkarlenka/leetcode | /fruit_into_basket.cpp | UTF-8 | 1,120 | 3.046875 | 3 | [] | no_license | //
// fruit_into_basket.cpp
//
// Created by omlenka on 12/04/20.
// Copyright © 2020 omkar lenka. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
int totalFruit(vector<int>& tree)
{
int max_fruits = 1;
int same_res = 1, diff_val = -1, diff_res = 1;
for(int i =... | true |
6cdee78fa1ab1131eb2fa0874954c1b5dbd14458 | C++ | Dieg657/GoS_Version2 | /pycalculos.h | UTF-8 | 4,193 | 2.65625 | 3 | [] | no_license | #ifndef PYCALCULOS_H
#define PYCALCULOS_H
#include "header.hpp"
class PyC{
private:
PyObject *moduleMainString;
PyObject *moduleMain;
PyObject *func;
PyObject *args;
PyObject *result;
public:
PyC();
void desalocarPy();
double calcularBloqueio(double erlang, long slot);
double calcul... | true |
73ce96b23150ea032b6f95797e7c22ce11abd8ba | C++ | ootakakazuki/atcoder_practice | /pra/dp_slimes.cpp | UTF-8 | 1,191 | 2.71875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int N; cin >> N;
vector<ll> a(N + 1, 0);
vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0));
for (int i = 0; i < N; i++)
{
int tmp; cin >> tmp;
a[i + 1] = tmp + a[i];
}
for (int w = 2; w <= N; w++)
{
for (int l = 0; l ... | true |
79edfb2917fd12e56f511417ebece8ff136738cd | C++ | mane-paata/C-_HPC | /student_hw3_src/max_performance.cpp | UTF-8 | 411 | 3 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include "Timer.hpp"
using namespace std;
int main(){
size_t N = 1024*1024*1024;
double num1 = random(), num2 = random(), sum = 0.0, time;
Timer T;
T.start();
for (size_t i = 0; i < N; ++i)
sum += num1*num2;
T.stop();
cout << sum << endl;
time = T.elapsed();
co... | true |
864ec469e3e3fc5b6fe904da4e0aaf949ccc3147 | C++ | Loodwood/SemestralkaPosko | /pong/Pong/Ball.h | UTF-8 | 2,289 | 3.421875 | 3 | [] | no_license |
#ifndef BALL_H
#define BALL_H
#include "Vec2.h"
enum class CollisionType
{
None,
Top,
Middle,
Bottom,
Left,
Right
};
struct Contact
{
CollisionType type;
float penetration;
};
//definovanoe konstant pre velkost nasej lopticky
const int BALL_WIDTH = 15;
const int BALL_HEIGHT = 15;
const int WIND... | true |
4eb55a6ae01749157748bb9f7863b7f0e9323af5 | C++ | orahmad/Mancala | /Player.h | UTF-8 | 928 | 2.78125 | 3 | [] | no_license | #ifndef PLAYER_H
#define PLAYER_H
#include <iostream>
#include <vector>
#include "Board.h"
#include "Side.h"
class Player
{
public:
Player(std::string name);
std::string name() const;
virtual bool isInteractive() const;
virtual int chooseMove(const Board& b, Side s) const = 0;
virtual ~Player();
pr... | true |
100b083527005954d4b9c51d0bdb2fd8d3a5106c | C++ | HXLLL/xstore | /xcache/src/translation_table.hh | UTF-8 | 2,426 | 2.625 | 3 | [] | no_license | #pragma once
#include <vector>
#include "../../deps/r2/src/common.hh"
#include "../../xutils/marshal.hh"
#include "./lib.hh"
namespace xstore {
namespace xcache {
using namespace r2;
// only leaf the 8-bit of the incarnation
const usize kIncarBit = 8;
const usize kIncarMask = bitmask<usize>(kIncarBit);
templat... | true |
0b8fcf3f239a72604394807a7ff3e7eddb2e8bd3 | C++ | hhland/stl-lab | /22/Chapter22_5/main.cpp | GB18030 | 654 | 3.40625 | 3 | [] | no_license | #include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
void print(int x){
cout << x << " ";
}
int main(void){
vector<int> v1, v2;
v1.push_back(1);
v1.push_back(3);
v1.push_back(5);
v2.push_back(2);
v2.push_back(4);
v2.push_back(6);
//ӡv1v2
cout << "ǰ, v1=";
for_each(v1.begin(), v1.... | true |
f2d89d15b20509da1f9811a242018da724969874 | C++ | tagoro9/Practicas-ETSII | /SSI/practica_4/aes/lib/keys/keys.cc | UTF-8 | 1,432 | 2.90625 | 3 | [] | no_license | #include "keys.h"
Keys::Keys(const Bitset key, char MODE) {
//Inicializar la clave
_key = new BitsetMatrix(4,4,key.to_s());
//Generacion de la clave expandida
BitsetMatrix exp_key(4,44);
//Copiar las 4 primeras columnas de la clave
for (int i = 0; i < 4;i++)
exp_key.set_column(i,(_key->get_column(i)));
for (i... | true |
b82e21943991c20e59e955d8acae346626e7c1dc | C++ | ttzztztz/leetcodeAlgorithms | /Lintcode/1445. Delete Characters.cpp | UTF-8 | 513 | 3.203125 | 3 | [] | no_license | class Solution {
public:
/**
* @param s: The string s
* @param t: The string t
* @return: Return if can get the string t
*/
bool canGetString(string &s, string &t) {
// Write your code here
const int n = s.size(), m = t.size();
int ptr1 = 0, ptr2 = 0;
while (p... | true |
ea5eb5fd8a557aa905504feae0dbf2ae4d4d371f | C++ | ALEHACKsp/fps_spoofer | /fps_spoofer/CMem.h | UTF-8 | 2,109 | 2.953125 | 3 | [] | no_license | #pragma once
#include <Windows.h>
#define ASM_JMP 0xE9
#define ASM_NOP 0x90
class CMem
{
public:
template<class T, class U> static void PutSingle(U pMemory, T value);
template<class T, class U, class V> static void Put(U pMemory, V pValue, unsigned long uiLen);
template<class T, class U> static T Get(... | true |
0f37d004f136bed181e9ae58e97fe223bc47171d | C++ | rcirca/irose | /src/lib_util/CDXHPC.H | UTF-8 | 896 | 2.671875 | 3 | [] | no_license | #ifndef _H_CDXHPC
#define _H_CDXHPC
#define WIN32_EXTRA_LEAN
#include <windows.h>
class CDXHPC
{
private :
DWORD m_dwTmpTIME;
DWORD m_dwCheckTIME;
DWORD m_dwLastTIME;
protected:
// counter variables
LARGE_INTEGER m_freq, m_restart;
LARGE_INTEGER m_current, m_excess;
LARGE_INTEGER m_tmpcurrent;
public:
CDXH... | true |
ccc96daf5d69b976ecd8a41fab2b6c5417766fa1 | C++ | SirTorresDev/EDA | /1ªParte/NuevosEjercicios/Ejercicio25/Ejercicio25/Source.cpp | UTF-8 | 1,138 | 3.046875 | 3 | [] | no_license | //Roberto Torres Prensa
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int minVectorG(const vector<int>datos, const int i, const int j) {
if (i + 1 >= j) { //Hay 2 elemento
if (datos[i] > datos[j]) {
return datos[j];
}
else {
return datos[i];
}
}
else {
int mitad = (... | true |
87d9044e125fe021076a60c695fdc8df41f9862c | C++ | Tatyumi/LifeGame | /LifeGame/CellManager.h | SHIFT_JIS | 996 | 2.890625 | 3 | [] | no_license | #pragma once
#include "FieldManager.h"
enum ECellState
{
DEPOPULATION = 1, // ߑa
BORN = 3, // a
DENSE = 4, // ߖ
};
class CCellManager
{
public:
// RXgN^
CCellManager();
//
void Initialize();
// J[\ݒ菈
void SetCursor(CFieldManager* cField);
// J[\ړ
void MoveCursor();
// tB[hɃZ̏Ԃf
void ReflectCellS... | true |
1224b78532a59f84b90a9e97eadb86d8c24ec8ca | C++ | nad2000/functional-programming-using-cpp | /square_values.cpp | UTF-8 | 1,889 | 3.1875 | 3 | [] | no_license | #include <algorithm>
#include <iterator>
#include <vector>
#include <fplus/fplus.hpp>
using namespace std;
typedef std::vector<int> Inst;
int square(int x) {
return x * x;
}
Inst square_vec_goto(const Inst& xs) {
Inst ys;
ys.reserve(xs.size());
auto it = begin(xs);
loopBegin:
if (it == end(xs)) goto loopEnd;
y... | true |
76dd3666d5c6da9827c6011fb97b145fe4351b77 | C++ | TaihuLight/stealthdb | /src/enclave/enc_timestamp_ops.cpp | UTF-8 | 1,820 | 3.046875 | 3 | [] | no_license | //
// ENCRYPTED TIMESTAMPS(8 bytes) FUNCTIONs
//
#include "enclave/enclave.h"
#include "enclave/enclave_t.h" /* print_string */
extern sgx_aes_ctr_128bit_key_t p_key;
/* Compare two encrypted timestamps(int64 - 8 bytes) by aes_gcm algorithm
@input: uint8_t array - encrypted source1
size_t - length of encrypted ... | true |
c4c86cfb0cbdcd96c20d4e3bd1fda331488a0be8 | C++ | takami228/atcoder | /exawizards2019/c.cpp | UTF-8 | 1,119 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main(){
int n, q;
string s;
cin >> n >> q >> s;
char t[q];
char d[q];
int g[n];
map<char, vector<int> > m;
for(int i = 0; i < q; i++){
cin >> t[i] >> d[i];
}
for(int i = 0; i... | true |
5a9fd4cc4a120898b494df7455655f2a771b4328 | C++ | abhishekxix/Programs | /algorithms/practice.cpp | UTF-8 | 1,337 | 3.296875 | 3 | [] | no_license | #include <bits/stdc++.h>
class Entity {
private:
int weight;
int profit;
public:
Entity(int weight = 0, int profit = 0)
: weight {weight}, profit {profit}
{}
int get_weight() {
return weight;
}
int get_profit() {
... | true |
d8cfbc15a6558d26a6359e6ce4a34416025e0d43 | C++ | kaulszhang/base | /include/util/protocol/rtsp/RtspError.h | GB18030 | 11,673 | 2.703125 | 3 | [] | no_license | // Rtsp.h
#ifndef _UTIL_PROTOCOL_RTSP_ERROR_H_
#define _UTIL_PROTOCOL_RTSP_ERROR_H_
namespace util
{
namespace protocol
{
namespace rtsp_error {
enum errors
{
already_bind = 1, // 1 rtspѾ
not_bind, // 2 rtspѾ
... | true |
cb3f429b4d591ccf65b032b8bdec540d5157b2a2 | C++ | VitorPChaves/AssimpTest | /src/main.cc | UTF-8 | 1,977 | 2.578125 | 3 | [] | no_license |
#include <Shader.h>
#include <Model.h>
#include <Camera.h>
#include <Things.h>
GLFWwindow* window = nullptr;
Camera* camera = new Camera;
void mouse_callback(GLFWwindow* window, double xpos, double ypos) {
camera->mouse_callback(window, xpos, ypos);
}
bool initGL() {
if (!glfwInit()) {
fprintf(stderr, "Failed ... | true |
a3daa385a4272fbb35323b7ad5833eb2be1eac21 | C++ | jedichien/self-driving | /project_7_kidnapped_vehicle/learn/loc_motion.cpp | UTF-8 | 2,467 | 3.3125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <algorithm>
#include <vector>
#include "norm.h"
using namespace std;
/**
* initialize priors
*/
vector<float> init_priors(unsigned int map_size, vector<float> landmark_positions, float control_stdev);
/**
* motion model
*/
float motion_model(float pseudo_position, float movement, vec... | true |
59ef79a95594012da39f6fd7e84d8a31c07e7eed | C++ | vaibhavpandey2012000/compatative-Programming | /bitwise/uniqe_number_2.cpp | UTF-8 | 577 | 2.9375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int count_set(int ans)
{
int as=0;
while((ans&1)!=1)
{
as++;
ans=ans>>1;
}
return as;
}
void count_num(vector<int> &v,int n)
{
int ans=0;
for(int i=0;i<n;i++)
{
ans=ans^v[i];
}
int ss=count_set(ans);
int mask=(1<<ss),ff=0;
// cout<<mask<<endl;
for(int i=0;... | true |
0aae873500bc7f19f89803a8ea562a70776ec4e6 | C++ | lamnot/Cplusplus | /day6_Basic_Classes/Listing_6.5_Demo _of_Interface_vs_implementation_conflicts.cpp | UTF-8 | 1,265 | 3.828125 | 4 | [] | no_license | /*
* Listing6.5.cpp
* A demonstration of violations of the interface
*
* Created on: 3 Dec 2012
* Author: hp
*/
/*
//Headers and Includes
#include <iostream>
using namespace std;
//Types and defines
class cCat // cCat class declaration
{
public:
cCat(int initialAge); // cCat class con... | true |
f5cee43bc2dce1652b7d6a42e3594aaf00ff94d8 | C++ | acrobatman/libofd | /utils/StringFormatter.h | UTF-8 | 1,053 | 2.84375 | 3 | [
"MIT"
] | permissive | #ifndef __UTILS_STRINGFORMATTER_H__
#define __UTILS_STRINGFORMATTER_H__
#include <vector>
#include <cstdio>
namespace utils {
class StringFormatter {
public:
struct GuardedPointer {
GuardedPointer(StringFormatter * sf) : sf(sf) { ++(sf->buf_cnt); }
GuardedPoin... | true |
8bbbe36bd2c421b127dd78407b357bf479974cbe | C++ | likan999/ContestSolver | /UvaOnline/Solve11504.cpp | UTF-8 | 2,550 | 2.84375 | 3 | [] | no_license | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
struct Vertex {
vector<int> outs;
int scc;
int preorder;
};
struct StackFrame {
int ip = 0;
int i;
size_t nextOutIndex = 0;
};
Vertex vertices[100000];
int sccs, C;
vector<int> S, P;
bool ins[100000];
vect... | true |
c5e8c7e775c434ce668e65820cd624f72f49cb81 | C++ | rugbyprof/2143-Object-Oriented-Programming | /Lectures/03-Game_Of_Life/helper.hpp | UTF-8 | 198 | 2.953125 | 3 | [] | no_license | using namespace std;
int** allocate(int width,int height) {
int **array = new int *[height];
for (int i = 0; i < height; i++) {
array[i] = new int[width];
}
return array;
}
| true |
5d07e1ff28e996d06ebe6eb9dd0d86aa9a0b42a6 | C++ | aldebaran/libqi | /qi/type/detail/anyiterator.hxx | UTF-8 | 1,437 | 2.984375 | 3 | [] | permissive | #pragma once
/*
** Copyright (C) 2013 Aldebaran Robotics
** See COPYING for the license
*/
#ifndef _QITYPE_DETAIL_ANYITERATOR_HXX_
#define _QITYPE_DETAIL_ANYITERATOR_HXX_
#include <qi/type/typeinterface.hpp>
namespace qi {
inline AnyReference AnyIterator::operator*()
{
if (kind() == TypeKind_Iterator)
retur... | true |
38bf65a19ab79ba5a73b56915c3d1c73e6e548df | C++ | gregoire-caulys/greenhouse-control | /FanControlInProgress/sensors.cpp | UTF-8 | 3,010 | 2.71875 | 3 | [] | no_license | /**
PROJECT : Greenhouse Project
FILENAME : sensors.cpp
DESCRIPTION :
Classes for sensors
AUTHORS :
Gaspard Feuvray, Gregoire Gentile
*/
#include "sensors.h"
// Writes all measurements in json format
String build_json(String sensor_measurements[SENSORS_NB]) {
String str = "*{";... | true |
ac2f5a3d6d00d3d10d346d2fcc2eae3195ddae30 | C++ | asgaonkar/RSA-Blind-Signature | /main.cpp | UTF-8 | 2,230 | 3.328125 | 3 | [] | no_license | /*
Project Members:
1. Jaswant Pakki - 1208755310
2. Atit Gaonkar - 1217031322
*/
#include <stdio.h>
#include <stdlib.h>
#include <array>
#include <iostream>
#include <random>
#include <cmath>
#include "RSA.h"
#include "BigInt.h"
#define RAND_LIMIT32 0x7FFFFFFF
using namespace RSAUtil;
using namespace std;
... | true |
11978c99a96bf521ba4170bee80d20b2923df9d7 | C++ | Niraka/PinballGame | /PinballGame/source/Map.cpp | UTF-8 | 4,786 | 2.578125 | 3 | [] | no_license | #include "Map.h"
/**
Constructs a default Map. */
Map::Map()
{
m_collisionsManager.addCollisionListener(this);
m_currentState = State::WAITING;
}
/**
Sets the gravity of the map. Gravity is applied to every non-static GameObject
every game loop.
@param vGravity The gravity vector. */
void Map::setGravity(Vector2D&... | true |
1b33f2f663a1e62645cc6648ae71afaccce53899 | C++ | zoejiaen/MyPaintTest3 | /shape.cpp | UTF-8 | 1,857 | 3.140625 | 3 | [] | no_license | #include "shape.h"
#include <QDebug>
Line::Line(const QPoint &p1, const QPoint &p2, const QColor &color, int width) :
m_p1(p1),
m_p2(p2),
m_color(color),
m_width(width)
{
}
void Line::draw(QPainter &painter) const
{
QPen pen(m_color);
pen.setWidth(m_width);
QPen temp = painter.pen();
p... | true |
aa1ccebd0667ec82246df6c59954753765177974 | C++ | axxonite/algorithms | /EPI/Solutions/15_BinarySearchTrees/15.1_is_binary_tree_a_bst_solution.cpp | UTF-8 | 654 | 2.765625 | 3 | [] | no_license | // Copyright (c) 2015 Elements of Programming Interviews. All rights reserved.
#include "stdafx.h"
#include "binary_tree_prototype.h"
#include "binary_tree_utils.h"
namespace Solutions
{
bool IsBinaryTreeBST( const unique_ptr<BinaryTreeNode<int>>& tree, int low, int high )
{
if ( !tree )
return true;
if ( tr... | true |
f44d6a1d2116ba1b38ece988621b0c75e9a11583 | C++ | karanb1/Ladder | /drinks.cpp | UTF-8 | 260 | 2.59375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0;
double percentage;
cin >> n;
int arr[n];
for(int i=0;i<n;i++){
cin >> arr[i];
sum+=arr[i];
}
percentage =(double) sum/n;
cout<< percentage;
} | true |
d855d5aa948177f34ee89115f351ac3bc3977852 | C++ | EudaldV98/Piscine_Cpp | /module_08/ex01/main.cpp | UTF-8 | 3,363 | 2.9375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | true |
49751f925b329f44220bb5af1222b3ae5444634b | C++ | iCodeIN/leetcode-4 | /LC_272.cpp | UTF-8 | 1,317 | 3.234375 | 3 | [] | no_license | void dfs(TreeNode* root, priority_queue<pair<double, int>>& pq, double target, int k) {
if(!root) return;
pq.push(make_pair(fabs(target - double(root->val)), root->val));
if(pq.size() > k)
pq.pop();
dfs(root->left, pq, target, k);
dfs(root->right, pq, target, k);
}
vector<int> closestKVa... | true |
5a57a27f379ac026dd98279b287ff09372c73883 | C++ | JeongKwonHo/cplusplus | /CPP_BASIC/03_VAR/constexpr2.cpp | UTF-8 | 847 | 3.546875 | 4 | [] | no_license | /*
*
핵심 정리
1. 상수의 종류
- runtime constant
- compile-time constant (constexpr)
2. constexpr은 compile-time 상수로만 초기화 할 수 있다.
3. 배열의 크기
- C89문법 : 컴파일 시간 상수만 가능하다.
- C99문법 : 변수도 가능하다. VC++은 지원 안함.
*
*/
#include <iostream>
int main()
{
//const int c = 10; // 컴파일 시간 상수
// 컴파일 시간에 c를 사용하는곳을 매크로 처럼 이미 f... | true |
05a426b4d167aa29f47afbfae33c1d658a444ec7 | C++ | thangvubk/MultiGroupLevelLogger | /logger.cpp | UTF-8 | 1,348 | 2.671875 | 3 | [] | no_license | #include "logger.h"
#include <stdio.h>
#define LOG_MAX_LEN 1024
pthread_mutex_t Logger::_loggerMutex;
const char* Logger::LogGroupNames[] = {"GROUP_1", "GROUP_2"};
static int loggerConfig[][4] ={
0, //LOG_LEVEL_DEBUG
0, //LOG_LEVEL_INFO
0, //LOG_LEVEL_WARNING
1, //LOG_LEVEL_ERROR
//group 2
0, //L... | true |
27f999381d5c504a0a19e802318d2d16a922d88e | C++ | hellolijj/OJ | /leet-code/数组/442-数组中重复的数据.cpp | UTF-8 | 1,292 | 3.546875 | 4 | [
"MIT"
] | permissive | /*给定一个整数数组 a,其中1 ≤ a[i] ≤ n (n为数组长度), 其中有些元素出现两次而其他元素出现一次。
找到所有出现两次的元素。
你可以不用到任何额外空间并在O(n)时间复杂度内解决这个问题吗?
示例:
输入:
[4,3,2,7,8,2,3,1]
输出:
[2,3]
*/
/*
testcase
[4,3,2,7,8,2,3,1]
[1]
[1,2]
*/
#include <cstdio>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> findDuplicates(vector<in... | true |
d1485813ed940d7b7fef7fa474a237e689228a0d | C++ | frcepeda/Contest-Archive | /Codeforces/Practice/UKIEPC 2015/I.cpp | UTF-8 | 1,072 | 2.921875 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include <cctype>
#include <cstring>
using namespace std;
char s[10000];
char *hard = "bcdgknpt";
char *endings[3] = {"ah", "oh", "uh"};
bool ishard(char c){
for (int i = 0; hard[i]; i++)
if (hard[i] == c)
return true;
return false;
}
char start(char c){
int r = 0;
f... | true |
2b02f6d670dcf64ebc7e46ee025e9c80fb477614 | C++ | z-siddy/vublockchain | /headers/hash.h | UTF-8 | 2,236 | 3.03125 | 3 | [] | no_license | //
// Created by zygsi on 9/13/2019.
//
#ifndef VUBLOCKCHAIN_HASH_H
#define VUBLOCKCHAIN_HASH_H
#include <chrono>
#include "main.h"
#include <vector>
#include <random>
#include <sstream>
#include <fstream>
namespace hash {
class Timer {
private:
std::chrono::time_point<std::chrono::high_resolution_c... | true |
dda531d703ff4f9ec526ebdd816c34f7ad0a669e | C++ | nobalpha/open-source-contribution | /CPP/PrepBytesCP/BoxesandToys.cpp | UTF-8 | 304 | 2.59375 | 3 | [
"MIT"
] | permissive | //Question Link- https://mycode.prepbytes.com/problems/fundamentals/BOXTOY
#include <bits/stdc++.h>
using namespace std;
int main()
{
int box=0;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int t;
int c;
cin>>t>>c;
if(c-t>=2)
{
box++;
}
}
cout<<box;
return 0;
} | true |
3c770e4876813f6eecd0ae574f57a3cdb200a15f | C++ | hojin-koh/cpp-aspartame | /tests/optarr/optnum.cc | UTF-8 | 4,887 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | #include <aspartamev0/optarr.h>
#include <catch2/catch_test_macros.hpp>
#include <stdexcept>
SCENARIO("Number Array Opts", "[optarrnum]") {
GIVEN("Empty array options") {
aspartamev0::OptArrInt ei;
aspartamev0::OptArrFloat ef;
aspartamev0::OptArrBool eb;
THEN("They have correct size") {
REQU... | true |
80fbc7d7c90127c18e935624576b69a45c55999a | C++ | GwonDalhyeon/LevelSet | /FastMarching/FastMarchingLevelset.h | UTF-8 | 12,664 | 3.125 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct LevelSet
{
int* pointIndex;
int xNum, yNum;
double* xCood;
double* yCood;
double* Phi;
double dx, dy;
int* pointStatus;
int alive, narrowBand, farAway;
int aliveCount, narrowBandCount, farAwayCount;
LevelSet();
LevelSet(int gridNum, double dX);
LevelSet(int ... | true |
41f1a8cef9d398da3a318a0aa0c10192b668d089 | C++ | marianbitsov23/TuesWork | /OOP/C++/required-hw-oop/test/clothing.h | UTF-8 | 492 | 2.59375 | 3 | [] | no_license | #ifndef CLOTHING_H
#define CLOTHING_H
#include <string>
#include <iostream>
#include "stock.h"
using namespace std;
class Clothing : public Stock{
public:
string color;
double size;
string material;
Clothing();
Clothing(string name, double price, double quantity, Provider p... | true |
96931f44c2d36b0132f9f8a4095b453304f4cae8 | C++ | vitorgabrielmoura/Exercises | /C++/Ex08.cpp | ISO-8859-1 | 426 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
/* Nos exerccios C e D, crie o quadro resumo, algoritmo descritivo e o cdigo fonte com base nos diagramas de blocos*/
int main(int argc, char** argv) {
setlocale(LC_ALL, "Portuguese");
const float G = 9.8;
float altura, TQ;
cout << "Digite a altura: "... | true |
b6fa370fc43077e46311b22a7ec30dd241f8f88d | C++ | slingthor/mathing | /mathing_test/Vector4Tests.cpp | UTF-8 | 5,475 | 3.296875 | 3 | [] | no_license | #include "pch.h"
#include "../mathing/Math/Vector4.h"
using namespace Math;
TEST(Vector4, initialization)
{
auto vector = Vector4(1.0f, 2.0f, 3.0f, 4.0f);
EXPECT_EQ(1, vector.X());
EXPECT_EQ(2, vector.Y());
EXPECT_EQ(3, vector.Z());
EXPECT_EQ(4, vector.W());
}
TEST(Vector4, EqualsTrue)
{
auto vector1 = Vector4... | true |
819f524ed6f98d9a3ff8a62267370bd2a06088c4 | C++ | executors/futures-impl | /rapperswil-prototype/memory.hpp | UTF-8 | 11,155 | 3.03125 | 3 | [] | no_license | // Copyright (c) 2018 NVIDIA Corporation
// Author: Bryce Adelstein Lelbach <brycelelbach@gmail.com>
//
// Distributed under the Boost Software License v1.0 (boost.org/LICENSE_1_0.txt)
#if !defined(FUTURES_MEMORY_HPP)
#define FUTURES_MEMORY_HPP
#include <utility>
#include <new>
#include <memory>
#include <iterator>
... | true |
ca421f517f9fa242d4dcac0f28bcfe6dab1af3b6 | C++ | Gimenesomenes/Carolina- | /mediapond.cpp | ISO-8859-2 | 242 | 2.578125 | 3 | [] | no_license | #include<stdio.h>
main(){
float a,b,c,mediapond;
printf("Digite as 3 notas\n");
scanf("%f", &a);
scanf("%f", &b);
scanf("%f", &c);
mediapond=((a*2)+(b*3)+(c*1))/6;
printf("A mdia ponderada das notas : %5.2f", mediapond);
}
| true |
bbe7e965dd3b7571afd35998fdc2cadfcac6dcd8 | C++ | Absurdius/c-misc | /lab4/nameserver/mns.h | UTF-8 | 376 | 2.53125 | 3 | [] | no_license | /*
* Interface MNS
* implement this interface.
*/
#ifndef MNS_H
#define MNS_H
#include <map>
class MNS : public NameServerInterface
{
public:
MNS();
virtual void insert(const HostName&, const IPAddress&);
virtual bool remove(const HostName&);
virtual IPAddress lookup(const HostName&) const;
priv... | true |
b343f7c84e890a82f1c1a68402706bfd774ba05f | C++ | ferluque/PracticaFinalED | /src/Ruta.cpp | UTF-8 | 1,768 | 3.359375 | 3 | [] | no_license | #include "Ruta.h"
using namespace std;
istream& operator>>(istream& in, Ruta& ruta) {
int num_puntos;
in >> num_puntos;
in.ignore();
for (int i=0; i<num_puntos; i++) {
Punto nuevo;
in >> nuevo;
ruta.puntos.push_back(nuevo);
in.ignore();
}
return in;
}
ostream&... | true |
712fd49d1c4fb4b134f0e8cff5d681301a1467bc | C++ | dwentzel/bounce | /headers/logging/log_sync.h | UTF-8 | 761 | 2.828125 | 3 | [] | no_license | #ifndef BOUNCE_LOGGING_LOG_SYNC_
#define BOUNCE_LOGGING_LOG_SYNC_
#include <ostream>
#include <sstream>
namespace bounce {
class LogSync {
public:
explicit LogSync(std::wostream& output_stream);
~LogSync();
template<typename T>
LogSync& operator<<(const T& t);
... | true |
a468524eeeeba60326ad1927c21f966294e32136 | C++ | AJ92/Math | /src/Geometry/sphere.cpp | UTF-8 | 653 | 3.140625 | 3 | [] | no_license | #include "Geometry/sphere.h"
Sphere::Sphere()
{
pos = Vector3(-1,-1,-1);
radius = -1;
}
Sphere::Sphere(Vector3 pos, double radius) :
pos(pos),
radius(radius)
{
}
Sphere::Sphere(double pos_x, double pos_y, double pos_z, double radius) :
pos(Vector3(pos_x,pos_y,pos_z)),
radius(radius)
{
}
V... | true |
ec636e91c8681a8a364eca9a773931ab2e46a863 | C++ | kevin-plumyoen/Projet_UdeS_DX11 | /Sources/VectorStorage.h | UTF-8 | 9,692 | 3.140625 | 3 | [] | no_license | #ifndef DEF_ECS_VECTOR_STORAGE_H
#define DEF_ECS_VECTOR_STORAGE_H
#include "Entity.h"
#include "StorageTraits.h"
#include <vector>
#include <utility>
#include <iterator>
#include <cassert>
// A storage must store components
// A storage must associate a component with an entity
struct EntityIndexAlreadyInUse{};
tem... | true |
5fc3fb4f1c27ba4afa8af71223e1868a7efec202 | C++ | Blast07/Leetcode | /factorial-trailing-zeroes.cpp | UTF-8 | 147 | 2.796875 | 3 | [] | no_license | class Solution {
public:
int trailingZeroes(int n) {
int res =0;
int five = 5;
while(n){
res += n/five;
n /= five;
}
return res;
}
}; | true |
2732dbc528ab62a4a68c7cc4331a31b1c712ba3a | C++ | luhdriloh/c_the_quest | /vector_averages/vector_averages.cpp | UTF-8 | 716 | 3.765625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
double find_average(vector<double> numbers);
int main ()
{
vector<double> values;
double average;
double current_value;
while(cin >> current_value)
values.push_back(current_value);
cout << "the average... | true |
ae7dbb1e82fb4c005dd753378992292dadcc77fb | C++ | minisparrow/acm | /spiralmatrix.cpp | UTF-8 | 1,296 | 3.515625 | 4 | [] | no_license | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> res(n, vector<int>(n, 0));// 结果矩阵
int i = 0;
int j = 0;// (i,j)指示当前所在格子
res[i][j] = 1;// 进入第一个格子,即左上角格子
while(res[i][j] != n * n)// 终止条件
{
while(j + 1 < n && 0 == res[... | true |
04f4d65853cbf1663cb13209a29d803875c4ae38 | C++ | HackBL/Syracuse-University | /CIS-554/Fall 2019 Classnotes/2019_10_03_Lecture_LRvalue.cpp | UTF-8 | 767 | 3.765625 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*
Entity or expression that can only appear on right side of an assignment statement is Rvalue
Entity that can appear on either side of an assignment statement is Lvalue
*/
void addValue(int &value) { cout << value+10<< endl; } //Lvalue reference version
void addValue(int&& va... | true |
8ef4f69c69558313cfc91eb884df44da8da5404b | C++ | zhuxb/C-ATTL3 | /C-ATTL3/core/gpu/curand/CuRANDGenerator.hpp | UTF-8 | 2,364 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
* CuRANDGenerator.hpp
*
* Created on: 5 Aug 2018
* Author: Viktor Csomor
*/
#ifndef C_ATTL3_CORE_GPU_CURAND_CURANDGENERATOR_H_
#define C_ATTL3_CORE_GPU_CURAND_CURANDGENERATOR_H_
#include "core/gpu/cuda/CUDAArray.hpp"
#include "CuRANDError.hpp"
namespace cattle {
namespace gpu {
namespace {
template<t... | true |
ed55cd1b9df62a8769d9ce571c723075ee903654 | C++ | kiliakis/cpp-benchmark | /random_generators/tests/randomtest_synch_rad2.cpp | UTF-8 | 3,938 | 2.515625 | 3 | [] | no_license |
#include <iostream>
#include <fstream>
#include <random>
#include <chrono>
#include <math.h>
#include <stdlib.h>
#include <blond/vector_math.h>
#include <blond/utilities.h>
#include <blond/math_functions.h>
#include <blond/optionparser.h>
#include <boost/random.hpp>
#include <boost/random/normal_distribution.hpp>
usi... | true |
6b9907dc67b3f540f8302750f516091d84d9a490 | C++ | ryancarr/HackerRank | /30DaysOfCode/Day16/main.cpp | UTF-8 | 373 | 3.234375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::stoi;
using std::string;
int main()
{
string S;
cin >> S;
int result = NULL;
try
{
result = stoi(S);
cout << result << endl;
}
catch(std::exception e)
{
cout... | true |
2c2d7835771902d83efca4206940e7c5e27eb054 | C++ | L-Xiafeng/I_AM_A_UESTC_Student | /DataStruct课程/第三次上机实验.cpp | WINDOWS-1252 | 2,866 | 3.046875 | 3 | [] | no_license | //۰ by zhou Yuchuan
#include <bits/stdc++.h>
using namespace std;
#define END 999999
#define Info char
#define MAX 100
typedef struct{
int key;
Info data;
}RecType;
void QuickSort(RecType R[],int l,int r);
int partition(RecType R[],int l,int r);
int BinarySearch(RecType R[],int l,int r,int data);
int UpperBound... | true |
4842a81bd13fa9465933b65f917fda1462779689 | C++ | FrostyBonny/FundamentalsOfCompiling | /语义分析/main.cpp | UTF-8 | 14,663 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <fstream>
using namespace std;
struct table {
string name;
int address;
};
fstream file;
fstream file_out;
vector<string> token;
string str;
vector<table *> varTable;
//int vartablep = 0;
int datap = 0;
int labelp = 0;
int ... | true |
758d1f63f5ace1fcbaff109dc99d9999f135f630 | C++ | fink-arthur/C-PvZ-Project | /src/MoneyTurret.cpp | UTF-8 | 930 | 2.921875 | 3 | [] | no_license | #include "MoneyTurret.h"
#include "Environment.h"
#include "GraphicPrimitives.h"
#include <ctime>
#include <sys/time.h>
MoneyTurret::~MoneyTurret(){
}
/* This function makes the player gain 4 money every second the game is running */
void MoneyTurret::act() {
struct timeval tp2;
gettimeofday(&tp2, NULL);
time2 = ... | true |
815e6dc063871fee823741c35681b9aae95029aa | C++ | Autoquark/SdlBreakout | /SdlBreakout/SdlBreakout.Library/Point.cpp | UTF-8 | 1,404 | 2.78125 | 3 | [] | no_license | #include "stdafx.h"
#include "Point.h"
#include "AxisAlignedRectF.h"
#include "Line.h"
std::optional<Contact> Point::CastAgainst(const Shape& other, const Vector2F& movement, const InternalityFilter internalityFilter) const
{
return other.CastAgainstThis(*this, movement, internalityFilter);
}
std::optional<Contact> ... | true |
9d16233924b30e0d8300755d30739dc502a799e6 | C++ | pipo-chen/mooc-datastruct | /data-struct/PK/main.cpp | UTF-8 | 636 | 2.71875 | 3 | [] | no_license | //
// main.cpp
// PK
//
// Created by mk on 2021/7/20.
//
#include <iostream>
/**
5 局 3 胜 每一局都有两队伍的变化
*/
int main(int argc, const char * argv[]) {
int a = 100, b = 100, a_win = 0, b_win = 0;
for (int i = 0; i < 5; i++) {
//a 循环一百次 b 循环 100 ci
for (int a_score = 0; a_score < 101; a_score++... | true |
16092d544dae4379b3f87e3d07cdbfc18c62adc6 | C++ | sjzlyl406/Practice | /test75.cpp | UTF-8 | 3,605 | 3.046875 | 3 | [
"LicenseRef-scancode-boost-original"
] | permissive | /*************************************************************************
> File Name: test75.cpp
> Author: leon
> Mail: sjzlyl406@163.com
> Created Time: 2015年07月09日 星期四 21时28分13秒
************************************************************************/
/********************************************************... | true |
ff41a775a4998acac87b0795515f6911a24608d8 | C++ | alisatsar/itstep | /CPP/template/array/array.h | UTF-8 | 1,263 | 3.65625 | 4 | [] | no_license | #pragma once
template<class T, int N>
class Array
{
public:
T m_array[N];
Array();
/*в классе
template<int N1>
Array(Array<T, N1> const& rhs)
{
for (int i = 0; i < N1; i++)
{
m_array[i] = i < N1 ? rhs.m_array[i] : T(); //T() конструктор по умолчанию, который заполняется 0
}
}*/
template<int N1>
Arr... | true |
813be433ccb6124c6e9be3e9fc5710c45a182823 | C++ | josthelvish/Edx-DEV210.2x-LAB2 | /Student.cpp | UTF-8 | 417 | 2.828125 | 3 | [] | no_license | //
// Created by jsilva on 19-12-2017.
//
#include "Student.h"
Student::Student(const string &firstName, const string &lastName, int age, const string &address, const string &city,
unsigned int phoneNumber) : Person(firstName, lastName, age, address, city, phoneNumber) {}
Student::Student() : Person... | true |
9997ff531e5a364a59331d20f9861179ad5e185e | C++ | Girl-Code-It/Beginner-CPP-Submissions | /Urvashi/milestone-28(Hashmaps)/Leetcode/Level-2/Top_K_Frequent_Words.cpp | UTF-8 | 733 | 3.0625 | 3 | [] | no_license | bool cmp(const pair<int, string> &a, const pair<int, string> &b)
{
if (a.first > b.first)
return true;
else if (a.first == b.first)
return (a.second < b.second);
else
return false;
}
class Solution
{
public:
vector<string> topKFrequent(vector<string> &words, int k)
{
... | true |
3d66af334598072a770c7b7c738ffb045d28aa3c | C++ | frogost/Task1 | /main.cpp | UTF-8 | 205 | 3.1875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
char c = 125;
cout << char(c*3) << endl;
cout << char(c/3) << endl;
cout << char(c+3) << endl;
cout << char(c-3);
return 0;
} | true |
6711d8a721390fa458cbc558a2fbd7e3f1894d57 | C++ | LowCostCustoms/asio_coro | /tests/test_async_wait.cpp | UTF-8 | 1,006 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "asio_coro/asio_coro.hpp"
#include "catch2/catch.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/steady_timer.hpp>
TEST_CASE("async_wait returns an awaitable that resumes the coroutine upon the associated timer is triggered") {
boost::system::error_code wait_error;
std::chrono::steady_clo... | true |
c2431301ac4638c12ffaff9efae4753f6c4d85b7 | C++ | makredzic/zadaca3 | /zad5/main.cpp | UTF-8 | 593 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <string>
template<typename Iter> bool jednako(Iter it1begin, Iter it1end, Iter it2begin) {
while(it1begin != it1end) {
if (*it1begin != *it2begin) return false;
it1begin++;
it2begin++;
}
return true;
}
int main() {
std::string rijec;
std::cout << "Unesit... | true |
f206c2b0d88e6f59fe82205a20741c843cf8a4b6 | C++ | teddy8997/LeetCode | /Medium/22. Generate Parentheses/generateParenthesis.cpp | UTF-8 | 732 | 3.609375 | 4 | [] | no_license | /*
time complexity: O(2^n)
space complexity: O(k + n)
*/
class Solution {
public:
vector<string> generateParenthesis(int n) {
string cur = "";
vector<string> ans;
if(n > 0){
dfs(n, n, cur, ans);
}
return ans;
}
private:
void dfs(int l, int r, stri... | true |
17d7aa5befa8cbe63c20c8b2b6e72c86020f44ea | C++ | nodakai/exp | /ofstreamPerf.cpp | UTF-8 | 2,957 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
#include <time.h>
long long diffTimespecUsec(const ::timespec &a, const ::timespec &b)
{
return (a.tv_sec - b.tv_sec) * 1000 * 1000 + (a.tv_nsec - b.tv_nsec) / 1000;
}
static ::timespec ts0, ts1;
static long long d0, d1, d2, d3, d4, d5, d6, d7;
#defin... | true |
ad979059649de85faabb38483b78c25ccc0d9d28 | C++ | shubhampathak09/codejam | /dfs/efficient_approach_array duplicatrs.cpp | UTF-8 | 531 | 3.125 | 3 | [] | no_license | // duplicates in array o(n) time complexity and o(1) space
// elements in arays in raneg 1 to n
// coding interview problem
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[]={ 4, 3, 2, 7, 8, 2, 3, 1};
int n=sizeof(a)/sizeof(a[0]);
vector<int>ans;
// a[0]=4 => a[4-1]=... | true |
ea955f8f5c2618e0e96fa861b9ddda5eb8329d24 | C++ | snoowty/Morning | /ABC030_c_2.cpp | UTF-8 | 2,043 | 3.75 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
// index が条件を満たすかどうか
// bool isOK(int index, int key) {
// if (v[index] >= key) return true;
// else return false;
// }
// 汎用的な二分探索のテンプレ
int binary_search(int key, vector<int> v) {
int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
int right = (in... | true |
45b1268319e6534d97b9dd5ec3cb6d1f15936406 | C++ | RobertWeber1/canopen | /tests/od.cc | UTF-8 | 2,420 | 3.125 | 3 | [
"MIT"
] | permissive | #include "catch.h"
#include <canopen/object_dictionary.h>
template<class T>
constexpr T max(T a, T b)
{
return (a < b) ? b : a;
}
template<size_t COUNT>
constexpr size_t max_();
template<>
constexpr size_t max_<0>()
{
return 0;
}
template <size_t COUNT, class FIRST, typename... REST>
constexpr size_t max_(... | true |
25926e4afa93ad1f1d277f045eeca8bb375c757f | C++ | jbxplan/GMLToolbox-src | /Sonst/X3D-Module/X3D-Module/Writable/X3D/Grouping.h | UTF-8 | 792 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "..\Metaable.h"
#include "Optional.h"
#include "Shape.h"
#include <list>
namespace X3D
{
class Grouping : public Metaable
{
public:
virtual ~Grouping();
void addGrouping(Grouping* grouping) { m_groupings.push_back(grouping); }
void addShape(Shape* shape) { m_shapes.... | true |
455469ee6b40eec43132f235cdd85d65cffd1fa5 | C++ | Sergimech/arduino-ros-examples | /src/oscillator_configurable/oscillator_configurable.ino | UTF-8 | 1,126 | 2.640625 | 3 | [] | no_license | /****
* Oscillator configurable
**/
//Includes
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include <ros.h>
#include <std_msgs/Float32.h>
#include <std_msgs/UInt16.h>
//ROS variables
ros::NodeHandle nh_;
std_msgs::Float32 float_msg_;
ros::Publisher publisher_("wave", &float_msg_);... | true |
935a21f1f156a44a6ed51a94f3c66d7a3a1f4f7e | C++ | 1BB3/c-programs | /1_2.cpp | UTF-8 | 278 | 2.859375 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
main(){
int a,b,c;
printf("Enter two numbers : ");
scanf("%d%d",&a,&b);
c=a;
a=b;
b=c;
printf("The numbers after swapping are : %d%d",a,b);
getch();
}
| true |
19473217bb0d0d394ac8587a4a5123027152d38b | C++ | vasilmao/LinkArrFast | /LinkedList.cpp | UTF-8 | 13,935 | 3.046875 | 3 | [] | no_license | #include "LinkedList.h"
#ifdef _DEBUG
#define ASSERT_OK {if (LinkedList_ok(list) != LISTOK) {LinkedList_dump(list); assert(!"OK");}}
#else
#define ASSERT_OK
#endif
void LinkedListPopSortedEnd (struct LinkedList* list, size_t pop_index);
void LinkedListPushSortedLinking (struct LinkedList* list, Elem_... | true |
94f29d1aa24033c42074646bd55834e8bf036fc3 | C++ | ausaafnabi/Delhi-University-Bsc-CS-Honours | /Discrete-Structures/q20.cpp | UTF-8 | 357 | 3.34375 | 3 | [] | no_license | //This program is to find number of leaf nodes in a full m-array tree with i internal vertices
#include<iostream>
using namespace std;
int main()
{
int m,i;
cout<<"Enter the value of m in the tree";
cin>>m;
cout<<"Enter the number of internal vertices";
cin>>i;
cout<<"The number of leaf nodes are "<<... | true |
b9504cc178f9c00d5f27fdf38023f5e41abe007c | C++ | gcc-o-o/cpp_code | /content_1/stonewt/stone2.cpp | UTF-8 | 355 | 2.796875 | 3 | [] | no_license | //stone2.cpp -- testing class Stonewt
//compile with stonewt1.cpp
#include <iostream>
using std::cout;
#include "stonewt1.h"
void display(Stonewt st, int times);
int main()
{
Stonewt incognito{20.0};
incognito.show_pds();
incognito.show_stn();
cout << "incognito * 3\n";
incognito = incognito * 3.0;
incognito.sh... | true |
2f192edcda22b1da12747f1cd00be65e47fb5ef6 | C++ | Tocknicsu/oj | /pcca/2015_1/0916/pb.cpp | UTF-8 | 1,173 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int t[4][4], d;
void move(){
for(int k = 0 ; k < 4 ; k++){
for(int i = 0 ; i < 4 ; i++){
for(int j = 0 ; j < 3 ; j++){
if(!t[i][j])
swap(t[i][j], t[i][j+1]);
}
}
}
}
void add(){
for(int ... | true |
b3685aa6958e2845f6eb05e5f2a0b462f38957f0 | C++ | KatarinaBakic/Projektivna-geometrija | /src/main.cpp | UTF-8 | 14,189 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <GL/glut.h>
#include <cmath>
#include <Eigen/Dense>
#include <Eigen/Geometry>
using Eigen::MatrixXf;
MatrixXf p1(1, 3), p2(1, 3), q1(1, 3), q2(1, 3);
static int window_width, window_height;
static int timer_active = 0 ;
static float timer = 0;
double parametar_max = 50;
static void ... | true |
9b288d48623337565637e46498d626a3f53abff7 | C++ | mdonaka/CompetitiveProgrammingCpp | /Test/DataStructure/DisjointSparseTable_xor.test.cpp | UTF-8 | 930 | 2.546875 | 3 | [] | no_license | #define PROBLEM "https://yukicoder.me/problems/no/1456"
#include <iostream>
#include <unordered_set>
#include "./../../Library/DataStructure/DisjointSparseTable.hpp"
using ll = long long;
using std::cout;
using std::cin;
constexpr char endl = '\n';
struct F { auto operator()(ll x, ll y) { return x ^ y; ... | true |
fcb9b2c854063a0e89cd4d7c344514b24efee899 | C++ | namse/meteor | /src/Meteor/Sprite.h | UTF-8 | 1,113 | 2.65625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "D2DRenderer.h"
#include "D2DBitmap.h"
#include <string>
class CSprite
{
protected:
float m_ImageWidth;
float m_ImageHeight;
float m_ColorR, m_ColorG, m_ColorB;
float m_Opacity;
public:
CSprite()
: m_ImageWidth(0.f), m_ImageHeight(0.f),
m_ColorR(0.f), m_ColorG(0.f), ... | true |
40373f1a2ef0cdcad30cb8f0658f132b977f263a | C++ | 0xj4m35/C-Fundamental | /Another source/bai_6_rw.cpp | UTF-8 | 658 | 3.09375 | 3 | [] | no_license | #include <stdio.h>
int main(){
int num;
char c;
do{
int first=0, last=0, i=0;
printf("Enter a collection of Integers and finish by number 0\n\n");
do{
i += 1;
printf("Integer <%d> : ", i);
scanf("%d", &num);
if (num==0)
break;
else
if (num==24){
if (first==0){
first=... | true |
28251205b14f38fff8bb6f7bec9cb030d0760517 | C++ | jgaines42/Steric_dipeptides | /C_code/aa_setup.cxx | UTF-8 | 5,200 | 2.59375 | 3 | [] | no_license | #include "aa_setup.h"
#define PI 3.14159265
using namespace std;
// int phi_index[], int psi_index[], int chi1_index[], int chi2_index[], int chi3_index[], int CH3_1_index[], int CH3_2_index[], int end_CH3_1_index[], int end_CH3_2_index[]
void get_dihedral_indexes(std::string aa_name, int index_array[9][4]){
if (a... | true |
edcc16f78fd8d9673dd49700092887101e8c4a5a | C++ | Ariemn2929/College-Programs | /C++ Practice Programs/Ch 4/Ch 4/26/26.cpp | UTF-8 | 805 | 3.78125 | 4 | [] | no_license | // 26.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
// The switch statement in this program uses the "fall through"
// feature to catch both uppercase and lowercase letters entered
// by the user.
#include <iostream>
using namespace std;
int main()
{
char ... | true |
f413b27ab9443cb625c63dc6e63489ffb61ad8e3 | C++ | Lureif/arduino-funtime | /glowing_leds/glowing_led_name.ino | UTF-8 | 788 | 2.765625 | 3 | [] | no_license | #include <FastLED.h>
#include <stdlib.h>
#include <stdio.h>
#define LED_PIN A3
#define NUM_LEDS 200
#define BRIGHTNESS 50
CRGB leds[NUM_LEDS];
void setup()
{
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop()
{
unsigned int i;
unsigned int str_counter;
unsig... | true |