uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
66fa5458-9324-41bc-b82b-e886c1dbcbf5 | PerfectLifeG/Algorithm-Competition | HDU/5th/1006.cpp | #include<bits/stdc++.h>
using namespace std;
// #define int long long
#define no cout<<"No"<<endl
#define yes cout<<"Yes"<<endl
typedef pair<int,int> PII;
const int N=200010;
const int mod=998244353;
const int INF=0x3f3f3f3f;
void solve()
{
string s;cin>>s;
int n=s.size();
s=' '+s;
vector<int>f(n+1,0);
... | ALGO | 0.999414 | 4.562693 |
4c58e3d2-6604-42e4-8f56-7bddded4429a | DeepikaKALAIVANAN/LeetcodeProblems | 0006-zigzag-conversion/0006-zigzag-conversion.cpp | class Solution {
public:
string convert(string s, int n) {
if(n==1) return s;
int x = 2*n-2;
int i=0;
string ans="";
while(i<n){
int j=i;
while(j<s.size()){
ans+=s[j];
if(i>0 && i<n-1 && j+x-2*i<s.size()){
... | ALGO | 0.999989 | 5.932439 |
703673e6-5a08-49c4-9759-460effa091ef | alvinpiter/competitive-programming | AtCoder/ABC/164/D.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int suff[200003];
int cnt[2020];
memset(suff, 0, sizeof(suff));
memset(cnt, 0, sizeof(cnt));
int n = (int) s.length();
suff[n + 1] = 0;
cnt[0] = 1;
long long int answer = 0;
int mul = 1;
f... | ALGO | 0.999759 | 4.770514 |
dd3b11e1-4f46-40d6-8df2-e9efc46ccf96 | sawlani/densest-subgraph | alternate_code/iterative_peeling_naive.cpp | // Saurabh Sawlani
// Find maximum subgraph density
// Uses BBST to store intermediate degrees
// 6-10 x slower than recursive_peeling_yu, but simpler to understand
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include<cassert>
#include <vector>
#include <queue>
... | ALGO | 0.999833 | 4.437324 |
35f77397-cdb2-470c-8a1f-45dd60c4f244 | ByunKi/BaekJoon_Solution | CPP/2711.cpp | /*
* 제출 번호: 38303033
* 아이디: adviate
* 문제: 2711
* 결과: 맞았습니다!!
* 메모리: 2024 KB
* 시간: 0 ms
* 언어: C++17
* 코드 길이: 323 B
*/
#include <iostream>
using namespace std;
int main() {
cin.tie(NULL);
ios::sync_with_stdio(false);
int TC;
cin >> TC;
for (int i = 0; i < TC; i++) {
int idx;
string str;
cin >> idx >> str;... | ALGO | 0.999488 | 5.588226 |
bb0f1938-3ca9-4712-96a2-dad66f06b637 | marceauPailhas/mva | 3D computer/GCDisparity.cpp | // Imagine++ project
// Project: GraphCutsDisparity
// Author: Renaud Marlet/Pascal Monasse
// Student: TODO
#include <Imagine/Images.h>
#include <iostream>
#include <algorithm>
#include <string>
#include "maxflow/graph.h"
#include <Imagine/LinAlg.h>
using namespace Imagine;
using namespace std;
typedef Image<byt... | ALGO | 0.99831 | 5.116158 |
6289b03e-6c98-4cd4-856d-147cb5e952a2 | harisvelispahic/FIT | Strukture-podataka-algoritmi/Algorithms/N-Way-Merge.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> Two_Way_Merge(vector<int> A, vector<int> B) {
vector<int> resultList;
int i = 0, j = 0; // counters for traversing the lists A and B
// the while loop exits as soon as one of the two lists ends
while (i < A.size() && j < B.size()) {
if (A... | ALGO | 0.99999 | 4.960603 |
f404a019-41f0-4e01-80db-4d8addbf00ab | GabrielMunarriz/Practice-Code-Problems | Hackerrank/Unsorted/Grading Students/GS.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'gradingStudents' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts INTEGER_ARRAY grades as parameter.
*/
vector<int> gradingStudents(vector<... | ALGO | 0.999565 | 4.882889 |
7138f46a-8346-4ab7-817d-fd97a484cfd5 | harsh24-06/cpp | Patterns/Pattern22.cpp | /*
****
***
**
*
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int i = 1;
while (i <= n)
{
int j = 1;
while (j <= n - i + 1)
{
cout << "*";
j++;
}
cout << endl;
i++;
}
return 0;
} | ALGO | 0.999976 | 3.826564 |
d87161e5-edd9-49f4-b847-a3461a3af688 | kapdop/android_frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/get_pred_outside.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpos = x half-pixel of (x,y) coordinates within a VOP; motion
compensated coordinates; native data type
ypos = y half-pixel of (x,y) coordinates within a VOP; motion
co... | ALGO | 0.999714 | 6.723259 |
f292f139-1c9d-4cf4-9fd0-7e2f3902be03 | astronmax/holekeeper | src/config_parser.cpp | #include "config_parser.hpp"
#include "common.hpp"
#include <QtCore/QFile>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
using namespace hk;
ConfigParser::ConfigParser(QString const& filename) {
QFile config_file;
config_file.setFileName(filename);
config_file.open(QIODevice::ReadOnly | QI... | CONFIG | 0.851843 | 5.850538 |
0ae32686-a6be-46d2-b1af-6d16f40be89f | Himanshi-techweb/GeekforGeeks | Difficulty: Medium/Next Greater Element/next-greater-element.cpp | class Solution {
public:
vector<int> nextLargerElement(vector<int>& arr) {
// code here
stack<pair<int,int>> st;
vector<int> nsg(arr.size(),-1);
for(int i=0;i<arr.size();i++){
while(!st.empty() && st.top().first<arr[i]){
auto it=st.top();
... | ALGO | 0.999911 | 5.563965 |
de371cae-1fd2-433d-91dd-f2315ebbb184 | AHAsif1234/Codeforces | codeforces problem solve/A. HQ9+.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
cin>>s;
for(int i=0;i<s.size();i++)
{
if(s[i]=='H' || s[i]=='Q' || s[i]== '9')
{
cout<< "YES";
return 0;
}
}
cout<< "NO";
}
| ALGO | 0.998764 | 3.266998 |
299f05a8-ccde-42c8-97fe-c8b695e37985 | Official-Krish/Data-Structures-and-Algorithm | Famous Algorithms/Searching Algorithm/interpolation_search.cpp | #include<iostream>
// function to search the value in an array using interpolation search
int search(int arr[], int value, int len) {
int low = 0, high, mid;
high = len-1;
while (arr[low] <= value && arr[high] >= value) {
mid = (low + ((value-arr[low])*(high-low)) / (arr[high]-arr[l... | ALGO | 0.999788 | 4.965806 |
7d335802-9fbe-432f-9b46-db7a1db6f59b | raincross7/code-similarity | codes/train_code/problem492/problem492_178.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj... | ALGO | 0.999946 | 4.095904 |
822d8c91-31d0-441e-93d8-59f7f8e2c9d4 | Divyalok123/CN_Data_Structures_And_Algorithms | Linked_List/print_reverse_ll.cpp | // You have been given a singly linked list of integers. Write a function to print the list in a reverse order.
// To explain it further, you need to start printing the data from the tail and move towards the head of the list, printing the head data at the end.
#include <iostream>
class Node
{
public:
int data;
... | ALGO | 0.999358 | 5.780511 |
bb3fa260-4e8a-4c1f-a395-77b5a9ad7da2 | arclab-hku/SOPVO | 3rdPartLib/g2o/g2o/core/hyper_dijkstra.cpp | #include <queue>
#include <deque>
#include <vector>
#include <assert.h>
#include <iostream>
#include "hyper_dijkstra.h"
#include "g2o/stuff/macros.h"
namespace g2o{
using namespace std;
number_t HyperDijkstra::TreeAction::perform(HyperGraph::Vertex* v, HyperGraph::Vertex* vParent, HyperGraph::Edge* e){
(void... | ALGO | 0.999833 | 4.655377 |
c27d654d-eb00-46e8-b81a-709f3828597f | hfukuoka/atcoder | abc/048/a.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>
#define all(v) v.begin(), v.en... | ALGO | 0.996692 | 4.066313 |
34024441-57d0-4c66-849e-3460f4e74046 | ysilberg/CPP-Ex1 | part2/utils/Utils.cpp | #include "Utils.h"
#include "../stack/Stack.h"
#include <iostream>
using namespace std;
// Function to reverse the elements of an array using a stack
// Input: int pointer nums, unsigned int size
void reverse(int* nums, unsigned int size)
{
Stack stack;
initStack(&stack);
for (unsigned int i = 0; i < size; ++... | TOOL | 0.991554 | 5.293442 |
514b8351-2272-4420-9060-aac65e7b29f8 | VulpesCorsac/Leetcode | 0083. Remove Duplicates from Sorted List - Easy/solution.cpp | static auto _ = [] () { ios_base::sync_with_stdio(false); cin.tie(nullptr); return 0; } ();
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* he... | ALGO | 0.999966 | 6.235503 |
49907842-0b20-47f4-bd90-a081c22aa660 | CitrusSin/AlgorithmProblemAnswers | AtCoder/practice2_a.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int djs[N];
int djs_head(int x) {
if (djs[x] == 0) return x;
int res = djs_head(djs[x]);
djs[x] = res;
return res;
}
void djs_merge(int a, int b) {
a = djs_head(a);
b = djs_head(b);
if (a != b) {
djs[b] = a;
... | ALGO | 0.999946 | 4.518355 |
bb83033d-4464-4fad-b3b7-5c6c1f566384 | zoumson/Challenge | Sorting and Searching/Sliding Cost.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 2e5+1;
int N, K, x[maxN];
ll losum, hisum;
multiset<int> lo, hi;
ll cost(){
ll median = *lo.rbegin();
ll locost = (median * lo.size()) - losum;
ll hicost = hisum - (median * hi.size());
return locost + hicost;
}
voi... | ALGO | 0.999934 | 3.588584 |
56515fc4-f643-4740-8d1d-00ef77aa9f6e | chanhou/FingerprintClusterer | FingerprintKeyer/BinningClusterer.cpp | #include "BinningClusterer.hpp"
#include "FingerPrintKeyer.hpp"
#include "Keyer.hpp"
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include "helpers.hpp"
#include <fstream>
using namespace std;
typedef unordered_map<string, unordered_map<string, int> > mmm;
unordered_map<string,... | DATA | 0.956817 | 4.826041 |
ffff7e2b-1202-4c5b-b8a2-e9fcc7a4166b | thuem/THUNDER | src/Functions/Filter.cpp | /*******************************************************************************
* Author: Mingxu Hu
* Dependency:
* Test:
* Execution:
* Description:
*
* Manual:
* ****************************************************************************/
#include "Filter.h"
void bFactorFilter(Image& dst,
... | ALGO | 0.986486 | 4.201041 |
292c813e-1d9e-41c8-b768-41802da4b3df | Khairul-Anam-Mubin/UVa-Solutions | 10780 - Again Prime? No Time.cpp | /***
** Author: Khairul Anam Mubin
** Bangladesh University of Business and Technology,
** Dept. of CSE.
***/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <string>
#include <sstream>
#include <iterator>
#include <vector>
#include <map>
#include <set>
#include <queue... | ALGO | 0.999671 | 4.413769 |
8e21cf72-b8ec-4b8c-8862-74a9d424725b | PaulCaudal/Projet-Cpp-2018 | arbre.cpp | #include"arbre.h"
#include "ellipse.h"
#include"util.h"
#include<random>
#include<iostream>
arbre::arbre(int x,int y, int t, Couleur couleur, Couleur couleur2,int d)//constructeur
:objet(d)
{
m_x=x;
m_y=y;
m_t=t;
m_couleur=couleur;
m_couleur2=couleur2;
}
void arbre::dessiner(Svgfile& svgout,int... | ALGO | 0.946487 | 3.496595 |
ceee855a-32a5-4d28-ac5a-3b4e20bfac85 | MansourGu/College_Work | 人工智能/第三次实习/Particle.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
void get_init();
float fun(float x, float y);
void find_min(float x[], int n);
void V_update(int x);
void P_update(int x);
void F_update(int x);
void Best_update(int x);
void Print();
const int maxgen = 300;//
const int sizep... | ALGO | 0.999975 | 4.507502 |
1b77f3b2-0ad6-4daf-b1f1-21ed474c7b94 | ishandutta2007/codeforces | chenyu_qiu/normal/1515/C.cpp | #include <iostream>
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main()
{
int t, n, m, x;
string s, s1, s2;
cin>>t;
while(t--)
{
cin>>n>>m>>x;
int a[n];
vector<pair<int, int>> vec;
for(int i=0; i<n; i++)
{
cin>>a[i];
vec.push_back(make_pair(a[i], i+... | ALGO | 0.999965 | 3.147365 |
755bb841-c1b5-4596-b1d0-af0b3f4fd36c | chilimyan/SwordToOffer | 剑指 offer/034-丑数/02-uglynum_set.cpp | #include <iostream>
#include <set>
using namespace std;
// Կ
#define __tmain main
#ifdef __tmain
#define debug cout
#else
#define debug 0 && cout
#endif // __tmain
class Solution
{
public:
int GetUglyNumber_Solution(int index)
{
if(index <= 0)
{
return 0;
}
... | ALGO | 0.999974 | 4.363114 |
e7f19226-106d-4cd4-afd1-5f8087c3c589 | dzungpng/material-point-method-jello-simulation | Deps/libigl/python/py_igl/py_fit_rotations.cpp | m.def("fit_rotations", []
(
const Eigen::MatrixXd& S,
const bool single_precision,
Eigen::MatrixXd& R
)
{
return igl::fit_rotations(S, single_precision, R);
}, __doc_igl_fit_rotations,
py::arg("S"), py::arg("single_precision"), py::arg("R"));
m.def("fit_rotations_planar", []
(
const Eigen::MatrixXd& S,
Eig... | ALGO | 0.95611 | 6.320322 |
cb781a2b-cbd8-4094-9e28-09b1b7bcff46 | KapoorNandini/DSA | BubbleSort.cpp | /* *****BUUBLE SORT*******
Every Element Is Compared with neighbour element nd if i>i+1 then swap
In each round the ith largest element will be placed to its right place
there are total n-1 rounds in bubble sort
Time Complexity -----> BEST CASE ---> O(n)
Worst Case ----> O(n^2)
Bubble Sort is a Stable Algorithm
*/
#in... | ALGO | 0.999871 | 5.093606 |
2556cce5-7103-41be-ba9d-4cb925324dd7 | uche-hub/expense_tracker | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
ad35d476-8153-4903-a882-3a01ef58e58a | ishandutta2007/codeforces | strawberryc/normal/1149/A.cpp | #include <bits/stdc++.h>
// 0830
//
inline int read()
{
int res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c == '-') bo = 1; else res = c - 48;
while ((c = getchar()) >= '0' && c <= '9')
res = (res << 3) + (res << 1) + (c - 48);
return bo ? ~res + 1 : res;
}
const in... | ALGO | 0.999917 | 3.119268 |
80916fcd-cbb2-4688-adf5-cb5775a5a962 | ILyoan/MySnippets | problem-solving/acmicpc.net/11652.cpp | // baekjoon online judge 11652 (www.acmicpc.net/problem/11652)
#include <cstdio>
typedef long long i64;
const int MAXN = 1000000;
i64 A[MAXN + 1];
i64 B[MAXN + 1];
void merge(int begin, int end) {
int mid = (begin + end) / 2;
int p = begin;
int q = mid;
int r = begin;
while (p < mid && q < en... | ALGO | 0.999971 | 4.319737 |
cadf3498-0812-4dfd-949d-d28868865eaf | fujinotatsunari/testmat | testmat/main.cpp | #include"matrix.hpp"
#include<iostream>
#include<vector>
#include <random>
int random(int low, int high)
{
return low + rand() % (high - low + 1);
}
int main(void) {
int dim = 10;
vector<double> bvec;
vector<double> xvec;
bvec.resize(dim);
xvec.resize(dim);
cout << "bvec = [" << endl;
for (int i = 0; i < dim;... | ALGO | 0.998773 | 3.463715 |
95d9f7d8-7ad0-441b-804a-0d1d30896460 | bagaspng/AlgorithmCPP | Belajar-cpp/strukturData/sorting/Untitled1.cpp | #include <iostream>
using namespace std;
int main() {
string nama_ruangan[3] = {"Ruang Sirkulasi", "Ruang Referensi", "Ruang Baca"};
string jenis_buku[4] = {"Buku Fiksi", "Buku Akademik", "Majalah", "Komik"};
int banyak_buku[3][4];
int total_buku[4];
for (int i = 0; i < 3; i++) {
cout <... | ALGO | 0.997073 | 4.373662 |
93490061-1bf4-418d-9ca5-4f9c248aa0fc | BoLin-TW/LeecodePractice | cpp/LeetCode/No300.cpp | /*
Given an integer array nums, return the length of the longest strictly increasing subsequence.
A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements.
For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7].
*/... | ALGO | 0.999991 | 6.067384 |
0359d84e-63e5-494f-ab91-72c0697da41d | koyotecoin/koyotecoin | src/rpc/server.cpp | #include <rpc/server.h>
#include <rpc/util.h>
#include <shutdown.h>
#include <sync.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/system.h>
#include <util/time.h>
#include <boost/signals2/signal.hpp>
#include <cassert>
#include <chrono>
#include <memory>
#include <mutex>
#include <unordere... | WEB | 0.926357 | 7.745615 |
82816873-f88e-461d-8324-6c8b14cfb079 | shahbazcse/DataStructures | Stack/NStacksInArray.cpp | // Link: https://www.codingninjas.com/codestudio/problems/n-stacks-in-an-array_1164271
// Approach: [TC: O(1) / SC: O(S+N)]
#include <bits/stdc++.h>
class NStack
{
int *arr;
int *top;
int *next;
int n,s;
int freeSpot;
public:
// Constructor
NStack(int N, int S)
{
n=N;
... | ALGO | 0.999486 | 4.910391 |
1c77a984-3452-44d2-9dfa-2c5600acd53b | MatzeB/llvm | lib/IR/InlineAsm.cpp | #include "llvm/IR/InlineAsm.h"
#include "ConstantsContext.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <cass... | TOOL | 0.889823 | 7.496182 |
444b093f-2562-4a9b-8e9f-08464e27de07 | karan-pawar-09/codeforces | U_Dinner_with_Emma.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,m;
cin>>n>>m;
vector<vector<ll>> arr(n,vector<ll>(m,0));
for(ll i=0;i<n;i++) {
for(ll j=0;j<m;j++) {
cin>>arr[i][j];
}
}
ll... | ALGO | 0.999967 | 3.709137 |
799b3e09-a163-4c56-89bb-ceef79be44da | liwan-cn/oj | 北邮OJ/0273.cpp | #include<stdio.h>
#include<vector>
#include<map>
#include<algorithm>
#include<string.h>
#include<string>
using namespace std;
vector<int> List[101];
map<string,int> M;
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
int cnt=0;
scanf("%d",&n);
M.clear();
for(int i=0;i<n;i++)
List[i].clear();
whi... | ALGO | 0.992378 | 3.522115 |
06d77ee9-3225-4e4a-a056-1bd3f85a6e67 | hacanand/c-competitive_programming_code | accenture_max_int_in_string.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string str;
getline(cin, str);
int maxi = INT_MIN;
string tmp = "";
for (char ch : str)
{
if (ch - '0' <= 9 && ch - '0' >= 0)
{
tmp = tmp + ch;
}
else
... | ALGO | 0.999402 | 4.941907 |
75211cb5-9fe0-4571-a71c-4674c9e2f624 | manikanta2901/ubuntu | .history/SRM/elab/DAA/DivideAndConquer/minimumAndMaximum_20210226143229.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
vector<int>numbers;
pair<int,int> getMinMax(int low,int high){
int min1 = numbers[0],min1 = numbers[0],max = numbers[0],max = numbers[0];
if(abs(low - high) <= 1){
return make_pair(max(numbers[low],numbers[high]),min(numbers[low],numbers[h... | ALGO | 0.999965 | 4.099147 |
5a11badf-c457-481a-a358-8f2d4689844c | FaadCoder/Leetcode-Solutions | counting-bits/counting-bits.cpp | class Solution {
public:
vector<int> countBits(int n) {
// n+1 as we are going to count from 0 to n
vector<int> t(n+1);
// t[0] will be 0 beacuse 0 has count of set bit is 0;
t[0] = 0;
// we can compute current set bit count using previous count
... | ALGO | 0.999996 | 6.505688 |
27118e3e-a5e1-4aa4-a308-25e64a6360ca | shohan98/CodeFolio | codeforce_div2_426_B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int i,j,k,m,n,start[30],close[30],g;
string s;
scanf("%d %d",&n,&k);
for(i=0;i<30;i++)
start[i] = close[i] = 0;
cin>>s;
if(!start[s[0]-65])
start[s[0]-65] = 1;
close[s[0]-65] = 1;
for(i=1;i<n;i++){
... | ALGO | 0.99999 | 3.461325 |
df232e6c-d1d0-47a8-9520-1bfac6d46c16 | Nitin1130/Data-Structures-ProblemsCplusplus | CountingSort.cpp | #include <bits/stdc++.h>
using namespace std;
int amax(int a[],int n){
int m=a[0];
for(int i=1;i<n;i++){
if(a[i]>m) m=a[i];
}return m;
}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
int M=amax(a,n);
//initialise all elements by 0
int freq[M + 1]=... | ALGO | 0.999988 | 3.969286 |
83602cc8-9a00-41f7-88db-6a48235d74c6 | atom501/v-img | src/integrators/mis_integrator.cpp | #include <integrators.h>
glm::vec3 mis_integrator(Ray& input_ray, std::vector<size_t>& thread_stack, const BVH& bvh,
const std::vector<std::unique_ptr<Surface>>& prims,
const GroupOfEmitters& lights, pcg32_random_t& hash_state, uint32_t depth,
... | ALGO | 0.996019 | 5.24827 |
757ef4da-8266-443c-a600-34f56483ef28 | 40LF0/concurrent_programming | lab03/prime.cpp | #include <stdio.h>
#include <pthread.h>
#include <math.h>
#define NUM_THREAD 10
#define NUM_INCREASE 100000
int cnt_global = 0;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
bool is_prime[NUM_INCREASE];
void IsPrime(int n) {
if (n < 2) {
is_prime[n] = false;
return;
}
for (... | ALGO | 0.999311 | 4.157421 |
48c63472-bb46-4a87-ac5f-19c562c61eb5 | sigu1011/atcoder | abc095_a.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int price = 700;
if (S.at(0) == 'o') price += 100;
if (S.at(1) == 'o') price += 100;
if (S.at(2) == 'o') price += 100;
printf("%d", price);
}
| ALGO | 0.981192 | 3.243611 |
8675642b-75c4-4b77-a547-3b69f2069a19 | darrylteo/cp4-solutions | 3 Problem Solving Paradigms/4. Dynamic programming/a. Max 1D2D Range Sum/787 - Maximum Sub-sequence Product.cpp | #include <bits/stdc++.h>
using namespace std;
// bigint from gfg
class BigInt {
string digits;
public:
//Constructors:
BigInt(unsigned long long n = 0);
BigInt(string &);
BigInt(const char *);
BigInt(BigInt &);
//Helper Functions:
friend void divide_by_2(BigInt &a);
friend bo... | ALGO | 0.999974 | 4.181519 |
8df6384e-b9ce-4e3d-a90c-9aa6531ef450 | nwjs/chromium.src | tools/clang/v8_handle_migrate/HandleMigrate.cpp | // A clang tool for the migration of Handle<T> to DirectHandle<T>.
// This is only useful for the V8 code base.
#include <clang/AST/ASTContext.h>
#include <clang/ASTMatchers/ASTMatchFinder.h>
#include <clang/ASTMatchers/ASTMatchers.h>
#include <clang/Frontend/FrontendActions.h>
#include <clang/Tooling/CommonOptionsPar... | TOOL | 0.866709 | 7.650239 |
0d6c653c-53b2-429e-aa3c-b514992663f7 | anveshi/Competitive-Programming | codeforces/599-D/599-D-14385843.cpp | // Anve$hi $hukla
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline void fastIO(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
typedef pair <LL,LL> PLL;
vector < PLL > v;
const int Maxn = 200005;
void Print(vector <PLL> &P){
cout << P.size() << endl;
for(LL i=0;i<P.size();... | ALGO | 0.99977 | 3.35113 |
f2ed51a0-65c2-4186-baf0-47ab59beb4e9 | niveshnagar/leetcode-solutions | Linked lists/reverseLinkedList.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.99941 | 5.493556 |
35e7c10a-8886-4995-a6b9-c6136d5b0101 | champawatsaksham0693/Crtphase2 | tree.cpp | /*
Level oreder traversal of tree using an array
time compexity of swap of two array is O(1)
*/
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node *left;
Node *right;
Node(int data){
this->data = data;
left = NULL;
right = NULL;
}
};... | ALGO | 0.999848 | 4.666847 |
d96c5057-7cd0-41b2-babf-4d9aeb7a2eb5 | raincross7/code-similarity | codes/train_code/problem124/problem124_413.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(),... | ALGO | 0.99985 | 3.869217 |
2675a03d-c21e-4e24-9439-bb0df6776c02 | ShahjalalShohag/bcs-contest-resources | aust_iupc_2025/A/main_solution.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long MOD = 998244353;
// 设置最大预处理范围
const int MAX = 2000000; // 这个值可以根据实际情况调整,确保涵盖所有可能的输入
vector<long long> fact(MAX + 1, 1), inv_fact(MAX + 1, 1);
// 使用费马小定理计算模逆元
long long mod_inv(long long x, long long mod) {
long lon... | ALGO | 0.999996 | 5.504061 |
1ff01caf-d81b-43b7-bd09-9856434b0b8a | bytedance/SchurVINS | svo_ceres_backend/src/pose_local_parameterization.cpp | /**
* @file PoseLocalParameterization.cpp
* @brief Source file for the PoseLocalParameterization class.
* @author Stefan Leutenegger
*/
#include "svo/ceres_backend/pose_local_parameterization.hpp"
#include <svo/vio_common/logging.hpp>
#include <svo/vio_common/matrix_operations.hpp>
#include <svo/common/transforma... | ALGO | 0.896996 | 5.943432 |
971dd068-4a7c-42e9-93df-747aff5c8dbd | soikot-shahriaar/Algorithms | ProblemSolving/Easy Problems/7_Combination_Lock.cpp | // Problem Link:
// https://vjudge.net/contest/575161#problem/G
#include <iostream>
using namespace std;
int main()
{
int n;
string a, b;
cin >> n >> a >> b;
int ans = 0;
for (int i = 0; i < n; i++)
ans += min(10 - abs(a[i] - b[i]), abs(a[i] - b[i]));
cout << ans << endl;
return ... | ALGO | 0.999848 | 4.091544 |
8f504141-2128-4a63-94c4-4b3a89318d62 | SirADV24/Sortring-Algorithms-Visualiser | Service.cpp | #include "Service.h"
#include <random>
#include <iostream>
#include <stack>
int get_random() {
std::random_device device;
std::mt19937 generator(device());
std::uniform_int_distribution<int> distribution(50, 350);
return distribution(generator);
}
void my_swap(Bar* first, Bar* second) {
Bar* temp... | ALGO | 0.987493 | 4.853107 |
b804863b-3102-4a33-8438-9a5d9d880fd5 | wenjiesun1024/Leetcode | Cpp/001~100/003. Longest Substring Without Repeating Characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
if (s.empty()) return 0;
int n = s.length(), left = -1, res = 1;
vector< int > m(128,-1);
for (int i = 0; i < n; i++) {
left = max(left, m[s[i]]);
m[s[i]] = i;
res = max(res, i-left)... | ALGO | 0.999909 | 5.840687 |
9121fca7-b58e-4443-98bc-c0d84b82349d | aman-harness/ai-gp | mycode/OJ/usaco/chapter5/window.cpp | /*
ID: interne4
PROG: window
LANG: C++
DATA: 2010.12.15
ALGO: Links , Simulation , Clip Rectangle
*/
/**************************************
OIer C++ IDE Generate
web: http://www.n8lm.cn/product?id=1
Please don't cut down these.
**************************************/
#include <fstream>
#include <iomanip>
#include <m... | ALGO | 0.975014 | 3.626498 |
58fccb99-6269-4930-9928-22664e29dc1a | ishandutta2007/codeforces | piob/normal/37/A.cpp | #include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cstring>
#include <functional>
#define FWD(a,b,c) for(int a=(b); a<(c); ++a)
#define BCK(a,b,c) for(int a=(b); a>(c); --a)
#define FE(a,b) for(typeof((b).end()) a=(b).begin(); a!=(b).end(); ++a)
using namespace std;
i... | ALGO | 0.998965 | 3.762864 |
ed4e3bdb-d2b2-40cd-a590-159a5142ed9f | AmiEklasMohin/UvaOJ | TheDecoder.cpp | #include <iostream>
#include <string>
int main() {
std::string encodedLine;
while (std::getline(std::cin, encodedLine)) {
std::string decodedLine = "";
for (int i = 0; i < encodedLine.length(); i++) {
int x = encodedLine[i] - 7;
decodedLine += (char) x;
}
... | ALGO | 0.985802 | 4.85992 |
184eae46-ca57-41f2-8369-754b3907f7af | andywu1998/C_and_Cpp | 学校课程代码/算法设计与分析/实验二 0-1背包/0-1背包.cpp | // #pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <iostream>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int inf = 0x3f3f3f3f;
#define LOCAL
const int maxn = 1e3 + 7;
int main(int argc, c... | ALGO | 0.999978 | 3.759853 |
50d90627-b716-49f8-8e62-ecfca7062ea7 | KhadimHussainDev/Mobile-App-Development | chap5/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.997751 | 6.76073 |
6ccff2c6-3ef5-4780-b060-03ea3b556063 | Vedant285/LeetCode | 347-top-k-frequent-elements/top-k-frequent-elements.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int, int>mp;
for (auto it : nums) {
mp[it]++;
}
int n = nums.size();
vector<vector<int>>temp(n + 1);
for (auto it : mp) {
temp[it.second].push_back(it.f... | ALGO | 0.999992 | 6.024781 |
04e4ef6c-eae7-4d45-9e7d-1dfbea8d2ef6 | roshnimishraa/Interview-Bit | Tree/Root to leaf/Path Sum.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
int helper(TreeNode* A, int B, int sum)
{
if(A == NULL) {
return 0;
}
sum += A->val;
// left Tr... | ALGO | 0.999984 | 5.763062 |
efabbe31-0424-4704-88ed-65c2cf090a67 | CMU-BeanBurrito/comp-prog | CF/CF1833/F.cpp | /*
Author: BeanBurrito
*/
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define MOD 1'000'000'007
#define divceil(n, m) (n+m-1)/m
int gcdExt(int a... | ALGO | 0.999976 | 4.806528 |
45b352b0-d40e-45e6-99b2-ba956b930153 | alexanderlvarfolomeev/ITMO | Algorithms and Data Structures/StackQueueDisjoinedSet/StackSort.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <string>
#include <utility>
#include <stack>
using namespace std;
int main()
{
int n;
int x, y, m, k, l;
char ch;
bool b[200000];
int c[100000];
m = 0;
l = 0;
st... | ALGO | 0.999954 | 3.774578 |
716d08a3-214b-4281-a4d5-6e1433a4408a | xxxxxxxyyyyyyyxxxxx/z3str4 | src/opt/opt_preprocess.cpp | #include "opt/opt_preprocess.h"
#include "util/max_cliques.h"
namespace opt {
expr_ref_vector preprocess::propagate(expr* f, lbool& is_sat) {
expr_ref_vector asms(m);
asms.push_back(f);
is_sat = s.check_sat(asms);
return s.get_trail(1);
}
bool preprocess::prop_mutexes(vect... | ALGO | 0.992901 | 5.718768 |
e5b1758a-2777-4389-8158-bea1e33eecf5 | superxiaobai-1/LLM_Voice_Flow | tts/eigen-3.4.0/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.968802 | 3.245548 |
33fb14f3-f61f-4266-a7b2-4e130e2cfaef | Prithiraj-Dhar/Algorithm- | GRAPH/dfs_traversal.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> adj_list [1005];
bool vis[1005];
void dfs(int src){
cout<<src<<" ";
vis[src]=true;
for(auto child : adj_list[src])
if(vis[child]==false)
dfs(child);
}
int main(){
int n,e;
cin>>n>>e;
while(e--){
int a,b;
... | ALGO | 0.999989 | 4.326142 |
dce7ab1e-1485-43e3-81e3-c3b16bd832d7 | pengw0048/Ural--Timus--Solution | 1057/1057_3008310_WA_20100414141502.cpp | #include<iostream>
using namespace std;
int x,y,k,b;
int f[50][50],a[50];
void init(){
int i,j;
f[0][0]=1;
for(i=1;i<=31;i++){
f[i][0]=f[i-1][0];
for(j=1;j<=i;j++)
f[i][j]=f[i-1][j]+f[i-1][j-1];
}
}
int solve(int x){
int i,ans=0;
for(i=0;x!=0;i++){
a[i]=x%b;
... | ALGO | 0.99968 | 3.343659 |
c16322f9-a009-4826-9c1c-7a262d23c7ba | Stuthedian/Univer | C++/Visual Studio/Exam/Бил14/2.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
bool comparestr(char*, char*);
int main()
{
ifstream textfile("textfile.txt");
char abonent[50], number[8], query[8];
if (!textfile.is_open())
{
cout << "Error opening" << endl;
cin.get();
return... | ALGO | 0.956719 | 3.53678 |
5d4e51d0-6ed9-4d41-a670-afe5ef6f79ed | sarvex/leetcode-mini-kanren | lcof2/剑指 Offer II 078. 合并排序链表/Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeKLists... | ALGO | 0.999444 | 6.232008 |
a0e2f2aa-d337-4077-94e0-2d6b3926b17d | JungleTryne/Algo-Course | part-four/retrospective.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>
/* We have field 8x8
* So we have 8^2 * 8^2 * 2 = 8192 vertices in
* out game graph
*/
enum FieldSize {
X = 8,
Y = 8
};
enum FieldObjects {
WALL = 1,
FUGITIVE [[maybe_unused]] = 2,
... | ALGO | 0.999876 | 5.922873 |
16d79ecb-3efa-4e24-aa13-919928127456 | Ankit3019/SomeThing | Pattern/pattern5.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int row = 1;
while (row <= n)
{
int col = 1;
while (col <= row)
{
cout << "*";
// cout << row; for printing number (or of 5)
col = col + 1;
}
cout << e... | ALGO | 0.999886 | 3.944444 |
b0d9c79d-d0be-4336-b62d-38c1b690c205 | MatthewDZane/UnrealQRCodeScanner | Source/ThirdParty/OpenCVLibrary/Hololens/sources/apps/interactive-calibration/rotationConverters.cpp | #include "rotationConverters.hpp"
#include <cmath>
#include <opencv2/calib3d.hpp>
#include <opencv2/core.hpp>
#define CALIB_PI 3.14159265358979323846
#define CALIB_PI_2 1.57079632679489661923
void calib::Euler(const cv::Mat& src, cv::Mat& dst, int argType)
{
if((src.rows == 3) && (src.cols == 3))
{
... | ALGO | 0.882173 | 6.967579 |
61c9023f-baea-496c-aebc-6a26eb49f171 | Nrgeup/Algorithm-practice | poj/1002.cpp | #include<iostream>
#include<cstdlib> /* rand,srand,calloc,free,malloc,realloc,abs,div,labs,ldiv, */
#include<cstdio> /*scanf,printf*/
#include<cstring> /*字符串函数memset()*/
#include<cmath> /**/
#include<iomanip>
#include<string>
#include <vector>
#include<algorithm>
#include<string.h>
using namespace std;
int mmmap[... | ALGO | 0.999795 | 3.0571 |
ae7220af-1c67-4e0c-94cf-915eb8881136 | sakib-mustafa-ak/Codeforces-Solutions | 1535A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define Start ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ff first
#define ss second
#define pb push_back
#define pr pair<int,int>
void solve(){
ve... | ALGO | 0.999952 | 4.612295 |
92835dfb-e5ef-4a45-98ae-7f2dcea887ec | THU-DSP-LAB/llvm-project | libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires CopyConstructible<Compare>
// Iter
// max_element(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <random>
#include <cassert>
#include "test_macros.h"
#include... | TEST | 0.886859 | 6.037132 |
1a053288-33ee-431e-bed0-4223238c39d3 | raincross7/code-similarity | codes/train_code/problem246/problem246_468.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
int main(){
int N, T;
cin >> N >> T;
vector<int> t(N);
rep(i, N) cin >> t[i];
ll ans = T;
for (int i=1; i<N; i++) {
... | ALGO | 0.99995 | 3.405507 |
9c6a8b68-7dfc-4070-873e-ea853455fef3 | yydaily/cf_solution | 18/E/solution.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m;
string buf;
const int maxm = 502;
int mat[maxm][maxm];
int cost[maxm][30][30];
int dp[maxm][30][30];
pair<int, int> pre[maxm][30][30];
void cal(int row, int a, int b) {
cost[row][a][b] = 0;
if (a == b) {
cost[row][a][b] = 0x3f3f3f3f;
retur... | ALGO | 0.999998 | 3.414121 |
0325ef96-591b-4783-bf42-45af38e5bab2 | Rishab30Gupta/CppCodes21-22 | Level1/4)Basic Data Structures/1)-LinkedLists/Get_Value_In_LinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *next;
Node() {
next = NULL;
}
Node(int data) {
this->data = data;
next = NULL;
}
};
void Display_LL(Node *head) {
Node *temp = head;
while (temp != NULL) {
cout << temp->data << " ";
temp = temp->next;
}
cout << endl;
... | ALGO | 0.999649 | 3.654589 |
9f27f8a4-15f4-4400-bb1f-43a41a3de6ae | Das-Sourashis/Reg_Exp_to_DFA | src/Hopcroft_minimization.cpp | #include "../include/Hopcroft_minimization.h"
#include <list>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <set>
void create_minimize_dfa_table(std::vector<std::vector<std::string>> &dfa, std::set<std::set<std::strin... | ALGO | 0.999887 | 5.792971 |
e8fd75d5-4d8f-4f6f-a47f-e63d732f5fa9 | kasi2022/Flutter-Sql-flite-projext | 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 |
5a05e3b0-4598-4dc1-bf3e-71bde44bd9c9 | DinushaWeerakoon/SiyaraRefacoring | OpenCPN/libraries/rapidjson-master/example/parsebyparts/parsebyparts.cpp | // Example of parsing JSON to document by parts.
// Using C++11 threads
// Temporarily disable for clang (older version) due to incompatibility with libstdc++
#if (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)) && !defined(__clang__)
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
... | TOOL | 0.884563 | 7.119899 |
e3b22199-2d9f-4e31-866a-f9caffcc1bb2 | BujorelActimel/codemy-bac | cls-10-MI/lectia11/functii/functii.cpp | #include <iostream>
#include <cstring>
using namespace std;
void Trim(char s[]) {
int i;
for (i = 0; i < strlen(s); i++) {
if (s[i] != ' ') {
break;
}
}
strcpy(s, s+i);
for (i = strlen(s)-1; i >= 0; i--) {
if (s[i] != ' ') {
break;
}
}
... | ALGO | 0.998184 | 3.792129 |
252a7bb6-f97e-4286-860e-6ade011947dd | raghu1298/C- | DesignPatterns/Day3/17Iterator.cpp | #include<iostream>
#include<string>
using namespace std;
namespace nm17
{
class IIterator
{
public:
virtual void First() = 0;
virtual void Last() = 0;
virtual bool Next() = 0;
virtual int Current() = 0;
virtual void MoveNext() = 0;
};
class Container
{
int arr[5];
int size = 5;
public:
Containe... | TOOL | 0.9552 | 3.726314 |
9a862370-65a7-4893-9ebb-361a08b27caf | Steve-Qian-13/github | progs/codes/earlySelectionSort.cpp | // early terminating selection sort
#include <iostream>
#include <algorithm> // has copy
using namespace std;
template<class T>
void selectionSort(T a[], int n)
{// Early-terminating version of selection sort.
bool sorted = false;
for (int size = n; !sorted && (size > 1); size--)
{
int indexOfMax = 0;... | ALGO | 0.999994 | 5.435626 |
5c266650-4c1f-4976-82e7-4eb5026dae57 | mayank7jha1/March-22 | Lecture 20/3SUM.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n, m;
int cnt[10];
int main() {
int t;
cin >> t;
while (t--) {
ll n;
cin >> n;
for (int i = 0; i < 10; i++) {
cnt[i] = 0;;
}
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
x = x % 10;
cnt[x]++;
}
vector<int>v;
f... | ALGO | 0.999593 | 4.499838 |
393f9347-1c66-476e-9945-1492095e7a73 | Erica114/Informatica | 3CerinteTudor.cpp | /*Se dau n numere si un t care reprezinta cerinta.
Cerinta 1: se afiseze numarul care are cei mai multi divizori din cele n numere
Cerinta 2: Sa se afiseze numerele prime
Cerinta 3: Se citeste un k. Sa se afiseze cate numere din cele n numere
au cel putin k divizori care sunt patrate perfecte.**/
#include ... | ALGO | 0.999758 | 4.430699 |
5b358c08-14c5-4d94-b65c-cb88db5f26f3 | omerzaheer-dev/GitHub | lvlodrtrsl.cpp | #include <iostream>
#include <queue>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int value) {
data = value;
left = right = nullptr;
}
};
class BinaryTree {
public:
Node* root;
BinaryTree() {
root = nullptr;
}
void in... | ALGO | 0.999998 | 6.488385 |
105d960a-fe54-4365-b6c6-314c82fec48c | strikersix23/ndk-arm32 | ndk/renderscript/slang/BitWriter_2_9_func/ValueEnumerator.cpp | #include "ValueEnumerator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Suppor... | TOOL | 0.865986 | 3.900924 |
866b54f8-7cbd-46c9-a2d5-72a933bde1b3 | sarvex/leetcode-elm | solution/1100-1199/1152.Analyze User Website Visit Pattern/Solution.cpp | class Solution {
public:
vector<string> mostVisitedPattern(vector<string>& username, vector<int>& timestamp, vector<string>& website) {
unordered_map<string, vector<pair<int, string>>> d;
int n = username.size();
for (int i = 0; i < n; ++i) {
auto user = username[i];
... | ALGO | 0.999942 | 5.975423 |
e935cdea-6925-48d8-aed4-9e29655af853 | amansaxena1/Leetcode | 665-non-decreasing-array/665-non-decreasing-array.cpp | #define llint long long int
class Solution {
public:
bool checkPossibility(vector<int>& v) {
llint cnt=0;
for(llint i=1;i<v.size();i++){
if(v[i] < v[i-1]) {
cnt++;
if(i>=2){
if(v[i] < v[i-2]) v[i] = v[i-1];
else v[i-... | ALGO | 0.999984 | 5.313434 |
f0099a5a-d013-47f8-a5d9-8bc797bbfd5e | ishandutta2007/codeforces | he_ren/normal/920/B.cpp | #include<cstdio>
#include<queue>
using namespace std;
const int MAXN = 1e3 + 5;
const int m = 5e3;
const int MAXM = m + 5;
struct Node
{
int l,r,id;
}a[MAXN];
queue<Node> q;
int ans[MAXN];
void solve(void)
{
int n;
scanf("%d",&n);
for(int i=1; i<=n; ++i)
scanf("%d%d",&a[i].l,&a[i].r), a[i].id=i;
for(int i=1;... | ALGO | 0.999992 | 4.374298 |
35989a1e-dcee-433f-82c3-3a3aab98edf1 | ishandutta2007/codeforces | soschina/normal/1627/C.cpp | #include <cstdio>
#include <vector>
using namespace std;
const int N = 1e5 + 1;
int t, n, u, v;
struct edge{
int id, to;
edge(int _id, int _to) : id(_id), to(_to) {}
};
vector<edge> e[N];
int ans[N];
void dfs(int i, int from){
int lastnum;
for(edge ed : e[i])
if(ed.id == from)
lastnum = ans[ed.id];
for(edg... | ALGO | 0.999929 | 4.568768 |
183f005c-30e6-45a3-8221-56176942298f | tr1ten/DNA | 1973D.cpp | #include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
template<typename T>
using order... | ALGO | 0.998991 | 3.610114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.