uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
246d54b5-cf9e-4e8d-96ff-02f83f73256c | MinhTuan2405/DSA_ | SPOJ PTIT/P202PROJ.cpp | // https://www.spoj.com/PTIT/problems/P202PROJ/
// P202PROJ - Đếm cặp
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int dem = 0;
for (int i = 0; i < s.length(); i++)
if (s[i] == '2')
dem++;
long long sum = 0;
for (int i = 0; i < s.length();... | ALGO | 0.999651 | 4.173635 |
8fbf9c53-185d-4a0f-ad3f-fc04d4c43244 | SanyamAgarwalRobotics/SDCND_MPC | src/Eigen-3.3/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.998764 | 3.093769 |
08340c4b-3171-4b42-b9ee-6cfef050251a | sysulic/ABS | eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
ArrayXXf a(2,2);
a << 1,2,
3,4;
cout << "(a > 0).all() = " << (a > 0).all() << endl;
cout << "(a > 0).any() = " << (a > 0).any() << endl;
cout << "(a > 0).count() = " << (a > 0).count() << endl... | ALGO | 0.960469 | 3.835741 |
a203bb6c-03a1-4a31-93ea-26b551566757 | Piyush4298/Cpp-Practice-problems | Trees/topViewOfBt.cpp | /*
I/P:
10
/ \
20 30
\ \
50 70
O/P : 20 10 30 70
*/
#include<iostream>
#include<queue>
#include<utility>
#include<map>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int x)
{
data = x;
... | ALGO | 0.99999 | 4.510958 |
d5618f53-adac-4cc7-bc2d-4c607b4358fd | ACM-TOMS/CALGO | 0940/Original-Submission/Src/ThirdParty/blitz-0.10/benchmarks/dot2.cpp | #include <blitz/timer.h>
BZ_USING_NAMESPACE(blitz)
double dot(const double* a, const double* b, int n)
{
double result = 0.;
for (int i=0; i < n; ++i)
result += a[i] * b[i];
return result;
}
template<class T>
void sink(T&)
{
}
void sink(double,double,double,double,double,double,double,double,do... | ALGO | 0.999134 | 5.561045 |
6ec0ba36-1924-448d-bfce-c2f1b4801128 | leafeonia/leetcode | C++/code/633.cpp | class Solution {
public:
bool judgeSquareSum(int c) {
int square = (int)sqrt(c);
if (square*square == c) return true;
for (int i = 1;i <= square;i++){
int left = c - i * i;
int s2 = (int)sqrt(left);
if (s2 * s2 == left) return true;
}
retur... | ALGO | 0.999955 | 5.423352 |
4e99024b-0967-461e-8c80-30b71dc0c481 | paramsingh/cp | src/practice/generouskefa.cpp | #include <bits/stdc++.h>
using namespace std;
char s[10100];
int freq[100];
int main(void) {
int n, k;
scanf("%d %d", &n, &k);
scanf("%s", s);
for (int i = 0; i < n; i++)
freq[s[i] - 'a']++;
// try to assign each color to different friends
// if some color gets left, you're fucked
for (int i = 0; i < 26; i+... | ALGO | 0.999994 | 3.9531 |
2d02eda1-f2a8-4625-b887-6e2c34b22bc4 | kkeita/llvm_autofdo | lib/Transforms/IPO/MergeFunctions.cpp | #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#inc... | TOOL | 0.971192 | 6.223552 |
4e1d8675-0ccb-4d9d-8e5d-1ed0404b1453 | obiwac/freebsd-s0ix | contrib/llvm-project/lld/MachO/MarkLive.cpp | #include "MarkLive.h"
#include "Config.h"
#include "OutputSegment.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "UnwindInfoSection.h"
#include "lld/Common/ErrorHandler.h"
#include "llvm/Support/TimeProfiler.h"
#include "mach-o/compact_unwind_encoding.h"
namespace lld::macho {
using namespace llvm;
using... | TOOL | 0.90308 | 7.964442 |
26cf7225-02cc-4f51-b20f-e053a7c686f1 | deepin-community/llvm-toolchain-16 | mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp | #include "mlir/Dialect/Affine/TransformOps/AffineTransformOps.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
#include... | TOOL | 0.853817 | 7.859805 |
fff5c0d9-63bd-437a-816c-bd955ce565f3 | jinz2014/Cpp | cpp_feature/bitset_test.cpp | #include <iostream>
#include <string>
#include <bitset>
#include <limits>
using namespace std ;
int main()
{
string str = "00000100" ;
//cout << bitset<numeric_limits<unsigned long>::digits>(str).to_ulong() << '\n' ;
cout << bitset<8>(str).to_ulong() << '\n' ;
}
| ALGO | 0.991674 | 3.210061 |
ada2c30c-f3c6-42a2-a462-e4e04d334e43 | shbhmexe/LeetCode-Question-Sol | Easy/MaximumProductofTwoElementsinanArray_1464.cpp | //Question 267
// //Approach-1 (Keep finding the max current number)
// //T.C : O(n)
// //S.C : O(1)
// class Solution {
// public:
// int maxProduct(vector<int>& nums) {
// int n = nums.size();
// int maxNum = nums[0];
// int result = 0;
// for(int i = 1; i<n; i++)... | ALGO | 0.999976 | 5.907513 |
4cca3c96-5337-4a7f-9994-4e75830ef458 | shivgupta198922/HACKEREARTH-MASTER | Data Structures/Arrays/1-D/Testing Strings.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n, m, k;
cin >> n >> m >> k;
vector<set<pair<int, int>>> v(k);
while(n--)
{
int l, r, z;
cin >> l >> r >> z;
l--,r--,z--;
v[z].inse... | ALGO | 0.999953 | 4.184761 |
eaa69fc4-cc23-4cbd-b725-4135c1081d07 | aneeqaf/Quantum-Simulation | QuantumSim/compression/compression/gnuplot-iostream/boost_1_75_0/libs/graph/example/sloan_ordering.cpp | #include <boost/config.hpp>
#include <vector>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/sloan_ordering.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/bandwidth.hpp>
#include <boost/graph/profile.hpp>
#include <boost/graph/wavefront.hpp>
using std::cout;
using... | ALGO | 0.999972 | 6.518653 |
e0188511-a9b7-4537-ad68-6e79302e64ed | naumazeredo/competitive-programming | livearchive/ser-usa-2015/7379.cpp | #include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
typedef long long ll;
typedef long double ld;
... | ALGO | 0.999928 | 3.667986 |
1f66b39f-cb14-4108-bf27-f14c38f65d2d | AlexanderJamesBecoy/ETHZ-RobotX-rss-workspace | src/lib/ocs2/ocs2_core/src/automatic_differentation/FiniteDifferenceMethods.cpp | #include <algorithm>
#include <ocs2_core/automatic_differentiation/FiniteDifferenceMethods.h>
namespace ocs2 {
/******************************************************************************************************/
/****************************************************************************************************... | ALGO | 0.998987 | 7.422379 |
8e43f3e3-c372-4883-98b6-6b6982c612c5 | chunhonglee/shreve-binomial-model | src/binaryTree.cpp | #include "binaryTree.h"
std::shared_ptr<Node> BinaryTree::buildTree(int n){
std::shared_ptr<Node> current = std::make_shared<Node>();
if (n == 0){
return current;
}
std::shared_ptr<Node> left = buildTree(n-1);
current->setLeft(left);
std::shared_ptr<Node> right = buildTree(n-1);
c... | ALGO | 0.999028 | 5.428323 |
9a5be3d5-9d9a-496c-89fa-ee7176e864f6 | perpig/DS | 书本源代码/Chapter9/selection_sort/TestSimpleSelectionSort.cpp | #include "Assistance.h" //
#include "SimpleSelectionSort.h" // ѡ㷨
int main(void)
{
int a[] = {55, 63, 38, 21, 63, 92, 16, 46, 87, 72};
int n = 10;
cout << "ǰ:";
Display(a, n);
SimpleSelectionSort(a, n); // ѡ
cout << ":";
Display(a, n);
system("PAUSE");
return 0;
}
| ALGO | 0.990476 | 3.601149 |
d2f1d958-f0e6-4563-9730-1fe686c93d2d | GlaciEnora/Old-C-Code | 4--5-Prog2.cpp | #include <iostream>
using namespace std;
class Distance{
private:
int feet;
float inches;
public:
void get()
{
cout << "Enter the feet and inches: ";
cin >> feet >> inches;
}
void average(Distance c[])
{
int i, sumf=0;
double sumi=0.00;
for (i=0;i<10;i++)
{
sumf+=c[i].feet... | TOOL | 0.93961 | 4.008457 |
3015c0b6-93a5-4d09-abca-6007bc7d0c96 | rohitmathur-7/DSA-Topic-Wise-Questions-and-Solutions | Recursion/Challenges/smart_keypad_1.cpp | /*
You will be given a numeric string S. Print all the possible codes for S.
Following vector contains the codes corresponding to the digits mapped.
string table[] = { " ", ".+@$", "abc", "def", "ghi", "jkl" , "mno", "pqrs" , "tuv", "wxyz" };
For example, string corresponding to 0 is " " and 1 is ".+@$"
Input Forma... | ALGO | 0.999385 | 4.31579 |
fd2d6aee-d23f-4db5-b957-e60476b3ccc0 | xodbs97/Baekjoon | 프로그래머스/unrated/120912. 7의 개수/7의 개수.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> array) {
int answer = 0;
for(int i : array){
while(i){
if(i % 10 == 7){
answer++;
}
i /= 10;
}
}
return answer;
} | ALGO | 0.998056 | 4.894501 |
91b3c84f-0fe2-4af2-b920-e983a8a27108 | ljmf00/lldb-d | libc/src/stdlib/div.cpp | #include "src/stdlib/div.h"
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(div_t, div, (int x, int y)) {
div_t res;
integerRemQuo(x, y, res.quot, res.rem);
return res;
}
} // namespace __llvm_libc
| TOOL | 0.957338 | 6.592211 |
f8622474-3522-452b-9d97-9cc127f36d5b | PorametKeawubol/codef | Psek/ac.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
int main()
{
string s;
getline(cin, s);
stringstream ss(s);
vector<int> v;
string token;
// อ่านเป็น string แล้วตรวจสอบว่าเป็นตัวเลขหรือไม่
while (ss >> token)
{
try
{
int num = stoi(token);
v.push_back(num);
}
catch... | ALGO | 0.989637 | 4.323483 |
7bf1da3b-8164-49ce-b38b-b9dedece918a | skywoodsz/LVI-SAM-with-LegOdom | LVI_SAM_fixed/src/lidar_odometry/imuPreintegration.cpp | #include "utility.h"
#include <gtsam/geometry/Rot3.h>
#include <gtsam/geometry/Pose3.h>
#include <gtsam/slam/PriorFactor.h>
#include <gtsam/slam/BetweenFactor.h>
#include <gtsam/navigation/GPSFactor.h>
#include <gtsam/navigation/ImuFactor.h>
#include <gtsam/navigation/CombinedImuFactor.h>
#include <gtsam/nonlinear/Non... | ALGO | 0.928177 | 5.467428 |
f76c1d52-fdae-4f83-aa8e-4e3026f2cda7 | ishandutta2007/codeforces | noam527/normal/875/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,p,x;
bool a[300001]={};
scanf("%d",&n);
p=n;
printf("1 ");
while(n--){
scanf("%d",&x),a[x]=1,p++;
while(a[--p]);
printf("%d ",p-n+1);
}
} | ALGO | 0.999947 | 3.279787 |
afb3d4fc-43d5-4f31-b967-8e264d00f6b1 | sarwar1821201/cpp_problem | romanToInt.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
int romanToInt(string s) {
unordered_map<char, int> roman = {
{'I', 1}, {'V', 5}, {'X', 10},
{'L', 50}, {'C', 100},
{'D', 500}, {'M', 1000}
};
int total = 0;
int prev_value = 0;
for (int i = s.length() - 1; ... | ALGO | 0.993854 | 6.861939 |
26a8efe3-3b0b-41ac-abc0-51d6542effc6 | omer4d/OldCodeBackup | CODE/OLD_CRAP/particles/main.cpp | #include <stdio.h>
#include <conio.h>
#include <math.h>
#include <allegro.h>
#include <vector>
#include <string>
#include <map>
#include "Vec2f.hpp"
#include "DrawVec2f.hpp"
#include "Particle.hpp"
#include "SpringCon.hpp"
#include "StickCon.hpp"
#include "StaticStickCon.hpp"
#define PIXEL(bmp, x, y) ((long*)(bmp)... | ALGO | 0.97983 | 4.339997 |
3a928dfe-e430-4cbb-8fee-7decc57375de | codingdud/AlgoDocHub | DataStructure/StackQueues/cp-question/priTopost.cpp | #include<iostream>
#include<stack>
using namespace std;
string preTopost(string s){
stack<string> st;
for(int i=s.size()-1;i>=0;i--){
if(s[i]=='+'||s[i]=='-'||s[i]=='/'||s[i]=='*'){
string op1=st.top();st.pop();
string op2=st.top();st.pop();
st.push(op1+op2+s[i]);
... | ALGO | 0.999881 | 4.157836 |
ecf09d38-f41b-49ac-8ad4-63f556fff95a | cooler-SAI/wow-Revelion-v2 | src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp | #include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "nexus.h"
enum Spells
{
SPELL_SPARK = 47751,
H_SPELL_SPARK = 57062,
SPELL_RIFT_SHIELD = 47748,
SPELL_CHARGE_RIFT = 4774... | TOOL | 0.919994 | 5.044806 |
eb0e2e10-9977-4d7e-8798-1ce4e18f1ba1 | shleshitha/gfg_DSA | Difficulty: Easy/Unique rows in boolean matrix/unique-rows-in-boolean-matrix.cpp | class Trienode{
public:
Trienode* child[2];
bool isEnd;
Trienode(){
child[0]=child[1]=NULL;
isEnd=false;
}
};
// void traverse(Trienode *root, vector<vector<int>>&ans, int len,vector<int>temp){
// if(root==NULL) return;
// if(temp.size()==len){
// ans.push_back(temp);... | ALGO | 0.999913 | 5.624499 |
ca7dc5e9-3942-4cbc-9961-73edb93e5c4e | rusucosmin/courses | ubb/acm/nat2017/socks.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int inf = 0x3f3f3f3f;
int n, k, size[maxn];
string col[maxn];
bitset <maxn> used;
int main() {
ifstream fin("socks.in");
ofstream fout("socks.out");
fin >> n >> k;
for(int i = 1; i <= n; ++ i) {
fin >> col[i] >> size[i];
}
i... | ALGO | 0.999895 | 3.630134 |
a6ea5980-3a9c-4ff0-b2ad-82196557980d | radiantrise/CPP | beautiful_pair.cpp | #include <bits/stdc++.h>
using namespace std;
int first(int x)
{
if (x > 10)
{
while (x > 10)
{
x = x / 10;
}
}
else
{
return x;
}
return x;
}
int last(int y)
{
return y % 10;
}
int countBeautifulPairs(vector<int> &nums)
{
int n = nums.size... | ALGO | 0.999681 | 5.312479 |
2ec58df6-b4c9-4ba4-8a5e-8e42a26046c3 | Shubhamt45054/CrackYourInternship | String/Medium/08_Print Anagrams Together.cpp | class Solution{
public:
vector<vector<string> > Anagrams(vector<string>& str) {
vector<string> temp=str;
int n=str.size();
map<string,int> mp;
for(int i=0;i<n;i++){
sort(temp[i].begin(),temp[i].end());
mp[temp[i]]++;
}
int k=mp.size();
... | ALGO | 0.999949 | 5.845086 |
8334684b-e392-46e6-8e0d-1329e11186f6 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7470_14.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2333333;
long long a[N], b[N];
int n, L;
int main() {
scanf("%d%d", &n, &L);
for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1);
a[0] = b[0] = n;
fo... | ALGO | 0.999942 | 3.198549 |
ec607bce-7b78-4911-9dfe-28ffbcd76d5f | OBAViJEST/rain | src/rpcmining.cpp | #include "main.h"
#include "db.h"
#include "txdb.h"
#include "init.h"
#include "miner.h"
#include "bitcoinrpc.h"
using namespace json_spirit;
using namespace std;
Value getmininginfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getmininginfo\n"
... | WEB | 0.92524 | 4.149909 |
f0ae0b9e-964c-4145-9b44-cf892c5224c4 | Samruddhij555/HPC | 1.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <omp.h>
using namespace std;
// Graph class representing the adjacency list
class Graph {
int V; // Number of vertices
vector<vector<int>> adj; // Adjacency list
public:
Graph(int V) : V(V), adj(V) {}
// Add an edge to the graph
v... | ALGO | 0.999985 | 6.659646 |
05ddc1a0-30ee-433b-af13-aca0ef2a3bcf | developer-bin/algorithm | boj/boj_10824.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <vector>
#include <cmath>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <stack>
#include <list>
#define MIN_VALUE -200000000
#define MAX_VALUE 200000000
#... | ALGO | 0.998711 | 4.242975 |
5c8e3f85-b397-46cd-b1b9-251de9c59111 | sasz1995/help | puzzel1.cpp | #include <iostream>
using namespace std;
int find(char*,char,int);
void display(char*,char ,int);
int main()
{
int count=3,i,j;
char a[]=("word");
char b;
int y;
for(i=0;a[i]!='\0';i++)
{
for(j=0;j<count;j++)
{
cin>>b;
y=find(a,b,i);
if(y==1... | ALGO | 0.999199 | 3.061995 |
292e947c-5508-46b1-87f8-7e2dcbd86614 | ryaotuix/Baekjoon | Stack/224.cpp | #include <bits/stdc++.h>
using namespace std;
string evaluateOneParenthesis(stack<string> s)
{
int res = 0;
int opt = 1;
while (!s.empty())
{
string k = s.top();
s.pop();
// change operator
if (k == "+" || k == "-")
{
opt = (k == "+") ? 1 : -1;
... | ALGO | 0.999938 | 4.644165 |
71c6c742-dbcf-4d79-bf48-998a7f1e0e4f | vfolunin/archives-solutions | URI Online Judge/2395.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int a1, b1, c1, a2, b2, c2;
cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
cout << (a2 / a1)... | ALGO | 0.998775 | 3.858593 |
7213d24c-384d-4b19-a631-a2bc0dd09ab7 | coolyuyuyu/leetcode | algorithm_0000-0999/433-Minimum Genetic Mutation/main.cpp | class Solution {
public:
vector<char> choices = {'A', 'C', 'G', 'T'};
int minMutation(string startGene, string endGene, vector<string>& bank) {
unordered_set<string> candidates;
for (const string& gene : bank) {
candidates.insert(gene);
}
queue<string> q({startGene})... | ALGO | 0.99985 | 5.826653 |
da8a6e68-f97d-439f-86ab-57a405cbef62 | tizbac/mesa | src/glsl/lower_discard.cpp | /**
* \file lower_discard.cpp
*
* This pass moves discards out of if-statements.
*
* Case 1: The "then" branch contains a conditional discard:
* ---------------------------------------------------------
*
* if (cond1) {
* s1;
* discard cond2;
* s2;
* } else {
* s3;
* }
*
* becomes:
*
* ... | ALGO | 0.879447 | 7.662433 |
8a76e1f7-c5cd-419c-80d7-8efb68b60484 | CongJyu/Pitaya | HNU-CG/EX4-Q01/EX4-Q01/main.cpp | //
// main.cpp
// EX4-Q01 数小木块
//
// Created by cyrain on 2021/10/18.
//
#include <iostream>
int main() {
using namespace std;
// 1 3 6 10 15 21 27 34 ...
int n = 0;
cin >> n;
int sum = 0;
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= n; j++) {
i = i + j;
s... | ALGO | 0.999434 | 5.17802 |
186d9b6b-b5ee-4cff-8e5b-e6e72142c0be | jishu-yadav/CrackYourPlacement | Implementing Dijkstra Algorithm - GFG/implementing-dijkstra-algorithm.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find the shortest distance of all the vertices
//from the source vertex S.
vector <int> dijkstra(int n, vector<vector<int>> g[], int src)
{
// Code here
prior... | ALGO | 0.999975 | 4.771176 |
d4458417-0dc6-4e44-8884-6cc874b6d6d2 | Sowmik23/CompetitiveProgramming | Uva/Parentheses_Balance(Heavy_Tricks)Learn_alot.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
string str;
stack<char>stk;
bool bracket(char open,char close)
{
if(open=='(' and close==')') return true;
else if(open=='[' and close==']') return true;
else return false;
}
bool check(string str)
{
int l = str.size();
for(int i=0;i<l;i++)
{
if(str[i]=='(... | ALGO | 0.999414 | 4.973597 |
04655c02-7d84-47e6-b6d8-3af7c3772cbf | Pro-Haseeb/C-Plus-Plus | function/lab man ret 1.5.cpp | #include<iostream>
using namespace std;
int breaksum(int n);
int main()
{
int num,r1;
cout<<"ENTER NUMBER:";
cin>>num;
r1= breaksum(num);
cout<<"SUM OF NUMBER 1 AND NUMBER 2 = "<<r1;
}
int breaksum(int n)
{
int n1,n2,n3;
n1=n/100;
n2=(n/10)%10;
n3=n%10;
int sum=n1+n3;
return sum;
}
| ALGO | 0.993331 | 3.612857 |
0171b6aa-feaa-4484-8582-0ba6d07f89fb | vinicius-cardoso/beecrowd | estruturas-e-bibliotecs/2594.cpp | #include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main() {
int numero_de_textos;
string palavra;
cin >> numero_de_textos;
cin.ignore();
for (int i = 0; i < numero_de_textos; i++) {
string texto, palavra, aux;
int espacos = 0;
getline(cin, ... | ALGO | 0.998958 | 4.216197 |
57c99e5d-daf2-4f07-b7fa-afdc6003896a | flukekub/My-code-in-comprog-data_algo | algo/da66_f2_grid_loop.cpp | #include <iostream>
#include <vector>
int ans = 0;
int row, column;
bool isLoop(std::vector<std::vector<int>> &vec, std::vector<std::vector<bool>> &vis, int& startRow, int& startColumn)
{
// loop clockwise
//std::cout << "new loop\n";
//std::cout << "start " << startRow << " " << startColumn <<'\n';
std::strin... | ALGO | 0.999934 | 5.109941 |
d2273423-c24a-468d-bc58-4d8d193a2edd | mireskandari/Competitive-Programming | codeforces/934/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define long long long int
#define err(a...) fprintf(stderr, a)
int main() {
int k;
scanf("%d", &k);
if (k > 2 * 18) {
puts("-1");
exit(0);
}
while (k > 1) {
putchar('8');
k -= 2;
}
if (k != 0)
putchar('9');
return 0;
}
| ALGO | 0.999695 | 4.020832 |
1a06c643-7c68-4cbc-a0ef-970b69bb66dd | remcous/Programming-Principles-and-Practice | Ch19/vector.cpp | /*
vector.cpp
Revision History:
*/
#include <iostream>
using namespace std;
/****************************************
* CLASS DEFINITIONS
****************************************/
class vector{
int sz; // the size
double* elem; // pointer to the first element
// (of type dou... | TOOL | 0.966012 | 5.370409 |
bb69b40f-d1d3-46f3-bbaf-5a5167b903df | cbkpar/BOJ | boj_24783.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int iT;
cin >> iT;
while(iT--)
{
int iA, iB, iC;
cin >> iA >> iB >> iC;
if(iA<iB) swap(iA,iB);
bool bPossible = false;
i... | ALGO | 0.999454 | 4.428269 |
70035848-2d4e-4367-804b-76ad0ed83d07 | iMjayant17/PracticeLeet | 279-perfect-squares/perfect-squares.cpp | class Solution {
public:
int numSquares(int n) {
vector<int> dp(n+1,0);
dp[1] = 1;
for(int i = 2;i<=n;i++){
int val = INT_MAX;
for(int j = 1;j*j<=i;j++){
val = min(val,dp[i-(j*j)]);
}
dp[i] = val+1;
}
// for(auto... | ALGO | 0.999966 | 5.408776 |
e56ad54c-b23a-4a10-bec6-fbcdec689fd7 | KUIxd/frameworks_av | media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "ScalarArithmetic.h"
#include "VectorArithmetic.h"
#include "LVM_Macros.h"
void Mac3s_Sat_Float(const LVM_FLOAT* src, const ... | ALGO | 0.968149 | 4.706398 |
53a19e10-fe3d-4f15-8adf-aa3e2c0f6cdc | denis-gubar/Leetcode | Two Pointers/2046. Sort Linked List Already Sorted Using Absolute Values.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999998 | 5.700568 |
ebada9fc-3b49-41fb-af55-4e6b5a8785fe | hyakukyojin/link382010 | C++/GHEP_SO/GHEP_SO.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("GHEP_SO.inp","r",stdin);
freopen("GHEP_SO.out","w",stdout);
int a,b,c,ma;
cin>>a>>b>>c;
ma=max(a,max(b,c));
int mi;
mi=min(a,min(b,c));
cout<<ma*100+(a+b+c-ma-mi)*10+mi;
return 0;
}
| ALGO | 0.999423 | 3.824182 |
13e9de56-9087-4a86-8fac-b4045c40742c | ZongleiJiao/OntologyViewer | libcola/cc_clustercontainmentconstraints.cpp | #include "libcola/cola.h"
#include "libcola/compound_constraints.h"
#include "libcola/cc_clustercontainmentconstraints.h"
using vpsc::XDIM;
using vpsc::YDIM;
namespace cola {
class ClusterShapeOffsets : public SubConstraintInfo
{
public:
ClusterShapeOffsets(unsigned ind, vpsc::Dim dim, double offset,
... | ALGO | 0.917568 | 6.497835 |
ab8255c9-96d6-489d-82dc-9e4e85b6ec8e | ishandutta2007/codeforces | 1092515503/normal/1530/A.cpp | #include<bits/stdc++.h>
using namespace std;
int T,n,res;
int main(){
scanf("%d",&T);
while(T--){
scanf("%d",&n),res=0;
while(n)res=max(res,n%10),n/=10;
printf("%d\n",res);
}
return 0;
} | ALGO | 0.999448 | 4.612522 |
1fe62de6-ce01-4b5b-8be7-f72faa7e9868 | ssj-gz/Competitive-Programming | adventofcode/2023/day9/day9_part2_solution.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
int main()
{
string sequenceLine;
int64_t result = 0;
while (getline(cin, sequenceLine))
{
if (sequenceLine.empty())
continue;
std::cout << "sequenceLine: " << sequenceLine <<... | ALGO | 0.999686 | 4.295665 |
e1587c37-3f8e-4911-bc7e-8fbe8a3affd3 | ugozapad/xray-2212 | xrQSlim/src/object_sliding.cpp | #include "stdafx.h"
#pragma hdrstop
#include "object.h"
#include "object_sliding.h"
//BOOL g_bUseFastButBadOptimise = FALSE;
// Call this to reorder the tris in this trilist to get good vertex-cache coherency.
// *pwList is modified (but obviously not changed in size or memory location).
void OptimiseVertexCoherency... | ALGO | 0.974468 | 4.58292 |
551bfab2-d5b1-4ee1-bbf1-0a993c5a8227 | ishandutta2007/codeforces | 12tqian/normal/722/D.cpp |
#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
us... | ALGO | 0.999983 | 3.746423 |
76c61917-b5aa-406a-b031-03b3c3afb21b | jamesfowkes/asap-watercraft-user-board | util.cpp | /*
* util.cpp
*
* James Fowkes (<EMAIL>)
* for ASAP Watercrafts
*
* Created March 2017
*
*/
/*
* C standard library Includes
*/
#include <stdint.h>
/*
* Public Functions
*/
uint32_t subtract_not_below_zero(uint32_t a, uint32_t b)
{
if (a > b) { return a - b;}
else { return 0;}
}
uint16_t subtract_no... | TOOL | 0.980643 | 6.08918 |
9402c6e8-0949-460d-826f-83466b61b25b | D4rkSantana/CPP | cpp08/ex01/Span.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Span.cpp :+: :+: :+: */
... | TOOL | 0.902515 | 4.743217 |
d065ceb0-eba5-4347-928e-d8e7be3d7863 | LJNing2610/AcWing- | 820. 递归求斐波那契数列.cpp | #include<bits/stdc++.h>
using namespace std;
int sb(int a){
if(a==1||a==2)
return 1;
else
return sb(a-1)+sb(a-2);
}
int main() {
int n;
cin>>n;
cout<<sb(n);
return 0;
}
| ALGO | 0.99995 | 4.284532 |
45ad8186-47ab-446c-ae4e-026965b4e6d1 | beavct/fifth-semester-EPS | programming-challenges-mac0327/L5/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define oiee ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
const ll MOD = 1e9+7;
const ll MAX = 1e7+2;
ll fatorial[MAX];
void pre_calc_fatorial(){
fatorial[0] = 1;
for(ll i=1; i < MAX; i++){
fatorial[i] = (fatorial[i-1] * i)%MOD;
}
}
... | ALGO | 0.999632 | 5.03414 |
dcf0c454-bdea-4e5d-b99a-b8b38369a2da | DebasmitaBasu/custom-OpenMP-directives | clang/test/SemaCXX/constexpr-factorial.cpp | // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s
constexpr unsigned oddfac(unsigned n) {
return n == 1 ? 1 : n * oddfac(n-2);
}
constexpr unsigned k = oddfac(123);
using A = int[k % 256];
using A = int[43];
| ALGO | 0.994987 | 6.445701 |
d8f34db4-33cb-4ee7-b047-a9e077328864 | tachithanhdanh/Codelearn.io-Courses | Basic-Algorithms/Chapter06.Sequence/exercise-41.cpp | std::vector<int> alternatingSums(std::vector<int> a)
{
int sum1=0,sum2=0;
for (int i=0;i<a.size();++i) {
if (i&1) sum2+=a[i];
else sum1+=a[i];
}
vector<int> ans={sum1,sum2};
return ans;
}
| ALGO | 0.999381 | 4.787049 |
80558534-541e-4662-b0c5-093d903bfd62 | gfh16/StudyNotes | CPP/C++学习资料/C++入门经典/每章习题答案/2271 Solutions to Exercises/ch08/Ex8_05.cpp | // Exercise 8.5 The function smaller() is similar to the function larger() that we saw in the chapter. Once you have updated the smaller of val1 and val2, it then becomes the larger!
#include <iostream>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
long& smaller(long& m, long& n);
long& larger(l... | ALGO | 0.999966 | 5.689386 |
c49fd920-b06b-4f14-b7bb-aaae48a6a7fb | lwher/Algorithm-exercise | C++/HDU/hdu 1005.cpp | #include<iostream>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int f[10000],A,B,n;
int main(){
int i;
while(cin>>A>>B>>n && A && B && n){
f[1]=1;f[2]=1;
for(i=3;i<10000;i++){
f[i]=(A*f[i-1]+B*f[i-2])%7;
if(f[i]==1 && f[i-1]==... | ALGO | 0.999933 | 3.383893 |
72f5bca2-61de-424e-bd04-5cbbff8c9234 | TKG-master/KMGS | hh/ActionPathMove.cpp | #include "ActionPathMove.h"
#include "Enemy.h"
bool ActionPathMove::Execute(Enemy* enemy)
{
if (enemy->GetAstatus() != WALK)
{
enemy->SetAstatus(WALK);
}
// ڕWn_擾
DirectX::SimpleMath::Vector3 targetPos = enemy->Getpath()[enemy->GetPathIndex()];
DirectX::SimpleMath::Vector3 currentPosi... | ALGO | 0.951251 | 3.896993 |
4ae8e8f1-2765-4e50-9b28-132caab11209 | rcslab/hatcp | freebsd/contrib/llvm-project/llvm/lib/CodeGen/ReachingDefAnalysis.cpp | #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/ReachingDefAnalysis.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
using namespace llvm;
#define DEBUG_TYPE "r... | ALGO | 0.998173 | 7.726544 |
3f2c513f-a468-4916-a91a-739ecd21f1d4 | FPSG-UIUC/Pandora | simulator/src/systemc/tests/systemc/misc/v1.0/dash9/speed.cpp | /*****************************************************************************
speed.cpp -- Definition of the speedometer.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*************************************************************... | ALGO | 0.860258 | 5.898379 |
b5bf691b-c4e8-41b6-ae41-414a0ac81e4b | Riddhi12349/GFG_CODES | Medium/Cheapest Flights Within K Stops/cheapest-flights-within-k-stops.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int CheapestFLight(int n, vector<vector<int>>& flights, int src, int dst, int k) {
int n1 = flights.size();
vector<vector<int>> adj[n];
for(int i... | ALGO | 0.999627 | 5.618436 |
89604ab7-7d8d-4056-8838-d093b5375475 | ShinigameBR/cpp-complexity-algorithms-3-EDB1 | p1/p1.cpp | #include "headers/p1.h"
// Função auxiliar que verifica se os delimitadores são correspondentes
bool isEqual(char abertura, char fechamento)
{
return (abertura == '(' && fechamento == ')') ||
(abertura == '[' && fechamento == ']') ||
(abertura == '{' && fechamento == '}');
}
// Função para v... | ALGO | 0.990665 | 6.490103 |
c778316f-4578-45f7-a76b-30b4989c94dc | Matbar1/STRIVER-S-SDE-SHEET | Longest Palindromic Substring.cpp | class Solution {
public:
string longestPalindrome(std::string s) {
int n = s.length();
std::vector<std::vector<bool>> dp(n, std::vector<bool>(n, false));
int start = 0; // Starting index of the longest palindromic substring
int maxLength = 1; // Length of the longest palindromic substring
... | ALGO | 0.999973 | 6.724955 |
2556207e-4442-4967-aa5f-c99cf6ca0453 | AnshSingh0443/C- | Stacks/Assignment/Car_Fleet2.cpp | #include<iostream>
#include<vector>
#include<stack>
using namespace std;
vector<double> getCollisionTimes(vector<vector<int>>& cars) {
vector<double>answer(cars.size(),-1);
stack<int> st;
for(int i=cars.size()-1;i>=0;i--){
//check if car ahead if curr car is faster
while(... | ALGO | 0.999723 | 4.962844 |
44528e4e-a8ab-41a4-8ac1-e6a8a2b92686 | ncwong26/tower-climb | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.94874 | 6.933585 |
19746d91-aa29-4c00-8bed-6fbb788b544d | youngdexter/algorithm | cp363背包问题的方案总数-货币系统1.cpp | //cp363ķ-ϵͳ1
/*
ֵ:10
:3
ֵ a[1]:1
ֵ a[2]:2
ֵ a[3]:5
f[m]:10
*/
#include <iostream>
using namespace std;
int m; //ֵ 10
int n; //ֵ 3
int a[11]; //ֵ
long long f[101]; //f[j]ʾֵΪj
int i,j,k; //ѭ
int main(int argc, char **argv) {
cout << "ֵ:";
cin >> m;
cout << ":";
cin >> n;
for (i = 1; i <= n; i++) {
cout <<... | ALGO | 0.999683 | 3.641969 |
33d29b61-8b5e-41d7-bb5e-f4b2752b8b33 | tanishqbaweja2410/SdeSheetChallenge | KthPermutation.cpp | // TC : O(N) * O(N) = O(N^2) -> N for choosing N digits & N for erasing elements from the ds.
// SC : O(N) for storing N numbers in a ds
// Recursive Solution
class Solution {
private:
int fact(int n) {
if(n <= 1) return 1;
return n * fact(n - 1);
}
private:
void f(int n, int k, string &s, s... | ALGO | 0.999974 | 6.83968 |
fca3c6f5-2e4f-4ca8-8b03-ab9b8fdcc045 | maru-n/BoidsSimulator | boid.cpp | #include "boid.h"
#include <math.h>
static const double PI = 6*asin( 0.5 );
Boid::Boid(){
Vector3D p;
Vector3D v;
position = p;
velocity = v;
live = false;
}
Boid::Boid(Vector3D _p){
Vector3D v;
position = _p;
velocity = v;
live = false;
}
Boid::Boid(Vector3D _p, Vector3D _v){
position = _p;
velocity = _v... | ALGO | 0.995327 | 5.005172 |
517604aa-1221-4082-ae41-6138c6cdc586 | shreyansh2000rawat/Datastructure-and-Algorithm | array/Max difference_gfg/main.cpp | #include <bits/stdc++.h>
using namespace std;
/* For a given array arr[], returns the maximum j i such that
arr[j] > arr[i] */
int maxIndexDiff(int arr[], int n)
{
int maxDiff = -1;
int i, j;
for (i = 0; i < n; ++i) {
for (j = n - 1; j > i; --j) {
if (arr[j] > arr[i] && maxDiff < (j - i))
maxDiff = j - ... | ALGO | 0.999164 | 4.497875 |
1b005974-f493-444a-9a9b-494d6fd05e2f | ishandutta2007/codeforces | dorost/normal/63/E.cpp | /* * In the name of GOD */
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
const int N = 19;
int dp[(1 << N)];
int32_t main() {
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
vector <vector <int>> v = {
{0, 1, 2},
{3, 4, 5, ... | ALGO | 0.999719 | 3.541749 |
0d817cbe-5f6c-459a-ace7-4980ccae9de6 | aryan2279/codingskills | print1ton.cpp | #include <iostream>
using namespace std;
void printNumbers(int n) {
for (int i = 1; i <= n; i++)
cout << i << " ";
}
int main() {
printNumbers(10);
return 0;
}
| TOOL | 0.88406 | 4.1998 |
0c1bf417-7946-4936-8bc8-05934eeb260f | 001priyanshu/competitve-programming | A+B.cpp | #include "bits/stdc++.h"
using namespace std;
#define lli long long int
void solve(){
string s;
cin>>s;
int a=s[0]-'0';
int b=s[2]-'0';
cout<<a+b<<endl;
return;
}
int main(){
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
} | ALGO | 0.998436 | 4.303339 |
f1fdee50-1bfb-4161-a3f7-196a737964a9 | MasterToycode/HelloWorld | flower.cpp | #include <graphics.h>
#include <conio.h>
#include <math.h>
#include<Windows.h>
// ȫֱ
int rosesize = 500;
int h = -250;
// ṹ
struct DOT
{
double x;
double y;
double z;
double r; // ɫ
double g; // ɫעΪȷ
};
//
bool calc(double a, double b, double c, DOT& dot)
{
double j, n, o, w, z;
if (c > ... | ALGO | 0.926765 | 4.022773 |
fb6d4d55-4234-489d-b0d4-258c7ed08ec5 | GuacheSuede/MSSubmission1234567890 | submission/ema/boost_1_69_0/libs/graph/example/in_edges.cpp | #include <boost/graph/adjacency_list.hpp>
/*
Sample Output
0 <--
1 <-- 0
2 <-- 1
3 <-- 1
4 <-- 2 3
*/
int main(int , char* [])
{
using namespace boost;
using namespace std;
using namespace boost;
typedef adjacency_list<listS,vecS,bidirectionalS> Graph;
const int num_vertices = 5;
... | ALGO | 0.999847 | 5.161046 |
47207602-6083-4cde-9112-86477a401b59 | danieltrt/SBFL | benchmarks/python/CHECK_ARRAY_CONTAINS_CONTIGUOUS_INTEGERS_DUPLICATES_ALLOWED_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <fstream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#incl... | ALGO | 0.999247 | 5.839067 |
5bcc62ea-05f3-4d92-8f9f-19d391e33fae | RUSHDCAT/Contest-Solutions | Petrozavodsk Winter-2018. AtCoder Contest./code/f.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <queue>
using namespace std;
const int N = 1e5 + 7;
bool vis[N];
int a[N];
vector<int > p[N];
void gao(int x, multiset<int > &s){
vis[x] = true; s.insert(a[x]);
for (int v : p[x]) if (!vis[v]){
gao(v, s);
}
}
int m... | ALGO | 0.99989 | 3.603636 |
00003589-50bb-4784-bc7b-bb3acfa7ddfc | leverimmy/Codes | 比赛/学校/2019-9-13测试/source/PC21_wym/bomb.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,top,ptop;
inline int read()
{
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return... | ALGO | 0.999764 | 4.011797 |
1f807db9-5f32-438d-baf5-8367385bda7b | thecoldness/codeforces | gym/2024 Liaoning/E.cpp | #include <bits/stdc++.h>
const int Max_n = 1e6 + 5;
int T , n , k;
int a[Max_n] , st[Max_n] , tp , pre[Max_n] , lst[Max_n];
std::vector<int> v[Max_n];
using ll = long long;
int p[Max_n];
void solve()
{
std::cin >> n >> k;
for(int i = 1 ; i <= n ; ++ i)
std::cin >> a[i];
for(int i = 1 ; i <= n ; ++ i)
{
... | ALGO | 0.999933 | 3.8979 |
d9df7469-3d2c-4102-af87-4e4eca8abcbc | AniketR10/DSA | StacksMostImpQ.cpp/removeConsecutiveDuplicatesInStr.cpp | #include<iostream>
#include<stack>
#include<algorithm>
using namespace std;
string removeDup(string s){
stack<char>st;
st.push(s[0]);
for(int i=1; i<s.size();i++){
if(s[i]==s[i-1]) continue;
else{
st.push(s[i]);
}
}
s="";
while(st.size()>0){
s+=st.top();
... | ALGO | 0.999763 | 4.860166 |
6c3ac052-c55f-47fc-949c-793f8379d1ae | kunal2812/CP | codeforces/1675/D.cpp | #pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define yes cout << "YES" << endl; return
#define no cout << "NO" << e... | ALGO | 0.999496 | 4.151144 |
ba9bb2c3-136d-4eed-837d-f68f9d399473 | abdelwahebhafs/Windows_DG | eigen/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.991414 | 3.669638 |
daad64af-7aab-4485-9034-1069d1b387fc | SerdnaSoyoh/oop-final-project | OOP Final Project/Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.954129 | 6.933585 |
0430f25f-05e2-4302-992c-2273875a1d15 | alenthankz/Master_DSA | CODE/Number/noOfPairSumisDivsiblebyK.cpp | // Count pairs in array whose sum is divisible by K
#include<bits/stdc++.h>
using namespace std;
/*
if k was 4;
If both are divisible by 4.
If one of them is equal to 1 modulo 4 and other is 3 modulo 4. For instance, (1, 3), (5, 7), (5, 11).
If both of them is equal to 2 modulo 4 i.e., (2, 2), (2, 6), (6, 10)
*/
int c... | ALGO | 0.999922 | 4.830044 |
e0095ada-6095-497d-863c-03d877a506c6 | Chivas-Regal/ACM | Learnding/CoolQuestion/hdu_4576 Robot(概率dp)/main.cpp | /******************************************
概率DP
一个由n个位置的环,初始在1号位,共走m步,每步可能随机向左或向右
走w步,求w步后,在[l,r]位置内的概率
题解:对概率dp,对于当前在i位置,概率为
dp[id][i] = 0.5*dp[id-1][(i+w)%n]+0.5*dp[id-1][(i-w+n)%n];
设置两个数组,不断的暴力,滚动数组即可。
PS:这题时间卡的特别紧,多加一次取余操作都会超时。
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4576
**********************************... | ALGO | 0.999954 | 3.007025 |
d05fcad6-e9ac-4a13-911d-6cde8ed67b0f | SIDLAD/CC | c and cpp codes/practice folder/G_Library_of_Magic.cpp | #include <bits/stdc++.h>
const long double EPS = 1e-7;
const long long int M = (long long int) 1e9 + 7;//998'244'353;
using namespace std;
//insert policy here
//insert mintcode here
#if defined (ONLINE_JUDGE) || !__has_include (</home/sidlad/Desktop/Coding Folder/c and cpp codes/Debug.h>)
void _exe() {}
temp... | ALGO | 0.999826 | 3.799529 |
60b1e3e3-55f9-4748-a674-2bb9c3a238bf | Oepeling/ICPC-UB-ScrambledEggs-TRD | stress-tests/graph/MaximalCliques.cpp | #include "../utilities/template.h"
#include "../../content/graph/MaximalCliques.h"
template<class F>
void fastCliques(vector<B>& eds, F f) {
B R{}, P = ~B(), X{};
vi deg(sz(eds));
rep(i,0,sz(eds)) deg[i] = sz(eds[i]);
rep(j,0,sz(eds)) {
int i = (int)(min_element(all(deg)) - deg.begin());
R[i] = 1;
rec(eds, ... | ALGO | 0.995096 | 5.43602 |
9d46f0d9-e46f-497a-ad51-81f3a27dd99e | AdityaKarn/cp-cpp | LEARNING/graphTheory/HEsocialNetworkingGraph.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
vector<int> adj[1000001];
int vis[1000001];
int dis[1000001];
int level[1000001];
void bfs(int src){
queue<int> q; q.push(src);
vis[src]=1; dis[src]=0;
while(!q.empty()){
int curr = q.front();
q.pop();
for... | ALGO | 0.999945 | 4.585177 |
2247d331-69aa-4124-b6bd-bea9662ea20d | DucL0c/DSA_PTIT | src/DSA06018 bo sung phan tu.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
int dem=0;
for(int i=0;i<n-1;i++){
if(a[i]==a[i+1]) continue;... | ALGO | 0.999174 | 4.257551 |
674e51df-abd7-48ec-bbb2-fdf286112742 | DarkComLikeEating/Data-Structure-Learning | 06 数组和广义表/6.2稀疏矩阵的三元组表示.cpp | #include <iostream>
using namespace std;
const int M = 5; //rows of sparse matrix
const int N = 5; //cols of sparse matrix
const int Maxsize = 25; //max size of nonzero element in sparse matrix
typedef struct {
int r;
int c;
int d;
} TupNode;
typedef struct {
int rows;
int cols;
int nums;
... | ALGO | 0.999753 | 3.31985 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.