uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b2b8424f-697e-4b93-a4a2-4388fc29ddcf | CIBC-Internal/boost | libs/graph/example/kuratowski_subgraph.cpp | #include <boost/graph/boyer_myrvold_planar_test.hpp>
#include <boost/graph/is_kuratowski_subgraph.hpp>
using namespace boost;
int main(int argc, char** argv)
{
typedef adjacency_list
< vecS,
vecS,
undirectedS,
property<vertex_index_t, int>,
property<edge_index_t, int>
>
graph;
... | ALGO | 0.97449 | 7.005524 |
22b7e3ee-dd14-417d-981d-d58c9762a6f3 | santi3223/PreseleccionIOI | Codeforces/Problemas/Otros/Construct_the_String.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define vc vector<char>
#define ull unsigned long long
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second
#define ff(i, p, x) for (ll i = p; i < x; i++... | ALGO | 0.999068 | 3.81335 |
c68fb7a3-79ea-4b86-8858-df8583e9dd99 | BLBT1/MyLeetcodeSolution | Sorting/Quick Select/347. Top K Frequent Elements/347.top-k-frequent-elements.cpp | /*
* @lc app=leetcode id=347 lang=cpp
*
* [347] Top K Frequent Elements
*/
// @lc code=start
class Solution
{
public:
vector<int> topKFrequent(vector<int> &nums, int k)
{
unordered_map<int, int> cnts;
for (auto i : nums)
{
cnts[i]++;
}
vector<pair<int, in... | ALGO | 0.999967 | 5.974501 |
8559d47d-08aa-485d-89c2-5777cc57078d | hek-git/problem_solving | programmers/Lv. 2/20240108_행렬의 곱셈.cpp | #include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2) {
vector<vector<int>> answer;
for(int i = 0; i < arr1.size(); i++){
vector<int> tmp;
for(int j = 0; j < arr2[0].size(); j++){
int sum = 0;
... | ALGO | 0.999853 | 5.268888 |
d41d675a-ca25-475c-87b5-7b1d45a76dfc | Khaleeq01/Leetcode-problems-solutions | 0443-string-compression/0443-string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int i=0;
int ansIndex=0;
int n=chars.size();
while(i<n){
int j=i+1;
while(j<n && chars[i]==chars[j]){
j++;
}
chars[ansIndex++]=chars[i];
int count=... | ALGO | 0.999995 | 6.406136 |
abbeded0-a932-4ed0-b7e7-f31254af59d2 | dwfrank1/BoostSearch | Boost_Searcher/boost_1_83_0/libs/geometry/test/cs_undefined/other.cpp | // Boost.Geometry
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#include "common.hpp"
#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/algorithms/simplify.hpp>
template <typename G>
inline void simplify(G const& g1, G & g2)
{
bg::simplify(g1, g2, 1, bg::strateg... | ALGO | 0.976101 | 7.409091 |
fd33508b-199f-41b0-baa8-b8f349f4b311 | Sadat-09/Codeforces | Holiday Of Equality.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
max_element(arr[0],arr[n-1]);
}
| ALGO | 0.998407 | 3.47012 |
634103e7-b437-417e-9675-1f8098258834 | bcreane/hacker_rank | algorithms/strings/gem_stones.cpp | #include <cstdio>
#include <string>
#include <iostream>
#include <cmath>
#include <climits>
#include <unordered_map>
namespace {
typedef std::unordered_map<char, bool> CHash_t;
void
get_map_of_chars(const std::string& s, CHash_t& cp)
{
for (auto c:s) {
cp[c] = true;
}
}... | ALGO | 0.999535 | 4.950559 |
d2b16999-aad8-439d-8aa3-2d885d149ebc | Bo2874/DSA | Next-generation/DSA01009 - XÂU AB ĐẶC BIỆT.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int n, k, final = 0, dem = 0;
int a[100];
vector <string> v;
void init(){
for(int i = 1; i <= n; i++) a[i] = 0;
}
bool check(){
int cnt = 1;
for(int i = 1; i < n; i++){
if(a[i] == 0 && a[i] == a[i+1]) cnt++;
else {
if(cnt == k) return true;
... | ALGO | 0.999949 | 3.788421 |
63f7ef5a-5400-424e-8e7e-b9aedc4cc86f | Cdccc1/Huffman-Encode | decompressor.cpp | #include "decompressor.h"
Decompressor::~Decompressor() {}
// ʵʽѹĺ
void Decompressor::decompress(const std::wstring& inputFilename, const std::wstring& outputFilename)
{
// ԶƷʽļ
std::wifstream inputFile(inputFilename, std::ios::binary);
std::wofstream outputFile(outputFilename);
// ļ׳`
if (!inputFile.is_open() ... | TOOL | 0.961032 | 4.116105 |
8d8ffbcc-4ee9-43bb-a828-789e169c751f | MCKG-L/codes | 算法模板/00经典题/04动态规划/杂项/表达式.cpp | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
using i128 = __int128;
typedef pair<int,int> PII;
using ll = long long;
const int N = 5e5 + 10,mod = 1e9 + 7,inf = 1e18;
/* abc_403_f
用一个只包含 +、*、1、( 和 ) 的表达式表示出 N,求最短的满足条件的表达式。
403: 1+(1+1+1)*(1+11+11+111)
11 : 11
9 : (1+1+1)*(1+1+1)... | ALGO | 0.999976 | 5.232662 |
6f2c5ee1-50dc-4244-9667-b77165603228 | lishun1995/leetcode | 60.最大子序列和.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
using namespace std;
class Solution {
public:
int FindGreatestSumOfSubArray(vector<int> array) {
int __max = array[0];
int currentMax = __max;
for(int i = 1; i < array.size(); i++)
{
if(currentMax... | ALGO | 0.999813 | 4.716673 |
05b25eeb-4e27-42e3-99de-bd7a9c9dde17 | lld2006/my-c---practice-project | 297/zrep.cpp | #include <cstdio>
#include "../lib/typedef.h"
#include <vector>
using namespace std;
int main(){
i64 limit = 100000000000000000;
//i64 limit = 1000000;
vector<i64> fibvec;
fibvec.push_back(1);
fibvec.push_back(2);
int pos = 1;
i64 value = 0;
while(true) {
value = fibvec[pos] + fi... | ALGO | 0.999394 | 3.394349 |
d16015b5-79f5-48f5-941a-b222af30e176 | AdithyaViswanathan/Codeforces | 285C.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
ll n,temp;
vector<ll>a;
cin>>n;
for(int i=0;i<n;i++)
cin>>temp,a.push_back(temp);
sort(a.begin(),a.end());
temp = 0;
for(int i=0;i<a.size();i++)
temp += abs(a[i]-(i+1));
cout<<temp;
}
int main()
{
long testcase = 1;
//cin >... | ALGO | 0.999392 | 3.995696 |
345ef9ac-7a48-4f15-b9df-ccafd58580ae | nicolasnna/trilateration_xbee_ros | trilateration/src/trilateration_node.cpp | #include "trilateration.cpp"
int main(int argc, char **argv){
// Inicilizar nodo
ros::init(argc,argv, "Trilateration");
ros::NodeHandle nh;
Trilateracion Trilateracion(&nh);
// Frecuencia
ros::Rate freq(30);
while(ros::ok()){
//Trilateracion.PublicarMensaje();
ros... | TOOL | 0.916206 | 3.449542 |
302880be-0875-4a43-a89c-a8563ac8264e | Veraph/LeetCode_Practice | sword/14.cpp | #include <cmath> // pow()
// O(1) greedy
class Solution {
public:
int cuttingRope(int n) {
if (n == 2)
return 1;
if (n == 3)
return 2;
int cnt3 = n / 3;
if (n - cnt3 * 3 == 1)
cnt3--;
int cnt2 = (n - cnt3 * 3) / 2;
return pow(... | ALGO | 0.999993 | 5.486072 |
087f2c7d-83b7-471f-b68d-f89a850e555a | 113bommy/PathRepair | variable_trace/cpp/cpp_code/cpp_correct/cpp_correct_test_114_3.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> v;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
v.push_back(k);
}
sort(v.begin(), v.end());
int temp = n / 2;
int i = 0, j = 1;
while (j <=... | ALGO | 0.999848 | 3.483979 |
28da2d32-985f-43eb-ad9e-dd0be3dd7d5a | nobinov/image_resizer_server | include/boost_1_75_0/libs/intrusive/example/doc_assoc_optimized_code.cpp | using namespace boost::intrusive;
// Hash function for strings
struct StrHasher
{
std::size_t operator()(const char *str) const
{
std::size_t seed = 0;
for(; *str; ++str) boost::hash_combine(seed, *str);
return seed;
}
};
class Expensive : public set_base_hook<>, public unordered_set_base... | TOOL | 0.99485 | 7.03795 |
7703a868-8286-4573-89db-799e49d69265 | sangbumlikeagod/Leetcode_page | C++/MEDIUM/2530. Maximal Score After Applying K Operations.cpp | class Solution
{
priority_queue<int> pq;
public:
long long maxKelements(vector<int> &nums, int k)
{
for (int num : nums)
{
pq.push(num);
}
long long answer = 0;
while (k)
{
int highest = pq.top();
pq.pop();
ans... | ALGO | 0.999959 | 5.235621 |
aae35f4f-c6b5-47aa-be2e-91786f9dbf55 | mvschaik/aoc2021 | day15/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <climits>
#include <queue>
#include <unordered_set>
#include <algorithm>
// Make std::pair hashable. Not sure why it isn't...
namespace std {
template<typename T1, typename T2>
struct hash<std::pair<T1,T2>> {
std::size_t operator()(const std::pa... | ALGO | 0.999357 | 5.666014 |
697c1030-af86-45eb-b926-f28b860891a4 | Sivasubramani/LeetCode | StudyPlan/DataStructures/RemoveDuplicatesfromSortedList.cpp | // 83. Remove Duplicates from Sorted List
// Easy
// Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.
// Example 1:
// Input: head = [1,1,2]
// Output: [1,2]
// Example 2:
// Input: head = [1,1,2,3,3]
// Output: [1,2,3]
... | ALGO | 0.99997 | 5.892773 |
ca814d56-db76-46d0-bf87-d796ff6f94e9 | Vinioktaa/TugasPemrograman_ViniOktapiani2006059 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
1500afe8-4ac9-4dd4-84cc-c05849f97a32 | ishandutta2007/codeforces | chemthan/normal/739/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
... | ALGO | 0.999977 | 5.084199 |
b3c67cd5-df57-41c5-a95d-628caf7c59ce | ENG-MHS26/p. | main (14).cpp | #include <iostream>
using namespace std;
int main() {
int x[] = {10, 20, 30, 40, 50};
cout << "x: " << x << endl;
cout << "*x: " << *(x) << endl;
cout << "x + 1: " << x + 1 << endl;
cout << "*(x + 1): " << *(x + 1) << endl;
cout << "x + 2: " << x + 2 << endl;
cout << "*(x + 3): " ... | TOOL | 0.903548 | 3.500869 |
93eab708-ddf2-4262-af6b-dd7a4afdadc8 | Jishnu-Nandhiath/Placement-Preparation | HackerRank/30 day challenge/Day10_Binary_Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
string binary(int decimal)
{
string binary_value = "";
for(long int i = decimal ; i> 0 ; i/=2)
binary_value += to_string(i%2);
return binary_value;
}
int main()
{
int n;
cin>>n;
string bin = binary(n);
int count = 0;
int consecutive_ones = 0;
for(long int j ... | ALGO | 0.9998 | 4.765309 |
459ab655-28a0-4522-bc93-4081c20f6c65 | TCGBench/TCGBench | data/human_performance_code/human_performance_code_noip/P1061/ac_2.cpp | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int a[26];
int a1,a2,w;
bool add(){
int g=0;
for(int i=1;i<=w;i++)
if(a[i]!=a2-i+1){ g=i; break;}
if(g==0) return true;
a[g]++;
for(int i=g-1;i>=1;i--) a[i]=a[i+1]+1;
... | ALGO | 0.999986 | 3.142094 |
98887978-5870-4d40-a53b-b69fd2db2860 | raincross7/code-similarity | codes/train_code/problem138/problem138_29.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
int ans = 0, mx = 0;
rep(i, n)
{
if (h[i] >= mx)
{
... | ALGO | 0.999865 | 4.387645 |
a579374f-b6c6-4a69-b410-50d786265833 | Chrinkus/advent-of-code | 2017/cpp/day22_2.cpp | #include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
#include <fstream>
#include <cmath>
#include <algorithm>
using namespace std;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// map functions
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *... | ALGO | 0.999862 | 6.743951 |
967ec78a-5945-4502-a4c2-aa32d7aed08c | fashionverch/ladybird | UI/Headless/Test.cpp | #include <AK/ByteBuffer.h>
#include <AK/ByteString.h>
#include <AK/Enumerate.h>
#include <AK/LexicalPath.h>
#include <AK/QuickSort.h>
#include <AK/Vector.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/Directory.h>
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
#include <... | TEST | 0.868279 | 7.090148 |
8021b719-2540-4c77-a32f-24b36460e3c1 | xLLLxLLLx/xLLLx | contest/PKUSC/2018/B.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 25, M = (1 << 20), mod = 998244353;
ll a[N], fr[M], rf[M], v[M];
ll mul(ll x, ll y) {
return x * y % mod;
}
void Mul(ll &x, ll y) {
x = (x * y) % mod;
}
ll add(ll x, ll y) {
return (x + y) % mod;
}
void Add(ll &x, ll y) {
x = (x + ... | ALGO | 0.999903 | 3.839348 |
0950fa25-47fb-4609-94d5-9d48a6354cdb | SnoopyCodes/code | silver/notgrind/bs/loanrepayment/loanrepayment.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
bool sim(long long x, ll N, ll M, ll K) {
long long days = 0;
while (N > 0 && days <= K) {
days++;
long long give = N / x;
if (give > M) { N -= give; }
else { N -= M; }
}
return N <= 0 && days <= K;
}
int... | ALGO | 0.999983 | 3.87111 |
d8299d22-49e0-4410-9ce5-bc165ad2e0ee | ICraZZyBoY/Algorithms-Trainings | UNIVERSITY (ICPC, codeforces, contests, etc.)/CF/28.10.2023/B.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int t;
cin >> t;
string s1, s2;
int n, m;
while (t--)
{
cin >> n >> m;
cin >> s1 >> s2;
char c = 'a';
if (s2[0] == s2[m - 1])
c = s2[0];
for (int i = 0; i < m - 1; ++i)
... | ALGO | 0.999991 | 4.581519 |
567723c8-e011-4973-a007-0b0cac01ee52 | unclezhou486/ACM-Solutions | Mix/luogu/P_5937_CEOI_1999_Parity_Game(种类并查集).cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1e4+10;
int n,m;
int cnt;
int b[N];
int f[N];
struct node{
int u,v;
string str;
}a[N];
int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
void solve(){
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>a[i].u>>a[i].v>>a[i].str;
a[i].u--... | ALGO | 0.999958 | 3.989705 |
23c9e3fc-348b-4663-8071-984aeb3fcbb1 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7252_1.cpp | #include <bits/stdc++.h>
using namespace std;
int a = 101, b = 101, c = -1, d = -1, Xcentre, Ycentre, T[8];
bool inside_square(int x, int y) {
return (x >= a && x <= c && y >= b && y <= d);
}
bool inside_diamond(int x, int y) {
return ((abs(x - Xcentre) + abs(y - Ycentre)) <=
(abs(T[0] - Xcentre) + abs(T[... | ALGO | 0.999952 | 3.629357 |
2b6ad9d1-6663-442f-84d0-02b3113da5ba | xenial/algorithms | AoC/2021/14/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
#define sz size
#define rsz resize
#define ii pair<int,int>
void set_io(string filename = "") {
ios::sync_with_stdio(0);
cin.tie(0);
if (filenam... | ALGO | 0.999622 | 3.709011 |
697be22c-931e-4c5e-bb2c-3b5ff7a0b8d8 | brstu/OTIS-2024 | trunk/ii02616/task_01/src/1labasOTIS.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
using namespace std;
float alf = 0.6, bet = 0.8, c = 0.2, dlt = 1.0, es = 0.2;
vector<float> Linear(int tau, float temp) {
vector<float> res(tau); res[0] = temp;
for (int i = 1; i < tau; i++) {
res[i] = alf * res[i - 1] + bet *... | ALGO | 0.99861 | 3.596205 |
6034b082-9b02-4b81-9d4c-30c4290821b7 | Harashen/ArcadEngine | collision.cpp | #include "collision.hpp"
#include "player.hpp"
#include "rect.hpp"
#include "utils.hpp"
Uint32 Colision::Invert(Uint32 col)
{
Uint32 ret = 0;
/* Invert X */
if (col & COLLISION_TOP) {
ret |= COLLISION_BOTTOM;
}
if (col & COLLISION_BOTTOM) {
ret |= COLLISION_TOP;
}
/* Inve... | ALGO | 0.993152 | 5.647123 |
0745746b-296c-4203-b932-35201459edea | ericsato77/Bsc_Inf_me_03_21_COM221 | Projects/Lab-7/SwapNumbersWithPointers.cpp | #include <iostream>
using namespace std;
void swap(int *x, int *y); // function declaration
int main() {
int varA = 25;
int varB = 100;
cout << "varA before swap: " << varA << endl; // varA is 25
cout << "VarB before swap: " << varB << endl; // varB is 100
swap(&varA, &varB);
co... | ALGO | 0.999101 | 6.121829 |
8cdca3fa-a442-4bb8-a726-380e18687141 | g0at1/leetcode-solutions | cpp/27-remove-element/solution.cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int index = 0;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] != val) {
nums[index++] = nums[i];
}
}
return index;
}
};
| ALGO | 0.999878 | 6.178722 |
18a80e74-8287-4b7f-97a3-cf9fdda445f2 | AlexHuang006/self_driving | src/f1tenth_simulator/src/distance_transform.cpp | #include <cstddef>
#include <vector>
#include <cmath>
#include "f1tenth_simulator/distance_transform.hpp"
// Implementation based on the paper
// Distance Transforms of Sampled Functions
// Pedro F. Felzenszwalb and Daniel P. Huttenlocher
// http://people.cs.uchicago.edu/~pff/papers/dt.pdf
using namespace racecar_si... | ALGO | 0.999945 | 6.975525 |
d8684d67-6a28-40b0-a1a2-1ae9131c18e4 | sujalpahwa30/-CrackYourInternship | String/RabinKarpAlgorithmForPatternSearching.cpp | #include<iostream>
#include<string>
using namespace std;
#define d 256
void search(char pat[], char txt[], int q)
{
int M = strlen(pat);
int N = strlen(txt);
int i, j;
int p = 0;
int t = 0;
int h = 1;
for (i = 0; i < M - 1; i++)
h = (h * d) % q;
for (i = 0; i < M; i++) {
p = (d * p + pat[i]) % q;
t = (d... | ALGO | 0.999968 | 4.446859 |
48032458-9045-4140-8ac0-db7dc25352e1 | alamgir65/Daily-Problem-Solving | C_Numeric_String_Template.cpp | #include<bits/stdc++.h>
#define ll long long
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define cyes cout<<"Yes"<<endl;
#define cno cout<<"No"<<endl;
#define print(flag) (flag)? cout<<"YES\n" : cout<<"NO\n";
#define all(x) x.begin(), x.end()
#define nl cout<<endl;
#define endl '\n'
#define love int mai... | ALGO | 0.999634 | 4.544321 |
40e42001-0397-4608-9567-1b0ec1b19cd7 | Parthiv-MEV/SoC-CP | codeforces_2033E.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
long long n, k;
cin >> n >> k;
long long total = n * (2 * k + n - 1) / 2;
long long minDiff = LLONG_MAX;
... | ALGO | 0.999955 | 4.755651 |
122d8cbc-b66a-4994-b8fb-aabb764c3537 | nillmishra/DSA-in-CPP | 2D array/max_in_2d.cpp | #include <iostream>
#include <limits.h>
using namespace std;
int minimumnarray(int arr[][3]){
int mini= INT_MAX;
for (int i = 0; i<4; i++)
{
for (int j = 0; j<3; j++)
{
if(arr[i][j] < mini){
mini = arr[i][j];
}
}
}
return mini;
}
int... | ALGO | 0.999799 | 3.864161 |
38ba70b2-f988-4eb9-a70a-aa3b1b097a84 | Johannyjm/c-pro | AtCoder/abc/abc103/c.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
ll tmp;
while(m%n){
tmp = n;
n = m % n;
m = tmp;
}
return n;
}
ll lcm(ll m, ll n){
return... | ALGO | 0.999954 | 4.24383 |
82f68835-b921-4bc3-b6d3-99a212df3047 | ishandutta2007/codeforces | zylber/normal/115/E.cpp | #include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
#define MOD 1000000007
#define forn(a, n) for(int a = 0; a<(int) (n); ++a)
#define dforn(a, n) for(int a = (n)-1; a>=0; --a)
#define dforsn(a, ... | ALGO | 0.999807 | 4.087208 |
65c7b5bc-9e1c-4b61-9c67-6fa87b86bc15 | qkrwlgus5832/ps | boj/미로 만들기/미로 만들기.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <memory.h>
#include <limits.h>
using namespace std;
int graph[51][51];
int dir[4][2] = { {-1,0},{1,0},{0,-1},{0,1} };
int check[51][51];
int n;
class node {
public:
int x;
int y;
int count;
node(i... | ALGO | 0.999805 | 3.695238 |
0dd07ba3-e870-429d-8eb5-7b7bf48daa7e | cicuvc/LLVM-LA32R | libc/src/math/generic/dsqrtf128.cpp | #include "src/math/dsqrtf128.h"
#include "src/__support/FPUtil/generic/sqrt.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, dsqrtf128, (float128 x)) {
return fputil::sqrt<double>(x);
}
} // namespace LIBC_NAMESPACE_DECL
| ALGO | 0.933754 | 6.410752 |
5100b6ea-a3c7-4964-b47b-956a6e1f29cc | ZJUBCA/eosio-dapp-boilerplate | libc++/upstream/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp | // <vector>
// template <class InputIter> vector(InputIter first, InputIter last);
#include <vector>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
#if TEST_STD_VER >= 11
#include "emplace_con... | TEST | 0.893799 | 7.314195 |
b3a213e5-9829-4ce3-bd45-1d999c0c87f4 | ufwt/windows-XP-SP1 | XPSP1/NT/inetsrv/iis/ui/itools/linkchk/linkpars.cpp | #include "stdafx.h"
#include "LinkPars.h"
#include "link.h"
#include "lcmgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Constants
const CString strLocalHost_c(_T("localhost"));
void
CLinkParser::Parse(
const CString& strData,
const CString& strBaseURL,
... | TOOL | 0.880623 | 4.846183 |
f337a15d-7f9e-4fd6-9adc-6489e17b6c07 | Kumari08/Graph-DSA | 5dfs.cpp | // by Kumari NEHAAAAAAAAAAAAAAAAAAAAAA
#include<bits/stdc++.h>
using namespace std;
//Depth First Search
//The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and
//explores as far as possible along each branch before backtracking.
//recursive approach
templa... | ALGO | 0.99989 | 4.880407 |
c2fa1f56-c8fb-4422-b26b-8f370939393f | LucasProcopio/code-forces-challanges | beautiful_matrix.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repe(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
typedef vector<int> VI;
//header
int findMiddle(int n);
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, r, c, ans = 0;
vector<vector<in... | ALGO | 0.999951 | 3.936204 |
2e870f39-2644-4046-a2dd-2876250cff52 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_no_LineNumber/model/cpp/cpp_source/source_93.cpp | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
char a[10] = {0};
char b[10] = {0};
char bb = 1;
int hj = 0;
scanf("%c", &bb);
do {
a[hj] = bb;
hj++;
scanf("%c", &bb);
} while (bb != ':');
a[hj] = 0;
scanf("%s", &b);
int begA = -1;
int begB = -1;
for (int i = 0; a[i... | ALGO | 0.999665 | 3.183155 |
2e7429ae-d871-4ce5-81aa-961c4386e414 | FunctionLab/sleipnir | src/clustpivot.cpp | #include "stdafx.h"
#include "clustpivot.h"
#include "meta.h"
namespace Sleipnir {
/*!
* \brief
* Implements a randomized pivot clustering algorithm due to Ailon and Charikar.
*
* \param MatSimilarities
* Matrix of similarity scores between each pair of elements.
*
* \param dCutoff
* Description of paramete... | ALGO | 0.99933 | 6.362289 |
7fb2e8c1-d591-41de-a20a-881935f74f39 | HuntingtonPanda/DataStructure_Algo1 | sql/includes/tokenizer/state_machine_functions.cpp | #include "state_machine_functions.h"
//Fill all cells of the array with -1
void init_table(int _table[][MAX_COLUMNS]){
for(int i = 0; i < MAX_ROWS; ++i){
for(int j = 0; j < MAX_COLUMNS; ++j){
_table[i][j] = -1;
}
}
}
//Mark this state (row) with a 1 (success)
void mark_success(int... | ALGO | 0.868862 | 3.361441 |
4ad83c44-f2b0-4dd8-95e9-021389cfd17e | raincross7/code-similarity | codes/train_code/problem283/problem283_118.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
string s;
cin>>s;
int len = s.length();
int arr[len+1];
memset(arr,-1,sizeof(arr));
if(s[0]=='<')
arr[0] = 0;
if(s[len-1]=='>')
arr[len] = 0;
for(int i = 0;i<len;i++)
{
if(s[i]=='>' && s[i+1]=='<')
... | ALGO | 0.999872 | 3.498963 |
5c91fe4d-4ecc-4578-8188-5dc2e5d45e16 | divya9658/365-days-of-Coding | Power-of-Three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n <= 0) return false;
while(n%3==0){
n/=3;
}
return n==1;
}
}; | ALGO | 0.998752 | 6.035913 |
85e19cb6-096b-423a-813e-3f84d1f9ec93 | litmusos-mirror/frameworks_av | media/codecs/m4v_h263/dec/src/idct.cpp | /*
------------------------------------------------------------------------------
MODULE DESCRIPTION
This file contains the functions that transform an 8r8 image block from
dequantized DCT coefficients to spatial domain pirel values by calculating
inverse discrete cosine transform (IDCT).
------------------------... | ALGO | 0.999433 | 4.627599 |
dc001275-b15b-4dce-9cb6-726cf9c185a0 | FaizzE/C-Pus-Plus | C Plus Plus/ARRAY/reverseArray.cpp | #include<iostream>
#include<iomanip>
using namespace std;
void RevArray(int arr[], int n)
{
// 1st Method
for(int i = n-1; i >= 0; i--){
cout << arr[i] << " ";
}cout << endl;
// 2nd Method
for(int i = 0; i < n; i++){
cout << arr[n-1-i] << " ";
}
}
int main()
{
int xy[100] ... | ALGO | 0.999432 | 4.569253 |
da5b5b17-606d-4e8a-819e-6dfaa9e436ae | HekpoMaH/Olimpiads | Shumen AiB/more2013/Untitled Folder/ru-olymp-roi-2010-tests/4-sms/sms_ab_greedy1.cpp | //Greedy solution --- chooses K best in each layer.
#include <cstdio>
#include <cassert>
#include <memory>
#include <vector>
#include <cstring>
#include <algorithm>
using std::vector;
using std::pair;
using std::sort;
const int MAXN = 200000;
const int K = 3000;
char s[MAXN][12];
char st[12], fin[12];
int d[MAXN];
... | ALGO | 0.999757 | 3.005389 |
4dc492bd-5212-40d0-9fc4-6a7afec57823 | uef-machine-learning/fastdp | python/py_interf.cpp |
#include <Python.h>
#include <math.h>
#include <numpy/arrayobject.h>
#include <stdio.h>
#include "rknng/rknng_lib.h"
#include "rknng/dataset.hpp"
#include "rknng/knngraph.hpp"
#include "rknng/options.h"
#include "rknng/util.h"
#include "rknng/dataset.cpp"
#include "rknng/knngraph.cpp"
#include "rknng/options.cpp"
#i... | DATA | 0.996732 | 6.868474 |
1ba678ea-fe9d-4e6f-9604-f3d344ca739e | dezchavyu/c_project | Работа 18/XO.cpp | #include <iostream>
#include <Windows.h>
#include <ctime>
using namespace std;
const int SIZE3 = 3;
const int SIZE4 = 4;
const int SIZE5 = 5;
int flag = 3; // значение размера массива
int gamemode = 1;
int playerx;
int playery;
int win = 0;
int countmotion3 = 9;
int countmotion4 = 16;
int countmotion5 = 25;
... | TOOL | 0.948718 | 3.636739 |
7db328d8-6712-4d67-9a7e-4dd94328216a | ishandutta2007/codeforces | dottle/normal/1688/C.cpp | #include<bits/stdc++.h>
#define int long long
const int N=1005000;
using namespace std;
void solve(){
int t;cin>>t;t=t<<1|1;
vector<int> res(300);
while(t--){
string s;cin>>s;
for(auto x:s)res[x]^=1;
}
for(int i=0;i<300;i++)if(res[i])cout<<(char)i<<'\n';
}
main(){
ios::sync_with_stdio(0);
int _T=1;cin>>_T;... | ALGO | 0.999848 | 4.086423 |
d759c5a4-35f8-49ff-b637-b8985d6f8a6c | Bostrix/FSL-susan | newimage/armawrap/tests/newmat/newmatnl.cpp | //$$ newmatnl.cpp Non-linear optimisation
#define WANT_MATH
#define WANT_STREAM
#include "newmatap.h"
#include "newmatnl.h"
#ifdef use_namespace
namespace NEWMAT {
#endif
void FindMaximum2::Fit(ColumnVector& Theta, int n_it)
{
Tracer tr("FindMaximum2::Fit");
enum State {Start, Restart, Continue, Inter... | ALGO | 0.999966 | 6.228117 |
fd18fb6f-bbe5-4d65-9461-61e1084b2a44 | Alfred-TERNYNCK/Epitech | Year2/OOP/NANO/TEKSPICE/src/main_bs.cpp | #include <iostream>
#include <memory>
#include "../component/AndComponent.hpp"
#include "../component/FalseComponent.hpp"
#include "../component/TrueComponent.hpp"
#include "../component/NotComponent.hpp"
#include "../component/OrComponent.hpp"
std::ostream& operator<<(std::ostream& s, nts::Tristate v)
{
if (v == ... | TOOL | 0.942647 | 6.35507 |
1e7d7800-4a3c-4a38-8ae4-b45869cd0214 | sharc-lab/LightningSim | llvm-project/clang/lib/AST/DeclObjC.cpp | #include "clang/AST/DeclObjC.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/IdentifierTabl... | TOOL | 0.99038 | 3.511175 |
36de9d68-12b5-4b33-acdc-f22e437b93b3 | moinulislamsajid/CodeForces_Group_Contest | GroubContest/Contest2/G.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n,k;
cin>>n>>k;
vector<ll> res;
ll sum = n*(n+1)/2;
// cout<<sum<<endl;
if(k>sum)
{
cout<<-1<<endl;
contin... | ALGO | 0.999969 | 4.530955 |
b988d86e-6c8a-42ab-b424-c49d359c226d | marktoakley/LamarckiAnt | GMIN/source/OXDNAinterface/MD_CPUBackend.cpp | /*
* MD_CPUBackend.cpp
*
* Created on: 03/set/2010
* Author: lorenzo
*/
#include "MD_CPUBackend.h"
#include "IOManager.h"
template<typename number>
MD_CPUBackend<number>::MD_CPUBackend(IOManager *IO) : MDBackend<number>(IO) {
this->_is_CUDA_sim = false;
}
template<typename number>
MD_CPUBackend<number>::... | ALGO | 0.999402 | 3.706078 |
6413b7c4-6491-4df3-86dd-3f6b95f1ef26 | the-indian-dev/cirnoYSF | public/tests/batch/ysclass11/YsParallelMergeSort/test.cpp | #include <ysclass11.h>
YSRESULT BasicTest(YsThreadPool &thrPool)
{
int r[48]=
{
13,47,89,01,68,51,23,04,56,80,
17,01,34,10,23,19,41,81,23,48,
15,68,90,61,85,50,17,12,30,16,
03,46,95,13,49,56,13,18,23,74,
01,63,95,76,19,10,23,65
};
YSRESULT res=YSOK;
YsSimpleParallelMergeSort(48,r,thrPool);
for(auto R... | TEST | 0.990957 | 5.183848 |
4ab8cc3e-a0c1-4916-9d53-2d952ba49cdf | sarvex/leetcode-d | lcof2/剑指 Offer II 019. 最多删除一个字符得到回文/Solution.cpp | class Solution {
public:
bool validPalindrome(string s) {
for (int i = 0, j = s.size() - 1; i < j; ++i, --j)
if (s[i] != s[j])
return check(s, i + 1, j) || check(s, i, j - 1);
return 1;
}
bool check(string s, int i, int j) {
for (; i < j; ++i, --j)
... | ALGO | 0.999981 | 6.395447 |
5b3cb351-0190-4277-8011-2f5e8bdfdefd | suxutao/LeetcodeList | cn/2608-shortest-cycle-in-a-graph .cpp | #include "../../../stdc.h"
using namespace std;
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
vector<int>G[1005];
int findShortestCycle(int n, vector<vector<int>>& edges) {
int ans=INT_MAX;
for (auto &i: edges){
G[i[0]].push_back(i[1]);
... | ALGO | 0.999622 | 5.292684 |
7a5e0ef3-da6f-48ec-9447-edffad5101e4 | siddharth12s/LeetCode- | 0682-baseball-game/0682-baseball-game.cpp | class Solution {
public:
int calPoints(vector<string>& operations) {
stack<int> st;
for(auto s : operations){
if(s=="+"){
int a = st.top();
st.pop();
int b = st.top();
st.push(a);
st.push(a+b);
}e... | ALGO | 0.999792 | 6.099619 |
56e6739a-0678-445e-aefd-aa8e4a2bd975 | akashgupta200134/DSA | primewithfor.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "enter the value of n" << endl;
cin >> n;
bool isprime = 1;
for (int i = 2; i < n; i++)
{
if (n % i == 0)
{
cout << " not a prime number" << endl;
isprime = 0;
break;
... | ALGO | 0.999318 | 3.628026 |
51286986-6f7e-4503-af9f-4b18b8d714d3 | smileakklpl/TQC_Plus-Cpp-version2 | 4.字串與檔案處理/404.cpp | //題目: 字母出現次數
//輸入: 字串input(限制50個字元)
//輸出: 出現次數最多的字母與次數
#include <iostream>
#include <cstring>
using namespace std;
int main() {
int n[26] = {0};
char input[50];
cin >> input;
for (int i = 0; i < strlen(input); i++){
n[input[i] - 'a']++;
}
int max = 0, position;
for (int i = 0; i... | ALGO | 0.99967 | 5.170673 |
123a35b3-3dd3-490f-8837-3cf87bf04eb1 | Abhinav-Kosta/ACC45DAYSOFCODE-2024 | Day7-Jump_Game.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
bool canJump(vector<int>& nums) {
int size = nums.size();
if(size == 1){
return true;
}
int farthest = 0;
for(int i = 0; i < size; i++){
if(i > farthest){
... | ALGO | 0.999918 | 6.013746 |
05bd8400-c88b-4a2b-85fd-b2b230cd4d80 | tcjcxy30/pedsim_ros-1 | pedsim_simulator/src/force/alongwallforce.cpp | #include <pedsim_simulator/config.h>
#include <pedsim_simulator/element/agent.h>
#include <pedsim_simulator/element/obstacle.h>
#include <pedsim_simulator/force/alongwallforce.h>
#include <pedsim_simulator/scene.h>
#include <ros/ros.h>
AlongWallForce::AlongWallForce(Agent* agentIn) : Force(agentIn) {
// initialize ... | TOOL | 0.938861 | 5.99804 |
02d2afe4-07bb-4281-b38c-4d975d47e86b | gutic/progcient | parcial.cpp | //parcial 4/05
//lo hice en linux mint
#include <iostream>
#include <math.h>
using namespace std;
int main(){
#define COD(FLAG,RADIO,ANGULO) float((flag == 1 ? (radio*cos(angulo)) : (radio * sin(angulo)))) //(salario < 200001 ? 3 : 4) ))
float radio, angulo, x, y;
int flag = 1;
do {
std::cout << "Ingrese u... | ALGO | 0.973975 | 3.537811 |
003c5953-06c3-464e-9062-6ff1977bbb1c | ashvin232002/StriverSDESheet | Tree/ZigZag.cpp | #include<bits/stdc++.h>
using namespace std;
//User function Template for C++
// Structure of the node of the binary tree is as
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
class Solution{
public:
//Function to stor... | ALGO | 0.999992 | 5.453972 |
25a1dbf8-1972-4191-b646-6a8829f4454a | YJ243/python_codingTest | codetree_backtracking/chooseLine_해설.cpp | /*
* 2024.03.20
* 해설 풀이
* 모든 선분을 선택하는 조합을 만들어본 후, 그 중 선분끼리 전혀 겹치지 않는 경우들 중 최대 선분의 수를 구하면 된다
* 두 선분이 겹치는지 여부는 한 점이 다른 선분에 속하는지 여부로 쉽게 판단 가능하다.
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;
int n;
pair<int, int> segments[MAX_N];
int ans;
vector<pair<int, int> >... | ALGO | 0.99993 | 5.927948 |
4ca5fcc5-20a3-42df-83e4-01131336b2cb | hoangnguyen2809/DSA | Disjoint Set (Union-Find Algorithm)/leet1579.cpp | class UnionFind {
private:
vector<int> parent;
vector<int> rank;
public:
UnionFind(int n) {
parent.resize(n);
rank.resize(n, 0);
for (int i = 0; i < n; ++i) {
parent[i] = i;
}
}
int find(int x) {
if (parent[x] != x) {
parent[x] = find(... | ALGO | 0.99989 | 5.773188 |
3e87aa31-0fbe-458c-8b8e-8ca41ae8e64b | sohamsshah/AlgorithmsONLY | Sorting_Algorithms/C++/selection_sort.cpp | // Selection Sort
#include <bits/stdc++.h>
using namespace std;
void swap(int *a, int *b){
int temp = *a;
*a = *b;
*b = temp;
}
void SelectionSort(int arr[], int n){
int i, j, min_idx;
for (i=0; i< n-1; i++){
min_idx = i;
for(j=i+1; j<n; j++){
if(arr[j] < arr[min_idx]){
min_idx = j;
}
swap(&arr[m... | ALGO | 0.999741 | 4.724625 |
bedcff2a-252e-4827-85d2-bc80a07d61ff | Md-Nasiat-Hasan-Fahim/Problem-Solving-with-C | .acmx/solutions/Codeforces - Codeforces Round 744 (Div. 3)/E_1_Permutation_Minimization_by_Deque.cpp | #include<bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define int long long
#define all(x) x.begin(),x.end()
#define pb push_back
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define check(x) cout << (#x) << " is " << (x) << endl;
const int mod ... | ALGO | 0.999879 | 4.002876 |
8ec7750b-7313-48fc-afc2-c9060d7b95cc | raincross7/code-similarity | codes/train_code/problem467/problem467_129.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int K, N;
cin >> K >> N;
vector<int> A(N);
rep(i, N) cin >> A[... | ALGO | 0.999968 | 3.939477 |
a7cd9d53-aa5c-4433-8584-7ba7636d0bc7 | AutomotiveAIChallenge/aichallenge2023-integration-final | src/universe/autoware.universe/planning/behavior_velocity_planner/src/scene_module/intersection/scene_merge_from_private_road.cpp | #include <lanelet2_extension/regulatory_elements/road_marking.hpp>
#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <scene_module/intersection/scene_merge_from_private_road.hpp>
#include <scene_module/intersection/util.hpp>
#include <utilization/boost_geometry... | TOOL | 0.973311 | 4.654211 |
7c81ed92-dd9e-4fcf-a305-c9e44859a73c | roylee0305/StudyAndPractice | DataStructuresAndAlgorithm/ArrayCompare/main.cpp | /* Given 2 arrays, create a function that let's a user know (true/false) whether these two arrays contain any common items
For Example:
const array1 = ['a', 'b', 'c', 'x'];
const array2 = ['z', 'y', 'i'];
should return false.
-----------
const array1 = ['a', 'b', 'c', 'x'];
const array2 = ['... | ALGO | 0.998782 | 5.24276 |
d6da10c5-7ccc-46bd-aba7-c720ba6a83b0 | Dinkar12/-CrackYourPlacement | 0437-path-sum-iii/0437-path-sum-iii.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.999965 | 5.957401 |
c00eb775-dbfa-4b56-b625-e3f1f0643689 | mortezasj11/FoundationCT | env/Lib/site-packages/mmcv/ops/csrc/parrots/knn.cpp | // Modified from
// https://github.com/CVMI-Lab/PAConv/tree/main/scene_seg/lib/pointops/src/knnquery_heap
#include "pytorch_cpp_helper.hpp"
#include "pytorch_device_registry.hpp"
void knn_forward_impl(int b, int n, int m, int nsample, const Tensor xyz,
const Tensor new_xyz, Tensor idx, Tensor di... | ALGO | 0.987722 | 6.536577 |
49b34af1-9b72-46ed-a18a-7f318686b27d | jianminchen/leetcode-14 | src/remove-duplicate-letters.cpp | class Solution {
public:
string removeDuplicateLetters(string s) {
int counts[26] = {};
bool inresult[26] = {};
for(char c: s) counts[c-'a']++;
string result = "";
for(char c: s) {
counts[c-'a']--;
if(inresult[c-'a']) continue;
while(!resul... | ALGO | 0.999968 | 6.87148 |
3c74f179-974d-424e-a88f-8a15e8aa9043 | sumaia31/Codes | Celcius to Farenhite.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
float c,f;
cout<<"Please enter celcius temperature: "<<endl;
cin>>c;
f=(1.8*c)+32;
cout<<"Farenhite temperature is :"<<f<<endl;
return 0;
}
| TOOL | 0.916198 | 3.651867 |
adef4e2e-952c-4a55-b9c9-53f9e789d221 | blackbeardONE/CheggHero | coursehero_auto_reg/account_registered_on_20180325/txtsource/kthmax.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<ll,int> ii;
#define fill(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFO... | ALGO | 0.999992 | 3.975377 |
fc014237-e313-410e-809f-1b91bbd01985 | NitinChaudhary007/Data-Structure-with-Cpp | A2Z Strivers DSA Course/step13_Tree/Medium Problems/02Check_Balance.cpp | #include "Header.h"
class Solution {
public:
bool isBalanced(TreeNode* root) {
if(height(root) == -1)
return false;
else
return true;
}
int height(TreeNode* root) {
if(root==NULL)
return 0;
int leftHeight = height(root->left);
... | ALGO | 0.999362 | 6.428359 |
06283a66-8be3-473b-b3be-2c1e015fcf3f | ishandutta2007/codeforces | tmwilliamlin168/normal/915/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
string a, b;
int cntA[10];
string solve(int i, bool smaller) {
if(i>=b.size())
return "";
if(!smaller&&cntA[b[i]-'0']) {
--cntA[b[i]-'0'];
string c=solve(i+1, 0);
++cntA[b[i]-'0'];
if(c!="fk")
return b[i]+c;
}
for(int j=smaller?9:b[i... | ALGO | 0.999974 | 4.374111 |
4969753d-c1e4-48f8-a40b-1f9d0e64eb75 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9118_4.cpp | #include <bits/stdc++.h>
using namespace std;
int n, ans = 0;
char a[251];
int main() {
cin >> n >> a;
int m = strlen(a);
if (a[m - 1] != 0) a[m] = '0';
for (int i = 0; i <= m; i++) {
if (a[i] == '1' && a[i + 1] == '0') {
ans++;
printf("%d", ans);
ans = 0;
i++;
continue;
} ... | ALGO | 0.999974 | 4.013427 |
2a8380eb-cd18-4edd-b1b5-91284aabb77f | kainotoa/GOWTool | src/MathFunctions.cpp | #include "pch.h"
#include "MathFunctions.h"
uint32_t BitHacks::RoundUpTo2(uint32_t v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
return v;
}
Vec3::Vec3(const float& x, const float& y, const float& z)
{
X = x, Y = y, Z = z;
}
float Vec3::magnitude(void)
{
return (sqrt(X * X... | TOOL | 0.954084 | 3.658875 |
56008e2e-383e-42f9-a254-d88b2ba8d3e9 | ChrisBGonz/College_Code_Projects | Year 3/Other/Cipher Decoders (Revisited): main.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int choice;
cout << "Select the cipher you want to decrypt from the choices below:\n";
cout << "1. Affine\n";
cout << "2. Caesar\n";
cout << "3. Vigenere\n\n";
cout << "Enter your choice (1-3): ";
cin >> choice;
... | ALGO | 0.989692 | 3.765277 |
da87e503-a3e0-45ea-ac31-9d12078e3304 | 27diego/CST370 | Concepts/Dijkstra's and A*/Dijkstra's and A*/main.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <climits>
using namespace std;
struct GraphNode {
int data; // whatever data it holds
vector<pair<GraphNode *, int> > neighbors;//pairs of neighbor nodes and their weights
public:
GraphNode(int d)//constructor ... | ALGO | 0.99988 | 4.750217 |
d6cf5b4d-f54b-4fd2-bfb3-a3ca722bb70b | rasitabay/lastmile_challenge | src/code/sort.cpp | /*
* sort.cpp
* created on: April 24, 2013
* last updated: May 10, 2020
* author: Shujia Liu
*/
#ifndef __Sort__
#include "sort.h"
#endif
TSort* tSort = NULL;
void InitSort(){
tSort = new TSort();
}
void swap(int &x, int &y){
int s=x;
x=y;
y=s;
}
void selectionSort(vector<int>& Arg, int l, int r){... | ALGO | 0.999849 | 5.123093 |
d9a69508-609c-4075-a3cc-e06362217b2a | zsustc/RNNSLAM | src/FullSystem/PixelSelector2.cpp | #include "FullSystem/PixelSelector2.h"
//
#include "util/NumType.h"
#include "IOWrapper/ImageDisplay.h"
#include "util/globalCalib.h"
#include "FullSystem/HessianBlocks.h"
#include "util/globalFuncs.h"
namespace dso
{
PixelSelector::PixelSelector(int w, int h)
{
randomPattern = new unsigned char[w*h];
std::srand... | ALGO | 0.987402 | 4.399215 |
e26a45e6-6bdc-4a01-a584-9539f2f5d24b | vrangr1/competitive-programming | contests/codeforces/cf_rounds/cf_round_9--/codeforces_916_div3/d.cpp | /***************************************************
* Author : Anav Prasad
* Nick : vrangr
* Created : Tue Dec 19 20:16:18 IST 2023
****************************************************/
#include <iostream>
#include <vector>
#include <string.h>
#include <ctype.h>
#include <set>
#include <stdlib.h>
#include <map>
#i... | ALGO | 0.999962 | 4.589353 |
5e6713aa-9ccc-4ba6-8a71-b41b246b33a1 | KIT-ISAS/iviz | iviz_opencv/aruco/src/charuco.cpp | #include "precomp.hpp"
#include "opencv2/aruco/charuco.hpp"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
namespace cv {
namespace aruco {
using namespace std;
/**
*/
void CharucoBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderBits) {
CV_Assert(!outSize.empty());
CV_Asser... | TOOL | 0.98421 | 6.122703 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.