uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
cedf254b-7bb2-4b9e-927f-bf2edcfb8b05 | lun5/HE-tumor-object-segmentation | otherMethods/ncut_multiscale_1_6/a_times_b_cmplx.cpp | /*================================================================
a_times_b_cmplx.cpp = used by a couple of mex functions
provide Matrix vector multiplications,
and solve triangular systems
(sparse matrix and full vector)
CSC_CmplxVecMult_CAB_double, CSR_CmplxVecMult_CAB_double,
CSCsymm_CmplxVecMult_CAB_double added... | ALGO | 0.997275 | 3.437396 |
919efeda-a665-484b-ad46-dc232fcac093 | sarvex/leetcode-scopes | solution/2300-2399/2318.Number of Distinct Roll Sequences/Solution.cpp | class Solution {
public:
int distinctSequences(int n) {
if (n == 1) return 6;
int mod = 1e9 + 7;
vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(6, vector<int>(6)));
for (int i = 0; i < 6; ++i)
for (int j = 0; j < 6; ++j)
if (gcd(i + 1, j + 1) ==... | ALGO | 0.99999 | 6.042689 |
680b37bf-3d42-4b8a-8ac9-26c84d9200fc | sravi4701/competitive-programming | hackerrank/code_sprint#4_1.cpp | //__author__= "Ravi Shankar"
#include<bits/stdc++.h>
using namespace std;
/*******usful typedef's *********/
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> ii;
typedef list<int>li;
typedef list<li>lii;
typedef set<int>si;
typedef set<si>sii;
typedef map<int,int> mi;
/*****... | ALGO | 0.999837 | 3.666727 |
9b99f939-0ff9-4983-bc74-8c54db25c382 | sarvex/leetcode-cyber | solution/1900-1999/1976.Number of Ways to Arrive at Destination/Solution.cpp | typedef long long ll;
class Solution {
public:
const ll INF = LLONG_MAX / 2;
const int MOD = 1e9 + 7;
int countPaths(int n, vector<vector<int>>& roads) {
vector<vector<ll>> g(n, vector<ll>(n, INF));
vector<ll> dist(n, INF);
vector<ll> w(n);
vector<bool> vis(n);
for ... | ALGO | 0.999952 | 5.393147 |
a1bf035c-f308-4a51-bf4e-5c4f00faadd5 | stockingstocker/WIP-Bi-Directional-Linked-List-Dictionary | main.cpp | /** Start by copying in your code from part IV.
* You need to finish part IV before starting
* part V.
*
*
**/
#include <iostream>
#include <fstream>
#include <cctype>
#define DEFAULT_DICT "dictionary1.txt"
#define DEFAULT_OUTPUT_FILE "dict-updated.txt"
#include "LinkedList.h"
#include "testll.h"
using nam... | TOOL | 0.908062 | 5.763816 |
a43cae37-be7a-484d-8210-902f31dcc9f2 | NREL/OpenStudio | src/utilities/geometry/RoofGeometry.cpp | #include "RoofGeometry.hpp"
#include "RoofGeometry_Details.hpp"
#include "Geometry.hpp"
#include "Vector3d.hpp"
#include <boost/optional.hpp>
#include <boost/math/constants/constants.hpp>
namespace openstudio {
/// Generate shed roof polygons
std::vector<std::vector<Point3d>> generateShedRoof(std::vector<Point3d>& p... | TOOL | 0.867118 | 7.460271 |
471af564-efb0-4b6b-8288-f4b1785452ce | koNoJOJOga/Algorithmic_learning-main | ACWingBasement/基础算法_快排.cpp | #include <iostream>
using namespace std;
const int N = 1e6 + 10;
int n;
int q[N];
void quick_sort(int q[], int l, int r)
{
if (l >= r) return;
int x = q[l], i = l - 1, j = r + 1;
while (i < j)
{
do i++; while (q[i] < x);
do j--; while (q[j] > x);
if (i < j) swap(q[i], q[j]);... | ALGO | 0.99996 | 4.095093 |
85282f79-acef-43ec-b8ac-90c19a273bc3 | Anamika-29/LeetCode | 0472-concatenated-words/0472-concatenated-words.cpp | class Solution {
public:
vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {
unordered_set<string> words_set;
for (string word : words) words_set.insert(word);
vector<string> res;
for (string word : words) {
int n = word.size();
vector... | ALGO | 0.999591 | 6.180778 |
06152dcc-d34d-4461-8fc0-cf547d48b1d8 | luisjmarrero/CodeProblems | Spoj/prime_generator.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
typedef vector <int> vi;
typedef vector <long long> vll;
const ll tenSix = 1000000;
const ll tenNine = 1000000000;
ll primes[ten... | ALGO | 0.999807 | 3.675521 |
b26b9995-ec1b-4a85-bbc8-fcb60a186caa | RakshitSathyakumar/LeetCode-Solutions | 2799-count-complete-subarrays-in-an-array/2799-count-complete-subarrays-in-an-array.cpp | class Solution {
public:
int countCompleteSubarrays(vector<int>& nums) {
int cnt=0;
set<int> st;
for(auto itr:nums) st.insert(itr);
for(int i=0;i<nums.size();i++){
set<int> st1;
for(int j=i;j<nums.size();j++){
st1.insert(nums[j]);
... | ALGO | 0.999936 | 5.794471 |
7f464fa7-0d1a-4730-8992-95fd5c075af3 | raincross7/code-similarity | codes/train_code/problem451/problem451_437.cpp | #include <bits/stdc++.h>
using namespace std;
#define DBG(x) \
(void)(cout << "L" << __LINE__ \
<< ": " << #x << " = " \
<< (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v... | ALGO | 0.999895 | 3.717925 |
8217e82f-c7f1-4881-b3bf-e5e5d0cfacbd | xueyajiang/Zhou_ziyou | Lesson_20/ISBN_example.cpp | #include <cstdio>
using namespace std;
int main()
{
char ch[11];
int i;
int sum = 0;
printf("ISBN룺");
scanf("%c-%c%c%c-%c%c%c%c%c-%c", &ch[0], &ch[1], &ch[2], &ch[3], &ch[4], &ch[5], &ch[6], &ch[7], &ch[8], &ch[9]);
ch[10] = '\0';
printf("%s\n", ch);
for (i = 1; i < 10; i++)
{
sum = sum + i * (c... | ALGO | 0.996609 | 3.022079 |
742967ff-2192-49d0-8f91-dd7feb148f4d | GlodonOpenSrc/Qt5.9.5_Glodon | qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/decoder/core/src/mv_pred.cpp | #include "mv_pred.h"
#include "ls_defines.h"
#include "mb_cache.h"
namespace WelsDec {
void PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]) {
bool bTopAvail, bLeftTopAvail, bRightTopAvail, bLeftAvail;
int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc;
int32_t i... | ALGO | 0.999839 | 5.548096 |
5164d2e1-721e-4643-ab30-6637a33b3c63 | Aanshi-Singh/Data-Stucture-And-Algorithm | recursion/factorial.cpp | #include <iostream>
#include <string>
#include<algorithm>
using namespace std;
int factorial(int n){
if(n==1){
return 1;
}
int prevFact = factorial(n-1);
return n*prevFact;
}
int main(){
int n;
cin>>n;
cout<<factorial(n);
return 0;
} | ALGO | 0.999989 | 4.857564 |
9e3a909c-a0f1-4579-a5ef-7b16a9fd1ae3 | TakumaSato777/Atcoder | ABC/201/b.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cstdlib>
#include <cmath>
using ll=long long;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i,x,n) for (int i = (int)(x); i < (int)(n); i++)
int N;
int main() {
cin >> N;
... | ALGO | 0.999874 | 3.393762 |
ca0a879c-957a-4eb3-89fb-a1ad7908c4c9 | Solybum/PSO-Related-Stuff | Pso_File_Formats-master/xvm/pvrx2png-master/deps/squish/singlecolourfit.cpp | #include "singlecolourfit.h"
#include "colourset.h"
#include "colourblock.h"
namespace squish {
struct SourceBlock
{
u8 start;
u8 end;
u8 error;
};
struct SingleColourLookup
{
SourceBlock sources[2];
};
#include "singlecolourlookup.inl"
static int FloatToInt( float a, int limit )
{
// use ANSI round-to-zero b... | ALGO | 0.932773 | 6.13898 |
e02a6203-d8e9-4463-950c-cc0a73d5dd80 | omar-besbes/competitive-programming | solutions/CSES/Range Queries/1143 - Hotel Queries.cpp | #include <bits/stdc++.h>
using namespace std;
int n, q;
vector<int> a, t;
void build(int v = 1, int tl = 0, int tr = n - 1) {
if (tl == tr)
t[v] = a[tl];
else {
int tm = (tl + tr) / 2;
build(2 * v, tl, tm);
build(2 * v + 1, tm + 1, tr);
t[v] = max(t[2 * v], t[2 * v + 1]);
}
}
... | ALGO | 0.99997 | 4.286231 |
cc684b3e-425e-4315-83ec-017b6d72b515 | lechenyu/Arbalest-Vec | bolt/lib/Passes/HFSort.cpp | #include "bolt/Passes/HFSort.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <unordered_set>
#define DEBUG_TYPE "hfsort"
namespace opts {
extern llvm::cl::opt<unsigned> Verbosity;
}
namespace llvm {
namespace bol... | ALGO | 0.99846 | 6.844934 |
15bf5ac1-530e-4fed-996e-7df2a5750f31 | zyx4843/leetcode | src/Restore_IP_Addresses.cpp | // Source : https://oj.leetcode.com/problems/restore-ip-addresses/
// Author : zheng yi xiong
// Date : 2014-12-30
/**********************************************************************************
*
* Given a string containing only digits, restore it by returning all possible valid IP address combinations.
* F... | ALGO | 0.999665 | 4.954638 |
3e2d9c11-2bb0-4740-acbf-c97f6cdef8ff | Anupam1707/CPP | Experiment 4/Additional Questions/3. printNLeapYears.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cout << "Enter the value of N: ";
cin >> N;
cout << "Leap years from 1 to " << N << " are: ";
for (int year = 1; year <= N; ++year) {
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
cout << year << " ";... | ALGO | 0.999531 | 3.649306 |
83d56254-5723-44b7-913b-4d2108c9d3c6 | franciscoSavala/cpCodeforces | 1473B String LCM.cpp | #include <iostream>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
#include <string>
#define ll unsigned long long
using namespace std;
string st_mult(string a, int x){
string ans = "";
for(int i=0; i<x; i++){
ans += a;
}
return ans;
}
void solve(){
string s, t;
cin >> s >> t;
vecto... | ALGO | 0.999849 | 4.362859 |
f104af45-82dd-46b3-b3b4-54679a9f52c2 | coder-dkr/cpp-miniprograms | binaryClass.cpp | #include <iostream>
#include <string>
using namespace std;
//program to take a binary string from user and return its ones compliment
class binary
{
private:
string s;
void chck_bin();
bool stopp = false;
public:
void binaryinp()
{
cout << "Enter a binary String: ";
cin >> s;
... | ALGO | 0.997255 | 5.445432 |
0a7d7e29-55df-44d5-b3a3-f36b3be2fa41 | ishandutta2007/codeforces | sys/normal/984/C.cpp | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
if(a<b) swap(a,b);
return b==0?a:gcd(a%b,b);}
bool is_fin(long long a,long long bas)
{
long long aa=gcd(a,bas);
/*while(a!=aa)
{
aa=a;
a/=gcd(a,bas);
}*/
while(aa!=1)
{
while(!(a%aa))
a/=aa;
aa=gcd(a,aa);
}
return a... | ALGO | 0.999774 | 4.272721 |
3b89af63-c91b-4825-8f33-f639eee481b7 | arthuredelstein/tor-browser | intl/icu/source/common/uvector.cpp | #include "uvector.h"
#include "cmemory.h"
#include "uarrsort.h"
#include "uelement.h"
U_NAMESPACE_BEGIN
#define DEFAULT_CAPACITY 8
/*
* Constants for hinting whether a key is an integer
* or a pointer. If a hint bit is zero, then the associated
* token is assumed to be an integer. This is needed for iSeries
*/
... | TOOL | 0.908195 | 7.008241 |
9459dd82-7479-443f-8513-0ac603d1b46b | its-ani/Practiceq | 2d_array.cpp | #include<iostream>
using namespace std;
// 2d array are stored as 1d in the memory
// address of value = arrayname + [(i*col) + j] * sizeof(typeofarray);
// always have to pass columns value in the function
int main(){
int arr[10] = {0};
cout<<arr<<endl;
cout<<&arr<<endl;
cout<<arr[0]<<endl;
c... | ALGO | 0.996239 | 3.249837 |
240bd213-d077-431e-84d9-3bff78c86090 | G0325g/ps | 프로그래머스/2/42578. 의상/의상.cpp | #include <string>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
int solution(vector<vector<string>> clothes) {
int answer = 1;
multimap<string, string> clo; //키 중복을 허용하는 맵
vector <string> key; //키를 저장할 벡터
for(int i=0; i<clothes.size();i++)
{
... | ALGO | 0.999123 | 5.278799 |
73aa8975-a73d-47f6-b556-34d75ae63ef0 | Abubakar-40/DSA | Linked List/InsertAtEnd.cpp | //GFG : https://www.geeksforgeeks.org/problems/linked-list-insertion-1587115620/0?utm_source=youtube&utm_medium=collab_striver_ytdescription&utm_campaign=linked-list-insertion
class Solution {
public:
Node *insertAtEnd(Node *head, int x) {
if(head ==nullptr)
{
head = new Node(x);
... | ALGO | 0.999641 | 5.481263 |
e7e05949-1d85-4964-9eaa-2bb0c0a9a87c | DingZhan/Data-Structure-and-Algorithm-Chinese-PTA- | 30. 目录树/a.cpp | #include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
//ڵṹ
struct TreeNode
{
//Ŀ¼ļǷĿ¼ļ
TreeNode(const string& name, bool bDir)
{
this->name = name;
this->bDir = bDir;
//ʼΪNULL
left = right = N... | ALGO | 0.999645 | 4.768373 |
c34a4b4e-3d2c-4ab5-984c-80ef5bb12c59 | GymMendoza/03_busqueda | Busqueda_Monomio.cpp | #include<iostream>
using namespace std;
struct monomio{
int coeficiente;
int exponente;
};
//////////////////////////////////////////////////////////////////////////////
void ordenarPoli(monomio termino[], int n);
int busqSecuenOrd(monomio termino[], int n, monomio buscartermino);
////////////////////////////////////... | ALGO | 0.999149 | 3.769305 |
4956e8ea-fdef-4133-87ae-59fbb75fdead | raincross7/code-similarity | codes/train_code/problem069/problem069_27.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rng(a) a.begin(),a.end()
using namespace std;
using ll = long long;
int main() {
char c;
cin >> c;
if(c=='A') cout << 'T';
if(c=='T') cout << 'A';
if(c=='C') cout << 'G';
if(c=='G') cout << 'C';
return 0;
} | ALGO | 0.999789 | 4.656895 |
1bb49d4f-1101-4750-8a94-581fb548afbf | eilis-jung/Chimera-old | ChimeraBoundaryConditions/src/Boundary Conditions/Farfield2DBC.cpp | #include "Boundary Conditions/FarFieldBC.h"
namespace Chimera {
namespace BoundaryConditions {
template<>
void FarFieldBC<Vector2>::applyBoundaryConditionNorth(GridData<Vector2> *gridData, solverType_t solverType) {
solverType; //Un-referenced trick - Outflow bds are not dependent on solverType
GridData2... | ALGO | 0.991058 | 6.023 |
7e192ff8-6443-4a38-be91-1c87b8787294 | Landvibe-DataStructure-2023Study/KimYoungSin | week9/22 p4.cpp | // , 1. ¦ 2. 켱
#include <iostream>
#include <vector>
using namespace std;
int prior(int a) {
if (a % 2 == 0) return 1;
else return 0;
}
class PQueue {
public:
vector<int> pr;
void push(int data) {
pr.push_back(data);
}
int pop() {
vector<int>::iterator iter;
vector<int>::iterator p = pr.begin();
for... | ALGO | 0.999978 | 4.448486 |
4daec685-851d-4ffd-a35c-461ec210c74a | Forsworns/homework | CS138数据结构C/11_1069/11_1069/源.cpp | #include<iostream>
#include<algorithm>
#pragma warning (disable:4996)
using namespace std;
int probableMoneyNums, maxMoney, varietyNum;
int moneyValue[1000] = { 0 }, coinNums[105] = { 0 }, dpProbableMoney[100005] = { 0 };
int main() {
freopen("test.txt", "r", stdin);
ios::sync_with_stdio(false);
std::cin.tie(0);
c... | ALGO | 0.999333 | 3.316802 |
379ee339-1c42-45ee-ac5d-a4ab8ef5986f | mahaqj/Multi-Threaded-Pacman | speed boost .cpp | #include <GL/glut.h>
#include <cmath>
#include <cstring>
#include <cstdio>
#include "newpac.h"
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
#include <iostream>
#include <chrono>
#include <random>
#include <algorithm>
using namespace std;
#define COLUMNS 19
#define ROWS 22
pthread_t ghostThreads[4],... | TOOL | 0.925253 | 3.617318 |
5e7abe3d-1915-4a2d-a5e2-058225331052 | QIDITECH/QIDISlicer | bundled_deps/libigl/igl/random_dir.cpp | IGL_INLINE Eigen::Vector3d igl::random_dir()
{
using namespace Eigen;
double z = (double)rand() / (double)RAND_MAX*2.0 - 1.0;
double t = (double)rand() / (double)RAND_MAX*2.0*PI;
// http://www.altdevblogaday.com/2012/05/03/generating-uniformly-distributed-points-on-sphere/
double r = sqrt(1.0-z*z);
double... | ALGO | 0.997861 | 5.792841 |
26d741ce-78c1-48b5-b019-db05105d79b3 | NishantTomer5601/LeetCode-Questions-Repo-nishanttomer5601- | 3531-minimum-amount-of-damage-dealt-to-bob/3531-minimum-amount-of-damage-dealt-to-bob.cpp | class Solution {
public:
// static bool cmp(pair<int,int> a,pair<int,int> b, int p){
// // int p=powr;
// return a.first*(a.second-p)> b.first*(b.second-p)>;
// }
long long minDamage(int p, vector<int>& d, vector<int>& h) {
int tv=p;
int n=d.size();
vector<pair<long long,long l... | ALGO | 0.999603 | 3.948501 |
6cc4ceda-aa1b-4d9e-8f19-083ffa553dfe | Starry0/ACM | 牛客网/NOIP历年真题练习-普及组/1006.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 10100;
bool ok(int y) {
if(y%4==0&&y%100!=0 || y%400==0) return true;
return false;
}
int main() {
int a, b, ans = 0;
cin >> a >> b;
for(int i = a/10000; i <= b/10000; i ++) {
int y = i%10*1000+i/10%10*100+i/100%10*10+i/1000;
y = y + i * 10000;
if... | ALGO | 0.999516 | 4.032873 |
a972f34b-243c-4e40-8f55-c2271fb03985 | keshavgupta1304/DSA-QUESTIONS | 494-target-sum/target-sum.cpp | class Solution {
public:
int findWays(vector<int>& num, int tar) {
int n = num.size();
vector<int> prev(tar + 1, 0);
if (num[0] == 0)
prev[0] = 2;
else
prev[0] = 1;
if (num[0] != 0 && num[0] <= tar)
prev[num[0]] = 1;
for (int i... | ALGO | 0.999984 | 5.991364 |
adcdeb41-2260-4a5a-b154-6880f994f512 | daid/SeriousProton2 | extlibs/bullet/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp | ///This file was written by Erwin Coumans
#include "btMultiBodyJointLimitConstraint.h"
#include "btMultiBody.h"
#include "btMultiBodyLinkCollider.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
btMultiBodyJointLimitConstraint::btMultiBodyJointLimitConstraint(btMultiBody* body, int link, btScalar l... | ALGO | 0.984353 | 6.584676 |
1c88c28f-c782-4053-b419-0c81ba67870a | Himanshutomar31/c-topython | externals/Eigen3/doc/examples/DenseBase_template_int_middleRows.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.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.969531 | 3.236517 |
f30777c3-f97a-4909-be78-91f7bcde0546 | eyangch/competitive-programming | USACOcontests/gold/2016.12/checklist.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
template <typename T1, typename T2>
ostream &operator <<(ostream &os, pair<T1, T2> p){os << p.first << " " << p.second; return os;}
template <typename T>
ostream &operator <<(ostream &os, vector<T> &v)... | ALGO | 0.999885 | 3.850336 |
aada1a3b-dd4e-41dc-9433-7e8f11386af6 | fishy15/competitive_programming | online/cf/819/mainak_and_array.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <numeric>
#define ll long long
#define ld long double
... | ALGO | 0.999957 | 5.156207 |
112ce60f-8e59-46fc-95bb-b10cff74922c | mingzehuang/acpc | src/robust_sparse_pca.cpp | #include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
// [[Rcpp::export]]
arma::mat robustPCA(arma::mat& M, double eps, int MaxIter, double gamma, double tau){
int n = M.n_rows, p = M.n_cols;
arma::colvec d, soft_d;
arma::mat Q, R, R_t, soft_S, S(n, p, arma::fill::zeros), eta(n, p,... | ALGO | 0.999897 | 6.532284 |
2067b7e3-0905-4fbc-b8f9-aee46b375366 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9019_9.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> v[6];
int m, a = 0;
cin >> m;
for (int i = 1; i <= m; i++) {
int x, y;
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
for (int i = 1; i <= 6; i++) {
if (v[i].size() == 2) a++;
}
if (a == 5)
cout << "FA... | ALGO | 0.99964 | 3.872353 |
569002a9-d9df-48e8-861f-49db48dd80d2 | CongJyu/Pitaya | HNU-CG/HW6-Q04/HW6-Q04/main.cpp | //
// main.cpp
// HW6-Q04 求指数
//
// Created by cyrain on 2021/11/15.
//
#include <iostream>
using namespace std;
int exponent(int, int);
int main() {
int num = 0;
int k = 0;
cin >> num >> k;
cout << exponent(num, k) << endl;
return 0;
}
int exponent(int x, int y) {
int cnt = 0;
int cp = ... | ALGO | 0.999915 | 4.886464 |
d5dc5c7f-bc69-4238-9867-a55f26ce2b62 | Ikesters/ArcPro | dep/src/g3dlite/uint128.cpp | /**
@file uint128.cpp
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@author Kyle Whitson
@created 2008-07-17
@edited 2008-07-17
*/
#include "G3D/uint128.h"
namespace G3D {
/** Adds two 64-bit integers, placing the result and the overflow into 64-bit integers.*/
static void addAndCarry(const ... | ALGO | 0.955487 | 7.427236 |
7bba12e6-1b7b-4157-bfbf-e3157cb77103 | Glasspham/DSA-28Tech | Generation-Backtracking/Generation/lesson_5.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int a[1001], n, k, final = 1;
void ktao(){
for(int i = 1; i <= k; ++i)
a[i] = i;
}
void sinh(){
int i = k;
while(i >= 1 and a[i] == n - k + i) --i;
if(i == 0) final = 0;
else{
a[i]++;
for(int j = i + 1; j <=... | ALGO | 0.999986 | 3.573897 |
7d774d61-7a19-4fa2-bd73-4755ff0a79a1 | ishandutta2007/codeforces | zhylj/normal/1257/A.cpp | #include <bits/stdc++.h>
template <typename T> inline void rd(T& x) {
int si = 1; char c = getchar(); x = 0;
while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x... | ALGO | 0.999522 | 4.484018 |
f78ca014-a589-4b45-89c0-8b391f4f2afd | swewalka/flutter-metatube | 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.99874 | 6.767714 |
b1ecb133-c39e-4ec9-908f-aaa2e69f6051 | ManglaPalak/DSA-cpp | Graphs/BFS DFS Problems/Word Ladder I.cpp | int ladderLength(string beginWord, string endWord, vector<string>& wordList) {
queue<pair<string,int>> q;
unordered_set<string> st(wordList.begin(),wordList.end());
q.push({beginWord,1});
st.erase(beginWord);
while(!q.empty()){
string word=q.front().first;
int steps=q.front().second;... | ALGO | 0.999985 | 5.346498 |
84fc0428-bf1d-4d2e-bae0-e11325e50fa6 | Yaser-wyx/ACM | LG/P2024.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
/**
* Created with IntelliJ Clion.
* @author wanyu
* @Date: 2018-05-15
* @Time: 22:12
* To change this template use File | Settings | File Templates.
*
*/
#define mset(t, x) memset(t,x,sizeof(t))
#define lson index<<1
#define rson (... | ALGO | 0.999939 | 3.976421 |
c7947562-5c61-4b28-bc1e-ee1d0cdd1572 | theoc0702/MyLaboAccess | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998756 | 6.772262 |
addb96e6-a8f6-417f-813d-29aeb1384a62 | shufay/CS2 | suung-cs2-week2/warmup/loop.cpp | /**
* Linked list with function to check if there is a loop in the list.
*
* Member function List::loop() is the function checking for a loop.
* List::make_loop() makes a loop in the list.
*
* To run:
* Type 'g++ --std=c++11 -o loop loop.cpp' in terminal and then type
* './loop'.
*
* main() creates a list a... | ALGO | 0.997564 | 5.572074 |
899ef295-8338-42ca-8f3d-1833ad373bf8 | muschellij2/FSL6.0.0 | extras/include/boost/libs/program_options/src/value_semantic.cpp | #define BOOST_PROGRAM_OPTIONS_SOURCE
#include <boost/program_options/config.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/cmdline.hpp>
#include <set>
#include <cctype>
namespace boost { namespace program_options {
... | TOOL | 0.984269 | 7.56654 |
491ddc46-0a5d-4534-a8e8-71e22f0caee1 | thomaskuestner/CS_MoCo_LAB | reconstruction/gadgetron/CS_LAB_Gadget/src/GADGET_TOOLS/hoNDDCT.cpp | /*
file name : hoNDDCT.cpp
author : Martin Schwartz (<EMAIL>)
version : 1.0
date : 03.01.2015
description : implementation of the class "hoNDDCT" (file hoNDDCT.h)
references : - hoNDFFT.h from the original Gadgetron implementation
- fftw.org
notes : main parts are from the original hoNDFFT.h fil... | ALGO | 0.988809 | 5.367085 |
6cf80945-7955-43b4-a986-019d9e8f5333 | nuraia/DSA-204 | 204 problem-2.cpp | #include <bits/stdc++.h>
#define INF INT_MAX
#define ll long long
#define pb push_back
#define mp make_pair
#define M 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
vector<int>adj[100];
int colour[100]={0};
int vis[100]={0};
bool dfs(int node,int c)
{
vis[node]... | ALGO | 0.999988 | 4.115249 |
9a818330-4d04-49bb-9686-5887e1b29845 | sagpant/QuantLib | ql/math/integrals/integral.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/math/integrals/integral.hpp>
#include <ql/errors.hpp>
namespace QuantLib {
Integrator::Integrator(Real absoluteAccuracy,
Size maxEvaluations)
: absoluteAccuracy_(absoluteAccuracy),
max... | ALGO | 0.909052 | 7.075708 |
14dca381-8ac1-41f8-8c74-67ef1bd71e12 | Priyankar96/face_recognize | opencv-master/opencv-master/modules/features2d/test/test_utils.cpp | namespace opencv_test { namespace {
TEST(Features2D_KeypointUtils, retainBest_issue_12594)
{
const size_t N = 9;
// Construct 4-way tie for 3rd highest - correct answer for "3 best" is 6
const float no_problem[] = { 5.0f, 4.0f, 1.0f, 2.0f, 0.0f, 3.0f, 3.0f, 3.0f, 3.0f };
// Same set, different order ... | TEST | 0.894754 | 7.783778 |
76efef0c-350f-47d1-8d2d-6d5a16f1eb2e | dhanusrikar/competitive-coding-program | 17_combination_of_numbers.cpp | #include <bits/stdc++.h>
using namespace std;
// Find the number of ways to reach 'x' using n1, n2, n3 and nN numbers
// Ex: find the number of ways to reach 15 using 3s, 5s, and 10s.
// We use Dynamic Programming, where the dp table consists of all the numbers upto 'x'
// we initialise the first element 0 to 1 and it... | ALGO | 0.999892 | 3.897129 |
570497d3-3489-44e2-96e1-27505b48cc93 | pandarudra/DS | 123-best-time-to-buy-and-sell-stock-iii/best-time-to-buy-and-sell-stock-iii.cpp | class Solution {
private:
int Transaction(vector<int>& p , int i , int canBuy , int limit , int N , vector<vector<vector<int>>>& dp) {
if(i >= N || limit == 0) return 0 ;
if(dp[i][canBuy][limit] != -1) return dp[i][canBuy][limit] ;
if(canBuy) {
int buy = -p[i] + Transact... | ALGO | 0.999965 | 5.813887 |
ac2eacf7-91d8-41fc-bc12-0580de2a2ac8 | raincross7/code-similarity | codes/train_code/problem022/problem022_471.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a,b;
cin >> a >> b;
cout << round((a+b)/2);
return 0;
}
| ALGO | 0.999626 | 3.140942 |
0e5dec09-f3a1-4e93-b1b3-650359b1018a | EgorKotenko/c-plus-course | Problems 9/Задача №1/hw9№1.cpp | // hw91.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "iostream"
#include "fstream"
#include "string.h"
#include "iomanip"
using namespace std;
struct List
{
char *value;
List *next;
};
void addToList(List *&input, char *x)
{
List *l = new List();
... | TOOL | 0.985609 | 3.98868 |
e4f91dfb-5d87-48cb-b554-90bcee7ed92f | ttamx/Competitive-Programming | codeforces/1857F.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void runcase(){
int n;
cin >> n;
map<ll,ll> mp;
for(int i=0;i<n;i++){
ll x;
cin >> x;
mp[x]++;
}
int q;
cin >> q;
while(q--){
ll x,y;
cin >> x >> y;
ll v=x*x-4*y;
... | ALGO | 0.999547 | 4.231507 |
f6e570e5-2f19-46d6-ac1c-f6036660a1e6 | brownwj/leetcode | subsets.cpp | class Solution {
private:
vector<vector<int> > result;
public:
vector<vector<int> > subsets(vector<int> &S) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
sort(S.begin(),S.end());
result.clear();
vector<int> temp_null;
temp_null.cl... | ALGO | 0.99987 | 4.910375 |
950dc588-7295-47ea-8276-70fe35d7e028 | amityadav23112000/leetcode-solution | 1524-number-of-sub-arrays-with-odd-sum/1524-number-of-sub-arrays-with-odd-sum.cpp | class Solution {
public:
int numOfSubarrays(vector<int>& arr) {
long long ans=0;
long long even=0;
long long odd=0;
long long sum=0;
for(int i=0;i<size(arr);i++){
sum+=arr[i];
if(sum%2==0){
ans+=odd;
even++;
... | ALGO | 0.999977 | 5.414632 |
5b069a53-13ef-488c-8797-d3c76e74126e | ishandutta2007/codeforces | n_z__/normal/896/B.cpp | #include<bits/stdc++.h>
using namespace std;
int a[1001];
int main()
{
int n,m,c,q=0;
cin>>n>>m>>c;
while(m--&&q<=n)
{
int x;
cin>>x;
if(x>c/2)for(q=n;a[q]>=x;--q);
else for(q=1;a[q]&&a[q]<=x;++q);
cout<<q<<endl;
fflush(stdout);
a[q]=x;
for... | ALGO | 0.999995 | 3.107928 |
c156bb08-2fec-4d23-aa26-ebdb2f7b6a3a | kmjp/procon | codeforce/661-700/679/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#def... | ALGO | 0.999934 | 3.713531 |
b5fcdff4-25b1-4c9d-a935-51105c511460 | xavier-tricoche/spurt | misc/lic.cpp | #include <iostream>
#include <image/nrrd_wrapper.hpp>
#include <teem/hest.h>
#include <math/fixed_vector.hpp>
#include <exception>
char* name_in, *name_out;
double length, eps;
size_t res[2];
double spc[2];
void initialize(int argc, char* argv[])
{
hestOpt* hopt = NULL;
hestParm* hparm;
airArray* mop;
... | ALGO | 0.988425 | 3.930432 |
4f33524f-b714-4e75-8903-5dc3755e95f3 | Yotta2/CTCI_my_solution | chapter_3/3.3/sol0.cpp | #include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <set>
#include <stack>
#include <vector>
using namespace std;
template<typename T>
class setOfStacks {
public:
setOfStacks() : capacity(3) {}
void push(T val) {
if (empty()) {
stack<T> s;
s.pu... | ALGO | 0.997649 | 3.853024 |
2b9ec069-2831-4e38-a90d-24804c330c9f | PranshuSrivastava/Data-Structures-And-Algorithms | 26-remove-duplicates-from-sorted-array/26-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if(!nums.size())
return 0;
for(auto i=nums.begin()+1;i!=nums.end();i++)
{
if(*i==*(i-1))
{
nums.erase(i);
i--;
}
}
return nums.si... | ALGO | 0.99991 | 6.145568 |
32953399-babc-4cf6-a517-fbec8179f15f | has2/Problem-Solving | boj-solved.ac/Gold2/13334.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int N,d,ans;
vector<pair<int,int>> t,a;
int main(){
scanf("%d",&N);
int j=0;
for(int i=0;i<N;i++){
int u,v;
scanf("%d%d",&u,&v);
if(u>v) swap(u,v);
t.push_back({u,v});
}
scanf("%d",&d);
... | ALGO | 0.999766 | 3.540494 |
a1df3619-6f8a-4812-9402-59fe60b34153 | div-bargali/DSA-problems | 0144-binary-tree-preorder-traversal/0144-binary-tree-preorder-traversal.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.999989 | 6.304764 |
abc0827a-024b-4816-ba60-9f8cfbc5e572 | shuvomdhar/Notes-Helper | SNU Coding/CPP Assignments/Question 9/code81.cpp | /*
Create an abstract base class Shape with a pure virtual function area(). Create two derived classes, Circle and Rectangle, from Shape, each implementing the area() function to calculate its specific area. Write a program to create objects of both Circle and Rectangle classes, call the area() function for each, and d... | TOOL | 0.990596 | 5.82067 |
19fa6257-5bb3-429a-be32-698cb0ac9751 | ishandutta2007/codeforces | teja349/normal/884/B.cpp | //teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16); cout << 100 << end... | ALGO | 0.999974 | 3.327619 |
a233d275-2d75-47f3-8258-ae2388e9618f | JayWestfield/task-based-workstealing | tools/unbalancesTreeGenerator.cpp | #include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <vector>
void generateUnbalancedTree(int depth, int maxChildren, int maxWeight = 1) {
std::srand(depth * maxChildren * maxWeight);
int currentDepth = 0;
int nodeCount = 0;
std::vector<int> nodesAtCurrentDepth =... | ALGO | 0.986218 | 5.471756 |
bf4fdfbc-4ee3-4968-b38e-2ec87cbce0e3 | limhan124/ALGOLAB | week7/radiation/radiation.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cassert>
#include <bitset>
#include<CGAL/basic.h>
#include<CGAL/QP_models.h>
#include<CGAL/QP_functions.h>
#include<CGAL/Gmpzf.h>
using namespace std;
typedef CGAL::Gmpzf ET;
typedef CGAL::Quadratic_program<ET> Program;
typedef CG... | ALGO | 0.999646 | 4.217999 |
f40dad20-7650-4e00-aa46-4ce3764ed448 | nitesh098suthar/code | keypadProblem.cpp | #include<iostream>
#include<vector>
using namespace std;
void sol(string input, string output, int index, vector<string> answer, string mapping[])
{
if(index>=input.length())
{
return;
}
int digit = input.at(index) - '0';
string value = mapping[digit];
for(int i = 0 ; i<value.len... | ALGO | 0.999856 | 5.358274 |
1099df89-033d-4807-b904-6c5ac843a2aa | phillc/tron-server-in-a-box | tronserver/genmap.cpp | #include <stdio.h>
#include <utility>
#include <map>
#include <set>
#include "board.h"
#include "graph.h"
using namespace std;
static void
mirror(int w, int h, int &x, int &y)
{
/* line symmetry
if (w % 2)
y = h - y - 1;
else
x = w - x - 1;
*/
/* point symmetry */
x = w - x - 1;
y = h - y - 1;
}
int main(i... | TOOL | 0.857235 | 4.345852 |
cb9e8a50-717d-4ef2-9480-b09d601a1185 | Priyanshu4650/Daily-Problems-LeetCode | 128-longest-consecutive-sequence/longest-consecutive-sequence.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if(nums.size() == 0) {
return 0;
}
unordered_set<int> s(nums.begin(), nums.end());
int result = 1;
for(auto num : nums) {
int temp = num;
if(s.find(temp - 1) == s.end()) ... | ALGO | 0.999941 | 5.870317 |
62facd69-3800-40fa-bc08-dc86ae90d5ac | shubhamlokhande2147/CDAC-Buddy | C++/c++/Lab date 15-09-2023/loop/WhileLoop_Table.cpp | #include<iostream>
using namespace std;
int main()
{
int i=1,num;
cout<<"\nEnter the num : ";
cin>>num;
while(i<=10)
{
cout<<num<<" * "<<i<<" = "<<num*i<<endl;
i++;
}
cout<<"\n";
return 0;
}
| ALGO | 0.999001 | 3.11426 |
49aa5602-cb51-4e6a-9686-ec2e0e5574b9 | qfs1998/c-_primer_solutions | 45_accumulate算法模板尝试/Project1/Project1/源2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
template<typename _InputIterator, typename _Tp,
typename _BinaryOperation>
_Tp Accumulate(_InputIterator __first, _InputIterator __last,
_Tp __init, _BinaryOperation __binary_op)
{
for (; __fir... | ALGO | 0.998611 | 4.87286 |
dcb23538-0cfb-460d-9ebd-fda7069e4a56 | davidazael/Cpp-fundamentals | Exam Prep #1 - Team Exercises/Chapter 2 Exercise # 19.cpp | // Chapter 2 Exercise # 19
//
//
//
#include <iostream>
using namespace std;
int main()
{
int quarters, dimes, nickles, pennies;
cout << "Enter the number of quarters, dimes, and nickles seperated by spaces: \n";
cin >> quarters >> dimes >> nickles;
cout << endl;
quarters = quarters * 25;
dimes = dimes * 10;... | ALGO | 0.965888 | 3.843655 |
c750863c-1bbe-42ff-b502-e45e8d9cc6a5 | cocoddingcodespace/codespace_baekjoon | fibo/11444/11444.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef vector<vector<long long >> Matrix;
Matrix multiply(Matrix a, Matrix b) {
int n = a.size();
int m = a[0].size();
Matrix ret;
for (int i = 0; i < n; i++) {
ret.push_back(vector<long long>());
for (int j = 0; j < m; j+... | ALGO | 0.99992 | 4.153394 |
328a66d1-ad91-4a3c-bda4-6d700deb1a88 | prakriti9/c-programs | evenodd.cpp | #include <bits/stdc++.h>
using namespace std;
void evenodd(int ar[], int n)
{
int l = 0, r = n-1;
while(l<r)
{
if(ar[l] % 2 != 0)
{
swap(ar[l], ar[r--]);
}
else{
l++;
}
}
}
int main()
{
int ar[] = {5,4,3,2,1,8};
int n = *(&ar + 1) ... | ALGO | 0.999905 | 4.256094 |
a35737cd-e2df-4f4b-b49e-00bd00630682 | MirYeasirAbrar/CodeQuest-to-Career | Codeforces/Problem Set/1535A - Fair Playoff.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int t; cin >> t;
while (t--)
{
int s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
int win1 = max(s1, s2);
int loss1 = min(s1, s2);
int win2 = max(... | ALGO | 0.999795 | 4.707377 |
86b526fa-cc5e-4f8f-8bdf-40ba77ef28df | Heisenberg71/Competitive-Programming | Online Judge Submissions/ACM ICPC Submissions/ACM ICPC'13 Onsite Solution/A.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll t, a, b, c;
while(cin >> t){
if(t == 0) break;
ll vol = 0, hei = 0;
while(t--){
cin >> a >> b >> c;
if(hei <= c){
if(hei == c) vol = max(vol, a*b*c);
... | ALGO | 0.999779 | 3.762905 |
3735365f-f048-420f-96cd-b36611c949d5 | wyrover/soui-1 | third-part/7z/CPP/7zip/Compress/Rar5Decoder.cpp | // #include <stdio.h>
#include "../Common/StreamUtils.h"
#include "Rar5Decoder.h"
namespace NCompress {
namespace NRar5 {
static const size_t kInputBufSize = 1 << 20;
void CBitDecoder::Prepare2() throw()
{
const unsigned kSize = 16;
if (_buf > _bufLim)
return;
size_t rem = _bufLim - _buf;
if (rem != ... | TOOL | 0.86329 | 4.673841 |
88104df9-6fca-4c77-8543-7032eb30484e | ishandutta2007/codeforces | roundgod/normal/1207/A.cpp | #include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int t,b,p,f,h,c;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d%d%d",&b,&p,&f,&h,&c);
int an... | ALGO | 0.999481 | 3.169164 |
f22d1999-9179-436b-9a43-711f2a847f1b | jlcarr/ProjectEuler | Problem080/bigInt_attempt.cpp | // Solution to Project Euler problem 80
#include <iostream>
#include <chrono>
#include <math.h>
#include <vector>
#include <map>
/*
For simplicity, gonna try the bisection method
Added subtraction via 10s complement
*/
class bigInt{
public:
std::vector<int> digits;
bool positive;
bigInt(int x=0){
positi... | ALGO | 0.999945 | 5.457765 |
554a053c-c592-4b69-a8b6-e98a6deea78b | daizxn/promble | P3131/P3131.cpp | #include <bits/stdc++.h>
using namespace std;
int l[7] = {0, -1, -1, -1, -1, -1, -1}, r[7];
int S = 0;
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
int a;
cin >> a;
S = (S + a) % 7;
if (l[S] == -1)
l[S] = i;
r[S] = i;
}
int an... | ALGO | 0.999319 | 3.628432 |
9841714a-69e6-44aa-83a6-c2b44c228249 | meetdoshi90/CP-Algorithms | Math/Algebra/Sieve-of-Eratosthenes.cpp | // Sieve of Eratosthenes
// Finding all prime numbers in a range [1:n]
// Time: O(nloglogn)
// Space: O(n)
#include<bits/stdc++.h>
using namespace std;
void sieve(int n){
vector<bool> isPrime(n+1,true);
for(int i=2; i<=n; i++){
if(isPrime[i]){
cout << i << " ";
for(long long j=i*i; j<=n; j+=i)
isPrime[j] ... | ALGO | 0.999585 | 5.020424 |
f4ad8b89-76c3-4bd0-a699-c08a5d013e02 | Nilesh2000/ErrorFreeCodes | CodeForces/25A - IQ test.cpp | # include <iostream>
using namespace std;
int main()
{
int n;
cin >>n;
int a, LastoddPos, LastevenPos, evenCount=0;
for(int i=1;i<=n;i++)
{
cin >>a;
if(a%2)
{
LastoddPos=i;
evenCount--;
}
else
{
LastevenPos=i;
evenCount++;
... | ALGO | 0.999882 | 3.873278 |
b3b92c4e-35af-4eaf-9339-0c8802eed7c1 | leo2105/Metodos-Numericos | MetodoFalsaPosicion.cpp | #include <iostream>
#include <math.h>
using namespace std;
const double tol = 1e-5;
double f(double x){
double rpta;
rpta = pow(x,3);
return rpta;
}
int main(){
double a,b,m;
a = -10.0, b = 20.0;
m = a;
while( fabs(f(m)) > tol){
m = (a*f(b) - b*f(a))/(f(b)-f(a));
if(f(m) == 0.0){
a = m, b = m;
}
... | ALGO | 0.999965 | 3.987321 |
78dcf9f6-5399-45b5-b7c5-286045c5a4b2 | DigitalFaust/Unweighted_graph | topsort.cpp | #include<iostream>
#include<stack>
using std::cout;
using std::endl;
using std::cin;
using std::stack;
const int MAXV = 100;
int TIME = 0;
stack<int> sorted;
bool processed[MAXV + 1];
bool discovered[MAXV + 1];
int parent[MAXV + 1];
int entry_time[MAXV + 1];
int exit_time[MAXV + 1];
struct edgenode
{
int y;
int wei... | ALGO | 0.99998 | 5.298692 |
faae4331-5458-43ef-9e9e-654e14a7ca21 | SUKRUCIRIS/AI_enhanced_Voxel_Game_Engine | third_party/assimp/code/PostProcessing/ImproveCacheLocality.cpp | /** @file Implementation of the post processing step to improve the cache locality of a mesh.
* <br>
* The algorithm is roughly basing on this paper:
* http://www.cs.princeton.edu/gfx/pubs/Sander_2007_%3ETR/tipsy.pdf
* .. although overdraw reduction isn't implemented yet ...
*/
// internal headers
#include "Pos... | ALGO | 0.994904 | 6.374086 |
58dc9662-e3f0-4a21-99c6-0af25f6a3637 | nerrons/lc | 217.contains-duplicate.cpp | /*
* @lc app=leetcode id=217 lang=cpp
*
* [217] Contains Duplicate
*
* https://leetcode.com/problems/contains-duplicate/description/
*
* algorithms
* Easy (53.74%)
* Likes: 502
* Dislikes: 583
* Total Accepted: 410.9K
* Total Submissions: 764.3K
* Testcase Example: '[1,2,3,1]'
*
* Given an array o... | ALGO | 0.998823 | 5.498229 |
cac7463a-e03e-4119-8290-321c327dde61 | shawon-majid/CP-Track | CSES/playlist.cpp | //Bismillahir Rahman-ir Rahim
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << " : " << x << endl;
#define all(c) c.begin(), c.end()
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef unsigned long long ull;
typedef l... | ALGO | 0.999953 | 4.136601 |
605f669f-4642-4182-9b2b-e6f3b06bc300 | ishandutta2007/codeforces | wxhtzdy/normal/816/B.cpp | #include <bits/stdc++.h>
using i64 = long long;
const int N = 2E5 + 5;
int sum[N];
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, k, q;
std::cin >> n >> k >> q;
for (int i = 0; i < n; i++) {
int l, r;
std::cin >> l >> r;
++sum[l];
-... | ALGO | 0.999942 | 4.299721 |
138b89b6-a7cf-49ec-81c2-915cec16e997 | iroshankumar/c- | loops/factorialOfANumber.cpp | #include <iostream>
using namespace std;
int main()
{
int n, sum = 1;
cout << "enter Nth number of factorial";
cin >> n;
for (int i = n; n > 0; n--)
{
sum *= n;
}
cout << sum << endl;
} | ALGO | 0.99983 | 3.808056 |
3438a10f-6cd4-4194-b243-44e87cbdba2f | 4bdul4ziz/Uni-Programs | maxSumSubArrayDAC.cpp | #include <iostream>
#include <vector>
#include <chrono>
using namespace std;
//q2 maximum sub array using divide and conquer
/* int maxSubArray(vector<int>& nums, int low, int high)
{ gae
if (low == high)
return nums[low];
int mid = (low + high) / 2;
int left_sum = maxSubArray(nums, low, mid);
... | ALGO | 0.999875 | 5.722306 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.