uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
785cfe44-187e-43ba-bf68-5bcc4ddd87a0 | KuldeepSingh5763/Zepskill | C++/array/firstinterview.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter number : ";
cin>>n;
for(int row=1;row<=n;row++){
for(int col=n;col>=1;col--){
if(row>=col){
cout<<"*"<<" ";
}else{
cout<<" "<<" ";
}
}
cout<<e... | ALGO | 0.999749 | 3.873141 |
ee6fa408-05fb-4d53-9cca-714a8efa4695 | Ownfos/Waffle | libraries/boost_1_72_0/libs/mpl/example/fsm/player2.cpp | #include <vector>
#include <ctime>
#include <iostream>
#if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 310
namespace std { using ::clock_t; }
#endif
namespace mpl = boost::mpl;
using namespace mpl::placeholders;
// A metafunction that returns the Event associated with a transition.
template <class ... | ALGO | 0.909776 | 7.724843 |
99f2877d-244c-4ffa-abc2-3a72c3707998 | jenasuman/LeetCode-Solutions | 287-find-the-duplicate-number/287-find-the-duplicate-number.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
int i=nums[0];
while(nums[i]!=-1){
int j=nums[i];
nums[i]=-1;
i=j;
}
return i;
}
}; | ALGO | 0.999965 | 5.687914 |
d6108230-90fc-411a-8678-9ecf09314a84 | SequoiaDB/SequoiaDB | thirdparty/boost/libs/graph_parallel/test/distributed_graph_coloring_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#define PBGL_ACCOUNTING
#include <boost/graph/use_mpi.hpp>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/distributed/boman_et_al_graph_coloring.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boos... | ALGO | 0.914805 | 6.795743 |
81d11e84-c7e8-480c-8c75-d5bac7516ef2 | vedantchawla07/DSARepo | graphs/shortestPathinUndirectedGraph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> shortestPath(int n, int m, vector<vector<int>>& edges) {
// all will have T.C of ElogV.
set<pair<int, int>> s;
vector<int> dist(n + 1);
vector<int> ans;
... | ALGO | 0.999962 | 5.772609 |
ec210b4b-eb0d-4a12-9774-6387368c56bf | mesiddhantcodes/Pre-Placement-Training-Program | Assignment03/Problem2.cpp | // Question 2
// Given an array nums of n integers, return an array of all the unique quadruplets
// [nums[a], nums[b], nums[c], nums[d]] such that:
// ● 0 <= a, b, c, d < n
// ● a, b, c, and d are distinct.
// ● nums[a] + nums[b] + nums[c] + nums[d] == target
// You may return the ans... | ALGO | 0.999898 | 5.588972 |
7cdccaf1-c08e-4168-a068-58bb587003ae | jpovalles/Quiz-3-Parallel-Programming | matrixVector/matrixVectorPthreads.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <pthread.h>
using namespace std;
int **matrix;
int *vector;
int *result;
int cols;
#define NTHREADS 2
typedef struct {
int startRow;
int endRow;
}ThreadData;
void *multiplyRow(void *arg) {
ThreadData* data = (ThreadData*) arg;
int sta... | ALGO | 0.999242 | 4.064693 |
d236dc70-5b81-4e41-8299-ccf515b2b2bf | SanchitPandey26/CPP | Binary-Search/Answers/11.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, k;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++){
cin >> arr[i];
}
cin >> k;
if (k > n){
cout << -1 << endl;
return 1;
}
int low = *max_element(arr, arr+n), high = accumulate(arr,arr+n,0);
... | ALGO | 0.999992 | 4.167232 |
49f1987a-3306-4190-932e-83d10d1f824d | ZakariaZhlat125/problem_codeforces | Jumping Mario/main.cpp | #include<bits/stdc++.h>
using namespace std;
const int m=50;
int main(){
int k,n;
cin>>k;
for(int i=0;i<k;++i){
cin>>n;
int high=0;
int low=0;
int ar[m];
for(int j=0;j<n;j++){
cin>>ar[j];}
if(n==1){
cout<<"Case "<<i+1<<": "<<"0 0"<<endl;
}
else{
... | ALGO | 0.999414 | 3.464074 |
aa7cd8b2-06c6-45d0-a131-eb12fad28d88 | tlsgkdns/study | Backtracking/2549_Rubik'sRectangle.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<pair<int, pair<int, int>>> mv, ansMv;
int arr[4][4], ans = 8;
int calcDismatch()
{
int ret = 0;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
ret += (i * 4 + j + 1 != arr[i][j]);
return ret;
}
void rotateRow(int r)
{
int tmp = arr[r]... | ALGO | 0.999705 | 3.671751 |
4260be81-de3b-4a1e-827c-d4f03f47acb9 | sifat-hossain-niloy/LLMs-Performance-in-ICPC-Problems | Solution-Codes/2016/O1-Preview/F.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
using namespace std;
struct Node {
int downstream; // Index of downstream node (0 for sea)
int64_t distance; // Distance to downstream node
vector<int> upstreams; // Indices o... | ALGO | 0.99994 | 5.270822 |
a99d266e-737d-4a90-b56c-38a44c86e590 | Prateek-5/Leetcode-Problems | Graph-Problems/997-Find-the-Town-Judge.cpp | /*
In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody.
Everybody (except for the town judge) trusts the town judge.
There is exactly one person that satisfies properties 1 and 2.
You are ... | ALGO | 0.999944 | 6.08604 |
138acff5-b1ef-4b65-9d60-4c4c41388e1b | oneapi-src/SYCLomatic | llvm/tools/llvm-exegesis/lib/Clustering.cpp | #include "Clustering.h"
#include "Error.h"
#include "SchedClassResolution.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include <algorithm>
#include <deque>
#include <string>
#include <vector>
namespace llvm {
namespace exegesis {
... | ALGO | 0.99784 | 7.06417 |
b058c605-017c-4056-a633-152da427b231 | kalpeshbhosle/C-Programs | Untitled3.cpp | #include<iostream>
using namespace std;
int myfunction(int a,int b)
{
if (a > b)
return a;
else
return b;
}
int main ()
{
int myfunction(int a,int b)
int x;int y;
int myfunction(int a,int b);
cout << "enter your two numbers :"<<endl;
cin >>x>>y;
... | ALGO | 0.99911 | 3.700587 |
c217f3cc-e209-4878-9d7c-ac3bb5b03e94 | ishandutta2007/codeforces | pctprobability/normal/1542/B.cpp | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using ll = long long;
using ld = long double;... | ALGO | 0.999733 | 4.776181 |
d401345d-8281-450e-9503-5ad6fc7743c2 | ishandutta2007/codeforces | satashun/normal/1621/E.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
template <class T>
V<T> make_vec(size_t ... | ALGO | 0.999984 | 4.680717 |
78cb078b-039c-47b6-b8a8-6189bb5e62e7 | garimasinghgryffindor/POTD | 04 - Apr/18-Apr, Two Repeated Elements.cpp | //User function template for C++
class Solution {
public:
//Function to find two repeated elements.
vector<int> twoRepeated (int arr[], int n) {
vector<int>res;
long long sum = (long long)n*(n+1)/2;;
long long sum_squares = (long long)n*(n+1)*(2*n+1)/6;
long long org_sum = 0;
... | ALGO | 0.999905 | 4.478335 |
2f519774-720d-44d3-a3ad-f65fbcf51665 | IDA-TUBS/CC_LinkMonitor | thirdparty/boost_1_73_0/tools/bcp/scan_licence.cpp | #include "licence_info.hpp"
#include "bcp_imp.hpp"
#include "fileview.hpp"
#include <fstream>
#include <iostream>
const int boost_license_lines = 3;
static const std::string boost_license_text[boost_license_lines] = {
"Distributed under the Boost Software License, Version 1.0. (See",
"accompanying file LICENSE_1_0... | TOOL | 0.943117 | 6.800427 |
9c696233-d360-4cee-8fc8-cb9fcb30f0ba | luboolu/Programmers | Level1/로또의최고순위와최저순위/solution.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> lottos, vector<int> win_nums) {
vector<int> answer;
int num = 0;
int zero = 0;
for (int i = 0; i < lottos.size(); i++){
if (lottos[i] != 0)
for (int j = 0; j < win_nums.si... | ALGO | 0.999904 | 4.702855 |
c78b36de-827d-46b8-8ed5-6c1bef8c9ad8 | narujh/2014 | ivb-3-14/Safronov.I.A/lab02.cpp | #pragma warning(disable : 4996)
#include <cstdio>
#include <cstdlib>
#include <cstring>
static double **
__loadMatrix(
const char * const szFileName,
int * piRows,
int * piCols);
static void
__destroyMatrix(double **pMatrix, int rows, int cols);
static int
__exception(const char * const szMessage)
{
fprintf(st... | ALGO | 0.949571 | 4.288353 |
92133067-d8d5-404d-a1ed-3c7e2672411f | babayaga-13/Competitive-Programming | CODEFORCES/div.2/C_Card_Game.cpp | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using pbds = tree<T, null_type, less<T... | ALGO | 0.999965 | 4.848368 |
294e3598-d98c-4157-82cc-f97383890307 | Chandan193/LeetCode-Solution | 342-power-of-four/power-of-four.cpp | class Solution {
public:
bool isPowerOfFour(int n) {
if(n<=0) return false;
while(n>0){
if(n!=1 && n%4!=0) return false;
n /= 4;
}
return true;
}
}; | ALGO | 0.99951 | 5.844475 |
a5e13901-db20-4fb6-b0f0-0f346e1dd26c | BruJu/AdventOfCode | 2023/src/day24.cpp | #include "../../common/advent_of_code.hpp"
#include <vector>
using i64 = std::int64_t;
// https://adventofcode.com/2023/day/24
struct LineEquation {
// y = mx + b
double m;
double b;
double compute(double x) const {
return m * x + b;
}
std::optional<std::pair<double, double>> intersect(const LineEq... | ALGO | 0.995821 | 5.633665 |
35b2dfee-c7d8-4df2-a64a-20cb33b6d3ab | wowoto9772/Hungry-Algorithm | LAVIDA/2414/solution.cpp | #include <stdio.h>
#include <memory.h>
int I[103];
int N[103];
int J[103][13];
int dp[10003][103];
int n, m;
int M(int a, int b){ return a < b ? b : a; }
int dy(int w, int i){
if (i > n)return 0;
if (dp[w][i] != -1)return dp[w][i];
dp[w][i] = 0;
for (int j = N[i]; j >= 0; j--){
int cst = j*I[i];
if (w + cst... | ALGO | 0.99997 | 3.06494 |
e26194f9-faea-4f90-b102-10fb22aefacc | WangX0111/op_fusion | llvm/utils/PerfectShuffle/PerfectShuffle.cpp | #include <cassert>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <vector>
struct Operator;
// Masks are 4-nibble hex numbers. Values 0-7 in any nibble means that it takes
// an element from that value of the input vectors. A value of 8 means the
// entry is undefined.
// Mask manipulation funct... | ALGO | 0.983424 | 4.59199 |
d2984308-dec9-4bb6-9c27-caf56e9d17ab | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2331_5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
vector<int> a(2 * n - 1);
for (auto &i : a) cin >> i;
int cnt = 0, ans = 0;
for_each(a.begin(), a.end(), [&](int x) { cnt += x < 0; });
for_each(a.begin(... | ALGO | 0.999978 | 4.668103 |
f9283209-29a2-4bea-bead-66a468fffc98 | DeadTSAR/otTeacher | ЛЕКЦИИ (пятницы)/Поиск максимального элемента.cpp | // ConsoleApplication71.cpp: определяет точку входа для консольного приложения.
//
// ConsoleApplication71.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <vector>
#include <algorithm>
using namespace std;
int i = 20; //global
int mai0n... | ALGO | 0.9791 | 4.047198 |
1e8a1282-b5db-4fe1-b2df-888077c45eae | zhuwenxi/PFNN-TVM | third_party/eigen3/doc/examples/class_FixedBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived, 2, 2>
topLeft2x2Corner(MatrixBase<Derived>& m)
{
return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
}
template<typename Derived>
const Eigen::Block<const Derived, 2, 2>
topLeft2... | TOOL | 0.876798 | 6.661391 |
399b1093-8f56-4942-a42f-642328f56f84 | ceviert/cse211project | src/MoveValidator.cpp | #include "MoveValidator.hpp"
const Position directions[8] = {
{1,0}, // RIGHT
{-1,0}, // LEFT
{0,-1}, // UP
{0,1}, // DOWN
{1,-1}, // UPPER RIGHT
{-1,-1}, // UPPER LEFT
{-1,1}, // LOWER LEFT
{1,1} // LOWER RIGHT
};
const Position l_shape_directions[8] = {
{1,2}, // DOWN L FACING RIGHT
... | ALGO | 0.940347 | 6.535772 |
d3aa1c3e-588b-4e66-a67e-492acfa818e8 | gosth/MyLeetcodeOpen | offer46.Backtrack.AC.cpp | class Solution {
public:
void dfs(const std::vector<int>& numInteger, int currentIndex, int* result) {
if (currentIndex == numInteger.size()) {
*result += 1;
return;
}
// 使用一个字符
dfs(numInteger, currentIndex + 1, result);
// 使用两个字符
if (currentIndex < numInteger.size() - 1 && 0 != n... | ALGO | 0.999809 | 6.918016 |
07be0a50-17ab-4117-9963-f93fe320e073 | dimalit/ipt | src/lighting/lighting.cpp | #include "lighting.h"
#include <randf.h>
using namespace glm;
using namespace std;
light_intersection Lighting::last_sample;
// NB Although this is duplicated code, it allows to break dependency from main project
static float intersection_with_sphere(float radius, vec3 origin, vec3 direction){
//|origin + direc... | ALGO | 0.966194 | 4.611127 |
b97d11a8-50d5-46d3-8744-5fbbb2757667 | SADMAN30102001SAKIB/object-oriented-programming-in-cpp-and-java | CPP/CSE 1202/Lab/LAB 3/3iv.cpp | #include <iostream>
using namespace std;
class A
{
private:
int ax;
public:
A(int a)
{
ax = a;
cout << "Constructor of class A called." << endl;
}
int getAx()
{
return ax;
}
~A()
{
cout << "Destructor of class A called." << endl;
}
};
class B ... | TOOL | 0.890335 | 6.262247 |
1fbdf815-74e0-4d0b-baf5-7a8f143f2c65 | yuweichen1008/Side_Program | Xplane_Radar/example_radar.cpp | // Working Radar Code
#include <GL\freeglut.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
void Radar_Pattern(void);
void initGL();
void display();
void Keyboard(unsigned char, int, int);
float sw = 0;
int main(int argc, char* argv[])
{
printf("\n Hold 's' key down to sweep rad... | ALGO | 0.959467 | 5.494357 |
dc08af4e-707a-41bc-8969-06ae7faca339 | Matteovullo/Prog-I | ESAMI LABORATORIO/Esercizi classi/Calendario.cpp | /*Con riferimento all’oggetto di tipo Data costruito in un
esercizio precedente, si costruisca un oggetto Calendario che
contenga un array di puntatori a oggetti di tipo Data.
La classe possiede un costruttore che prende in input
l’anno e il giorno di inizio (ad esempio “Lunedì” se
il primo gennaio di quell’anno è... | TOOL | 0.960742 | 3.792545 |
07d3a97a-9ee3-42e7-802f-e084c1411d52 | Pratistha98/Comsc-210 | Assignment3/MyDynamicArray.cpp |
/*
School : Diablo Valley College
Term : 2019 Spring
Course : ComSc - 210,
Programmar : Pratistha Maharjan
Programmar's ID: 1650717
*/
#include <iostream>
#include <string>
#include <iterator>
#include <sstream>
#include <vector>
using namespace std;
#include <cctype>
#include "DynamicArray.h"
vector<string> parseS... | TOOL | 0.855116 | 4.006596 |
c437441f-572e-45da-b675-6922e65a8f47 | tejas238/Data-Structure-Projects | Event_Management_BST_ADT/main.cpp | //main.cpp for Program# 3 by Tejas Menon, CS163, last edited on 5/21.
//Purpose: main.cpp reads in data from the external file 'events_tej.cpp' and allows testing of
// all the BST functions in any user specified order
#include "header.h"
int main()
{
BST all_events;
ifstream in_file;
in_file.open("events... | TOOL | 0.856819 | 3.982959 |
b27f015c-060d-4439-b168-d3b5140c1b04 | sukritidawar/Data_Structures_and_Algorithms | dequebasic.cpp | #include <iostream>
#include <deque>
using namespace std;
//Data structure with min/max operations in O(1) time
struct MyDS{
deque<int>dq;
void insertMin(int x){
dq.push_front(x);
}
void insertMax(int x){
dq.push_back(x);
}
int getMin(){
return dq.front();
}
int ... | ALGO | 0.999942 | 4.462919 |
d361d3ef-a271-4824-b1bd-6693b2f2596d | been2525/embedded-system-2024 | day07/project8/sort01.cpp | #include <stdio.h>
void array(int ary[])
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
int num = ary[j];
if (ary[i] < ary[j])
{
ary[j] = ary[i];
ary[i] = num;
}
}
}
for (int i = 0; i < 8; i++)
{
printf("%d\n", ary[i]);
}
}
void main()
{
int ary[] = { 9,4,8,15,3,7,2,... | ALGO | 0.999917 | 3.614306 |
637c4383-0a8d-455b-b417-b7f3ef7ac7c1 | Dhruva1098/learnCpp | dsa/rest/bottom_view_bTree.cpp | #include <map>
#include <utility>
#include <queue>
using namespace std;
struct TreeNode{
int val;
TreeNode* left;
TreeNode* right;
};
vector<int> topView(TreeNode* root){
vector<int> out;
if(root == NULL) return out;
map<int,int> map;
queue<pair<TreeNode*,int>> q;
q.push({root,0});
while(!q.empty()){
... | ALGO | 0.999971 | 5.422225 |
b37c59db-ec14-4134-a4d5-692fb5026d7b | ritik955/Newton_School_DSA_Assignments | Nov Assignment/Sorting/Implementing_Merge_Sort.cpp | #include<bits/stdc++.h>
using namespace std;
void merge(int arr[], int p, int q, int r) {
int n1 = q - p + 1;
int n2 = r - q;
int L[n1], M[n2];
for (int i = 0; i < n1; i++)
L[i] = arr[p + i];
for (int j = 0; j < n2; j++)
M[j] = arr[q + 1 + j];
int i, j, k;
i = 0;
j = 0;
k = p;
while (i < ... | ALGO | 0.999979 | 4.614262 |
c49fdba4-2bc0-4214-8ff1-e901ec8ca38c | CUNY-TTP-Technical-Interview-Prep/cuny-ttp-algo-summer2021 | taojieTan/assignments/slidingwindow/lc209/lc209.cpp | // Problem Statement #
// Given an array of positive numbers and a positive number ‘S,’ find the length of the smallest contiguous subarray whose sum is greater than or equal to ‘S’. Return 0 if no such subarray exists.
using namespace std;
#include <iostream>
#include <limits>
#include <vector>
class MinSizeSubArr... | ALGO | 0.99996 | 7.00343 |
33d182de-acbf-4e53-90f6-d08e5e37caeb | Growgrass/Akebi-GC | cheat-base/src/cheat-base/util.cpp | #include <pch.h>
#include <framework.h>
#include "util.h"
#include <Windows.h>
#include <shellapi.h>
#include <commdlg.h>
#include <shtypes.h>
#include <shobjidl_core.h>
#include <shlobj_core.h>
#include <sstream>
#include <string>
#include <iomanip>
#include <codecvt>
#include <filesystem>
namespace util
{
std... | TOOL | 0.967552 | 6.264155 |
34e76397-0ea1-440d-a90c-858c58100f00 | kitanoyoru/labs-sem-5 | SIMZIS/Lab4/code/main.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
bool is_primitive_element(int g, int p) {
unordered_set<int> powers;
int result = 1;
for (int i = 1; i < p; i++) {
result = (result * g) % p;
powers.insert(result);
}
for (int i = 1; i < p - 1; i++) {
if (p... | ALGO | 0.999879 | 5.828094 |
195168e0-9baa-4c7a-b5d0-f9069f9d85b1 | hvanman2code/CP-Codeforces-Codes | candies.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t=0;
cin>>t;
while(t--){
long long int n=0;
cin>>n;
long long int x=0;
int trial =0;
for(long long int i=4;trial <30; ){
if(n%(i-1)==0) {
x=n/(i-1);
break;
}
i=i*2;
... | ALGO | 0.999936 | 3.78189 |
cc890c7b-60e7-4a40-89c2-5e74f79a08e3 | jovechiang/solSGU | 363.cpp | #include <iostream>
//#include <conio.h>
using namespace std;
class P
{
public:
int k,t;
};
P p[100];
int m,n;
int badge[100];
int stack[100][100];
int tans[100];
int bans[100];
int main()
{
int min,mini;
cin>>n>>m;
for(int i = 0;i<n;i++)
{
cin>>p[i].k>>p[i].t;
// p[i].t++;
}
min = 0;
mini = 0;
int t = 0;... | ALGO | 0.999904 | 3.20422 |
80c71dc1-579a-4dee-8262-e57796f55d4c | Pankajesc/Leetcode | 1971-find-if-path-exists-in-graph/1971-find-if-path-exists-in-graph.cpp | class Solution {
public:
bool validPath(int n, vector<vector<int>>& edges, int source, int destination) {
if (n == 1) return true;
vector<bool> visited(n, false);
visited[source] = true;
bool flag = true;
while (flag) {
flag = false;
for (const auto& e... | ALGO | 0.99997 | 6.309745 |
57404528-75e8-4397-adad-0a40dc3aae79 | AliKhudiyev/Summer-2021 | FRS/Adaptive-Fuzzy-Compression/lint.cpp | // #include "lint.h"
#include "lint2.h"
using namespace std;
const char* words[10] = {
"title",
"car",
"air",
"plain",
"apple",
"dynamite",
"game",
"computer",
"learn",
"play"
};
int main(int argc, const char** argv){
if(argc == 1)
return -1;
auto lint = LINT2();
// lint.train("~/datasets/AGI/enwik9"... | ALGO | 0.988895 | 5.128267 |
da57f98f-ed05-4350-905e-ccfa7920b4d5 | Nauh24/thcs2-codeptit | C02005_HinhBinhHanhNguoc.cpp | #include<stdio.h>
int main() {
int a,b;
scanf("%d %d", &a, &b);
for(int i=1;i<=a;i++){
for(int j=1;j<i;j++) printf("~");
for(int j=1;j<=b;j++) printf("*");
printf("\n");
}
}
| ALGO | 0.99899 | 3.461143 |
9f3ec42f-6b86-4a0c-be04-aa7e0e446049 | mitupatil18/Leetcode-Solutions | 1468-check-if-n-and-its-double-exist/check-if-n-and-its-double-exist.cpp | class Solution {
public:
bool checkIfExist(vector<int>& arr) {
for(int i = 0 ; i<arr.size();i++)
{
for(int j = i+1; j<arr.size() ;j++)
{
if(arr[i]==2*arr[j] || (arr[i]*2==arr[j])) return 1;
}
}
return 0;
}
}; | ALGO | 0.997074 | 5.671267 |
bbfe6fde-08a7-40e8-904e-9891261b4a7e | StevenShuoFeng/CodeJamPractice | 2016 Round 1A/c.cpp | /*
https://code.google.com/codejam/contest/4304486/dashboard#s=p2
Problem
You are a teacher at the brand new Little Coders kindergarten. You have N kids in your class, and each one has a different student ID number from 1 through N. Every kid in your class has a single best friend forever (BFF), and you know who that... | ALGO | 0.998528 | 3.84128 |
b3b66ee6-ec98-4038-9f84-28b296431d88 | Atik-hridoy/Atiks_portfolio | 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 |
e5eb8fd1-abc9-4d14-a1ae-b863f954b0e0 | nikhil980/gfgcoding | Difficulty: Easy/Merging two unsorted arrays in sorted order/merging-two-unsorted-arrays-in-sorted-order.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Your code goes hereclass Solution{
class Solution {
public:
void sortedMerge(vector<int>& arr1, vector<int>& arr2, vector<int>& res)
{
sort(arr1.begin(),arr1.end());
sort(arr2.begin(),arr2.end());
... | ALGO | 0.999879 | 5.563656 |
f2e0f04a-6c06-45e5-a590-55a66de27d81 | M16EL/Module-4-Introduction-To-Oops-Programming | Inheritance and Polymorphism/13.cpp | //Write a program to find the max number from given two numbers
//using friend function
#include <iostream>
using namespace std;
void findMax(int a, int b);
class MaxFinder {
private:
int num1;
int num2;
public:
MaxFinder(int a, int b) {
num1 = a;
num2 = b;
}
friend void findMax... | ALGO | 0.999572 | 5.747948 |
aa102dfb-7e98-46dc-b53c-a47d3fcd8ce8 | DevEngineers/Learn-Git-Client | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998693 | 6.797273 |
6878218f-17c0-4472-8374-5a1bb819627a | bakhuiwon326/algorithm | 백준/알고리즘별/그래프/[1753]최단경로/main.cpp | #define _CRT_SECURE_NO_WARNINGS
#define MAXV 20001
#define INF 2147483647
#include<iostream>
#include<vector>
#include<cstring>
#include<queue>
using namespace std;
typedef struct graph {
int vertex;
int weight;
graph(int vertex, int weight) : vertex(vertex), weight(weight) {}
bool operator<(const graph g) const... | ALGO | 0.999956 | 3.853988 |
57be7942-cd7e-47fe-8f20-169db164b9ee | suarezjruben/Data-Structures | Quick and Insertion Sorting/sortDriver.cpp | #include "insertionSort.cpp"
#include "quickSort.cpp"
#include <string>
using namespace std;
template <class ItemType>
void display(ItemType theArray[], int size)
{
for (int i = 0; i < size; i++)
std::cout << theArray[i] << " ";
cout << endl << endl;
}
int main ()
{
// Array of strings
string a[27] = {... | ALGO | 0.997959 | 5.147388 |
96f170a2-2ae0-4b2a-bc25-7c608af6e910 | EasyDeps/boost | libs/math/example/policy_eg_3.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4305) // 'initializing' : truncation from 'long double' to 'const eval_type'
# pragma warning (disable : 4244) // conversion from 'long double' to 'const eval_type'
#endif
#include <iostream>
using std::cout; using std::endl;
//[policy_eg_3
#include <boost/math/distributi... | ALGO | 0.939715 | 4.436164 |
f5ff2e25-deb4-4d28-b806-358752af8e2f | luhsra/melf-linker | src/llvm/lib/CodeGen/OptimizePHIs.cpp | #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo... | ALGO | 0.959768 | 7.810433 |
63524585-09ed-408f-ab07-2a8c55c75215 | soal01/formalki | Practice2/src/EarleyAlgorithm.cpp | #include "EarleyAlgorithm.h"
EarleyAlgorithm::EarleyAlgorithm() :
_classes(),
_str(),
_grammar()
{}
EarleyAlgorithm& EarleyAlgorithm::fit(const Grammar& G) {
_grammar = G;
Rule firstRule = Rule("$->S");
_grammar.rules.insert(firstRule);
return *this;
}
void EarleyAlgorithm::completeForClass(int n... | ALGO | 0.997764 | 4.181515 |
9e3a0f7e-25c9-4c22-9278-32a6e5af85ea | Sakilshikdar/All_Data_Algorithms_code | Marge_sort/Marge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
const int n = 1e5 + 7;
int arr[n];
void marge(int l, int r, int mid)
{
int Left_size = mid - l + 1;
int L[Left_size + 1];
int right_size = r - mid;
int R[right_size + 1];
for (int i = l, j = 0; i <= mid; i++, j++)
{
L[j] = arr[i];
}
... | ALGO | 0.999987 | 4.648955 |
11806ede-a7b2-4aac-bb98-f3d7a69cb7ae | 569985011/Work-Space | C/PTA数据结构与算法中文/5-44 基于词频的文件相似度.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HashLenth 10007 //ڴ濪3MBҲDz1MBݸ
/*
ύʱ ״̬ Ŀ ʱ û
2018/1/26 17:49:32 ȷ 30 7-44 C (gcc) 75 ms 569985011
Ե ʾ ʱ ڴ
0 sample ȷ 2 ms 244KB
1 ͬһļظֵĵʲظ㣻̫ĵֻǰ10ĸ ȷ 2 ms 244KB
2 ȫͬ ȷ 2 ms 256KB
3 ȫͬ ȷ 2 ms 152KB
4 NM1ļȫʣ1ʳļ ȷ 75 ms 2032KB*/
typedef struct node ... | ALGO | 0.999388 | 3.595897 |
4fa217ca-5d57-46cb-b5fa-18e56f8f640e | MultiDCP/BOJPractice | c++/11653.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int main(void){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
if(n == 1) return 0;
int origN = n;
for(int i=2; n!=1; i++){
if(i*i > origN){
cout << n;
break;
}
while(... | ALGO | 0.99999 | 4.926732 |
895b4acd-315d-4358-8e70-9b703218d1ce | raincross7/code-similarity | codes/train_code/problem421/problem421_32.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<set<int>> G(4);
for (int i = 0; i < 3; i++) {
int a, b; cin >> a >> b;
a--; b--;
G.at(a).insert(b);
G.at(b).insert(a);
}
vector<int> v = { 0, 1, 2, 3 };
do {
bool can = true;
for (int i = 0; i < 3; i++) {
if (!G.a... | ALGO | 0.999998 | 4.33478 |
7c553fb8-9cfe-4ae9-b57b-e917f0b760e4 | Hevhove/42_projects | cpp/cpp09/ex01/srcs/RPN.cpp | #include "RPN.hpp"
// Helper functions
static bool isInteger(const std::string& str) {
if (str.empty()) {
return false;
}
// check characters
for (unsigned long i = 0; i < str.size(); ++i) {
if (!isdigit(str[i])) {
return false;
}
}
return true;
}
// Constructors
RPN::RPN() {
//
}
... | TOOL | 0.946105 | 5.325799 |
ad9a388d-4d00-43c6-8ad4-23f4b26851c5 | hmson3/codingtest | baekjoon/barkingdog/0x04_list/1406_yame.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX = 1000005;
char dat[MX];
int pre[MX], nxt[MX];
int unused = 1;
void insert(int addr, int num){
dat[unused] = num;
pre[unused] = addr;
nxt[unused] = nxt[addr];
if(nxt[addr] != -1) pre[nxt[addr]] = unused;
nxt[addr] = unused;
unused++;
}... | ALGO | 0.999905 | 4.102286 |
07f11ad4-765f-49d9-98cc-6078cd5693b1 | Eren51/midterm2 | projee/Middlewares/Third_Party/EdgeImpulse_final_MachineLearning/edgeimpulse/edge-impulse-sdk/tensorflow/lite/micro/kernels/rfft2d.cpp | #include <math.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <algorithm>
#include <complex>
#include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h"
#include "edge-impulse-sdk/tensorflow/lite/c/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h"
#inc... | ALGO | 0.859306 | 7.207357 |
06ab40a3-7ace-46b1-bd31-cfde94c5fbd9 | EBUCILONG/Distributed-HNSW | src/include/kahiplib/parallel/modified_kahip/lib/partition/uncoarsening/refinement/cycle_improvements/advanced_models.cpp | /******************************************************************************
* advanced_models.cpp
* *
* Source of KaHIP -- Karlsruhe High Quality Partitioning.
* Christian Schulz <<EMAIL>>
*****************************************************************************/
#include <algorithm>
#include "advanced_m... | ALGO | 0.999208 | 4.945067 |
fd2add9b-12e8-4481-8f53-9bd664b83ab5 | AsAdityaSonu/DSA | Leet Code/Medium/633_Sum_of_Square_Numbers.cpp | #include<iostream>
using namespace std;
// Approach 1: Two Pointer
class Solution {
public:
bool judgeSquareSum(int c) {
int k = sqrt(c);
long a=0, b=k;
while(a<=b){
if(a*a+b*b<c){
a++;
}else if(a*a+b*b>c){
b--;
}else{
... | ALGO | 0.999889 | 4.699155 |
85f62046-cf29-4988-bc0b-74be7ed45a05 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/16/53/7.cpp | #include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define... | ALGO | 0.999818 | 3.261666 |
0cf52d06-08c2-49de-ac48-8a769baefc6b | k930503/coding-test | 프로그래머스/2/150368. 이모티콘 할인행사/이모티콘 할인행사.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxSubscribers = 0;
int maxSales = 0;
vector<int> discounts = {10, 20, 30, 40};
void backtrack(vector<vector<int>>& users, vector<int>& emoticons, vector<int>& currentDiscounts, int index) {
if (index == emoticons.size()) {
... | ALGO | 0.997859 | 6.168721 |
f53dac09-6cc5-48c3-a592-1ef5161f70b3 | Leapense/problems | 20291번: 파일 정리/파일 정리.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
map<string, int> cnt;
for (int i = 0; i < N; i++) {
string filename;
cin >> filename;
size_t pos = filename.find_last_of('.');
string ext = fi... | ALGO | 0.996726 | 5.859599 |
4617004e-9a3f-4acc-b831-93c5572f0a09 | NehemiasContreras/Taller-Aplicaciones | Tp 14 Taller.cpp | #include <iostream>
using namespace std;
int main() {
int cantidadnumeros;
int numero;
int pares =0;
int impares =0;
cout<<"Ingrese la cantidad de numeros que desea ingresar: ";
cin>>cantidadnumeros;
for (int i = 0; i < cantidadnumeros; i++) {
cout<<"Ingrese el numero:"<<endl;
... | ALGO | 0.98698 | 4.561547 |
1d2816c7-3b12-4e17-b046-304976408fb7 | Andrew53O/NSYSU | Freshman/Spring 下/Cpp/BOOK homework/Chapter 3/13_giveaway_easy_version.cpp | #include <iostream>
#include <ctime>
using namespace std;
int main(void)
{
srand(time(NULL));
const int unique_number = 4;
int winner[unique_number];
int low_range = 1;
int high_range = 4;
for (int i = 0; i < unique_number; i++)
{
int random_number;
bool isDuplicate;
... | ALGO | 0.995589 | 3.874614 |
68f2c499-6517-4287-806b-18b4b8c80a35 | ishandutta2007/codeforces | sonechko/normal/884/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define ss second
#define ff first
const int MOD = 1000000007;
#define mod %MOD
#define pb push_back
#define ld long double
const int N = 1e6 + 11;
const int MAX = 1e8;
int main()
{
ios_base::sync_... | ALGO | 0.999996 | 3.468904 |
31ec66ec-944d-4ca7-b3ce-651631f1f297 | NaEunMin/cpp-practice | cpp4장문제풀이/4장14번.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | TOOL | 0.976355 | 4.026045 |
8f9caf75-1af8-4567-8151-d5d15795e3be | ShuYuMo2003/Generative-Articulated-Object-s- | third_party/ManifoldPlus/3rd_party/libigl/include/igl/line_search.cpp | IGL_INLINE double igl::line_search(
Eigen::MatrixXd& x,
const Eigen::MatrixXd& d,
double step_size,
std::function<double(Eigen::MatrixXd&)> energy,
double cur_energy)
{
double old_energy;
if (cur_energy > 0)
{
old_energy = cur_energy;
}
else
{
old_energy = energy(x); // no energy was given... | ALGO | 0.999992 | 5.737637 |
3ca04228-c4e7-40f3-8032-18d8b3b0cab3 | fzanutto/competitive_programming | Codeforces/1255/E.cpp | #include <bits/stdc++.h>
using namespace std;
int v[100005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> v[i];
}
if(n == 1 && v[0] == 1){
cout << -1 << endl;
return ... | ALGO | 0.999913 | 4.027987 |
ca21df2d-2ce5-45f7-8818-5de57f2c5319 | andrefakhoury/competitive-programming | problems/solutions/GEMA/GEMA Strings/GEMA Strings 02/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define pb push_back
#define mk make_pair
#define fi first
#define se second
typedef pair<int, int> pii;
typedef long long ll;
const int MAXN = 1e5 + 5;
vector<int> prefixFunction(string& s) {
int n = (int)s.length();
vector<int> pi(n);
for (i... | ALGO | 0.999667 | 4.102813 |
06712fbb-08ab-4cf3-9089-afdfd8f76e9d | Disjepion/match3 | MyGame/cocos2d/cocos/platform/win32/CCFileUtils-win32.cpp | #include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#include "platform/win32/CCFileUtils-win32.h"
#include "platform/win32/CCUtils-win32.h"
#include "platform/CCCommon.h"
#include <Shlobj.h>
#include <cstdlib>
#include <regex>
#include <sstream>
using namespace std;
NS_CC_BEGIN
#defin... | TOOL | 0.913839 | 6.187604 |
a85d25d2-fac4-4231-a6dc-9194cf60b31e | nccaiteam/histopathology_annotation_nia | libs/boost_1_67_0/libs/graph/test/tiernan_all_cycles.cpp | #include <iostream>
#include <boost/graph/graph_utility.hpp>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/directed_graph.hpp>
#include <boost/graph/tiernan_all_cycles.hpp>
#include <boost/graph/erdos_renyi_generator.hpp>
#include <boost/random/linear_congruential.hpp>
using namespace std;
using ... | TEST | 0.960664 | 6.371836 |
84428f12-408e-41d3-9d30-dced7451c1d7 | zhanhang2014/pat-advanced | 2016-09-11(1116-1119)/1118.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int fa[10001] = { 0 }, cnt[10001] = { 0 };
int n, q;
int findf(int x){
int a = x;
while (x != fa[x]) x = fa[x];
return x;
}
void Union(int a, int b){
int faa = findf(a);
int fab = findf(b);
if (faa != fab) fa[faa] = fab;
}
int main(){
for (int i =... | ALGO | 0.999943 | 4.201132 |
53b251b9-bfd1-40a2-8609-807cfcdea561 | aqilahrose/Basic-Prog-cplusplus | C++ Lab-Tutorial/Lab 2 C++/MCQ example/setprecision.cpp | #include <iostream>
#include <iomanip>
using namespace std;
//Example 5
int main () {
float loan, rate, interest;
loan = 15700; rate = 0.03737;
interest = loan * rate;
//cout << fixed << showpoint << setprecision(2);
cout << showpoint<< setprecision(2);
cout << "Interest is RM: ";
cout << interest << endl;
}
| TOOL | 0.987994 | 3.776566 |
331cbacd-27fb-49e7-975e-8f9f7d42c15c | Pri-27ya/Codeforces-Questions | B_Array_Stabilization.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
for(int &i : arr){
cin >> i;
}
sort(arr, arr + n);
cout << min(arr[n - 1] - arr[1], arr[n - 2] - arr[0]);
} | ALGO | 0.999857 | 3.793674 |
717bd6fa-9717-4f66-951d-1fa3d3712957 | Ygorfnascimento/Exercicios_em_C_plus_plus | May_2025/Exemplo - Desafio.cpp | #include <iostream>
#include <string>
#include <set>
#include <random>
#include <algorithm>
#include <iomanip>
#include <cctype>
using namespace std;
// Verifica se o nome contém apenas letras do alfabeto (sem acentos ou espaços)
bool validarNome(const string& nome) {
return all_of(nome.begin(), nome.end(), [](ch... | TOOL | 0.857617 | 6.158077 |
a7934f5b-b5ef-4726-9621-3d5b15439f13 | Mr-Trash/abdc | Aeroplane Bombing/Aroplane Bombing.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int test, row;
int playGround[50][50];
int answer;
int Max(int a, int b)
{
if (a > b)
return a;
else
return b;
}
void getMaxCoins(int current_row, int current_col, bool bombUsed, int coins, int isRowSafe)
{
if (curren... | ALGO | 0.999652 | 4.194917 |
8635fa08-f5c3-4da1-8034-1adf60c0ef06 | CrutoSJ/GFG-Leetcode_CPP-Python | #Leetcode-Daily/2185.cpp | // #Question:-
// Link-> https://leetcode.com/problems/counting-words-with-a-given-prefix/description/?envType=daily-question&envId=2025-01-09
// Date-> 09/01/25
// #Solution:-
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int prefixCount(vector<string>& words, string pref) {
in... | ALGO | 0.999837 | 6.349827 |
97f8fb7f-47af-4255-9a17-29af05266cd5 | BilalBashirDEV/Logic-building-for-absolute-beginner-programmers-in-Cpp | even or odd.cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cin>>a;
if (a%2==0)
{
cout<<"even"<<endl;
}
else
{
cout<<"odd";
}
return 0;
}
| ALGO | 0.999949 | 3.536304 |
7844c476-8775-4f5e-b11d-7a17d5fc0451 | yuhi-dev/AtCoder | tessoku/answer/codes/cpp/chap01/answer_A01.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N; // 入力
cout << N * N << endl; // 出力
return 0;
}
| ALGO | 0.996929 | 3.320068 |
fda8a8d9-b343-4adc-b010-5ea441c3a39e | justnotanu/leetcode | 0258-add-digits/0258-add-digits.cpp | class Solution {
public:
int addDigits(int num) {
if (num<10)
return num;
if (num%9==0)
return 9;
else
return num%9;
}
}; | ALGO | 0.999891 | 6.44095 |
b5e9f919-7e10-48d4-87f3-536147dc6dd7 | sarvex/leetcode-bash | solution/1700-1799/1758.Minimum Changes To Make Alternating Binary String/Solution.cpp | class Solution {
public:
int minOperations(string s) {
int cnt = 0, n = s.size();
for (int i = 0; i < n; ++i) cnt += s[i] != "01"[i & 1];
return min(cnt, n - cnt);
}
}; | ALGO | 0.999937 | 5.868265 |
8d48a5d5-0a0a-476c-ad8f-a7a00e4cb11c | ZeZo9530/Meals_App | 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 |
aa3b5694-99c3-4af0-bc69-eacbd2340bf8 | codesmith17/CODEFORCES | A_Pythagorean_Theorem_II.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[5000] = {0};
int n, count = 0;
cin >> n;
int k = 0;
for (int i = 1; i <= 10000; i++)
{
for (int j = 1; j <= 10000; j++)
{
arr[k] = i * i + j * j;
k++;
}
}
... | ALGO | 0.999395 | 3.199893 |
7ac1b732-d40e-41ff-8f65-b88d2d9be15c | amgit99/cses-ProblemSet | Graph Algorithms/game_routes.cpp | #include<bits/stdc++.h>
#define brr cin.tie(0) -> sync_with_stdio(0);
#define tc int t; cin >> t; while(t--)
#define __ << " " <<
#define ll long long
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define pi pair<int, int>
#define mod 1000000007
using namespace std;
vector<int> start, fi... | ALGO | 0.999739 | 4.600273 |
bcbbfacd-8bea-456f-bd0b-c1b2eff5b510 | GanpatiRathia/c_programming | old_repo/sorting/3_insertion_sort/2_recursive_insertion_sort.cpp | /*Recursive Insertion Sort
Insertion sort is a simple sorting algorithm that works the way we sort playing cards in our hands.
Below is an iterative algorithm for insertion sort
Algorithm
// Sort an arr[] of size n
insertionSort(arr, n)
Loop from i = 1 to n-1.
a) Pick element arr[i] and insert
i... | ALGO | 0.999993 | 7.013928 |
84e685e1-c3ef-49c8-a948-41db25a63640 | omarKaushru/Numb-UV-Life-activites | UVA/MOH/12036 Stable Grid.cpp | ///Accepted
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t, n, x, Case = 0;
cin>>t;
while(t--)
{
cin>>n;
int count[101] = {};
int i, j, flag = 1;
for(i = 0; i < n; i++)
{
for(j = 0; j < n; j++)
{
cin>>x;
count[x]++;
if(count[x] > n)
flag = 0;
}
}
Case++;... | ALGO | 0.999547 | 3.929518 |
47f34c83-c79a-4664-9d99-8af9e844dc2f | Vedantjn/epam-cpp-notes | 9 December 2024/condition_variable_practice2.cpp | //Condition Variable in c++ threading
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
using namespace std;
condition_variable cv;
mutex m1;
long balance = 0;
void addMoney(int money){
lock_guard<mutex> lg(m1);
balance+=money;
cout << "Amount added and the current balance is... | ALGO | 0.93264 | 5.730328 |
00d2ea00-c76b-4a25-8fbd-0b71f0b1e90f | LucasCampos/EncontroFractal | NVT_2D/main.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <fstream>
#include <tuple>
#include <limits>
#include "RNG.hpp"
#include "Particle.hpp"
#include "ExtVar.hpp"
#include "Vector2D.hpp"
#include "Quantities.hpp"
using namespace std;
typedef ParticleGeneral<Vector2D> Particle;
double CalculateTemperatu... | ALGO | 0.999784 | 4.57576 |
c04641d9-b784-403a-91a7-73332f746ed9 | javireqs/cpp-projects | intermediate/main.cpp | //
// main.cpp
// numberGame
//
// Created by r94 on 10/12/21.
//
#include <iostream>
using namespace std;
void playOneGame();
void getUserResponseToGuess();
int getMidpoint();
const int UPPER_BOUND = 100; // global variable for upper bound
const int LOWER_BOUND = 1; // global variable for lower bound
int main... | ALGO | 0.997105 | 5.804943 |
516774af-aa85-42e4-b1fa-02336c244e65 | shivankit1210/Solved_Leetcode_Problems | week14/TransposeMatrix867.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& matrix) {
int n = matrix.size();
int m = matrix[0].size();
vector<vector<int>> result(m, vector<int>(n));
for(int i =0 ; i < n ;i++){
for(int j=0 ; j<m ;j++){
result[j][i]= matrix... | ALGO | 0.99994 | 6.449976 |
c47e8b43-ca86-4add-9b10-4dc49e1933ef | kodsnack/advent_of_code_2017 | f00ale-cpp/p25.cpp | #include <iostream>
#include <vector>
#include <string>
int main() {
int ans1 = 0;
struct state {
state(int v0, int d0, int s0, int v1, int d1, int s1)
: val0(v0), val1(v1), delta0(d0), delta1(d1), state0(s0), state1(s1) {}
int val0, val1;
int delta0, delta1;
int state0, state1;
};
std::v... | ALGO | 0.999348 | 3.784125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.