uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
480cee15-36e1-4bf1-80ed-6b04fd17336a | HernandezAlvarezAlejandro/3erParcial_v2.0 | act5.cpp | #include <iostream>
using namespace std;
int main()
{
float p,s;
int h;
cout<<"Ingresa las horas trabajadas: ";
cin>>h;
cout<<"Ingresa lo cobrado por hora: ";
cin>>s;
if (h<=40){
p=h*s;
}
else{
p=40*s+(h-40)*s*1.5;
}
if (h>=50){
p+=(h-50)*s*0.5;
... | ALGO | 0.999081 | 3.454349 |
6ef29e97-8775-47c2-a357-fe979fb46578 | liyuan989/exercise | c++ primer, 4th Edition/Unit16/16.1/16-1.cpp | #include <iostream>
#include <string>
template <typename T>
inline T AbsoluteValue(const T &obj)
{
return (obj >= 0) ? obj : (-1*obj);
}
int main(int argc, char const *argv[])
{
std::cout << AbsoluteValue(1) << std::endl;
std::cout << AbsoluteValue(-1) << std::endl;
std::cout << AbsoluteValue(9.99) << std::endl;... | TOOL | 0.984538 | 5.526012 |
7401db98-547c-4924-bfb1-8308250f6b65 | ustcwpz/USTC-CS-Courses-Resource | 大二下/物联网导论/QRCode/decode/QZXing/zxing/zxing/qrcode/decoder/QRDecodedBitStreamParser.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <zxing/qrcode/decoder/DecodedBitStreamParser.h>
#include <zxing/common/CharacterSetECI.h>
#include <zxing/FormatException.h>
#include <zxing/common/StringUtils.h>
#include <iostream>
#ifndef NO_ICONV
#include <iconv.h>
#endif
// Require... | TOOL | 0.905522 | 4.699557 |
6c93ca87-475d-408e-8994-fdc826335af2 | masterchief007/UnrealEngine | Engine/Plugins/Experimental/GeometryProcessing/Source/DynamicMesh/Private/MeshWeights.cpp | #include "MeshWeights.h"
#include "VectorUtil.h"
FVector3d FMeshWeights::UniformCentroid(const FDynamicMesh3 & mesh, int32 VertexIndex)
{
FVector3d Centroid;
mesh.GetVtxOneRingCentroid(VertexIndex, Centroid);
return Centroid;
}
FVector3d FMeshWeights::UniformCentroid(const FDynamicMesh3& mesh, int32 VertexIndex, T... | ALGO | 0.998248 | 7.225409 |
35e3bf96-ebac-45e7-b1d3-b8fb252fb89c | kossa56/CPP-algorytmy | klasa_4/schemat_hornera/zamiana_systemu/oct2dec.cpp | #include <bits/stdc++.h>
//Micha Kossakowski 4E
using namespace std;
long long oct2dec(string s){
long long W=0;
for(int i=0; i<s.size(); i++){
W=W*8+int(s[i]-'0');
}
return W;
}
int main(){
string liczba;
cin>>liczba;
cout<<oct2dec(liczba);
return 0;
}
| ALGO | 0.945149 | 4.087515 |
50b21ac3-f022-4a21-9424-ec36c23a220f | Exr0nProjects/learn_cpp | problems/usaco/gold/x2018dec/xdining/main_dining.cpp | /*
TASK: dining
LANG: C++14
*/
/*
* Problem dining (usaco/gold/2018dec/dining)
* Create time: Thu 26 Mar 2020 @ 08:34 (PDT)
* Accept time: [!meta:end!]
*
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <tuple>
#include <vector>
#include <string>
#include <cstring>
#include <list>
#include <a... | ALGO | 0.999957 | 4.73725 |
bd7a5a15-788b-4bb1-9fb7-8a38dab6ec39 | Deepti675/Leet_Code | Array_Easy/measuring-weights-54c2dc75-b4ccf064.cpp | //https://www.hackerearth.com/problem/algorithm/measuring-weights-54c2dc75-b4ccf064/
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
long long dp[n];
dp[0] = arr[0];
for(int i=1;i<n;i++){
... | ALGO | 0.99994 | 3.96225 |
9a8f3931-211a-44d1-8ace-4d20b0803dd2 | samlinwc/assignment4 | TestTree.cpp | #include "treenode.h"
#include "tree.h"
#include <iostream>
#include <sstream>
using std::cout;
using std::endl;
using std::ostringstream;
class JustAnInt {
public:
int x;
bool operator<(const JustAnInt & other) const {
return (x < other.x);
}
};
int main() {
int retval ... | TEST | 0.955406 | 6.029825 |
9d1ff5b4-d8e5-44ae-a4fe-61604c4afa54 | norberto-schmidt/openmc-surftrack | src/distribution_energy.cpp | #include "openmc/distribution_energy.h"
#include <algorithm> // for max, min, copy, move
#include <cstddef> // for size_t
#include <iterator> // for back_inserter
#include "xtensor/xview.hpp"
#include "openmc/endf.h"
#include "openmc/hdf5_interface.h"
#include "openmc/math_functions.h"
#include "openmc/random_lcg... | ALGO | 0.982492 | 6.062912 |
0bd462f3-a0fe-4dac-94fb-bf1cf7ebd748 | MaxSally/Competitive_Programming | UVA Book/cpbook-code-master/cpbook-code-master/ch9/SparseTable.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 10000 // adjust this value as needed
#define L2_N 14 // 2^14 = 16384 > 10000, adjust this value as needed
class RMQ { // Range Minimum Query
private:
int i, j, k, x, y, P2[L2_N], L2[(... | ALGO | 0.99997 | 4.60104 |
578b7925-358e-4c11-896f-c92cb9ad244a | Avishi2407/Leetcode-Solutions-in-Java-C- | 3249-minimum-number-of-operations-to-make-array-xor-equal-to-k/minimum-number-of-operations-to-make-array-xor-equal-to-k.cpp | class Solution {
public:
int minOperations(vector<int>& nums, int k) {
int finalXor = 0;
// XOR of all integers in the array.
for (int n : nums) {
finalXor = finalXor ^ n;
}
int count = 0;
// Keep iterating until both k and finalXor becomes zero.
... | ALGO | 0.999975 | 6.120522 |
aec5e477-fdf6-496d-b282-a53acb95ee36 | chiragsawarn/DP | 2_Unbounded-Knapsack-Variants/3_Coin-Changing-Max-Ways_rec.cpp | // GFG - You don't have access to this problem
// https://www.geeksforgeeks.org/coin-change-dp-7/
#include <bits/stdc++.h>
using namespace std;
int t[101][101];
int maxWaysToChange(int a[], int n, int amount){
if(amount == 0) return 1;
if(n == 0) return 0;
if(t[n][amount] != -1) return t[n][amount];
... | ALGO | 0.99992 | 5.484085 |
e21c8f7d-a1b1-466b-b320-b8aea0bad091 | Derrc/cp | cf/1800/kings_path/kings_path.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <deque>
using namespace std;
using pii = pair<int, int>;
// BFS from start to end
// Can store allowed / visited in memory since total sum of allowed segments is <= 10^5
int dx[8] = {0, 1, 0, -1, -1, -1, 1, 1};
int dy[8] = {1, 0, -1, 0, -1, ... | ALGO | 0.999892 | 4.374676 |
d7eae35c-de46-40e1-839e-a6fa29285d65 | Keep-Coding-Club/Algorithm | Kim-Seongyeong/self-study/0x10-DP/BOJ_2294(DP).cpp | /*
11047 ->
https://www.acmicpc.net/problem/11047
2294 X -> DP
https://www.acmicpc.net/problem/2294
*/
/*
Ǯ
https://coco-ball.tistory.com/20
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, k;
cin >> n >> k;
int coin[101];
int... | ALGO | 0.999985 | 4.109827 |
26897adb-06fc-43f0-b30c-3866d0c86ebc | ferluht/pocketdaw | 3rdparty/bgfx/3rdparty/spirv-tools/source/fuzz/transformation_add_dead_continue.cpp | #include "source/fuzz/transformation_add_dead_continue.h"
#include "source/fuzz/fuzzer_util.h"
namespace spvtools {
namespace fuzz {
TransformationAddDeadContinue::TransformationAddDeadContinue(
const spvtools::fuzz::protobufs::TransformationAddDeadContinue& message)
: message_(message) {}
TransformationAdd... | TOOL | 0.918608 | 7.762632 |
9ec4b428-4599-48dc-8268-9bdf27228497 | M-SAAVE/Ardupilot_dev | libraries/AP_IOMCU/iofirmware/mixer.cpp | /*
mixer for failsafe operation when FMU is dead
*/
#include <AP_HAL/AP_HAL.h>
#include <AP_Math/AP_Math.h>
#include <SRV_Channel/SRV_Channel.h>
#include "iofirmware.h"
#define ANGLE_SCALE ((int32_t)4500)
#define RANGE_SCALE ((int32_t)1000)
/*
return a RC input value scaled from -4500 to 4500
*/
int16_t AP_IOM... | TOOL | 0.853986 | 6.855888 |
33970ff3-7301-4a27-9237-76f76f41aa07 | dev-area/C-CPP | design patterns/stl examples/cont/set2.cpp | #include <iostream>
#include <set>
using namespace std;
int main ()
{
set<int> c;
c.insert(1);
c.insert(2);
c.insert(4);
c.insert(5);
c.insert(6);
cout << "lower_bound(3): " << *c.lower_bound(3) << endl;
cout << "upper_bound(3): " << *c.upper_bound(3) << endl;
cout << "equal_range... | ALGO | 0.982091 | 4.008673 |
3b266cd9-9cd2-452e-bfb2-8692d9142b65 | ss-shrishi2000/Algorithms_On_Graphs | week3_paths_in_graphs1/2_bipartite/bipartite.cpp |
Checking whether a Graph is Bipartite
Problem Introduction
An undirected graph is called bipartite if its vertices can be split into two parts such that each edge of the
graph joins to vertices from different parts. Bipartite graphs arise naturally in applications where a graph
is used to model connections between obj... | ALGO | 0.999969 | 5.770221 |
d6dacc6a-8696-4b18-9752-4db8a4681930 | raincross7/code-similarity | codes/train_code/problem088/problem088_401.cpp | #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<... | ALGO | 0.999703 | 3.749867 |
3b8bdcdc-ddb9-4a81-98a4-8132256387ff | blockspacer/bootstrap-redux | ext/boost-1.70.0/libs/sort/example/boostrandomgen.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <stdio.h>
#include "stdlib.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <boost/random.hpp>
using std::string;
using namespace boost;
int main(int argc, const char ** argv) {
//Always seed with the same ... | TOOL | 0.97392 | 3.996213 |
5abfa6c7-e78e-454a-8cac-700438a042a2 | enzoBrum/competitive-programming | kattis/muddyhike.cpp | #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using iii = tuple<int, int, int>;
vector<vector<pii>> prim(vector<vector<pii>> &adj) {
priority_queue<iii, vector<i... | ALGO | 0.999965 | 4.27424 |
bacedb05-8f6b-4e98-b96c-d3c02b8150e9 | heesangh/spmm-llm-optimization | optim5/doc/examples/TutorialLinAlgInverseDeterminant.cpp | #include <iostream>
#include <Eigen/Dense>
int main() {
Eigen::Matrix3f A;
A << 1, 2, 1, 2, 1, 0, -1, 1, 2;
std::cout << "Here is the matrix A:\n" << A << std::endl;
std::cout << "The determinant of A is " << A.determinant() << std::endl;
std::cout << "The inverse of A is:\n" << A.inverse() << std::endl;
}
| ALGO | 0.999859 | 4.572668 |
d9302da0-64c4-4e66-9943-89f6896ca2f9 | josahe/model-predictive-control | src/Eigen-3.3/failtest/qr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.887556 | 3.076401 |
4eab77e4-0ba8-4bb2-9a60-a16f6066ce0b | nirajchittodiya/codes_DSA | Lec 9 Arrays/sumOfvector.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int size;
cout<<"Enter size: ";
cin>>size;
vector<int> v(size);
int n = size;
int ele;
while(n--){
cin>>ele;
v.push_back(ele);
}
int sum = accumulate(v.begin(),v.end(),0);
cout<<sum<<endl;
return 0;
} | ALGO | 0.999204 | 3.990043 |
24a36e83-0e0a-4731-964a-d77dfa223155 | rayaq-siddiqui/semantic_segmentation_self_driving_cars | user_trained_enet_model/boost_1_79_0/libs/compute/perf/perf_rotate.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/rotate.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int ma... | ALGO | 0.984229 | 5.683743 |
453d75b7-866c-495e-b1db-ad0ef14633d2 | rjsuraj/DSA-with-Pw-Skills | Assignment_Questions - Arrays/2.cpp | #include<iostream>
using namespace std;
int main()
{
int arr[] = {2,3,4,1,5};
int max = INT_MIN , min = INT_MAX;
for(auto element : arr){
if(element > max)
max = element;
if(element<min)
min = element;
}
cout<<max<<" "<<min;
} | ALGO | 0.999815 | 3.706191 |
32b4e3ae-f8bc-41f8-ad32-d3a12a7147ce | hljeong/cp | kattis/cocoacoalition.cpp | #include <bits/stdc++.h>
using namespace std;
#define vc vector
using vi = vc<int>;
using ll = long long;
const int maxn = 1e5+5;
const int inf = 1e9;
int main() {
ll n, m, a; cin >> n >> m >> a;
ll b = n * m - a;
if (!(a % m) || !(a % n) || !(b % m) || !(b % n)) {
cout << 1 << endl;
return 0;
}
for... | ALGO | 0.999982 | 3.810437 |
85bd70b0-64dd-4f67-ac48-02d0c1823251 | QuietkidAniket/codeforces | contest_995/D.cpp | #include <bits/stdc++.h>
using namespace std;
void solve();
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("/Users/aniketkundu12072004/codeforces/input.in", "r+", stdin);
freopen("/Users/aniketkundu12072004/codeforces/output.out", "w", stdout);
i... | ALGO | 0.999493 | 4.34662 |
3bc3e03d-d886-4c92-9ce9-7b7f88eacce3 | deeptesh-rout/Leetcode-Solutions--Advanced-- | Pacific Atlantic Water Flow - Leetcode 417/Pacific Atlantic Water Flow - Leetcode 417.cpp | #include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
class Solution {
public:
vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {
vector<vector<int>> result;
if (heights.empty() || heights[0].empty()) return result;
int m = heights.size();
... | ALGO | 0.999955 | 7.091601 |
9c698a6a-5ded-4c8f-9ee3-2933b1757143 | PrinceInScripts/Leetcode-Question | 3. May 2024/Problem 4 {Subsets}/Questionc.cpp | /*
# 78.Subsets
*/
/*
Given an integer array nums of unique elements, return all possible
subsets
(the power set).
The solution set must not contain duplicate subsets. Return the solution in any order.
Example 1:
Input: nums = [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Example 2:
Input: nums = [0]... | ALGO | 0.999395 | 6.60113 |
6409dcba-4747-4d82-9433-3a4350f62336 | ldjhust/algorithm-and-datastructure | src/InsertSort_Demo.cpp | #include "Swap.h"
#include "InsertSort.h"
#include "PrintArray.h"
int main(int argc, char *argv[])
{
int array[] = {10, 9, 4, 3, 6, 2, 8, 1, 7, 5};
printf("before sort:\n");
printarray(array, 10);
InsertSort(array, 10);
printf("afte sort:\n");
printarray(array, 10);
return 0;
}
| ALGO | 0.996234 | 4.006196 |
2f639bcb-85bf-4a7a-8fa3-44d2a5569c35 | R41NB0W-D4SH/OOP_Lab_Work | Lab_2/task7.cpp | #include <iostream>
using namespace std;
int main()
{
setlocale(0, "");
unsigned int time;
double per, dep;
cout << "Введите начальный вклад: ";
cin >> dep;
cout << "Введите число лет: ";
cin >> time;
cout << "Введите процентную ставку: ";
cin >> per;
per /= 100;
for (in... | ALGO | 0.983082 | 3.68825 |
7ae39aaa-bd26-43a7-a0b8-f315923cea19 | clockzhong/WrapLAMP | Boost/libs/spirit/example/x3/calc/calc4.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating generation of AST. The AST,
// once created, is traversed, 1) To print its contents and
// 2) To evaluate the result.
//
// [ JDG April 28, 2008 ] For BoostCon 2008
// [ JDG February 18, 20... | TOOL | 0.921277 | 7.847742 |
51527e15-cdfd-42ba-b6c1-6688e646aff0 | 0nT31ee9/Asterism | src/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/bulirsch_stoer.cpp | #include <iostream>
#include <fstream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <boost/array.hpp>
#include <boost/ref.hpp>
#include <boost/numeric/odeint/config.hpp>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/odeint/stepper/bulirsch_stoer.hpp>
#include <boost/numeric/odeint/stepper/bulirs... | ALGO | 0.999914 | 5.710762 |
5e5ac668-fdb3-4f4e-bfa0-84dde628ccc1 | liardanc3/algorithm | cpp/3425.cpp | #include <bits/stdc++.h>
#define MX 1'000'000'000
#define int long long
using namespace std;
typedef pair<string, int> psi;
string cmd, ans="";
vector<psi> vect;
int num, n;
signed main() {
ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
while (cin >> cmd) {
vect.clear();
if (cmd == "QUIT")
... | ALGO | 0.999511 | 4.399795 |
35bbfe40-22fd-4cef-8720-11fd4707da78 | invrev/ctci | prog_challenge/findMissingNumber.cpp | #include<iostream>
using namespace std;
int findMissingNumber (int a[],int n) {
int result = 0;
int x1 = 0;
int x2 = 0;
for (int i=0;i<l;i++) {
x1 = x1 ^ a[i];
}
for (int i=1;i<=l+1;i++) {
x2 ^= i;
}
result = x1 ^ x2 ;
return result;
}
void test(int a[]) {
int ... | ALGO | 0.999173 | 3.515242 |
afad3b44-f801-43a0-81a9-b21c77a87164 | 0-jij-0/CompetitiveProgramming | Problems Archive/1000 - 1999/1635 - Planet Lapituletti.cpp | #include <iostream>
#include <string>
using namespace std;
int h, m;
string mirror = "015aa2aa8a";
bool valid(string H, string M) {
if (H.size() == 1) { H.insert(H.begin(), '0'); }
if (M.size() == 1) { M.insert(M.begin(), '0'); }
swap(H[0], H[1]); swap(M[0], M[1]);
if (mirror[H[0] - '0'] == 'a') { return false; }... | ALGO | 0.999737 | 5.678093 |
796ec2c8-b06f-4d66-93b4-f23aba0ed697 | paulpaul91/c-_practice | VisualStudio2012/3/vecScores.cpp | #include <string>
using std::string;
#include <vector>
using std::vector;
#include <iostream>
using std::cin; using std::cout; using std::endl;
int main()
{
// hold the grades we read from the standard input
vector<unsigned> grades;
// count the number of grades by clusters of ten:
// 0--9, 10--19, . .. 90--9... | TOOL | 0.952598 | 4.363571 |
09f7c7be-823f-4db7-aef4-62fe5fc3a745 | myerraymond/Applied_Programming | Assignment_3.cpp | /* Myer Raymond #18035406 */
#include <iostream>
#include <iomanip>
using namespace std;
//Function problem(c) works. Remove (//), and highlight, ctrl + / on text not in function.
/*i started with a function, then got stuck so tried it without a function, then figured it out
so the function works also, just need t... | TOOL | 0.937088 | 3.568818 |
5cfadeb4-c5b9-4cf5-b229-351d505f23b8 | ayushbdkt-01/Striver-A2Z-DSA-Sheet | Linked List/addTwoNumbers.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
Node(int d){
data=d;
next=NULL;
}
Node(int d,Node* nex){
data=d;
next=nex;
}
};
Node* arrayToLinkedList(vector<int> arr){
Node* head=new Node(arr[0]);
Node* temp=head;
fo... | ALGO | 0.999982 | 5.419749 |
35c9a828-8b7b-4a8d-b09f-d785bfbb9976 | icyrhyme/zoj | 1978.cpp | #include <cstdio>
#define MAXN 3000
#define MAXL 33900
using namespace std;
int ans[MAXN], a[MAXL];
int main() {
for(int i = 0; i < MAXL; ++i) {
a[i] = i + 2;
}
int len = MAXL;
for(int i = 0; i < MAXN; ++i) {
int val = a[0], j;
ans[i] = val;
//printf("%d\n", val);
for(j = 0; j < len; j += val) {
a[j] =... | ALGO | 0.999954 | 3.302072 |
c8e2433c-ef6b-4531-a617-1451c7c31f3d | ShreyKhanduja/DSA-Sheet | populate_next_pointers.cpp |
Node *connect(Node *root) {
// edge case
if(!root)
return NULL;
queue<Node*> q;
q.push(root);
Node *curr;
// perform BFS: level order traversal
while(!q.empty()) {
int n = q.size(); // denotes the number of nodes in the current level
for(int i = 0; i < n; i++) {
... | ALGO | 0.999448 | 4.062452 |
ca11d262-c736-4a90-9cd9-00f41ad333b3 | Sookmyung-Algos/2021algos | algos_assignment/3rd_grade/김도은_whaeun25/2nd_week2/5576.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int>w;
vector<int>k;
int main() {
for (int i = 0; i < 10; i++){
int a;
cin >> a;
w.push_back(a);
}
for (int i = 0; i < 10; i++){
int a;
cin >> a;
... | ALGO | 0.999911 | 3.026053 |
334a9454-6f78-4d26-86ad-3a2fb1d03e6b | Larissa-D-Gomes/AnimationAndCGIMotion | t1m2/starter_code/include/eigen/bench/vdw_new.cpp | #include <Eigen/Array>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &interactions2)
{
retur... | ALGO | 0.999889 | 3.438695 |
f0e06d66-a397-4cdc-ac38-d3b27cd2e6d9 | wupsi/60DaysOfAlgorithms | Days/Day16/Problems/A.cpp | class Solution {
public:
int BinarySearch(vector<int>& array, int size, int value){
int first = 0, last = size - 1, mid;
while(true){
mid = (first + last) / 2;
if(value < array[mid])
first = mid + 1;
else if(value > array[mid])
last = mid - 1;
else
return mid;
}
}
void QuickS... | ALGO | 0.99993 | 5.918711 |
6b630d01-99c0-42c2-bd6f-70687c08e9ee | Wan1302/Data-Structure-and-Algorithm | CTDL-3/DaThuc.cpp | #include <bits/stdc++.h>
using namespace std;
struct DONTHUC{
int somu;
double heso;
DONTHUC(double _heso = 0,int _somu=0){
heso = _heso;
somu = _somu;
}
DONTHUC& operator = (const DONTHUC &rhs){
if (this == &rhs) return *this;
this->heso = rhs.heso;
this->somu = rhs.somu;
return *this;
}
};
st... | ALGO | 0.995282 | 4.214066 |
b736b6b8-a5cd-413c-90c2-6a3c24ad104b | KBC-1315/toonflix | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998756 | 6.772262 |
75d6d96e-2594-47b8-8628-8ae1551281ce | Kongkai670610723/practice-exam | pretest3.cpp | #include<iostream>
#include<cmath>
using namespace std;
int adif(int a,int b){
if ( a >= 360 || a <= 360){
a %= 360;
}
if (b >= 360 || b <= 360){
b %= 360;
}
if (abs(360 - abs(a-b)) < abs(a - b)){
return abs(360 - abs(a -b));
}else{
return abs(a - b);
}
}
i... | ALGO | 0.99989 | 3.613419 |
da2e50ca-e55f-4aa1-8191-1c459f2b12a5 | vaishdho1/DSA | Tries/cnt_pairs_with_xor_in_range.cpp | /*
Given an array count pairs (i,j) such that the xor is in the range
low and high.
Approach:
1) We can use a Trie based appraoch for this.
2) The basic idea is to store the numbers in a trie and
before storing to count the number of numbers with xor in range low and high.
3) The problem here is that, counting requir... | ALGO | 0.999989 | 5.917721 |
6dfeb8dc-da35-40a6-a1c5-fc2ba2bc6c2d | LeTuan93/Toan-roi-rac-2 | 6.6 Shortest path using Floyd algorithm.cpp | #include<iostream>
#include<vector>
using namespace std;
const int INF=1e9;
int d[100][100];
int nex[100][100];
int a[100][100];
int n;
void floyd(){
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++){
d[i][j]=a[i][j];
if (a[i][j]!=INF) nex[i][j]=j;
else nex[i][j]=0;
}
}
for (int k=1;k<=n;k++){
for (i... | ALGO | 0.99994 | 3.502453 |
ab4b7d3c-3f79-4ed6-99e8-4bd5a7ef46c9 | priyanshuyadav28/C-plus-plus-Tutorial | tut57.cpp | // VIRTUAL FUNCTIONS EXAMPLES + CREATION RULE IN C++.
#include <iostream>
#include <cstring>
using namespace std;
class CWH
{
protected:
string title;
float rating;
public:
CWH(string s, float r){
title = s;
rating = r;
}
virtual void display() {}
};
class CWHVideo : public CWH{
float videoLen... | TOOL | 0.953619 | 5.051644 |
a69151c0-90ff-4651-86f4-e47229a029cf | Shubh08am/Leetcode_DSA_Problems-Solutions | 2317. Maximum XOR After Operations.cpp | class Solution {
public:
int maximumXOR(vector<int>& nums) {
//at Max answer can be 2^(n-1) where n is no. of bits in maximum element
//i.e all bit can be sit
//if any no. in the range 2^x to 2^y than some bit can be made set or unset using some x
//ex:-6 (2^2 - 2^3) using 4 -> 6&... | ALGO | 0.999958 | 5.752987 |
7cff89f9-abca-4548-ba4d-60139f8c1c49 | jethvaharsh333/DSA | NeetCode/Array/23_Maximum_Product_Subarray/lc.cpp | class Solution {
public:
int maxProduct(vector<int>& nums) {
// int omp = nums[0], nmp = nums[0];
// for(int i=0; i<nums.size(); ++i){
// if(nmp*nums[i] >= nmp ){
// nmp *= nums[i];
// }
// else{
// nmp = 1;
// }
... | ALGO | 0.999952 | 5.63043 |
d1c84ed8-e1d5-4557-8bdd-bc09d6615e82 | Mostafa61290/C- | list.cpp | #include<iostream>
#include<String>
#include "stdio.h" // to using NULL
#include"list.h"
using namespace std ;
list::list(){ // constructor
head = cursor = prev = NULL ; // initial value of pointer of nodes are NULL
}
bool list::listIsEmpty() {
if (head == NULL)
return true ;
else
... | ALGO | 0.989322 | 3.348535 |
e8938da2-f57b-4723-a5e3-7e83cd605cf7 | LonglongSang/Life_of_XDU | OiWiki_Learning/树形dp/P2014 [CTSC1997]选课.cpp | //https://www.luogu.com.cn/problem/P2014
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cassert>
#include <string.h>
#include <queue>
using namespace std;
#define N 305
int n,m,indeg[N],head[N],tot,grade[N],par;
int dp[N][N];
int cap[N];
int tot_dp[N];
struct node{
int to;
... | ALGO | 0.999974 | 3.636938 |
a3e7210d-0a8c-409a-995f-32c41d94733e | 9759176595/LeetCodeQuestion | Sorting the Sentence.cpp | class Solution {
public:
string sortSentence(string s) {
string word;
vector<string>v(10);
for(int i=0;i<s.size();i++){
if(s[i]>=48 && s[i]<=57){
v[s[i]-48]=word+" ";
word="";
i++;
}
else word+=s[i];
... | ALGO | 0.999824 | 6.27459 |
2c1356ef-45e0-4f12-9b61-21ab71b2c67c | Mackenzie-98/Solutions | RPC/2020/07/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
typedef long long ld;
int main() {
// your code goes here
ios::sync_with_stdio(0),cin.tie(0);
int n;
ll t,s,tmp,ant,aux=0,rta=0;
cin>>n;
while(n--){
cin>>t>>s;
cin>>ant;
rta=0;
for(ll i=0;i<s-1;i++){
cin>>tmp;
if(... | ALGO | 0.999657 | 3.392196 |
4f7f0b54-b064-402e-9e67-3a3ace287cac | cormoran/CompetitiveProgramming | src/contest/others/gcj/2018/Round1B/B/main.comp.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl
template<class T> bool set_min... | ALGO | 0.999897 | 4.119682 |
e3874449-2b01-41a1-aaaf-403613447bfb | hoonti06/problem-solving | cpp/SWEA/success/2383-backtrack-simulation.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <cstring>
using namespace std;
#define MAX_N 102
int N, M, K;
int dx[4] = { -1, 1, 0, 0 };
int dy[4] = { 0, 0, -1, 1 };
int board[MAX_N][MAX_N];
int stairs[2][2];
int track[MAX_N];
vector<pair... | ALGO | 0.999345 | 4.213015 |
639c08b9-7d85-45cb-9644-b99e1ff121b7 | ishandutta2007/codeforces | moe.tsuki/normal/1009/F.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#de... | ALGO | 0.999933 | 4.165831 |
943e65ab-fa9b-4731-a794-7b7514fcf162 | WaterLemur/Learning_Cpp | CodeBeauty C++/3 - C++ Functions/versions/0.7/courses/1 - Functions/7 - Generic functions.cpp | #include "../1 - Functions.h"
#include <iostream>
using namespace std;
template<typename T>//<class T>
void Swap(T& a, T& b) {
T temp = a;
a = b;
b = temp;
}
void C1C7()
{
int a = 5, b = 7;
cout << a << " - " << b << endl;
Swap(a, b);
cout << a << " - " << b << endl;
char c = 'c', d = 'd';
cout << c << " ... | ALGO | 0.904186 | 3.684864 |
5e4a4e72-42b1-4032-a18a-a035a980c854 | ShawnTSH1229/XEngine | ThirdParty/boost_1_78_0/libs/multi_index/example/sequenced.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost... | ALGO | 0.973259 | 6.33118 |
c6866124-41b1-45e6-b060-df31912a8441 | shubh1777/LeetCode-100Days | Rahul/day12.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int n = nums.size();
if(n<3){
return n;
}
int k=2;
for(int i=2;i<n;i++){
if(nums[i]!=nums[k-2]){
nums[k++]=nums[i];
}
}
return k;
}
}; | ALGO | 0.999881 | 6.004648 |
16271250-d8eb-4e81-90cf-2ffb3ac774dc | shivanshcpp/Programs | linearSearch.cpp | #include<iostream>
using namespace std;
int main()
{
//Linear Search Program
int n,ele,flag=0;
cout<<"Enter Size of array";
cin>>n;
cout<<"Enter element to be Searched";
cin>>ele;
int arr[n];
//Inputting an Array
cout<<"Enter elements in the array:";
for(int i=0;i<n;i++){
... | ALGO | 0.998705 | 4.589333 |
b1c2a229-2a76-4c2d-8b07-4bffeadab82d | sarvex/leetcode-giz | solution/1000-1099/1014.Best Sightseeing Pair/Solution.cpp | class Solution {
public:
int maxScoreSightseeingPair(vector<int>& values) {
int ans = 0, mx = values[0];
for (int j = 1; j < values.size(); ++j) {
ans = max(ans, values[j] - j + mx);
mx = max(mx, values[j] + j);
}
return ans;
}
}; | ALGO | 0.99999 | 6.185551 |
34eccf03-aeb5-4c84-8324-54cbae368248 | DanielVillota16/my-codeforces-solutions | 1255_B.cpp | #include <bits/stdc++.h>
#include <math.h>
#define pb push_back
#define fst first
#define snd second
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
using namespace std;
int main() {FIN;
int t... | ALGO | 0.999695 | 3.868557 |
571ac4d6-5130-421b-a185-b78daa6c9913 | aaddaammgg/CLionProjects | BTree/main.cpp | #include <iostream>
#include "BTree.h"
using namespace std;
int main()
{
// int count = 5;
// cout << "Enter the number of elements : ";
// cin >> count;
BTree root;
// for(int i = 0; i < count; i++){
// // int element;
// // cout << "Enter the key " << i +1 << " : ";
// // ... | ALGO | 0.998708 | 3.535248 |
b19e2bc3-ac39-4924-9ffb-bd3812fc34d4 | XiaoShu2020ace/LeetCode | 5 Longest Palindromic Substring/Longest Palindromic Substring.cpp | /**
对于一个子串而言,如果它是回文串,并且长度大于 2,那么将它首尾的两个字母去除之后,它仍然是个回文串。例如对于字符串 “ababa”,
如果我们已经知道 “bab” 是回文串,那么 “ababa” 一定是回文串,这是因为它的首尾两个字母都是 “a”。
对于一个字符串,从最长开始切分出各个字符串,判断其是否是回文串,直到找到第一个回文串为止,这个回文串就是最长的回文子串
class Solution {
public:
pair<int, int> expandAroundCenter(const string& s, int left, int right) {
while (left >= 0... | ALGO | 0.999987 | 6.384649 |
01e0fbff-eab2-4f85-8aaa-c5e6c9a1a072 | deeptechlabs/cyberweapons | Encryption/crypto32/shark.cpp | // shark.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "shark.h"
#ifdef WORD64_AVAILABLE
#include "modes.h"
#include "gf256.h"
NAMESPACE_BEGIN(CryptoPP)
static word64 SHARKTransform(word64 a)
{
static const byte iG[8][8] = {
0xe7, 0x30, 0x90, 0x85, 0xd0, 0x4b, 0x91, 0x41,
... | ALGO | 0.999797 | 7.718422 |
b82c617d-5b81-496d-98c8-01e3edbc4e37 | MostafaElnahas/VDSProject_Group5 | src/bench/CircuitToBDD.cpp | //
// Written by Carolina P. Nogueira 2016
// Refactored by Deutschmann 27.09.2021
//
#include "CircuitToBDD.hpp"
#include <utility>
CircuitToBDD::CircuitToBDD(shared_ptr<ClassProject::ManagerInterface> BDD_manager_p) {
bdd_manager = std::move(BDD_manager_p);
}
CircuitToBDD::~CircuitToBDD() = default;
void Cir... | ALGO | 0.996092 | 5.85812 |
3f8033de-4f99-4778-856b-f50dd00eac84 | praveen6791/c-_assignment | que44.cpp | // 44.Write a C++ program to print a pattern using nested for loops.
#include <iostream>
using namespace std;
int main() {
int rows = 5;
for(int i = 1; i <= rows; i++) {
for(int j = 1; j <= rows-i; j++) {
cout << " ";
}
for(int k = 1; k <= 2*i-1; k++) {
cout... | ALGO | 0.999245 | 4.838571 |
08851ea7-99b7-461f-a81f-3fcf195453d4 | kmjp/procon | atcoder/abc151-200/abc177/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999826 | 4.149834 |
eadee431-c79f-401e-9941-042f4ba46b86 | david2du/david_training | gao/2021/day1/class/QE.cpp | #include <bits/stdc++.h>
using namespace std;
struct Edge
{
int a;
int b;
int val;
};
vector<Edge> edge[1010];
void
int main(int argc, char const *argv[])
{
int n = 0, m = 0;
cin >> n >> m;
for (int i = 0; i < m; i++)
{
int a = 0, b = 0, d = 0;
cin >> a >> b >> d;
... | ALGO | 0.999747 | 4.329854 |
07a6cbfc-2002-4d2c-a3f1-57c4bb05c476 | jingaz/LeeCode | 合并K个排序链表.cpp | #include <iostream>
#include <vector>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode *mergeKLists(vector<ListNode *> &lists) {
ListNode *head = nullptr;
if (lists.empty()) {
return head;
}
head = new ListNode(0);
... | ALGO | 0.999858 | 5.395475 |
0bc2cf7e-cd65-4797-8055-6160f7386130 | dhingrahimanshu/CompetitiveProgramming | Segment Trees/segmenttree.cpp |
/*
Author :: Bot Anshu
~All our knowledge has its origins in our perceptions - Leonardo Da Vinci.
*/
#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using nam... | ALGO | 0.999768 | 4.984951 |
cccb0e8f-325b-4d2b-9a43-04473877985e | blackgeorge-boom/llvm-unifico | libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp | // <vector>
// void push_back(const value_type& x);
#include <vector>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> c;
c.push_back(0);
assert(c.size... | TEST | 0.939658 | 5.985829 |
e41b3f3b-fce2-4ecb-8be4-dd15a668097d | lemonpuddi/I2P3-lemon | unittest/state_test.cpp | #include <iostream>
#include <cstdlib>
#include "../src/state/state.hpp"
#include "../src/config.hpp"
int main(){
srand(RANDOM_SEED);
State state;
std::cout << state.encode_output() << std::endl;
state.get_legal_actions();
for(auto move: state.legal_actions){
std::cout << move.first.first << " " << m... | ALGO | 0.976957 | 4.196708 |
48e0bcba-1989-41a6-95bf-5e1623d28e6f | ishandutta2007/codeforces | andr0901/normal/1451/E1.cpp | //#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#defi... | ALGO | 0.999664 | 3.19652 |
c812d02c-c694-4f9e-bb0b-97b3c4d2c750 | ssayin/riscv32-cosim-model | src/pinst/pinst.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
const std::string blank = " ";
struct instr_type {
enum placement_rule { ANY, HI, LO };
std::string instr;
int span;
placement_rule rule;
bool operator<(const instr_type &other);
};
void gene... | ALGO | 0.991606 | 5.640017 |
f614241b-9b60-4ec9-a054-23b04a25ee99 | Ajain0311/CPP-Codes | All_sort_menudriven.cpp | #include<iostream>
#include<algorithm>
using namespace std;
class BubbleSort{
public:
int count = 0;
void bubblesort(int *arr, int n){
for(int i = 0; i < n - 1; i++){
for(int j = 0; j < n - i - 1; j++){
if(arr[j] > arr[j+1]){
swap(arr[j], arr[j+1]);
... | ALGO | 0.999107 | 3.988555 |
4ddd0f18-e2e9-45f9-906f-73ebbc404563 | fulatin/MyAlgorithmProblemCode | luogu/4995.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
int l = 0;
int r = n - 1;
int last = 0;
int nowtp = 1;
long long ans = 0;
while (l <... | ALGO | 0.999962 | 4.187887 |
0ef30d71-64d3-48de-a2f7-7377b068a908 | Johan-David/SIA | tp1/sia_td1/ext/nanogui/ext/eigen/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2d A;
A << 2, 1,
2, 0.9999999999;
FullPivLU<Matrix2d> lu(A);
cout << "By default, the rank of A is found to be " << lu.rank() << endl;
lu.setThreshold(1e-5);
cout << "With threshold 1e-5... | ALGO | 0.999839 | 4.090376 |
5b29b59e-19d8-4399-a82e-6154caa142c2 | HadyAhmed00/MyChallenge | July 2022/day30/LengthofLongest.cpp | //
// Created by Hady Ahmed on 7/29/2022.
//
/*
██████╗ █████╗ ██╗ ██╗ ██╗ ██╗ ██████╗ ██████╗
██╔══██╗██╔══██╗╚██╗ ██╔╝ ████████╗╚════██╗██╔═████╗
██║ ██║███████║ ╚████╔╝ ╚██╔═██╔╝ █████╔╝██║██╔██║
██║ ██║██╔══██║ ╚██╔╝ ████████╗ ╚═══██╗████╔╝██║
██████╔╝██║ ██║ ██║ ╚██╔═██╔╝██████╔╝╚██... | ALGO | 0.999899 | 5.653941 |
a3d0a93a-80b1-412e-980a-2693caef9002 | yosoufe/SFND_3D_Object_Tracking | src/matching2D_Student.cpp | #include <numeric>
#include "matching2D.hpp"
using namespace std;
// Find best matches for keypoints in two camera images based on several matching methods
void matchDescriptors(std::vector<cv::KeyPoint> &kPtsSource, std::vector<cv::KeyPoint> &kPtsRef,
cv::Mat &descSource, cv::Mat &descRef,
... | ALGO | 0.998588 | 7.148239 |
2b83cfa4-2f4e-4f88-a717-f82a7a1a16a5 | aa01912001/LeetCode | No_1557/Minimum Number of Vertices to Reach All Nodes.cpp | class Solution {
public:
vector<int> findSmallestSetOfVertices(int n, vector<vector<int>>& edges) {
vector<int> check(n);
for(int i=0; i<edges.size(); i++) {
check[edges[i][1]] = 1;
}
vector<int> ret;
for(int i=0; i<n; i++) {
if(check[i] == 0)... | ALGO | 0.999865 | 6.178244 |
f8dafb08-1216-43ee-8180-371a86e6462d | ThangQT2606/CTDL-GT | distinct_sum.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n; cin >> n;
int a[n];
for(int &x : a)
{
cin >> x;
}
set<int> dp;
dp.insert(0);
for(int x : a)
{
set<int> tmp;
for(auto it : dp)
{
tmp.insert(it + x);
}
dp.inse... | ALGO | 0.9999 | 3.580315 |
f7b5ad4d-da25-4432-86ce-9bf9b5278097 | amanBhawsar/Coding-Tree | LeetCode/274. H-Index.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
sort(citations.begin(),citations.end());
int n=citations.size();
for(int i=0;i<n;i++){
if(citations[i]>=n-i)
return n-i;
}
return 0;
}
}; | ALGO | 0.999931 | 6.238379 |
be26404e-398f-4498-91da-ff9468ac5a74 | StenTech/ProblemSolving | open.kattis.com/Tarifa/tarifa.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int x, n, m = 0;
cin >> x;
cin >> n;
for (int i = 0; i < n; i++)
{
int ms;
cin >> ms;
m+=ms;
}
cout << (n+1)*x - m;
return 0;
} | ALGO | 0.999595 | 3.74378 |
e77f7769-7dc4-456a-be0d-02f372e131b1 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8465_17.cpp | #include <bits/stdc++.h>
using namespace std;
long long vx[1000005], vy[1000005], v[1000005];
int main() {
int i, j;
int n, m, a, b;
cin >> n >> m;
v[1] = 1;
for (i = 2; i <= n; i++) v[i] = v[i - 1] * 12;
for (i = 0; i < m; i++) {
cin >> a >> b;
vx[a] += v[b];
vx[b] += v[a];
}
for (i = 1; i ... | ALGO | 0.999894 | 3.615712 |
091160ad-bdfa-4a36-be6b-ac89c5835fdd | prismskylabs/opencv-lite | modules/legacy/src/featuretree.cpp | #include "precomp.hpp"
#include "_featuretree.h"
void cvReleaseFeatureTree(CvFeatureTree* tr)
{
delete tr;
}
// desc is m x d set of candidate points.
// results is m x k set of row indices of matching points.
// dist is m x k distance to matching points.
void cvFindFeatures(CvFeatureTree* tr, const CvMat* desc,
... | ALGO | 0.970089 | 6.345142 |
072e528d-c625-429e-b9f2-639893ca1d22 | ra-hul16/Patterns | pat45.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<2*n-1;i++){
int cond=0;
if(i<n){ //growing phase of diamond
cond=i;
}
else{ //shrinking phase of diamond
cond=n-(i%n)-2;
}
for(int j=0;j<=cond;j++){
... | ALGO | 0.999947 | 3.369772 |
b7602c16-31f3-4d99-9f03-f4a3db737a8e | Loghic/FJFI-school | ZALG/cv/cv8/main.cpp | #include <iostream>
#include <assert.h>
using namespace std;
enum{OK};
const int N = 5;
struct Tower
{
int h; //height
int a[N];
};
void init(Tower & X)
{
X.h = 0;
for (int i = 0; i < N; i++)X.a[i] = 0;
}
void print();
void step(Tower &X, Tower &Y);
void setup(Tower & X)
{
X.h = N;
for (... | ALGO | 0.999689 | 3.461689 |
641fe66c-927e-410a-819d-258076dab494 | RebecaNicu/PDA_Project | Threads/Threads.cpp | #include <iostream>
#include <thread>
#include <numeric>
#include <fstream>
#include <vector>
// Funcția pentru calculul sumei elementelor unei porțiuni a matricei
int calculateSum(const int* matrix, int numColumns, int startRow, int endRow) {
int sum = 0;
for (int i = startRow; i <= endRow; ++i) {
for... | ALGO | 0.999659 | 6.325502 |
81427a53-b8b8-4234-a8be-b89696a0526c | karaagro/cadi-ai | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998762 | 6.786404 |
3d6421a4-3ee8-4398-8bf8-5909c30f7f1c | hasansujan23/Graph | topological_sort_using_dfs.cpp | #include<bits/stdc++.h>
using namespace std;
#define M 100
vector<int>v[M];
stack<int>st;
int vis[M];
void dfs(int s){
if(vis[s]==1)
return;
vis[s]=1;
for(int i=0;i<v[s].size();i++){
dfs(v[s][i]);
}
st.push(s);
}
int main()
{
int node,edge;
cin>>node>>edge;
for(int i... | ALGO | 0.999995 | 4.799533 |
377149be-27bc-4955-9998-5b1c4f3c2d65 | sinian666/codes_102_1 | cpp_副本42/chapter_stack_and_queue/deque.cpp | /**
* File: deque.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化双向队列 */
deque<int> deque;
/* 元素入队 */
deque.push_back(2);
deque.push_back(5);
deque.push_back(4);
deque.push_front(3);
deque.push_fron... | TEST | 0.897769 | 5.774346 |
7e820532-248b-4715-b368-0d548f819dd4 | AnonimiAngels/cache_engine | benchmarks/google/cache_performance.cpp | /**
* @file cache_performance.cpp
* @brief Comprehensive throughput benchmarks for all cache algorithms
*
* This file implements Google Benchmark tests that measure the throughput performance
* of all cache engine algorithms under various scenarios including different cache sizes,
* hit/miss ratios, and key dist... | TEST | 0.907532 | 7.797155 |
842e5c32-a04f-41c2-86dd-6abcafbec416 | aufanam/Competitive-Programming | 349A.cpp | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define itn int
#define ckmin(a, b) a = min(a, b)
#define ckmax(a, b) a = max(a, b)
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define mp(a, b) make_pair(a, b)
using namespace std;
const int MOD=1e9+7;
const int mod... | ALGO | 0.999885 | 4.768133 |
b78015f5-515c-4c49-a644-44a71427c409 | IndiraNukeshova/msu-practicum-5semestr- | third homework/F.cpp | #include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <limits>
const uint64_t INF = std::numeric_limits<uint64_t>::max();
class TGraph {
public:
TGraph(uint64_t n) : N(n), AdjacencyLists(n) {}
void ReadFromStream(std::istream& stream, uint64_t k);
int64_t Dijkstra(uint64_t a, uin... | ALGO | 0.999928 | 4.766849 |
7cc3c774-7531-41fd-9e60-4164bd8a20eb | feelpp/feelpp | toolboxes/feel/feelmodels/solid/solidmechanicsupdateresidual.cpp | /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=cpp:et:sw=4:ts=4:sts=4
*/
#include <feel/feelmodels/solid/solidmechanics.hpp>
namespace Feel
{
namespace FeelModels
{
SOLIDMECHANICS_CLASS_TEMPLATE_DECLARATIONS
void
SOLIDMECHA... | ALGO | 0.949347 | 5.69998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.