uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c50263a3-a2d5-461e-90a2-4f406b794356 | openharmony/arkcompiler_runtime_core | static_core/libpandabase/utils/utf.cpp | #include "utf.h"
#include <cstddef>
#include <cstring>
#include <limits>
#include <tuple>
#include <utility>
// NOLINTNEXTLINE(hicpp-signed-bitwise)
static constexpr uint32_t U16_SURROGATE_OFFSET = (0xd800 << 10UL) + 0xdc00 - 0x10000;
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define U16_GET_SUPPLEMENTARY(lea... | TOOL | 0.964229 | 7.292177 |
b09598ac-b423-47d3-9976-1a7a9a787337 | gfuid/c-_program | program/pattern.cpp | #include<iostream>
using namespace std;
int main()
{
int n,t;
cin >> n>>t;
//row column patter
for(int i=0; i<n; i++)
{
for(int i=0; i<t; i++)
{
cout << "*" ;
}
cout<< endl;
}
// Square pattern
int row,col;
cin >> row>>col;
... | ALGO | 0.999705 | 3.165449 |
6c32c840-f1d8-4114-9246-aea4ac8c1b89 | VishalC02/DS | uniqueelement.cpp | #include<iostream>
using namespace std;
int uniqueElement(int arr[],int n){
int ans=0;
for(int i=0;i<n;i++){
ans=ans^arr[i];
}
return ans;
}
int main(){
int arr[6]={1,2,2,1,1,3};
int a=uniqueElement(arr,6);
cout<<a<<endl;
} | ALGO | 0.999889 | 4.416786 |
ca1e2005-f8fe-42be-b112-47bb42c8237b | Ritapravo/coding | graphs/16_topological_sort/usingDFS.cpp | // https://practice.geeksforgeeks.org/problems/topological-sort/1
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define v(a) vector<a>
void graphInput (vector<int> [], int );
void dfs(vector<int>adj[], vector<int>&visited, vector<int>&res, int node){
visited[node] = 1;
for(auto i : adj[node]... | ALGO | 0.999987 | 5.68696 |
6d8492dc-ccd5-46b8-930b-6cd47c9ca701 | Itsrajsk/DSA-In-Cpp-From-Scratch | Matrix/Search-In-2D-Array-2.cpp | // Search In 2D Array Level 2 Problem
#include <bits/stdc++.h>
using namespace std;
void search(vector<vector<int>> &arr, int row_size, int col_size, int target)
{
int row = 0;
int col = col_size - 1;
while (row < row_size && col_size >= 0)
{
int element = arr[row][col];
if (element =... | ALGO | 0.999921 | 5.62663 |
86327977-cd3a-42f9-bdb8-7a56ddae7b5a | simranmodi1609/opencv | samples/cpp/fitellipse.cpp | /********************************************************************************
*
*
* This program is demonstration for ellipse fitting. Program finds
* contours and approximate it by ellipses using three methods.
* 1: OpenCV's original method fitEllipse which implements Fitzgibbon 1995 method.
* 2: The App... | ALGO | 0.998274 | 6.216884 |
7d980095-b51c-482d-aa61-18d4c902bd0b | rafaelauler/llvm-openisa | utils/TableGen/DAGISelEmitter.cpp | #include "CodeGenDAGPatterns.h"
#include "DAGISelMatcher.h"
#include "llvm/Support/Debug.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
using namespace llvm;
#define DEBUG_TYPE "dag-isel-emitter"
namespace {
/// DAGISelEmitter - The top-level class which coordinates construction
/// a... | TOOL | 0.909868 | 7.916114 |
52b08fde-4376-4db8-9159-7016d2352082 | sneharameshjadhav-22/DSA | Stack-queue/postfix to infix.cpp | /*givou are given a string that represents the postfix form of a valid mathematical expression. Convert it to its infix form.
Example:
Input:
ab*c+
Output:
((a*b)+c)
Explanation:
The above output is its valid infix form.
Your Task:
Complete the function string postToInfix(string post_exp), which takes a postfix stri... | ALGO | 0.99997 | 6.298636 |
762362b1-26ba-4d7d-aa10-28069a6c3536 | Paul-Elibana/Projet_Flutter | 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.998799 | 6.776823 |
78d9a005-1c2f-4bd8-be50-0f4e7a0c5054 | blueboy/portalR2 | dep/recastnavigation/Detour/Source/DetourNavMeshBuilder.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "DetourNavMesh.h"
#include "DetourCommon.h"
#include "DetourNavMeshBuilder.h"
#include "DetourAlloc.h"
#include "DetourAssert.h"
static unsigned short MESH_NULL_IDX = 0xffff;
struct BVItem
{
unsigned short bmin[3];
unsigned short ... | ALGO | 0.993528 | 7.029079 |
cbc6e993-a4d1-4656-b0c1-c6723541bc07 | nish2503/DSA-Sheet | Striver-DSA/Recursion_Striver/7_CombinationSum2.cpp | #include<bits/stdc++.h>
using namespace std;
void combiSum(int idx, vector<int>& nums, int n, int target, vector<int>& res){
if(idx==n){
if(target==0){
for(int i:res){
cout<<i<<" ";
}
cout<<endl;
}
return;
}
if(nums[idx] ... | ALGO | 0.999775 | 5.384017 |
94fca008-b3be-4fb4-ab08-4bc19a20f16a | prachiMeshram/Data-Structures-and-Algorithm | Dynamic Programming/palindromePartitioningll.cpp | // https://www.codingninjas.com/studio/problems/palindrome-partitioning_873266?source=youtube&campaign=striver_dp_videos&utm_source=youtube&utm_medium=affiliate&utm_campaign=striver_dp_videos
#include <bits/stdc++.h>
using namespace std;
// MEMOISATION
bool isPalindrom(int i, int j, string &str) {
while (i < j)... | ALGO | 0.999993 | 6.301381 |
c8ff3e18-5f3c-402b-9cc4-3cf3d7f14727 | shiva-shankar22/cpp | graphs/StriverGraphSeries/bfsTraversal.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
// BFS is Traversal Technique used to traverse Graph and visit the nodes exactly once
void bfs(vector<int> adj[],int s,int n){
vector<bool> vis(n,false);
queue<int> q;
q.push(s);
vis[s]=true;
while(!q.empty()){
int node =q.f... | ALGO | 0.999953 | 4.990337 |
0880a3e3-785c-4328-8bb6-35dd86fec8a4 | Intiser/ProblemSolvingAndContest | CodeForces/VNCA.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int check(string s){
int X = 0,Y = 0;
int x = 0,y = 0;
int len = s.size();
for(int i=0;i<len;i++){
if(s[i]=='R'){
x = x + dx[0];
y = y + dy[0];
}
else if... | ALGO | 0.999757 | 3.242193 |
889429f5-b110-43b7-9256-f7f05e5d052e | GuilhermeGabriel/competitive-programming | cses/1383.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
int mat[9][9];
int somaslinhas[9];
int somascolunas[9];
int linhas[10][10];
int colunas[10][10];
int n,k=1;cin>>n;
while(n--){
memset(linhas,0,sizeof(linhas));
memset(colunas,0,sizeof(colunas));
int atual;
bool possible=true... | ALGO | 0.999661 | 5.276029 |
e3e82ba7-c6a4-4c9f-aa59-8a551a8cd4d0 | fithisux/FSL | extras/include/boost/libs/msm/doc/HTML/examples/BoostCon09Full.cpp | #include <vector>
#include <iostream>
#include <boost/mpl/vector/vector50.hpp>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/back/tools.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
namespace // Concrete FSM implementation
{
// eve... | TOOL | 0.947593 | 7.016479 |
9e596598-ae09-4127-a560-5781796b6c24 | raincross7/code-similarity | codes/train_code/problem243/problem243_200.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s,t;
cin>>s>>t;
int i=0,j=0;
int cnt=0;
while(i<3 && j<3)
{
if(s[i]==t[j])
cnt++;
i++;
j++;
}
cout<<cnt;
} | ALGO | 0.999829 | 3.282205 |
2c144522-5ae7-4a78-9927-35a07f0b178c | aufanam/Competitive-Programming | B_2_Lampu_Hias_Warna-Warni.cpp | #include <bits/stdc++.h>
#define ll long long
#define int long long
#define ld long double
#define ull unsigned long long
#define itn ... | ALGO | 0.999963 | 3.853581 |
2f304a25-7860-455c-8ec5-6862f6084e2a | rikuTanide/atcoder_endeavor | code-festival-2018-quala/code_festival_2018_quala_b.cpp | #include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
using namespace std;
const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
... | ALGO | 0.999438 | 4.083588 |
f53ae5fa-6813-477e-9692-97a13ced5f8f | ouuan/Tree-Generator | tests/check.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <functional>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> f(n + 1);
for (int i = 1; i <= n; ++i) f[i] = i;
function<int(int)> find = [&](int x) { return x == f[x] ? x : f[x] = find(f[x]); };
for (int i = 1;... | ALGO | 0.999689 | 4.929407 |
35f6203a-6d79-4540-9909-1699119cff9b | mnygp/MolecularSimulation | problemSet5/Set5.cpp | #include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
struct Beads {
double x,y,z; // position in 3 dimensions
double px, py, pz; // momentum in 3 dimensions
double fx, fy, fz; // forces in 3 dimensions
};
class VerletSimulation {
public:
VerletSimulation(int N,double n_steps, dou... | ALGO | 0.999969 | 5.415561 |
597fc39c-fdd5-452e-bca4-68a229618059 | bhoomi2716/Assignment-Module-4 | program-11.cpp | // Write a program to swap the two numbers using friend function.
#include <iostream>
using namespace std;
class Swap
{
public:
int number1, number2;
Swap(int no1, int no2)
{
number1 = no1;
number2 = no2;
}
void BeforDisplayValue()
{
cout << "....... Befor Swaping ..... | ALGO | 0.999471 | 6.117095 |
c5c5e33e-5698-4fa4-9f58-ab8807130ca2 | coreykok/LoadTrajectory | resources/app/R-Portable-Mac/library/Rcpp/examples/ConvolveBenchmarks/convolve9_cpp.cpp | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
// this version expands convolve8_cpp by making Vec mimic the structure of
// NumericVector. It peforms well, so this is is not the structure of
// NumericVector that is the problem. So what is it then ?
//
// could it be because NumericVector is... | ALGO | 0.998592 | 6.450036 |
0e20593f-34b2-4963-8e0c-d8e478b4dfae | 192210060/CSA0402-OPERATING-SYSTEM | memory allocation.cpp | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MEMORY_SIZE 100
struct MemoryBlock {
int id;
int size;
int allocated;
};
void initializeMemory(struct MemoryBlock memory[], int size);
void printMemory(struct MemoryBlock memory[], int size);
void allocateFirstFit(struct MemoryBlock memory[... | ALGO | 0.999154 | 5.042833 |
bb51130f-e6e6-4333-8cc0-7dc9ef146f71 | FoxMoss/FoxWorld | camera.cpp | #include "camera.hpp"
#include "raylib.h"
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <pthread.h>
#include <raymath.h>
#include <string>
#include <thread>
#include <vector>
Vector3 A = {1, -1, 1};
Vector3 B = {-1, -1, 1};
Vector3 C = {0, 1, 1};
FoxTri *tri = new FoxTri(A, B, C);
... | ALGO | 0.959381 | 5.435453 |
cc135995-7cc5-4ef5-930c-0979e0b7557d | Alexander-1989/Drives | Drives/Utility.cpp | #pragma once
#include "Utility.h"
#include <math.h>
double Utility::Round(double value, int precision)
{
int decimal = (int)pow(10, precision);
return floor(value * decimal) / decimal;
} | TOOL | 0.998393 | 5.403846 |
36468ea2-bc0d-436e-a1ff-9b57c7e7c623 | ishandutta2007/codeforces | smax/normal/821/D.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif
template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typena... | ALGO | 0.999929 | 4.103977 |
0de5ed97-af2a-4d29-b29f-4f53bd4b14b2 | MNIGARR/Dynamic-Array | Dynamic Array/Source.cpp | #include <iostream>
#include <assert.h>
using namespace std;
template <class T>
class DynamicArray {
T* arr = nullptr;
int size = 0;
public:
DynamicArray() = default;
DynamicArray(const DynamicArray& da) {
if (da.size == 0) {
arr = nullptr;
size = 0;
return;
}
arr = new T[da.size];
size = da.siz... | TOOL | 0.862677 | 5.259861 |
7b6ca1fd-b79e-4262-93ed-3bbf4af5fb84 | AlizadehAli/path_planning | src/Eigen-3.3/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.98043 | 6.128571 |
dd915e69-303c-43f0-9a68-e2052412572b | alexandraback/datacollection | solutions_5658282861527040_0/C++/yannis/b.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int t, T, i, j, a, b, k;
scanf("%d", &T);
for (t=1; t<=T; ++t) {
scanf("%d %d %d", &a, &b, &k);
int ans = 0;
for (i=0; i<a; ++i... | ALGO | 0.997562 | 3.546423 |
cdf0662d-5bf2-4542-b8cd-dbe4bd34e79b | B-Navchev/Solutions-PO | Tasks/TasksLec04/IfinFunction.cpp | //C++ program returns the input number if the number is even
// If the number is odd returns ((temp * 3) + 1);
#include<iostream>
using namespace std;
int printSth(int a)
{
int temp = a;
if ((a > 0) && ((a % 2) == 0))
{
return temp;
}
else
{
return ((temp * 3) + 1);
}
}
int main()
{
int n, result;
cou... | ALGO | 0.999863 | 5.042154 |
a25b7baf-ab7f-40b7-b858-ef3fb83222e6 | niki/gameprogcpp | Exercises/4.2/Board.cpp | #include "Board.h"
#include "Random.h"
BoardState::BoardState()
{
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 7; j++)
{
mBoard[i][j] = Empty;
}
}
}
std::vector<BoardState*> BoardState::GetPossibleMoves(SquareState player) const
{
std::vector<BoardState*> retVal;
// For each column, find if a move... | ALGO | 0.972622 | 5.714752 |
05399117-38a9-4100-a855-baa5953905cc | CapTen101/CP-Solutions | Codeforces/Codeforces Round #734 (Div. 3)/B1.cpp | #include <bits/stdc++.h>
using namespace std;
#define my_sizeof(type) ((char *)(&type + 1) - (char *)(&type))
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ll long long int
#define ull unsigned long long int
#define ul unsigned long int
#define get cin >>
#define print cout <<
#define inarr(s, n... | ALGO | 0.99987 | 4.162714 |
da93df6a-4510-489a-839e-c0eceae247f9 | ishandutta2007/codeforces | siberian/normal/1360/D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define all(x) x.begin(), x.end()
template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, co... | ALGO | 0.999946 | 5.430622 |
f5fd1a94-1b41-435e-9575-0c7ee6e244a4 | Reaning/leetcodeCode | .leetcode/494.目标和.cpp | /*
* @lc app=leetcode.cn id=494 lang=cpp
*
* [494] 目标和
*/
// @lc code=start
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int findTargetSumWays(vector<int>& nums, int target) {
int sum=0;
for(auto it:nums)sum+=it;
vector<vector<int>>dp(nums.size())
}
};
// @... | ALGO | 0.999909 | 6.108719 |
04420f26-6292-4b3f-8983-1b76bc4f792a | kaba2/tim | tim/corematlab/matlab_tsallis_entropy_lps.cpp | // Description: tsallis_entropy_lps
// DocumentationOf: tsallis_entropy_lps.m
#include "tim/corematlab/tim_matlab.h"
#include "tim/core/tsallis_entropy_lps.h"
void force_linking_tsallis_entropy_lps() {};
using namespace Tim;
namespace
{
void matlabTsallisEntropyLps(
int outputs, mxArray *outputSet[],
int inp... | ALGO | 0.999731 | 4.392337 |
56bd0684-4f54-4ea2-a5f0-8a745a51921a | steineggerlab/petasearch | lib/mmseqs/src/commons/Orf.cpp | #include "Orf.h"
#include "Util.h"
#include "Debug.h"
#include "TranslateNucl.h"
#include "simd.h"
#include "itoa.h"
#include <climits>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <algorithm>
const char* Orf::iupacReverseComplementTable =
"................................................... | ALGO | 0.99809 | 3.628073 |
56b4c036-fd63-41b0-855f-20d22373d1a9 | AllenTsai1215/2023aaia2 | week11/week11-3.cpp | #include <stdio.h>
int gcd(int a,int b){
if(a==0) return b;
if(b==0) return a;
return gcd(b,a%b);
}
int main()
{
printf("пJӼƦr:");
int a,b;
scanf("%d %d",&a,&b);
int ans =gcd(a,b);
printf("O:%d",ans);
}
| ALGO | 0.999769 | 3.462384 |
e48804fd-befd-4c29-86d3-9138e9f91e1d | pengw0048/Ural--Timus--Solution | 1075/1078_3042798_WA_20100508074900.cpp | #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
double x[4],y[4],z[4];
double d(int i,int j){
return sqrt(pow(x[i]+x[j],2)+pow(y[i]+y[j],2)+pow(z[i]+z[j],2));
}
int main(){
int i;
double a,b,c,ca,cb,dis,t,s,r;
for(i=1;i<=3;i++)cin>>x[i]>>y[i]>>z[i];
cin>>r;
a=d(2,3);
b=d(1,3);
c=d(2,1);
ca=(p... | ALGO | 0.999494 | 3.376621 |
3bd88916-8771-4c88-8141-65ad9fb3789d | divykantsharma/Leetcode-Solution | 1742-widest-vertical-area-between-two-points-containing-no-points/1742-widest-vertical-area-between-two-points-containing-no-points.cpp | class Solution {
public:
int maxWidthOfVerticalArea(vector<vector<int>>& points) {
sort(points.begin(),points.end()); //sorting must be done on the basis of x axis
int maxi=INT_MIN;
for(int i=0;i<points.size()-1;i++){
maxi=max(maxi,points[i+1][0]-points[i][0]);
}
... | ALGO | 0.999832 | 5.683249 |
a2b68ab5-22b1-46e6-a4d9-a4c5945c1c1b | ishandutta2007/codeforces | bohdanpastuschak/normal/676/C.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cma... | ALGO | 0.999809 | 4.059914 |
76b75073-0f9b-43a7-8005-0b737daec3cf | za233/Polaris-Obfuscator | src/lldb/test/API/functionalities/data-formatter/user-format-vs-summary/main.cpp | struct Pair {
int x;
int y;
Pair(int _x, int _y) : x(_x), y(_y) {}
};
int main() {
Pair p1(3,-3);
return p1.x + p1.y; // Set break point at this line.
}
| ALGO | 0.973509 | 4.382822 |
41572bef-0864-449b-8822-c909b1754023 | Sowmik23/CompetitiveProgramming | DSA_Implementation/21. DP/3. canSum_Memorization.cpp | #include <bits/stdc++.h>
using namespace std;
///Write a function 'canSum(nums, targetSum)' that takes in a targetSum
///and an array of numbers as arguments.
///The function should return a boolean indicating whether or not it is
///possible to generate the targetSum using numbers from the array.
///You may use an... | ALGO | 0.999566 | 5.852932 |
b5f0d3fd-9993-472e-90ac-de9d5aac5980 | rasinhas/Maratona | codeforces/random/6C.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int n;
int a, b, t=0, ta=0, tb=0;
int choc[200000];
scanf("%d", &n);
a = 0;
b = n-1;
for(int i=0;i<n;i++) scanf("%d", &choc[i]);
while(a <= b || (!ta || !tb))
{
if(ta <= tb)
{
ta +=... | ALGO | 0.999762 | 3.44862 |
357853e8-78f0-49ef-8857-c79afeed6866 | ishandutta2007/codeforces | pikel_rik/normal/232/A.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()
using namespace __gnu_pbds;
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_... | ALGO | 0.999969 | 3.581359 |
b034a426-842e-443b-abee-4e9b27148f91 | Maolin-Wei/BU_Classes | EC601/final_project/packages/mmcv/ops/csrc/pytorch/ball_query.cpp | // Modified from
// https://github.com/sshaoshuai/Pointnet2.PyTorch/tree/master/pointnet2/src/ball_query.cpp
#include "pytorch_cpp_helper.hpp"
#include "pytorch_device_registry.hpp"
void ball_query_forward_impl(int b, int n, int m, float min_radius,
float max_radius, int nsample,
... | ALGO | 0.885873 | 6.726894 |
1d50eb3a-957c-45ef-a09b-1876bd2359ba | anju30k/Flutter-Work | assignment_21(listViewSeperator)/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.998564 | 6.76073 |
16f1a77b-e3c4-47a8-80dc-cbc10c3069ae | Ibn-Omar-Romel/Competitive_Programming_Codeforces | Round 993/A_Easy_Problem.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define vsort sort( vec.begin(), vec.end())
#define asort sort( veca, veca+size )
#define ok cout << "ok" << endl
#define nl cout << endl
// loops
#define fr(a, b) for(int i = a; i < b; i++)
v... | ALGO | 0.999754 | 4.41221 |
09dab23d-7efb-4eb4-b97e-0da1b44ad30e | tht2005/OI | usaco/train/barn1.cpp | /*
ID: dangduo1
LANG: C++11
PROB: barn1
*/
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define FORE(i,a) for(auto&i:a)
#define rep(i,b) for(int i=0,_b=(b);i<_b;++i)
#define SZ(a) ((int)a.size())
#define ALL(a) a.be... | ALGO | 0.999985 | 3.587387 |
a7a70561-752e-4122-b384-18d643459aee | Ivirton/ESTRUTURA-DE-DADOS-2 | algritmos de ordenacao/insect_sort/insert_encadeada.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct no {
char nome[20];
struct no* proximo;
} No;
No* cabeca = NULL;
void clear_screen() {
system("cls");
}
void imprimir(No* head) {
while (head) {
printf("%s -> ", head->nome);
head = head->proximo;
}
printf("NULL\n");
}
void ad... | ALGO | 0.999866 | 4.314407 |
b3f7fb1b-34cc-438c-918d-6d57c2891203 | 98andwin/Kattis_solutions | Problems/Video Speedup/videospeedup.cpp | #include <iostream>
using namespace std;
int main(){
int n, p, k;
cin >> n >> p >> k;
double sum = 0;
double prev = 0;
for (int i=0; i<n; i++){
double value;
cin >> value;
sum += (value-prev) * (100.0+i*p)/100.0;
prev = value;
}
sum += (k-prev)... | ALGO | 0.996865 | 3.130128 |
15d7a721-0524-4253-b579-977fc8b4db9b | sumitsojha88/Placement-Preparation | Geeks For Geeks Solutions/HashMap/Count pairs with given sum.cpp |
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int getPairsCount(int arr[], int n, int k) {
int count=0;
unordered_map<int,int> mp;
for(int i=0;i<n;i++)
{
int diff = k -arr[i];
... | ALGO | 0.999671 | 5.788258 |
228f67d4-c25d-4d04-80c7-d3a208b8ed18 | moonsong98/AlgorithmPractice | BOJ/11779.cpp | #include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<queue>
using namespace std;
const int MAX=987654321;
int main(void) {
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int n, m, s, e; cin >> n >> m;
vector<vector<pair<int,int>>> adj(n+1, vector<pair<int,int>... | ALGO | 0.99999 | 4.045311 |
9e2245d6-29ae-4b82-a87d-a3ee38c72194 | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/vcglib/apps/sample/trimesh_voronoiclustering/trimesh_voronoiclustering.cpp | #include<vcg/complex/complex.h>
#include<vcg/complex/algorithms/create/platonic.h>
#include<wrap/io_trimesh/import_ply.h>
#include<wrap/io_trimesh/export_ply.h>
#include<vcg/complex/algorithms/point_sampling.h>
#include<vcg/complex/algorithms/voronoi_processing.h>
using namespace vcg;
using namespace std;
class MyEdg... | ALGO | 0.995315 | 5.398154 |
3c9198db-6587-47f5-8461-205d85de5d88 | Temyaroslav/MDS2020 | cpp_mft/babylon_system.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
int main()
{
using namespace std;
int n, x, r;
string res = "";
cin >> n;
r = 0;
while (true){
if (n < pow(60, r)){
break;
}
else{
r++;
}
}
... | ALGO | 0.999661 | 4.000598 |
a26c5cef-0768-403a-9931-24549ec42baf | iitpparshant/cp_practice | codechefcontest/starter140Div3/Yoga Class.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n,x,y;
cin>>n>>x>>y;
int p= n*x;
int q= n/2*y;
if(n%2!=0){
q+=x;
}
cout<<max(p,q)<<endl;
}
return 0;
}
| ALGO | 0.999743 | 3.710686 |
23cbefc8-8b84-4a16-8941-74dfe69eeb9a | Amrita2222/DSA | TCSNQT/number/positiveOrNegative.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int num = -19;
if(num > 0){
cout << "The number is positive";
}
else if(num < 0 ){
cout << "The number is negative";
}
else{
cout << "zero";
}
return 0;
}
| ALGO | 0.999169 | 3.617284 |
840a02c9-dea1-4e0b-962e-d405d4964440 | EagleEyeKestrel/Leetcode | 101-200/146. LRU 缓存/template的副本.cpp | class LRUCache {
public:
int cap;
unordered_map<int, int> mp;
list<int> l;
unordered_map<int, list<int>::iterator> node;
LRUCache(int capacity) {
cap = capacity;
}
int get(int key) {
if (!mp.count(key))
return -1;
int res = mp[key];
l.erase(node[k... | ALGO | 0.999087 | 6.288125 |
2f5d0ade-26aa-45e5-8c01-9a788ef0b5be | abhijeet65/geeks_for_geeks | chori.cpp | #include<bits/stdc++.h>
using namespace std;
int reverse(int c){
int rev=0,r;
while(c>0){
r=c%10;
rev=(rev*10)+r;
c=c/10;
}
return rev;
}
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int x=reverse(n);
cout<<x<<endl;
if(x==n)
{
cout<<"1"<<"1"<<endl;
}
else
cout<<"0"<<"1"<<endl;
}
return 0;
}
| ALGO | 0.999942 | 4.533696 |
1e387e54-86ae-4fda-afe8-2f6545efa3bf | ANHM323/Entregas-y-Parciales | Ejercicios/Ejercicios de practica/ejercicio4_find_if.cpp | #include <iostream>
#include <vector>
#include <algorithm>
// Devuelve el índice del primer número par, o -1 si no hay ninguno
int buscarPrimerPar(const std::vector<int>& nums) {
auto it = std::find_if(nums.begin(), nums.end(),
[](int x){ return x % 2 == 0; });
if (it != nums.end()) ... | ALGO | 0.999832 | 5.935891 |
61939278-31d0-4292-94e9-07c629cd48b0 | Mohamedsaied8/EmbeddedCppDiploma | cpp/labs/templates/templates_basic.cpp | #include <iostream>
#include <vector>
template<class T>
T Max(T a , T b)
{
return a > b ? a : b;
}
int main()
{
std::vector<int> vect;
auto max = Max<int>(3, 6);
auto d_max = Max<double>(4.1, 8.5);
auto c_max = Max<char>('c', 'q');
std::cout << "int max " << max << " double max " <<
... | ALGO | 0.989655 | 4.716388 |
851aab22-07d9-4e20-a211-1573c2fad8e2 | chauhankartik/UVa | Cses/Graphs/Building_Teams.cpp | #include <bits/stdc++.h>
using namespace std;
// bipartite division -- graph coloring using 2 colors
vector<int> color(100001, -1);
vector<int> adj[100001];
int visited[100001];
int flag = 1;
void dfs(int v, int col)
{
visited[v] = true;
color[v] = col;
for (auto u : adj[v])
{
if (!visited[u]... | ALGO | 0.999985 | 4.582122 |
59667bf6-3519-4318-acf2-3f463b6e2e18 | prasannabantu/Code-100-days | LC2278. Percentage of Letter in String.cpp | class Solution {
public:
int percentageLetter(string s, char letter) {
int c=0;
for(auto ca:s) if(ca==letter) c++;
return (c*100)/s.size();
}
};
| ALGO | 0.995551 | 5.07152 |
59f83d1e-1f5a-404c-8763-b0820e6faff9 | muhammadakfz/Algorithm-Adventures | TLX/troc-19/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q;
cin >> p >> q;
int sum = (p * p) + (q * q) + 1;
if(sum % 4 == 0) cout << sum/4 << endl;
else cout << -1 << endl;
return 0;
} | ALGO | 0.999831 | 4.245488 |
60bd0405-84e8-4a13-abe5-fd53eb092ae5 | yitianhao/gpu_sched_new | gpu-sched-exp/minor/boost_1_61_0/libs/graph/example/astar-cities.cpp | #include <boost/graph/astar_search.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/random.hpp>
#include <boost/random.hpp>
#include <boost/graph/graphviz.hpp>
#include <sys/time.h>
#include <vector>
#include <list>
#include <iostream>
#include <fstream>
#include <math.h> // for sqrt
using names... | ALGO | 0.999925 | 6.297695 |
21c91e70-bc1a-4809-8da3-4ea1863c6e14 | HEMAL1234/Code1 | 102B .cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string a;
cin>>a;
long long sum=0,cnt=0;
while (a.size()>1){
for (int i=0;i<a.size();i++){
sum+=(int)a[i]-48;
}
stringstream st ;
st<<sum;
a=st.str();
sum=0;
cnt++;
}
cout<<cnt;
return 0;
}
| ALGO | 0.999845 | 3.385975 |
81398044-3135-42e4-b1cb-4ff982921a64 | riofach/uas-wabah-covid | 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.998733 | 6.76775 |
d12c324a-2481-4bab-a634-97b93f47542b | jeffwitthuhn/DK3ProgrammingContestPractice | c++ versions/rumikub.cpp | //example problem 6
#include <fstream>
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
//#include <string>
using namespace std;
struct tile{
char color;
int number;
};
int main(){
ifstream infile("RummikubIn.txt");
ofstream outfile("RummikubOut.txt");
unsigned long long inputs;
//string dumm... | ALGO | 0.998889 | 3.285125 |
75530479-bd5d-4755-98a1-23b8f27d03ec | abufarhad/Programming | DP/Count of subsets with sum equal to X/Subset sum.cpp | #include<bits/stdc++.h>
#include<stdio.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n, m) scanf("%lld%lld",&n, &m)
#define scc(c) scanf("%c",&c)
#define fr(i,... | ALGO | 0.999788 | 3.154416 |
be749b88-99c6-45df-ad3a-1da135e5eb88 | WHALEEYE/CS203-Lab-Assignments | Lab07/B.cpp | #include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long t, n, ini, pwi, h;
cin >> t;
for (int i = 0; i < t; i++) {
h = 1;
pwi = 2;
cin >> n;
while (pwi <= n) {
pwi *= 2;
h++;
}
cout << h << endl;
}
return ... | ALGO | 0.999963 | 4.379511 |
d8ac534a-5750-4368-8cfe-02b6ab3e795f | RenzoSC/codeforces-problems | resolutions/binarySearch/1538CNumberOfPairs.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;
cin >> t;
for (int x = 0; x < t; x++)
{
long long n , l , r;
cin>>n>>l>>r;
vector <long long> nums;
for (long long j = 0; j < n; j++)
{
... | ALGO | 0.999906 | 3.5703 |
bd171721-42b3-411c-8a09-923bbb9cf5ef | zjy-dev/algorithm | LeetCode/73-矩阵置零.cpp | #include "LeetCode.h"
class Solution {
public:
void setZeroes(vector<vector<int>> &nums) {
bool r = false, c = false;
int m = nums.size(), n = nums[0].size();
for (int i = 0; i < n; i++)
if (!nums[0][i]) {
r = true;
break;
}
for (int i = 0; i < m; i++)
if (!nums[i]... | ALGO | 0.995652 | 6.004076 |
2785a87f-88f5-41e8-96e4-c7a441eb218c | raptoravis/forwardplusrendering | thirdparty/boost_1_70_0/libs/sort/example/stringsample.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/string_sort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
using std::string;
using namespace boost::sort::spreads... | ALGO | 0.995106 | 4.772617 |
aa5404ab-11ce-4e14-a729-a766d8a61177 | jesuswr/cp-codes-and-problems | 535D.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<i... | ALGO | 0.999985 | 3.853436 |
f2d6df6f-2ec9-4518-9061-a05bc929bfc7 | vamcrizer/cpp-ptit | long/Phan_Tu_Chung.cpp | // LonggVu.
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
using str = string;
void nhap(ll a[], int n){
for(int i=1; i<=n; i++){
cin >> a[i];
}
}
void solve(ll a[], int n, ll b[], int m, ll c[], int p){
int x = 1, y = 1, z = 1, dk = 0;
while(x <= n && y <= m && z... | ALGO | 0.999908 | 3.727053 |
f7a1fecc-4215-4b92-a78c-288f5dca4104 | Ivan-71-ua/Competitive-Programming | LeetCode/279.cpp | #include <bits/stdc++.h>
class Solution {
public:
int numSquares(int n) {
int k = sqrt(n);
std::vector<int> dp(n + 1, n + 1);
dp[0] = 0;
for (int i = 1; i < n +1; i++)
{
for (int j = 1; j <= k; j++)
{
if(i - (j * j) > -1) {
if(dp[i - (j * j)] > -1) {
dp[i] = std::min(dp[i],... | ALGO | 0.999953 | 5.335066 |
fd2c4b23-e201-4f05-8671-db66050521ba | jasongoo827/CPP_Study | Coding_Test/baekjoon/Old/tree/5639.cpp | #include <iostream>
using namespace std;
// boj 5639
// #include <iostream>
// #include <vector>
// using namespace std;
// int datas[10000];
// struct Node
// {
// int var;
// Node *left;
// Node *right;
// };
// Node *makeTree(int min, int max, int &i, int maxIdx)
// {
// if (i >= maxIdx)
// ... | ALGO | 0.999929 | 5.132034 |
0ce9d0fb-9d29-46b0-beab-9262ba41632d | Raikyr4/Estrutura_de_Dados | Grafo/Trabalho_06_Hash/Trabalho_07_TiposHash/Quadratica.cpp | #include <vector>
#include <iostream>
#include <list>
using namespace std;
class Aluno
{
public:
Aluno() {}
Aluno(long int m, string n) : matricula(m), nome(n) {}
virtual ~Aluno() {}
void setMatricula(long int m) { matricula = m; }
void setNome(string n) { nome = n; }
long int getMatricula() { ... | ALGO | 0.993799 | 4.875791 |
cd220dd5-7f18-4032-b7fc-59bfb7dd2382 | yjnnlee/Algorithm | solve/4153 직각삼각형.cpp | #include <stdio.h>
int n,m,k;
int main(void) {
while(1){
scanf("%d%d%d", &n, &m, &k);
if(n==0 && m==0 &&k==0) return 0;
if(n*n + m*m == k*k || n*n + k*k ==m*m || k*k+m*m==n*n) printf("right\n");
else printf("wrong\n");
}
}
| ALGO | 0.999962 | 3.273456 |
ef71905e-0b42-44e9-b5c5-131903adedf9 | VasisthaPrakhar/LC_Questions | 1277-count-square-submatrices-with-all-ones/1277-count-square-submatrices-with-all-ones.cpp | class Solution {
public:
int countSquares(vector<vector<int>>& mat) {
int n=mat.size();
int m=mat[0].size(),ans=0;
int dp[n][m];
memset(dp,0,sizeof(dp));
for(int i=0;i<n;i++){
dp[i][0]=mat[i][0];
ans+=mat[i][0];
}
for(int j=1;j<m;j++){
... | ALGO | 0.999703 | 6.003202 |
a999aa6c-9258-4c36-b3d5-1b7a2b9e297f | pkrc267/coding-problems | Misc/mergeSort.cpp | #include "iostream"
using namespace std;
void Merge(int A[], int T[], int l, int mid, int r)
{
int l1= l;
int j = l;
int leftEnd = mid;
//int size = r - l + 1;
int k = mid+1;
while(l <= leftEnd && k <= r){
if(A[l] <= A[k]){
T[j] = A[l];
l++;
}
else{
T[j] = A[k];
k++;
}
j++;
}
while(l <= ... | ALGO | 0.999958 | 4.616008 |
3b429ab0-e423-4e2d-88dc-605affad0ae1 | emrullahjack/cpp-workspace | Algorithms/SmallestAbsoluteDiff/smallestAbsoluteDiff.cpp | /*
* File name: smallestAbsoluteDiff.cpp
* Author: Emrullah Jack Oztosun (<EMAIL>)
* Description: Suppose you are given two arrays A[1..n] and B[1..n] of integers. You are required to find
* a pair of elements (A[i], B[j]) such that their absolute difference is the smallest over all such pairs.
* Notes: Assume A and ... | ALGO | 0.999965 | 5.021938 |
b824ba80-e1a9-4b8b-b149-1b8f14ea3a85 | JMacro/Car.Discern | src/Car.Discern.Core/src/core/feature1.cpp | #include "easypr/core/feature.h"
#include "easypr/core/core_func.h"
#include "thirdparty/LBP/lbp.hpp"
namespace easypr {
Mat getHistogram(Mat in) {
const int VERTICAL = 0;
const int HORIZONTAL = 1;
// Histogram features
Mat vhist = ProjectedHistogram(in, VERTICAL);
Mat hhist = ProjectedHistogram(in, HORIZO... | ALGO | 0.920917 | 5.369115 |
bb761aca-a58a-46b6-bfe6-654c11bee595 | kmjp/procon | 2012-2016/2015/unk/unk8/b.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 ZERO(... | ALGO | 0.999861 | 3.816115 |
aca8867f-17da-4e05-baa8-84c392229909 | Ayuub254/DATA-STRUCTURES-AND-ALGORITHMS-IN-C- | Selection Sort/Selection Sort/main.cpp | //
// main.cpp
// Selection Sort
//
// Created by Ayub's mac✌🏾 on 15/10/2024.
//
#include <iostream>
using namespace std;
class Sorting{
public:
void display(int myArr[], int n){
for(int i =0; i<n; i++){
cout<<myArr[i]<<" , ";
}
cout<<endl;
}
void selectionSort... | ALGO | 0.99981 | 5.461308 |
60bee9c2-5d8f-4c89-9076-479808b2406e | dipu-bd/OJ-Codes | UVA Codes/Volume 101/10131 - Is Bigger Smarter/10131 - Is Bigger Smarter_v1.cpp | /*============================
/\u7h0r : 5ud!p70 ch@ndr@ d@5
=============================*/
//C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h>
//cpp headers
#include <iostream>
#include <iomanip>
#include <sstream>
#incl... | ALGO | 0.999922 | 3.346542 |
3157b536-89db-4885-a4a9-cd267d474c4c | chensming/AlogrithmProblem | LeetCode/动态规划/70.爬楼梯/Solution.cpp | /*
假设你正在爬楼梯,需要 n 阶你才能到达楼顶。
每次你可以爬 1 或 2 个台阶,你有多少种不同的方法可以爬到楼顶呢?
*/
#include <vector>
using namespace std;
class Solution
{
public:
int climbStairs(int n)
{
if (n <= 2)
return n;
int nums[n + 1];
nums[1] = 1;
nums[2] = 2;
for(int i = 3; i <= n; i++)
... | ALGO | 0.999865 | 4.708514 |
6b7d40e4-291e-44ae-8258-c5bbf98e8627 | thecreatorsir/DailyDSA | stacks/remove-outermost-parentheses.cpp | class Solution {
public:
string removeOuterParentheses(string S) {
string ans{};
int outer = 0;
for(auto s:S){
if(s=='('){
outer++;
if(outer!=1) ans.push_back(s);
}
else{
outer--;
if(ou... | ALGO | 0.999261 | 6.183115 |
31c1183d-2948-443c-80ea-dd0f1e8ddef5 | misiewiczp/arc | ctrl.app/src/planner/mpc/src/Eigen-3.3/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.852053 | 3.154174 |
f73ec957-4195-4855-914d-21e665165abb | lsChen916/NCTU_CASE | HW3/inverse_kinematics_source_code/boost_1_59_0/libs/graph_parallel/test/distributed_dfs_test.cpp | #ifdef BOOST_NO_EXCEPTIONS
void
boost::throw_exception(std::exception const& ex)
{
std::cout << ex.what() << std::endl;
abort();
}
#endif
using namespace boost;
using boost::graph::distributed::mpi_process_group;
// Set up the vertex names
enum vertex_id_t { u, v, w, x, y, z, N };
char vertex_names[] = { 'u',... | ALGO | 0.917927 | 6.794466 |
5ce504f3-0620-4f5a-9da5-140c48c11f5d | d2verb/misc | algorithms/search/hill_climbing/hill_climbing.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int gx, gy;
// Using manhattan distance as eval function
int eval(int x, int y) {
return -(abs(gy - y) + abs(gx - x));
}
void find_goal_pos(vector<string> &field) {
int H = field.size();
int W = field[0].size();
for (int y = 0; y < H;... | ALGO | 0.999956 | 4.811213 |
f9cfaa3d-daa1-40d2-87b8-32bfeed3311f | christiealappatt/TrilRACE | packages/rol/example/PDE-OPT/binary/adv-diff/example_01.cpp | /*! \file example_01.cpp
\brief Shows how to solve the binary advection-diffusion control problem.
*/
#include "Teuchos_GlobalMPISession.hpp"
#include "Tpetra_Core.hpp"
#include "Tpetra_Version.hpp"
#include <iostream>
//#include <fenv.h>
#include "ROL_Stream.hpp"
#include "ROL_ParameterList.hpp"
#include "ROL_... | ALGO | 0.999287 | 6.010931 |
6e47859c-d610-40f9-97ae-68a13943992e | vfolunin/archives-solutions | EOlymp/10615.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <random>
using namespace std;
class Treap {
inline static minstd_rand gen;
struct Node {
int key, priority, size = 1;
Node *left = 0, *right = 0;
Node(int key) : key(key)... | ALGO | 0.999639 | 4.361184 |
f622e459-546c-4164-8a82-a6cd4cb3779a | GabrielaRistea/OOP | ex1_lab9_Ristea_Gabriela_CR2.3A/main.cpp | #include <iostream>
#include <vector>
#include "Sort.h"
#include "Utils.h"
using namespace std;
int main()
{
int intArr[] = { 3, 1, 4, 1, 5, 9, 2, 6, 5 };
int n = sizeof(intArr) / sizeof(intArr[0]);
bubbleSort(intArr, n);
cout << "Sorted intArr: ";
for (int i = 0; i < n; i++)
{
cout ... | ALGO | 0.998195 | 4.917782 |
8d74bb93-7037-4c20-aea5-4e080095de00 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/October/ReplaceForX_20201005133911.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999946 | 3.469119 |
d7688046-9af7-458f-8f11-883442fdffda | d33pe8h-j4a/450Dsa | Linked_list/Remove_duplicates2.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
void print(Node *root)
{
Node *temp = root;
while(temp!=NULL)
{
cout<<temp->data<<" ";
temp=temp->next;
}
}
// } Driver Code Ends
/*
The structure ... | ALGO | 0.999832 | 5.862942 |
70424a72-3148-48e8-8ee0-4aeb2f4db305 | RieraULL/AyED | Temario/Tema3/listas/Vector/main_sll.cpp | #include <iostream>
#include "sll.hpp"
#include "memory.hpp"
#define N_CHARS 26
using namespace std;
int main(void)
{
AyED::memory<char> memory;
AyED::sll<char> lista(memory);
for(int i{0}; i < N_CHARS; i++)
lista.insert_head( memory.New('a' + i) );
lista.write(cout);
cout << endl;
int nodo = lista.ext... | ALGO | 0.975167 | 3.401718 |
b0cb6f83-7334-45d5-84f2-3b2ef7e4b34d | smrashed/leetcode-solutions | DSA/100. Same Tree/solution.cpp | /**
* 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) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999968 | 6.56306 |
77e97010-8ab6-41f9-be4e-d49f4d351a6c | VatsalP117/dsa-questions | Random/Math/check_prime_efficient.cpp | // Brute force:
// i=2 se leke n-1 tak loop chala do koi bhi divide kar diya to false varna true
// T.C= O(n)
// Better approach: O(n^1/2) i.e square root of n time complexity
// idea: divisors always occur in pairs
// eg: 30: (1,30),(2,15),(3,10),(5,6)
// elements of pair multiply to n
// so if(x... | ALGO | 0.999826 | 5.450925 |
d4a304a1-db06-43f1-83fa-b2bec32a8a33 | Rulial/TRUST-PI | src/Nimiq/Address.cpp | #include "Address.h"
#include "../Base32.h"
#include "../Hash.h"
#include "../HexCoding.h"
#include <TrezorCrypto/blake2b.h>
#include <algorithm>
#include <cassert>
#include <cmath>
using namespace TW::Nimiq;
static const char* BASE32_ALPHABET_NIMIQ = "0123456789ABCDEFGHJKLMNPQRSTUVXY";
static int check_append(in... | TOOL | 0.892837 | 7.532937 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.