uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7123a122-7c4e-48ab-9941-7782351e90ff | anish-mankani1/C_plus | quest86.cpp | /*
*/
#include<iostream>
using namespace std;
int main()
{
int arr[]={1,2,3,4,5,6};
int x=6;
int i;
for(i=0;i<x;i++)
{
if(arr[i]==x)
{
cout<<x<<endl;
}
}
return 0;
} | ALGO | 0.998912 | 3.134832 |
7d419c24-86b6-4280-83a2-1651658bbc45 | ishandutta2007/codeforces | davidberard/normal/1156/C.cpp | #include <cassert>
#include <iomanip>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <queue>
#include <list>
#include <deque>
#... | ALGO | 0.999917 | 4.435399 |
f62856e5-4210-48f4-a7f9-27121ce7b571 | rdbyk/balisc | scilab/modules/elementary_functions/src/cpp/log1p.cpp | #include "log1p.hxx"
#include <Eigen/Core>
using types::Double;
using Eigen::Map;
using Eigen::ArrayXd;
namespace balisc
{
Double* log1p(Double* x)
{
Double* y = new Double(x->getDims(), x->getDimsArray(), false);
int n = x->getSize();
//double* xr = x->get();
//double* yr = y->get();
//fo... | ALGO | 0.932646 | 3.389842 |
5391f046-5bc6-43a5-af7b-3df5a8f0dce6 | chrizonix/RCBot2 | utils/vbsp/csg.cpp | #include "vbsp.h"
/*
tag all brushes with original contents
brushes may contain multiple contents
there will be no brush overlap after csg phase
each side has a count of the other sides it splits
the best split will be the one that minimizes the total split counts
of all remaining sides
precalc side on plane table... | ALGO | 0.995256 | 5.275417 |
5c219a1d-d187-44fc-8dbf-b12924eee4e2 | Vijay6923/All_platform_question | BITWISE/codeforces/two_divisors.cpp | #include<bits/stdc++.h>
using namespace std;
long long find_smallest_prime(long long n) {
if (n % 2 == 0) return 2;
if (n % 3 == 0) return 3;
for (long long i = 5; i * i <= n; i += 6) {
if (n % i == 0) return i;
if (n % (i + 2) == 0) return i + 2;
}
if (n > 1) return n;
return ... | ALGO | 0.999946 | 5.231017 |
b1d7d294-4089-4023-8ae7-1b32152d8197 | ishandutta2007/codeforces | alpha_q/normal/1467/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200010;
vector <int> g[N];
map <int, int> global;
int n, a[N], in[N], out[N], ptr, fenw[N];
void go (int u = 1, int par = -1) {
in[u] = ++ptr;
for (int v : g[u]) if (v != par) go(v, u);
out[u] = ptr;
}
void update (int p, int v) {
while (p < N) fe... | ALGO | 0.999341 | 4.246077 |
5b43dc27-f1ce-4147-9a97-9649c29cb90f | astro-heree/DSA | STL/mutliset.cpp | #include<iostream>
using namespace std;
int main()
{
mulitset<int> ms;
ms.insert(1);//{1}
ms.insert(1);//{1,1}
ms.insert(1);//{1,1,1}
ms.erase(1);// all the 1's are erased.
//So if we have to delete the single occurance of 1
ms.erase(ms.find(1));
//It deletes only one 1.
ms.erase... | ALGO | 0.992521 | 4.32147 |
6c4f87c8-2e85-45a9-98eb-398e60fafc36 | rajat641/Algorithms | Almost Sorted.cpp | #include <bits/stdc++.h>
using namespace std;
int a[1000001];
vector< int >v;
map< int , int >mm;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin>>n;
for(int u=1;u<=n;u++) {cin>>a[u];
mm[a[u]]=u;
v... | ALGO | 0.999993 | 3.312094 |
65e2f55f-2971-4383-b7df-db6411867550 | ndaless/dataStructures-algorithmsAnalysis | Tareas/Tarea4/T4EDA_LeslyAnda.cpp | // Tarea 4 - EDAII
#include <iostream>
#include <vector>
#include <complex>
#include <algorithm>
typedef long long ftype;
typedef std::complex<ftype> point;
#define x real
#define y imag
class LiChaoTree {
public:
//static const int maxn = 2e5;
static const int maxn = 4;
std::vector <point> line;
... | ALGO | 0.999901 | 4.089626 |
f1e1d51a-1b61-48dd-9c29-ffcef6ad4280 | lingyuhaunti/leetcode-C- | lc74.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
if ( matrix.size() < 1 || matrix[0].size() < 1 || matrix[0][0] > target || matrix[matrix.size()-1][matrix[0].size()-1] < target) {
... | ALGO | 0.999511 | 5.447555 |
79f5e4d6-a212-4f49-b19d-dbc599823f43 | TechAoba/OJ-code | 华东师范大学oj/1082. Easy to AC.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int jie[12];
int main()
{
int i, n;
jie[0] = jie[1] = 1;
for(i=2;i<12;i++) jie[i] = jie[i-1]*i;
int A[10];
A[0] = 1;
for(i=1;i<10;i++) {
A[i] = A[i-1] + jie[i+1];
}
while(cin>>n && n>=0) {
bool ok = false;
for(i=0;i<10;i++) if(n==A[i]) ok = true;... | ALGO | 0.999703 | 3.314221 |
823dcf4f-1193-42ba-bd2b-3e6b63fae6a8 | VatsalS31/STRIVER-SDE-SHEET | Trees/rightview.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.999931 | 6.253685 |
b900119d-8556-48b7-968f-fc0eac14893d | Datguyprasham/CompetitiveProgramming | Codechef sol/DSA series/1/LADDU.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
#define pb push_back
#define pi 3.1415
const lli MOD= 1e9+7;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
ll... | ALGO | 0.988159 | 4.33238 |
f5da6b9c-a54b-49e7-82af-12505cb426d1 | vi5hnuu/cpp-dp-series | 337. House Robber III.cpp | /*
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root.
Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if t... | ALGO | 0.999968 | 6.545694 |
7a0be36f-05ed-4d4f-95bb-89ca191686c1 | Edrummaster/tic-tac-toe | Tablero.cpp | //#include <iostream>
#include "Tablero.h"
//using namespace std;
Tablero::Tablero(char strEtq){
for (int i=0; i < 3; i++){
for (int j=0; j < 3; j++) {
Tablero:: matriz[i][j]= strEtq[i];
}
}
}
void Tablero::dibujarse(){
for (int i=0; i < 3; i++){
for (int j=0; j < 3; j++) {
cout<<" "<<matriz[i][j]... | ALGO | 0.924059 | 3.656177 |
39f349e0-c51f-47bf-b78e-92229f8e6bb9 | voe09/CPPPlayGround | Round1/DP/MaximalSquare.cpp | /*
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4.
*/
// dp[i][j] = min(dp[i-1][j-1], dp[i-1][j], dp[i][j-1]) + 1
class Solution {
public:
int maximalSqua... | ALGO | 0.999963 | 7.052565 |
8b756a64-d288-44eb-a9bd-b2e795186823 | DVMirchev/clogg | 3rdparty/onetbb/examples/parallel_for/game_of_life/Evolution.cpp | /*
Evolution.cpp: implementation file for evolution classes; evolution
classes do looped evolution of patterns in a defined
2 dimensional space
*/
#include "common/utility/get_default_num_threads.hpp"
#include "Evolution.hpp"
#include "Board.hpp"
#ifdef USE_SSE
#define GRAIN_S... | ALGO | 0.999909 | 5.307861 |
bc75eaae-87fb-4928-b7a9-38bd81ff3302 | akothen/Hydride | frontends/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp | #include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/... | ALGO | 0.983347 | 8.083392 |
3091cc9b-97ac-4aa7-9b05-80cd0edf2faf | ishandutta2007/codeforces | deepinc/normal/474/F.cpp | #include<bits/stdc++.h>
using namespace std;
unordered_map<int,int>rt;
const int S=3333333;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lc[S],rc[S],n,A[S],ans,g[S],w[S],m,pc;
#define md (L+R>>1)
void build(int p,int L,int R){
if(L==R)return void(g[p]=A[L]);
build(p<<1,L,md);build(p<<1|1,md+1,R);
g[p]=gcd(g[p<<1... | ALGO | 0.999964 | 4.033203 |
920ff08b-5b16-4d3a-aa46-4b46c5a77dcd | cfoust/leetcode-problems | problems/partition-list/solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* partition(ListNode* head, int x) {
}
}; | ALGO | 0.999971 | 5.39269 |
5cf7a191-4aba-40f9-8feb-849af05c8122 | sheepatsea/19th-Smartcar | upper_com/src/tool/calibration.cpp | /**
********************************************************************************************************
* 示例代码
* EXAMPLE CODE
*
* (c) Copyright 2024; SaiShu.Lcc.; Leo; https://bjsstech.com
* ... | TOOL | 0.987349 | 3.37921 |
99eea077-11a7-4270-9ef7-8eb83cbc988e | amrutansugaranaik/codechef | covidlq.cpp | /*
* @author : Amrutanu Garanaik
* @date : 14th April 2020
*
* @question :
* Given a binary sequence, check any two 1s are at least 5 0s apart.
* e.g. print YES for 00100000100, 010, 00100000000010000010 etc
* e.g. print NO for 10100, 11011, 100100001 etc
*
*/
#include <stdio.h>
int ... | ALGO | 0.999878 | 4.42681 |
583d5c0d-3a2d-416e-ba8b-81d7adb8bacc | TEAM-Gummy/android_frameworks_base | core/jni/android/opengl/util.cpp | #include "jni.h"
#include "JNIHelp.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <dlfcn.h>
#include <GLES/gl.h>
#include <ETC1/etc1.h>
#include <core/SkBitmap.h>
#include "android_runtime/AndroidRuntime.h"
#undef LOG_TAG
#define LOG_TAG "OpenGLUtil"
#i... | TOOL | 0.954035 | 6.151347 |
fa9ee05a-1fcd-4a83-93cf-786e31a7b3ab | MrLeanage/farm_buddy | 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.998693 | 6.797273 |
756a31e1-d309-46f7-acff-964f4b7196fe | aryan-shrivastava09/GFGDSA | LookupTableCountSetBits.cpp | #include<iostream>
using namespace std;
int table[256];
void initialize()
{
table[0] = 0;
for(int i =1;i<256;i++)
{
table[i] = (i&1) + table[i/2];
}
}
int main()
{
int n;
cout<<"Enter a number: ";
cin>>n;
initialize();
int res = table[n&0xff];
n= n>>8;
res += table[n&... | ALGO | 0.999952 | 4.309247 |
1406fe18-a2d6-40a5-a37f-c38345f1e969 | mihretgold/Competitive-Programming | 1838-frequency-of-the-most-frequent-element/1838-frequency-of-the-most-frequent-element.cpp | class Solution {
public:
int maxFrequency(vector<int>& nums, long k) {
sort(nums.begin(), nums.end());
int n =nums.size();
int i=0;
int ans=0;
for(int j=0; j<n; j++){
k +=nums[j];
while(k<(long) nums[j]*(j-i+1)){
k-... | ALGO | 0.999982 | 5.807608 |
d26919e3-5638-43ff-9091-6aaf78b22ecb | ShinWonjung/programmers | findsosu/findsosu/소스.cpp | #include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
bool isprime(int n)
{
if (n <= 1) return false;
if (n == 2) return true;
if (n % 2 == 0) return false;
for (int i = 3; i <= sqrt(n); i++)
{
if (n % i == 0) return false;
}
return true;
}... | ALGO | 0.999572 | 5.419116 |
9001657a-49d7-445f-9317-8b9443859eae | faustgames-ru/FaustEngine | FaustGames/Native/src/core/Math.cpp | #include "Math.h"
namespace core
{
float Math::Epsilon(1e-8f);
float Math::MaxValue(1e10f);
float Math::Pi(3.14159265359f);
float Math::abs(float a)
{
return a > 0 ? a : -a;
}
float Math::saturate(float a)
{
if (a < 0.0f)
return 0.0f;
if (a > 1.0f)
return 1.0f;
return a;
}
float Math::trunc(... | ALGO | 0.964396 | 6.170305 |
f48b368f-efdb-4509-9c55-27d9fe464474 | 101magikarp101/USACO | cses/mathematics/graph-paths.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
#define MOD2 1000000007
#define vt vector
#define endl '\n'
#define pb push_back
#define pf push_front
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define uset unordered_set
#define umap unordered_map
#define mset ... | ALGO | 0.999977 | 4.932274 |
5b1b54e7-661d-4dc5-b0be-4ae775870822 | Sanzzes/wopc-core | src/bindings/scripts/scripts/kalimdor/teldrassil.cpp | /* ScriptData
SDName: Teldrassil
SD%Complete: 100
SDComment: Quest support: 938
SDCategory: Teldrassil
EndScriptData */
/* ContentData
npc_mist
EndContentData */
#include "precompiled.h"
#include "follower_ai.h"
/*####
# npc_mist
####*/
enum eMist
{
SAY_AT_HOME = -1000411,
EMOTE_AT_HOME ... | TOOL | 0.878526 | 5.893619 |
87000d6d-158b-45df-af87-f31c2ab675f5 | trapperdot00/emelt_digitalis_kultura_programozasi_tetelek | test/felteteles_maximum.cpp | #include "../src/csrb.h"
#include <vector>
#include <iostream>
int main() {
std::cout << "Feltételes maximum\n";
std::vector<int> lista{0,5,1,3,5,7,22,115,73,4};
std::cout << "Lista:";
for (int i : lista)
std::cout << ' ' << i;
std::cout << '\n';
auto feltetel = [](int i) { return i % 2 == 0; };
std::ve... | ALGO | 0.997407 | 5.25621 |
3e3c0449-2079-4457-bf76-7a78365cb67d | wael-suleiman-UdeS/RobotFoot | Darwin/Eigen/doc/examples/Tutorial_PartialLU_solve.cpp | #include <Eigen/Core>
#include <Eigen/LU>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vec... | ALGO | 0.999886 | 3.142099 |
fc42ffd1-87ae-4321-8441-1f394447499a | homer6/c_reading | boost-trunk/libs/graph/example/adjacency_list.cpp | #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map/property_map.hpp>
/*
Sample Output
graph name: foo
0 --joe--> 1
1 --joe--> 0 --curly--> 2 --dick--> 3
2 --curly--> 1 --tom--> 4
3 --dick--> 1 --harry--> 4
4 --tom--> 2 -... | ALGO | 0.986875 | 6.19313 |
d7602e60-3e2b-4ca1-82ed-b70f8db6cd95 | akms-limon/Contest_Problem_Solving | codeforces/C_1_Bessie_s_Birthday_Cake_Easy_Version.cpp | #include <bits/stdc++.h>
#define nl "\n"
#define nll cout<<"\n"
#define ll long long
#define tc int t; cin>>t; while(t--)
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define cinx(array) { for (auto &x: array) cin >> x; }
#define coutx(array) { for (auto x : array) cout << x << " "; cout << endl; }
using n... | ALGO | 0.999771 | 3.459581 |
c7112d64-604e-46f1-ad10-2ef833e5b813 | varadkhadake2002/Striver-A2Z-DSA | Day3/nCr.cpp | #include <bits/stdc++.h>
using namespace std;
int factorial(int n){
int fact =1;
for(int i=1; i<=n; i++){
fact *= i;
}
return fact;
}
int nCr(int n, int r){
int fact_n = factorial(n);
int fact_r = factorial(r);
int fact_nmr = factorial(n-r);
return fact_n / (fact_r * fact_nmr... | ALGO | 0.999945 | 5.294121 |
50168dce-6096-4243-86c9-0d1907b801e3 | malvarado27/Amrex | Src/LinearSolvers/MLMG/AMReX_MLCGSolver.cpp |
#include <limits>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <AMReX_ParmParse.H>
#include <AMReX_Utility.H>
#include <AMReX_LO_BCTYPES.H>
#include <AMReX_MLCGSolver.H>
#include <AMReX_VisMF.H>
#include <AMReX_ParallelReduce.H>
#ifdef _OPENMP
#include <omp.h>
#endif
namespace amrex {
namespac... | ALGO | 0.998248 | 6.028852 |
ace4551e-aca7-4513-951f-6a15fb006492 | PrathameshJadhav30/DSA-Course | 009-Problems On Arrays/07-Product of Array Except Self/2-Optimal Approach with Space Optimization/ProductofArrayExceptSelf.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
vector<int> answer(n, 1); // Initialize result array with 1s
// Step 1: Store prefix product from the left
for (... | ALGO | 0.999996 | 7.350891 |
f7b386cf-efb9-4935-82df-166b474aed27 | PranshuSrivastava/Data-Structures-And-Algorithms | Implementation/chocolate-feast.cpp | #include <bits/stdc++.h>
using namespace std;
int chocolateFeast(int n, int c, int m) {
int wrappers, count=0;
count+=n/c;
wrappers=n/c;
while(wrappers!=0)
{
count+=wrappers/m;
if(wrappers/m!=0)
wrappers=wrappers/m+wrappers%m;
else
wrappers=0;
}
retur... | ALGO | 0.999958 | 4.93691 |
b282a331-9eee-46f4-9dc5-d352db077496 | aarindey/Leetcode-Solution-By-aarindey | perfect-number/perfect-number.cpp | class Solution {
public:
bool checkPerfectNumber(int n) {
int sum=0;
for(int i=1;i*i<=n;i++)
{
if(n%i==0)
{
sum+=i;
if(i*i!=n)
sum+=(n/i);
}
}
return (sum-n==n);
}
}; | ALGO | 0.999965 | 5.81136 |
26e4009a-2aef-4c0e-8f79-d79c2b6a481d | wxpftd/SCAUOJ | 11088.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int lessN(int n, int m)
{
if (1 > n || 1 > m)
return 0;
else if (1 == n || 1 == m)
return 1;
else if (m == n)
{
return 1 + lessN(n, m-1);
}
else if (m > n)
{
return lessN(n, n);
}
else if (n ... | ALGO | 0.999927 | 3.581168 |
81f4c36e-ff4d-41c5-b080-b6b4271b62ec | LucsJs/CppProjects | Craps.cpp | // craps
/*
Um jogador rola dois dados. Cada dado tem seis faces. Essas faces contm 1, 2, 3, 4, 5 e 6 pontos. Depois que os dados param de
rolar, a soma dos pontos nas faces viradas para cima calculada. Se a soma 7 ou 11 na primeira rolagem dos dados, o jogador
ganha. Se a soma 2, 3 ou 12 na primeira rolagem dos dad... | ALGO | 0.90681 | 5.571439 |
345020b6-f0dc-4f92-963c-13990d244628 | yqw1212/fuzztruction-llvm17.0.6 | libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp | // <algorithm>
// template<InputIterator Iter, class T>
// requires HasEqualTo<Iter::value_type, T>
// constexpr Iter::difference_type // constexpr after C++17
// count(Iter first, Iter last, const T& value);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#if TE... | TEST | 0.950845 | 6.977204 |
09091e32-68b4-4c36-9bb8-8f3a1b76fed4 | Ayushi02paul192/Leetcoding | Rearrange a string - GFG/rearrange-a-string.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
string arrangeString(string str)
{
//code here.
int cache[26]={0};int sum =0;
for(auto &c:str)
{
if(isdigit(c))
sum+=c-'0';
el... | ALGO | 0.999722 | 6.912281 |
a7a19b11-35f7-49d1-a202-c08f8bb0a209 | vk-kushwaha/CPP_practice | practice/Find_and_Earn.cpp | #include <iostream>
#include <vector>
using namespace std;
int findNumberOfLIS(vector<int>& nums) {
int n = nums.size();
if (n <= 1) {
return n;
}
vector<int> lengths(n, 1); // lengths[i] represents the length of the LIS ending at index i
vector<int> counts(n, 1); // counts[i] represe... | ALGO | 0.999994 | 6.496078 |
49cad201-0fee-4f0f-ab83-90fba189a081 | SAURABHMISHRA55/IIIT-M.Tech-SEM-1 | MAIN REPO/Data Structures & Algorithms for Problem Solving/ASSIGNMENTS/2023201034_A4/2023201034_A4/2023201034_A4_Q3.cpp | #include <iostream>
#include <ctime> // time calculations
#include <fstream> // file handling
#include <algorithm> // for sort
#include <iomanip> // setprecision
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define INT_MAX 2... | ALGO | 0.999081 | 4.941699 |
b50b4b64-f2af-473d-bdc2-5749a4fa01cc | raj-jondhale/Strivers-A2Z-DSA-Sheet | 3 Problems on array/3.1 _ Easy/06 Move Zeros.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution
{
public:
void pushZerosToEnd(int arr[], int n)
{
// code here
int i = 0;
for (int j = 0; j < n; j++)
{
if (arr[j] != 0)
... | ALGO | 0.999437 | 6.50837 |
fd1a8141-0e96-4411-91e5-d4095a0e5a22 | devSmarak972/code-o-soccer | Strategy/Skills/sDefendPoint.cpp | #include "skillSet.h"
#include "pathPlanners.h"
#include "beliefState.h"
#include "config.h"
#include <math.h>
#include <stdio.h>
namespace Strategy
{
void SkillSet::defendPoint(const SParam& param)
{
Vector2D<int> ballFinalpos;
ballFinalpos.x = state->ballPos.x+0.5*state->ballVel.x;
ballFinalpos.y = s... | TOOL | 0.997305 | 5.111437 |
c341de72-71f7-446a-a5f1-f41612910194 | wwxhero/lib_hIK | src/bvh.cpp | #include "pch.h"
#include <iostream>
#include <stack>
#include <queue>
#include "bvh.h"
#include "bvh11_helper.hpp"
#include "ArtiBody.hpp"
#include "articulated_body.h"
#include "motion_pipeline.h"
#include "fk_joint.h"
#include "handle_helper.hpp"
#include "ik_logger.h"
#include "ArtiBodyFile.hpp"
#include "Math.hpp"... | ALGO | 0.906213 | 4.782052 |
f7597f93-d14e-4936-b545-f8cdfc788c0e | batherit/Algorithm | Study20200330/15655_N과M(6).cpp | #include<iostream>
#include<algorithm>
using namespace std;
int arr[10];
int res[10];
void prt(int e) {
for (int i = 0; i < e; i++) {
cout << res[i] << ' ';
}
cout << '\n';
}
void sol(int n, int m, int s, int d) {
if (d == m) {
prt(d);
return;
}
for (int i = s; i < n; i++) {
res[d] = arr[i];
sol(n, ... | ALGO | 0.999986 | 3.480778 |
94a7d824-1fe3-42ef-adf9-59a0572becb7 | MuhammadAhmadNaveed4714/Oop | code32.cpp | #include<iostream>
using namespace std;
//Function to insert a string
int insertString(char* destination, int index, const char* src)
{
int srcLength = 0;
while (src[srcLength] != '\0')
{
srcLength++;
}
int destinationLength = 0;
while (destination[destinationLength] != '\0')
{
destinationLength++;
}
//Che... | ALGO | 0.990138 | 5.207507 |
a5def66c-e049-4f83-b2a4-670575fff479 | LevkoBe/GroupChat | Common/Common.cpp | #include "Common.h"
std::mutex m;
bool Common::errorMessage(const std::string& message) {
std::lock_guard<std::mutex> lock(m);
std::cerr << message << std::endl;
return false;
}
// basic send-receive mehthods
bool Common::sendChunkedData(SOCKET clientSocket, const char operationType, const std::string& m... | TOOL | 0.930866 | 5.857884 |
57420c87-a7b7-4492-b8c4-b795408ab968 | Rohith916/coding | cpp/inheritance using FRIEND function.cpp | // inheritance using friend function
#include<iostream>
using namespace std;
class b;
class A{
private:
int x,y;
friend b;
};
class b
{
public:
A o;
void get()
{
cin>>o.x>>o.y;
cout<<o.x*o.y;
}
};
int main()
{
b o;
o.get();
} | TOOL | 0.897942 | 3.388437 |
c13bda06-2301-40f8-9fe0-ecbc61c41ecd | has2/Problem-Solving | programmers/level4/단어_퍼즐.cpp | #include <string>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
vector<string> str;
string t;
int dp[20001],inf=9e7;;
bool check(int n,string& s){
for(int i=0;i<s.size();i++){
if(n+i>=t.size()) return 0;
if(t[n+i]!=s[i]) return 0;
}
return 1;
}
int sol(int n)... | ALGO | 0.999955 | 5.587727 |
bf2dc7a5-5df3-4233-81bc-7c078dcf3f9e | ednux/interview | 1_replacing_characters_in_place.cpp | #include <iostream>
#include <string.h>
using namespace std;
void replace(char *input, int size);
int main(int argc, char **argv)
{
char input[30] = "User is not allowed";
replace(input, 19);
if (strcmp(input, "User&32is&32not&32allowed") == 0)
{
cout << input << endl;
}
else
{
... | TOOL | 0.988862 | 3.605199 |
2d6de684-eaf5-46ff-ace5-9e8f790bcfe5 | mohitkumaragrawal/cpp-algo | graph/shifting-string.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int min_rot(string& a) {
string b = a + a;
return b.find(a, 1);
}
void solve() {
int N;
cin >> N;
string s;
cin >> s;
vector<vector<int>> G(N);
for (int i = 0; i < N; ++i) {
int x;
cin >> x;
x--;
G[i].push_back(x);
... | ALGO | 0.99997 | 5.120448 |
3f92b562-3316-4534-be37-3f755f309efa | luigifreda/pyslam | thirdparty/g2opy/g2o/examples/simple_optimize/simple_optimize.cpp | #include <iostream>
#include "g2o/core/sparse_optimizer.h"
#include "g2o/core/block_solver.h"
#include "g2o/core/optimization_algorithm_gauss_newton.h"
#include "g2o/core/optimization_algorithm_levenberg.h"
#include "g2o/solvers/csparse/linear_solver_csparse.h"
#include "g2o/core/factory.h"
//#include "g2o/types/slam... | ALGO | 0.888056 | 6.640134 |
ab250054-d04c-408d-b064-2be9af203f9b | upadrastaharshavardhan/programing_quections-_c- | 195 A. Let's Watch Football.cpp | #include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
fastread();
//freopen("input.txt","r", stdin);
ll a,b,c;
c... | ALGO | 0.999933 | 3.666391 |
fc78e774-6c21-4bfa-a321-83d62e38f8d2 | ishandutta2007/codeforces | mrdindows/normal/681/D.cpp | #pragma comment(linker, "/stack:20000000")
#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <cstdio>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack... | ALGO | 0.999989 | 3.716873 |
b2dd277d-41a8-46f8-af3a-2b8284e058f7 | sarvex/leetcode-fish | solution/0400-0499/0408.Valid Word Abbreviation/Solution.cpp | class Solution {
public:
bool validWordAbbreviation(string word, string abbr) {
int i = 0, j = 0;
int m = word.size(), n = abbr.size();
while (i < m) {
if (j >= n) {
return false;
}
if (word[i] == abbr[j]) {
++i;
... | ALGO | 0.999614 | 6.369315 |
d8eb0a37-2120-4489-82a2-53c80c7f3a05 | Ahmed1262005/Qt-Game-Multiplayer-RocketShooting | Game/Box2D/Collision/b2CollideCircle.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
void b2CollideCircles(
b2Manifold* manifold,
const b2CircleShape* circleA, const b2Transform& xfA,
const b2CircleShape* circleB, const b2Transform& xfB)
{
manifold->pointCou... | ALGO | 0.999031 | 7.760263 |
319116be-ad86-41e5-93ec-fba3306fae53 | ggasoftware/indigo | graph/src/path_enumerator.cpp | #include "base_cpp/tlscont.h"
#include "base_cpp/cancellation_handler.h"
#include "graph/graph.h"
#include "graph/path_enumerator.h"
using namespace indigo;
IMPL_TIMEOUT_EXCEPTION(PathEnumerator, "path enumerator");
PathEnumerator::PathEnumerator (Graph &graph, int begin, int end) :
_graph(graph),
_begin(begin),
_en... | ALGO | 0.997027 | 6.969555 |
b03a8a53-b159-4276-b628-5ad9d71b987b | mohammad-hajiebrahimi/Online_judge | Codeforces/prablems/main/496C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort(all(x))
#define sep ' '... | ALGO | 0.999978 | 3.837688 |
40d25af2-a376-4f73-9ab2-9b48203a57bc | uthman-khan/4th-semester | Design and analysis of algorithms/merge_Sort.cpp | #include <iostream>
using namespace std;
void merge(int arr[], int left, int mid, int right) {
int n1 = mid - left + 1;
int n2 = right - mid;
int L[n1], R[n2];
for (int i = 0; i < n1; i++) L[i] = arr[left + i];
for (int j = 0; j < n2; j++) R[j] = arr[mid + 1 + j];
int i = 0, j = 0, k = left;... | ALGO | 0.999994 | 5.985943 |
6edf6dee-def6-4af9-946f-3c5fb1153678 | lucaswilliamgomes/QuestionsCompetitiveProgramming | HackerRank/Compare the Triplets.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> compareTriplets(vector<int> a, vector<int> b) {
int a_points = 0, b_points =0;
for (int i = 0; i < 3; i++){
if (a[i] > b[i]) a_points++;
if (b[i] > a[i]) b_points++;
}
vector <int> points;
points.push_back(a_points);
po... | ALGO | 0.999812 | 4.178703 |
6f9ff89e-74a4-434a-86ca-27dddd37a717 | runemadsen/SpatialMediaFinal | src/addons/PennerEasing/Quint.cpp | #include "Quint.h"
float Quint::easeIn (float t,float b , float c, float d) {
return c*(t/=d)*t*t*t*t + b;
}
float Quint::easeOut(float t,float b , float c, float d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
}
float Quint::easeInOut(float t,float b , float c, float d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
r... | ALGO | 0.916962 | 5.513054 |
40345b35-f40c-4073-9966-822c2b3ce029 | ishandutta2007/codeforces | martin53/normal/580/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> in={} ;
for(int i=1;i<=n;i++)
{
int cur;
cin>>cur;
in.push_back(cur);
}
int cnt=1, outp=1;
for(int i=1;i<n;i++)
{
if(in[i-1]<=in[i])cnt++;
else cnt=1;
outp=max(outp, cnt);
}
cout<<outp<<endl;
} | ALGO | 0.999948 | 4.030669 |
3644743c-63aa-492a-afe0-d29375011402 | MadCatMining/DiminutiveCoin | src/utilstrencodings.cpp | #include "utilstrencodings.h"
#include "tinyformat.h"
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <limits>
using namespace std;
static const string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static const string SAFE_CHARS[] =
{
CHARS_ALPHA_NUM + " ... | TOOL | 0.96967 | 5.662208 |
96b49fa5-b3c3-46ca-af55-b3a403512f3b | shreyanshthakur/DSA_Course | afterCourse/Leetcode/4Sum.cpp | class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
vector<vector<int>> ans;
int n = nums.size();
if (n < 4) return ans;
sort(nums.begin(), nums.end());
for(int first = 0 ; first < n-3 ; first++) {
long long ... | ALGO | 0.999957 | 6.130862 |
92df7401-d0aa-4e3a-a4df-e1da0b6d0b24 | rbritton3468/Parallel_Network- | fileCompression/encryption.cpp | #include <vector>
#include <iostream>
#include <cstdint>
#include <cstring>
#include "encryption.hpp"
const u_int8_t global_key[32] = {
0x50, 0x61, 0x62, 0x6C, 0x6F, 0x20, 0x66, 0x6F,
0x72, 0x20, 0x50, 0x72, 0x65, 0x73, 0x69, 0x64,
0x65, 0x6E, 0x74, 0x20, 0x6F, 0x66, 0x20, 0x43,
0x6F, 0x6C, 0x6F, 0x6D,... | ALGO | 0.999625 | 6.165189 |
46631da2-713a-46b0-925b-b03b8aeeabb2 | tzhenyu/BACS1013-Practical | practicals/practical4b3.cpp | #include <iostream>
using namespace std;
int mairtytyhtyn() {
for (int i = 3; i <= 75; i+= 3) {
cout << i << " ";
}
return 0;
} | ALGO | 0.998369 | 3.215685 |
a80a6b36-d2b3-4137-a7d1-cb6bbbe82d65 | DPontes/Self-Driving-Car-ND_Path-Planning | src/Eigen-3.3/doc/examples/TemplateKeyword_simple.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)
{
dst.triangularView<Upper>() = src.triangularView<Upper>();
}
int main()
{
MatrixXf m1 = MatrixXf::Ones(4,4);
MatrixXf m2 = MatrixXf::Random(4,4);
std::cout << "m2 before copy:"... | TOOL | 0.976324 | 5.210898 |
5eacba21-da19-41d5-8107-85cdc0d16ffb | Swadeshit27/CrackYourInternship | Arrays/Spiral_matrix.cpp | // time: O(n*m) space: O(n*m) [no extra space]
class Solution
{
public:
vector<int> spiralOrder(vector<vector<int>> &matrix)
{
int n = matrix.size();
int m = matrix[0].size();
vector<int> ans;
int cnt = 0;
int startCol = 0, startRow = 0, endCol = m - 1, endRow = n - 1;
... | ALGO | 0.999983 | 6.197742 |
bd8961f7-b079-4145-aeaf-247c63cc564c | Lycheus/shore-llvm | libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class student_t_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
int main()
{
{... | TEST | 0.980671 | 4.994881 |
476cdde1-661e-4908-adbf-d6d34ef5665e | pulkitjain1821/SPOJ | PIGBANK.cpp | #include <cstdio>
#include <cstdlib>
#define inf 1000000000
using namespace std;
void display(int values[],int weights[], int count)
{
for(int i=0;i<count;i++)
{
printf("Values of coin: %d, weight: %d \n",values[i],weights[i]);
}
}
void min_money(int n, int vals[], int weights[], int count)
{
int arr[n+1];
... | ALGO | 0.999539 | 3.358184 |
59a78548-b411-4769-b5cd-d3cf1466a112 | tangodown1934/Algorithm-judge | source/mt/1876851_AC_0.08SEC.cpp | #include <stdio.h>
int a;
void mt(int x)
{
if (x > a)
{
return;
}
if (x == a){
printf("%d",a);
return;
}
printf("%d", x);
mt(x+1);
printf("%d", x);
return;
}
int main(void){
scanf("%d", &a);
mt(1);
return 0;
}
| ALGO | 0.999868 | 3.253422 |
44f83343-8a04-4078-84e7-fba97bffc204 | SabinaRachev/3D-Snake-Game-Final-Project | igl/columnize.cpp | template <typename DerivedA, typename DerivedB>
IGL_INLINE void igl::columnize(
const Eigen::PlainObjectBase<DerivedA> & A,
const int k,
const int dim,
Eigen::PlainObjectBase<DerivedB> & B)
{
// Eigen matrices must be 2d so dim must be only 1 or 2
assert(dim == 1 || dim == 2);
// block height, width, and... | ALGO | 0.946832 | 5.236076 |
b30d2a64-d446-4455-945b-85ad44f61495 | Gem0512/codeptit_ki_1_nam_2 | giai_ma_tang_giam.cpp | #include <iostream>
#include <stack>
using namespace std;
void solution()
{
string s;
stack<int> mystack;
cin >> s;
int i, j = 0;
for (i = 0; i < s.length(); i++)
{
if (s[i] == 'D')
{
if (i == 0 || s[i - 1] == 'I')
mystack.push(++j);
mysta... | ALGO | 0.999859 | 5.232005 |
4aaaa6d2-98c6-4ddb-be1c-c5577638fe73 | imraghavagr/DSA-cpp | PLA1001/pat training/1.anagram.cpp | #include<iostream>
#include<string>
#include<unordered_map>
using namespace std;
bool solve(string a, string b){
if(a.length() != b.length()) return false;
unordered_map<char, int> mp;
for(auto it : a){
mp[it]+=1;
}
int count = mp.size();
for(auto it : b){
if(mp.find(it... | ALGO | 0.999985 | 4.331834 |
25a34b18-594b-465a-8ee1-576d8bc1a93c | SynTax19/LeetCode-Solutions | 1310-xor-queries-of-a-subarray/1310-xor-queries-of-a-subarray.cpp | class Solution {
public:
vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) {
int n = arr.size();
vector<int> pre(n,0);
pre[0] = arr[0];
for (int i=1;i<n;i++)
pre[i] = pre[i-1]^arr[i];
vector<int> res;
for (auto it : q... | ALGO | 0.999988 | 5.730666 |
d28767c1-cc6f-46c8-9aa2-037dbbc01c34 | Foysal-Munsy/Rush-Roadmap | Week-03/Day 06/is it cat.cpp | /********************
* ------------- *
* Author:Foysal *
* ------------- *
********************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<in... | ALGO | 0.999552 | 4.518407 |
80c68261-7db7-421b-8ba1-e4415328d498 | Hou-Xiaoxuan/AlgorithmCompetition | algorithm_contest_2020/training match/9_10/C Bad Hair Day Poj 3250.cpp | #ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include<iostream>
#include<algorithm>
#include<stack>
#include<vector>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define m_p make_pair
#define P pair<int,int>
#define x first
#define y second
typedef long long L... | ALGO | 0.998307 | 3.403108 |
a8c67192-db67-4d71-b731-6dafdbc8dbcb | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11397_41.cpp | #include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
int n, k, m;
long long dp[1010][110][2][2], g[1010];
void Add(long long &a, long long b) {
a += b;
a %= m;
if (a < 0) a += m;
}
int main() {
cin >> n >> k >> m;
g[0] = 1;
for (int i = 1; i <= 1000; i++) g[i] = g[i - 1] * 10LL % k;
long ... | ALGO | 0.999969 | 3.787686 |
a794b127-4fd6-4586-b89a-898b248f5770 | Sanskar8779/DSA | BinaryTree/11. Diameter2.cpp | //Diameter of Binary tree
//Time complexity of this program is O(n)
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *left, *right;
Node(int key){
data = key;
left = right = NULL;
}
};
int height(Node *root, int &diameter){
if(!root) return 0;
i... | ALGO | 0.999753 | 5.56774 |
a98bda04-22ea-46a3-9347-3b6b7d1a1cea | Golovanov399/adventofcode | 2024/18_a.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
inline int nxt() {
int x;
cin >> x;
return x;
}
vector<int> read_ints() {
vector<int> res;
int x;
while (cin >> x) {
res.push_back(x);
}
return res;
}
vector<int> read_ints(const string& s) {
stringstream sstr(s);
vecto... | ALGO | 0.99889 | 4.232463 |
d990dd7e-f9ba-420a-bbb0-09bb242024a3 | sakshimali0307/CPP | Basics/17_Pattern for (X).cpp | #include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int i = 0, j = 0, x = 0;
cout<<"\nEnter Size For Pattern : ";
cin>>x;
cout<<"\n\n********** Pattern **********\n\n";
for(i = 1; i <= x; i++)
{
for(j = 1; j <= x; j++)
{
if(i == j || i + j == x ... | ALGO | 0.998878 | 3.7793 |
bb462692-554b-4924-96bf-f5449412655e | developertouch/password_validator | 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.9988 | 6.76073 |
a851a4f5-c474-4761-9dc9-1ea5ae9505c3 | navaljangir/Leetcode-Monthly | October/1458MaxDotProductOfTwoSequences.cpp | class Solution {
public:
int solve(vector<int>&nums1 , vector<int>&nums2 , int i , int j,vector<vector<int>>&dp){
if(i>=nums1.size()){
return -1e9;
}
if(j>=nums2.size()){
return -1e9;
}
if(dp[i][j]!=-1e9){
return dp[i][j];
}
... | ALGO | 0.999981 | 6.166877 |
dff91b60-3c71-40ec-8f24-bd7003a94443 | navjeet-py/Codechef-Problems | cpp/MINARRS.cpp | #include <iostream>
using namespace std;
#define range(i, a, b) for(int i = a; i < b; i++)
long long int mx_array(long long int A[], int N) {
long long int mx = 0;
range(i, 0, N) mx = max(mx, A[i]);
return mx;
}
int main(){
int T, N;
cin >> T;
while(T--){
cin >> N;
long long ... | ALGO | 0.999869 | 4.731831 |
e32d3cce-0d53-43c4-9e3e-7f8823f105b9 | KrishnakantTiwari11/Leetcode_All_topics_problem | 670-maximum-swap/maximum-swap.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
class Solution {
public:
int maximumSwap(int num) {
vector<int> digits;
while (num > 0) {
int digit = num % 10;
digits.push_back(digit);
num /= 10;
... | ALGO | 0.999905 | 6.64919 |
7d2add0b-0316-49fc-974c-97ce90ac239c | saulcanche/codeforces | contests/906/a.cpp | #include <iostream>
#include <map>
using namespace std;
typedef long long ll;
void solve(){
ll n, nCopy, x;
map<ll, ll> rep;
cin >> n;
nCopy = n;
while(nCopy-- && cin >> x) rep[x]++;
bool isP = false;
if(rep.size() <= 2) {
auto first = rep.begin()->second;
auto last = rep.r... | ALGO | 0.999627 | 4.594504 |
e4eeeda9-d76a-488a-b4e9-fbf1ced621d2 | ishandutta2007/codeforces | nik_storm_2010/normal/459/D.cpp | #include <cstdio>
#include <map>
using namespace std;
const int N = 1e6 + 10;
int f[N], a[N], c1[N], c2[N];
void add(int i) {
for (int x = i; x < N; x = (x | (x + 1))) f[x]++;
}
int getsum(int i) {
int res = 0;
for (int x = i; x >= 0; x = (x & (x + 1)) - 1) res += f[x];
return res;
}
int main() {
... | ALGO | 0.999974 | 3.93143 |
64253353-05dd-4da0-83a5-64d492ace6e4 | Micronet-Ltd/sc600-android-external | eigen/doc/examples/Tutorial_ArrayClass_accessors.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf m(2,2);
// assign some values coefficient by coefficient
m(0,0) = 1.0; m(0,1) = 2.0;
m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0);
// print values to standard output
cout << m << endl << endl;
... | ALGO | 0.98226 | 3.536336 |
6c22dbb6-72ab-40e7-92f0-d2c3aca9bd30 | qvntz/c-plus-plus-white-belt | week2/ex7.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
void PrintBusesForStop(std::map<std::string, std::vector<std::string>> &stops_to_buses,
const std::string &stop) {
if (stops_to_buses.count(stop) == 0) {
std::cout << "No stop\n";
}
else {
for (const std::string &bus : stops_to_buses... | ALGO | 0.934007 | 5.724614 |
0f13a47e-fd2d-4baa-b005-21b17450bad1 | nihithreddy/PrepBytes-Solutions | Queues/Minimum Cost Of Ropes.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n;
ll d;
cin>>n;
priority_queue<ll,vector<ll>,greater<ll>> pq;
for(int i=0;i<n;i++){
cin>>d;
pq.push(d);
}
ll cost = 0LL;
while(pq.size()>1){
ll a = pq.top();pq.pop();
ll b = pq.top();pq.pop();
pq.... | ALGO | 0.999815 | 4.964505 |
1603d9f7-89b3-4453-b466-c35a136c0d97 | Gapraomoosap/Cs101 | year2/Algorithm/grader/lab3_3.cpp | #include <iostream>
using namespace std;
void swap(int *i,int *j){
int k = *i;
*i = *j;
*j = k;
}
int partition(int a[], int l, int r,int k) {
int pivot, i, j, t;
pivot = a[r]; // first item always as the pivot
i = l;
j = r + 1;
while(1)
{ do { ++i;
}while(a[i] <= pivot);
do { --j;
}while(a[j] > pivot);
if(i... | ALGO | 0.999969 | 4.420113 |
b6941c98-9e16-4540-99b5-b4c40c9b752c | optimus-alfaomega/C-Estructuras-datos | array/ordenamiento y analisis/ejercicio_4_cout.cpp | #include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
int main(int argc, char *argv[]) {
system("color 30");
int cantidad = 10, resultado = 0;
int vector_A[10];
int vector_B[10];
for (int i = 0; i < cantidad; i++){
vector_A[i] = i;
resultado = pow(vector_A[i], 2);
vector_B[i] = ... | ALGO | 0.88155 | 3.534408 |
415461d6-56bd-46a5-be41-a2ad5efe3873 | Deepoo2000/LeetcodeProblems | 925-long-pressed-name/925-long-pressed-name.cpp | class Solution {
public:
bool isLongPressedName(string name, string typed) {
int i=0, j=0;
int n=name.length(), t = typed.length();
if(name[0]!=typed[0]) return false;
while(i<n || j<t){
if(name[i] == typed[j]){
i++,j++;
}
... | ALGO | 0.999914 | 5.989314 |
b036a237-8b2c-4999-ab4c-eccc73a401c2 | PetrAhtimirov/CPP-Basics-Yandex-Tasks | 1.5.A Passwords.cpp | #include <iostream>
#include <cctype>
#include <vector>
#include <string>
int main() {
int upper = 0;
int lower = 0;
int digit = 0;
int other = 0;
std::string password;
std::getline(std::cin, password);
if ((password.size() < 8) || (password.size() > 14)) {
std::cout << "NO";
... | ALGO | 0.999428 | 4.563552 |
7f02632a-b557-424b-bbcd-fb051864fd92 | Trinadh465/platform_frameworks_av | media/libstagefright/codecs/amrwb/src/deemphasis_32.cpp | /*
------------------------------------------------------------------------------
Filename: deemphasis_32.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-----------------------------------------------------------------------... | ALGO | 0.999759 | 5.971553 |
274f75bf-c9c3-4d98-b590-e1ad59cbd969 | kmjp/procon | csacademy/041-060/054/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999741 | 3.351515 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.