uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8e051819-e5b2-489e-85f0-e053532a69ec | hudeclukas/VDSuperVis | SimilarityMatrix.cpp | #include "SimilarityMatrix.h"
#include "Superpixel.h"
SimilarityMatrix::SimilarityMatrix() {
}
SimilarityMatrix::~SimilarityMatrix() {
}
cv::Mat& SimilarityMatrix::getSimilarityMatrix(std::map<int, Superpixel> items) {
m_matrix.create(items.begin()->second.max_id, items.begin()->second.max_id, CV_64FC1);
for (auto... | ALGO | 0.850631 | 4.394941 |
bd7b6cae-80c5-4dd4-95e1-636c2d01d453 | oga1221/samos | src/integrators/integrator_nve.cpp | /*!
* \file integrator_nve.cpp
* \author Rastko Sknepnek, <EMAIL>
* \date 20-Feb-2014
* \brief Implementation of the NVE integrator.
*/
#include "integrator_nve.hpp"
/*! This is standard velocity Verlet NVE integrator.
* It has ability to limit maximum particle displacement
* which is useful for relaxation... | ALGO | 0.999132 | 6.01716 |
c3f680ec-9077-456b-a2d5-b895e6c5a9d9 | WesleyLaura/EJERCICIOS-DE-ARREGLOS-DE-N-DIMENSIONALES | EJERCICIO10.cpp | /*10. Generador de Tablero de Buscaminas: Desarrolla un programa que genere un tablero inicial para
el juego de Buscaminas en una cuadrícula de 10x10. El programa debe:
a) Crear aleatoriamente un tablero donde cada celda puede contener una mina (1) o estar vacía (0).
b) Para cada celda, calcular y mostrar el número d... | ALGO | 0.992933 | 5.827267 |
41150ccb-7601-4c63-ac05-639ed51ee525 | tpgus2603/Boj | Bojgold4/9252.cpp | #include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
int dp[1001][1001];
string ans;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);
string a,b;
cin>>a>>b;
int alen=a.length();
int blen=b.length();
for(int i=1;i<=alen;i++)
{
for(int j=1;j<=blen;j++)
{
if(a[i-1... | ALGO | 0.999998 | 3.881597 |
f344a301-38aa-42fc-b2bf-ddc71ec49dec | chandrasekhar-DEV-CODER/geeksforgeeks | Difficulty: Medium/Detect Loop in linked list/detect-loop-in-linked-list.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* next;
Node(int val) {
data = val;
next = nullptr;
}
};
void loopHere(Node* head, Node* tail, int position) {
if (position == 0)
return;
Node* walk = head;
for (int i... | ALGO | 0.999587 | 5.47116 |
e848d9d2-9f13-4a93-8554-fe0413587795 | karmanya17/HackerRank-Solutions-Problem-Solving | Strong Password.cpp | #include <bits/stdc++.h>
using namespace std;
// Complete the minimumNumber function below.
int minimumNumber(int n, string password) {
// Return the minimum number of characters to make the password strong
int d=0,lc=0,uc=0,s=0;
for(int i=0;i<n;i++){
if(isupper(password[i]))
uc++;
... | ALGO | 0.998427 | 4.714396 |
b80f3728-c681-4669-aef2-d5420ae7aab9 | marcosatti/orbum | liborbum/src/Controller/Ee/Core/Interpreter/CEeCoreInterpreter_ALU_OTHERS.cpp | #include <cmath>
#include <cstdlib>
#include "Controller/Ee/Core/Interpreter/CEeCoreInterpreter.hpp"
#include "Core.hpp"
#include "Resources/RResources.hpp"
#include "Utilities/Utilities.hpp"
void CEeCoreInterpreter::PABSH(const EeCoreInstruction inst)
{
auto& r = core->get_resources();
// Rd = ABS(Rt), No e... | TOOL | 0.854625 | 6.32718 |
7c341084-6c99-47f4-abfa-ae759bebfdca | jbegaint/delaunay-cpp | demo.cpp | #include <vector>
#include <GL/freeglut_std.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "delaunay.hpp"
using namespace delaunay;
namespace context {
std::vector<Point<float>> points;
} /* namespace context */
void displayMe()
{
/* Draw points. */
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1, 1, 1);
glB... | ALGO | 0.996756 | 7.156429 |
886b105f-757b-46ee-83af-19b7d34f16b0 | PhuocVinhLee/system_exam_quiz_programming | online_exam_system_backend/temp/vi1gty2s.cpp | #include <stdio.h>
int main() {
int number1, number2, sum;
printf("Enter two integers: ");
scanf("%d %d", &number1, &number2);
// calculate the sum
sum = number1 + number2;
printf("%d + %d = %d", number1, number2, sum);
return 0;
}
| TOOL | 0.985314 | 4.41848 |
bd0b30d2-ebf9-4853-ab87-4feaf2dbab07 | geekygirl8/Hacktoberfest_2022_DSA | C++/C++/find-duplicate-subtrees.cpp | // Time: O(n)
// Space: O(n)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
namespace std{
namespace
{
// Code from boost
// Reciprocal of the ... | ALGO | 0.999941 | 6.774745 |
0b8f7994-c937-4103-b4b8-0505cdef3641 | cogsys-tuebingen/csapex_core_plugins | csapex_optimization/src/get_best_optimization_result.cpp |
/// PROJECT
#include <csapex/model/node.h>
#include <csapex/model/node_modifier.h>
#include <csapex/model/token.h>
#include <csapex/msg/end_of_sequence_message.h>
#include <csapex/msg/generic_value_message.hpp>
#include <csapex/msg/io.h>
#include <csapex/param/parameter_factory.h>
#include <csapex/signal/event.h>
#inc... | ALGO | 0.881101 | 6.064403 |
04716a2b-c425-41bf-8bfc-4b2585db5e82 | Luck-shya/LeetCode | 1807-partitioning-into-minimum-number-of-deci-binary-numbers/1807-partitioning-into-minimum-number-of-deci-binary-numbers.cpp | class Solution {
public:
int minPartitions(string n) {
int ans=0;
for(int i=0;i<n.size();i++){
int b = int(n[i]) - 48;
if(ans<b){
ans=b;
}
}
return ans;
}
}; | ALGO | 0.999928 | 5.49289 |
7193ad11-cad3-45ff-bbb9-a6597ce071a4 | jasmineanand/DataStructureAlgorithm_CPP_ProblemSolving_Solutions | ReviseFarenhiteCelcius.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int S;
int W;
int E;
cin >> S >> W >> E;
int i = 0;
while (i >= S && i <= E)
{
if (i % W == 0)
{
int c = ((5.0 / 9) * (i - 32));
cout << i << " " << c << endl;
}
i++;
}
} | ALGO | 0.999648 | 3.18496 |
224b8a10-44ea-427f-b7fa-be9e17620cac | oVeron0615/baekjoon | solved.ac - CLASS/CLASS 2/boj_2869.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tii;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int A, B, V; cin >> A >> B >> V;
cout << (V - B - 1) / (A - B) + 1;
} | ALGO | 0.999116 | 4.065422 |
95d0d542-d96b-429a-963f-4a3d81b5c420 | aaeilrv/CI5651 | Tarea6/multiswap.cpp | #include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return a < b ? a : b; }
struct Node {
int val;
int weight, size;
Node *left, *right;
Node(int c) : val(c), weight(rand()), size(1), left(NULL), right(NULL) {}
} *root;
int size(Node *treap) { return treap ? treap->size : 0; }
void split(Node ... | ALGO | 0.999703 | 3.820879 |
c70818b9-13b1-44c5-89f0-29fc396d631c | ishandutta2007/codeforces | waterfalls/normal/496/A.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int n;
scanf("%d",&n);
int holds[n];
for (int i=0;i<n;i++) scanf("%d",&holds[i]);
int ans = 10000;
for (int i=1;i<n-1;i++) {
int prev = holds[0];
int cur = 0;
for (int j=1;j<n;j++) {
if... | ALGO | 0.999901 | 3.677418 |
0e138592-0c9b-4dcd-ab8e-7312acca97ab | heheBearhehe/Dalipai | DaLiPoker/cocos2d/cocos/base/ZipUtils.cpp | // FIXME: hack, must be included before ziputils
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
#else // from our embedded sources
#include "unzip.h"
#endif
#include "base/ZipUtils.h"
#include <zlib.h>
#include <assert.h>
#include <stdlib.h>
#include "base/CCData.h"
#include "base/ccMacros.h"
#include "platfo... | TOOL | 0.939423 | 6.651322 |
1763e6e4-d4f9-46d0-9d1f-c7896bcf8e55 | StudyingFather/my-code | GCJ/2020-Qual-B.cpp | #include <cstdio>
#include <cstring>
char s[105],t[10005];
int cnt=0;
void addl(int x)
{
while(x--)
t[++cnt]='(';
}
void addr(int x)
{
while(x--)
t[++cnt]=')';
}
void add(char c)
{
t[++cnt]=c+'0';
}
int main()
{
int T;
scanf("%d",&T);
for(int kase=1;kase<=T;kase++)
{
memset(t,0,sizeof(t));
cnt=0;
scanf... | ALGO | 0.999406 | 3.569121 |
1371538f-c686-4b06-9fa1-2af8b44f82bf | onlyLTY/data_Structure_suep | homework/q2_15/main.cpp | #include <iostream>
template <typename T>
T * reverse(T *p, int size){
T *reverse_a = new T[size];
for (int i = 0; i < size; i++) {
*(reverse_a+i) = *(p+size-i-1);
}
return reverse_a;
}
#include <iostream>
template <typename T>
void output(T *p,int n){
for (int i = 0; i < n; i++) {
... | ALGO | 0.997909 | 4.974188 |
684d164c-909f-4a4d-a0f2-84c6e11daa8b | Denisacke/Fundamental_Algorithms2019 | Lab9Assignment/Lab9Assignment/Source.cpp | #include <iostream>
#include <list>
#include "Profiler.h"
#include <conio.h>
#include <random>
#include <ctime>
using namespace std;
Profiler profiler("Lab9");
int Op;
class Graph {
public:
int V;
list<int> *adj;
Graph(int V);
void addEdge(int v, int w);
void BFS(int s);
};
Graph::Graph(int V) {
this->V = ... | ALGO | 0.969974 | 4.105104 |
c3b6ffd5-7769-48c8-9a64-43754c584707 | clarinet758/atcoder | abc/b126_150/b134/c1.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define per(i,n) for(int i=n-1;i>=0;--i)
#define sc1(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d %d",&a,&b)
#define sc3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sl1(a) scanf("%lld",&a)
#define sl2(a,b) scanf("%lld %lld",&a,&b)
... | ALGO | 0.999995 | 3.232257 |
4a2b7e49-5cb2-4cb6-b1b6-e3d08d0a98e7 | ishandutta2007/codeforces | linkus/normal/1039/C.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr... | ALGO | 0.999998 | 4.211425 |
6aa224b3-af41-4e3f-883a-81990697d326 | MVARUNREDDY8203/LEETCODE_- | 1463-the-k-weakest-rows-in-a-matrix/1463-the-k-weakest-rows-in-a-matrix.cpp | class Solution {
public:
vector<int> kWeakestRows(vector<vector<int>>& mat, int k) {
vector<pair<int, int>> ans;
int m = mat.size(), n= mat[0].size();
for (int i=0; i<m; i++) {
int cnt = 0;
int j = 0;
while (j < n && mat[i][j]) cnt += mat[i][j++];
... | ALGO | 0.999958 | 5.872372 |
40fd35e7-bc9a-4215-bc47-576ef6e95baa | sharmarajdaksh/cp | leetcode/1309.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
const int aAscii = 97;
public:
string freqAlphabets(string s)
{
unsigned int slen = s.length();
string ans = "";
int index = -1;
char c = 'A';
for (int i = slen - 1; i >= 0; i--)
{
if... | ALGO | 0.999841 | 5.026242 |
54e5cc19-be73-4696-b7f4-c43945ea4341 | Prachi-kumari-1111/Learn-c-plus-plus | conditionls/greatestint.cpp | #include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"enter 1st number :";
cin>>a;
cout<<"enter 2nd number:";
cin>>b;
cout<<"enter 3rd number:";
cin>>c;
if (a>b && a>c) {
cout<<a<< "is greatest";
}
else if(b>a && b>c)
{ cout<<b<< "is greatest";
}
... | ALGO | 0.999867 | 3.488615 |
9b23cc23-9496-456f-967a-101c0615b246 | ishandutta2007/codeforces | wxhtzdy/normal/1223/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long l... | ALGO | 0.999495 | 3.210426 |
89dace02-601d-4fb2-b68c-aa4f350e82f9 | shubhampawar574/Coding-Problems | June/Leetcode/3_Time Needed to Inform All Employees.cpp | class Solution {
public:
int dfs(int headId,vector<int>& informTime,vector<int> adj[]){
int maxTime = 0;
for(auto it:adj[headId])
maxTime = max(maxTime,dfs(it,informTime,adj));
return informTime[headId] + maxTime;
}
int numOfMinutes(int n, int headID, vector<int>& ma... | ALGO | 0.999672 | 5.706602 |
5f947980-2fc8-4028-80fc-61bf443a3c66 | nampluskr/coding_study | library/graph/treversal.cpp | #include "graph.h"
#include "func.h"
#ifndef MAX_NODES
#define MAX_NODES 100
#endif
GraphTreversal G1;
void init_graph1() {
G1.init(10);
G1.add(0, 1); G1.add(0, 2);
G1.add(1, 3);
G1.add(2, 4); G1.add(2, 5); G1.add(2, 6);
G1.add(3, 7); G1.add(3, 8);
G1.add(6, 9);
}
void test_dfs(int option... | ALGO | 0.993406 | 4.605023 |
26e8b74f-c27c-4fcf-ac4d-1a393499ac1c | AKSNPL/ADP-2018 | aufgabe2/aufgabe2.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <array>
#include <stdint.h>
#include <functional>
#include "aufgabe2.hpp"
using namespace std;
/// Build suffix array from text.
/// Input: the text (might be empty)
/// Output: a suffix array (sorted). The variabl... | ALGO | 0.998887 | 4.526076 |
ff40e59b-10f2-42e5-b560-5af713ebedb3 | mohitgupta02/Leetcode_ans | 1073-number-of-enclaves/1073-number-of-enclaves.cpp | class Solution {
public:
void dfs1(int row, int col, vector<vector<int>>& grid,
vector<vector<int>>& vis, int n, int m, int drow[], int dcol[]) {
vis[row][col] = 1;
for (int i = 0; i < 4; i++) {
int nrow = row + drow[i];
int ncol = col + dcol[i];
if ... | ALGO | 0.99998 | 6.498071 |
fff75e81-a57c-4921-8a4e-72342cfbefbd | sujal-p0408/Leetcode-Solved-Problems | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int k=1;
for(int i=1;i<nums.size();i++)
{
if(nums[i]!=nums[i-1]) {nums[k]=nums[i]; k++;}
}
return k;
}
}; | ALGO | 0.99987 | 5.957767 |
fa4ebb37-5455-4dea-8fd9-f44c1258278e | raincross7/code-similarity | codes/train_code/problem117/problem117_113.cpp | #include <iostream>
using namespace std;
int main() {
int a, b, c;
bool yn;
cin >> a >> b >> c;
yn = a >= b ? false : b >= c ? false : true;
if( yn ) cout << "Yes" << endl;
else cout << "No" << endl;
} | ALGO | 0.999989 | 3.973894 |
a378298c-b024-4695-af0a-ff3e5f30adc9 | Seddvwy/Celebrity-Image-Classification | opencv-master/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char ** argv)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (D... | ALGO | 0.99448 | 6.215502 |
19b8b2fd-f629-40ca-b268-3edd6f1ff2e3 | gurpartb/play | C++/play.cpp | #include <iostream>
#include <math.h>
int main(int argc, char const *argv[]) {
std::cout << ceilf(log10(12))<< '\n';
return 0;
}
// int main(int argc, char const *argv[]) {
// srand(time(NULL));
// int count = 100;
// float sum = 0;
// for (size_t i = 0; i < count; i++)... | ALGO | 0.969771 | 3.23929 |
9a014b56-0968-46a3-9900-dfe748365591 | qrbs/pytorch_source | pytorch/aten/src/ATen/native/quantized/cpu/q_avgpool.cpp | #include <ATen/ATen.h>
#include <ATen/NativeFunctions.h>
#include <ATen/Parallel.h>
#include <ATen/native/Pool.h>
#include <ATen/native/quantized/cpu/init_qnnpack.h>
#include <ATen/native/quantized/cpu/qnnpack_utils.h>
#include <ATen/native/quantized/cpu/quantized_ops.h>
#include <caffe2/utils/threadpool/pthreadpool-cp... | TOOL | 0.902111 | 7.267867 |
9533ed8b-8c41-4355-bd39-7cd8ec4b4490 | huyhoang-8296/CSE-109 | lab5/src/hashtable.cpp | #include "hashtable.h"
HashTable::HashTable(){
capacity = 50;
HT = new Node*[capacity];
}
HashTable::HashTable(int cap){
capacity = cap;
HT = new Node*[capacity];
}
HashTable::~HashTable(){
}
int HashTable::computeHash(Student s){
return s.getID() % capacity;
}
int HashTable::hashSearch(Student s){
int cou... | ALGO | 0.984412 | 4.320092 |
2c1b2f99-eaaa-4931-b801-dd4349f5fb81 | emti19/Solved-OJ-Problems-Round-2 | CME.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int q,n,i;
cin>>q;
for(i=1; i<=q; i++)
{
cin>>n;
if(n==2)
cout<<"2"<<endl;
if(n!=2 && n%2==0)
cout<<"0"<<endl;
if(n%2!=0)
cout<<"1"<<endl;
}
return 0;
}
| ALGO | 0.999942 | 3.412148 |
c4665f8a-de16-4b57-b930-ed72f345c22d | HaoTom1/APM_gazebo | libraries/AP_HAL_Linux/Flow_PX4.cpp | #include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
#include "Flow_PX4.h"
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
extern const AP_HAL::HAL& hal;
using namespace Linux;
Flow_PX4::Flow_PX4(uint32_t width, uint32_t bytesperline,
uint32_t max_flow_... | ALGO | 0.992542 | 5.151992 |
a9e64834-e879-4564-b4b5-2f8e4b160d64 | scarletrunner7000/contests | poj/poj3009/poj3009/poj3009.cpp | //poj3009.cpp
//PKU JudgeOnline
//poj3009 Curling 2.0
#include <cstdio>
#include <queue>
#define WMAX 20
#define HMAX 20
#define T 10 // ^[̍ől
#define EDGE -1
#define VACANT 0
#define BLOCK 1
#define START 2
#define GOAL 3
using namespace std;
class board
{
public:
int t; // ݂̃^[
int data[WMAX + 2][HMAX + 2]; // Ֆ... | ALGO | 0.999785 | 3.65296 |
bbcf87ba-cd61-47cf-a779-f4a137322d44 | Drew-Miller/CS442 | pa10_textures/tube.cpp | #include <iostream>
using namespace std;
#include "curve.h"
#include "geometry.h"
#include "scene.h"
#include "tube.h"
#include "wrap_cmath_inclusion.h"
const Point3 Tube::operator()(const double u, const double v,
Vector3 &dp_du, Vector3 &dp_dv) const
//
// returns a Point3 on the surface of the tube. `u` ma... | ALGO | 0.972573 | 4.932576 |
63ac9691-b396-49a8-994e-00518f942b3f | AniDashyan/SoA_vs_AoS | main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include "kaizen.h"
size_t NUM_PARTICLES = 1000000;
size_t NUM_ITERATIONS = 1000;
struct ParticleAoS {
double pos_x, pos_y, pos_z;
double mom_x, mom_y, mom_z;
int spin; // -1 or 1
};
struct ParticleSoA {
std::vector<double> po... | ALGO | 0.998041 | 7.423198 |
0b46de16-6e69-43c0-bd68-57728f0ea830 | liangwt/leetcode | 47.permutations_II.cpp | #include <vector>
using namespace std;
class Solution
{
public:
vector<vector<int>> permuteUnique(vector<int> &nums)
{
sort(nums.begin(), nums.end());
vector<vector<int>> ans;
vector<int> temp;
vector<int> visited;
visited.resize(nums.size());
helper(nums, ans... | ALGO | 0.999985 | 5.814219 |
5e1a0229-7115-48d1-a576-732ed352f851 | Hy1ex/vance-src | tier1/checksum_sha1.cpp | /*
100% free public domain implementation of the SHA-1
algorithm by Dominik Reichl <<EMAIL>>
=== Test Vectors (from FIPS PUB 180-1) ===
SHA1("abc") =
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
... | ALGO | 0.992519 | 6.585141 |
f1c5cbd2-9e0c-4c87-bb63-d74e9c99793c | Aethereux/Hikari-LLVM19 | libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class fisher_f_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cmath>
#include "test_macros.h"
double fac(double x)
{
double ... | TEST | 0.988892 | 4.623489 |
69bc52a5-ca92-4146-b35f-c81bf5df83fb | wangwangok/leetcode | nc7_maxProfit.cpp | #include <iostream>
#include <vector>
/**
*
* 假设你有一个数组,其中第 i 个元素是股票在第 i 天的价格。
* 你有一次买入和卖出的机会。(只有买入了股票以后才能卖出)。请你设计一个算法来计算可以获得的最大收益。
*/
/**
* 输入:[1,4,2]
* 返回值:3
*/
/**
* 输入:[2,4,1]
* 返回值:2
*/
using namespace std;
class Solution {
public:
/**
*
* @param prices int整型vector
* @return int整型... | ALGO | 0.999842 | 4.752744 |
ab0cef9d-51a5-47d2-bcee-1fc2e38bb894 | Soham-Chaudhuri/My-CPP-practice | 732B.cpp | #include<bits/stdc++.h>
#include<vector>
#include<string.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include <sstream>
#include <algorithm>
#include <random>
using namespace std;
typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;
typedef long l... | ALGO | 0.999982 | 3.024438 |
4b8f2d17-6f06-4c9f-9aed-2040b0a92545 | CadenCarlson/Kinect-Depth-Camera | opencv/sources/modules/imgproc/src/spatialgradient.cpp | #include "precomp.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include <iostream>
namespace cv
{
/* NOTE:
*
* Sobel-x: -1 0 1
* -2 0 2
* -1 0 1
*
* Sobel-y: -1 -2 -1
* 0 0 0
* 1 2 1
*/
template <typename T>
static inline void spatialGradientKernel( T& vx, T& vy... | ALGO | 0.996206 | 6.386929 |
f9561eaf-68a5-46d8-a224-4066382f51fb | jude2333/Leetcode-Solutions | cpp/0010-regular-expression-matching.cpp | /*
Given string & pattern, implement RegEx matching
'.' -> matches any single character
'*' -> matches zero or more of the preceding element
Matching should cover the entire input string (not partial)
Ex. s = "aa", p = "a" -> false, "a" doesn't match entire string "aa"
DFS + memo, 2 choices at ... | ALGO | 0.999917 | 6.823869 |
6199d7d0-ef76-4a2b-af60-c656f2cf83a2 | thiagorigstak/Competitiva | CodeForces/Mashup1/A.cpp | #include <bits/stdc++.h>
#define endl "\n"// macro
#define ll long long// macro
#define desync ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
//typedef long long int ll; define ll para long long int "macro"
int main(){
desync;
int n;
int answ = 0;
cin >> n;
strin... | ALGO | 0.999964 | 4.247203 |
b03f0f9f-25e2-4502-be15-a3698369e51d | iamkanhaiyakumar/Code-Help-C-- | 2.Intoduction to C++/Pattern/02More patterns/fullfacncypattern.cpp | #include<iostream>
using namespace std;
void fullfancy12(int n){
//fancy12 pattern
//outer loop
for (int i =0; i < n; i++){
//inner loop
for(int j = 0; j<2 * i+1; j++){
// cout<<"+";
if (j% 2 ==0)
cout << i+1;
else
cout<<"*";
... | ALGO | 0.999297 | 3.231141 |
443fb76d-9d72-44b5-91b9-361908114ef7 | sxu39/TP-RPMD | lammps-stable_2Aug2023_update2/src/fix_addforce.cpp | #include "fix_addforce.h"
#include "atom.h"
#include "atom_masks.h"
#include "domain.h"
#include "error.h"
#include "input.h"
#include "memory.h"
#include "modify.h"
#include "region.h"
#include "respa.h"
#include "update.h"
#include "variable.h"
#include <cstring>
using namespace LAMMPS_NS;
using namespace FixConst... | ALGO | 0.920081 | 6.631028 |
d10f454d-69a6-45cb-b524-eed40d6eb68f | Sntai20/CPSC-5910-Data-Structures | Week6/Lecture/Polymorphism/13_shape.cpp | #include <iostream>
using namespace std;
class Shape {
public:
Shape(int a = 0, int b = 0){
width = a;
height = b;
}
virtual int area() { return 0; }
protected:
int width, height;
};
class Rectangle: public Shape {
public:
Rectangle(int a = 0, int b = 0) : Shape(a, b) { } ... | TOOL | 0.875599 | 5.782762 |
5203f08d-3afb-44d0-b08d-3af304775758 | ahsanaliii/Flutter-UI | loginpage/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.998285 | 6.776823 |
697306c5-dd7b-488e-a35f-7ed98343f835 | muhammadrofiq586/tets | thirdparty/glslang/glslang/MachineIndependent/IntermTraverse.cpp | #include "../Include/intermediate.h"
namespace glslang {
//
// Traverse the intermediate representation tree, and
// call a node type specific function for each node.
// Done recursively through the member function Traverse().
// Node types can be skipped if their function to call is 0,
// but their subtree will stil... | TOOL | 0.855052 | 7.338685 |
1d3d4d2c-14a2-4938-bbab-31a1ed381e21 | freezer-glp/leetcode-submit | src/Valid Anagram.cpp | /*Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may assume the string contains only lowercase alphabets.
Follow up:
What if the inputs contain unicode characters? How would you ad... | ALGO | 0.999918 | 6.482352 |
19f2fcb4-bf18-476a-bafa-09c0b9432369 | ishandutta2007/codeforces | djq_cpp/normal/1209/A.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;
int n, a[105];
int cnt[105];
int main()
{
scanf("%d", &n);
rep(... | ALGO | 0.999692 | 3.762098 |
e4e725a2-7a4d-4fbf-93f1-fb285712e5a3 | saurabhd14/Mytest | mvsim-master/externals/Box2D/Box2D/Collision/Shapes/b2ChainShape.cpp | #include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <new>
#include <string.h>
b2ChainShape::~b2ChainShape()
{
Clear();
}
void b2ChainShape::Clear()
{
b2Free(m_vertices);
m_vertices = NULL;
m_count = 0;
}
void b2ChainShape::CreateLoop(const b2Vec2* vertices, i... | ALGO | 0.981538 | 6.764051 |
8a13caa6-ae1f-4560-a3b8-0946b5dd80e8 | liuq901/code | SGU/s_145.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>
#include <cstdarg>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set... | ALGO | 0.999979 | 3.62265 |
d08047a0-457f-4ab6-93ff-b86597805c7f | pyrimidine02/Problem_Solving | Codeforces/Codeforces Round 937 (Div. 4)/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3f3f3f3f;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
int gcd(int a, int b) {
return (a % b == 0) ? b : gcd(b, a % b... | ALGO | 0.99621 | 4.902597 |
df5d45fe-a728-482b-b8ed-97249fb1398b | xcloudyunx/Informatics | Kick Start/2019 Round A/2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
for (int z=1; z<=T; z++) {
int R, C;
cin >> R >> C;
vector< vector<int> > grid(R, vector<int> (C, INT_MAX));
queue< pair<int, int> > q;
for (int i=0; i<R; i++) {
string s;
cin >> s;
for (int j=0; j<C; j++) {
... | ALGO | 0.999366 | 4.354033 |
8a4e77c6-c649-4b08-8043-d9c4d62549ef | DeepSceneSeg/EfficientPS | mmdet/ops/grid_sampler/src/cpu/grid_sampler_cpu.cpp | // Modified from https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/GridSampler.cpp
#include <torch/extension.h>
#include "grid_sampler_cpu.h"
#include <ATen/ATen.h>
#include <ATen/Device.h>
#include <ATen/NativeFunctions.h>
#include <c10/core/Layout.h>
#include <c10/util/Exception.h>
#ifdef _OPENMP
... | DATA | 0.969488 | 5.084744 |
1da1840c-43a9-4992-9ede-fc0fdfce09a2 | rajeev2810/Practice_CPP_Coding | ConstructBinaryTree/ConstructBinaryTree.cpp | // ConstructBinaryTree.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <unordered_map>
using namespace std;
/**
* Definition for a binary tree node.
**/
struct TreeNode {
int val;
Tree... | ALGO | 0.999998 | 6.686818 |
930a5cd7-5afe-4ff8-864a-f58fcd46b4db | chaehonglee/SP17-CSE332 | lab3/MagicSquare.cpp | // MagicSquare.cpp
// Annie Lee : <EMAIL>
// Jeremiah Lorentz : <EMAIL>
// Jairaj Mathur : <EMAIL>
// (Lab 3) Multiple Games : magic square source file
#include "stdafx.h"
#include "GameClass.h"
#include "NineAlmondsGame.h"
#include "common.h"
#include "game_pieces.h"
#include "MagicSquare.h"
#include <iostream>
#incl... | ALGO | 0.937794 | 4.348647 |
792c3c3f-052a-457d-8668-9aefee641ba6 | abhinav8925/Codeforces-Solutions | 1283B - Candies Division .cpp | /*
***** !!!!! JAI SHREE KRISHNA !!!!! *****
Date -> 9th August 2023
Code by - Abhinav Anand
Problem link -> https://codeforces.com/problemset/problem/1283/B
*/
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
using namespace std;
int N=1000001;
... | ALGO | 0.999939 | 4.890951 |
a83dc8a1-173b-4a65-bab7-1c0b5b6deaf2 | shoaibrayeen/Programmers-Community | Bit Algorithm/Find the Maximum XOR Possible in a Given Range/SolutionByShreya.cpp | // This is an O(1) solution to finding the maximum XOR of a pair of numbers in a range
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int maximumXOR(int L, int R)
{
int LXR = L^R;
int highestSetBit = log2(LXR)+1;
int maxXOR = (1 << highestSetBit) - 1;
return maxXOR;
/*
... | ALGO | 0.999792 | 4.217157 |
570a665a-ef8d-440d-af8b-a4e9bd872e51 | andi34/SlimRoms_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_imdct_synth.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_imdct_synth.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------... | ALGO | 0.999746 | 4.159706 |
0b589b67-f53b-42c4-9100-92d9f9894768 | syntacore/snippy | libc/src/math/generic/remainderf.cpp | #include "src/math/remainderf.h"
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
int quotient;
return fputil::remquo(x, y, quotien... | ALGO | 0.982176 | 6.308753 |
0b6722d1-32e2-4a9e-8e8b-7af205abe2ad | hopef/paFaced | pa_sfid/src/math_functions.cpp | #include "math_functions.h"
#include <xmmintrin.h>
#include <cstdint>
#ifdef _WIN32
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
float simd_dot(const float* x, const float* y, const long& len) {
float inner_prod = 0.0f;
__m128 X, Y; // 128-bit values
__m128 acc = _mm_setzero_ps(); // set to (0, 0, 0,... | ALGO | 0.999287 | 6.400803 |
26bc142e-3388-4697-9cb3-0728f43f968f | atopuzov/gp-market-trading | StatsCalcOp.cpp | /***************************************************************************
* (c) 2008-2011 Aleksandar Topuzović *
* <<EMAIL>>, <<EMAIL>> *
***************************************************************************/
#include <beagle/GP.hpp>
#include <beagle/macros.hpp>
... | ALGO | 0.992413 | 6.963302 |
fa3f8435-de78-47a8-bf0f-649325933a82 | abdirakhman/Olymp | Math and Code/Summer Elimination/J/main.cpp | /**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAj... | ALGO | 0.999721 | 4.206205 |
7de23517-72e0-4de0-a7ec-fa1207bf9a16 | byteplus-sdk/BytePlusWTN | SDK/third_party/boost_1_69_0/boost/algorithm/minmax/fuzzing/minmax_element.fuzz.cpp | #include <iterator> // for std::distance
#include <cassert> // for assert
#include <boost/algorithm/minmax_element.hpp>
#include <boost/algorithm/cxx11/none_of.hpp>
// Fuzzing tests for:
//
// template <class ForwardIterator>
// std::pair<ForwardIterator,ForwardIterator>
// minmax_element(ForwardIterator first, F... | TEST | 0.975436 | 5.713445 |
9c7755ae-d932-4123-8f3a-bc772538ae7f | pranavb45/CPP | Cpp_Assignment_5/Q1.cpp | /*Q1. Write a menu driven program for Student management.
In main(), create Array of Objects and provide facility for accept, print, search and sort.
For student accept name, gender, rollNumber and marks of three subjects from user and print name,
rollNumber, gender and percentage.
Provide global functions void sortRec... | TOOL | 0.986024 | 3.293767 |
9a1a73e7-bba7-4bc9-9429-77d6b0ada2d1 | nicknickeryt/NXPCup | firmware/pixy/src/common/src/blobs.cpp | #include "pixy_init.h"
#include "misc.h"
#include "cameravals.h"
#include "chirp.hpp"
#include "blobs.h"
#define CC_SIGNATURE(s) (m_ccMode==CC_ONLY || m_clut.getType(s)==CL_MODEL_TYPE_COLORCODE)
Blobs::Blobs(Qqueue *qq, uint8_t *lut) : m_clut(lut)
{
int i;
m_mutex = false;
m_minArea = MIN_AREA;
m_ma... | ALGO | 0.972997 | 5.233971 |
fd8cfa6f-7430-4894-ba38-399caeb017d7 | frederickpek/leetcode | 216-combination-sum-iii/216-combination-sum-iii.cpp | #define rep(i, n) for (int i = 0; i < n; ++i)
#define for_nCk(s, n, k) \
for (int s = (1 << k) - 1, tmp_var = 0; s < (1 << n); \
tmp_var = s | (s - 1), s = (tmp_var + 1) | (((~tmp_var & -~tmp_var) - 1) >> (__builtin_ctz(s) + 1)))
class Solution {
public:
vector<vector<int>> combinationSum3(int k, int target) {
... | ALGO | 0.999966 | 5.46508 |
9c5f5759-c3df-48af-9fa6-730fafacdaa1 | swarajpande5/os-lab | Disk Scheduling/scan.cpp | /*
SCAN Disk Scheduling
*/
#include <bits/stdc++.h>
using namespace std;
int scan(vector<int> request, int head, int diskSize, string direction)
{
int totalSeekLength = 0;
int distance, currTrack;
int initialHead = head;
vector<int> left, right;
vector<int> sequence;
if(direction == "l... | ALGO | 0.999835 | 4.545495 |
1f8d76fc-4872-4b8f-8445-c73e303e381c | maximalmatchingmicalivazirani/MicaliVaziraniGPU | src/matching.cpp | //complexity O(E sqrt(V) log*(V))
#include<bits/stdc++.h>
#include <unistd.h>
#include <chrono>
#include "mmiof.h"
using namespace std;
#define st first
#define nd second
typedef pair<int,int> pii;
//disjoint set union data structure
struct DSU {
vector<int> link;
vector<int> directParent;
vector<int> size... | ALGO | 0.999379 | 4.457393 |
f0253308-3b7a-4dd9-ab2b-4ec91985ee24 | Ashish9426/Data-Stuctures-and-Algorithms | 16. linglist assignments/doubly_list_deque.cpp | #include <iostream>
using namespace std;
class doubly_list;
class node {
private:
int data;
node* next;
node* prev;
public:
node() {
data = 0;
next = NULL;
prev = NULL;
}
node(int val) {
data = val;
next = NULL;
prev = NULL;
}
friend class doubly_list;
};
class doubly_list {
private:
node* head;... | ALGO | 0.996362 | 5.322919 |
cfc56cfd-db06-46ea-a392-f67438065cd8 | tsugitta/atcoder | contests/abc171/abc171_b/main.cpp | // https://atcoder.jp/contests/abc171/tasks/abc171_b
#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i... | ALGO | 0.999994 | 4.531397 |
73b620bf-d386-4e59-b7d7-1e80cef3ebf0 | hiiamtruongnhudat/Discrete | CombinationNextStrings.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k, x[16];
bool cauhinhcuoi = false;
void reset()
{
for (int i = 1 ; i <= n; i++)
x[i] = i;
cauhinhcuoi = false;
}
void sinh()
{
int i = k;
while ( i > 0 && x[i] == n - k + i)
i--;
if (i>0)
{
x[i] = x[i] +1;
for (i... | ALGO | 0.999933 | 3.523313 |
d0b74d5b-50cd-47f8-ad21-a08987a94c72 | FredB1/qcNotes | cs211/Midterm/Q2.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
void printAlphabet(const bool asUppercase);
int main(const int argc, const char *argv[])
{
if (argc == 2)
{
const bool asUppercase = (bool)std::stoi(std::string(argv[1]));
printAlphabet(asUppercase);
}
else
{
... | TOOL | 0.923844 | 5.307321 |
25ef7faf-75b5-4c7e-838c-fa09b853b676 | VAUsIGT/projects-2024-2 | progr/lab1v3.cpp | #include <iostream>
#include <cmath>
#define M_PI
struct Answer {
double root; //
int iterations; //
double precision; //
};
// . .
double func(double x) {
//return cos(2 * x + 3.1415 / 2) + x + 8;
return 0.7 * (sin(x / 2) + cos(2 * x)) - x;
}
// ()
Answer bisection(doubl... | ALGO | 0.999957 | 4.812146 |
c3244a73-14b7-4444-ab4a-27a7c488a8d1 | nibalizer/notcs162 | program1.cpp | //Spencer Krum
//March 28 2011
//karlaf
//cs162
//
//Algorithm:
//Welcome the user to the program.
//Print a usage.
//Begin loop.
//Ask User for instructions. Provide 3 options. 1) Print usage. 2) Compress word. 3) Quit. If none or invalid is given, quit.
//If print usage:
// Print usage.
//If compress word:
// Ask ... | ALGO | 0.999681 | 4.93778 |
f9efdc4f-8175-455d-971f-05dadfd44cca | jetmuffin/algorithm | leetcode/451.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef pair<char, int> PII;
struct cmpByValue {
bool operator() (const PII& a, const PII& b) {
return a.second > b.second;
}
};
class Solution {
public:
string frequencySort(string s) {
map<char, i... | ALGO | 0.999997 | 4.806801 |
ade728d0-2eb4-4ba8-808c-75402833975c | igor-pavkov/honours-2024 | Code Examples/DiverseVul Filtered/Secure/60ff5b2f547af3828aebafd54daded44cfb0807a-2.cpp | int key_update(key_ref_t key_ref, const void *payload, size_t plen)
{
struct key_preparsed_payload prep;
struct key *key = key_ref_to_ptr(key_ref);
int ret;
key_check(key);
/* the key must be writable */
ret = key_permission(key_ref, KEY_NEED_WRITE);
if (ret < 0)
return ret;
/* attempt to update it if supp... | TOOL | 0.892978 | 6.258735 |
f4c6e18a-8515-4bdd-838a-ea22dc2dfa20 | sirkp/DSA | 9. Strings/problems/p25.cpp | // https://practice.geeksforgeeks.org/problems/distinct-pattern-search-1587115620/1/?track=SPC-Strings&batchId=154
bool search(string p, string s) {
int n = s.size(), m = p.size();
int i = 0, j=0;
while(i<n){
if(s[i]==p[j]){
i++;
j++;
if(j==m)
re... | ALGO | 0.999358 | 5.100435 |
13fb6059-7aaa-469b-b71e-a0c8aa3b9ad5 | ACMClassCourse-2023/int2048-2023 | data/Corner/6.cpp | /*
Time: 2023-10-27
Test: Operator +, -, *, /, %.
std Time: 0.10s
Time Limit: 1.00s
Notes: Sanity check.
*/
#include "int2048.h"
#include <cstdint>
using sjtu::int2048;
void test_self() {
int2048 x {1ll};
// pow(2,1000)
for(int i = 0 ; i < 1000 ; ++i) { x += x; x -= -x; }
std::cout << x << '\n';
... | TEST | 0.935944 | 4.302786 |
74cc45c9-76b5-4854-8654-474d8881fd86 | Gescale/C-PlusPlus--Challenges | Transpose 2D array using the swap function.cpp | #include <iostream>
using namespace std;
const int N=4, M=5;
void displayORG(int my4by4P[N][N])
{
cout << '\t' << "ROW1" << '\t' << "ROW2" << '\t' << "ROW3" << '\t' << "ROW4" << '\t' << endl;
for(int i=0; i < N; i++)
{
cout << "Column: " << i+1<< "| ";
for(int j=0; j< N; j++)
{
... | ALGO | 0.999023 | 4.39478 |
38a6cbe8-c379-4d96-af13-9a992d59bfab | Inna-hub-13/Functions_Pointers | findGCD.cpp | #include <stdio.h>
int findGCD(int, int);
void main() {
printf("The largest common dividor of 1688, 146 is %d\n", findGCD(1688, 146));
printf("The largest common dividor of 5000, 125 is %d\n", findGCD(5000, 125));
printf("The largest common dividor of 13, 16 is %d\n", findGCD(13, 16));
}
int findGCD(int number1... | ALGO | 0.999495 | 4.543531 |
8b8a3d3b-f02d-4d25-95cf-e34bae004957 | kri5h92/LeetCode-Codes | 14-longest-common-prefix/14-longest-common-prefix.cpp | // #include<bits/stdc++.h>
// using namespace std;
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
int len = INT_MAX;
for(auto i : strs)
{
len = min(len,(int)i.length());
}
string ans = "";
bool flag = true;
for(int i = ... | ALGO | 0.999743 | 5.418047 |
a2b19e01-e94d-47ee-a6b4-9893312ab047 | HaiZeizhouyuan/HZOJ | 264_2.cpp | /*************************************************************************
> File Name: 264_2.cpp
> Author: zhouyuan
> Mail: <EMAIL>
> Created Time: 2021年02月03日 星期三 09时55分04秒
************************************************************************/
#include<iostream>
#include<cstring>
#include<algorithm>
#includ... | ALGO | 0.999938 | 3.678929 |
63e5ed65-8740-400a-b64b-d72d27b3dc07 | cppimmo/AdventOfCode | 2021/Day3/main2.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
#include <bitset>
#include <array>
#include <algorithm>
#include <ranges>
#include <tuple>
#include <functional>
#include <utility>
static constexpr std::size_t gBitsSize{ 5 }; // 5 for test input.
using Bitset = std::bitset<... | ALGO | 0.998554 | 5.843281 |
1e55b859-5fd2-48d3-8c90-b40b995f3ab3 | mohamedamr77/Widget_package | 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.998784 | 6.761023 |
d6fc9e74-4983-4ab1-a138-950d1f9bd062 | hyperplasma/Ultimate-Solutions | PAT_Advanced_Level/cpp/PAT_A1051_Pop_Sequence/PopSequence.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <stack>
using namespace std;
const int MAXN = 1010;
int m, n, k; // m: 栈容量,n: 数字,k: 测试例数量
int main(void) {
cin >> m >> n >> k;
while (k--) {
stack<int> s;
int num[MAXN];
for (int i = 0; i < n; ++i) cin >> n... | ALGO | 0.999818 | 3.91648 |
e7f28cfb-4d57-4e52-a847-8bfa11909194 | eshernan/parallel_course | cuda/03_cuda_thread_programming/10_atomic_operation/reduction.cpp | #include <stdio.h>
#include <stdlib.h>
// cuda runtime
#include <cuda_runtime.h>
#include <helper_timer.h>
#include "reduction.h"
void run_benchmark(void (*reduce)(float*, float*, int, int),
float *d_outPtr, float *d_inPtr, int size);
void init_input(float* data, int size);
float get_cpu_result(f... | ALGO | 0.970536 | 5.201875 |
eb0e803b-de02-4360-9119-03d66fbc5989 | bentleyjensen/studious-potato | assignment31.cpp | /******************************************************************************
* Program:
* Assignment 31, Array Design
* Sister Hansen, CS 124
* Author:
* Sterling Jensen
* Summary:
* Get 10 grades from the user, put them in an array and print the average
*
* Estimated: 10 Minutes
* Actual: 5 ... | ALGO | 0.855632 | 5.645159 |
e2999a58-b17e-40f9-93a0-964305ace048 | Ryadav0654/DSA | Sorting/Heap sort/heap.cpp | #include <iostream>
using namespace std;
class heap
{
public:
int arr[100];
int size;
heap()
{
arr[0] = -1;
size = 0;
}
void insert(int val)
{
++size;
int index = size;
arr[index] = val;
while (index > 1)
{
int parentI... | ALGO | 0.999643 | 4.202439 |
914647b6-c534-4a32-bf0b-b130d094411b | adarsh44444/CSES-SOLUTION | 2649-count-total-number-of-colored-cells/count-total-number-of-colored-cells.cpp | class Solution {
public:
long long coloredCells(int n) {
return 1 + 4LL * n * (n - 1) / 2;
}
}; | ALGO | 0.999939 | 4.354633 |
17f0c3fd-643f-4dfc-b289-b3c557fc8dc0 | GeniusBacon/Cryptographic-Algorithms | T4_RSA.cpp | #include "T4_RSA.h"
#include <iostream>
#include <numeric>
#include<math.h>
using namespace std;
int T4_RSA::rsa_keysetup(int p, int q)
{
int e = 0;
long long qn = ((long long)p - 1) * ((long long)q - 1);
for (int i = 2; i < qn; i++)
{
if (i < qn && gcd(i, qn) == 1)
{
e = i... | ALGO | 0.999775 | 3.757854 |
8c6a57e1-5cfb-4c56-8142-53a130e12c3a | beberiche/Algorithms | backJoon/src/Q1072_게임/main.cpp | //
// Created by 김종현 on 2023/03/29.
//
#include <iostream>
using namespace std;
double x,y;
long long ans,z;
void input() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> x >> y;
z = y*100/x;
}
long long check(long long mid) {
return (y+mid)*100/(x+mid);
}
void solve() {
long long l=0;
long long ... | ALGO | 0.999801 | 4.169763 |
c93fad01-7f9a-4ffd-a431-91eede8f2dbd | Eunno-An/Programmers | Lv3/★순위.cpp | //fail
//1. 플로이드 와샬로 푸는 방법
//2. 단순 구현 문제(dfs)
//푼 방법은 후자로 하였으며, 아이디어를 참고하였음(https://blog.naver.com/gmlwo308/222180287358)
//쉬운 문제였으나,, 접근 다 해놓고 생각을 좀 더 깊게 하지 못했음.
#include <string>
#include <vector>
#include <cstring>
using namespace std;
int dfs(vector<vector<int>> graph,vector<bool>& visit, int node, int n) {
if... | ALGO | 0.999946 | 4.998992 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.