uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c548e34a-045d-4733-be93-9ff4e35d4cda | Mattia-Zambetti/TouchGFXlearningTest | Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.907945 | 7.464193 |
86bee1f9-7350-4b26-8108-2a401f3e562a | cwhuang1937/CP | course contest/contest2/q3/main.cpp | #include<bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int g[100010];
int Find(int a) {
if(a == g[a])
return a;
return g[a] = Find(g[a]);
}
void Union(int a, int b) {
int ga = Find(a);
int gb = Find(b);
if(ga != gb) {
g[ga] = gb;
}
}
int main(... | ALGO | 0.999973 | 4.248899 |
94a325bb-5806-4cb1-9042-a26d596d4dd6 | ntanthedev/Cpp | Du Tuyen/Du Tuyen 12/comnet.cpp | //Written by: ntannn_
//created in 08:55:16 - Fri 09/08/2024
#include <bits/stdc++.h>
// #pragma GCC optimize("O3,unroll-loops,no-stack-protector")
// #pragma GCC target("sse4,avx2,fma")
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end(... | ALGO | 0.999968 | 4.760431 |
0633ba4a-d3da-42ab-9c26-29e8244c9413 | HKABIG/100-DaysOf-DailyChallenges | GFG/Longest Palindromic Subsequence.cpp | //{ Driver Code Starts
//Initial template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
int longestPalinSubseq(string A) {
int n = A.length();
string s = A;
string r = "";
for(int i=n-1;i>=0;i-... | ALGO | 0.99981 | 6.456469 |
40edd91f-8e27-47a7-b5b7-5c84a2a34d2f | dzuizz/codeforces | A_Payment_Without_Change.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <cmath>
#include <unordered_map>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typede... | ALGO | 0.999103 | 3.64995 |
fd40b4c3-d4ca-4974-a86f-152679ea96da | TanushriDeshmukh/Open-CV | samples/dnn/person_reid.cpp | #include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/dnn.hpp>
using namespace cv;
using namespace cv::dnn;
const char* keys =
"{help h | | show help message}"
"{model m | | network model}"
"{query_list q | | list of query images}"
"{galle... | DATA | 0.894756 | 6.504936 |
4369449b-4032-46a7-8e9f-b6d16c7b59ce | LuisaGroup/LuisaRender-coroutine | src/integrators/coro_path.cpp | //
// Created by Hercier on 2023/12/25.
//
#include <luisa-compute.h>
#include <util/sampling.h>
#include <base/pipeline.h>
#include <base/integrator.h>
#include <util/progress_bar.h>
using namespace luisa;
using namespace luisa::compute;
namespace luisa::render {
using namespace compute;
class CoroutinePathTracin... | ALGO | 0.945836 | 5.946201 |
76869f80-6980-435b-acc8-1d330d51152f | aumj/deeprl_driving_behaviors | sumo-0.31.0/src/duarouter/duarouter_main.cpp | /****************************************************************************/
/// @file duarouter_main.cpp
/// @author Daniel Krajzewicz
/// @author Jakob Erdmann
/// @author Michael Behrisch
/// @date Thu, 06 Jun 2002
/// @version $Id: duarouter_main.cpp 25918 2017-09-07 19:38:16Z behrisch $
///
// Main for ... | TOOL | 0.915322 | 5.371128 |
0bf391f7-6447-441b-9a9f-85d5c71dbc78 | nayalchitra/P3_Program | Patterns and series/problem1.10.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,k,j;
cin>>n;
int tospace=n/2;
int toprint=1;
for(i=1;i<=n/2;i++)
{
for(k=1;k<=tospace;k++)
cout<<" ";
for(j=1;j<=toprint;j++)
cout<<"*";
tospace--;
toprint+=2;
cout<<endl;
}
for(i=n/2+1;i<=n;i++)
{
for(k=1;k<=tospace;k++)
... | ALGO | 0.999951 | 3.554364 |
575f93b8-8f53-496a-874b-fefd7597dc57 | Ethereal-OS/external_libcxx | test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp | // UNSUPPORTED: c++98, c++03
// <algorithm>
// template<class T>
// pair<T, T>
// minmax(initializer_list<T> t);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
int main()
{
assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({1, 3, 2}) == std::pair<int, ... | TEST | 0.943071 | 5.906502 |
ac679624-e476-460d-8b83-bad8405241ae | Vivek3072/Theory-Questions-gfg-dsa | 4.Recursion/Permutations/String.cpp | #include<bits/stdc++.h>
using namespace std;
void generatePermut(string str, int i){
if(i == str.size() - 1){
cout<<str<<" ";
return;
}
for(int j=i; j<str.size() ; j++){
swap(str[i],str[j]);
generatePermut(str,i+1);
swap(str[i],str[j]);
}
}
int main(){
gene... | ALGO | 0.999982 | 4.430065 |
3f173632-bd0a-42e6-af33-9b543bd8ba14 | SuryansDev/Leetcode-Solutions-DSA | 0784-insert-into-a-binary-search-tree/0784-insert-into-a-binary-search-tree.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.999978 | 6.318732 |
9b3c9736-316c-469d-a65f-9ac6cb785a55 | C-mmon/CupHead | BinarySearch/SearchInsertPosition.cpp | int low = 0;
int high = arr.size() - 1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (arr[mid] == searchElement) {
return mid;
}
if (arr[mid] < searchElement) {
low = mid + 1;
} else {
high = mid - 1;
}
}
// in the scenario the target was not found
return... | ALGO | 0.999897 | 4.538157 |
6e69c2f3-1612-4246-8608-0285e131e918 | ADS-bot/Leetcode | 3217-delete-nodes-from-linked-list-present-in-array/3217-delete-nodes-from-linked-list-present-in-array.cpp | class Solution {
public:
ListNode* modifiedList(vector<int>& nums, ListNode* head) {
ListNode dummy(0, head);
unordered_set<int> numsSet{nums.begin(), nums.end()};
for (ListNode* curr = &dummy; curr->next != nullptr;)
if (numsSet.contains(curr->next->val))
curr->next = curr->next->next;
... | ALGO | 0.999977 | 6.462355 |
ae735f1c-9c3c-46f7-a0a1-ca0cb146d77a | sKAR04/CP-Practice | Codechef/AUG18/GCDMOD.cpp | //Strike me down and I shall become stronger, than you can possibly imagine
#include <bits/stdc++.h>
using namespace std;
//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//save time
#define endl '\... | ALGO | 0.999968 | 4.805724 |
6e7fcc88-ad9e-4f10-bd8f-564fa6d9576b | yjsohn/BaekJoon | 2636.cpp | #include <iostream>
#include <cstring>
#include <queue>
//발상의 전환 필요: 치즈 중심이 아닌 공기 중심
/*참조 블로그
https://steady-coding.tistory.com/173
https://jaimemin.tistory.com/1032
*/
using namespace std;
enum { CHEESE = 1, PREAIR, AIR };
int N, M, cheese_cnt, ans = 1;
int dy[] = { -1, 1, 0, 0 };
int dx[] = { 0, 0, -1, 1 };
int c... | ALGO | 0.9999 | 4.573815 |
470dcade-6c0b-4d47-b4a6-b5101f577963 | showmic96/Online-Judge-Solution | LightOJ/1134/11212239_AC_140ms_2468kB.cpp | // In the name of Allah the Most Merciful.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[100005];
int main(void)
{
int t , c = 0;
scanf("%d",&t);
while(t--){
memset(dp , 0 , sizeof(dp));
int n , m;
scanf("%d %d",&n , &m);
int sum = 0;
... | ALGO | 0.999839 | 4.363923 |
248f8323-e8c6-48e4-aed3-7000e5e51ddb | 778477/LeetCode | 00676. Implement Magic Dictionary.cpp | #include <math.h>
#include <stdio.h>
#include <cstdlib>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <string>
#include <unordered_map>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
... | ALGO | 0.9988 | 5.60174 |
9deba23a-e3f2-42c1-a925-5cf2a7833130 | pprajap/boost | libs/graph/example/successive_shortest_path_nonnegative_weights_example.cpp | #include <boost/graph/successive_shortest_path_nonnegative_weights.hpp>
#include <boost/graph/find_flow_cost.hpp>
#include "../test/min_cost_max_flow_utils.hpp"
int main() {
boost::SampleGraph::vertex_descriptor s,t;
boost::SampleGraph::Graph g;
boost::SampleGraph::getSampleGraph(g, s, t);
boost::su... | ALGO | 0.999129 | 3.956671 |
88e90d78-8d78-4fc1-ac09-d7ce9df9852a | dumpinfo/BulletAccTest | Bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp | #include "btMinkowskiSumShape.h"
btMinkowskiSumShape::btMinkowskiSumShape(const btConvexShape* shapeA,const btConvexShape* shapeB)
: btConvexInternalShape (),
m_shapeA(shapeA),
m_shapeB(shapeB)
{
m_shapeType = MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE;
m_transA.setIdentity();
m_transB.setIdentity();
}
btVector3 btMinko... | ALGO | 0.969682 | 6.213969 |
4e39b39f-1d6e-4322-a479-51f16aef3cf7 | josegarcia19809/programas_cpp | 03_ciclos/suma_total.cpp | /*
* Elaborado por José L. García
*/
// Este programa pedirá 3 veces un número y lo estará agregando a una suma total
#include <iostream>
using namespace std;
int main() {
int suma = 0;
int numero;
int contador = 1;
while (contador <= 3) {
cout << "Dame un número: ";
cin >> numero;... | ALGO | 0.977544 | 3.330803 |
0d5893a3-38ac-4cc5-8fd0-daacf1d1d63d | ishandutta2007/codeforces | far_from_noob/normal/1519/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int... | ALGO | 0.999966 | 3.991168 |
9362b03b-1e76-4477-aa9a-d0ecc9bbe844 | neverac/2020summer | 个人赛10/G/26821221_ZhiyuanZheng_G.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
struct node{
int num,pos;
}a[110];
bool cmp(node x,node y){
if (x.num==y.num) return x.pos<y.pos;
return x.num>y.num;
}
bool cmps(node x,node y){
return x.pos<y.pos;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for (int i=1;i<=n;i++){
int... | ALGO | 0.999991 | 3.864995 |
ecb7ead0-a53b-4bd3-a5fb-0497be6b35bc | Chamod-Kavinda/In-20-CS2023 | Week 11/Prim's MST.cpp | #include <iostream>
#include <vector>
#include <climits>
#define V 6
using namespace std;
int minKey(vector<int> key, vector<bool> mstSet) {
int minVal = INT_MAX, minIndex;
for (int v = 0; v < V; v++) {
if (!mstSet[v] && key[v] < minVal) {
minVal = key[v];
minIndex = v;
... | ALGO | 0.999925 | 5.314616 |
9afed407-daaa-44a9-b54e-f8ee11aa3a2d | animeshsahu80/Interviewbit-solutions | intersecting_chords_in_circle.cpp | #define mod 1000000007
int Solution::chordCnt(int A) {
vector<long long int> dp(A+1);
dp[0]=1;
dp[1]=1;
for(int i=2;i<=A;i++){
for(int j=0;j<i;j++){
dp[i]=(dp[i]+((dp[j]%mod)*(dp[i-j-1]%mod))%mod)%mod;
}
}
return int(dp[A]%mod);
}
| ALGO | 0.999927 | 4.537903 |
74f1847c-cc64-4521-a77c-39e1f771c4a5 | NamDinhRobotics/3dv_tutorial_ceres_mpc | examples/ceres_tut1.cpp | //
// Created by dinhnambkhn on 27/08/2023.
//
#include <iostream>
#include <ceres/ceres.h>
//create a functor with residual = (10-x)^2+(3-y)^2
struct CostFunctor {
template<typename T>
bool operator()(const T *const x, T *residual) const {
residual[0] = T(10.0) - x[0];
residual[1] = T(3.0) - x... | ALGO | 0.999139 | 3.837076 |
e5380f9e-221b-438b-a070-63ebba72470e | Kyle-Perry/Kattis-Solutions | breakingbranches.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
uint64_t n;
cin >> n;
if(n % 2 == 0)
{
cout << "Alice\n1" << endl;
}
else
{
cout << "Bob" << endl;
}
return 0;
} | ALGO | 0.999939 | 3.923291 |
756ee689-3c94-46cd-9ac6-b2b0c60999d4 | Emmet-Hayes/HayesCompressor | Source/dsp/SmoothingFilter.cpp | #include "include/SmoothingFilter.h"
#include "../JuceLibraryCode/JuceHeader.h"
void SmoothingFilter::prepare(const double& fs)
{
sampleRate = fs;
a1 = 1;
b1 = 1 - a1;
}
void SmoothingFilter::process(const double& sample)
{
if (first)
{
state = sample;
first = false;
}
stat... | ALGO | 0.87953 | 5.75222 |
d0b12f19-927e-491c-b3b3-ffa3e5815e1f | priyaaditya10/DSA_Ques | arrays/palindromic_array.cpp | /* Given a Integer array A[] of n elements. Your task is to complete the function PalinArray.
Which will return 1 if all the elements of the Array are palindrome otherwise it will return 0.
Example:
Input:
2
5
111 222 333 444 555
3
121 131 20
Output:
1
0
Explanation:
For First test case.
n=5;
A[0] = 111 //which... | ALGO | 0.998359 | 5.545776 |
9d1795e3-e24f-49cf-b044-ddeb74655f59 | dhirajpatil2346/compitative | a20j/boys_and_girls.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
ofstream g;
string filename("output.txt");
g.open("output.txt", std::ofstream::out | std::ofstream::trunc);
g.close();
g.open(filename, ios_base::app);
if (n > k)
{
vector<char> v(n + k, 'B')... | ALGO | 0.999283 | 3.592015 |
ec8e6c6d-34c1-432d-961f-c23f5cbf9e40 | CrutoSJ/GFG-Leetcode_CPP-Python | #Leetcode-Daily/2976.cpp | // #Question:-
// Link-> https://leetcode.com/problems/minimum-cost-to-convert-string-i/description/?envType=daily-question&envId=2024-07-27
// Date-> 27/07/24
// #Solution:-
#include<bits/stdc++.h>
using namespace std;
class Solution {
private:
void FloydWar(vector<vector<long long>> &adjMatrix, vector<char>&... | ALGO | 0.999989 | 5.959051 |
dd5552dc-fd30-4047-8096-b6003464a1ba | whquddn55/Algorithm_BojSolves | 8000/8394.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename a, typename b>
ostream& operator<<(ostream& os, const pair<a, b>& pai) {
os << pai.first << ' ' << pai.second;
return os;
}
template<typename a, typename b>
istream& operator>>... | ALGO | 0.999817 | 3.755336 |
109ed8c9-48af-411c-8b3e-a5f8a7326786 | veerko/dsa-master | DSA/Feb LeetCode Challenge/simplify-path.cpp | class Solution {
public:
string simplifyPath(string path) {
vector<string> stack;
string res, temp;
stringstream p(path);
while (getline(p, temp, '/')) {
if (temp == "" or temp == ".") continue;
if (!stack.empty() && temp == "..")
stac... | ALGO | 0.999529 | 6.097864 |
0337e741-7721-4bf6-9c40-8a1b8f277ee8 | shubhansu-kr/DailyChallenge-2024-LeetCode | 01_January_2024/05_MaxProfit.cpp | // https://leetcode.com/problems/maximum-profit-in-job-scheduling/?envType=daily-question&envId=2024-01-06
#include <bits/stdc++.h>
using namespace std ;
class Solution {
public:
int jobScheduling(vector<int>& startTime, vector<int>& endTime, vector<int>& profit) {
int n = startTime.size();
vector... | ALGO | 0.999961 | 5.989975 |
a5ebd6d5-660c-4d9f-baee-0a843a5a8919 | bokusunny/atcoder-archive | atcoder.jp/abc210/abc210_e/Main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<pair<long long, int>> AC(M);
for (int i = 0; i < M; i++) {
cin >> AC[i].second >> AC[i].first;
}
sort(AC.begin(), AC.end());
long long tot = 0;
for (auto [C, A] : AC) {
auto new_N = gcd(N, A); // 新しい連結... | ALGO | 0.999936 | 4.235956 |
101b35a2-0b54-4d24-8103-4be955f67e0f | DimitarSht/Informatics-10B-class | Първи срок/Седмица_03_Упражнение_04_10_2023/zad2_upr.cpp | #include<iostream>
using namespace std;
void edn(int n,int a[])
{
for(int i=0; i<n-1; i++)
{
for(int b=i+1; b<n; b++)
{
if(a[i]==a[b])
{
cout<<a[i]<<" ";
cout<<i<<" "<<b<<" ";
}
}
}
}
//1 2 3 1 2
int main()
{
in... | ALGO | 0.999709 | 3.319446 |
b51487a1-cc41-42a2-bf35-36a5e1156310 | Michaelmilk/pat | 1075-PAT Judge.cpp | #include <iostream>
#include <vector>
#include <string>
#include <iterator>
#include <cmath>
#include <map>
#include <algorithm>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <set>
#include <fstream>
#include <cstring>
using namespace std;
ifstrea... | ALGO | 0.998227 | 3.311811 |
29f6bc18-6f9a-4705-b9a3-56d33d00d028 | hardikgupta2003/DataStructuresAndAlgorithms | Tries/SumOfPrefixScoresOfString.cpp | #include <bits/stdc++.h>
using namespace std;
struct trieNode
{
int countP = 0;
trieNode *children[26];
};
class Solution
{
public:
trieNode *getTrieNode()
{
trieNode *newNode = new trieNode();
for (int i = 0; i < 26; i++)
{
newNode->children[i] = nullptr;
}... | ALGO | 0.999972 | 5.91151 |
3e95353a-49c6-424e-88a9-922281a97a9b | Ahmedhany-1/Leetcode-Solutions | 1060-missing-element-in-sorted-array.cpp | class Solution {
public:
// Return how many numbers are missing until nums[idx]
int missing(int idx, vector<int> &nums) {
return nums[idx] - nums[0] - idx;
}
// Using idx, what is kth missing number
int kth(int idx, vector<int> &nums, int k) {
// k - missing(idx, nums) = the remaining values
return nums[idx]... | ALGO | 0.999886 | 5.57974 |
1a6a2ba9-7324-46af-8264-6c914a4c1888 | imoiwm/dynamica2oj | lessthan1300/panoramixsprediction.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef ve... | ALGO | 0.99999 | 3.729822 |
75fab174-316c-4d17-be2c-4ef5d4bd4327 | logixoul/grid-fluid | src/gpuBlur2_5.cpp | #include "precompiled.h"
#include "shade.h"
#include "stuff.h"
#include "shade.h"
#include "gpgpu.h" // for shade2
#include "gpuBlur2_5.h"
#include "stefanfw.h"
namespace gpuBlur2_5 {
gl::TextureRef run(gl::TextureRef src, int lvls) {
auto state = shade2(src, "_out.rgb = fetch3();");
for (int i = 0; i < lvls; i... | TOOL | 0.90708 | 4.298052 |
b2259015-0f5b-494b-b42c-2e10625636b4 | devsamin/LeedCode-Problem-Solving | Decode_String.cpp | class Solution {
public:
string decodeString(string s) {
stack<int> Numst;
stack<char> Chst;
int num = 0;
for (char c : s) {
if (isdigit(c)) {
num = num * 10 + (c - '0'); // পুরো সংখ্যা তৈরি করছি
}
else if (c == '[') {
... | ALGO | 0.999776 | 6.9769 |
e2c851bf-1172-4401-8994-fdd19eedd955 | ch-saty/codechef | test.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int y,x,sal=0,l=0,si=INT_MIN;
string s;cin>>x>>y>>s;
for(int i=0;i<=29;i++){
if(s[i]=='1'){
l++;
sal+=x;
}
else if(s[i]=='0'){
si=max(si,l);
l=0;
}
}
cout<<sal+(y*si)<<endl<<si<<endl;
}
}
| ALGO | 0.997906 | 3.458863 |
d9feb434-5a09-4c72-91a8-01ddeee7e85c | Hotckiss/cpp_labs | hw2/hw2/src/Board.cpp | #include <cassert>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include "Board.h"
Board::Board() {
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
field[i][j] = '.';
}
int Board::get_cell(const int x, const int y) const {
assert(x >= 0 && y >= 0 && x < 10 && y < 10);
... | ALGO | 0.999703 | 4.965794 |
257fb992-3453-4d20-972a-242caa60675f | ishandutta2007/codeforces | huansuz1/normal/459/B.cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
long long n , a[223456] , zz , z , s;
int main(){
long long mi = 1234567891, ma = 0;
cin >> n ;
for (int i = 1; i <= n; i++ ) {
cin >> a[i];
if (a[i]>ma) ma=a[i];
if (a[i]<mi) mi=a[i];
}
for (int i = 1; i <= n; i++ ... | ALGO | 0.999869 | 3.585111 |
0eb512e8-ba43-408b-a18a-8169584b3309 | sebas095/Competitive-Programming | URI/Triangle.cpp | #include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl '\n'
using namespace std;
bool isTriangle(double &a, double &b, double &c) {
bool f1, f2, f3;
f1 = (a < b + c) and (a > fabs(b - c));
f2 = (b < a + c) and (b > fabs(a - c));
f3 = (c < a + b) and (c > fabs(a - b))... | ALGO | 0.999196 | 4.773005 |
3b15e9f6-b029-4657-8261-bd197c18ae23 | jevinskie/llvm-project-embedded-library-in-process | libcxx/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp | // bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs); // constexpr since C++23
#include <bitset>
#include <cassert>
#include <cstddef>
#include <vector>
#include "../bitset_test_cases.h"
#include "test_macros.h"
template <std::size_t N>
TEST_CONSTEXPR_CXX23 void test_op_or() {
std::vector<std::bits... | TEST | 0.959675 | 7.779898 |
2142c1fd-9641-49b9-824a-5d7920374eb8 | yash-gupta11/Strivers-A2Z-DSA-Course-Sheet | 4_0 BINARY SEARCH/4_1 BS in 1D array/6_Find_the_first_or_last_occurrence_of_a_given_number_in_a_sorted_array.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> searchRange(vector<int>& nums, int target) {
int first = -1,last = -1;
int s = 0,e = nums.size()-1;
while(s <= e){
int mid = s + (e-s)/2;
if(nums[mid] == target){
first = mid;
e = mid... | ALGO | 0.999959 | 5.800495 |
1a333ce2-b921-43b9-a641-e334c75aa5d3 | jagadishchakma/cse-fundamentals-course-with-phitron | course_DS/module_02_vector/vector_string.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
cin.ignore();
vector<string> name(n);
for (int i = 0; i < n; i++)
{
getline(cin,name[i]);
}
for (string na:name)
{
cout << na << endl;
}
return 0;
} | ALGO | 0.935142 | 4.189976 |
b0b68a96-13e2-4846-9f4d-616b83802fda | sqrd-max/cpp | 1 sem/lab_6_2/task3/task3.cpp | #include <iostream>
#include <functional>
#include <vector>
#include <cmath>
// Структура события для математического pipeline
struct MathEvent {
double number;
};
// Тип обработчика события для математического pipeline
using MathHandler = std::function<void(MathEvent&)>;
// Структура для хранения обработчиков с... | ALGO | 0.948896 | 7.542414 |
5c9fd8a1-cdb3-4abc-99bd-c36f77b54308 | Paras7527/Logic_Building | program370.cpp | #include <iostream>
using namespace std;
struct node
{
int data;
struct node *next;
struct node *prev;
};
typedef struct node NODE;
typedef struct node *PNODE;
class DoublyCL
{
public:
PNODE head;
PNODE tail;
int iCount;
DoublyCL()
{
head = NULL;
tail = NULL;
... | ALGO | 0.992022 | 4.927358 |
7b94d332-c482-46d6-a49b-c703a68eca49 | Obozha/CodeTraining | C语言代码练习/ACM算法设计/1021三个整数的最大值.cpp | #include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
// 20 16 18
int max =a;
if(b>max){
max=b;
}
if(c>max){
max=c;
}
printf("%d",max);
return 0;
}
| ALGO | 0.999078 | 3.710526 |
aa8853b2-d852-42c4-9e8e-248e1a251a6f | Midas847/Competitive-Coding | LeetCode Submissions/n-th-tribonacci-number/Accepted/9-29-2021, 8_42_16 AM/Solution.cpp | // https://leetcode.com/problems/n-th-tribonacci-number
class Solution {
public:
int tribonacci(int n) {
int dp[38];
dp[0] = 0;
dp[1] = 1;
dp[2] = 1;
for(int i=3;i<=n;i++){
dp[i] = dp[i-3] + dp[i-2] + dp[i-1];
}
return dp[n];
}
}; | ALGO | 0.999977 | 6.087729 |
c891b6ff-ccc5-473f-9424-c3909362e782 | Dom94/Project | Project/Dependencies/include/Box2D/Dynamics/b2Island.cpp | #include "Box2D/Collision/b2Distance.h"
#include "Box2D/Dynamics/b2Island.h"
#include "Box2D/Dynamics/b2Body.h"
#include "Box2D/Dynamics/b2Fixture.h"
#include "Box2D/Dynamics/b2World.h"
#include "Box2D/Dynamics/Contacts/b2Contact.h"
#include "Box2D/Dynamics/Contacts/b2ContactSolver.h"
#include "Box2D/Dynamics/Joints/b2... | ALGO | 0.999973 | 4.619961 |
6ba0d564-c487-4aea-ad6a-22c7ea40cea4 | ishandutta2007/codeforces | ohweonfire/normal/526/C.cpp | #include <bits/stdc++.h>
using namespace std;
long long c,wr,wb,hr,hb;
int main()
{
cin>>c>>hr>>hb>>wr>>wb;
c=c/__gcd(wr,wb)*__gcd(wr,wb);
if(wr*hb>wb*hr)
{
swap(wr,wb);
swap(hr,hb);
}
else if(wr*hb==wb*hr&&wr>wb)
{
swap(wr,wb);
swap(hr,hb);
}
long long t=0;
if(wr>=10000)
{
for(int i=0;i*wr<=c;i++)... | ALGO | 0.999797 | 3.502608 |
73479974-caf7-4c4e-8b79-68237bef1b37 | Gnaroshi/practice-algorithm-solvedac | With_Levels/Bronze/Bronze_4/25640.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string j;
int n;
int ans = 0;
cin >> j >> n;
while (n--)
{
string temp;
cin >> temp;
if (j == temp)
ans++;
}
cout << ans << '\n';
... | ALGO | 0.999897 | 4.073517 |
99c9d3bd-7d37-41e2-8968-1749bb23596d | mandagod/SDL | code/proconsumer.cpp | /*
proconssumer.cpp
An example of using SDL threads and semaphores.
The producer-consumer problem using semaphores.
Compile: g++ -o proconsumer proconsumer.cpp -lSDL -lpthread
Execute: ./proconsumer
*/
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <stdio.h>
#include <stdlib.h>
using namespace ... | ALGO | 0.962078 | 6.056248 |
089573cc-9376-4bbe-b607-4648979d3b31 | fangwj-12/https-github.com-chen08209-FlClash | 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.998809 | 6.763549 |
3f27991f-c2b2-4268-a304-afa4182e1aa5 | arthurvinice/programmingStudies | factorial.cpp | // Have the function FirstFactorial(num) take the num parameter being passed
// and return the factorial of it.
// For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24.
// For the test cases, the range will be between 1 and 18 and the input will always be an integer.
// A challenge available o... | ALGO | 0.999935 | 5.268978 |
71d38499-9999-4b97-a121-1da2ff36f1df | Digi-Space-Productions/godot-historical | servers/physics/step_sw.cpp | /*************************************************************************/
/* step_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | ALGO | 0.989962 | 4.425402 |
b16ea278-15d8-4651-8eb5-b522241a4d7d | aakashparajuli/Programming-files | mass of air in automobile.cpp | # include<stdio.h>
# include<conio.h>
# include<math.h>
main (){
float a,b,c,r1,r2,d;
printf(enter the values of a, b, c);
scanf ( %f %f %f, &a, &b, &c);
d= b*b 4*a*c;
if (d>0){
r1 = -b+sqrt (d) / (2*a);
r2 = -b-sqrt (d) / (2*a);
printf (The real roots = %f %f, r1, r2);
}
else if... | ALGO | 0.999716 | 3.219834 |
0f377795-b0a9-4fc2-a326-eb7b6c1e6654 | steven-LSC/UVA-Solutions | 872.cpp | #include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <algorithm>
using namespace std;
multimap<char,char> graph;
vector<char> ans;
map<char, int> situation;
bool backtracking(int length)
{
if (length == situation.size()) {
cout << ans[0];
for (int i = 1; i < ans.size... | ALGO | 0.999844 | 4.070702 |
c7b2cda2-5302-48a8-bce3-dc0d348b55f8 | Akashgund13/ApplicationPrograms | C++_Programming/Program478.cpp | #include<iostream>
using namespace std;
template <class T>
class ArrayX
{
public:
T *Arr;
int iSize;
ArrayX(int);
~ArrayX();
void Accept();
void Display();
bool LinearSearch(T);
};
template <class T>
ArrayX<T> :: ArrayX(int iNo)
{
this->iSize = iNo;
... | ALGO | 0.999504 | 3.913261 |
f19c92a5-193b-475a-acea-240c92d3b435 | aman-akv0/leetcodeAKV | 977. Squares of a Sorted Array.cpp | class Solution {
public:
vector<int> sortedSquares(vector<int>& nums) {
vector<int>v(nums.size());
for(int i=0;i<nums.size();i++){
v[i]= nums[i]*nums[i];
}
sort(v.begin(),v.end());
return v;
}
};
| ALGO | 0.999966 | 5.937839 |
55dd8f65-1cad-48b0-84e0-b2afad542ee7 | sergii-yatsuk/codejam | GoogleCodeJam/GCJ_2017_1C_A/main.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <fstream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <iostream>
#include <iomanip>
#include <array>
#include <cmath>
#include <limits>
#include <cassert>
... | ALGO | 0.998866 | 3.618634 |
1a602543-fe00-430a-a00d-bd95aa8b920d | kagasan/atcoder | abc/abc150/5.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, ... | ALGO | 0.999991 | 4.067217 |
29f4091e-d38b-42cf-95f6-6b2ddc40736e | longnu/codetree-TILs | 240523/오목/O-mok.cpp | #include <iostream>
#include <algorithm>
#define DIR_NUM 8
using namespace std;
int arr[19][19];
int dx[DIR_NUM] = {1, 1, 1, -1, -1, -1, 0, 0};
int dy[DIR_NUM] = {-1, 0, 1, -1, 0, 1, -1, 1};
int InRange(int x, int y) {
return 0 <= x && x < 19 && 0 <= y && y < 19;
}
int main() {
// 입력
for(int i = 0; i ... | ALGO | 0.999827 | 3.733962 |
51badda9-b84e-4020-9477-2f528e5dc860 | 1337DaKL/Bai_Tap_C_Plus_Plus | codePTIT/DSA04009.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
ll n;
struct matran
{
ll a[11][11];
friend matran operator*(matran x, matran y)
{
matran kq;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
kq.a[i... | ALGO | 0.999859 | 3.212517 |
23d361c7-a94f-4493-b6e7-a35bf1e69041 | hug567/mylib | cpp/leetcode/leetcode_0005.cpp | // leetcode 5: 最长回文子串 [中等]
// 2023.05.05
#include <iostream>
#include <string>
#include "common.h"
using namespace std;
#define LOCAL_SOLUTION_01
/***** submit code ************************************************************/
// 方案一:
// 思路:回文串的中心可以是1个或2个字符,以回文串中心为起点,向两边扩展,查找
// 最长回文子串
#ifdef LOCAL_SOLUTION_0... | ALGO | 0.99995 | 6.488856 |
a9a8a9e5-e886-4783-90e2-935ab4b0ede6 | anantdeepsingh/Leetcode | 198-house-robber/house-robber.cpp | class Solution {
public:
int maxAmount(int ind,vector<int>&nums,vector<int>&dp){
int n=nums.size();
if(ind>=n) return 0;
if(dp[ind]!=-1) return dp[ind];
int op1=maxAmount(ind+1,nums,dp);
int op2=nums[ind]+maxAmount(ind+2,nums,dp);
return dp[ind]=max(op1,op2);
}
... | ALGO | 0.999916 | 5.860945 |
9033c7a3-7ae2-433d-a2cf-c753db36d6fe | Nisarg-1406/DSA-LeetCode-Coding-Questions-in-C- | Arrays/Largest Subarray with zero sum.cpp | //https://practice.geeksforgeeks.org/problems/largest-subarray-with-0-sum/1
//https://www.youtube.com/watch?v=xmguZ6GbatA - IMP Concept by TUF
//Done in the GFG pratice link
int maxLen(int A[], int n)
{
unordered_map<int,int> mp;
int maxi = 0;
int sum = 0;
for(int i=0;i<n;i++){
sum = sum + A[i]... | ALGO | 0.999558 | 5.709948 |
892f16e4-d569-4a6c-b069-64a023fc2c7f | Jin-Myung/hacker_rank | cpp/stl/vector_erase.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int N;
cin >> N;
vector<int> arr;
while (N--) {
int temp;
cin >> temp;
... | ALGO | 0.999577 | 3.207392 |
8a7c78f7-245d-4a9d-8c06-a0f50eb07a41 | duttabhishek0/Dynamic_Programming | PartitioningProblem.cpp | #include<iostream>
using namespace std;
bool partition(int *a,int n,int sum){
if(sum==0){
return 0;
}
}
int main(){
int arr[] = {1, 5, 11, 5};
int n = sizeof(arr)/sizeof(int);
int sum=0;
for(int i=0;i<n;i++){
sum += arr[i];
}
cout<<sum/2;
return 0;
}
| ALGO | 0.999721 | 3.968067 |
c3ef3f39-a58d-4dc6-9396-0cc27cb78e47 | divyanshu1906/LeetCode | breadth-first-search/01-matrix.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
int m = mat.size(), n = mat[0].size();
vector<vector<int>> ans(m, vector<int>(n, -1));
queue<pair<int, int>> q;
vector<vector<int>> directions = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
for (int i = 0; i < m; i+... | ALGO | 0.999978 | 6.711289 |
02ce9e7b-db04-47b1-8527-8f7d2aef881a | AmanSingh1611/Data-Structures-in-CPP | BST/BSTfromSortedArray.cpp | /**********************************************************
Following is the Binary Tree Node class structure
template <typename T>
class BinaryTreeNode {
public :
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data) {
this -> data = data;
l... | ALGO | 0.999988 | 6.25179 |
c9a3f3b5-c676-4206-bed0-de5623eb1986 | vit6556/OOP_labs | lab_1/matrix/matrix.cpp | #include <iostream>
#include <vector>
#include "matrix.h"
namespace matrix {
Matrix input_matrix() {
Matrix matrix;
std::cout << "Enter amount of rows: ";
std::cin >> matrix.m;
std::cout << "Enter amount of columns: ";
std::cin >> matrix.n;
int val;
std::cou... | ALGO | 0.996985 | 3.961359 |
f5f6f4ec-42ce-45d6-8a85-29bde197091f | helloMickey/Algorithm | lc-cn/叶子相似的树.cpp | // https://leetcode-cn.com/problems/leaf-similar-trees/
/**
* 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) {}
* Tre... | ALGO | 0.999968 | 6.238634 |
79838354-3b40-4583-97ea-5bf6c9cd1a95 | hyongbai/aosp-lite-10 | system/core/adb/daemon/auth.cpp | #define TRACE_TAG AUTH
#include "adb.h"
#include "adb_auth.h"
#include "adb_io.h"
#include "fdevent.h"
#include "sysdeps.h"
#include "transport.h"
#include <resolv.h>
#include <stdio.h>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <memory>
#include <android-base/file.h>
#include <android-bas... | TOOL | 0.887965 | 7.735165 |
9b5e48c9-a844-4c95-8f74-de9649c7c555 | Syncmewo/CPSINS | eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define function to be applied coefficient-wise
double ramp(double x)
{
if (x > 0)
return x;
else
return 0;
}
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random();
cout << m1 << endl << "becomes: " << endl << ... | ALGO | 0.972092 | 4.120226 |
ab428a36-89ea-4d8d-97ad-85fdc34d1e9a | ganeshkumarka/Design-Analysis-of-Algorithms | DAA lab/CoinChangeProblem.cpp | #include <iostream>
using namespace std;
int minCoins(int coins[], int n, int amount) {
int dp[amount + 1];
fill(dp, dp + amount + 1, 1e9);
dp[0] = 0;
bool solutionFound = false;
for (int i = 0; i < n; ++i) {
for (int j = coins[i]; j <= amount; ++j) {
if (dp[j - coins[i]] != 1e9... | ALGO | 0.999965 | 5.523232 |
346f207a-5494-4ab9-b44b-30a760699924 | WhiteSunJin/C | ADT/第二章 栈和队列实践/实验3 循环队列及基本运算/3.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 20
typedef struct
{
char data[MAXSIZE];
int rear,front;
}SeQueue;
void Int_SeQueue(SeQueue **q)
{
*q = (SeQueue *)malloc(sizeof(SeQueue));
(*q)->front = 0;
(*q)->rear = 0;
}
int Empty_SeQueue(SeQueue *q)
{
if(q->front == q->rear)
{
return 1;
}
else
{... | ALGO | 0.996444 | 4.065361 |
8ed92cde-c4eb-406d-b5ba-274a988cd979 | ishandutta2007/codeforces | kdh9949/normal/1163/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200005, L = 20;
int n, a[N], b[L], c;
int ins(int x){
for(int i = 0; i < c; i++){
int bc = __builtin_clz(b[i]), xc = __builtin_clz(x);
if(bc > xc) break;
else if(bc < xc) continue;
else x ^= b[i];
if(!x) return 0;
}
for(int i = 0; i <= c; i++){... | ALGO | 0.999984 | 3.667404 |
75b220bb-1b8f-40e5-a17c-9c01d659ea5f | DevEn9u/06Flutter | ex11_textfield1_deco/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.998456 | 6.76775 |
e0683336-0259-4929-bfe8-66489a2111a0 | Alfeim/njuee_LeetCode_Solutions | Cpp/Submit Records/349. Intersection of Two Array.cpp | /********************************************
作者:Alfeim
题目:两个数组的交集
时间消耗:4ms
解题思路:运用STL容器
********************************************/
class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
unordered_set<int> Set;
unordered_set<int> record;
vector<int> re... | ALGO | 0.999847 | 5.351779 |
5bfb20e5-e7c2-4ea7-beba-a50fef9ca279 | aniketpathak028/Data-Stuctures-and-Algorithms | Binary Search/index_of_first_1_in_infinte_sorted_array.cpp | #include<bits/stdc++.h>
using namespace std;
int findIndex(vector<int> &nums){
int s = 0, e = s + 1, mid;
// find the range of elements
while(!nums[e]){
s = e;
e = 2 * e;
}
int res = -1;
while(s<=e){
mid = s + (e - s) / 2;
if(nums[mid]==1){
res = mid... | ALGO | 0.999864 | 4.861739 |
20211897-1adb-4327-a55b-4aba373207a6 | peteryao7/cses-pset | intro/PalindromeReorder.cpp | #include <iostream>
using namespace std;
typedef long long ll;
int main() {
string s;
cin >> s;
int ch[26] = {};
int odds = 0;
for (char c : s)
ch[c - 'A']++;
for (int i : ch) {
if (i % 2)
odds++;
}
if (odds > 1) {
cout << "NO SOLUTION";
r... | ALGO | 0.999989 | 4.333211 |
3871d53d-363d-4cf4-87f6-1da6ff54b6ed | imsuck/solutions | luyencode/solved/POWER3.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
for (int i = 0; i < n; i += 1) {
ll x;
cin >> x;
double delta = round(cbrt(x)) - cbrt(x);
if (delta < 0 && delta > -1e... | ALGO | 0.999602 | 4.275687 |
0412503d-0ddd-4b7f-93d4-3ac1c81f4516 | 1020xyr/CodeSet | 代码/39.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
vector<int> edge[101];
int indegree[101];
queue<int> Q;
void func() {
int n, m;
while (cin >> n >> m && n != 0) {
while (!Q.empty()) {
Q.pop();
}
for (int i = 0;i < n;i++) {
indegree[i] = 0;
edge[i].clear();
}
for (int i = 0... | ALGO | 0.999957 | 4.743134 |
1d6c5d57-8ace-4dae-8d1b-3d16c25b11a3 | biyotteu/algorithms | C++/문자열.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin >> a >> b;
int res = 50;
for(int i=0;i<=b.size()-a.size();i++){
int cmp = 0;
for(int j=0;j<a.size();j++)
if(a[j] != b[i+j]) cmp++;
res = min(res,cmp);
}
cout << res;
} | ALGO | 0.99993 | 3.613067 |
aab41c9b-a4c6-415c-b39a-7d9238d1f68f | tic40/atcoder | other_contest/edpc/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define endl '\n'
const int INF = numeric_limits<int>::max();
template<class T> void chmin(T& a, T b) { a = min(a,b); }
int main() {
int n,k; cin >> n >> k;
vector<int> h(n);
REP(i,n) cin >> h[i];
vector<int> dp(n,INF);
dp[0... | ALGO | 0.999946 | 4.143871 |
ae2917b6-8e0a-4942-894e-895f60e35e55 | Keerthansuvarna/Programming_in_C | Pyramid Pattern.cpp | #include<stdlib.h>
#include<iostream>
using namespace std;
/*Code to print pyramid with any given character*/
int main()
{
int n,i,j,a,b;
/*n for pyramid hight ----> Number of rows
i for select row & j for select column */
cout<<"Enter the number of lines re... | ALGO | 0.999716 | 3.696002 |
2223df79-55fa-4dea-9201-1b1ef7707c50 | ad-kat/MIT_Manipal_Labwork | DS lab/lab 3/palindrome_stack/main.cpp | #include <iostream>
#include <string.h>
#define MAX 50
using namespace std;
class Stack
{
private:
char data[MAX],str[MAX];
int top,length,count;
public:
void push(char);
char pop();
Stack()
{
top==-1;
length=0;count=0;
}
void get();
void check();
void extract();
... | ALGO | 0.999135 | 3.94554 |
f07c9a6e-ee5d-4c0d-b48f-a6d146307e4a | Veljko28/cpp-data-algrtms | codeforces/104/Exams.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <string>
#include <cstring>
#include <ctime>
#include <set>
#include <list>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <unordered_map>
#include <deque>
#include... | ALGO | 0.999966 | 4.158997 |
48533784-e032-4ffc-9189-047fc6fb571f | Akp6528/DS-Algo | Arrays & Strings/image.cpp | #include<iostream>
#include<algorithm>
using namespace std;
void display(int a[][1000], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << a[i][j] << " ";
}
cout << endl;
}
}
void rotate(int a[][1000], int n) {
//reverse each row
for (int row = 0; row < n; row++) {
int start_... | ALGO | 0.999114 | 4.384831 |
ef4a908f-16dd-4fdf-9a90-abfa6aa3ac6e | hackybacky/my-leet | 2095-delete-the-middle-node-of-a-linked-list/2095-delete-the-middle-node-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteMiddl... | ALGO | 0.999904 | 5.952514 |
8a7c504c-c547-4176-a820-415406d317da | ankit039/Competitive_Programming_Solutions | codechef/may19b_redone.cpp | #include<bits/stdc++.h>
typedef unsigned long long int type;
using namespace std;
#define M 1000000007
int main()
{
int t,n;
cin>>t;
type arr[1000007];
arr[0]=1;
for(int i=1;i<1000007;i++)
{
arr[i]=((arr[i-1]*i)%M);
}
while(t--)
{
cin>>n;
cout<<(arr[n+1]-1)%M<<e... | ALGO | 0.999957 | 4.122381 |
f225082a-b5cd-4f8e-8fdf-32e348dd9718 | rotarymars/atcoder_submissions | abc325/abc325_c/abc325_c.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <vector>
struct DSU
{
public:
DSU() : _n(0) {}
explicit DSU(int n) : _n(n), parent_or_size(n, -1) {}
int merge(int a, int b)
{
int x = leader(a), y = leader(b);
if (x == y)
return x;
if (-parent_or_size[x] <... | ALGO | 0.999919 | 4.525998 |
ebb1e5c2-0ccf-4a8e-af64-376d42e607a8 | yyytae0/algorithm-training | c/Project1/Project1/2_27.cpp | /*
#include <string>
#include <vector>
using namespace std;
int solution(int n) {
int answer = 0;
for (int i = 1; i <= n; i += 2)
{
if (n % i == 0)
{
answer++;
}
}
return answer;
}
*/ | ALGO | 0.999256 | 4.624732 |
89069496-9c3a-4bcc-9bf7-027c03ac6b2b | chaochao42/self_calibrated_jnerf | contrib/mipnerf/python/jnerf/ops/op_include/eigen/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.987944 | 4.015535 |
8cc9d762-993e-4a2a-8b58-c625975c48e1 | KhangPham205/ControlStructeExercise | CTDK/002/002.cpp | #include <iostream>
using namespace std;
int main()
{
float r;
cout << "Nhap r: ";
cin >> r;
float s = 3.14 * r * r;
cout << "Dien tich la: " << s << endl;
return 0;
} | ALGO | 0.979386 | 3.081311 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.