uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
14fead04-ac63-44c9-aeef-a33242dbb713 | Acul4321/competitive-programming-submissions | atcoder/abc383/abc383_b/main.cpp | #include <iostream>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <deque>
#include <stdio.h>
#include <cassert>
#define ll long long
#define ld long double
#define MOD(x,y) (x%y+y)%y
using namespace std;
//modular ... | ALGO | 0.999969 | 4.556139 |
00e8e713-80fc-44bf-bb9f-21dfbaae4f0c | kidclone3/CP | OnlineJudge/Codeforces/TOPIC/implementation/TwoTeamsComposing.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define vi vector<int>
#define ll long long
#define all(x) x.begin(), x.end()
#define FOR(i, a) for (int i = 0; i < (a); ++i)
#define FOR1(i, a) for (int i = 1; i < (a+1); ++i)
#define F0R(i, a, b) for (int i=(a); i < (b); ++i)
#define F_OR(i, a, b, ... | ALGO | 0.999889 | 4.777775 |
b7e76c08-ab62-45eb-877f-75f4b0ada50f | firewood/topcoder | atcoder/tenka1_2012/qrb_b.cpp | // B.
#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
using namespace std;
int main(int argc, char* argv[]) {
#ifdef _MSC_VER
while (true)
#endif
{
string s;
cin >> s;
if (s.empty()) return 0;
string ans = s, head, tail, camel, snake;
bool camelCase = true, snake_case = true... | ALGO | 0.998841 | 4.424858 |
b71a2226-647c-4cf4-b968-aac19938075a | stevenokm/i2p-nthu-math | i2p1/src/function/lab12_3_110021120.cpp | #include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
void parse_expression(string &expression, vector<string> &tokens)
{
stringstream str(expression);
for (string term; (str >> term);)
{
tokens.push_back(term);
}... | ALGO | 0.999357 | 4.803482 |
cf8bf108-387c-4fba-bd7c-943ba199fd1f | ishandutta2007/codeforces | kubic/normal/1301/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 505
int n,m,q,L,R,ans,c[N][N][4],s[N][N][N>>1];char a[N][N];
int min(int x,int y) {return x<y?x:y;}
int f(char x)
{
if(x=='G') return 0;if(x=='Y') return 1;
if(x=='R') return 2;if(x=='B') return 3;return -1;
}
bool chk(int x,int x1,int y1,int x2,int y2)
{
if(!... | ALGO | 0.998662 | 3.927443 |
effa55e2-ff94-4c97-b5c9-72760a9b02d5 | nrhys2005/-algorithm | Programers_Greedy_단속카메라.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(vector<int> a, vector<int> b) {
return a[1] < b[1];
}
int solution(vector<vector<int>> routes) {
int answer = 0;
sort(routes.begin(), routes.end(), cmp);
int index = routes[0][1];
answer++;
for (int i = 1... | ALGO | 0.999156 | 5.064379 |
224096ce-ee82-43c5-8f42-e33113a7d9fe | raincross7/code-similarity | codes/train_code/problem079/problem079_286.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
//GOTU
//#GOTU
int main()
{
ll n,m;
cin>>n>>m;
ll broken[n+1]{};
ll temp;
for(ll i=0;i<m;i++)
{
cin>>temp;
broken[temp]++;
}
ll ways[n+1]{};
ways[0] = 1;
if(broken[1] == 0)
wa... | ALGO | 0.999995 | 4.462013 |
6f05166d-143d-4231-a299-128271ff4a72 | WadeOWatts/Object-Oriented-Programming-2022-Spring | Lab/Lab07/110511194_lab7.cpp | #include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
class PolySeq
{
public:
PolySeq();
PolySeq(int,double* ,int*);
PolySeq Add(PolySeq);
PolySeq Multiply(PolySeq);
PolySeq Derivative();
double Integral(int,int);
double getvalue(int);
void getce();
private:
int n;
double* ... | ALGO | 0.999805 | 3.273346 |
83463220-67d1-4877-9abb-605c6aafe5b9 | Anishprajapat123/DATA-STRUCTURES-AND-ALGOS | ARRAY/LONGEST CONSEQUENCE.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
void longestconsequence(int n,vector<int> &a)
{
unordered_set<int> st;
int longest=1;
if(n==0)
{
longest=0;
}
else{
for(int i=0;i<n;i++)
... | ALGO | 0.999835 | 4.087679 |
3ad5c300-ffe4-4d64-8a8e-3ba86a8fc474 | artyom2006KBTU/extra-points-1-4 | ex12.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if(n%4==0){
cout<<"yes";
}
else if(n%4!=0){
cout<<"no";
}
return 0;
}
| ALGO | 0.999958 | 4.20744 |
a6d03687-135f-493c-896f-6892785ebf12 | HowardDreemurr/pl-slam-compat | depends/opencv/modules/dnn/src/layers/softmax_layer.cpp | #include "../precomp.hpp"
#include "layers_common.hpp"
#include "op_halide.hpp"
#include "op_inf_engine.hpp"
#include "opencl_kernels_dnn.hpp"
#include <algorithm>
#include <stdlib.h>
using std::max;
#ifdef HAVE_OPENCL
using namespace cv::dnn::ocl4dnn;
#endif
namespace cv
{
namespace dnn
{
class SoftMaxLayerImpl : pu... | ALGO | 0.990022 | 7.498155 |
e7c8de70-ce30-4a73-90d3-8169177a97c6 | samin710/Codes | BearandBigBrother.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
cin >> a;
cin >> b;
for (int i = 1;; i++)
{
if ((3 * a) > (2 * b))
{
cout << i;
break;
}
a *= 3;
b *= 2;
}
} | ALGO | 0.999567 | 3.374106 |
1b139ec6-7a4d-47e4-b8b5-a67b19411793 | AlexanderSmall/EvoSim | evolutionsim1/EvolutionSim/GeneticAlgorithm.cpp | #include "GeneticAlgorithm.h"
#include <random>
#include <ctime>
#include <math.h>
#include <functional>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <stdio.h>
#define M_PI acos(-1.0)
static std::random_device rd; // random device engine, usually based on /dev/random on UNI... | ALGO | 0.976823 | 4.429975 |
b1242283-8700-43a0-980b-2d2b26c374b9 | NengQian/fluid_simulation | extern/eigen_3.3.4/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.999812 | 4.220459 |
d9a66d46-c4a2-46da-8d45-0c1c044b877c | amantvn1234/Leetcode-Gfg | matrix-diagonal-sum/matrix-diagonal-sum.cpp | class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int ans=0;
for(int i=0;i<mat.size();i++){
for(int j=0;j<mat[i].size();j++){
if(i==j||i+j==mat.size()-1)
ans+=mat[i][j];
}
}
return ans;
}
}; | ALGO | 0.999953 | 5.766252 |
66955034-d489-4e62-ad8c-705c8f03cde4 | n30nd/TTUD_Samsung-Applied-Programming-HUST | 3RD MID TEST DUNGPQ/Bai 3 Bien Doi/main.cpp | //Bài 3 BIẾN ĐỔI SỐ (P03)
//Cho một số nguyên dương N được ghi trên bảng. Tại mỗi bước, thực hiện 1 trong 2 phép biển đồi sau:
//Xóa N và thay bởi N + 2 (nếu N <= 10000)
//Xóa N và thay bỏi N – 5 (nếu N >= 5)
//Hãy xác định số ít nhất Q các bước biến đổi cần thực hiện để thu được số 0 ghi trên bảng
//Dữ liệu vào
//Số n... | ALGO | 0.999845 | 4.008296 |
d74b5d17-8c2b-46f6-b05c-8abceb31d307 | shoobiedoo/Baruch_C-_primer | Level 9/Exercise D/Projects/MC/UtilitiesDJD/CompileTimeVectorsAndMatrices/VectorSpaceMechanisms.cpp | // VectorSpaceMechanisms.cpp
//
//
// 2007-1-12 DD main functionality
// 2007-1-19 DD hpp and cpp
// 2007-6-1 DD Testing and beta code review
// 2007-6-8 DD new void functions for converting bwteem
// 2007-10-15 DD TripleSum (saxpy)
//
// (C) Datasim Education BV 2007-2008
//
#ifndef VectorSpaceMechanisms_CPP
#defin... | TOOL | 0.931079 | 4.773107 |
7267b066-dc7e-415e-a7e2-03beaebb7e40 | Kloud321/C---Fundamentals | Functions/04. Print Name of Numbers/task4.cpp | #include <iostream>
#include <string>
using namespace std;
string convertLessThanHundred(int num) {
if (num == 0) {
return "";
} else if (num < 10) {
return {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}[num - 1];
} else if (num > 10 && num < 20) {
return ... | TOOL | 0.978312 | 7.027596 |
5c6989c4-823b-45cf-896a-9bff3c741e69 | notabn/Path_Planning | src/Eigen-3.3/doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n... | ALGO | 0.993199 | 3.687909 |
3bd6cca6-1dff-4455-94cd-a67f2c0dba08 | Vekleon/sand-simulation | extern/libigl/include/igl/segment_segment_intersect.cpp | #include <Eigen/Geometry>
template<typename DerivedSource, typename DerivedDir>
IGL_INLINE bool igl::segment_segment_intersect(
const Eigen::PlainObjectBase <DerivedSource> &p,
const Eigen::PlainObjectBase <DerivedDir> &r,
const Eigen::PlainObjectBase <DerivedSource> &q,
const Eigen::PlainObjectBase <DerivedDi... | ALGO | 0.999084 | 6.660834 |
9f0fe617-f8cb-4e24-af30-5e3ac4f73030 | shiref209/learning-c | C++/4 control flow apps/even or odd/app.cpp | // even or odd checker
#include <iostream>
using namespace std;
int main()
{
int num;
cout << "Please enter the number" << endl;
cin >> num;
if (num % 2 == 0)
{
cout << "Number is Even";
}
else
{
cout << "Number is odd";
};
return 0;
} | ALGO | 0.996773 | 3.587918 |
5c404958-aeec-4af5-83ce-c254162d6026 | Krshivam/UVA-Online-Judge | uva_10819.cpp | #include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
int dp[10001][101];
pii wt[101];
int main(int argc, char const *argv[])
{
int n,m;
while(cin>>m>>n){
int cnt=0;
for (int i = 0; i < n; ++i)
{
int w,item;
cin>>w>>item;
wt[i].first = w;
wt[i].second = item;
cnt+=w;
}
if(m... | ALGO | 0.99984 | 3.282841 |
688ef419-8094-4245-86e4-8ca9aad419ef | darkhemic/blender | intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp | #include <OpenImageIO/fmath.h>
#include <OSL/genclosure.h>
#include "osl_closures.h"
CCL_NAMESPACE_BEGIN
using namespace OSL;
class DiffuseRampClosure : public CBSDFClosure {
public:
Color3 colors[8];
float3 fcolors[8];
DiffuseRampClosure() : CBSDFClosure(LABEL_DIFFUSE)
{}
void setup()
{
sc.prim = this;
... | ALGO | 0.882346 | 7.653316 |
09faa511-21bb-4c01-9aef-f89ad9295d7a | ra2003/Plagiarism | dataset/test/modification/1598_control_replacement/59/transformation_1.cpp | #include <iomanip>
#include <iostream>
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
for ( ; t--; )
{
int n;
cin>>n;
string a,b;
cin>>a>>b;
bool ans=true;
{
int i=0;
for ( ; i<n; )
{
if(!(a[i]=='0' || b[i]=='0')){
... | ALGO | 0.999414 | 4.879231 |
5f60fb12-129f-4c27-9ce0-d47023e8c3dd | goldenpython/Contests | Timus/p1001v0_cpp11.cpp | /*******************************************************************************
* Cristian Alexandrescu *
* 2163013577ba2bc237f22b3f4d006856 *
* 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ... | ALGO | 0.99946 | 4.179266 |
0875d493-c548-4dfb-a757-7dbe355678f9 | surendra-sketch/cprogram | c++/STL/AllQueries.cpp | #include<bits/stdc++.h>
#include<vector>
#include<stdlib.h>
using namespace std;
// void print(vector <int> &v){
// v.push_back(6);
// for(int i=0; i<v.size();++i)
// {
// cout<<v[i]<< " ";
// }
// cout<<endl;
// }
// int main(){
// system("cls");
// int n;
// cin>>n;
// vector<int> arr;
... | ALGO | 0.989939 | 3.371901 |
3600132b-1e8c-4600-9284-437c96ce7ce1 | ishandutta2007/codeforces | choutii/normal/497/E.cpp | #include <bits/stdc++.h>
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int) (x).size())
#define ALL(x) x.begin(), x.end()
#define debug(x) cerr << #x" = " << x << endl
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef unsigned long long u64;
ty... | ALGO | 0.999965 | 4.011181 |
607d6e01-1fa0-40a9-b59d-312e9f676d47 | randbatch-md/lammps-rbe | src/TALLY/compute_heat_flux_virial_tally.cpp | #include "compute_heat_flux_virial_tally.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "group.h"
#include "memory.h"
#include "pair.h"
#include "update.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeHeatFluxVi... | ALGO | 0.963184 | 6.389686 |
c9f5fb68-bed0-4812-9141-1b1bdb75cb7d | aqfaridi/Competitve-Programming-Codes | CODECHEF/SSTORY_back.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define... | ALGO | 0.999916 | 3.275716 |
166a5196-26a1-4f28-8a4d-b483f9bc3136 | adarshnarayan04/Codeforces | 743B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define popcount(x) __builtin_popcountll(x)
#define w(t) ll testcase; cin>>testcase; for (ll tc = 1; tc <= testcase; ++tc)
#define vin(v,n) for(int i = 0; i < n; ++i){int x;cin>>x;v.pb(x);}
//vin(vector na... | ALGO | 0.999671 | 4.368675 |
49b31b0d-7eb8-42b2-b88a-e3d96b09013c | CSTGluigi/2021trains | 二分查找及排序/P1678 烦恼的高考志愿.cpp | #include<bits/stdc++.h>
using namespace std;
#define maxn 1000050
int m,n,a[maxn];
int ler(int x)
{
int l=1,r=m,an=l;
while(l<=r)
{
int mid=l+r>>1;
if(a[mid]>=x)r=mid-1;
else l=mid+1;
if(a[mid]<x)an=mid;
else if(a[mid]==x)return 0;
}
return abs(a[an]-x);
}
int rer(int x)
{
int l=1,r=m,an=r;
while(l<=r)... | ALGO | 0.999969 | 3.744136 |
46df73e1-0c71-423b-bd34-1ae303a7a264 | AIDAN73/CSCI-311 | Lab5/AVLTree.cpp | // CSCI 311 - Fall 2021
// Lab 5 Skeleton - AVLTree cpp
// Author: Carter Tillquist
#include<iostream>
#include <vector>
#include <limits.h>
#include "AVLTree.h"
using namespace std;
AVLTree::AVLTree()
{
root = nullptr;
size = 0;
}
AVLNode* AVLTree::getRoot() {return root;}
int AVLTree::getSize() ... | ALGO | 0.999499 | 4.19601 |
7a6a8fac-19c6-41c9-a5fe-1174c51b2370 | bryanruiz1028/proyectos-en-c- | BRYAN RUIZtareas en TURBO C++/41TAREA.CPP | #include<iostream>
#include<conio.h>
using namespace std;
int p=4; //p x p 5 NUMEROS PARES MAYORES A 3
int main ()
{
do{
cout<<p<<",";
p=p+2;
}while(p<13);
getch();
} | ALGO | 0.99767 | 3.171989 |
0a8e2330-f638-4089-9aae-a4698d73cad3 | ploWoj/multithreads | module4/exercises/04_synchronization.cpp | // use store() / load()
#include <vector>
#include <atomic>
#include <mutex>
#include <thread>
#include <iostream>
using namespace std;
vector<int> generateContainer() {
vector<int> input = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9};
vector<int> output;
vector<thread> threads;
for (auto i = 0u; i < input.size();... | TOOL | 0.971456 | 4.102881 |
bc7334a3-81b0-44f1-8491-7bb41dcfd9e0 | ishandutta2007/codeforces | krk/normal/1074/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 1005;
int t;
int n;
vector <int> neigh[Maxn];
int A[Maxn], alen;
int B[Maxn], blen;
bool my[Maxn], his[Maxn];
int lvl[Maxn];
void Read(int A[], int &alen, bool my[])
{
scanf("%d", &alen);
for (int i = 0; i < alen; i++) {
scanf("%d", &A[i]... | ALGO | 0.999918 | 3.744718 |
294771f3-946b-4bc8-b511-26861ff82239 | anuragtomer/leetcode | 30-day-challenge/May/16.odd-even-linked-list.cpp |
#include <iostream>
#include <vector>
#include "../../include/utility.h"
using namespace std;
class Solution {
public:
ListNode *oddEvenList(ListNode *head) {
if (head == nullptr)
return head;
ListNode *evenHead = head->next;
if (evenHead == nullptr)
return head;... | ALGO | 0.999599 | 5.898377 |
3fe06bd7-302b-4df4-8afd-35d572104b09 | sudharsan12/problem_solving | question_20.cpp | #include<bits/stdc++.h>
using namespace std;
bool placeChk(vector<vector<char>> &mat,int row,int col,int m)
{
if(col==0 && mat[row][col]!= mat[row][col+1])
return true;
if(col==m-1 && mat[row][col]!= mat[row][col-1])
return true;
if(mat[row][col]!=mat[row][col-1] && mat[row][col]!=mat[row][co... | ALGO | 0.999977 | 4.457592 |
7166bbe9-4f63-4ff4-a3cf-4540c26ec6dc | mohit-bhat/Navigation-challenge | Dll6/Dll6/Dll6.cpp | // Dll6.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#define DLL6_EXPORTS
#include "Dll6.h"
#include <stdio.h>
using namespace std;
struct node{
Point p;
float key;
node *left;
node *right;
};
struct SearchContext{
node* root;
};
node * insertNode(node* n, const Point... | ALGO | 0.996979 | 4.617917 |
ea222423-78f2-40ee-bc6d-45437e52b621 | alexandraback/datacollection | solutions_5639104758808576_1/C++/liuq901/a.cpp | #include <cstdio>
char a[1010];
int main()
{
int T;
scanf("%d",&T);
while (T--)
{
int n;
scanf("%d%s",&n,a);
int tot=0,ans=0;
for (int i=0;i<=n;i++)
{
if (tot<i)
{
ans+=i-tot;
tot=i;
}
... | ALGO | 0.998749 | 3.75139 |
bc0cd88e-1710-4b30-8b67-90ab44d86323 | nikolapesic2802/Programming-Practice | Educational Codeforces Round 60/A.cpp | #include <bits/stdc++.h>
int n,m,s=1,c,a;
int main()
{
std::cin>>n;
while(n--)
{
std::cin>>a;
if(a>m)
m=a,s=1,c=0;
if(a==m)
c++;
else
c=0;
s=std::max(s,c);
}
std::cout<<s;
}
| ALGO | 0.999849 | 3.711496 |
6ff90183-9496-4e26-bf7f-7e7b9c55ab85 | Navknight/dsa | CodeForces/A_Word.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int u = 0;
int l = 0;
string sl = "";
string su = "";
for (auto i : s)
{
if (i - 'a' < 0)
{
u++;
su += i;
sl += i - 'A' + 'a';
}
else
... | ALGO | 0.999934 | 4.339591 |
2a4365b0-02a6-4cc2-a580-30c9d369efea | bitrig/bitrig | contrib/libc++/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp | // <forward_list>
// template <class Compare> void merge(forward_list&& x, Compare comp);
#include <forward_list>
#include <iterator>
#include <functional>
#include <cassert>
#include "min_allocator.h"
int main()
{
{
typedef int T;
typedef std::forward_list<T> C;
const T t1[] = {13, 12, ... | TEST | 0.981544 | 5.640454 |
6ad1be5d-d6c8-48fb-8b57-401bac989919 | Valerion052/codeforces | training/Тренировки_Нижний_Новгород/Сортировки/A01/main_v2.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int arr[N]{};
bool decreasing = true;
bool increasing = true;
for (int i=0; i<N; ++i) {
cin >> arr[i];
}
for (int i=0; i<N-1; i++) {
if (arr[i] < arr[i+1]) {
increasing = fal... | ALGO | 0.999997 | 4.500229 |
76f87ba8-becf-41ab-aefe-934c34cc88f4 | rajgoyal1729/DSA-Solutions | 2035-partition-array-into-two-arrays-to-minimize-sum-difference/2035-partition-array-into-two-arrays-to-minimize-sum-difference.cpp | class Solution {
public:
int minimumDifference(vector<int>& nums) {
int n=nums.size();
int sum=0;
for(auto &i:nums) sum+=i;
int N=n/2;
vector<vector<int>>left(N+1),right(N+1);
for(int mask=0;mask<(1<<N);mask++)
{
int idx=0,l_sum=0,r_sum=0;
... | ALGO | 0.999954 | 5.413046 |
1d06e111-37ce-434f-a918-91960fce3354 | Najwaeldiaraot/Najwaeldiaraot | jobsheet 6 - Looping/Tugas/Tugas No 2.cpp | //Created by 23343079_Najwa Eldiara Owilia Tiksa
#include <stdio.h>
int main (){
int i = 0; int j = 0;
for(i = 0; i < 5; i++){
for(j = 0; j <= i; j++){
printf("*");
}
printf("\n");
}
return 0;
}
| ALGO | 0.99982 | 3.605341 |
52c23cef-2314-49a2-9262-82fe52c26d09 | messicode/Practice | RotateArray.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution{
public:
int *rev(int *arr,int i,int j){
while(i<j)
{
swap(arr[i++],arr[j--]);
}
return arr;
}
//Function to rotate an array by d elements in counter-clockwise direction.
void rotateArr(int arr[]... | ALGO | 0.999839 | 5.237445 |
255cec0d-bef1-4a7b-93ba-c11ff978b25d | delanoflipse/IN4152-CGA-final-project | src/util/intersection.cpp | #pragma once
#include <glm/vec3.hpp>
namespace math
{
bool raySphereIntersect(glm::vec3 rayPosition, glm::vec3 rayDirection, glm::vec3 sphereCenter, float sphereRadius)
{
glm::vec3 rayDir = glm::normalize(rayDirection);
glm::vec3 fromRayToSphere = sphereCenter - rayPosition;
float t = glm::dot(fromRayT... | ALGO | 0.981761 | 5.310995 |
efdefb65-87ff-430d-9dfb-9e15f43470a5 | ray396/expenses | 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.998859 | 6.785645 |
fe087869-0439-409b-bd42-4713c6e7bb51 | saarang123/Competitive-Programming | codeforces/597C.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// ----------------------------------------Defines and Template-------------------------------------//
#define int long long
#define ll long long
#define double long do... | ALGO | 0.999869 | 3.338364 |
8638953c-a3e4-4e9f-89cb-00d4f63d9b98 | Niharikamnit/Leetcode | 424-longest-repeating-character-replacement/424-longest-repeating-character-replacement.cpp | class Solution {
public:
int characterReplacement(string s, int k) {
//sliding window. shrink the window everytime window_size-maxfreqcharfreq>k
int n=s.length();
int ans=-1;
unordered_map<char,int> mp;
int maxfreq=0;
int j=0;
int i=0;
while(j... | ALGO | 0.999989 | 6.238121 |
e0b8109d-3eb3-4bf1-b3ca-2ba594173c06 | Sudhanshu2306/Leetcode | 2139-minimum-moves-to-reach-target-score/2139-minimum-moves-to-reach-target-score.cpp | class Solution {
public:
int minMoves(int target, int maxDoubles) {
int count=0;
while(target>1 && maxDoubles>0){
if(target&1) count+=2;
else count+=1;
maxDoubles--;
target/=2;
}
return count+target-1;
}
}; | ALGO | 0.999904 | 6.158061 |
350232bc-0217-4d20-be52-ac5af4e7e39a | ishandutta2007/codeforces | xh092113/normal/1447/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define rg register
#define In inline
#define ll long long
const int N = 5000;
namespace IO{
In ll read(){
ll s = 0,ww = 1;
char ch = getchar();
while(ch < '0' || ch > '9'){if(ch == '-')ww = -1;ch = getchar();}
while('0' <= ch && ch <= '9'){s = 10 * s + ch - '0'... | ALGO | 0.999985 | 3.635443 |
1ece4e1e-c5a9-4a15-ba55-89f83248f0f2 | SaurabhAlex/miniBloc | 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 |
acf89116-39da-4224-8e62-bff6833442d7 | LSeaPDynasty/- | Test/3_1.cpp | #include <iostream>
#include <vector>
#include <stdexcept>
template <typename T>
class SeqStack {
private:
std::vector<T> stack;
public:
void push(const T& value) {
stack.push_back(value);
}
void pop() {
if (stack.empty()) {
throw std::out_o... | ALGO | 0.91318 | 6.53854 |
e41f4dfc-1823-475f-b2ac-5d765f1181a5 | RamadanAhmed/ann_char | sample/ann_sample.cpp | #include <cstdlib> // C standard library
#include <cstdio> // C I/O (for sscanf)
#include <cstring> // string manipulation
#include <fstream> // file I/O
#include <ANN/ANN.h> // ANN declarations
using namespace std; // make std:: accessible
//-----------------------------------------------... | ALGO | 0.988955 | 5.086342 |
af421952-af58-46d4-9a6b-f0dbe9f22dfa | AndyMc629/hypercarlo | src/mathsFuncs.cpp | /*
* mathematical functions not supplied by C++ libraries (or improvements of
* them).
*/
//returns correct modulus whether value is negative or not
//library supplied % does not work for negative numerator.
int mod(int x, int N) { // calculates x mod N.
return ((x %= N) < 0) ? x+N : x;
} | ALGO | 0.996347 | 5.008991 |
b176b98a-cd14-4913-b881-5ca8d0b41c7e | Sandra-Rosa/demo | palindromicpattern.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter a number ";
cin>>n;
for(int i=1;i<=n;i++){
int count=i;
int count1=2;
for(int j=1;j<=n-i;j++){
cout<<" ";
}
for(int k=1;k<=i;k++){
cout<<count<<" ";
count... | ALGO | 0.999794 | 3.323149 |
726d5a33-65fb-4be9-99ec-7cfbc1c3bd97 | piyush1009/Competitive_programming | Geeksforgeeks/Problems/anagram.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define F first
#d... | ALGO | 0.999991 | 4.567078 |
2a8dff65-60fa-4fde-89c6-32a1c4653d6f | aasthamuskan/cpp | c++/control statments/loopingoriterative/important questions/palindromeno.cpp | #include<iostream>
using namespace std;
int main(){
int i,rev=0,org;
cout<<"enter number: ";
cin>>i;
org=i;
while(i>0){
rev=(rev*10)+i%10;
i/=10;
}
if(rev==org){
cout<<"its a palindrome no";
}else{
cout<<"its not a pallindrome no";
}
return 0;
}... | ALGO | 0.999912 | 3.70135 |
97240826-b87d-40b8-b554-8b32e8c55b9b | skmainwal/Companies-Test-Problem-codeforce- | citrix/set-2/cereal-segments/solution.cpp | #include<bits/stdc++.h>
using namespace std;
void sliding_window_min(vector<int> &a, int k)
{
int n = a.size();
deque<int> dq;
// Fill the first window manually
for(int i = 0; i < k; i++)
{
while(not dq.empty() and a[dq.back()] >= a[i])
dq.pop_back();
dq.push_back(i);
}
int res = INT_MIN;
// Answer... | ALGO | 0.999954 | 4.337391 |
18dc7575-904a-49ef-98ed-471fa246c6c5 | Md-Salih/My-First-Language | Find the Height of a Binary Tree.cpp | #include <iostream>
struct Node {
int data;
Node* left;
Node* right;
Node(int value) {
data = value;
left = nullptr;
right = nullptr;
}
};
int findHeight(Node* node) {
if (node == nullptr) {
return 0;
}
int leftHeight = findHeight(node->left);
int r... | ALGO | 0.999947 | 7.270357 |
6ff7cfb7-8ea6-4450-b20f-c140b14cfed7 | sarvex/leetcode-clojure | lcof2/剑指 Offer II 049. 从根节点到叶节点的路径数字之和/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.999913 | 6.708503 |
b8573574-bd9b-4410-bbbe-78b1df7c7b63 | Next-Gen-UI/Hacktober | Leetcode/0831. Masking Personal Information/0831.cpp | class Solution {
public:
string maskPII(string S) {
const int atIndex = S.find('@');
if (atIndex != string::npos) {
transform(begin(S), end(S), begin(S), ::tolower);
return S.substr(0, 1) + "*****" + S.substr(atIndex - 1);
}
string s;
for (const char c : S)
if (isdigit(c))
... | ALGO | 0.937164 | 6.185835 |
e7cd4810-630a-4cc3-9925-61005b798f61 | WEGFan/Algorithm-Contest-Code | contests/2014-Xian-Invitational/HDU 4848 B.cpp | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int n, minans;
int d[37][37], dead[37], vis[37];
void dfs(int u, int cost, int sum, int cnt)
{
if (cnt == n)
{
minans = min(minans, sum);
return;
}
if (sum >= minans)
return;
... | ALGO | 0.999985 | 3.641531 |
5f904378-659b-419a-8c71-2c685fa520c8 | RezerdPrime/FIRST_CURSE | CATS/semester1/B5.cpp | #include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inf("input.txt");
ofstream outf("output.txt");
float number; inf >> number;
//cout << number << endl;
int* l = (int*) &number;
//cout << *l << endl;
int pow = ((*l >> 23) & 255) - 127;
if (number == 0)... | ALGO | 0.998476 | 3.941755 |
cec44f03-860d-4a5d-8972-29cd02e370ae | CodingGoku/DSA | BS/BS26_findPeakElement2.cpp | #include <bits/stdc++.h>
using namespace std;
int maxIndex(vector<vector<int>> mat, int n, int m, int col)
{
int maxi = -1, index;
for(int i=0; i<n; i++)
{
if(mat[i][col]>maxi)
{
maxi = mat[i][col];
index = i;
}
}
return index;
}
// T : log(m) x n
//... | ALGO | 0.999958 | 4.785207 |
db65776c-0a93-497e-b28c-fef65816ce7a | sachin27verma/DailyCodes | Difficulty: Easy/Remove Half Nodes/remove-half-nodes.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str) {
// Corner Case
if (str.length() == 0 || str[0... | ALGO | 0.999839 | 7.042317 |
3ffbb039-a09a-4c0f-ab6d-1b8ef8864118 | vikram-15122005/PRODIGY_AD_3 | 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 |
5f440c4e-8f54-416e-bc6b-e6363395baee | aashwin-tripathi/Leetcode-problems | 520-detect-capital/520-detect-capital.cpp | class Solution {
public:
bool detectCapitalUse(string word) {
bool first= false;
int n= word.length();
if(isupper(word[0])) first= true;
if(n==1) return true;
if(first){
bool second= false;
if(isupper(word[1])) second= true;
if(sec... | ALGO | 0.99995 | 5.85499 |
0bb39e8d-1b3d-45fb-9df9-206413df8d3e | abhiiguptaa/DsaKaro | 2678-number-of-senior-citizens/2678-number-of-senior-citizens.cpp | class Solution {
public:
/*
You are given a 0-indexed array of strings details. Each element of details provides information about a given passenger compressed into a string of length 15. The system is such that:
The first ten characters consist of the phone number of passengers.
The next character denotes th... | ALGO | 0.997911 | 6.140766 |
2085f69a-94d0-4b4d-8325-c9062d9efd1a | vixadd/rotor-browser | intl/icu/source/i18n/utf16collationiterator.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "charstr.h"
#include "cmemory.h"
#include "collation.h"
#include "collationdata.h"
#include "collationfcd.h"
#include "collationiterator.h"
#include "normalizer2impl.h"
#include "uassert.h"
#include "utf16collationiterator.h"
U_NAMESPACE_BEGIN
UTF16Coll... | TOOL | 0.941748 | 6.697597 |
a7cba415-ed1d-4f2e-95ba-6f4ceb3cb4d6 | WaleedOMEGA/CS | CS Course/ex1-4/main.cpp | #include <iostream>
using namespace std;
int avg(int arr[5]){
int sum=0,avg=0;
for(int i=0 ; i<5;i++){
sum+=arr[i];
}
avg=sum/5;
return avg;
}
int main()
{
int arr1[5]={1,2,3,4,5};
cout << avg(arr1) << endl;
return 0;
}
| ALGO | 0.996591 | 3.652571 |
9f4bf780-1a85-4e94-a109-c7b5a778ffba | danishahmadcode/C-Programs | ptd.cpp | #include <iostream>
using namespace std;
class A{
public:
int i;
void fun(){
cout<<"value of i : "<<i;
}
};
class B :public A{
public:
int j;
void fun2(){
cout<<"value of i : "<<i;
cout<<"value of j "<<j;
}
};
A* ptr;
A obj;
B obj2;
ptr = &obj2;
ptr->i = 34;
ptr->fun();
| TOOL | 0.958309 | 4.4945 |
17408a9b-3ae9-4558-b03d-b4f8b3ed3606 | TallerDeLenguajes1/tpn1-HectorEduardoFaciano | tp1_1.cpp | #include <conio.h>
#include <stdio.h>
#include <string.h>
int main(){
int x = 1, *punt;
punt = &x;
printf("Contenido del puntero: %d\n", *punt);
printf("Direccion de memoria del puntero: %d\n", punt);
printf("Direccion de la variable: %d\n", &x);
printf("Direccion de memoria del puntero: %... | TOOL | 0.928241 | 3.263912 |
cfff6342-cdba-4a4b-9eef-780bee976186 | MattiaCorradini/esercizi_3_superiore | programmi C++ info/quandratoinflolab/main.cpp | #include <iostream>
using namespace std;
/*
PRIMO PROGRAMMA: DISEGNA DUE LINEE PERPENDICOLARI
int main() {
int dimensione;
char carattere;
cin >> carattere;
cin >> dimensione;
for(int i=0; i<dimensione-1; i++)
{
cout<<carattere<<endl;
}
for(int j=0; j<dimensione; j++)
cout<... | TOOL | 0.871795 | 3.007 |
955c3edd-33d1-4926-99d5-7416c19d0020 | BangKartavya/LeetCode | N-ary Tree Postorder Traversal/main.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
void helper(Node* root,vect... | ALGO | 0.999794 | 6.007391 |
b7f7f258-4f4b-4268-a76f-090722ab3a80 | Modding-Zaibatsu/ue5-polaris | Engine/Source/ThirdParty/Intel/Embree/Embree270/src/kernels/xeonphi/bvh4hair/bvh4hair_builder.cpp | #include "bvh4hair/bvh4hair_builder.h"
#include "../geometry/bezier1i.h"
#include "../bvh4hair/bvh4hair_statistics.h"
#include "../../algorithms/parallel_partition.h"
namespace embree
{
#define DBG(x)
#define L1_PREFETCH_ITEMS 4
#define L2_PREFETCH_ITEMS 16
#define SINGLE_THREADED_BUILD_THRESHOLD 512
#define ... | ALGO | 0.852969 | 5.761095 |
97897755-7bf9-45e0-87ca-10e64f4410cc | TDHworkspace/SpeechRecognition | Project2-matching&training/singleDTW.cpp | #include "singleDTW.h"
vector<vector<double>> input(39);
vector<vector<double>> sample(39);
vector<vector<double>> dist;
int SPEECH = 1;
int SAMP = 2;
void readDCT(const char* filename, int flag){
ifstream in_DCT(filename);
string temp;
double DCT_value;
int count = 0;
if (!in_DCT.is_open()) {
cout << "Open ... | ALGO | 0.997386 | 5.016022 |
c86b430c-625c-4624-886f-f265556a843a | xuxmin/DrawLab | src/tracer/bsdf/microfacet.cpp | namespace drawlab {
class Microfacet : public BSDF {
public:
Microfacet(const PropertyList& propList) {
/* RMS surface roughness */
m_alpha = propList.getFloat("alpha", 0.1f);
/* Interior IOR (default: BK7 borosilicate optical glass) */
m_intIOR = propList.getFloat("intIOR", 1.5046... | ALGO | 0.918925 | 7.762975 |
7cc777e6-8bb9-4f7b-b252-53dd7ac63f13 | BUGyyc/AlgorithmCpp | source/2595.奇偶位数.cpp | /*
* @lc app=leetcode.cn id=2595 lang=cpp
*
* [2595] 奇偶位数
*/
// @lc code=start
class Solution
{
public:
vector<int> evenOddBit(int n)
{
int even = 0, odd = 0;
for (int i = 0; i < 32; i++)
{
int bit = 0;
// 取下第 I 位,判断是否是1
if ((1 << i) & n)
... | ALGO | 0.998318 | 6.047613 |
bc20405a-8455-49b4-922c-ae1e9e5b0edb | withrvr/TLE-CP31 | spoj/Aggressive_cows.cpp | // https://www.spoj.com/problems/AGGRCOW/
#include <bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void yes() { cout << "YES" << endl; }
void no() { cout << "NO" << endl; }
bool place_cow(vector<ll> &arr, ll cows, ll check_diff) { /... | ALGO | 0.999996 | 4.174329 |
23f9caab-59da-4895-8690-0d7b5d97f604 | redone-technologies/semantic_slam | semantic_slam_db_interface/src/db_interface_old_2year.cpp | #include <ros/ros.h>
#include <stdlib.h>
#include <fstream>
#include <sstream>
#include <string>
#include <ctime>
#include <stdlib.h>
#include <algorithm>
#include <streambuf>
#include <signal.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#inclu... | TOOL | 0.866691 | 3.792597 |
dbf2e461-0fd5-4a37-b7d3-0babcd192781 | prog470dev/procon | library/Mathematics/SectionSieve.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
/*
区間篩
引数 :long long l, long long r
返り値:vector<long long>(素数のみで構成)
概要 :与えられた区間(L~R)に対する素数を求める
まず、sqrt(R)までの素数を求め、その素数のみを用いてL~R区間のみの篩を行う
制約 :R<=10^12, R-L<=10^6
計算量:O((R-L)log(R-L))
*/
/*==========================================... | ALGO | 0.999927 | 3.642058 |
e4e1d790-49b0-4fff-b972-b2f83c28b093 | ishandutta2007/codeforces | faustaadp/normal/1738/C.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll NN = 2e5 + 5;
const ll mo = 1e9 + 7;
ll cnt[2];
ll d[110][110][2][2][2];
ll depe(ll E, ll O, ll pA, ll pB, ll gil)
{
if(E == 0 && O == 0)... | ALGO | 0.999997 | 4.344757 |
ffdae881-1f3e-4ca9-a543-c4b0a2e1dbe6 | PKUanonym/REKCARC-TSC-UHT | 大三下/数值分析/hw/上机实验/计21战裕隆(cpp代码)/编程作业8-计21战裕隆-2012011388/1.cpp | #include<iostream>
#include<cmath>
#include<memory.h>
using namespace std;
double a[6][6];
double v[10000][6]={0.0},u[10000][6]={0.0};
double u_max[10000]={0.0};
int cishu=1;
int n;
int biaoji;
void mifa()
{
for(int i=1;i<=n;i++)
{
v[0][i]=1.0;
u[0][i]=1.0;
}//ֵ
biaoji=0;
while(biaoji==0)
{
for(int i=1;... | ALGO | 0.999954 | 3.21732 |
020056d9-ebc9-41d9-b9ec-3ab784093970 | attadeep28/DSA-PRACTICE | DP/DP on string/LongestPalindromincSubseq.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s1 = "cbbd", s2;
s2 = s1;
reverse(s2.begin(), s2.end());
int n = s1.size(), m = s2.size();
vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
... | ALGO | 0.999982 | 4.458801 |
36bd0724-8362-46bf-b32a-e1b3378c8863 | HUcares86/Principles-of-Financial-Computing | code/AsianOption.cpp | //
// Created by Andy Chen on 6/11/2022.
//
#include "../includes/AsianOption.h"
AsianOption::AsianOption(Simulator *simulator, char whichOption, double k) : simulator(simulator),
whichOption(whichOption), K(k), r(simulator->getR()), T(simulator->getT()) {
calc();
deletePrice();
}
AsianOption::~AsianOption()... | ALGO | 0.982244 | 5.896626 |
b5eaf0ee-1830-47e1-874e-4ab38d8ca6ef | XYoung1201/SimPlugins | Derivative-微分求解/derivative.cpp | #include <iostream>
#include <math.h>
using namespace std;
double function1(double* parameters) {
return cos(parameters[0]) + sin(parameters[1]);
}
double function2(double x) {
return x * x * x;
}
double derivative(double(*func)(double*),double* parameters,int n,double step=0.01) {
parameters[n] += 2 * step;
do... | ALGO | 0.999625 | 4.429159 |
c3d30ae7-0560-462f-967f-35bd0400782b | kkpan11/apple-llvm-project | clang-tools-extra/clang-tidy/ClangTidy.cpp | #include "ClangTidy.h"
#include "ClangTidyCheck.h"
#include "ClangTidyDiagnosticConsumer.h"
#include "ClangTidyModuleRegistry.h"
#include "ClangTidyProfiling.h"
#include "ExpandModularHeadersPPCallbacks.h"
#include "clang-tidy-config.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#i... | TOOL | 0.855497 | 4.197783 |
c171ee64-9d8d-47a2-bfe5-59e27800481d | Digit24-dev/algorithm | Quiz/BJ/삼성SW/1260 dfs와 bfs.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> graph[100001];
int visited[100001] = { 0, };
int result[100001];
int cnt = 0;
void bfs(int r) {
queue<int> q;
q.push(r);
visited[r] = 1;
cnt++;
result[r] = cnt;
cout << r << " ";
while (!q.empty())
{
int inq = q.front();... | ALGO | 0.999982 | 3.750882 |
3a0fa9f1-4d98-4fd0-a91e-618749287c5f | jamesliu516/amrdg2d | approx_sol.cpp |
#include"vec2d.h"
//x,y belong to [-1,1]X[-1,1] 需要将 [x_{i-1/2} x_{i+1/2}] => [-1,1]
double approx_sol(double x, double y, double *doftmp, int n )
{
double uh;
if(n==6) {
uh=doftmp[0]+doftmp[1]*x+doftmp[2]*y+doftmp[3]*x*y
+doftmp[4]*(x*x-1.0/3.0) + doftmp[5]*(y*y-1.0/3.0);
}
else if(n... | ALGO | 0.999903 | 4.542969 |
d2b238ae-2aa7-4280-bdda-a9e2e492d153 | liuhycn/algorithm-exercise | PAT/PAT/PAT-A/1034.cpp |
#include <iostream>
#include <unordered_map>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<string, int> PII;
unordered_map<string, int> stringint;
unordered_map<int, string> intstring;
int cnt;
const int N = 2001;
int g[N][N];
int w[N];
vector<PII> res;
int visit[N];
voi... | ALGO | 0.999976 | 4.050401 |
cd4aec56-156c-4e6a-b207-f130986e251b | Ngocmai04/Algorithm-c- | euclid mo rong.cpp | #include <stdio.h>
/* Extended Euclidean algorithm for computing multiplicative inverses in modular structures */
long ModuloInverse(long a, long n) // a^-1 mod n
{
long r, q, y, y0 = 0, y1 = 1, tmp=n;
while(a > 0)
{
r = n % a;
q = n / a;
if(r == 0) break;
y = y0 - y1 * q;
... | ALGO | 0.999964 | 4.637311 |
5eac01fe-d360-4382-a64f-ed21350ed94b | avinashmallik62/SDE_PROBLEMS | GeeksForGeeks_TopicWise/Stacks/Minimum Element from Stack.cpp | #include<bits/stdc++.h>
using namespace std;
class _stack{
stack<int> s;
int minEle;
public :
int getMin();
int pop();
void push(int);
};
int main()
{
int t;
cin>>t;
while(t--)
{
int q;
cin>>q;
_stack *a = new _stack();
while(q--){
int qt;
cin>>qt;
... | ALGO | 0.999785 | 4.962914 |
a31b850e-a4a0-467a-85bb-50e810fd3f7a | ravimenariya/LEETCODE_GFG_POTD | GFG_POTD/Aug 2025/17 Sort by Absolute Difference.cpp | class Solution {
public:
void rearrange(vector<int> &arr, int x) {
// code here
map<int,vector<int>>mp;
int n = arr.size();
for(int i=0; i<n; i++){
mp[abs(arr[i]-x)].push_back(arr[i]);
}
int i = 0;
//dont confuse this as O(N*N) a... | ALGO | 0.999929 | 5.254 |
0d2b9277-367d-4432-b386-51e725f7aa73 | gnuborg/Githammer | BOSS/source/Tools.cpp | #include "Tools.h"
#include "BuildOrderSearchGoal.h"
#include "NaiveBuildOrderSearch.h"
using namespace BOSS;
#include "JSONTools.h"
BuildOrder Tools::GetOptimizedNaiveBuildOrderOld(const GameState & state, const BuildOrderSearchGoal & goal)
{
BuildOrder bestBuildOrder = GetNaiveBuildOrderAddWorkersOld(state, go... | ALGO | 0.99965 | 6.060171 |
760a03db-2a9b-40c3-b9a5-e4dd47db8dbb | ishandutta2007/codeforces | archuser84/normal/788/B.cpp | #define _USE_MATH_DEFINES
#define FAST ios::sync_with_stdio(false),cin.tie(0);
#include <bits/stdc++.h>
#define Loop(x, l, r) for(int x = (l); x < (r); ++x)
#define LoopR(x, l, r) for(int x = (r)-1; x >= (l); --x)
#define all(x) x.begin(), x.end()
#define Kill(x) return cout << (x) << '\n', 0
#define YN(flag) ((flag)? ... | ALGO | 0.99992 | 4.215465 |
17231b8d-e310-487f-a478-e60328c6144d | frankantony/beecrowd-solution | 2457.cpp | #include <cstdio>
#include <cstring>
using namespace std;
int main() {
char entrada[1001], c;
scanf(" %c",&c);
scanf(" %[^\n]", entrada);
int tam = strlen(entrada);
int palavras = 1, caractere = 0;
bool tem = false;
for (int i = 0;i < tam;i++) {
if (entrada[i] == ' ') {
if (tem)
caractere++;
palav... | ALGO | 0.999657 | 3.300097 |
1902fa46-9a5b-4b40-a8ac-4adf136fb637 | skybarer/codeforces | A_Word_Capitalization.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string inp;
string out = "";
cin >> inp;
int n = inp.length();
if (inp.at(0) >= 'a' && inp.at(0) <= 'z')
{
for (int i = 0; i < n; i++)
{
if (i == 0)
{
out += touppe... | ALGO | 0.984928 | 4.613475 |
a2db637f-17fc-4db9-9772-ee5c0d7c4154 | badumbatish/Leetcode | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
std::vector<int> result;
int rows = matrix.size();
int columns = matrix[0].size();
int up = 0, left = 0, right = columns - 1, down = rows - 1;
while (result.size() < rows * columns) {
... | ALGO | 0.999995 | 6.54377 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.