uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9dbc3318-647c-4306-b516-426413728ca7 | AmeenUrRehman/Cpp-Basics | Queue/KQueueinArray.cpp | #include<iostream>
using namespace std;
class KQueue {
public:
int n ;
int k ;
int freespot;
int *arr;
int *front;
int *rear;
int *next;
public:
KQueue(int n, int k){
this -> n = n;
this -> k = k;
front = new int[k];
rear = new int[k];
... | ALGO | 0.999716 | 4.320785 |
9c71f9dc-0fb7-47d7-9149-b1ed6b0d35c0 | suncofamily/temp-sim | ndnSIM/ns-3/src/ndnSIM/examples/ndn-congestion-alt-topo-plugin.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
// ndn-congestion-alt-topo-plugin.cpp
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"
namespace ns3 {
/**
*
* /------\ 0 0 /------\
* | c1 |<-----+ ... | TEST | 0.954009 | 5.192871 |
5435ff49-c12f-40e1-8d7c-5c8a5d23593d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7771_3.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c, d, i, j, k, l, n, m, x, y;
cin >> n;
long long int v[n + 8], s[n + 8];
for (i = 0; i < n + 5; i++) v[i] = 0;
for (i = 0; i < n; i++) {
cin >> a >> b;
v[a]++;
v[b]++;
}
l = 0;
for (i = 1; i <= n + 3; i++) {
... | ALGO | 0.999729 | 3.717835 |
7bf95b62-2931-49fd-a251-8d56f21aebac | extenvision/SpbSU-Homeworks | 1 semester/Task 7-4/Task 7-4/postfix.cpp | #include <iostream>
#include "stack.h"
#include "postfix.h"
#include <string>
using namespace std;
bool isDigit(char digit)
{
if ((digit >= '0') && (digit <= '9'))
{
return true;
}
return false;
}
bool isOperation(char operation)
{
return (operation == '+') || (operation == '-') || (operation == '*') || (ope... | ALGO | 0.996527 | 3.908055 |
f68ff76b-b0bb-48c8-a4e3-34298b8262fb | linneszyx/CP-Problems | Difficulty: Easy/Find All Triplets with Zero Sum/find-all-triplets-with-zero-sum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
vector<vector<int>> findTriplets(vector<int> &arr) {
int n = arr.size() ;
unordered_map<int , vector<int>> mp ;
for(int i = 0 ; i < n ... | ALGO | 0.997174 | 6.524713 |
6d09394c-e756-4620-8cdf-689bfe952d5a | shahadat-osman/Problem-Solving | LeetCode/2024/226-Invert_BinaryTree.cpp | // Shahadat Osman
// Date: 21-01-2024
#include <bits/stdc++.h>
using namespace std;
// * Definition for a binary tree node.
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
... | ALGO | 0.99998 | 6.495877 |
77ee37b4-b632-4746-86d7-89c2ac26f817 | jyotsnatiwary/Data-structures-algo | coding-ninjas/dynamic prog 2/Max Sum Rectangle.cpp | /*Max Sum Rectangle
Send Feedback
Given a 2D array, find the maximum sum rectangle in it. In other words find maximum sum over all rectangles in the matrix.
Input
First line contains 2 numbers n and m denoting number of rows and number of columns. Next n lines contain m space separated integers denoting elements of mat... | ALGO | 0.999979 | 4.624567 |
76557001-7218-494b-b7fd-773ca6b866ba | nateskel/SkelMUD | SkelMUD/Tokenizer.cpp | #include "Tokenizer.h"
#include "Utils.h"
#include <algorithm>
#include <sstream>
std::string Tokenizer::GetFirstToken(std::string &data, char delimiter, bool doPop) {
std::string::size_type n = data.find(delimiter);
std::string output;
if (n != std::string::npos) {
output = data.substr(0, n);
... | TOOL | 0.850228 | 4.686473 |
726d13e8-1dfe-4db0-811e-a1faa1b33702 | auniquesun/Data-Structure-and-Algorithms | bit-operation/subsets.cpp | #include<iostream>
#include <cmath>
#include <vector>
using namespace std;
// ====================== problem ======================
// 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。
// 说明:解集不能包含重复的子集。
// 示例:
// 输入: nums = [1,2,3]
// 输出:
// [
// [3],
// [1],
// [2],
// [1,2,3],
// [1,3],
// [2,3],
// [1,2],
/... | ALGO | 0.999707 | 4.683145 |
5d1036d4-b0c3-4dd4-a969-823d7ea910be | YJ243/python_codingTest | codetree_dxdy/mirror_laser.cpp | /*
* 2023.11.11
* Ǯ
* cur_d x/y ǥ ٲپ ߸
#include <iostream>
#define MAX_N 1000
using namespace std;
int N, K;
char a[MAX_N][MAX_N];
int x,y;
int cur_d;
int dirs[4][2] = {{-1,0},{0,1},{1,0},{0,-1}}; // ,,,
bool InRange(int x, int y){
return 0 <= x && x < N && 0 <= y && y < N;
}
int do_laser(){
int cnt... | ALGO | 0.999435 | 3.539557 |
69142353-e997-4c28-af7c-6d4a3faca034 | ishandutta2007/codeforces | sugarrr/normal/1107/C.cpp |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_b... | ALGO | 0.999946 | 3.94847 |
daeda312-c509-4b4d-8fd2-74c71c2e9d3b | jki14/competitive-programming | 2011/SIM/8-2011 Multi-University Training Contest 3 - Host by BIT/p1008.cpp | #include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<climits>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<set>
#include<map>
using namespace std;
#define N 11000
int n,p;
int a[N],id[N],r[N... | ALGO | 0.999956 | 3.330242 |
a7547441-ca92-45c3-9e74-9fca732a5181 | Anubhavi-Jaiswal/DSA | Patterns/Pattern14.cpp | #include<bits/stdc++.h>
using namespace std;
void print14(int n)
{
for(int i=0;i<n;i++)
{
for(char ch='A';ch<='A'+i;ch++)
{
cout<<ch<<" ";
}
cout<<endl;
}
}
int main()
{
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
int n;
cin>>n;
... | ALGO | 0.998969 | 4.237818 |
c916943d-404e-499c-b999-468406cbf506 | tbeu/AquaQChallengeHub | challenges/05/challenge05.cpp | // AquaQ Challenge Hub
// Challenge 5: Snake eyes
// https://challenges.aquaq.co.uk/challenge/5
#include <array>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <gsl/util>
static bool readFile(const std::string& fileName, std::vector<std::string>& lines)
{
std::ifstream in{fil... | ALGO | 0.998487 | 6.20692 |
65765168-c413-479e-a936-213184c50fe1 | AroundPeking/abacus_abf_gen | source/module_esolver/esolver_ks_pw_tool.cpp | #include "esolver_ks_pw.h"
#include "module_base/global_function.h"
#include "module_base/global_variable.h"
#include "module_hamilt_pw/hamilt_pwdft/global.h"
#include "module_elecstate/occupy.h"
#include "module_io/binstream.h"
namespace ModuleESolver
{
//--------------------------------------------------------------... | ALGO | 0.997556 | 4.134662 |
9947b159-71b9-4e5d-b270-1ff8533c0bc9 | eduardohmrodrigues/competitive-programming | hacker-rank/arrays-left-rotation.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the rotLeft function below.
vector<int> rotLeft(vector<int> a, int d) {
int pos, size = a.size();
vector<int> b(size);
d = d%size;
for(int i=0; i<size; ++i){
pos = i < d ? (size - (d - i)) : (i-d);... | ALGO | 0.999922 | 4.593087 |
4fdf8c2b-727d-455c-ab33-aa6d2214f788 | nezumimusume/GamePG_2_2018 | tkEngine/bulletPhysics/src/BulletSoftBody/btDefaultSoftBodySolver.cpp | #include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "btDefaultSoftBodySolver.h"
#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
#include "BulletSoftBod... | ALGO | 0.876801 | 7.064888 |
c8addd55-146d-4fe8-bd2d-2dcea8655817 | marielsan/2014_2015_robotics_metm | controllers/wall_detector/MyRobot.cpp | /**
* @file MyRobot.cpp
* @brief wall_detector
*
* @author MªElvira Tomeo Martin <<EMAIL>>
* @date 2014-11
*/
#include "MyRobot.h"
//////////////////////////////////////////////
MyRobot::MyRobot() : DifferentialWheels()
{
_time_step = 64;
_left_speed = 0;
_right_speed = 0;
// Habilito... | TOOL | 0.865702 | 3.997281 |
75bc7307-939b-42a7-aad9-c88247e09841 | ranxian/peloton-1 | src/index/btree_index.cpp | #include "index/btree_index.h"
#include "index/index_key.h"
#include "index/index_util.h"
#include "common/logger.h"
#include "common/config.h"
#include "storage/tuple.h"
#include "statistics/stats_aggregator.h"
namespace peloton {
namespace index {
#define BTREE_TEMPLATE_ARGUMENT ... | ALGO | 0.995804 | 7.840234 |
5e05b0dd-d919-4f15-a663-f360f25dca43 | Subbuleo23/finding-nemo | UnacademyCourse/PythonToCPP/Exercise.cpp | #include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int x = 10;
int y = 0;
int z = x and y;
cout<<z;
return 0;
} | ALGO | 0.999651 | 3.198082 |
aed33cda-04d6-46e5-972e-2b97b2f6ce45 | rhakash008/Code-force-problems | 266A.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int i,count=0,n;
string s;
cin>>n;
cin>>s;
for(i=0;i<n-1;i++){
if(s[i]==s[i+1]){
count++;
}
}
cout<<count;
return 0;
}
| ALGO | 0.99998 | 3.76468 |
5f453241-f701-41b6-ad8f-cdc7b5651786 | AlveyCoin/Alvey-Core | src/rpc/request.cpp | #include <rpc/request.h>
#include <fs.h>
#include <random.h>
#include <rpc/protocol.h>
#include <util/system.h>
#include <util/strencodings.h>
/**
* JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility,
* but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were
* unspecified... | WEB | 0.870074 | 7.495079 |
24cdcaf3-954e-4d6e-ad03-14bb79465cd3 | millag/DiscreteElasticRods | libs/dlib-18.9/examples/custom_trainer_ex.cpp | /*
This example program shows you how to create your own custom binary classification
trainer object and use it with the multiclass classification tools in the dlib C++
library. This example assumes you have already become familiar with the concepts
introduced in the multiclass_classification_ex.cpp ex... | DATA | 0.87721 | 7.83565 |
0f28c7be-4e57-42a0-9780-33a7e9356466 | AnshRehan04/oops | Recursion/prime.cpp | #include <iostream>
bool is_prime(int n, int divisor = 2) {
if (n <= 1) {
return false;
}
if (divisor * divisor > n) {
return true;
}
if (n % divisor == 0) {
return false;
}
return is_prime(n, divisor + 1);
}
int main() {
int number;
std::cout << "Enter a nu... | ALGO | 0.99962 | 5.014751 |
77fa968b-9eab-4911-b087-2e24ecd74697 | imkhushboo/DSA | GRAPHS/floyd_warshell_algo.cpp | /*
floyd warshell algorithm for negative path weight or cycle
shortest path algorithm from every node to every another node
problem - link : https://www.geeksforgeeks.org/problems/implementing-floyd-warshall2042/1
video - link : https://youtu.be/YbY8cVwWAvw?si=BXjMiMwaU4mJKVLK
*/
class Solution
{
public:
vo... | ALGO | 0.999972 | 5.856339 |
1ae7713d-ceb8-4650-aecc-29ac1d5a7b09 | MahmudJewel/DevSkill-my-solutions | C++/DCP-5 Solve the Recursion.cpp | /****************##################################*************************************************
* # Editor : Jewel Mahmud # *
* # Dept. of CSE, MBSTU # *
* # Date : 17/01/18 ... | ALGO | 0.999937 | 4.005374 |
1af3aa44-07fe-4ee6-8495-a3442d5fb6b2 | Giangattt123/DSA_PTIT | Backtracking-Branch_Bound/thapHaNoi.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define present(t, x) (t.find(x) != t.end())
#define sz(a) int((a).size())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define pb push... | ALGO | 0.999698 | 3.987665 |
3a0f6e46-4e3b-4f3d-9053-9977ec78adb7 | pkp245464/Competitive-Programming | Graph/FloydWarshallAlgorithm.cpp | #include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define ld long double
#define phb push_back
#define phf push_front
#define ppf pop_front
#define ppb pop_back
#define in insert
#define as assign
#define nl "\n"
#define fastinput ios::sync_with_stdio(0),cin.tie... | ALGO | 0.999953 | 3.331931 |
a8e8fc26-bc95-4fd6-a0d6-e0e9c0639377 | SambhavJain74/LearningCPP | Milestone-3/3_recursion_1b_assignment/1_replace_pi.cpp | #include <iostream>
using namespace std;
void replacePi(char input[], int i=10000)
{
if(input[0]=='\n')
{
return;
}
if(i==10000)
{
i=0;
while(input[i]!='\0')
{
i++;
}
i--;
}
if((input[0]=='p')&&(input[1]=='i'))
{
input... | ALGO | 0.999784 | 3.39701 |
0ab7f2a5-7918-4af0-9386-c28cdc728dd8 | suhyunch/shalstd | samsungsw/4012_cook/src.cpp | #include <iostream>
using namespace std;
int ingredient[16][16];
int N;
bool match[16];// 0은 A, 1은 B
int mn=1e9;
int abs(int a, int b) {return a>b ? a-b : b-a;}
void init();
void input();
void dfs(int depth, int cnt);
void solve();
int main(){
int tc;
scanf("%d",&tc);
for(int T=1; T<=tc; T++){
... | ALGO | 0.999242 | 4.079144 |
513b4144-70c4-45ea-a9a5-50ae618c5063 | Gilgameshgb-1/ProgrammingTechniques | Z5/Z1/main.cpp | #include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
#include <iterator>
template <typename TipEl,template <typename...> class Kontejner = std::vector>
class Tok{
Kontejner<TipEl> kolekcija;
public:
template <typename TipEl2, template<typename...> class Kontejner2>
... | TOOL | 0.984114 | 4.910506 |
52950879-6ecd-4abb-9af6-559436ea295e | hpc-ulisboa/NDPmulator | tests/test-progs/threads/src/threads.cpp | #include <iostream>
#include <thread>
using namespace std;
/*
* c = a + b
*/
void array_add(int *a, int *b, int *c, int tid, int threads, int num_values)
{
for (int i = tid; i < num_values; i += threads) {
c[i] = a[i] + b[i];
}
}
int main(int argc, char *argv[])
{
unsigned num_values;
if (a... | ALGO | 0.971168 | 4.36751 |
ea9d2402-b719-4747-9b6c-c863c16d5917 | gnipun05/CPP | Codeforces/Codeforces_Bit/Codeforces_Beginners/EvenOddsINTEST.cpp | #include <iostream>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
int position=1;
int arr[n+1];
arr[0]=0;
for(int i=1; i<=n; i+=2)
{
arr[position]=i;
position++;
}
for(int i=2; i<=n; i+=2)
{
arr[position]=i;
position++;
}
c... | ALGO | 0.999923 | 3.145728 |
ccbf1dff-52a0-47be-9959-cedaaa819e04 | Nguyenthithuhang0406/UDTT | Cau2_Vector_Sort_nlogn.cpp | #include<bits/stdc++.h>
using namespace std;
void init (vector<int>& a){
int n; cin >> n;
for(int i = 0; i< n; i++){
int x; cin >> x;
a.push_back(x);
}
}
void display(vector<int>& a) {
for(int x: a){
cout << x << " ";
}
}
int sum(vector<int>& a){
int s = 0;
for(int x : a){
s += x;
}
return s;
}
in... | ALGO | 0.999512 | 4.274484 |
c6e29aa2-7a5b-427e-9dbd-7e52fa7f7abd | Windfog-Studios/Pinball | Pinball/Box2D/Box2D/Collision/Shapes/b2PolygonShape.cpp | #include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <new>
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2PolygonShape));
b2PolygonShape* clone = new (mem) b2PolygonShape;
*clone = *this;
return clone;
}
void b2PolygonShape::SetAsBox(float32 hx,... | ALGO | 0.990695 | 7.92611 |
90810886-13fb-48f0-a7a3-2215f44c1025 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/tc_generated_progs_cpp/p03804/p03804_num0_parsed.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
string a[50],b[50];
cin>>n>>m;
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<m;i++) cin>>b[i];
int cnt=0;
for(int x=0;x<=n-m;x++){
for(int y=0;y<=n-m;y++){
cnt = 0;
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
... | ALGO | 0.999985 | 3.309414 |
8280bf15-2bcf-4093-8f43-86c776eb5998 | Sagar73594/C-Tutuorials | 22STL/6Maps.cpp | // ************************* STL MAPS ****************************//
// MAPS ARE USED TO REPLICATE ASSOCIATIVE ARRAYS
// MAPS CONTAIN SORTED KEY-VALUE PAIR IN WHICH EACH KEY IS UNIQUE AND CANNOT BE CHANGED, AND IT CAN BE INSERTED OR DELTED BUT CANNOT BE ALTERED.
// THE ASSCOIATIVE ARAY MEANS THAT THE INDEX OF ARRAY C... | ALGO | 0.970169 | 3.945242 |
39f440a8-436f-4891-a2c8-b32164d89f79 | gtech005/ros2_robots | src/robot_localization/src/ukf.cpp | #include <robot_localization/filter_common.hpp>
#include <robot_localization/ukf.hpp>
#include <Eigen/Cholesky>
#include <vector>
namespace robot_localization
{
Ukf::Ukf()
: FilterBase(),
uncorrected_(true)
{
size_t sigma_count = (STATE_SIZE << 1) + 1;
sigma_points_.resize(sigma_count, Eigen::VectorXd(STATE_SIZE... | ALGO | 0.992351 | 7.796961 |
96d55ef6-b447-4e2f-aa85-5e5623b68e35 | pnm6054/Algorithm_exercise | BOJ/Q10988.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main(void)
{
int p = 1;
char * s = new char[100];
cin >> s;
for (int i = 0; i < strlen(s) / 2; i++)
if (s[i] != s[strlen(s) - i - 1])
{
p = 0;
break;
}
cout << p << endl;
return 0;
} | ALGO | 0.99967 | 3.080086 |
93109481-d103-417b-9b96-193d6ddb16cb | ArchitKumar1/LeetCode-Submissions | rectangle-overlap/Wrong Answer/4-26-2021, 1:39:05 AM/Solution.cpp | // https://leetcode.com/problems/rectangle-overlap
class Solution {
public:
bool isRectangleOverlap(vector<int>& x, vector<int>& y) {
bool ok = 0;
ok |= (x[2] > y [0] && x[3] > y [1]);
swap(x,y);
ok |= (x[2] > y [0] && x[3] > y [1]);
return ok;
}
}; | ALGO | 0.999927 | 5.805109 |
aace42b6-c547-49f1-a8c2-95e39d4cb500 | Avdhesh-Varshney/CPMasterLog | CodeChef/Practice-Problem/SLOWSOLN.cpp | // Slow Solution
// Problem Code - SLOWSOLN
// https://www.codechef.com/problems/SLOWSOLN
// Solution:
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
while(t--) {
int maxt, maxn, sunn, sum = 0;
cin >> maxt >> maxn >> sunn;
while(sunn > 0 and maxt > 0) ... | ALGO | 0.999905 | 4.362848 |
bf2cc900-7a2c-423c-bb37-147fa8b5bcd3 | yeohj0710/old-solutions | 01000s/1766.cpp | #include <iostream>
#include <queue>
using namespace std;
int degree[32005] = {0, };
vector<int> node[32005];
priority_queue<int, vector<int>, greater<int>> Queue;
int main() {
int N, M, A, B, pop;
cin >> N >> M;
for(int i=0; i<M; i++) {
cin >> A >> B;
node[A].push_back(B);
degree[... | ALGO | 0.999996 | 4.176684 |
57460f0b-a7d4-4540-909c-f068743770ce | stwuhan/leetcode | solution/2300-2399/2332.The Latest Time to Catch a Bus/Solution.cpp | class Solution {
public:
int latestTimeCatchTheBus(vector<int>& buses, vector<int>& passengers, int capacity) {
sort(buses.begin(), buses.end());
sort(passengers.begin(), passengers.end());
int j = 0, c = 0;
for (int t : buses) {
c = capacity;
while (c && j < ... | ALGO | 0.99997 | 6.495057 |
d782aa8f-b262-4bd0-adb6-f91e7d8861d9 | NikhilRaj-25/Owl-Coder | Sequence of Sequence.cpp | int numberSequence(int m, int n){
// code here
if(n>7) return 0;
vector<int>vt(n);
vt[0]=1;
for(int i=1;i<n;i++){
if(vt[i-1]*2>m) return 0;
vt[i]=vt[i-1]*2;
}
int ans=1;
int x=n-1;
while(1){
if(vt[x]+1<=m){
int t;
t=(vt[x]+1)*pow(2,n-x-... | ALGO | 0.999992 | 3.799089 |
c99ec260-a9e0-43d8-a2ce-6f85e0832a0a | Lqs66/boost_1_74_0 | libs/compute/example/random_walk.cpp | #include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/inclusive_scan.hpp>
#include <boost/compute/algorithm/inclusive_scan.hpp>
#include <boost/compute/interop/opencv/core... | ALGO | 0.998688 | 4.715515 |
203ca419-480e-48ef-b591-7ecb6bc6eada | zxyDEDIRE/ACM_CODE | 多校/The 14th Jilin Provincial Collegiate Programming Contest/K.cpp | /*
嵌套变量重复
特殊样例 0 1 2 n
数组越界
开long long
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define p(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=... | ALGO | 0.999953 | 4.051798 |
7c047e06-446f-43ab-a7d9-04265d794ada | dinhcanh303/Cpp_Basic | C++_Basic/B32.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long k2,k3,k5,k6;
cin >> k2>>k3>>k5>>k6;
long long min256 = min(k2,min(k5,k6));
long long count256 = min256*256;
if(min256 == k2) cout<<count256;
else {
long long min32= min(k3,k2-min256);
cout << min32*32+count256;
}
return 0;
}
| ALGO | 0.999315 | 3.096764 |
244e1a7f-9edb-4b8d-b3bc-72fe6cbef3ab | Sukhpreet-Singh2428/DSA-IN-CPP | 9.Arrays/3.Hard/2MajorityElement_II.cpp | //! Majority Element ( > n/3 times )
//* (Hard Problem)
//? Eg: arr[] = {1,1,1,3,3,2,2,2} n = 8
//? --> return {1,2}
//? Q). How many integers at MAX be there in the answer ??
//* At Max 2 elements
//* eg : 8/3 = 2
//* so only those elements return whose freq > 2 i.e, 3
//* if there are more than 2, tells take... | ALGO | 0.999994 | 5.264908 |
1946fa23-3be8-4eec-8e30-635b2f7c0b17 | bala-chandar12/DSA-C- | hard/[1070] Height of the Tallest Building [H].cpp | /*
#### Height of the Tallest Building ####
Given an array of strings (depicting a skyline of several buildings), return in meters the height of the tallest building. Each line in the list represents 20m.
[Examples]
___
tallestBuildingHeight([
" ##",
" ##",
" ##",
"### ##... | TEST | 0.953644 | 3.68253 |
0b1daa01-12da-43ac-b745-bfa0ce7f5e65 | nadeenfarid/batsim-project_team1 | src/easy_lqf_lqf.cpp | #include <cstdint>
#include <list>
#include <set>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <batprotocol.hpp>
#include <intervalset.hpp>
#include "batsim_edc.h"
using namespace batprotocol;
// === Data structures ===
struct SchedJob {
std::string job_id;
uint32_t nb_hosts;
... | ALGO | 0.994412 | 5.927176 |
85677351-45f2-41f3-af54-f69a78b624fc | ishandutta2007/codeforces | pyqe/normal/1468/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fr first
#define sc second
long long n,nn=0,ma=1e9,a[200069],ps[200069],sk[200069],qq[200069],dsu[200069],cc[200069],sq[200069];
pair<long long,long long> as[200069];
bool cmp(long long x,long long y,long long x2,long long y2)
{
return x*y2... | ALGO | 0.999975 | 3.182255 |
4ba6975d-ce68-432f-b7a4-371ce8483f4a | MafiaHub/Framework | vendors/slikenet/DependentExtensions/cat/src/crypt/privatekey/ChaCha.cpp | #include <cat/crypt/symmetric/ChaCha.hpp>
#include <cat/port/EndianNeutral.hpp>
#include <string.h>
using namespace cat;
//// ChaChaKey
ChaChaKey::~ChaChaKey()
{
CAT_OBJCLR(state);
}
static u32 InitialState[12] = {
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
// These are from BLAKE-32:
0x510e527f, 0x9b05688c... | ALGO | 0.998808 | 6.199884 |
131d4c89-02dd-4bfd-b348-bd67ee4eb9db | viniciuslfernandes/Estudos_Programacao_Competitiva | Contest_UFU_2024/1_String/C_Abreviando_N.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin>>ws, s);
for(int i=0; i<s.size(); i++){
while(s[i]!=' ' or i<s.size()){
cout<<s[i];
i++;
}
}
return 0;
} | ALGO | 0.983573 | 3.019794 |
1d4cf3ac-e5d9-4284-a25e-9382ed543376 | r4dhika/DSA_Assignment_1 | Q3/Q_3.cpp | #include <iostream>
using namespace std;
int threeSumClosest(vector<int>& nums, int target) {
int n=nums.size();
int v[n][n];
int sum = 0;
sort(nums.begin(), nums.end());
int less = 0, more = 0;
int temp = abs(nums[2] - (target - (nums[0]+nums[1])));
int achieved = nums[0] + nums[1] + nums[... | ALGO | 0.999981 | 5.39101 |
c6a508d6-fde4-4dde-a91d-001b0c252249 | Shruti0512/Leetcoding | 0283-move-zeroes/0283-move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n=nums.size();
int i=0,j=0;
while(i<n){
if(nums[i]!=0){
nums[j]=nums[i];
j++;
}
i++;
}
while(j<n){
nums[j]=0;
j++;
... | ALGO | 0.999946 | 6.596358 |
e8eb4c56-31e9-4318-b180-f72d4d95b3b9 | himanshu5-prog/vortexGPU | simX/util.cpp | #include <vector>
#include <iostream>
#include <stdexcept>
#include <math.h>
#include <climits>
#include <fcntl.h>
#include "types.h"
#include "util.h"
using namespace vortex;
Word vortex::signExt(Word w, Size bit, Word mask) {
if (w >> (bit - 1))
w |= ~mask;
return w;
}
void vortex::wordToBytes(Byte *b, Wor... | TOOL | 0.882296 | 5.452678 |
63ed2c55-d7db-47f7-a902-314e674e377b | RJ26012002/Problem_Solving-DSA- | 0017-letter-combinations-of-a-phone-number/0017-letter-combinations-of-a-phone-number.cpp | class Solution {
private:
void solve(string digits,vector<string> &ans,string output, int index,string str[]){
if(index >= digits.length()){
ans.push_back(output);
return;
}
int number = digits[index] - '0';
string value = str[number];
for(int i=0... | ALGO | 0.999971 | 6.738351 |
27ee91c8-9914-44e6-b990-144b73b14818 | omseervi098/Leetcode-GFG-Practice | 2731-movement-of-robots/2731-movement-of-robots.cpp | #define ll long long int
class Solution {
const ll mod=1e9+7;
public:
int sumDistance(vector<int>& nums, string s, int d) {
for(int i=0;i<nums.size() and d!=0;i++){
if(s[i]=='L') nums[i]=(nums[i]-d);
else nums[i]=(nums[i]+d);
}
sort(nums.begin(),nums.end());
... | ALGO | 0.999954 | 5.40372 |
5de1d4cc-f953-4eb0-a276-32101f4c73b4 | kaungsathan/kaungsathan.github.io | Z2P lvl 4/c++/introduction/while-eg4.cpp | #include<iostream>
using namespace std;
int main() {
int i = 1;
while (i < 6)
{
if(i%2) {
cout << i << " is odd number";
cout << "\n";
}
i++;
}
} | ALGO | 0.98263 | 3.379176 |
d74a4c0e-97a1-4dc0-8de9-791a4c9abd0a | dltxio/trustwallet-stacks | src/VeChain/Signer.cpp | #include "Signer.h"
#include "../Hash.h"
using namespace TW;
using namespace TW::VeChain;
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
auto transaction = Transaction();
transaction.chain... | ALGO | 0.995508 | 6.45118 |
a1c2b3f2-9159-4b4f-ad66-dd7dc2637dda | MahirSez/problem-solving | codeforces/1167/C.cpp | #include <bits/stdc++.h>
#define ll long long int
#define PI acos(-1)
#define read freopen("in.txt","r",stdin)
#define uu first
#define vv second
#define write freopen("out.txt","w",stdout)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define EPS 1e-8... | ALGO | 0.999977 | 4.137112 |
e3cf1f31-09e5-4378-8820-24219f5d7a08 | ishandutta2007/codeforces | superguymj/normal/1665/E.cpp | #include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x; i<=y; ++i)
#define pb push_back
using namespace std;
const int N=100005,M=4000005,D=30;
int n,q,ql,qr,a[N],root[N],tot,l[M],r[M],x,ans;
struct seg{int siz,x;} t[M];
vector <int> tmp;
void build(int &rt,int lst,int d)
{
if(!rt) rt=++tot,l[rt]=r[rt]=0;
if(d==-1)... | ALGO | 0.999798 | 4.544805 |
45352de2-e4c2-44cc-a65e-d57982d560a5 | MakinoRuki/Codeforces | R942/1972A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <ctime>
#include <list>
#define N 200005
#define M 5005
#define eps 1e-7
using namespace std;
typedef long l... | ALGO | 0.999902 | 3.543372 |
9cd3dbb8-3de4-4205-84bd-b8ac1ee42499 | mysticrecords/cpp-primer | Exercise_Section_1.4.1/Exercise_1.10/exercise_1.10.cpp | #include <iostream>
int main() {
int num {10};
while(num >= 0) {
std::cout << num << std::endl;
--num;
}
return 0;
}
| TOOL | 0.970324 | 3.738513 |
290934a9-b0ba-45c6-8aff-a3aa63ff0d1b | xsxszab/lock_free_cuckoo_filter | cuckoo_filter/lock_free_filter.cpp | #include <lock_free_filter.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
LockFreeCuckooFilter::LockFreeCuckooFilter(int capacity, int _thread_count) {
table_size = capacity;
if (table_size <= 0) {
std::cout << "error: invalid capacity" << std::endl;
abort();
... | ALGO | 0.968072 | 5.339027 |
a42de7e7-330f-4c27-9e2f-7035c6fb7e5a | adiecse/DSA_copy | LinkedList/codehelp/Q14]delete_without_head_pointer.cpp | /*
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
}*head;
*/
class Solution
{
public:
//Function to delete a node without any reference to head pointer.
void deleteNode(Node *del)
{
Node* prev=del; //did istake here direct did Node* prev=head; g... | ALGO | 0.999819 | 4.545598 |
6a9ffa1e-ed54-4ff0-920f-a6df7fa66015 | yashsoni501/Competitive-Programming | Codeforces/1325C.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define MOD 1000000007
#define endl "\n"
#define sz(a) (int)((a).size())
#define all(x) (x).begin()... | ALGO | 0.999892 | 3.968912 |
04d80651-d8c6-44d0-ae09-b3af0814c119 | Wei-Welles-Du/oneAPI_Essentials_Chinese | 12_DPCPP_Local_Memory_And_Atomics/lab/atomics_lab.cpp | using namespace sycl;
static constexpr size_t N = 1024; // global size
int main() {
queue q;
std::cout << "Device : " << q.get_device().get_info<info::device::name>() << "\n";
auto data = malloc_shared<int>(N, q);
for (int i = 0; i < N; i++) data[i] = i;
auto min = malloc_shared<int>(1, q);
auto max = ma... | ALGO | 0.997981 | 3.391592 |
43ee4b4f-bc5d-4d4f-9c3d-443fc01fea30 | imawadh/Code-Force-Problem | Contest on Code Forces/Harbour Space Scholarship/ncreasing_and_decresing.cpp | # include <bits/stdc++.h>
// Solved
using namespace std;
int main()
{
int test;
cin>>test;
for (int i =0; i<test ; i++)
{
int x,y,n;
cin>>x>>y>>n;
vector <int> arr(n);
int a = 1;
arr[0]=x;
arr[n-1]=y;
for(int j = n-2;j>0; j-- )
{
... | ALGO | 0.999577 | 3.956076 |
c7fa5b06-b44f-48c5-bf44-e11c34abebaf | pranavbhosale25/data-structures | recursion/generate-subsets.cpp | class Solution {
public:
void subsetHelper(int index, vector<int> nums, set<vector<int>> &subsets, vector<int> &currSubset){
if(index == nums.size()){
subsets.insert(currSubset);
return;
}
currSubset.push_back(nums[index]);
subsetHelper(index+1,nums,s... | ALGO | 0.999982 | 6.230226 |
8188e0a7-4e5d-4ba9-8302-17e38ef9fdf2 | kuanlu95/bullet | Demos/CollisionDemo/CollisionDemo.cpp | ///
/// Collision Demo shows a degenerate case, where the Simplex solver has to deal with near-affine dependent cases
/// See the define CATCH_DEGENERATE_TETRAHEDRON in Bullet's btVoronoiSimplexSolver.cpp
///
//#define CHECK_GENSHER_TRIANGLE_CASE 1
///This low-level internal demo does intentionally NOT use the btBull... | ALGO | 0.995539 | 6.242307 |
cd4c9c8b-4f3e-465b-bf04-813a341a9722 | sat-yad/codeforcesSolutions | 276_C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fl(w,x) for(ll i=w;i<x;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cin.tie(nullptr); cout.tie(nullptr);
#define nl cout<<"\n";
#define onjudge #ifndef ONLINE_JUDGE freopen("./input.txt", "r", stdin); freopen("./output.txt", "w",... | ALGO | 0.999785 | 3.375921 |
4ae9e04e-b3ab-4879-ae41-b538dc9d5849 | bvazquezj/Algoritmos-Computacionales | probar alg/P016-burbuja-bidirecional-tiempo.cpp | // Autores: Edna Martha Miranda Chvez
// Sergio Fuenlabrada Velzquez
//
// Ordenamiento Burbuja bidirecional
//
// Los datos de entrada los toma de un archivo guardado en el mismo directorio que el programa,
// esto se realizo con el objetivo de que en las pruebas no se tecleen todas las ... | ALGO | 0.99921 | 4.068947 |
404b5633-98ac-4c1c-8f08-020e796a20a5 | maddymundhra/DSA-Supreme-2.0 | CharArrays&Strings-Class1/reversestring.cpp | // Reverse a string
#include<bits/stdc++.h>
using namespace std;
void reverseString(char ch[], int len)
{
int left=0;
int right=len-1;
while(left<=right)
{
swap(ch[left],ch[right]);
left++;
right--;
}
}
int main()
{
char ch[100];
cin >> ch;
int len = strlen(ch);
... | ALGO | 0.999852 | 3.97697 |
f5b43376-85ca-405c-bd78-86dde8c24bc0 | myattg12/lab-activity | Lab1exer3.cpp | #include <iostream>
#include <string>
using namespace std;
/*Write a C++ program that calculates the average of four numbers – just like in the previous exercise –
but this time ask the user to enter which four numbers to calculate. You will have to use the cin
command to get all four numbers from the user.
Sample Outp... | ALGO | 0.98617 | 3.654347 |
579f7a4d-dd64-4341-98fb-89dd6a7be449 | EternalProg/Algorithms | LeetCode/DP/198. House Robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int evenSum = 0;
int oddSum = 0;
for(int i = 0; i < nums.size(); ++i) {
if(i % 2 == 0) {
evenSum = max(oddSum, evenSum + nums[i]);
}
else {
oddSum = max(evenSum, oddSum ... | ALGO | 0.999955 | 5.737872 |
c9fc9876-7f66-40b7-bd97-4190156a4210 | Moontasir1091/Competetive_PRGRM | Problem Solving (Rating Based)/R - 1400/B. T-shirt buying.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
int p[N];
int a[N];
int b[N];
int main()
{
int n; cin>>n;
for(int i=1; i<=n; i++){ cin>>p[i];}
for(int i=1; i<=n; i++) {cin>>a[i];}
for(int i=1; i<=n; i++) {cin>>b[i];}
priority_queue<int, vector<int>, greater<int>> pq[5... | ALGO | 0.999981 | 4.075855 |
bfafa862-4e12-4791-b39f-56c5366ce78f | TheDev05/CARDIO | CodeForces/Rating 1400/C_Everyone_is_a_Winner.cpp | /*
Believe in your Karma & Keep chanting,
"Hare Rama Hare Rama, Rama Rama Hare Hare,
Hare Krishna Hare Krishna, Krishna Krishna Hare Hare !!"
Prayers. Practice. Patience.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using n... | ALGO | 0.999752 | 4.612672 |
2d11bb1d-fd72-43f7-b002-cae5ccafc950 | Mausoomi12/LeetCode-Questions | 1402-reducing-dishes/1402-reducing-dishes.cpp | class Solution {
public:
int helper(vector< int> &nums, int i, int j, vector<vector<int>> &dp){
if(i==nums.size()){
return 0;
}
if(dp[i][j]!=-1)
return dp[i][j];
int pick = j*nums[i] + helper(nums, i+1, j+1, dp);
int notpick = helper(nums,i+1,j,dp);
... | ALGO | 0.999882 | 5.669463 |
f26b08ae-5dc4-4017-aeaa-192ea4e6ac71 | hakim-dev/CPP | CPP-Assignment/Q12.cpp | /*Q12. Write a C++ Program to swap two
numbers using third Variable*/
#include <iostream>
using namespace std;
int main() {
// Variable declaration
int num1, num2, temp;
// Input the dividend and divisor
cout << "Enter Num1: ";
cin >> num1;
cout << "Enter Num2: ";
cin >> num2;
// Di... | ALGO | 0.999465 | 5.251049 |
e92a59e7-02c7-4454-ac40-c4a9209f8f7f | Abid-Ali-01/DSA | Data Structures/Stack/Stack.cpp | // C++ program to Implement a stack
// using singly linked list
#include <bits/stdc++.h>
using namespace std;
// creating a linked list;
class Node {
public:
int data;
Node* link;
// Constructor
Node(int n)
{
this->data = n;
this->link = NULL;
}
};
class Stack {
Node* top;
public:
Stack() { top = NULL; ... | ALGO | 0.999367 | 5.766428 |
f6de857d-437d-4b5c-ad9e-c39c83a57c5d | zhangzhiguo-fighting/HaizeiOJ | 数据结构复习习题/41.墙壁涂色3.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define MAX_N 1000
struct BigInt: public vector<int> {
BigInt(int x = 0) {
push_back(x);
normal();
... | ALGO | 0.999971 | 3.656429 |
5227aa8c-6945-4a42-8c2f-840ef805d2d3 | The-Loved-One/IPMP | Week1/q22_key_triplet.cpp | #include <bits/stdc++.h>
using namespace std;
//tried hashing from knowledge, didnt work
//"as expected" <= NOOB
class Solution{
public:
bool find3Numbers(int arr[], int n, int x)
{
// unordered_set<int> ans;
// for (int i = 0; i < n; i++) {
// for (int j = 1; j < n; j++) {
... | ALGO | 0.999943 | 5.282926 |
653d9e99-87a0-4715-9f26-add56ceb66ab | mohit-negi/interviewPrep | cplusplus/cpp-dsa/insertAtMiddle.cpp | #include<iostream>
using namespace std;
//initializing a node
class node{
public:
int data;
node* next;
//constructor for creating node
node(int d)
{
data = d;
next = NULL;
}
};
void insertAtHead(node*& head,int ... | ALGO | 0.999879 | 5.006574 |
fdee686d-94bb-42cc-9f9e-a871b94a96ad | ImtiazAhmedAkash/Problem-Solving | codeforces/1972/A.cpp | /* In the Name of ALLAH, the most gracious, the most merciful */
// Contest Proposal
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl '\n'
#define deb(x) cerr << #x << " = " << x << nl
const int inf = 1e9;
const ll INF = 1e18;
const int mod = 998244353;
const int N = 2e5 + 5;
void so... | ALGO | 0.999928 | 5.269019 |
f36d8ec8-6b62-4124-acf5-8a6f1393a38d | jiangpingPlus/SystemDesign | class4/sortedArray2BinaryTree.cpp | TreeNode* helper(vector<int>num, int first, int last){
if(first > last){
return NULL;
}
if (first == last) {
TreeNode* parent = new TreeNode(num[first]);
return parent;
}
int mid = (first + last) / 2;
TreeNode *leftchild = helper(num, first, mid - 1);
TreeNode *right... | ALGO | 0.999993 | 5.725657 |
f27db59d-f45d-46ed-9828-c12b83682b4e | ishandutta2007/codeforces | rama_pang/normal/427/C.cpp | /**
* Author : rama_pang
* Problem : https://codeforces.com/problemset/problem/427/C
* Time : O(N + M)
* Memory : O(N + M)
**/
#include <bits/stdc++.h>
using namespace std;
template<int SZ>
struct SCC {
int N, comp[SZ];
vector<int> adj[SZ], rev[SZ];
vector<int> bigComp, todo;
int vis[SZ];... | ALGO | 0.999978 | 4.743599 |
f4d62b5c-af66-4a29-b102-fc7babf3befd | ziademad2004/embedded_project | ProfessionalTicTacToe-not_completed_8th_version/src/aiopponent.cpp | #include "../include/aiopponent.h"
#include <QTimer>
#include <QRandomGenerator>
using Player = GameLogic::Player;
AIOpponent::AIOpponent(QObject *parent)
: QObject(parent), m_gameLogic(nullptr)
{
}
void AIOpponent::setGameLogic(GameLogic *gameLogic) {
m_gameLogic = gameLogic;
}
void AIOpponent::makeMove() {... | ALGO | 0.932096 | 6.072023 |
8ac0b065-7285-4a41-8760-b3010c4eee04 | veeresh-desai/DATA-STRUCTURES-AND-ALGORITHMS | unit 2/lexture 12/circular_insertion_list.cpp | #include <iostream>
using namespace std;
struct Node {
int data;
Node* link;
};
typedef Node* NODE;
NODE getnode() {
NODE x = new Node();
return x;
}
// Function to insert an item at the front of the circular linked list
NODE insertAtFront(NODE head, int item) {
NODE temp = getnode();
temp->... | ALGO | 0.999948 | 5.644108 |
bea3e200-564c-4d29-be68-4ce927be014b | roukaour/reddit-recommender-systems | collaborative/collaborative.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <tuple>
#include <random>
#include <algorithm>
#include <limits>
#include <ctime>
#include "collaborative.h"
std::string g_directory("C:/Users/Remy/Desktop/590/");
std::string... | ALGO | 0.994022 | 5.945682 |
716def1b-c55d-4816-bb05-94f13225acd6 | stpettersens/180-degrees | sumfor.cpp | /*
C++ Primer: Exercise 1.13 "Sum of 50 to 100 with for-loop"
sumfor.cpp
*/
#include <iostream>
int main() {
int max = 100;
int sum = 0;
for(int i = 50; i <= max; ++i) { // inclusive <=
sum += i;
}
std::cout << "Sum of 50 to 100 is " << sum << std::endl;
return 0;
}
| ALGO | 0.999795 | 4.362465 |
dd46f7b0-ff94-4505-90c0-c22b16973c85 | vararais/CircularQueuesArray_0049 | CircularQueue/CircularQueue.cpp | #include <iostream>
using namespace std;
class Queues {
int FRONT, REAR, max = 5;
int queue_array[5];
public:
Queues() {
FRONT = -1;
REAR = -1;
}
void insert() {
int num;
cout << "Enter a Number: ";
cin >> num;
cout << endl;
//Cek apakah an... | ALGO | 0.988212 | 4.961127 |
e734ccaa-7d49-459e-8065-16f5d2e64460 | Sayemahamed/cpp | C_Closest_to_the_Right.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long numbers,query;
cin >> numbers >> query;
vector<long long> data(numbers);
for(auto &it : data)cin >> it;
while(query--)
{
long long x;
cin >> x;
cout<<lower_bound(data.begin(),data.end(),x)-data.begin()<<e... | ALGO | 0.999929 | 4.571912 |
2ad9c641-b036-42f5-9884-b51d875c6a80 | OsamaDW2002/Problem_Solving_Practice | Frequency_Array/Boy_or_Girl.cpp | /*
*
* Problem Name : Boy or Girl
* URL : https://codeforces.com/problemset/problem/236/A
* Solved By : Osama Dweikat
*
* Comments About The Solution : this problem solved by using frequency array just to practice the concept , i can make the solution more efficient by using set
*
* */
#include <bits/stdc++.h>... | ALGO | 0.998972 | 4.397561 |
622fa3e7-b4d8-4a73-aaf1-ded4a1ed68dc | happy8541/stormDev | src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp | /* ScriptData
SDName: Boss_Celebras_the_Cursed
SD%Complete: 100
SDComment:
SDCategory: Maraudon
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
enum Spells
{
SPELL_WRATH = 21807,
SPELL_ENTANGLINGROOTS = 12747,
SPELL_CORRUPT_FORCES = 21968
};
class celebr... | TOOL | 0.864942 | 7.126202 |
b56bc741-0521-40f0-b00d-96137e1681c1 | ishandutta2007/codeforces | matrixcascade_qwq/normal/1657/A.cpp | //#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4", "avx")
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define int long long
#define YES puts("YES")
#define NO puts("NO")
#define Yes puts("Yes")
#define No puts("No")
#define edl p... | ALGO | 0.999895 | 3.69365 |
285f66e3-0738-40b6-9cd9-475f113e77a2 | revbayes/revbayes.archive | src/revlanguage/functions/math/Func_posteriorPredictiveProbability.cpp | #include "PosteriorPredictiveProbabilityFunction.h"
#include "Func_posteriorPredictiveProbability.h"
#include "ModelVector.h"
#include "Real.h"
#include "RealPos.h"
#include "RlDeterministicNode.h"
#include "TypedDagNode.h"
using namespace RevLanguage;
/** default constructor */
Func_posteriorPredictiveProbability::F... | ALGO | 0.995178 | 6.894706 |
a8fcc4b0-a921-444d-91a3-d6bfca13cd4b | mqjinwon/ComputerVision | Homeworks_CV/eigen-3.3.8/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.998453 | 4.306757 |
b9b8e8ae-e53e-4e91-92a8-c997da4622c5 | hossainsiam133/Object-Oriented-Programming | Building Blocks of OOP/Friend_Class_03.cpp | #include <iostream>
using namespace std;
class c1
{
private:
int a;
public:
void setA(int x)
{
a = x;
}
// Member function to display the value of 'a' inside c1
void display()
{
cout << "Value of a inside c1: " << a << endl;
}
// Friend class declaration for c3
f... | ALGO | 0.852308 | 5.707554 |
146e20a2-4496-401f-8aa5-ecd62aa8fcb6 | rpalovics/Alpenglow | cpp/src/main/utils/PopContainers.cpp | #include "PopContainers.h"
void PopContainer::increase(int item){
resize(item);
popularities_[item]++;
}
void PopContainer::reduce(int item){
popularities_[item]--;
}
void PopContainer::resize(int item){
if((int)popularities_.size()<item+1) popularities_.resize(item+1);
}
int PopContainer::get(int item) con... | TOOL | 0.953374 | 3.867908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.