uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
21f79282-3d56-4986-9e46-ca77e37f565a | HiepF5/CTDLGT_PTIT | code/ck/1.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,k;
int a[20]={};
void xuat()
{
for(int i=1;i<=k;i++)cout<<a[i]<<" ";
cout<<endl;
}
void sinh(int i)
{
for(int j=n-k+i;j>=a[i-1]+1;j--)
{
a[i]=j;
if(i==k)xuat();
else sinh(i+1);
}
}
main()
{
int t;
... | ALGO | 0.999904 | 3.432295 |
9085dc90-e84a-42c6-b016-eea8f7ff8680 | NCommander/openbsd-src-with-branches | gnu/llvm/llvm/lib/CodeGen/MachineOutliner.cpp | #define DEBUG_TYPE "machine-outliner"
using namespace llvm;
using namespace ore;
using namespace outliner;
// Statistics for outlined functions.
STATISTIC(NumOutlined, "Number of candidates outlined");
STATISTIC(FunctionsCreated, "Number of functions created");
// Statistics for instruction mapping.
STATISTIC(NumLeg... | TOOL | 0.964524 | 7.460069 |
a8669557-4a32-4355-b270-0660552d8b80 | HarshaVardhan31012007/Leetcode-and-Gfg-Codes | 1437-minimum-insertion-steps-to-make-a-string-palindrome/1437-minimum-insertion-steps-to-make-a-string-palindrome.cpp | class Solution {
public:
// int solve(string &s,int i,int j,vector<vector<int>>&dp){
// if(i>=j) return 0;
// if(dp[i][j]!=-1) return dp[i][j];
// if(s[i]==s[j])
// return dp[i][j]=solve(s,i+1,j-1,dp);
// else
// return dp[i][j]=1+min(solve(s,i+1,j,dp),solve(s,i,j-1,d... | ALGO | 0.999987 | 6.001441 |
6835cfc7-03cf-42f3-9ea0-074b5c590e8c | colenator123-design/cpe | dream.cpp | #include<iostream>
#include<stack>
#include<string>
using namespace std;
int main()
{
int n;
cin>>n;
stack<string>dream;
for(int i=0;i<n;i++)
{
string query;
cin>>query;
if(query=="Sleep")
{
string person;
cin>>person;
dream.push(pe... | ALGO | 0.903948 | 3.867324 |
bff66890-af82-4bf0-a8d8-9d695cc45b98 | quangbach1709/Study_cpp_py | C++in_class/TH3/th3_b5_b.cpp | #include<iostream>
using namespace std;
//ham tinh giai thua so le
int giai_thua(int n)
{
if (n==1)
{
return 1;
}
else
{
return n*giai_thua(n-2);
}
}
int main()
{
int n;
//nhap n
cout<<"Nhap N = ";
cin>>n;
//in dap an
cout<<"Giai thua cua cac so le ... | ALGO | 0.999745 | 3.866966 |
862a3d67-b626-4d29-b69d-fe3ff572f929 | raj-singh-2018/trees | Perfect Binary Tree.cpp | #include <bits/stdc++.h>
using namespace std;
struct node{
int data;
node *left, *right;
};
node* add(int data){
node *newnode = new node;
newnode->data = data;
return newnode;
}
bool perfectBinary(node *root){
queue<node*> Q;
Q.push(root);
Q.push(NULL);
int cnt = 0, lvl = -1;
... | ALGO | 0.999927 | 4.877235 |
3c471ab5-87fb-4799-9df0-be6edd3f4dc9 | ishandutta2007/codeforces | zhouyuyang/normal/1053/E.cpp | #include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator
#define PB push_back
#define MK make_pair
#define LB lower_bound
#... | ALGO | 0.999993 | 3.187244 |
f72a9fca-3414-43a5-83c3-045fe02eab30 | s-m-arafat/online-judge-problems | codeforces/Educational round 142/B.cpp | //Auth:Shakil Mahmud Arafat -arft666, AUST, Dept. of EEE
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>vll;
typedef vector<int>vi;
typedef vector<vll>vvl;
typedef vector<vi>vvi;
// #define OJ
#define nl '\n'
#define get cin>>
#define imn INT_MIN
#define imx INT_MAX
//vectors
#de... | ALGO | 0.998586 | 4.906793 |
3782073a-26d7-4f28-b46d-4cd8ac9c470e | DE0CH/aclib2 | target_algorithms/sat/clasp-cssc14/clasp-source/libclasp/src/solver_strategies.cpp | namespace Clasp {
/////////////////////////////////////////////////////////////////////////////////////////
// SolverStrategies / SolverParams
/////////////////////////////////////////////////////////////////////////////////////////
SolverStrategies::SolverStrategies() {
struct X { uint32 z[2]; };
static_assert(sizeo... | ALGO | 0.998013 | 5.116559 |
e6256df9-5807-4fee-a02c-921031597dfe | wzx54321/AndroidLearnTips | java-leetcode/code/unique-binary-search-trees-ii.cpp | // Unique Binary Search Trees II
// 时间复杂度TODO,空间复杂度TODO
class Solution {
public:
vector<TreeNode *> generateTrees(int n) {
if (n == 0) return vector<TreeNode*>();
return generate(1, n);
}
private:
vector<TreeNode *> generate(int start, int end) {
vector<TreeNode*> subTree;
if... | ALGO | 0.999821 | 6.711555 |
27fb20bd-c36a-4272-99ab-2c2ba18f9768 | Manh1802/TranVanManh-chuonh7-MonC | bai1.cpp | #include <iostream>
int main() {
const int size = 10;
int numbers[size];
// Input values into the array
std::cout << "Enter 10 values:" << std::endl;
for (int i = 0; i < size; ++i) {
std::cout << "Enter value " << i + 1 << ": ";
std::cin >> numbers[i];
}
// Find the larges... | ALGO | 0.999877 | 5.894125 |
d9e711d4-1447-4f95-90c3-fa82484acc27 | JingxueLiao/Data_Structures_and_Algorithms | problems/palindrome_partitioning_II.cpp | // Given a string s, partition s such that every substring of the partition is a palindrome.
// Return the minimum cuts needed for a palindrome partitioning of s.
// For example, given s = "aab",
// Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut.
#include <string>
#include <vector... | ALGO | 0.999692 | 6.485724 |
9113df9a-0538-4926-aaa6-c9dbfb766bb0 | txgcwm/code_study | cplusplus/boost/boost_1_63_0/libs/compute/example/host_sort.cpp | #include <iostream>
#include <vector>
#include <boost/spirit/include/karma.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/sort.hpp>
namespace compute = boost::compute;
namespace karma = boost::spirit::karma;
int rand_int()
{
return rand() % 100;
}
// this example demonstrates how to... | ALGO | 0.99968 | 5.778533 |
a9013823-8794-4b8d-8f8f-a5667d489af3 | ice2age/Algorithm | leetcode/permutation sequence.cpp | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
int factorial(int n) {
int r = 1;
for (int i = 2; i <= n; ++i)
r *= i;
return r;
}
int getKth(int k, bool* visited) {
int i = 0, count = 0;
while (count < k) {
if (!visited[i++])
++count;
}
return i-1;
}
... | ALGO | 0.999984 | 5.096656 |
7afb3c99-8712-41da-97f4-e98806fedea7 | openbabel/openbabel | src/forcefields/forcefieldmmff94.cpp | /*
* Source code layout:
* - Functions to calculate the actual interactions
* - Parse parameter files
* - Setup Functions
* - Validation functions
* - Calculate bond type, angle type, stretch-bend type, torsion type
* - Various tables & misc. functions
*
*/
#include <openbabel/babelconfig.h>
#include <openbab... | ALGO | 0.982099 | 3.322992 |
541ab6cc-4396-4998-a2c9-905b4cf85ebd | amanraox/-DSA- | Difficulty: Medium/Count the number of possible triangles/count-the-number-of-possible-triangles.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to count the number of possible triangles.
int countTriangles(vector<int>& arr) {
int res = 0;
sort(arr.begin(), arr.end());
for(int i= 2; i < arr.s... | ALGO | 0.999748 | 6.458364 |
43597eb1-79ce-47f1-8833-5e8cf484cff0 | sajangrover/DataStructureAndAlgorithms | cses/6_NumberSpiral.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int test;
cin>>test;
while(test--){
long long x,y;
cin>>x>>y;
long long mx = max(x,y)-1;
unsigned long long int ans;
ans = (mx*mx);
ans = ans + max(x,y);
if(x!=y){
if(max(x,y)%2){
... | ALGO | 0.999853 | 4.649817 |
903230c6-749a-43b5-a34a-b3c9fc737049 | sakshamrathi21/Competitive_Programming | problems_solved/29c.cpp | /**
* Author: Saksham Rathi
* Created: Sun Aug 3 11:47:39 IST 2025
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
void dfs(map<int, bool> &vis, int curr, map<int, vector<int>> &adj) {
cout << curr << " ";
vis[curr] = true;
for (auto x: adj[curr]... | ALGO | 0.999913 | 4.916992 |
8e510f5b-3179-49e7-a264-dfd97b1e3746 | ruby-kim/Algorithm | [N현직자 특강] All-in-One 직무역량 「알고리즘 교육프로그램」/2주차(190411)/STL을 활용한 스택 구현.cpp | #include<iostream>
#include<stack>
using namespace std;
int main()
{
stack <int> s;
s.push(3);
s.push(2);
s.push(1);
cout << "size: " << s.size() << endl; // ȯ
cout << s.top() << endl; // ȯ
s.pop(); //
cout << s.top() << endl; // ȯ
s.pop(); //
cout << s.top() << endl; // ȯ
s.pop(); //
... | ALGO | 0.985646 | 3.748808 |
8174a95e-adb7-4315-a98b-73c0b2957707 | vedantpople4/CodeChef_Solutions | DIVIDING.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n, sum=0;
cin>>n;
int a[n];
for( int i=0; i<n; i++)
{
cin>>a[i];
sum+=a[i];
}
if(sum==n*(n+1)/2)
cout<<"YES";
else cout<<"NO";
return 0;
}
| ALGO | 0.99987 | 3.93839 |
a991e547-94a7-4ce9-9be6-2be808ea00a5 | Anandharsh275/dsapractice | buildingTeams.cpp | #include<bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vl vector<long>
#define vii vector<ii>
#define lli long long int
#define INF 1000000000
#define endl '\n'
const doub... | ALGO | 0.999983 | 4.556618 |
f4dfe424-36d5-49de-a946-f0300bd0a55c | Magicinmybones/Leetcode_Solution | 239-Sliding-Window-Maximum/Sliding_Window_Maximum.cpp | #include <iostream>
#include <vector>
#include <deque>
using namespace std;
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
int n = nums.size();
deque<int> dq; // Stores indices of elements in window
vector<int> res; // Stores max elements
for(int i = 0; i < n; i++) {
// Remove out-o... | ALGO | 0.99998 | 6.309039 |
627032e6-617c-4441-9cf9-9e8a9127b7d3 | AndyGar04/ProgramacionTUP | MisAlgoritmosDeOrdenacion/MetodosDeOrdenacion.cpp | #include <iostream>
using namespace std;
void MetodoSeleccionDirecta(int array[], int n);
void MetodoInsercion(int array[], int n);
void MetodoInsercionPorIntercambio(int array[], int n);
void MetodoBurbuja(int array[], int n);
void BusquedaBinaria(int array[], int n);
int main(){
int d=5;
int a[d]={5,8,2,9,1... | ALGO | 0.999533 | 4.163222 |
2d79a8e3-49f7-424b-b555-6a8abdbf3a97 | SiddharthJoy/Leetcode-Practice | 53-maximum-subarray/53-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum = 0,mx = -10002;
int n = nums.size();
for(int i = 0;i<n;i++){
mx = max(mx,nums[i]);
if(sum + nums[i] >= 0) sum += nums[i],mx = max(mx,sum);
else sum = 0;
}
retur... | ALGO | 0.999981 | 6.046099 |
58385668-2bc5-44ca-a74c-437006023e31 | thegamer1907/Code_Analysis | contest/1542588501.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll ans;
bool ok = 0;
char st[3],a[110][3];
int n;
int main() {
scanf("%s",st);
scanf("%d",&n);
for (int i=0; i<n; ++i) {
scanf("%s",a[i]);
if (a[i][0]==st[0]&&a[i][1]==st[1]||a[i][0]==st[1]&&a[i][1]==st[0]) {
... | ALGO | 0.99998 | 3.286906 |
3e0947c0-67ce-428d-b212-6618a117c479 | ianczyko/conway-bioweb | conway/src/conway.cpp | /**
* \file conway.cpp
* \brief the C++ file with conway library.
*/
#include "conway.hpp"
#include <thread>
// #include <boost/thread/thread.hpp>
bool check_node(const Grid & grid, const int & row, const int & col){
if(row < 0 || row >= static_cast<int>(grid.size())) return false;
if(col < 0 || col >= stat... | ALGO | 0.998018 | 5.13512 |
7605f79e-2929-4dc3-ab13-d704d8745879 | MkashifShahid/C-Full-Course- | 19.Do while loo[p C++ Program to print numbers from 1 to 5.cpp | // C++ Program to print numbers from 1 to 5
#include<iostream>
using namespace std;
int main(){
int n=1;
do{
cout<<n<<endl;
n++;
}
while(n<=5);
}
| TOOL | 0.97976 | 3.593192 |
1c42f572-98c3-4e9b-b389-47b9bde66e4c | lucashuati/maratona | URI/1212.cpp | #include <bits/stdc++.h>
using namespace std;
string s1, s2;
void completa(){
int aux;
if(s1.size() > s2.size()){
aux = s1.size() - s2.size();
for (size_t i = 0; i < aux; i++) {
s2 += '0';
}
}
else{
aux = s2.size() - s1.size();
for (size_t i = 0; i < ... | ALGO | 0.999878 | 4.224457 |
7afc79b8-2693-43c9-9267-8deb242ada47 | kaydenpham27/Competitive-Programming | Solutions/CSES/Graph_Algorithms/school_dance_tran.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int O = 5e3 + 5;
int n, m, k, a[O], b[O];
struct DinicWS{
const int inf = 1e18;
const int MAXN = 5e3 + 5;
struct edge {
int a, b, f, c, id;
};
int n, m, s, t, lim;
vector <edge> e;
vector <int> d, p... | ALGO | 0.999972 | 3.512561 |
7e4fba4e-8989-4c3a-941c-a7d76fbefa99 | RevengeOS-Devices/android_device_xiaomi_oxygen-common | gps/utils/LocHeap.cpp | #include <LocHeap.h>
class LocHeapNode {
friend class LocHeap;
// size of of the subtree, excluding self, 1 if no subtree
int mSize;
LocHeapNode* mLeft;
LocHeapNode* mRight;
LocRankable* mData;
public:
inline LocHeapNode(LocRankable& data) :
mSize(1), mLeft(NULL), mRight(NULL), mDa... | ALGO | 0.997679 | 6.439088 |
b54a2736-e5d7-4c74-92c9-61f0f69be9c9 | Ideas-Laboratory/Taurus | Taurus/src/Quad.cpp | #include "Quad.h"
void Quad::add(float x, float y, int idx) {
size++;
float tempx = mass[0], tempy = mass[1];
bool sameflag = false;
float mult1 = (float)(size - 1.0f) / size;
float mult2 = (float)1.0f / size;
mass[0] = mass[0] * mult1 + mult2 * x;
mass[1] = mass[1] * mult1 + mult2 * y;
... | ALGO | 0.999093 | 3.699735 |
a75513df-c9b1-4e3a-b38b-9e01c6a1c224 | soumanpaul/Daily-LeetCode | 261-graph-valid-tree/261-graph-valid-tree.cpp | class UnionFind{
private:
vector<int> root;
vector<int> rank;
int count;
public:
UnionFind(int sz): root(sz), rank(sz){
for(int i =0; i < sz; i++){
root[i] = i;
rank[i] = i;
}
count = sz;
}
void U... | ALGO | 0.999962 | 6.09229 |
9db7be89-7836-4a33-a8e0-45960bada4c3 | akcite/code | cpp/map.cpp | /////////////////////////////////////////////////////////////////////////////////////
// for colon (element_declaration)
for (const auto& kv : myMap) {
std::cout << kv.first << " has value " << kv.second << std::endl;
}
/////////////////////////////////////////////////////////////////////////////////////
// Itera... | TOOL | 0.860215 | 3.967288 |
8b8ef19a-497c-45fb-9819-06a6054c73dd | andrewmw94/llvm_clang_GSoC | utils/TableGen/DFAPacketizerEmitter.cpp | #define DEBUG_TYPE "dfa-emitter"
#include "CodeGenTarget.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include "llvm/Support/Debug.h"
#include <map>
#include <string>
#include <queue>
u... | TOOL | 0.94384 | 7.693259 |
aa291706-f0cc-4c3c-b347-db02f9b10550 | basedafdev/geometry-processing-cubicstylization | libigl/include/igl/triangulated_grid.cpp | template <
typename XType,
typename YType,
typename DerivedGV,
typename DerivedGF>
IGL_INLINE void igl::triangulated_grid(
const XType & nx,
const YType & ny,
Eigen::PlainObjectBase<DerivedGV> & GV,
Eigen::PlainObjectBase<DerivedGF> & GF)
{
using namespace Eigen;
Eigen::Matrix<XType,2,1> res(nx,ny);... | ALGO | 0.944502 | 7.591068 |
f52ec4c3-2c22-42f1-bd9a-d1ffc7fbf93d | jacknab/Peppapow | src/pow.cpp | #include "pow.h"
#include "chain.h"
#include "chainparams.h"
#include "main.h"
#include "primitives/block.h"
#include "uint256.h"
#include "util.h"
#include <math.h>
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader* pblock)
{
if (Params().IsRegTestNet())
return pindexLas... | ALGO | 0.999019 | 6.998939 |
a7dec9a7-5b7b-4973-a0b7-095b5328a5de | goutham-kommuri/DESIGN-AND-ANALYSIS-OF-ALGORITHMS | 23.BINOMIAL COEFFICIENCY.cpp | #include <stdio.h>
int binomialCoeff(int n, int k) {
int C[n + 1][k + 1];
int i,j;
for (i = 0; i <= n; i++) {
for (j = 0; j <= k && j <= i; j++) {
if (j == 0 || j == i)
C[i][j] = 1;
else
C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
}... | ALGO | 0.999885 | 6.077928 |
d5ec58a3-e7b9-407e-82c8-9bf4a42a9fba | p1yush/code | Leetcode/longest_consecutive_sequence.cpp | int longestConsecutive(vector<int>& nums) {
int count = 1;
int mx = 0;
set<int> st;
vector<int> ans;
if(nums.size() == 0)
return 0;
for(int i = 0; i < nums.size(); i++)
st.insert(nums[i]);
for(auto it: st)
ans.push_back(it);
if(ans.size() == 1 || ans.siz... | ALGO | 0.99995 | 5.23461 |
ead306eb-a7ce-4ca9-b009-3f2df6db9766 | sarvex/leetcode-mini-kanren | solution/1100-1199/1116.Print Zero Even Odd/Solution.cpp | class ZeroEvenOdd {
private:
int n;
int flag;
mutex m1, m2, m3;
public:
ZeroEvenOdd(int n) {
this->n = n;
flag = 1; //奇偶判断
m1.lock();
m2.lock();
m3.lock();
}
// printNumber(x) outputs "x", where x is an integer.
void zero(function<void(int)> printNum... | ALGO | 0.999851 | 5.35545 |
f07ff468-ce3d-4f34-9e5b-fcbf85b3c728 | prianna/sir-models | 3StrainCSS/ODESolver.cpp | #include "ODESolver.h"
#include "globals.h"
ODESolver::ODESolver(std::vector<int> init_types, double t_init, double t_final)
:t(t_init), t_final(t_final)
{
for (int i = 0; i < K; i++)
{
V.push_back(init_types[i]);
dPop[i]=0;
}
step=0.00001/((RATES[0]+RATES[1]+RATES[2])*mu);
}
std:... | ALGO | 0.999555 | 4.958892 |
99aa1d16-6286-4b53-a033-e68f038b44ee | khan1203/basic-data-structure | DS-Final-Exam/03_Count_me.cpp | // by Khan Muhammad Rifat (CSE, BUBT)
#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define PI 2 * acos(0.0)
using namespace std;
int main()
{
int tc;
cin >> tc;
while (tc--)
{
string sentence;
getline(cin, sentence);
stringstream ss(sentence);
map<stri... | ALGO | 0.999344 | 4.531857 |
321e4e04-352e-4f69-8416-f857d8254efc | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV2/DIV2-885/D.cpp | #include <bits/stdc++.h>
using namespace std;
long long F(long long st, long long move) {
if (move == 0) {
return 0;
}
if (st == 2) {
long long cycle = move / 4;
long long res = cycle * 20;
move %= 4;
while (move > 0) {
res += st;
st = (st + ... | ALGO | 0.999925 | 4.325437 |
58457c15-55a7-461e-b6eb-0968b38aec96 | ishandutta2007/codeforces | maximumshot/normal/1730/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
const int inf = 1e9;
const ll inf64 = 1e18;
struct output {
string res;
void print() {
... | ALGO | 0.999971 | 4.910793 |
d63ea1e9-cc24-4cdf-baff-aebc34205a34 | arittro26/AAD-Lab-Assignment | InsertionSort.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void insertionSort(int arr[], int size) {
for (int i = 1; i < size; i++) {
int key = arr[i];
int j = i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] ... | ALGO | 0.999705 | 5.4993 |
87664a67-1c55-41bb-8fad-1b1db8181edd | algoplutus1708/Competitive-Programming-Solutions | Codeforces/1438 - Round #682 (Div. 2)/A. Specific Tastes of Andre.cpp | /*** KNOWLEDGE IS POWER ***/
#include<bits/stdc++.h>
typedef long long ll ;
#define int ll
using namespace std ;
signed main( )
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int testcases = 1 ;
cin >> testcases ;
while( testcases -- )
{
int n ;
cin >> n ;
for(int i =... | ALGO | 0.998832 | 3.837742 |
6b93a246-03fd-4a1e-8b43-99a05db0bb2b | 113bommy/PathRepair | variable_trace/cpp/cpp_code/cpp_incorrect/cpp_incorrect_test_120_3.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> b(200003, vector<int>(20));
void calc() {
for (int i = 1; i < 200002; i++) {
int num = i;
int curr = 0;
while (num > 0) {
b[i][curr] = num % 2 + b[i - 1][curr];
num /= 2;
curr++;
}
}
}
int main() {
ios_base::sync_w... | ALGO | 0.999926 | 4.353248 |
4b8455f9-ff16-4720-8709-968232bfffba | RajThakur777/Leetcode-POTD | 3394-minimum-array-end/3394-minimum-array-end.cpp | // class Solution {
// public:
// long long minEnd(int n, int x) {
// long long res = x;
// while(--n){
// res = (res + 1) | x;
// }
// return res;
// }
// };
class Solution {
public:
long long minEnd(int n, int x) {
long long num = x;
for(int i... | ALGO | 0.999915 | 5.788178 |
512cf66a-4898-458d-83ca-fc2d30926591 | Alok-Khansali/Lets-LeetCode | Medium/Break_a_Palindrome.cpp | class Solution // Runtime: 0 ms, faster than 100.00% of C++ online submissions for Break a Palindrome.
// Memory Usage: 6.3 MB, less than 5.00% of C++ online submissions for Break a Palindrome.
{
public:
string breakPalindrome(string palindrome)
{
ios_base::sync_with_stdio(0);
int... | ALGO | 0.998381 | 4.623218 |
611a7022-216b-4c9f-8f86-72cdfb61d1f8 | 1exx/xray-1 | 3rd party/boost/libs/regex/src/cregex.cpp | /*
* LOCATION: see http://www.boost.org for most recent version.
* FILE: cregex.cpp
* VERSION: see <boost/version.hpp>
* DESCRIPTION: Implements high level class boost::RexEx
*/
#define BOOST_REGEX_SOURCE
#include <boost/cregex.hpp>
#include <boost/regex.hpp>
#if !defined(BOOST_NO_STD_... | TOOL | 0.881546 | 5.160774 |
23fb6ec4-5209-4e79-9aa7-52f000528012 | su-u/Class | 6s/viusal/課題1/課題4/t4.cpp | #define _CRT_SECURE_NO_WARNINGS //warningo͖
#include "sample.h"
//****************************************************************
// TvvOFfilter_gaussian.cpp
// KEVAtB^s
//
// s@F filter_sample.exe inputfilename outputfilename
// inputfilename: ͉摜t@C(rbg}bvj
// inputfilename: o͉摜t@C(rbg}bvj
//
//*******... | TOOL | 0.896612 | 4.07915 |
5b849c35-28c7-4fe7-9949-fb1c01b2e714 | yutingye/RTQL8 | src/lcpsolver/Lemke.cpp | #include "Lemke.h"
#include <iostream>
#include <cmath>
#include <math.h>
using namespace std;
#ifndef isnan
# define isnan(x) \
(sizeof (x) == sizeof (long double) ? isnan_ld (x) \
: sizeof (x) == sizeof (double) ? isnan_d (x) \
: isnan_f (x))
static inline int isnan_f (float x) { return x != x; }... | ALGO | 0.999983 | 4.397291 |
30db0e47-bf3f-46bc-a835-c0bb918c5c71 | ttkkggww/procon_prectice | 3章/ALDS1_2_C_sample.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
struct Card
{
char suit, value;
};
void bubble(struct Card A[], int N)
{
for (int i = 0; i < N; i++)
{
for (int j = N-1; j >= i+1; j--)
{
if (A[j].value < A[j-1].value)
{
Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t;
}
}
}
}
void sele... | ALGO | 0.999893 | 4.553298 |
c7d2b177-0968-4ebf-a69e-213aaa11a6d8 | rishabg30/Data-Structures-and-Algorithms | arrays_problems/4Sum.cpp | #include <bits/stdc++.h>
using namespace std;
void printArray_2D(vector<vector<int>> &arr)
{
for (auto it : arr)
{
for (auto it2 : it)
{
cout << it2 << " ";
}
cout << endl;
}
}
vector<vector<int>> fourSum(vector<int> &nums, int target)
{
int n = nums.size();
... | ALGO | 0.99993 | 5.551993 |
d18619aa-3d1e-4ada-83c9-a2a9a46f0a7e | DiegoDA04/CodeForces | B_CopyCopyCopyCopyCopy.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
set<int> s;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
s.insert(a[i]);
}
cout << s.size() << endl... | ALGO | 0.999441 | 4.401077 |
c83be931-d8cc-4302-b5b0-74de57758ac0 | Ashish-kumar7/code-solutions | interviewBit-solutions/Graphs/Convert Sorted List To Binary Search Tree.cpp | /*
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
A height balanced BST : a height-balanced binary tree is defined as a binary tree in which the depth of the
two subtrees of every node never differ by more than 1.
Example :
Given A : 1 -> 2 -> 3
A he... | ALGO | 0.999999 | 5.92781 |
5414527a-659a-4458-b2b3-0ff34f095cc6 | gautamgtm/Codechef | Easy/LUCKYSTR.cpp | //LUCKYSTR
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#include <climits>
#include <utility>
usin... | ALGO | 0.999298 | 4.013639 |
309975ca-3728-48a9-8848-769bb56b0bc3 | protarie125/BOJ_11054 | main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<ll>;
int n;
vi a;
vi incr;
vi decr;
int main() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cin >> n;
a = vi(n);
i... | ALGO | 0.999932 | 4.438747 |
87e98290-4965-444a-a57d-255c801638d9 | Masud-Abdullah/Phitron | Phitron/Semester2/Basic_Data_Structures/Module 18/2_Level_Order_Print.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
void level_Order(Node *root)
{
if (root == NULL)
{
cout << "Tree Nai\n";
... | ALGO | 0.999952 | 4.621157 |
78dac06f-0152-40cf-b567-8d1ed36ea296 | asdf77616385/ceph-12.2.1 | src/boost/tools/quickbook/src/files.cpp | #include "files.hpp"
#include <boost/filesystem/fstream.hpp>
#include <boost/unordered_map.hpp>
#include <boost/range/algorithm/upper_bound.hpp>
#include <boost/range/algorithm/transform.hpp>
#include <boost/foreach.hpp>
#include <fstream>
#include <iterator>
#include <vector>
namespace quickbook
{
namespace
{... | TOOL | 0.858845 | 7.133454 |
41d390bb-353d-4e1c-880a-e162c615d76c | Nanshi29/leetcode | 0048-rotate-image/0048-rotate-image.cpp | class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
for(int i=0;i<matrix.size();i++)
for(int j = 0 ;j<i ; j++)
swap(matrix[i][j] , matrix[j][i]);
for(int i=0 ; i<matrix.size();i++)
reverse(matrix[i].begin(), matrix[i].end());
... | ALGO | 0.999982 | 6.241483 |
14211819-6ad2-4e77-8de8-fa14382712e4 | bread-board-coding/Hacktober-Fest-2022 | C++/FindNodeinBinaryTree.cpp | #include <iostream>
#include <queue>
using namespace std;
template <typename T>
class BinaryTreeNode {
public:
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data) {
this->data = data;
left = NULL;
right = NULL;
}
};
BinaryTreeNode<int> *tak... | ALGO | 0.999966 | 5.439269 |
ab1513c3-e389-4b78-94ec-506ae864aec5 | ishandutta2007/codeforces | compute/normal/1375/C.cpp | /* Aa^~ kokoro ga pyonpyon suru n jaa^~
// ZZZXXkXkkkZ!``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ```?Wfpppbpbbpbbpbbbkbkk
// ppbbbpbbpVr`` `` ` ` ` ` ```` `` ` ` `` ` ` ` ` ` ` ` ` ` dppbbkkkkkkkkkkqkqkk
// HkqqqqqkkWr`` ` ` ``` ``` `?G, ` ` ``.JC!```` ` ` `` `` ````(Wpbkkkkkkkkqkkkkkqk
// mmmmmqqqqpr` `` `` ``````... | ALGO | 0.99987 | 4.449062 |
630ee8fc-205a-4ece-8475-510fcae50055 | biancama/hackerRank_CPlus_practice | 007_variable_size_array.cpp | //
// Created by Massimo Biancalani on 2019-04-03.
//
#include <vector>
#include <iostream>
using namespace std;
void print_query() {
int n, q;
vector<vector<int> > m;
cin >> n;
cin >> q;
for (int i = 0; i < n; ++i) {
int l;
cin >> l;
vector<int> app(l);
for (int ... | ALGO | 0.999891 | 4.248723 |
f9f23507-4fc2-492f-83e5-52270e351a27 | goodchong/abacus_cusolvermp | source/module_base/math_bspline.cpp | #include "math_bspline.h"
#include <assert.h>
#include <cstdlib>
namespace ModuleBase
{
Bspline::Bspline()
{
bezier = nullptr;
norder = 0;
xi = 0;
Dx = 1.0;
}
Bspline::~Bspline()
{
delete[] bezier;
}
void Bspline::init(int norderin, double Dxin, d... | ALGO | 0.974757 | 5.701283 |
12b3f3ad-a925-4a6d-a84a-84246e24f0b4 | lumigraph/MotionOrbits | mathclass/quater.cpp | #include <iostream>
#include <cmath>
#include "quater.h"
#include "matrix.h"
#include "vector.h"
#include "position.h"
#include "unit_vector.h"
using std::istream;
using std::ostream;
using math::quater;
using math::matrix;
using math::vector;
using math::position;
using math::unit_vector;
static double eps = 0.000... | ALGO | 0.997942 | 5.927971 |
de526b52-0cfd-4933-91d4-b74a5a076ab2 | fibonacci998/Java-netbeans-project | Democ++/string2d.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
//remove redundant spaces in a string s
void removeRedSpaces(char s[])
{int n,low, up, i, j; char x[100];
n = strlen(s);
i=0; j=n-1;
while(i<n && s[i]==' ') i++;
low = i;
while(j>0 && s[j]==' ') j--;
up = j;
if(low>up) {strcpy... | ALGO | 0.999834 | 3.854426 |
8f978f79-53ee-4d7e-8cf6-841f2df61c06 | uthantvicentin/Competitive-Programming | CODEFORCES/Avulso/Implementacao/935A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int cont = 0;
for(int i = 1 ; i < n ;++i){
if((n-i) % i == 0)
cont++;
}
cout << cont << endl;
return 0;
}
| ALGO | 0.99972 | 4.936923 |
57dbb085-3e20-4a43-bbdc-dc0d4325d5bd | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc018/B/1453731.cpp | #include <iostream>
#include <set>
#include <cassert>
using namespace std;
const int MAXN=310;
struct Node {
Node *before=NULL,*next=NULL;
int key;
Node(int v) {
key = v;
}
}*tail[MAXN];
set<Node*> position[MAXN];
void removeNode(Node *p) {
if (p->before)
p->before->next = p->next;
if (p->next)
p->next->b... | ALGO | 0.99998 | 3.624702 |
ecd3d7ca-5fc5-408f-a11f-d6f2a8d4abd6 | BeyondSword/JPAT | Src/1032.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
const int MAXN=100001;
int H1, H2, N;
struct Node{
char Ch;
int next;
}node[MAXN];
int main(){
//cin >> H1 >> H2 >> N;
scanf("%d %d %d", &H1, &H2, &N);
for(int i=0; i<N; i++){
int addr,next;
char Ch;
scanf("%d %c %... | ALGO | 0.999912 | 3.317792 |
47f3d181-f03d-44c7-80a1-cf2e9e444489 | latentlyso/simmer | src/app/src/main.cpp |
#include "cxxopts/cxxopts.hpp"
#include "partition.hpp"
#include "parser.hpp"
#include "mesher.hpp"
#include "finder.hpp"
#include "simmer.hpp"
#include "writer.hpp"
#include "plotter.hpp"
std::vector<std::filesystem::path>
argParser(int argc, char ** argv);
/** measures durations in seconds of type double */
class... | TOOL | 0.897265 | 7.148618 |
52b586df-6d85-4f87-862b-cd42e7c4d40f | QM117/leetcode | 109. Convert Sorted List to Binary Search Tree/109. Convert Sorted List to Binary Search Tree.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), le... | ALGO | 1 | 5.761367 |
0a2ff5f1-ad14-443b-b015-39f04ca3062b | devs1979/Techno-Management-System | technoesis_central_system.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
class TechneosisMember {
private:
std::string organiser_name;
std::string director_name;
std::string general_secretary_name;
std::vector<std::string> sponsors_names;
int total_fund_alloted;
public:
// Constructor
... | TOOL | 0.865974 | 7.239014 |
8fd48359-0822-413b-910a-a0e8f6ea5a5d | andreeetmt/EXERCICIO-CPE | LISTA 5 RESPOSTAS/questao 2c lista 5.cpp | #include <iostream>
#include <cmath>
using namespace std;
bool primo(int n1) {
if (n1 <= 1)
return false;
for (int i = 2; i <= sqrt(n1); i++) {
if (n1 % i == 0)
return false;
}
return true;
}
int main() {
cout << "Nmeros primos entre 2 e 1000:" << endl;
for... | ALGO | 0.99933 | 4.404419 |
6f00f860-e78c-433e-ad72-1fe0ca80c0bf | outman119/leetcode | permutations.cpp | class Solution {
public:
vector<vector<int> > permute(vector<int> &num) {
vector<vector<int>> ret;
ret.push_back(num);
if (num.size() == 1 || num.size() == 0)
{
return ret;
}
auto tmp(num);
while (nextPermutation(num) == true && tmp!=num)
{
... | ALGO | 0.999992 | 5.541548 |
03b7152a-4937-49a7-8895-022377a46b15 | kmjp/procon | codeforce/cgr001-040/012/e.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999869 | 3.456727 |
993e6b92-b5f7-47f6-8949-cb52925fad1f | mohdazaan18/Classes | Polynomial Class/main.cpp |
#include <iostream>
using namespace std;
#include"inc.cpp"
int main()
{
Polynomial p1;
p1.setCoefficient(2,2);
p1.setCoefficient(1,3);
p1.setCoefficient(3,3);
p1.setCoefficient(0,7);
Polynomial p2;
p2.setCoefficient(2,12);
p2.setCoefficient(1,2);
p2.setCoefficient(3,2);
p2.se... | ALGO | 0.955901 | 3.658195 |
1f318850-358b-4655-93db-1872fd8ebdc9 | anmoanmo/acm_exercises | acm/代码源/01/1/p1177.cpp | //
// Created by ᕕ(◠ڼ◠)ᕗ on 24-6-22.
//
#include<bits/stdc++.h>
#define ll long long
std::vector<int> a; // 全局向量
using namespace std;
void quicksort(int l, int r) {
if (l >= r) {
return;
}
// 随机性,避免复杂度在最坏情况降低至n^2
std::swap(a[l], a[l + rand() % (r - l + 1)]);
int x = a[l];
int i = l, j... | ALGO | 0.999842 | 4.897848 |
14f6efc3-8837-404a-b1ae-3b4fa40a7b42 | kobeyuan/PointCloudMotion | eigen-3-1-4/bench/benchCholesky.cpp |
// g++ -DNDEBUG -O3 -I.. benchLLT.cpp -o benchLLT && ./benchLLT
// options:
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Cholesky>
#include <bench/BenchUtil.h>
using na... | TEST | 0.978803 | 5.812324 |
6280f200-0aaa-4685-a513-885588896ae3 | MariaYorsh/1-course-homework | 1 semester/12.12.17/12task.cpp | #include <iostream>
#include "matrix.h"
using namespace std;
void ShiftMatrix(int matrix[][N], int n);
void ReplaceMatrix(int matrix[][N], int n);
void DisplayMatrix(int matrix[][N], int n);
void GenerateMatrixFour(int matrix[][N], int n);
int main()
{
int matrix[N][N] = { 0 };
int n = 10;
GenerateMatrixFour(mat... | ALGO | 0.996656 | 3.911796 |
e2ea74e4-5db9-4208-9b4f-5a82667821a4 | saga-gis/saga-gis | saga-gis/src/tools/simulation/sim_fire_spreading/Simulate.cpp | /**********************************************************
* Version $Id: Simulate.cpp 911 2011-02-14 16:38:15Z reklov_w $
*********************************************************/
#include "Simulate.h"
#define MS2FTMIN (60.0 / 0.3048)
#define FTMIN2MMIN 0.3048
#define BTU2KCAL 0.252164401
#define FT2M 0.3048
#de... | ALGO | 0.975527 | 5.930015 |
6800eb2c-d515-47bd-a655-eb3b3a27804f | Bhawna751/LeetCode-Solutions | 0075-sort-colors/0075-sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int cnt0 = 0, cnt1 = 0, cnt2 = 0;
for(int i=0;i<nums.size();i++){
if(nums[i] == 0)cnt0++;
else if(nums[i] == 1)cnt1++;
else cnt2++;
}
for(int i=0;i<cnt0;i++){
nums[i] = 0;
... | ALGO | 0.999785 | 5.80048 |
c653e51d-c358-45f8-9fb3-e00974aabb0c | alexandraback/datacollection | solutions_2749486_0/C++/Hamzawy/b.cpp | /*
* b.cpp
*
* Created on: May 12, 2013
* Author: AhmedSamir
*/
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <cstring>
#include ... | ALGO | 0.999935 | 3.794385 |
ce9490c9-4d21-4c44-bfa4-5ec266a218d4 | yadsasusi/LeetCode-Sol | solutions/0153. Find Minimum in Rotated Sorted Array/0153.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int l = 0;
int r = nums.size() - 1;
while (l < r) {
const int m = l + (r - l) / 2;
if (nums[m] < nums[r])
r = m;
else
l = m + 1;
}
return nums[l];
}
};
| ALGO | 0.999985 | 6.474712 |
7a7fbf11-a117-48c3-a594-0943c470b058 | ishandutta2007/codeforces | fruwajacybyk/normal/696/B.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()
#define PII pair<int,int>
#define mp make_pair
#define st... | ALGO | 0.999689 | 3.273263 |
4efdf02b-cb0d-4e15-abc4-15afa029b783 | zyeternity/MyStudyCode | csp-jDay3/T267829.cpp | #include <bits/stdc++.h>
using namespace std;
struct ios_in {
template <typename _Tp> inline ios_in &operator>>(_Tp &x) {
char ch = getchar(), sgn = 0;
x = 0;
while (ch ^ '-' && !isdigit(ch))
ch = getchar();
if (ch == '-')
ch = getchar(), sgn = 1;
whil... | ALGO | 0.999722 | 3.156538 |
b37c4cb4-66e1-4935-9c90-c0452a46a3b6 | lxiao217/study428 | 深度学习/源码/OpenCV/opencv_contrib/modules/aruco/src/aruco.cpp | #include "precomp.hpp"
#include "opencv2/aruco.hpp"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include "apriltag_quad_thresh.hpp"
#include "zarray.hpp"
//#define APRIL_DEBUG
#ifdef APRIL_DEBUG
#include "opencv2/imgcodecs.hpp"
#endif
namespace cv {
namespace aruco {
using namespace std;
/**
*
*... | ALGO | 0.999324 | 3.415323 |
259511cd-084e-4b29-a9a6-6ca0020c2b2a | krivewuyuhao/note | 《C++》/大一下C++/20.cpp | #include <iostream>
using namespace std;
class Array {
private:
int a[4][4]; // 私有数据成员,用于存放4x4方阵
public:
Array(int a1[][4]);
void xuanzhuan();
void show();
~Array(){}
};
// 构造函数,接受一个4x4的整数数组作为参数,并用它初始化方阵a
Array::Array(int a1[][4]) {
for (int i = 0; i < 4; ++i) {
for (int... | ALGO | 0.999551 | 5.589577 |
59ceb31d-b786-4927-8ffd-e2a147242cf7 | UifeleanAuroraSofia/Object-Oriented_Programming | UifeleanAurora_lab9/UifeleanAurora_lab9_pr07.cpp | /* UifeleanAuroraSofia, ETTI, Seria A, grupa 4
Să se scrie programul care considera o clasa MyClass cu trei atribute de tip int. Clasa considera pe baza
mecanismului de supraincarcare metode publice int myFunction(…), care în funcţie de numărul de parametri
primiţi, returnează fie valoarea primită (1 parametru), fie pr... | ALGO | 0.986059 | 4.69827 |
fb6fe355-495f-4e6e-b197-740e7967770a | singh3000/Striver-sheet | DSA Crack Sheet/solutions/Find the Duplicate Number.cpp | /*
Find the Duplicate Number
=========================
Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
There is only one repeated number in nums, return this repeated number.
Example 1:
Input: nums = [1,3,4,2,2]
Output: 2
Example 2:
Input: nums = [3,1,3... | ALGO | 0.999911 | 6.54628 |
55f66a49-d0f1-4916-a569-584eda246e87 | Alex-Beng/ojs | FuckAlgorithmAnalysis/noj/1539_6皇后问题.cpp | #include <iostream>
using namespace std;
#define QUEEN 1
#define SPACE 0
int n = 6;
int board[23][33]; // 0 for space, 1 for queen
int ans;
void show(int ans) {
cout<<"No "<<ans<<':'<<endl;
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (board[i][j] == QUEEN) {
cou... | ALGO | 0.999499 | 5.020184 |
237f78b9-b9e6-4edc-b39d-178282afdfba | babiiigirl/DSA | DSA06017 - Tron hai day.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t; cin >> t;
while (t--)
{
int n, m; cin >> n >> m;
int a[n], b[m];
vector<int> v;
for (int &x : a)
{
cin >> x;
v.push_back(x);
}
for (int &x : b)
{
cin >> x;
v.push_back(x);
}
sort(v.begin(), v.end());
for (auto x : v... | ALGO | 0.999889 | 3.427461 |
4354c70f-28d5-42c4-bec0-e30b80cccf61 | mini-soda-uwisc/competition-code | CF/gym/gcpc2024/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
const ld pi = 3.14159265358979323846;
const int mod = 998244353;
const ll INF = 1e18;
template<typename T>
T chmax(T a, T b) {
return a > b ? a : b;
}
template<typename T>
T chmin(T a, T b) {
ret... | ALGO | 0.999985 | 5.318901 |
b7229219-17f1-48f6-b472-90efe7b790a2 | nnnagle/climate-bayes | R/thompson_forward.cpp | /* Estimate the forward part of the Thompson Recursion
* as outlined in McCausland et al.
* Given List Omega_{tt},
* List c_{t}
* Matrix Omega_{t,t-1}
* Return List L = Cholesky(Sigma_{tt})
* List LO = L\Omega_{t,t-1}
* vector m = Sigma_{tt} \ (c_t - Omega_{t,t-1} m_{t-1});
*/
// [... | ALGO | 0.999992 | 5.97602 |
36449064-5d2f-4fd4-97ff-7e45c3ace1e5 | smrutichan/DSA_LAB | hash_chaining (1).cpp | #include <iostream>
#include <list>
using namespace std;
const int TABLE_SIZE = 10;
class HashTable {
private:
list<int> table[TABLE_SIZE];
int hash(int key) {
return key % TABLE_SIZE;
}
public:
void insert(int key) {
int index = hash(key);
// Check if key already exists
... | ALGO | 0.999018 | 6.010177 |
a65d1312-2179-4519-b3ad-273f549438a6 | ljmf00/lldb-d | libc/src/math/aarch64/sqrt.cpp | #include "src/math/sqrt.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, sqrt, (double x)) {
double y;
__asm__ __volatile__("fsqrt %d0, %d1\n\t" : "=w"(y) : "w"(x));
return y;
}
} // namespace __llvm_libc
| TOOL | 0.987274 | 5.576637 |
153f6919-3824-4ba8-9e39-145c89448cc2 | charguer/optitrust | tests/omp/target_update2_exp.cpp | void init(float*, float*, int);
int maybe_init_again(float*, int);
void output(float*, int);
void vec_mult(float* p, float* v1, float* v2, int N) {
int i;
init(v1, v2, N);
#pragma omp target data map(to : v1[:N], v2[:N]) map(from : p0 [0:N])
{
int changed;
#pragma omp target
#pragma omp parallel for
fo... | ALGO | 0.99847 | 4.339231 |
0d954ec1-c3e7-4b16-8334-4adf3abb5fb1 | Orion-wyc/algorithms | leetcode_solutions/2-add_two_num.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* addTwoNumbers(ListNode* l1, ListNode* ... | ALGO | 0.999752 | 6.035273 |
806b4bef-c828-425a-af6e-8e25126a99b6 | sangcheol12/boj_solve | GraphSearch/boj2667.cpp | #include <iostream>
#include <algorithm>
using namespace std;
char cmap[26][26];
int imap[26][26];
bool visited[26][26];
int n,headcount[350],t;
int di[] = {0,0,1,-1};
int dj[] = {1,-1,0,0};
void dfs(int ci, int cj) {
visited[ci][cj] = true;
headcount[t]++;
for(int i=0; i<4; i++) {
int ni = ci + di[i];
int nj... | ALGO | 0.999951 | 3.344542 |
84c14fc0-3005-4250-a1e3-583bd80c09e4 | AbdelrahmanHamdyy/Problem-Solving | CodeForces/Old Contests Problems/Love A.cpp | #include <bits/stdc++.h>
#define init ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
using namespace std;
int main() {
init;
// Code
string s; cin >> s;
int a = 0;
int size = s.size();
for (auto i : s) {
if (i == 'a')
a++;
}
if (a > (s.size() + 1) / 2)
cout << s.size();
el... | ALGO | 0.999754 | 3.367033 |
6b926c48-9c85-4cc9-8009-f8806fb1dd8c | Huiyicc/armadillo-code | tests2/mat_minus.cpp | #include <armadillo>
#include "catch.hpp"
using namespace arma;
TEST_CASE("mat_minus_1")
{
mat A =
"\
0.061198 0.201990 0.019678 -0.493936 -0.126745 0.051408;\
0.437242 0.058956 -0.149362 -0.045465 0.296153 0.035437;\
-0.492474 -0.031309 0.314156 0.419733 0.068317 -0.454... | TEST | 0.859619 | 6.124365 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.