uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
25849870-cea1-4145-b750-0be2012681ef | AnonMiraj/Competitive-solving | Codeforces/Codeforces Round 934 (Div. 2)/C. MEX Game 1.cpp | // ﷽
// Contest: Codeforces Round 934 (Div. 2)
// Judge: Codeforces
// URL: https://codeforces.com/contest/1944/problem/C
// Memory Limit: 256
// Time Limit: 2000
// Start: Sat 16 Mar 2024 06:51:44 PM EET
// Reading Time :
// Thinking Time :
// Coding Time :
// Comments :
#include <algorithm>
#include <bitset>
#include... | ALGO | 0.999876 | 4.79752 |
4619a6af-01ec-4431-a76f-35353160abc6 | SID-A2/Spoj_Solutions | COEF.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll int fact(int n)
{
return (n == 1 || n == 0) ? 1 : fact(n - 1) * n;
}
int main(){
int n,k;
while(scanf("%d%d",&n,&k)!=EOF){
ll int a[k];
ll int ans=fact(n);
for(int i=0;i<k;i++){
cin >> a[i];
an... | ALGO | 0.999933 | 3.100015 |
4b187ae6-e9d0-4017-a712-020c6d1875a6 | NimishToshniwal/Codeforces-Solved | 1-499/451B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = 1; i <= n; i++)
int main()
{
ios::sync_with_stdio(false);
int n;
cin >> n;
int a[n], b[n];
rep(i, n)
{
cin >> a[i];
b[i] = a[i];
}... | ALGO | 0.99993 | 3.386364 |
29a4bb4c-2f60-4d41-a251-22e89aa0cb92 | MateyApostolov/HomeWork | NOI1/klassir.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
pair <int, int> c[4];
int n;
for(int i = 0; i < 4; i++) {
cin >> n;
c[i].first = 10 - n + 1 + i;
c[i].second = n;
}
sort(c, c + 4);
for(int i = 0; i < 4; i++) cout << c[i].second << " ";
return 0;
}
| ALGO | 0.99969 | 3.026034 |
82316d51-1089-41c6-b561-823ad41a86d4 | SonK4m3/Algorithms-and-Applications-SAMSUNG-PTIT-2021 | Practices/T1506_So_may_man.cpp | #include<bits/stdc++.h>
using namespace std;
void xuly(int n){
vector<int> a;
while(n >= 4){
if(n % 7 == 0){
a.push_back(7);
n -= 7;
continue;
}
if(n >= 4){
a.push_back(4);
n -= 4;
continue;
}
}
if(n == 0){
for(int i = 0; i < a.size(); i++) cout << a[i];
cout << endl;
}
else cout <<... | ALGO | 0.999857 | 5.069449 |
65eb4130-10a6-4679-b22b-e3e015da6e0b | moo1o/CppStudy | MapEx01/MapEx01/map01.cpp | #include <iostream>
#include <map>
#include <string>
using namespace std;
int main(void)
{
map<string, int> month_days_map;
string month[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
for(int i=0 ; i<sizeof(... | TOOL | 0.9915 | 3.751022 |
2cea4945-134c-4c42-ab44-68ff6cc4de4d | kmjp/procon | codeforce/201-220/cf216/e2.cpp | #include <cstdlib>
#include <cstring>
#include <memory>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <cmath>
#include <string>
#include <sstream>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
typedef signed long long ll;... | ALGO | 0.999866 | 3.667906 |
642c67f0-8091-4095-b70c-9dec3c76b2e8 | Medhaj-Kulkarni013/DSA_Coding | C++/Recursion3/StoreSubsetsString.cpp | #include<iostream>
#include<string>
#include<vector>
using namespace std;
void storeSubsets(string ans, string original, int idx, vector<string>& s){
if(idx==original.length()){
s.push_back(ans);
return;
}
char ch = original[idx];
storeSubsets(ans,original,idx+1,s);
storeSubsets(ans+... | ALGO | 0.999864 | 4.995954 |
5121f9d2-7548-44e7-93c0-a02dedb04a30 | ilwoong/crypto-primitives-arduino | aes/aes.cpp | #include <string.h>
#include "aes.h"
#include "sbox.h"
#include "gf256.h"
static const uint32_t RC[] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36,
};
static inline uint32_t rot32r8(uint32_t value)
{
return (value >> 8) ^ (value << 24);
}
static uint32_t sub_word(uint32_t value)
{
uint8_... | ALGO | 0.999518 | 5.909991 |
2fe562c1-4781-4ace-92eb-afad635b9154 | Lyd1995/Data_Structure_Class | 302.cpp | #include <iostream>
int main(int argc, char** argv) {
int N;
int i,j;
while(1)
{
printf("请输入查找项N:");
scanf("%d",&N);
i=j=1;
N=N-1;
while(N)
{
if(i<=j)
{
if(N--)
{
j++;
}
while(j!=1&&N!=0)
{
N--;
i++;
j--;
}
continue;
}
if(i>=j)
{
... | ALGO | 0.999666 | 3.567742 |
32130d98-1770-461a-b284-106ee5f02972 | adit2005/LEETCODE-CPP-DSA-QUESTIONS | 3-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
vector<int>mpp(256,-1);
int left = 0 , right = 0;
int n = s.size();
int len = 0 ;
while(right<n){
if(mpp[s[right]] != -1) {
left = max(mpp[s[right]]+1,left);
}
... | ALGO | 0.999922 | 5.814939 |
83743a1e-8a26-4c6f-b25f-9878b2d80c91 | Tejpatel1806/DSATutorial | OOPDSEM-3/OOPDLAB1.cpp | #include<iostream>
using namespace std;
class distance1
{
int feet;
int inches;
public:
void input()
{
cout<<"enter the value of distance:";
cin>>feet>>inches;
}
void display()
{
cout<<inches<<" "<<feet<<endl;
}
void subtract(distance1& d1,distance1& d2)
... | ALGO | 0.988252 | 3.369958 |
9ec0ebe5-b769-44d2-bbe3-1483886588c6 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4077_3.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 14;
const int INF = int(1e9);
int dp[1 << N];
int par[1 << N];
int last[1 << N];
pair<int, int> last_pair[1 << N];
int dp2[N][N][1 << N];
int lastv[N][N][1 << N];
vector<int> bits[1 << N];
int n;
int m;
vector<int> g[N];
int main() {
cin >> n >> m;
for (in... | ALGO | 0.999899 | 3.935704 |
ed8adb6b-78b9-4d65-9697-d316bd4fdbb8 | SamarthGarge/responsive_design | responsive_design/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.998407 | 6.76775 |
4964eb77-43a4-449d-8fe1-af93c6e57736 | Rahul-Chhabra-27/Interview_Preparation | DP/Traditional/coloringKnapsack.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
ll maxWeight(vector<vector<int>>& color,int m,int X,vector<vector<int>>& dp) {
// base case
if(m == 0) {
return 0;
}
// look up step
if(dp[m][X] != -2) {
return dp[m][X];
}
int ans = -1;
for(int wt: ... | ALGO | 0.999984 | 4.139707 |
d01ade43-2e38-4f23-8ec8-e5cc6d894d7b | HemanthReddy-24/Learning-DSA-in-Cpp | Problems in C++/13.cpp | #include<iostream>
using namespace std;
int factorial(int n){
if(n==0 || n==1){
return 1;
}
else{
return n*factorial(n-1);
}
}
int main(){
int n;
cout<<"Enter number:";
cin>>n;
cout<<factorial(n);
return 0;
}
| ALGO | 0.999534 | 4.03405 |
5eb5a984-a3d7-4eb3-8467-cf9a26724d8b | Lqs66/boost_1_74_0 | libs/geometry/index/test/algorithms/path_intersection.cpp | // Boost.Geometry Index
// Unit Test
#include <geometry_index_test_common.hpp>
#include <boost/geometry/index/detail/algorithms/path_intersection.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry... | TEST | 0.912097 | 7.715806 |
ac239ff6-8de4-4f9d-b185-26fc6bf15765 | ogoldthwaite/ColbyCS | classProjectStuff/365/project2/part3.cpp |
#include <opencv2/opencv.hpp>
#include <cstdio>
#include <cstdlib>
#include <dirent.h>
#include <cstring>
double calculateDif(std::vector<cv::Mat> base_hists, cv::Mat curimg);
int main(int argc, char *argv[]) {
char dirname[256];
DIR *dirp;
struct dirent *dp;
cv::Mat baseimg;
char filename[256];
// usage sta... | TEST | 0.966458 | 5.088401 |
3418b014-bf74-48ac-af0e-ae5e814f8ad3 | Lee-W/ACM | UVa/156/156.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define maxDictSize 1005
#define maxWordLen 25
string tranformWord(string s1) {
for (int i = 0; i < s1.size(); i++)
s1[i] = (char)tolower(s1[i]);
sort(s1.begin(), s1.end());
return s1;
}
main()
{
ios::sync_with_st... | ALGO | 0.999101 | 4.312276 |
07d2f993-6da5-45a7-8835-aaaf5bf90665 | AlexandrStasiuk/Cpp-Kursovaya | File.cpp | #include <iostream>
#include <fstream>
#include "File.h"
#include <string>
#include <cstdio>
using namespace std;
//
File::File(char* nameFile)
{
//
this->nameFile = nameFile;
//
open(nameFile, fstream::binary | fstream::in | fstream::out);
if (!is_open())
{
// ,
ofstream f(nameFile, fstream::bi... | TOOL | 0.970351 | 3.021609 |
00c9c01e-2b3d-4d19-aeb3-b6d45f4e68eb | Jiwant/Searching-and-Sorting | mandalsort.cpp | #include<iostream>
using namespace std;
void swap(int *x,int *y)
{
int temp=*y;
*y=*x;
*x=temp;
}
class Arr
{
private:
int num;
int *arr;
public:
void getArr();
void dispArr();
int getnum();
int partition(int,int);
void quicksort(int,int);
~Arr();
};
void Arr::getArr()
{
cout<<"Enter the Numbe... | ALGO | 0.999922 | 4.431157 |
ce61ed30-e2eb-4e8c-851f-c8edf8dbfd4b | JoseRFJuniorLLMs/SelfDrivingCar | CarND-Path-Planning-P11-master/src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_interop.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = (m.array() + 4).matrix() * m;
cout << "-- Combination 1: --" << endl << result << endl << e... | ALGO | 0.999545 | 4.531452 |
24e67f72-d98c-4154-a9f7-0b29776dfec9 | kunfengchen/carnd-t2-p5 | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.999774 | 4.220459 |
9e22136b-047f-4449-b248-0586b2f9384c | LocalClustering/HeidelbergMotifClustering | experimental_data/Local Motif Clustering via (Hyper)Graph Partitioning/algorithms/lib/partition/initial_partitioning/initial_refinement/initial_refinement.cpp | /******************************************************************************
* initial_refinement.cpp
* *
*
* XXX <<EMAIL>>
*****************************************************************************/
#include "initial_refinement.h"
#include "coarsening/coarsening.h"
#include "uncoarsening/uncoarsening.h"
... | ALGO | 0.999276 | 4.93346 |
bdf09a28-4b90-4612-abbc-81563d5b9080 | alexandraback/datacollection | solutions_5658282861527040_0/C++/Taube/Code.cpp | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
#include <ctime>
#include <memory.h>
#include <cctype>
#includ... | ALGO | 0.997866 | 3.153276 |
f35af151-4dc1-4256-969e-d2a71688ff06 | monoartarek/CPP-practice | 46_Subarrays.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the size of array: " ;
cin>>n;
int arr[n];
cout<<"Enter elements: ";
for(int i=0; i<n; i++){
cin>>arr[i];
}
//algorithm for subarrays
for(int i=0; i<n; i++){
for(int j=i; j<n; j++){
fo... | ALGO | 0.983019 | 3.305032 |
f1856081-1d5e-452f-b0a7-feb3462f4199 | ishandutta2007/codeforces | pavement/normal/1355/A.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#endif
#define int long long
#define ins insert
#define mp make_pair
#define mt make_tuple
#define pb push_back
#de... | ALGO | 0.99982 | 4.270317 |
9a713d00-d9ba-4ff6-9da2-31719c75d904 | hjiang13/LLMs-in-IR | processed_data/DecompiledResuts_Human_x_164_O2/GPT4o_Human_x_164_O2_decompiled/CPP_28.cpp | ```cpp
#include <string>
#include <vector>
#include <cstring>
void concatenate(std::string &result, const std::vector<std::string> &strings) {
result.clear();
for (const auto &str : strings) {
result += str;
}
}
int main() {
std::vector<std::string> strings = {"Hello, ", "world!", " This is a ... | ALGO | 0.989106 | 6.160672 |
267f13d6-2f0b-4d9c-97c6-8e9c0d389b63 | nedelcu-ioan/.dotfiles | .config/nvim/snippets/string/string_z_algorithm_std.cpp | // z_array=length of the longest substring starting from s[i] which is also a
// prefix of s
vector<int> z_algorithm(const string &s) {
int n = (int)s.size();
vector<int> z_array(n);
int left = 0, right = 0;
z_array[0] = 0;
for (int idx = 1; idx < n; ++idx) {
if (idx > right) {
l... | ALGO | 0.999 | 4.188989 |
7b3e8965-8324-4f93-9eb5-2b1afd25def6 | Leejungmin1119/c-solved-problem-in-Back_Jun | solved(bronze)/6.2231번 분해합(브론즈 2).cpp | #pragma warning (disable : 4996)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int a;
scanf("%d", &a);
for (int b = 0; b <= a; b++)
{
if (a== b + ((b / 1000000) % 10) + ((b / 100000) % 10) + ((b / 10000) % 10) + ((b / 1000) % 10) + ((b / 100) % 10) + ((b / 10) % 10) + (b % 10))
{
... | ALGO | 0.99893 | 3.676045 |
14f0b48d-8be1-4123-954d-0eb89e672ec0 | bishnumishra98/DSA | BaseBuildingPrograms/02. Basic_programming/CountNumberOfDigitsInANumber.cpp | #include <iostream>
#include <cmath> // for log
using namespace std;
// T.C: O(logn) base 10
// S.C: O(1)
int countNumberOfDigits_approach1(int n) {
int digits = 0;
while(n) {
digits++;
n = n / 10;
}
return digits;
}
// T.C: O(logn) base 10
// S.C: O(1)
int countNumberOfDigits_a... | ALGO | 0.999464 | 5.379538 |
5620bdb0-e391-43d0-9af8-e19904566eec | darrylteo/cp4-solutions | 7 (Computational) Geometry/1. Basic Geometry/d. Triangles (Trigonometry)/mountainbiking.cpp | #include <bits/stdc++.h>
using namespace std;
// v^2 = u^2 + 2as
struct seg{
int s, theta;
};
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//freopen("error.txt", "w", stderr);
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
vector... | ALGO | 0.999704 | 4.428059 |
38c266e2-8907-4716-ba7b-cc69ef4abdba | Ander-Ima/Mundo_de_Ram | RecursividadSimple/thanosSort.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int ordenamiento(int n, vector<int>& arr) {
if (is_sorted(arr.begin(), arr.end())) {
return n;
} else {
int mitad = n/2;
vector<int> arr1(arr.begin() + mitad, arr.end());
if (is_sorted(arr1.begin(),... | ALGO | 0.999899 | 5.331644 |
dac3ce41-5b36-4b94-8e1f-4f5bf2ae5b76 | YYQ0713/mpimega | src/assembly/contig_output.cpp | //
// Created by vout on 11/21/18.
//
#include "contig_output.h"
#include <cassert>
#include "definitions.h"
#include "unitig_graph.h"
#include <omp.h>
namespace {
inline char Complement(char c) {
if (c >= 0 && c < 4) {
return 3 - c;
}
switch (c) {
case 'A':
return 'T';
case 'C':
return... | ALGO | 0.944313 | 5.025945 |
d7744507-1532-44a6-b1f9-9459337cf5bd | Shyamji07/Leetcode-Solutions | 0904-fruit-into-baskets/0904-fruit-into-baskets.cpp | class Solution {
public:
int totalFruit(vector<int>& fruits) {
int n = fruits.size();
int ans=0 ,i=0, j=0;
unordered_map<int,int>mp;
while(j<n){
mp[fruits[j]]++;
while(mp.size()>2){
mp[fruits[i]]--;
if(mp[fruits[i]]==0) mp.erase(fruits[i... | ALGO | 0.99997 | 6.277442 |
3d28e10b-7bd6-4b8f-9b1a-51485c3c3d5f | alexandraback/datacollection | solutions_6377668744314880_0/C++/metsuryuu/c.cpp | /* Arkadiusz Wróbel - metsuryuu
*
* Konkurs: Google Code Jam 2015
* Zadanie: Logging
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
using namespace std;
typedef lo... | ALGO | 0.999933 | 4.609494 |
46d3631c-0292-47f0-9f23-9d620a3f8363 | sarvex/leetcode-simula | solution/0800-0899/0859.Buddy Strings/Solution.cpp | class Solution {
public:
bool buddyStrings(string s, string goal) {
int m = s.size(), n = goal.size();
if (m != n) return false;
int diff = 0;
vector<int> cnt1(26);
vector<int> cnt2(26);
for (int i = 0; i < n; ++i) {
++cnt1[s[i] - 'a'];
++cnt2[... | ALGO | 0.999976 | 5.551205 |
15b762b8-12ed-4454-80a5-7a08f2b097a8 | farmpiggie/competitive-programming | codeforces/2069/c.cpp | /*
* rule of beautiful subsequence:
* must start with 1
* must end with 3
* can only contain two in the middle
* ex: 1 [1 or more twos] 3
* dp
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 998244353;
int main() {
cin.tie(0)->sync_with_stdio(0);
int t; cin >> t;
while (... | ALGO | 0.999886 | 4.950922 |
a5905df1-b219-422e-9523-eed7f0e7dbbe | tongkiet890/TongAnhKiet_MonC | chapter 11/Programming Challenges_11.6.cpp | #include <iostream>
#include <string>
using namespace std;
const int NUM_PLAYERS = 12;
// Structure to store soccer player data
struct SoccerPlayer {
string name;
int number;
int pointsScored;
};
int main() {
SoccerPlayer team[NUM_PLAYERS];
int totalPoints = 0;
int maxPoints = -1; // Initiali... | ALGO | 0.972529 | 7.436091 |
1385f550-adfb-43ce-94b1-135537170fe0 | ishandutta2007/codeforces | ecnerwala/normal/1588/D.cpp | #include <bits/stdc++.h>
namespace std {
template<class Fun>
class y_combinator_result {
Fun fun_;
public:
template<class T>
explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}
template<class ...Args>
decltype(auto) operator()(Args &&...args) {
return fun_(std::ref(*this), std::forward<Args>(... | ALGO | 0.99996 | 6.044909 |
0b2d9f58-caa3-49ab-b0a2-a4304c9a269b | mateor/pdroid | android-2.3.4_r1/tags/1.30/frameworks/base/media/libstagefright/codecs/m4v_h263/dec/src/pp_semaphore_luma.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpred = x-axis coordinate of the MB used for prediction (int)
ypred = y-axis coordinate of the MB used for prediction (int)
pp_dec_y = pointer to the post processing semaphore for curren... | ALGO | 0.998952 | 6.601039 |
befbe919-9225-4312-8a26-ed31e939c8b7 | shangc1016/leetcode | src/luogu/P1115.cpp |
#include <algorithm>
#include <cstdint>
#include <iostream>
using namespace std;
int arr[200001];
int dp[200001];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int result{INT32_MIN};
dp[0] = arr[0];
for (int i = 1; i < n; i++) {
if (dp[i - 1] < 0 && arr[i] < 0) ... | ALGO | 0.999989 | 5.079758 |
58a8576c-7a2d-44f2-a262-0058c656edb0 | Nestnet-study/nestnet_algorithm_2024_2_beginner | JungSaeYeon/week_1/boj_2562.cpp | // 2562번 최댓값
#include <iostream>
using namespace std;
int main(void){
int max = 0, idx = 0;
for(int i=1; i<=9; i++){
int n;
cin >> n;
if(n > max){
max = n;
idx = i;
}
}
cout << max << '\n' << idx;
} | ALGO | 0.999816 | 4.052887 |
41cc6fd4-4ea7-40e5-b157-fe4b496bfaa9 | vanisharmaa/Dynamic-Programming | subsetSumToK.cpp | //SPACE OPTIMISATION
#include <bits/stdc++.h>
bool subsetSumToK(int n, int k, vector<int> &arr) {
// Write your code here.
vector<bool> next(k+1, false);
next[0] = true;
if (arr[0] <= k)
next[arr[0]] = true;
for(int i = 1; i < n; i++){
vector<bool> curr(k+1, false);
curr... | ALGO | 0.999961 | 5.585005 |
e435befa-8634-45d7-ab1f-663c6f8251ac | alzmqp00/leet | 48. 旋转图像.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
void rotate(vector<vector<int>> &matrix)
{
// 先想如何映射 把他拉直
}
int mapping(vector<vector<int>> &matrix, int i, int j, int n, int ring)
{
int index = i + n - 1;
if (i > n)
return;
}
}; | ALGO | 0.999968 | 4.353297 |
f9f9e733-59c8-499d-bb83-67c0e1600e05 | ZachVec/PAT-Advanced | #1056 Mice and Rice.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
size_t totalPlayerNum, playerNumEachGroup;
if(scanf("%zu%zu", &totalPlayerNum, &playerNumEachGroup) != 2) return 0;
vector<unsigned> weight(totalPlayerNum), rank(totalPlayerNum);
vector<size_t> order(totalPlayerNum);
for(u... | ALGO | 0.999987 | 3.141529 |
5b10d6f0-bc9a-44a4-962e-daac69370490 | abhisehekkumr/tree | LeafPath.cpp | #include<iostream>
using namespace std;
struct TreeNode {
int data;
TreeNode *left;
TreeNode *right;
TreeNode(int data){
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
TreeNode *insert(TreeNode *root, int data){
if(!root)
return ne... | ALGO | 0.999877 | 4.417209 |
550312ce-9a06-4719-ad42-aaa3eeb9225b | streagle/Penn-State-CPP | CMPSC 122/Labs/LabProj3.cpp | // Academic Integrity Affidavit:
// I certify that this program code is my work. Others may have
// assisted me with planning and concepts, but the code was written,
// solely, by me.
// I understand that submitting code that is totally or partially
// the product of other individuals is a violation of the Academic
// ... | TOOL | 0.996979 | 4.886496 |
bbeb345c-0777-4f42-b65f-a49349a50a50 | Seyamalam/Codeforces | 1500+++/1634c-okea.cpp | #include <cstdio>
int main(){
long t; scanf("%ld", &t);
while(t--){
long n, k; scanf("%ld %ld", &n, &k);
if((n % 2) && (k > 1) ){puts("NO"); continue;}
puts("YES");
for(long u = 1; u <= n; u++){
for(long p = 0; p < k; p++){printf("%ld ", u + n * p);}
put... | ALGO | 0.996109 | 3.546624 |
3bd396ad-7b5d-41af-b185-e2d7a2fd83c0 | akms-limon/Contest_Problem_Solving | codeforces/A_Colored_Balls_Revisited.cpp | /**
* author: A K M S Limon
* created: 19-January-2023 21:43:45
**/
#include <bits/stdc++.h>
#define nl "\n"
#define nll cout<<"\n"
#define ll long long
#define pb push_back
#define vc vector
#define vi vc<int>
#define vl vc<ll>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc in... | ALGO | 0.999961 | 4.35562 |
277fc589-0cdd-47a3-8d29-40b4e397497b | sanstzu/competitive-programming | codeforces/1515E - Phoenix and Computers.cpp | #include <iostream>
#include <cstring>
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,abm,avx,avx2,fma,mmx,tune=native")
using namespace std;
int mod;
// add, stick and merge in DP cc (connected components)
// dp[i][j] = i elements with j connect componen... | ALGO | 0.999943 | 4.160012 |
1025f898-538a-4458-ae5f-1d9b285fa321 | ishandutta2007/codeforces | kizen/normal/1036/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 2*(1e9)+4;
const long long IINF = (1e18)+4;
#define REP(i, N) for(int (i)=0;(i)<(N);++(i))
#define REP1(i, N) for(int (i)=1;(i)<=(N);++(i))
#define REPD(i, N) for(int (i)=(N)-1;(i)>=0;--(i))
#define REP1D(i, N) for(int (i)=(N);(i)>=1;--(i))
#define FOR(i, ... | ALGO | 0.999581 | 3.122547 |
1257e005-62ea-443c-a4c0-c6139a4bcdc2 | rstar900/GFG_160 | 004_Rotate_Array_2.cpp | //{ Driver Code Starts
// Initial function template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int gcd(int a, int b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
// Function to rotate an array... | ALGO | 0.999726 | 5.985573 |
ba4d5aa5-4621-45c4-8922-ea3e8c96749e | BUAAnhy/uav_nhy_control | src/lib/flight_tasks/tasks/ManualAltitudeSmoothVel/FlightTaskManualAltitudeSmoothVel.cpp | /**
* @file FlightManualAltitude.cpp
*/
#include "FlightTaskManualAltitudeSmoothVel.hpp"
#include <float.h>
using namespace matrix;
bool FlightTaskManualAltitudeSmoothVel::activate(const vehicle_local_position_setpoint_s &last_setpoint)
{
bool ret = FlightTaskManualAltitude::activate(last_setpoint);
// Check i... | ALGO | 0.933009 | 6.989818 |
007efc88-3c35-4cb8-8de7-5f2480c1e4c4 | gaurav12gk/LeetCode-Solution | 236-lowest-common-ancestor-of-a-binary-tree/236-lowest-common-ancestor-of-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(!root or ... | ALGO | 0.999986 | 6.011801 |
f8e9ac33-a0e2-4fc0-9e1e-691928af98ea | ishandutta2007/codeforces | kraskevich/normal/216/D.cpp | #include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <cassert>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <fstream>
using namespac... | ALGO | 0.999771 | 3.806604 |
6c8a0c0b-68b4-4d9d-accb-037def9a4e2b | JorgeIba/Competitive-Programming-Problems | CodeForces/TCArg2020/Product Sum.cpp | #include <bits/stdc++.h>
#define lli long long int
#define endl "\n"
#define forn(i, in, fin) for(int i = in; i<fin; i++)
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
//fastIO();
lli n; cin>>n;
vector< lli ... | ALGO | 0.999785 | 3.937536 |
54d6d971-3419-4c38-b7ab-7c916d875931 | CongJyu/Pitaya | HNU-CG/EX5-Q11/EX5-Q11/main.cpp | //
// main.cpp
// EX5-Q11 松雅的旅馆
//
// Created by cyrain on 2021/10/31.
//
#include <iostream>
int main() {
using namespace std;
int n = 0, d = 0, num = 0;
cin >> n >> d;
int pos[101] = {0}; // the position of the hotels
for (int i = 0; i < n; i++) {
cin >> pos[i];
}
for (int ... | ALGO | 0.999863 | 3.805666 |
56530379-2fa1-458f-a2ba-bc24f742f72c | Tatiksha/DS-A | prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if(strs.empty())
return " ";
for(int i=0;i<strs.size();i++)
{
reverse(strs[i].begin(),strs[i].end());
}
string res=strs[0];
for(int i=1;i<strs.size();i++)
{
string sample=strs[i];
... | ALGO | 0.999925 | 5.680193 |
125ccc43-b87b-42db-9e31-501393ec88a6 | Kryst4lize/BTVN | Algorithm/InputC-C++.cpp | #include<vector>
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<climits>
#include<sstream>
#include<bitset>
#include<fstream>
#include<string.h>
#include <stdio.h>
#include<cstring>
#define MAXR 100
#define MAXC 100
using namespace std;
void NhapMaT... | ALGO | 0.999973 | 3.218214 |
ad35b28d-31e6-4a40-93b5-98c06a1e9596 | maheshshinde9100/SCOE_CSE_Sem_3 | DSPS/LinkedList_Insertions.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node* next;
};
void insertAtBegining(Node* head){
int val;
cout<<"Enter Data of Node:"<<endl;
cin>>val;
Node* temp = new Node();
temp->data = val;
temp->next = head;
head = temp;
cout<<"Inserted at beginning :"<<endl;... | ALGO | 0.959918 | 4.386491 |
2efe5abb-ed54-4fc9-8705-fd08941fc4c6 | Po1s1on/BCY243003 | ict.cpp | #include <iostream>
using namespace std;
int main() {
int num1, num2, temp;
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
temp = num1;
num1 = num2;
num2 = temp;
cout << "Swapping:" << endl;
cout << "num1 = " << num1 << en... | ALGO | 0.998713 | 3.865385 |
23ea1935-a532-4de4-acb6-9a8ec0424095 | outInsideOut/CPP_tree | BSTnode.cpp | #include "BSTnode.h"
BSTnode::BSTnode(double value) {
data = value;
leftNode = nullptr;
rightNode = nullptr;
}
double BSTnode::GetData() {
return data;
}
BSTnode* BSTnode::GetLeft(){
return leftNode;
}
BSTnode* BSTnode::GetRight() {
return rightNode;
}
void BSTnode::Insert(double value) {
if (value >= data) {
... | ALGO | 0.993332 | 3.937899 |
f8d4b6d6-bf4d-4dc6-8991-791fb729031d | kerbyfc/test_cocos_project | frameworks/js-bindings/cocos2d-x/cocos/math/Mat4.cpp | #include "math/Mat4.h"
#include "math/Quaternion.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
Mat4::Mat4()
{
*this = IDENTITY;
}
Mat4::Mat4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
float m31, float m32, float m33, float m3... | TOOL | 0.988026 | 7.20292 |
f6b3da8d-ca19-4197-823d-cac70f55ed5c | ishandutta2007/codeforces | jhin/normal/994/B.cpp | // system.cout(translate *from glut);
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f for(int i=0;i<n;i++)
const int mod=1e9+7;
vector<int> p;
int ho,mi,se;
void fix_time()
{ if(se>59)mi+=se/60,se=se%60;if(se<0)se+=60,mi--;
if(mi>59)ho+=mi/60,mi=mi%60;if(mi<0)mi+=60,ho--;
//if(... | ALGO | 0.999927 | 3.271676 |
2860f5af-e4bc-428c-9512-c8cb8a20ceb5 | Gokulkrishnanrg2004/Super_dream_batch_training | 75-sort-colors/sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums)
{
int low=0;
int mid=0;
int high=nums.size()-1;
while(mid<=high)
{
if(nums[mid]== 0)
{
swap(nums[mid],nums[low]);
mid++;
low++;
... | ALGO | 0.999963 | 6.044339 |
e95f456a-c924-4520-8059-d65228f450d5 | cyruscyliu/videzzo-llvm-project | llvm/lib/MCA/Support.cpp | #include "llvm/MCA/Support.h"
#include "llvm/MC/MCSchedule.h"
namespace llvm {
namespace mca {
#define DEBUG_TYPE "llvm-mca"
ResourceCycles &ResourceCycles::operator+=(const ResourceCycles &RHS) {
if (Denominator == RHS.Denominator)
Numerator += RHS.Numerator;
else {
// Create a common denominator for LH... | TOOL | 0.936756 | 6.959136 |
54b4e362-1541-4de7-aa69-74085234a677 | mike-box/coursera | Data Structrues/week4_binary_search_trees/2_is_bst/is_bst.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
struct Node {
int key;
int left;
int right;
Node() : key(0), left(-1), right(-1) {}
Node(int key_, int left_, int right_) : key(key_), left(left_), right(right_) {}
};
bool dfs(i... | ALGO | 0.99992 | 5.750616 |
fdaaefb7-6163-4912-b96f-c96bcdfe0f6a | sarvex/leetcode-harbour | solution/1000-1099/1053.Previous Permutation With One Swap/Solution.cpp | class Solution {
public:
vector<int> prevPermOpt1(vector<int>& arr) {
int n = arr.size();
for (int i = n - 1; i > 0; --i) {
if (arr[i - 1] > arr[i]) {
for (int j = n - 1; j > i - 1; --j) {
if (arr[j] < arr[i - 1] && arr[j] != arr[j - 1]) {
... | ALGO | 0.999998 | 5.624665 |
f773e54c-765a-49d4-8419-3d16629e4f71 | SolveGuys/AlgorithmStudy | Problems_Archives/108week/keastmin/2206.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;
int N, M;
int dx[4] = { 0, -1, 0, 1 };
int dy[4] = { 1, 0, -1, 0 };
vector<string> map;
vector<vector<vector<bool>>> visited;
bool check(int x, int y) {
if (x < 0 || x >= M || y < 0 || y >= N) return false;
return true;
}
... | ALGO | 0.999956 | 5.447757 |
4b53c3f1-c244-47c6-9b8d-6d762f2f2861 | H2020-InFuse/cdff | Common/Core/liborbslam/modules/g2o/g2o/core/optimization_algorithm_dogleg.cpp | #include "optimization_algorithm_dogleg.h"
#include <iostream>
#include "../stuff/timeutil.h"
#include "block_solver.h"
#include "sparse_optimizer.h"
#include "solver.h"
#include "batch_stats.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmDogleg::OptimizationAlgorithmDogleg(BlockSolverBase* solver)... | ALGO | 0.999942 | 6.70963 |
09cde925-092e-4b79-a169-b2beaaf53279 | cxdcxd/NAVbot | ROS/Navigation/ROS/navigation/base_local_planner/src/costmap_model.cpp | #include <base_local_planner/line_iterator.h>
#include <base_local_planner/costmap_model.h>
#include <costmap_2d/cost_values.h>
using namespace std;
using namespace costmap_2d;
namespace base_local_planner {
CostmapModel::CostmapModel(const Costmap2D& ma) : costmap_(ma) {}
double CostmapModel::footprintCost(cons... | ALGO | 0.998231 | 4.089024 |
814180c5-32a6-4630-96de-a5cf575bb1d7 | ishandutta2007/codeforces | nots0fast/normal/1167/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) f... | ALGO | 0.999954 | 3.953164 |
8c590880-06ab-4ec0-b1ff-ada401ccc5bd | NVIDIAGameWorks/PhysX-3.4 | PhysX_3.4/Source/Common/src/CmBoxPruning.cpp | #include "CmBoxPruning.h"
#include "CmRadixSortBuffered.h"
#include "PsAllocator.h"
using namespace physx;
using namespace Gu;
using namespace Cm;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.998511 | 5.989526 |
257b4cea-696d-44bc-b2ae-45977694b1a5 | ARSD-Bsc-Comp-Sci-2024/Discrete-Structure-18043 | Practical_10.cpp | #include <iostream>
#include <conio.h>
#include <vector>
#include <math.h>
using namespace std;
vector<vector<char>> answer;
inline void swapping(vector<char>&b,int i,int j)
// to swap to adjacent member of the vector
{
char x=b[i];
b[i]=b[j];
b[j]=x;
}
void Permutation(vector<char> &a,int idx)
// to find a... | ALGO | 0.999734 | 3.686291 |
4119425b-a808-4e65-b07e-6b6fa34211d8 | kimjihyo/daily-coding-challenge | boj/2193/solution.cpp | #include <iostream>
using namespace std;
int main() {
int n;
long long dp[91][2]{};
cin >> n;
dp[1][0] = 0;
dp[1][1] = 1;
for (int i = 2; i < n + 1; i++) {
dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
dp[i][1] = dp[i - 1][0];
}
cout << dp[n][0] + dp[n][1] << '\n';
return 0;
} | ALGO | 0.99999 | 3.591631 |
10b381b9-04cb-4eef-a8e3-dc06abecb467 | Phistomevel/Dragonchess | DragonChess/game/moves/thief.cpp | #include "thief.h"
#include <map>
#include <algorithm>
#include "../moves.h"
#include "../board.h"
namespace game {
namespace moves {
Thief::Thief() {}
Thief::~Thief() {}
std::vector<::game::Moves> Thief::getMovesRaw(::game::Board &board, ::game::pieces::Abstract& ActivePiece) {
... | ALGO | 0.973695 | 3.466419 |
d8369b1a-cb2e-4d7f-8534-c01b3eb88da0 | JATIN-RAGHAV/CP-31 | 900/b_make_it_divisible_by_25.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef int64_t int6;
#define all(x) (x.begin(),x.end());
#define pb push_back
#define B .back()
#define repl(i,s,n) for (int i = s; i < n; i++)
#define repe(i,s,n) for (int i = s; i <= n; i++)
void solver(){
string... | ALGO | 0.999133 | 4.929984 |
ddc8d309-c326-4dbb-8582-9521c96a09e5 | zzctommy/public-source-code | 码库/CF1169B Pairs.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define pb(x) push_back(x)
#define mkp(x,y) make_pair(x,y)
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
inline int rd() {
int x=0,f=1;char ch=getchar();
whi... | ALGO | 0.999992 | 3.276499 |
dc7d9ed5-a950-4a15-8dd0-03d9ceae70b6 | hal1127/atcoder | misc/三井住友信託銀行プログラミングコンテスト2019/A.cpp | #include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
int M1, D1, M2, D2;
cin >> M1 >> D1;
cin >> M2 >> D2;
if (M1 == 12) {
if (M2 == 1) {
cout << 1;
} else {
cout <... | ALGO | 0.999178 | 3.423928 |
54bbb264-7743-492c-b6e0-e411bca41168 | priyankpm/plan-it | 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 |
7543b1ed-4917-40bd-ab36-073f332cfec6 | Crypt1cG/mandelbrot | src/calculations.cpp | #include "include/calculations.hpp"
#include <cmath>
#ifdef OPENCL
#include "include/openclStuff.h"
#endif
#include <vector>
const unsigned int NUM_CPUS = std::thread::hardware_concurrency();
// double numIterations = 30;
// extern "C" double iterate(ComplexNum* z, const ComplexNum* c, int itLeft);
double iterate... | ALGO | 0.999535 | 4.090624 |
cb2719e8-719f-49d9-940c-7ed1a59c594e | ikuo-suyama/competitive-programming | atcoder-problems/abc094_b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE \
ifstream in("atcoder-problems/abc094_b.txt"); \
cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cou... | ALGO | 0.999965 | 4.495744 |
d2c8b78d-8e97-4879-998d-85d04c1a35fc | yadzhang/boost | libs/geometry/doc/src/examples/algorithms/buffer_with_strategies.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[buffer_with_strategies
//` Shows how the buffer algorithm can be used to create a buffer of a linestring, a multi point, a multi polygon
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometr... | TOOL | 0.917219 | 7.146095 |
d1944d6e-ae77-4531-a4bc-d05809ff7761 | llvm-faultinjector/llvm-fault-injector | lib/CodeGen/SafeStackColoring.cpp | #include "SafeStackColoring.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instru... | TOOL | 0.956549 | 7.764141 |
fb99a1a6-2174-414d-aebf-c137fed5bbed | nkilicarslan/Computer-Graphics | cg_assignment_2/rasterizer/Helpers.cpp | #include <iostream>
#include <cmath>
#include "Helpers.h"
#include "Matrix4.h"
#include "Vec3.h"
#include "Vec4.h"
using namespace std;
/*
* Calculate cross product of vec3 a, vec3 b and return resulting vec3.
*/
Vec3 crossProductVec3(Vec3 a, Vec3 b)
{
Vec3 result;
result.x = a.y * b.z - b.y * a.z;
res... | ALGO | 0.994442 | 5.944127 |
39466c3d-420a-41f8-a3f6-e7eab91ab8a1 | MaikKlein/GameEngine | sourceCode/dependencies/dependencies_osx/glm/test/gtx/gtx_simd_mat4.cpp | #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/random.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <glm/gtx/simd_mat4.hpp>
#include <iostream>
#include <cstdio>
#include <ctime>
#include <vector>
#if(GLM_ARCH != GLM_ARCH_PURE)
std::vector<float> te... | TEST | 0.989981 | 6.118648 |
cdf57e0b-990c-4034-9421-f834d1966286 | TonyJM/ADA_1BM17CS119 | A10a_djikstra.cpp | #include <bits/stdc++.h>
#include<iostream>
using namespace std;
#define V 10
int minDistance(int dist[], bool sptSet[],int n){
int min = INT_MAX, min_index;
for (int v = 0; v < n; v++)
if (sptSet[v] == false && dist[v] <= min)
min = dist[v], min_index = v;
return min_index;
}
void printSolution(int dist[]... | ALGO | 0.999938 | 3.609788 |
8e0a643e-0abf-4d0b-83f5-c008ffa2d474 | PratikJagriti/LeetCode | 0031-next-permutation/0031-next-permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int length = nums.size();
if(length==0 || length==1) return;
int i,j;
for(i=length-2; i>=0; i--)
{
if(nums[i]<nums[i+1])
break;
}
if(i>=0)
{
fo... | ALGO | 0.999986 | 5.692778 |
e5c15405-bc79-4d3d-a6fd-3a1d2d0eba0c | ishandutta2007/codeforces | egor.lifar/normal/711/B.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
int n;
long long a[500][500];
int main() {
cin >> n;
int pos = -1;
for (int i = 0; i < n; i++) {
for (int j = 0;... | ALGO | 0.999967 | 3.638017 |
4fb56895-614d-4e33-b2c0-4dea1f1924dc | kohei1d/my-university-study | C++/practical-works/practical04/task3.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void findMinPoint(double [], int, int);
int main () {
int i, j, numP = 8, dim = 2;
double arrP[numP][dim], arrD[numP];
/* ----- variables -----
- numP: number of points
- dim: dimension
- arrP: 2D array for storing p... | ALGO | 0.999436 | 4.288038 |
766f26fe-23ca-4969-a09f-0e0939168583 | DanielRamosAcosta/pathfinder-algorithms | src/agent.cpp | #include "agent.hpp"
agent_t::agent_t(maze_t& maze):
maze_(maze)
{
start_.x() = 1;
start_.y() = 1;
end_.x() = maze.x()-2;
end_.y() = maze.y()-2;
}
void agent_t::solve(unsigned mode)
{
switch(mode){
case algorithm::breadth: breadth(); break;
case algorithm::depth: depth(); break;
case algorithm::hill_climbi... | ALGO | 0.999853 | 4.609116 |
f9aeb5ba-1b39-403a-a616-50b39563e7d9 | vltvdnl/Algorithmisation-and-programming-1-course | lab3.cpp | #include <iostream>
#include <windows.h>
#include "arraylib.h"
#include <malloc.h>
using namespace std;
int main(){
int n;
cin >> n;
int *a = ArrInput(n);
ArrOutput(a,n);
int Maxx = MAX(a,n);
int Minn = MIN(a,n);
SORT(a,n);
ArrOutput(a,_msize(a)/sizeof(a[0])); // _msize офицально не до... | ALGO | 0.998551 | 3.683853 |
7c5c3719-2b4c-4248-a063-788e191a7825 | NguyennGiang/CP_tutorial | Competitive Programming 3/Fenwick tree/HanoiFactory.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
int n;
ll f[N];
struct node {
long long a, b, h;
}itm[N];
bool cmp(node x, node y){
if (x.b != y.b){
return x.b < y.b;
}
return x.a < y.a;
}
void add(int id, ll val){
while (id <= n){
f[id] ... | ALGO | 0.999693 | 4.02476 |
66427bb7-9ff8-46e4-80b4-58e7a045e18b | raincross7/code-similarity | codes/train_code/problem478/problem478_187.cpp | #include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;
int ma... | ALGO | 0.999925 | 3.085743 |
75c9c7da-c353-4383-9310-f59c7ad252d9 | yiheng666/leetcode | 241. Different Ways to Add Parentheses.cpp | class Solution {
public:
unordered_map<string,vector<int>> memo;
vector<int> diffWaysToCompute(string expression) {
if (memo.count(expression)) return memo[expression];
vector<int> ans;
for (int i=0;i<expression.size();i++){
char c = expression[i];
if (c == '+' |... | ALGO | 0.999988 | 6.294884 |
c75e9520-06a7-485a-887c-c4eaeee327a2 | ishandutta2007/codeforces | flukehn/normal/958/C2.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_end=(a);i>=i##_end;--i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define foe(i,a) for(__typeof(a.begin()) i=a.begin();i!=a.end();++i)
#define fi first
#define... | ALGO | 0.99997 | 3.447682 |
36650c67-5038-422b-8374-6f6417094a31 | mjannat/Online-Judge-Problems-Solution-in-Cpp | J - Teamwork.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];
}
int cnt = 1;
vector <int> v;
int i;
for(i = 1; i < n; i++)
{
if(arr[i] == arr[i-1]) cnt++;
else
{
... | ALGO | 0.999996 | 3.320005 |
c3c54182-04cd-4e92-8be2-719a26191a7e | brithvik0305/CS-254 | Lab 2/Q6/6.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int customPartition(vector<ll>& arr, ll left, ll right){
ll pivotValue = arr[right];
ll i = left, j = left;
while (j < right) {
if (arr[j] < pivotValue) {
swap(arr[i], arr[j]);
i++;
}
j++;
... | ALGO | 0.999964 | 4.995969 |
34f390dc-e617-4e26-bdaa-5ebcb5db4008 | unlucky-13/Programming-Contests-Source-Codes | CodeFroces/Rounds/Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)/B.cpp | /*
* Mazharul Islam , BUET
* Problem Link:
*/
using namespace std;
#include <bits/stdc++.h>
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define rep(i,a,n) for(__typeof(n) i=a; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define write(x) freopen(x,"w",stdout);
inli... | ALGO | 0.999552 | 3.816678 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.