uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
281fc707-ce55-41c8-8d4a-3dc04dfb86f3 | moicez/pentaxis | pentaxis_kinematics/src/PentaxisArmKinematicsPlugin.cpp | /**
* @file PentaxisArmKinematicsPlugin.cpp
* @author Rasmus Hasle Andersen, Moises Estrada Casta/neda <<EMAIL>>
* @version 1.0
*
* @section LICENSE
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Softwar... | TOOL | 0.927977 | 6.661499 |
9ff33f88-3c66-4824-8ac7-be4a47f31ab2 | murari576/SOLVED-PBLM | Topological sort - GFG/topological-sort.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return list containing vertices in Topological order.
void solve(int node, vector<int> &vis, stack<int> &st, vector<int> adj[]){
vis[node] = 1;
for(auto it:adj[node]){... | ALGO | 0.999941 | 6.799704 |
00da4111-2432-44dd-bab6-5258c3e3d9a4 | trhgquan/CS153 | implementations/AES/AES.cpp | #include"AES.h"
AES::AES() {
// Do nothing
}
AES::~AES() {
delete[] _keyExpanded;
}
AES::AES(const char* keyInput) {
_keyExpanded = new unsigned char[INPUT_SIZE];
for (int i = 0; i < INPUT_SIZE; ++i) {
_keyExpanded[i] = keyInput[i];
}
_keyExpansion();
}
unsigned char* AES::key(... | ALGO | 0.993917 | 5.828822 |
bda90186-a848-43c1-954c-ff8d41674054 | hjiang13/LLMs-in-IR | processed_data/Decompiled_Humaneval_x_cpp_164_Result_O3/Meta-Llama-3.1-405B_Humaneval_x_cpp_164/test/CPP_98.cpp | #include <stdio.h>
#include <string.h>
#include <stdint.h>
int count_upper(const char* str) {
const char* vowels = "AEIOU";
int count = 0;
size_t len = strlen(str);
for (size_t i = 0; i < len; i++) {
char c = str[i];
if (c == vowels[0] || c == vowels[1] || c == vowels[2] || c == vowels[... | ALGO | 0.995978 | 5.759013 |
a67845fb-5736-4aef-96ec-c4a92bc09eaf | GaurishIIITNR/CP-Problems-Solutions | B_Paranoid_String.cpp | // HHM
// DATE: 02-07-2022
// TIME:11:34:49
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define dbl double
#define deb(v) cout << #v << " " << v << "\n"
#define deb2(v, k) cout << #v << " " << v << "\n" \
<< #k << " " << k << "\n"
#define vin(name, size) \
... | ALGO | 0.999606 | 4.057906 |
4de360f9-1d45-41ae-b8d5-2a404478b5fd | Akashkumar888/cpp_programming | pointers.cpp/swapusingpointers.cpp | #include<iostream>
using namespace std;
void sw(int *ptr1,int *ptr2){
int temp=*ptr1;
*ptr1=*ptr2;
*ptr2=temp;
cout<<ptr1<<endl;
cout<<ptr2<<endl;
}
int main()
{
int a=10,b=40;
sw(&a,&b);
cout<<&a<<endl;
cout<<&b<<endl;
cout<<a<<" "<<b<<endl;
return 0;
}
| ALGO | 0.999377 | 3.555125 |
5343d4b0-c8e9-4f9a-b559-c3802f6a4dac | SanjayYr/APPMPs | MP4-1_Submission/vector_reduction_gold.cpp | #include <stdio.h>
#include <math.h>
//#include <float.h>
////////////////////////////////////////////////////////////////////////////////
// export C interface
extern "C"
void computeGold( unsigned int* reference, unsigned int* idata, const unsigned int len);
////////////////////////////////////////////////////////... | ALGO | 0.990447 | 4.434791 |
26ecbc7e-5c83-4ffd-b145-fce4c1496525 | anmolp14/summer17_codes | crack/1.arrays&strings/q.cpp | vector<int> Solution::maxset(vector<int> &A) {
int n = A.length();
int maxa = 0;
int tempa = 0 ;
int ls=0,h=0,l;
for( int i=0; i<n ; i++)
{
if( A[i] < 0 )
{
if( maxa <= tempa)
{ if(maxa < tempa)
{
l = ls;
h = i-1;
maxa = tempa
}
else
{
if( i-1-ls > h-l)
{
... | ALGO | 0.999867 | 4.800764 |
aadcef6a-b2fd-4f52-9087-c1127fd534d1 | sardothien/MATF-materijali | 2. godina/aisp vezbe/jan1_2019/2.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define MAX (100)
void maxKvadrat(int mat[MAX][MAX], int m, int n){
int dp[n];
int max = 0;
for(int j = 0; j < n; j++){
dp[j] = mat[0][j];
if(dp[j] > max)
max = dp[j];
}
int l = 1;
for (int i = 1; i < m; i++) ... | ALGO | 0.999928 | 3.134393 |
052db1ee-fa82-4bea-96d1-14c33ab2a0ac | agraef/purr-data | externals/grill/trunk/dct/main.cpp | #ifdef _REENTRANT
#undef _REENTRANT
#endif
#include <flext.h>
#include <cstdlib>
#include <blitz/array.h>
namespace {
using namespace blitz;
class dct
: public flext_base
{
FLEXT_HEADER_S(dct,flext_base,setup);
public:
dct(int nc)
: nceps(nc)
{
AddInAnything();
AddOutLis... | TOOL | 0.974458 | 4.793991 |
5e1cfbb0-f69f-4e17-86c7-bc2d5f8e5404 | jccarvalhosa/maratona | spojbr/nuvemmg.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
#define INF 1000000000
using namespace std;
int main()
{
int pd[500][500], v[1000];
vector<pair<int, int> > vd;
int N, L, i, j, k, d, val, resp, custo;
while(scanf("%d%d", &N, &L) && N)
{
vd.clear();
for(i=0;i<N;i++) scanf("... | ALGO | 0.999856 | 3.156179 |
ec542284-20dd-49bd-856e-a96033d88789 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p01547/384629378/response_8.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
typedef double D;
typedef std::complex<D> P;
typedef std::pair<P, P> L;
typedef std::vector<P> VP;
typedef std::vector<VP> Vcon;
const D EPS = 1e-7;
D cross(P a, P b) { return (std::conj(a) * b).imag(); }
int ccw(P a, P b, P c) {
b -= a;... | ALGO | 0.999854 | 4.228154 |
b5744bf5-c879-4ddd-9d7b-3d69cab5dead | Kribon/zemoso-campus-training | Quiz/Question_1/convert.cpp | #include <iostream>
using namespace std;
string ones[] = { "", "one ", "two ", "three ", "four ",
"five ", "six ", "seven ", "eight ",
"nine ", "ten ", "eleven ", "twelve ",
"thirteen ", "fourteen ", "fifteen ",
"sixteen ", "seventeen ", "eighteen ... | TOOL | 0.98275 | 3.496941 |
ba4f9ddc-e759-4a8b-aef5-686b4d5b82fc | iamjay/Qt | tests/arthur/common/lookup3.cpp | /*
These functions are based on:
-------------------------------------------------------------------------------
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
These are functions for producing 32-bit hashes for hash table lookup.
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
are extern... | ALGO | 0.998558 | 6.062126 |
b68d7c4f-a1c9-4bc4-9b74-a26a2fc77482 | bracci/Qlockthree | Transitions.cpp | /**
* Transitions.cpp
* Transitionen bei Wechsel Zeitmatrix
*
* @mc Arduino/UNO
* @autor Manuel Bracher / <EMAIL>
* @version 1.0
* @created 19.05.15
*
* Versionshistorie:
* V 1.0: - Erstellt.
*/
#include "Transitions.h"
byte Transitions::_counter;
word Transitions::_usedColumns;
byte Transition... | ALGO | 0.871792 | 3.894579 |
8123b275-4a2f-4d56-b895-2fd002841aaf | Youssef-M-Salama/Jonior-Exam-Challange | G. The Adventure of the Number Quest.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
signed main()
{
double n, sum = 0; // Declare variables: n for the input, sum to store the result
cin >> n; // Take input n
// Loop ... | ALGO | 0.999917 | 5.44978 |
fc7d962a-0772-4bd3-80eb-099062329387 | ishandutta2007/codeforces | quailty/normal/1294/B.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN=1005;
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int n;
scanf("%d",&n);
vector<pair<int,int>> e(n);
for(int i=0;i<n;i++)
scanf("%d%d",&e[i].first,&e[i].second);
sort(e.begin(),e.end());
... | ALGO | 0.999972 | 3.653112 |
391365ef-7ab6-4106-8027-efea716014e8 | ishandutta2007/codeforces | fengzhengwei/normal/884/D.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
char gc(){static char buf[1<<16],*s,*t;if(s==t){t=(s=buf)+fread(buf,1,1<<16,stdin);if(s==t)return EOF;}return *s++;}
//#define getchar gc
ll read()
{
char c;
int w=1;
while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
ll ans=c-'0';
while((c=getchar())>=... | ALGO | 0.999993 | 3.702305 |
41427be9-7003-4da1-8aa2-d20768cf57b2 | JooHui-void/algorithm | 2239.cpp | #include <stdio.h>
int sdoku[9][9];
int tmp;
int check(int x,int y,int k){
if(tmp){
return 0;
}
for(int i=0;i<9;i++){
if(sdoku[i][y]==k||sdoku[x][i]==k){
return 0;
}
}
int n=x-x%3;
int m=y-y%3;
for(int i=n;i<n+3;i++){
for(int j=m;j<m+3;j++){
if(sdoku[i][j]==k){
return 0;
}
}
}
return 1... | ALGO | 0.999928 | 4.194448 |
7e0eda78-4c2c-49f9-998b-9f2d5aff4361 | rotarymars/atcoder_submissions | arc009/arc009_1/arc009_1.cpp | #include <iomanip>
#include <iostream>
using namespace std;
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
long double ans = 0;
for (int i = 0; i < n; i++) {
long double a, b;
cin >> a >> b;
ans += a * b;
}
cout << (int)(ans * 1.05) << endl;
return 0;
... | ALGO | 0.997217 | 3.85135 |
564e80ad-e4c3-41f0-a9f3-54010040af19 | marxvdl/hmmpred | src/Hmm.cpp | #include "Hmm.h"
#include "mappings.h"
#include <cassert>
#include <cmath>
#include <string>
bool performedReduxAlready = false;
void printVec2(vector<byte>& v){
cout << "{";
for(uint i=0; i<v.size(); i++)
cout << " " << REV_SEC_STRUCT[v[i]];
cout << " }\n - - - - ' - - -\n ";
for(uint i=0; i<v.size(); i++)
... | ALGO | 0.971814 | 3.922205 |
b007f62d-e3af-4d79-b081-804eccf7fff8 | santiagoladavaz/HuffmanTree | HuffmanTreeTest.cpp | #include <iostream>
#include "assert.h"
#include "HuffmanTree.h"
using namespace std;
void testLeaf(){
HuffmanTree leaf1 = leaf('a',1);
assert(weight(leaf1) == 1);
deleteHuffmanTree(leaf1);
std::cout << "testLeaf - OK" << std::endl;
}
void testBinary(){
HuffmanTree leaf1 = leaf('a',1);
Huf... | TEST | 0.88507 | 4.31775 |
c7c09cd6-4032-4d05-a3e2-366d6a19ce0b | Hovhannisyan03/CPP-OOP-Algorithms | Algorithms/sort/selectionSort/RecSelectionSort.cpp | #include <iostream>
int findMaxIndex(const int* arr, int size)
{
int index = 0;
for(int i = 1; i < size; ++i)
{
if(arr[i] > arr[index])
{
index = i;
}
}
return index;
}
void SelectionSort(int *arr, int size)
{
if(size <= 1)
{
return;
}
i... | ALGO | 0.999905 | 4.988854 |
160be3ec-55f5-4d14-8be5-d6487f3cd0a9 | nata-0419/podstawy_programowania_c.. | lab.IX/zad.4/main.cpp | /*
4. Napisz program, ktry zapisuje wartoci funkcji f(x)=2x-5 do tablicy n-elementowej
dla x zakresu [-2,6]. Wypisz otrzyman tablic. Dane przekazuj przez wskanik.
*/
#include <iostream>
#include <cmath>
using namespace std;
void wczytajRozmiar(int& n) {
cout << "Podaj rozmiar tablicy (n): ";
cin >> n;
}
vo... | ALGO | 0.986813 | 5.131589 |
69ff99b6-b4fe-4fc2-9809-54d84bb7863e | ZZAMBAs/baekjoon | graph/bfs/problem_25417.cpp | /*
//
// Created by cho on 23. 6. 1.
//
#include <iostream>
#include <queue>
using namespace std;
int r, c, board[5][5];
int dr[4] = {1, 0, -1, 0}, dc[4] = {0, 1, 0, -1};
bool visited[5][5];
bool inRange(int row, int col){
if (row >= 0 && row < 5 && col >= 0 && col < 5)
return true;
return false;
}
... | ALGO | 0.999883 | 4.521919 |
5f02bb62-9788-4234-9e62-7a6717ae4632 | Shivanigupta1970/c-programs | whileoddeven.cpp | #include <stdio.h>
main()
{
int i=0;
while (i<10)
{
if (i%2==1)
{
printf("%d\n",i);
}
i++;
}
}
| ALGO | 0.993289 | 3.004198 |
1460010d-878a-466b-aa99-2932db7feb4e | ksood2004/gfg-solution | Difficulty: Medium/Kth Smallest/kth-smallest.cpp | // User function template for C++
class Solution {
public:
// arr : given array
// k : find kth smallest element and return using this function
int kthSmallest(vector<int> &arr, int k) {
int n=arr.size();
priority_queue<int> pq;
for(int i=0;i<n;i++){
if(pq.size()<k){
... | ALGO | 0.999888 | 5.201318 |
db1c72be-732b-452d-ba46-aaae66237e7d | naimurnemu/Problems_solved_with_cpp | All the beginnings/vector_stack_problem_4.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int len;
cin >> len;
vector<int> v(len);
for (int i = 0; i < len; i++)
{
cin >> v[i];
}
stack<int> st;
for (int i = len - 1; i >= 0; i--)
{
int max = 0;
for (int j = i + 1; j < len; j++)
{
if (v[j] > max)
max =... | ALGO | 0.999956 | 3.797962 |
d7e03d49-6535-4c66-8d2b-6a4dc352b464 | avadheshgithub/DSA_Learning | 16. Stacks/04. Leetcode/11. Leetcode 85/MaximalRectangle.cpp | /*
## MAximal Rectangle [Leeetcode 85]
// connected with histrogram problem of [Leetcode 84]
and additional some logic for calculated the max area
*/
/*class Solution {
public:
int largestRectangleArea(vector<int>& arr) {
int n = arr.size();
// Step 01 - Calculate the NSI... | ALGO | 0.999862 | 6.955235 |
dba760a2-3e4e-48cb-911f-89532977ec0c | jesuswr/cp-codes-and-problems | F.moving_points.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<i... | ALGO | 0.999841 | 3.855414 |
59f57f5f-fe8d-49f5-a055-114eeb98758f | a-farooq/ProblemsAndSolutions | DataStructuresAndAlgorithms/linkedList/longest-palindrome-length.cpp | /****
Given a linked list, the task is to complete the function maxPalindrome() which returns an integer denoting the length of the longest palindrome list that exist in the given linked list.
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first l... | ALGO | 0.998985 | 6.173152 |
5e50d29c-e943-4e60-8f19-6b27c462773c | MANISHDUTT224/LeetCode | 0905-length-of-longest-fibonacci-subsequence/0905-length-of-longest-fibonacci-subsequence.cpp | class Solution {
public:
int lenLongestFibSubseq(vector<int>& arr) {
int dp[1000][1000];
const int n=arr.size();
fill(&dp[0][0],&dp[0][0]+n*1000,2);
unordered_map<int,int>mp;
mp.reserve(n);
for(int i=0;i<n;i++){
mp[arr[i]]=i;
}
int ans=0;
... | ALGO | 0.999893 | 5.410048 |
20fe2d8c-89ab-4556-90ba-2d168b49625f | jfgout/circseq-seqan2 | CS_Consensus/source/CS_Consensus.cpp | #include "CS_Consensus.hpp"
#include <iostream>
CS_ConsensusPosition::CS_ConsensusPosition(){
this->cs_ = 'N';
this->csQual_ = 0;
this->altQual_ = 0;
this->depth_ = 0;
this->vCalls_.resize(INIT_DEPTH);
this->vQuals_.resize(INIT_DEPTH);
//std::cerr<<"RESERVING...\n";
}
bool CS_ConsensusPosition::init(st... | ALGO | 0.973049 | 4.984453 |
bca7411a-0cf0-471a-972b-791fa2166c71 | ishandutta2007/codeforces | ashishgup/normal/1472/B.cpp | //Trying to screencast
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N = 105;
int n;
int a[N];
int32_t main()
{
IOS;
int t;
cin >> t;
while(t--)
{
cin >> n;
for(int i = 1; i <= n; i++)
cin ... | ALGO | 0.999962 | 4.574625 |
e094a194-633a-4369-82c1-1769fa99171b | alacine/homework | 202_197_224_59/ex2/1263.cpp | // 矩形的面积并
#include <cstdio>
#include <algorithm>
using std::min;
using std::max;
int x1, y1, x2, y2;
int x3, y3, x4, y4;
void reload(int &xa, int &ya, int &xb, int &yb) {
int xl = min(xa, xb);
int xr = max(xa, xb);
int yd = min(ya, yb);
int yu = max(ya, yb);
xa = xl, xb = xr;
ya = yd, yb = yu... | ALGO | 0.994332 | 3.350145 |
f4c7cf2c-2e47-4f6a-aa43-329287b35254 | Huyen0306/2025 | MaxMin/MaxMin.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector <int> v(n);
for (auto &i : v) {
cin>>i;
}
// Đi tìm max và min
int maxValue = *max_element(v.begin(), v.end());
int minValue = *min_element(v.begin(), v.end());
cout<<maxValue;
cout<<minVa... | ALGO | 0.999927 | 3.943317 |
f28fa531-cc74-4723-b623-d61e01760014 | Rudy451/cpp_primer | ex2.41.2.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include "Sales_data.h"
int i = 1;
Sales_data item;
std::vector<std::string> BOOK;
std::string ask = "Please enter Book ID";
std::string zero = "0";
int main()
{
std::cout << ask << std::endl;
while(std::cin >> item.book_id){
BOOK.resize... | ALGO | 0.983876 | 4.441006 |
18b2077c-f033-4433-bb3f-2d2e5c10c90a | ishandutta2007/codeforces | shubham__36/normal/1195/A.cpp | #include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
using namespace std;... | ALGO | 0.999977 | 3.572477 |
1018b590-6ea4-41b4-908b-3ce88e4ec178 | MohamedElbashar/ProblemSolving-Archive | shageer sheets/Sagheer specialist sheet/[SP] Dynamic Programming/DP[1]/Topic/10003 - Cutting Sticks [top-down].cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pi> vpi;
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define ... | ALGO | 0.999725 | 3.672287 |
85dd8b2e-1a15-41e4-b4c4-d7c4bed86be5 | timonella/zx-bober | ConsoleApplication5/ConsoleApplication5/ConsoleApplication5.cpp | // ConsoleApplication5.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <random>
using namespace std;
int main()
{
//setlocale(ALL_)
random_device RAND;
int sum = 0;
int x[1] = { 5 };
int* px=x;
cout << "Enter size of array:";
int si... | TOOL | 0.92311 | 4.045423 |
6587c6c0-9d89-4330-9ba1-e8f4ec9f03f9 | unsortedkgpian/CPP-Practice | Longest_AP_AZ101.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
int a[n];
for(int i =0;i<n;i++){
cin>>a[i];
}
int ans = 2;
int temp = 2;
if(n == 2){
cout<<2<<endl;
return;
}
for(int i=2;i<n;i++){
if( a[i] + a[i-2] == 2*a[i-1] ){
temp ++;
ans = max(ans, temp);
}else{
ans = max(an... | ALGO | 0.998578 | 4.50478 |
5c956bf4-551d-4f12-a70c-032e330d7272 | Somprakash04/LeetCode | 217-contains-duplicate/contains-duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_set<int> seen;
for (int num : nums) {
if (seen.find(num) != seen.end()) {
return true; // Duplicate found
}
seen.insert(num);
}
return false;
... | ALGO | 0.999661 | 6.664372 |
a78b0ce2-76c8-4a45-b3c7-13b3d4899e27 | navyaajainnn/Cpp | C++/triangle_pattern.cpp | // #include <iostream>
// using namespace std;
// int main()
//{
// int n = 4;
// int i = 1;
// while (i <= n)
// {
// int j = 1;
// while (j <= i)
// {
// cout << "*";
// j++;
// }
// cout << endl;
// i++;
// }
// return 0;... | ALGO | 0.999859 | 3.554591 |
f2d47627-ff50-4675-870f-69c80fc73618 | Fazle-Rakib/Project-150-2017831030 | Type 1/TopSort/topSort.cpp | #include<bits/stdc++.h>
using namespace std;
#define SZ 100
vector <int> graph[SZ];
bool visited[SZ];
stack <int> stk;
void DFS(int now)
{
visited[now] = true;
int i, to, k;
k = graph[now].size();
for(i=0;i<k;i++)
{
to = graph[now][i];
if(visited[to] == false)
{
... | ALGO | 0.999977 | 4.490364 |
6a0bc4a8-dd49-4df4-98c5-2059e1b8074b | Saksham-Mishra03/StriversA2Z-solutions | Dynamic Programming/DP on LIS/Longest Increasing Subsequence.cpp | class Solution {
public:
/* -----------recursive solution-------------------------------------------------
int recur(vector<int>&nums, int ind, int pre)
{
if(ind>=nums.size())
return 0;
int inc = 0;
if(nums[ind]>pre)
inc = 1+ recur(nums,ind+1, nums[ind]);
int exc... | ALGO | 0.999995 | 5.863468 |
ab4b6d9a-9e99-4269-902e-845db1f952e4 | umutoztunc/usaco-training | palsquare/palsquare.cpp | /*
ID: umutozt1
TASK: palsquare
LANG: C++14
*/
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;
char digits[20] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};
bool is_palind... | ALGO | 0.998604 | 4.020862 |
cd3631db-6acb-451c-90e4-2ac56201e5ad | Karma-1710/DSA_Cpp | Arrays/06_Operations_on_Array.cpp | #include<iostream>
using namespace std;
class Array{
private:
int size;
int length;
int* A;
public:
Array(int size);
int getLength() {return length;}
void Create();
void Display();
int Get(int index);
void Set(int index, int value);
... | ALGO | 0.972937 | 4.395923 |
736d5b3c-1b68-4a4f-87a5-9ebe7ae23e88 | swatejsonawane18/DSA_SEM3 | Sentence.cpp | #include <iostream>
using namespace std;
class Sentence
{
char st[200];
public:
void read();
void display();
void copy(Sentence);
int length();
Sentence concat(Sentence);
int substr();
void reverse();
int compare();
int palin();
Sentence del();
};
void Sentence::read()
{
cin>>st;
}
void Sentence::dis... | TOOL | 0.939905 | 3.45106 |
2473c77d-39aa-445d-8bf2-d9347ebd0b88 | tjkendev/procon-library | cpp/binary_search_tree/avl-tree.cpp | #include<algorithm>
using namespace std;
template<typename T>
class AVLTree {
struct Node {
Node *left, *right, *prt;
T key;
int height, size;
Node(T x) {
left = right = prt = nullptr;
height = 1;
key = x;
size = 1;
}
inline int factor() const {
int lv = (this-... | ALGO | 0.999862 | 5.092863 |
b3e32a55-413f-406b-b17a-fd10f479694e | DecryptAG/-CrackYourPlacement | Day20/Construct Tree from Preorder Traversal.cpp | // https://www.geeksforgeeks.org/problems/construct-tree-from-preorder-traversal/1
//{ Driver Code Starts
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int x){
data = x;
left = NULL;
right =... | ALGO | 0.99995 | 5.683077 |
5a8e6e4f-8cb2-495c-8920-9916dc1289e0 | mrsarthak001/c-program | c++ program/program-2.cpp | #include<iostream>
using namespace std;
class XYZ
{
public:
float bs,da,hra,GS,TAX;
XYZ(float a, float b, float c)
{
bs=a;
da=b;
hra=c;
process();
}
void process()
{
... | ALGO | 0.993648 | 3.349201 |
6bd2146d-fce3-4dc5-8ccf-bc85b4528437 | joaopbmarins/if672-algorithms | listas/HashIt.cpp | #include <iostream>
using namespace std;
#define endl "\n"
int h(string key){
int sum=0;
for(int i = 0;i<key.size();i++){
sum += 19 * key[i] * (i+1);
}
return sum % 101;
}
typedef struct{
string key;
int value;
}HT;
int count = 0;
int Find_HT(HT **table, string key){
int index = ... | ALGO | 0.999285 | 4.698373 |
15d0c1df-a998-44cd-a665-99eb448933c6 | Roman-n/xray-csky_borscht_sdk | plugins/lw/Export/scenscan/ptsearch.cpp | #include "stdafx.h"
/*
======================================================================
ptsearch.c
Functions for searching an ObjectDB point array by coordinate value.
This is useful when you need to be able to quickly find a point in the
object database by matching a position. An auxiliary array of point
inde... | ALGO | 0.999817 | 6.610915 |
91a34eeb-50c4-4441-a74d-f3b006826cae | hyeongjin-kim/coding-study | [05_14]파이프_옮기기 2/강진규.cpp | #include <iostream>
using namespace std;
bool arr[32][32];
long long dp[32][32][3];
int N;
int main(void) {
cin >> N;
for (int i = 0;i < N;++i)
for (int j = 0;j < N;++j)
cin >> arr[i][j];
dp[0][1][0] = 1;
for (int i = 0;i < N;++i) {
for (int j = 0;j < N;++j) {
if (j + 1 < N && !arr[i][j + 1])
dp[i]... | ALGO | 0.999883 | 3.6051 |
96f52a1c-488a-48bb-9360-62daf1c8bb38 | srikanthmalipatel/Spoj-Problems | PRIME1-6435235-src.cpp | #include<stdio.h>
#include <iostream>
using namespace std;
void sieve(long long int L,long long int U)
{
long long int i,j,d,count;
d=U-L+1; /* from range L to U, we have d=U-L+1 numbers. */
/* use flag[i] to mark whether (L+i) is a prime number or not. */
bool *flag=new bool[d];
for (i=0;i<d;i++) flag[i]=true;... | ALGO | 0.999447 | 3.418308 |
8978225f-cc5c-44d2-9de0-d57896a73e3c | feof81/morganaPublic | tests/morganaPgraph/pGraphGlobalManipTest4.cpp | #include <cmath>
#include <iostream>
#include <boost/mpi.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include "pMapItem.h"
#include "pMap.hpp"
#include "pVect.hpp"
#include "pVectComm.hpp"
#include "pGraphItem.h"
#include "pGraph.hpp"
#include "pGraphManip.hpp"
#include "pGraphCo... | ALGO | 0.998414 | 5.189784 |
21abf4e5-3f4c-408f-9284-42ae7f9dd912 | ibrahimmm999/pt-sree | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998784 | 6.761023 |
5d8e763c-7c76-4db3-9b94-ade9a7bc4bc9 | nihal866/Codeforces_Questions | C_Grandma_Capa_Knits_a_Scarf.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define fri(i, a, b) for(int i = a; i < b; i++)
#define frd(i, a, b) for(int i = a; i >= b; i--)
#define g(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/g(a,b)
#define vll vector<int>
#define lb(v,key) lower_bound(v.begin(), v.end(), key)
#define ub(v,key)... | ALGO | 0.999407 | 4.422981 |
2ab1a1df-dfd5-407a-b084-b1c36221929c | aadits1965/CODEFORCES | LEVEL B/B_Rule_of_League.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while (t--) {
int n, x, y,count=0;
cin >> n >> x >> y;
if ((x == 0 && y == 0) || (x != 0 && y != 0)) {
cout << "-1" << endl;
continue;
}
int step = (x != 0) ?... | ALGO | 0.999964 | 3.761568 |
466c1880-eb66-4b31-be7e-8b3d84310116 | Balpreet1003/LeetCode | 2901-longest-unequal-adjacent-groups-subsequence-ii/2901-longest-unequal-adjacent-groups-subsequence-ii.cpp | class Solution {
public:
bool differByOneChar(string word1, string word2) {
if (word1.length() != word2.length()) return false;
int diffCount = 0;
for (int i = 0; i < word1.length(); i++)
diffCount += word1[i] != word2[i];
return diffCount == 1;
}
vector<str... | ALGO | 0.999984 | 6.009027 |
134aecd2-2b12-455e-a9ec-d30ee22f908b | iamakashrout/Competitive-Programming | CodeChef/Starters 128/b.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
const ll mod=1e9+7;
void solve(){
ll n;
cin>>n;
vector<ll> a(n);
for(ll i=0; i<n; i++){
cin>>a[i];
}
vector<ll> v;
for(ll i=1; i<n; i++){
if(a[i]<a[i-1]){
v.push_back(i);
... | ALGO | 0.999997 | 4.232088 |
d9a80177-e314-43cf-8509-a6c403a3f9aa | sadramanouch/leetcode | 0763-partition-labels/0763-partition-labels.cpp | class Solution {
public:
vector<int> partitionLabels(string s) {
int n = s.size();
vector<int> result;
unordered_map<char, int> lastOccurrence;
for (int i = 0; i < n; i++) {
lastOccurrence[s[i]] = i;
}
int start = 0; // Start of the current partition
... | ALGO | 0.999742 | 6.799603 |
7ca79a92-0101-411d-912f-adca21501130 | ishandutta2007/codeforces | arbuzick/normal/1680/A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int l1, r1, l2, r2;
cin >> l1 >> r1 >> l2 >> r2;
if (max(l1, l2) <= min(r1, r2)) {
cout << max(l1, l2) << '\n';
} else {
cout << l1 + l2 << '\n';
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(null... | ALGO | 0.999724 | 4.109918 |
42aaa65a-3967-4ed6-9f00-12be0a4be8a4 | Kriti0802/LeetCode-Practice | Check_If_a_Word_Occurs_As a_Prefix_of_Any_Word_a_Sentence.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int isPrefixOfWord(string sentence, string searchWord) {
vector<string>x;
int i;
sentence+=" ";
string str="";
for(i=0;i<sentence.length();i++)
{
if(sentence[i]==' ')
{
... | ALGO | 0.99979 | 4.551319 |
587d8266-ebe6-446c-99e0-3f56f8a6f652 | harshkrt/DSA | Heap/heapCollection.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
class Collection
{
private:
int *data;
int size;
int maxLength;
public:
Collection()
{
data = NULL;
size = 0;
}
Collection(int maxLength = -1)
{
this->maxLength = maxLength;
this->size = 0;
... | ALGO | 0.999962 | 5.232527 |
e9b976a7-ee94-4800-b988-6a6dc5d6a432 | ishabhray/Competitive-Programming | atcoder/m_solutions2020_a.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll... | ALGO | 0.999621 | 3.492333 |
5b1d66f7-3433-433b-b0e1-5d0839855d8c | SachinGoyal94/cpp | lab assignments/lab 7/5_time.cpp | #include<bits/stdc++.h>
using namespace std;
class times
{
private:
int h,m,s;
public:
times(int x=0,int y=0,int z=0)
{
h=x;
m=y;
s=z;
}
times operator+(times & d)
{
s+=d.s;
if(s>=60)
{
s%=60;
m++;
}
... | ALGO | 0.93805 | 3.662747 |
139d9cda-0f36-4dd3-9334-5af66a6903c9 | dedoardo/polyfit | source/polyvec/regularity/add_90_degree_edges.cpp | // polyvec
#include <polyvec/regularity/add_90_degree_edges.hpp>
#include <polyvec/core/log.hpp>
#include <polyvec/geometry/path.hpp>
#include <polyvec/geometry/angle.hpp>
#include <polyvec/geometry/raster.hpp>
#include <polyvec/utils/matrix.hpp>
// libc++
#include <unordered_map>
#include <algorithm>
using namespace... | ALGO | 0.998491 | 7.565025 |
8d5fff20-b164-4410-bdc2-2ebed3cf0e26 | RifkideoWinada/strukdat | tugas/latihan4.no1.cpp | #include <iostream>
#include <cctype>
int main() {
std::string input;
std::cout << "Enter a sentence: ";
std::getline(std::cin, input);
int vowels = 0, consonants = 0, numerics = 0;
for (char c : input) {
if (std::isalpha(c)) {
if (c == 'a' || c == 'i' || c == 'u' || c == 'e' ... | TOOL | 0.982801 | 5.464595 |
81e361c0-48bc-471b-91bd-f2ef7487eb3a | ShrutiRani7029/Grid_dfs.cpp | number of islands.cpp | #include<bits/stdc++.h>
using namespace std;
void dfs(int i,int j,vector<vector<char>>&grid,int vis[][600],int n,int m)
{
if(i<0 || j<0 || i>=n || j>=m || grid[i][j]=='0')return;
if(!vis[i][j]){
vis[i][j]=1;
dfs(i+1,j,grid,vis,n,m);
dfs(i-1,j,grid,vis,n,m);
dfs(i,j-1,grid,vis,n... | ALGO | 0.999646 | 5.691635 |
947b0b15-6817-45c3-9e3c-930b8c795c21 | rohitshakya/CodeBucket | 1. Placements/7. Stack_Queue/4. RemoveAdjacentSimilarArray.cpp | /*
* Author : Rohit Shakya
* Date : July-2020
* Compiler : g++ 4.9.2
* Flags : -std=c++14
* Time complexity : O(n)
* Title : remove adjacent similar elements
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v={2,3,-5,5,6,3};
stack<int> st;
for(int i=0;i<v.size();i++)
{
if(!... | ALGO | 0.999941 | 5.089769 |
d306f40f-7341-47f9-8ee4-bc1f0a4d5c24 | nickbetsworth/Image-Classifier | library/NodePositioner.cpp | #include "NodePositioner.h"
#include "Histograms.h"
#include "ogdf/basic/GraphAttributes.h"
#include "ogdf/tree/TreeLayout.h"
#include "ogdf/energybased/FMMMLayout.h"
NodePositioner::NodePositioner(Graph* graph)
{
m_graph = graph;
}
NodePositioner::~NodePositioner()
{
}
map<Node, cv::Point> NodePositioner::get_node... | ALGO | 0.975611 | 5.845696 |
ed90ddf7-2bc0-4e52-a3f8-3845c281ed86 | PixelExperience/external_libcxx | test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval_param.pass.cpp | // <random>
// template<class IntType = int>
// class discrete_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <vector>
#include <cassert>
int main()
{
{
typedef std::discrete_distribution<> D;
typedef D::param_type P;
... | TEST | 0.965233 | 4.139297 |
38ff8987-ab49-4c68-9a83-998968e93003 | krisnamughni24/VST | DelayStereo/JuceLibraryCode/modules/juce_audio_basics/effects/juce_IIRFilter.cpp | #if JUCE_INTEL
#define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8f || n > 1.0e-8f)) n = 0;
#else
#define JUCE_SNAP_TO_ZERO(n)
#endif
//==============================================================================
IIRCoefficients::IIRCoefficients() noexcept
{
zeromem (coefficients, sizeof (coefficients));
}
IIR... | ALGO | 0.865983 | 6.028095 |
2ff68256-86e6-41de-8591-01ad38f52987 | angele34/cpsolutions | Uncategorized/Week3/1744A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int n; cin >> n;
int arr[n];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
string s; cin >> s;
bool possible = true;
for (int i = ... | ALGO | 0.99993 | 4.721781 |
70e231de-7634-4ae7-aa72-dff0bae62762 | Shantanupawar77/CPP | Bit_Manipulation/12_gcd.cpp | #include<iostream>
using namespace std;
int gcd(int a,int b){
while(b!=0){
int rem=a%b;
a=b;
b=rem;
}
return a;
}
int main(){
int a,b;
cout<<"Enter a:";
cin>>a;
cout<<"Enter b:";
cin>>b;
cout<<gcd(a, b);
return 0;
} | ALGO | 0.997956 | 4.209019 |
e4bcd19d-a331-48cb-a259-c7e11694ccae | OpenCalib/LiDAR2INS | eigen3/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999831 | 3.519938 |
d21cc217-3178-4134-b685-c2b77b5d5fe8 | jenny456/cpsolutions | leetcode/may challenge/OnlineStockSpan.cpp | class StockSpanner {
public:
StockSpanner() {
}
stack< pair<int,int>> st;
int next(int price) {
int idx=1;
while(!st.empty() && st.top().first<= price)
{
idx=idx+st.top().second;
st.pop();
}
st.push(make_pair(price,idx));
... | ALGO | 0.998519 | 6.068002 |
aa1a46a1-b25e-418b-950d-c6bdeb1028d1 | CodeAnt626/learning | c++/std/template_swap.cpp | /*************************************************************************
> File Name: template_swap.cpp
> Author: CodeAnt626
> Mail: <EMAIL>
> Created Time: Fri 20 Nov 2020 09:35:35 PM CST
************************************************************************/
#include <iostream>
using namespace std;
template... | ALGO | 0.998616 | 4.957749 |
78427242-2982-449a-b019-fe2d48cb14c0 | obiwac/freebsd-gsoc | contrib/llvm-project/llvm/lib/Transforms/Utils/LoopPeel.cpp | #include "llvm/Transforms/Utils/LoopPeel.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/Sca... | ALGO | 0.902137 | 5.523769 |
b141d005-f145-4f5f-b881-d880b4416c28 | jahangir1x/numerical-lab | 11a_newton_divided.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* /\F(Xn+1) = (F(Xn) - F(Xn-1))/(Xn) - (xn-1)
* F(X) = f(X0) + (X-X0)/\F(X0) - (X-X0)(X-X1)/\^2F(X0) + (X-X0)(X-X1)/\^3F(X0)...
*/
class NewtonsDividedDifferenceInterpolationFormula {
private:
public:
int n;
double x[100], y[100][100];
double at;
... | ALGO | 0.999649 | 4.143037 |
476bffae-e092-4dec-b417-fd7a1007e9b7 | atef7534/codeforces1000 | #180 Elections/solve.cpp | #include <iostream>
#include <algorithm>
#include <vector>
int main(void)
{
int tt;
std::cin >> tt;
while (tt--)
{
int a, b, c;
std::cin >> a >> b >> c;
std::vector<int> v{a, b, c};
std::sort(v.begin(), v.end());
if (v[0] == v[2])
std::cout << "1 1 1\n";
else if (v[1] == v[2])
... | ALGO | 0.999969 | 3.993442 |
6aeffe8c-e4d0-4309-a24c-ffcfdc50370b | amanpoddar375/LeetCodePOD | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int i = 0;
int j = 1;
while(j < nums.size())
{
if(nums[j]==nums[i])
j++;
else
nums[++i] = nums[j++];
}
return i+1;
}
}; | ALGO | 0.999855 | 6.144846 |
0a8066a2-10e5-4d43-a470-58febc1a78a4 | Hanthebot/Fast-Polynomial-Evaluation | fft_finite/fft.cpp | #include "fft_finite.h"
using namespace std;
// replaced by example's rev construction
// u32 find_ind(u32 w_exp, u32 modulus) {
// u32 ind = 0;
// for (u32 i = (modulus >> 1); w_exp && i > 0; i >>= 1) {
// if (w_exp % 2) ind |= i;
// w_exp >>= 1;
// }
// return ind;
// }
/**
@par... | ALGO | 0.999939 | 4.035864 |
d54bcb93-eed2-49f2-b8cb-410e29860b53 | Redleaf23477/ojcodes | acmicpc/2021-CCPC/L.cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long int;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
LL n, m, x, y; cin >> n >> m >> x >> y;
vector<LL> arr(m);
for (auto &x : arr) cin >> x;
LL ans = 0, left = 0;
// first
if (!arr.empty()) {
if (arr.front() >... | ALGO | 0.999879 | 3.83215 |
dc7a76a2-d259-4e48-8eae-facc3155372e | HaterYuumi/Sortirovochki | Хоар2.cpp | #include <algorithm>
#include <bitset>
#include <iostream>
#include <ctime>
#include <cmath>
using namespace std;
class Array {
int* a;
size_t n;
public:
Array(int* arr, int len) {
n = len;
a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = arr[i];
}
}
... | ALGO | 0.999924 | 4.748359 |
e627b7e8-36f3-411f-980d-bef9b9b68972 | n-miyamoto/training | ATC/abc379/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
int q;
cin >> q;
ll count = 0;
vector<ll> plants;
ll harvested = 0;
for(int i=0;i<q;i++){
int qi;
cin >> qi;
switch (qi)
{
case 1:
plants.push_back(count);
break;
case 2:
ll t;
cin >> t;
count += t;
... | ALGO | 0.999833 | 4.01177 |
c5435bde-7c85-4289-b184-d080f44cf685 | mengxu98/ImmuCycReg-framework | code/functions/compute_expression_vector.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector compute_expression_vector(DataFrame weightDT, NumericMatrix rawMatrix) {
// Get column names from rawMatrix
CharacterVector rawMatrixColNames = colnames(rawMatrix);
CharacterVector colnames = weightDT.names();
colnames[0] = "regulator... | ALGO | 0.998961 | 5.980525 |
fbcab78c-fe61-4fce-9c6b-de301294de8e | kunalsahdeveloper/DSA | Array/checkArrSorted.cpp | #include<iostream>
using namespace std;
bool checkSorted(int arr[], int n){
if(n==0 || n==1)
return true;
for(int i=1; i<n; i++){
if(arr[i-1] < arr[i]){
return false;
}
}
return true;
}
int main(){
// int arr[] = { 20, 23, 23, 45, 78, 88 };
// int n = siz... | ALGO | 0.999919 | 3.70069 |
1b1a3af1-a68f-4fc5-97c7-8aeba41f1d01 | yasmws/Algorithms | Lista1/a.cpp | #include "stdio.h"
#include "stdlib.h"
#include "stdbool.h"
#include "string.h"
#include "math.h"
#include<stdio.h>
#include<stack>
#include<vector>
#define UNVISITED 0
#define VISITED 1
using namespace std;
typedef struct graph
{
vector <vector<int>>list;
int numEdge;
int* Mark;
int numVertex;
}Graph;
Gr... | ALGO | 0.999972 | 3.76929 |
0861275f-128e-4e9b-b168-857f660a78c7 | sinian666/codes_102_4 | cpp_副本35/chapter_searching/two_sum.cpp | /**
* File: two_sum.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 方法一:暴力枚举 */
vector<int> twoSumBruteForce(vector<int> &nums, int target) {
int size = nums.size();
// 两层循环,时间复杂度 O(n^2)
for (int i = 0; i < size - 1; i++) {
for (int j = i + 1; j ... | ALGO | 0.999847 | 6.093446 |
660154bd-9ecb-4036-9b3f-08c6952aac2c | cYKatherine/ProgrammingContest | codeforcesProblemSet/122B/122B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
string s; cin >> s;
int four = 0, seven = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '4') four += 1;
else if (s[i] ==... | ALGO | 0.999752 | 4.428951 |
59e3caba-4985-45ee-a32f-7d743c18d5d3 | Gusyatnikova/StephenPrataExercises | ch_12_files/ch_12_queue_test.cpp | #include<iostream>
#include <ctime>
#include "ch_12_queue.h"
const int MIN_PER_HRS = 60;
bool newcustomer(double x);
int main() {
std::srand(std::time(0));
std::cout << "Case study: Bank of Heather Automatic Teller\n";
std::cout << "Enter maxumum size of queue:\n";
int qs;
std::cin >> qs;
Qu... | ALGO | 0.970687 | 4.848332 |
96e7e393-7ea3-4a98-8073-35bf731ddc58 | hrmon/judges | SGU/accepted/p375.cpp | //BE NAME DOOST
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <cmath>
using namespace std;
int main()
{
int n;
cin>>n;
int c[10009];
c[1]=1;
cout<<"1 ";
for(int i=2;i<=n;i++)
{
set <int> d;
int s=sqrt(i);
for(int j=2;j<=s;j++)
if(i%j==0)
{
d.... | ALGO | 0.999916 | 3.376496 |
a67fb92d-0918-449c-a3ca-2c6d6ce616f2 | stupidprogram/cpp | 3/3-36.cpp | //1
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int a[10] = {1,2,3,4,5,6,7,8,9,10};
int b[10] = {1,2,3,4,5,6,7,8,9,10};
int flag = 0;
if(sizeof(a) == sizeof(b))
{
for(size_t i = 0; i != sizeof(a) / sizeof(a[0]); ++i)
{
... | ALGO | 0.987398 | 3.468195 |
9117ca0a-d303-4a9e-b180-6ba1ad224a74 | kh-lu2/Algo-Archive | H - Greedy Algorithms/H04.cpp | //Code by Katarzyna Ludwa
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
int z;
cin >> z;
while (z--) {
int n; cin >> n;
vector<long long> V(n);
for (auto& ... | ALGO | 0.999938 | 4.199632 |
52340c07-011e-4cf6-9b77-2f8a0bde69af | Rajanpandey/Coding-Practice | InterviewBit/Dynamic Programming/Min Jumps Array.cpp | int Solution::jump(vector<int> &A) {
if(A.size() <= 1) {
return 0;
}
int maxReachPos = A[0];
int curMaxReachPos = A[0];
ist jumps = 1;
for(int i=1; i<=maxReachPos; i++) {
if(i == A.size()-1) {
return jumps;
}
curMaxReachPos = max(curMaxReachPos, i + A... | ALGO | 0.999969 | 5.543904 |
304896b6-cce6-4d7c-9de7-0042a45fa8c7 | pandeyyabhishek/Data_Structures_and_Algos | Graph_C 1/Breadth_First_Search.cpp | // * bfs is just like level order traversal
// TODO *: given an undirected graph and a source vertex 's',
// * print BFS from the given source node.
#include <bits/stdc++.h>
using namespace std;
vector<int> bfsOfGraph(int V, vector<int> adj[]) {
vector<int>res;
vector<bool>visited(V,false);
qu... | ALGO | 0.999926 | 5.060974 |
30b40ba4-7694-4452-88b8-d24c8eb5d875 | ShawnTSH1229/XEngine | ThirdParty/boost_1_78_0/libs/polygon/example/voronoi_basic_tutorial.cpp | // Boost.Polygon library voronoi_basic_tutorial.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <cstdio>
#include <vector>
#include <boost/polygon/voronoi.hpp>
using boost::polygon::voronoi_builder;
using boost::polygon::voronoi_diagram;
using boost::polygon::x;
using ... | ALGO | 0.999532 | 6.451248 |
2200bf90-7c90-4df1-ac4f-e51daaf5b097 | Arik096/OS | segmentation 93.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int base[4]={},bound[4]={},seg_size[4]={},v_mem=0,segment=0,offset=0,temp=0;
string access[4]={},v_access="\0";
for(int i=0; i<4; i++)
{
cin>>base[i]>>bound[i]>>a... | ALGO | 0.99068 | 3.211197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.