uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
39adc768-d7ee-4306-8b13-401177ed29a1 | AlSaimun/CSES-Problem-Set | cpp/Missing Number.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n, a; cin >> n;
ll sum = 0;
for (int i = 0; i < n - 1; i ++){
cin >> a;
sum += (ll) a;
}
ll total_sum = ((ll)n * ( n + 1)) / 2;
cout << total_sum - sum << '\n';
} | ALGO | 0.999569 | 3.441147 |
61f36a68-bcc9-4c9d-95be-5f635fbcf4a2 | satyamtiwari736182/CP | pepcoding/Level 1/11_Binary_Tree/sample.cpp | // 1. You are given a partially written BinaryTree class.
// 2. You are required to complete the body of diameter1 function. The function is expected to return the number of edges between two nodes which are farthest from each other in terms of edges.
// 3. Input and Output is managed for you.
#include "../header.h"
... | ALGO | 0.999567 | 4.191998 |
a171b183-97fb-4efb-9968-1c89ec1faa28 | miyatis/atcoder | abc333/d.cpp | //#include <bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <cmath>
#include "atcoder/all"
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <cstdlib>
using namespace std;
using namespace atcoder;
using min... | ALGO | 0.998552 | 4.664736 |
1fa47987-77ad-45b1-9fab-9dbe88f52f2b | ishandutta2007/codeforces | doped.silicon/normal/1221/G.cpp | // clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifndef ONLINE_JUDGE
#define bhartiya
#endif
#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// #pragma GCC ta... | ALGO | 0.999911 | 4.378469 |
80681eb7-a59c-46fe-8ea0-f4bfee430b30 | agamez2017/CSCE221 | Assignment2/221-A2-code/insertion-sort.cpp | //============================================================================
// Name : insertion-sort.cpp
// Author : Jessica Lefkowitz
// Date : 2/16/2019
// Description : Implementation of insertion sort in C++
//============================================================================
#inclu... | ALGO | 0.999947 | 5.452394 |
b6717550-1b74-4244-85bf-ada8e23525dd | Eriarer/ISC_3_C | C++/Estructura de Datos/Tareas/U1/007 PILAS y COLAS/COLAS.cpp | #include<iostream>
#include<string.h>
#include<string>
#include<queue>
#include<windows.h>
#include<time.h>
using namespace std;
int main(){
srand(time(NULL));
cout << endl << "\tABRAHAM MELGOZA DE LA TORRE" << endl;
cout<<"EJEMPLO insertar y eliminar letras de abecedario en una cola" << endl;
queue<ch... | TOOL | 0.929475 | 3.807201 |
e70006e2-7ee3-43db-bed1-7910c793a98a | dstackh/ClemsonCourse-DataStructuresAndAlgorithms | UsingBreadthFirstSearchToSolvePuzzles/waterJugs.cpp | /*
* Name:Smith Stackhouse
* Date Submitted:4/20/2020
* Lab Section:003
* Assignment Name: Lab 10 - Using Breadth-First Search to Solve Puzzles
*/
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;
// Reflects what each node represents...
// First value units of water in A... | ALGO | 0.999246 | 5.397261 |
efc68829-decf-4472-9be9-e0eb5c4ebfd7 | PeruDayani/Connecting-multiple-Hololens | apr23_finallllldemo/Il2CppOutputProject/IL2CPP/libil2cpp/icalls/mscorlib/System/MonoType.cpp | #include "il2cpp-config.h"
#include "il2cpp-class-internals.h"
#include "il2cpp-object-internals.h"
#include "il2cpp-tabledefs.h"
#include "gc/Allocator.h"
#include "icalls/mscorlib/System/MonoType.h"
#include "utils/Functional.h"
#include "utils/StringUtils.h"
#include "utils/Il2CppHashMap.h"
#include "vm/Array.h"
#in... | TOOL | 0.874428 | 5.985768 |
9d77e32e-81b4-42a3-8c8b-d4e9befd7c5a | luke-skywalker/accelerated-cpp | chapter4/4-6/grade.cpp | #include <stdexcept>
#include <vector>
#include "grade.h"
#include "median.h"
#include "Student_info.h"
double grade(double midterm, double final, double homework)
{
return 0.2 * midterm + 0.4 * final + 0.4 * homework;
}
double grade(double midterm, double final, const std::vector<double>& hw)
{
if (hw.size() == ... | TOOL | 0.88098 | 5.865122 |
28608c1c-ea5a-45e7-8aec-c1c32caa3e32 | shyyp/LeetCode | Permutations II.cpp | #include <vector>
#include <iostream>
#include <algorithm>
void fullPermute(std::vector<std::vector<int>>& res, std::vector<int>& num, int index, int len)
{
if(index == len)
{
res.push_back(num);
}
for(int i = index; i < len; ++i)
{
if(i != index && num[i] == num[i - 1])
{
continue;
}
int tmp = num[... | ALGO | 0.999949 | 4.795662 |
a4998dfd-7481-4e29-a134-9193727763af | Aaanchalsingh/Leetcode | 402-remove-k-digits/remove-k-digits.cpp | class Solution {
public:
string removeKdigits(string num, int k) {
// Stack to store the digits
stack<char> numStack;
// Iterating through each digit in the number
for (char digit : num) {
// While there are remaining removals (k) and the stack is not empty and t... | ALGO | 0.99999 | 7.146613 |
558744bd-ee35-432a-af3c-b3c4734f3d2d | SiberiaYaKing/LeetcodeSolution | Array/2DArray/54.螺旋矩阵.cpp | /*
* @lc app=leetcode.cn id=54 lang=cpp
*
* [54] 螺旋矩阵
*/
// @lc code=start
#include <vector>
using namespace std;
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
if(matrix.empty()) {return {};}
vector<int> res;
int col = matrix.size(), row = matrix.back(... | ALGO | 0.999956 | 6.699326 |
fec7d933-bfe4-436a-9e66-304b07dfcdd8 | eneserciyes/KU-COMP | COMP304-OperatingSystems/p2/p2/p2.cpp | #include "p2.h"
/**
* Main .cpp file. Function definitions and main function are here.
* @author Mehmet Enes Erciyes (merciyes18) - Nursena Köprücü (nkoprucu16)
*/
pthread_t create_breaking_events_thread() {
pthread_t thread;
if (pthread_create(&thread, NULL, breaking_event_generator, NULL) != 0) {
perror("... | ALGO | 0.991395 | 6.147858 |
802d3853-bd42-4462-8bbf-285a1a9be6f1 | DionysiosB/CodeChef | CARRANGE.cpp | #include <cstdio>
int main(){
long t; scanf("%ld", &t);
while(t--){
long s, m, v; scanf("%ld %ld %ld", &s, &m, &v);
printf("%ld\n", v * (m - s + 1));
}
}
| ALGO | 0.998923 | 3.946611 |
f0281c21-83fa-4e9c-9afd-57768fdc5f07 | MounotaDas/Algo-practice-problem | practice 8.cpp | #include<bits/stdc++.h>
using namespace std;
void Trim_string(string s){
if(s.size()<=10) cout<<s<<endl;
else{
for(int i=0;i<10;i++) cout<<s[i];
}}
int main(){
string s;cin>>s;
Trim_string(s);
}
| ALGO | 0.985817 | 3.79008 |
efb20e77-c075-455d-b0a9-fe7dcf6058bc | yang-su2000/CP-Practice | archived/2024-04/1954b.cpp | #include <bits/stdc++.h>
using namespace std;
// ./run sample.cpp
#define ll long long
int main() {
int t, n;
cin >> t;
while (t--) {
cin >> n;
vector<int> a(n);
for (int &i: a) cin >> i;
bool same = true;
for (int i=1; i<n; i++) {
if (a[i] != a[i-1]) {... | ALGO | 0.999633 | 4.14019 |
51a081ba-d9bf-426d-8761-9fe2ae4a809a | RyanHarlich/MakingGamesWithBen | deps/include/Box2D/Dynamics/Joints/b2FrictionJoint.cpp | #include <Box2D/Dynamics/Joints/b2FrictionJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i + rx j)
//... | ALGO | 0.992253 | 7.570709 |
8bd52210-5009-4784-8f75-7c8407f6dc5a | ashish-jha-73/CodeCrucible | Tic_Tac_Toe.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
/*
********************************************************************************************************************************************************************... | ALGO | 0.999971 | 4.781647 |
de2b83d1-7e56-436c-965a-bcf1125ee16b | dev1702ed/CP_Practice | cses/array_description.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include<set>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
using ll = long long;
long long M = 1e9 + 7;
int main()
{
int t=1;
// cin>>t;
while(t--)
{
int n,m;
cin >> n >> m;
... | ALGO | 0.999988 | 4.384794 |
62ac6220-cd5a-4d0e-9edf-2e771cc1a41e | GaisaiYuno/OI-Record-exe-deleted | Grade 8-9/G9S2/codeforces/000cf 468 div2/AA.cpp | #include<iostream>
#include<cmath>
using namespace std;
int n,a,ans;
int main(){
cin>>n;
for(int i=1;i<=n;i++) cin>>a,ans+=abs(a);
cout<<ans;
}
| ALGO | 0.999839 | 3.493201 |
589f5c48-8179-4402-ac08-8b9bceb747ef | Timmy-zzh/LeetCode | 05_array/48.rotate-image.cpp | #include <iostream>
#include <vector>
using namespace std;
/**
* 1、审题: 输入一个n*n的二维矩阵,需要将矩阵沿着顺时针旋转90度
* 2、解题:
* - 每次沿着矩阵的最外层四条边进行旋转,然后四条边逐次往内收缩,直到最后没有元素可以旋转
* - 每次旋转一条边上的元素,四条边的对应位置的元素进行交换,
*/
void rotate(vector<vector<int>> &matrix)
{
int up = 0;
int down = matrix.size() - 1;
int left = 0;
int rig... | ALGO | 0.999962 | 6.191568 |
cde962a0-375e-4e5a-a8f7-25e31f6b5408 | amdx1254/capstone-design1-llvm-obfuscation | src/llvm/lib/CodeGen/ExpandMemCmp.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/LazyBlockFrequencyInfo.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/C... | TOOL | 0.97627 | 7.085715 |
27e7c0f4-1685-4e05-a0de-17bf2a8ae152 | pickerxxr/Tag_Propagation_Partition | src/tag_partitioner.cpp | #include "tag_partitioner.hpp"
#include "conversions.hpp"
using namespace std;
#define all(x) x.begin(), x.end()
TagPartitioner::TagPartitioner(std::string basefilename)
: basefilename(basefilename), rd(), gen(rd()), writer(basefilename)
{
Timer convert_timer;
convert_timer.start();
Converter *converte... | DATA | 0.922772 | 4.799442 |
348ae686-fee9-4bf2-99c4-915e5f1092a0 | bsc-mem/Mess-Paraver | libs/boost_1_79_0/libs/asio/example/cpp14/parallel_group/parallel_sort.cpp | #include <boost/asio.hpp>
#include <boost/thread/thread.hpp>
#include <boost/asio/experimental/append.hpp>
#include <boost/asio/experimental/parallel_group.hpp>
#include <algorithm>
#include <chrono>
#include <functional>
#include <iostream>
#include <random>
template <
typename Executor,
typename RandomAccess... | ALGO | 0.999722 | 6.808834 |
31aa21cd-4af0-468a-8139-5174cd751a35 | ChenJiahao031008/apollo_shenlan | supplement/calib_tools/lidar2ins_ros_ws/src/fast_gicp/thirdparty/Eigen/unsupported/doc/examples/MatrixSine.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXd sinA = A.sin();
std::cout << "sin(A) = \n" << sinA << "\n\n";
MatrixXd cosA = A.cos();
std::cout << "cos(A) = \n" << cos... | ALGO | 0.975314 | 5.878768 |
51de75c1-9994-45b6-a5ce-78e679dbc493 | yanbcxf/cpp | MyToolKit/NumericalRecipes/recipes/gcf.cpp | #include <cmath>
#include <limits>
#include "nr.h"
using namespace std;
void NR::gcf(DP &gammcf, const DP a, const DP x, DP &gln)
{
const int ITMAX=100;
const DP EPS=numeric_limits<DP>::epsilon();
const DP FPMIN=numeric_limits<DP>::min()/EPS;
int i;
DP an,b,c,d,del,h;
gln=gammln(a);
b=x+1.0-a;
c=1.0/FPMIN;
d... | ALGO | 0.999853 | 3.171369 |
5e0ec27d-c7c2-4f1f-ba51-6d24ca545b56 | gspagare/second-year-comp-engg-sppu-dsa-lab-codes | C14.cpp | #include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
struct node
{ string vertex;
int time;
node *next;
};
class adjmatlist
{ int m[10][10],n,i,j; char ch; string v[20]; node *head[20]; node *temp=NULL;
public:
adjmatlist()
{ for(i=0;i<20;i++)
... | ALGO | 0.996247 | 3.040971 |
9141ec6b-efa6-4afb-ab4f-0061cb9f74dc | PedroMonte/cplib | grafos/djikstra.cpp | int n;
vector<vector<pii>> g(n);
vector<int> dist(n);
vector<int> par(n);
void dijkstra_normal(int s) {
dist[s] = 0;
priority_queue<pii, vector<pii>, greater<pii>> pq;
pq.push({0, s});
while (!pq.empty()) {
auto [du, u] = pq.top();
pq.pop();
if (du <= dist[u]) {
fo... | ALGO | 0.999884 | 4.774271 |
95689982-1eb2-494b-b083-45ead86b4c18 | Yuri-Albuquerque/dual_parabolic_wave_propagator_cpp | src/main_x11.cpp | #include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <iostream>
#include <iomanip>
#include <chrono>
#include <thread>
#include <cmath>
#include <cstring>
#include <algorithm>
#include "DualParabolicWaveSimulation.h"
using namespace WaveSimulation;
class X11Visualizer {
private:
Display* ... | ALGO | 0.969716 | 7.202205 |
54683834-533a-4d80-b3f0-dbf1d12378cb | emilymryan/LAMMPS-SPH-Source-Code | src/MOLECULE/dihedral_multi_harmonic.cpp | /* ----------------------------------------------------------------------
Contributing author: Mathias Puetz (SNL) and friends
------------------------------------------------------------------------- */
#include "dihedral_multi_harmonic.h"
#include <cmath>
#include "atom.h"
#include "neighbor.h"
#include "comm.h"... | ALGO | 0.997378 | 6.139575 |
7d31dd80-5679-41aa-9c4a-16f5fd2092d9 | jungflower/Algorithm | 04. DP/10844.cpp | // 10844 쉬운 계단 수
#include <iostream>
using namespace std;
long long dp[102][102]; // 길이가 i고, 마지막 숫자가 j인 계단 수
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
// 초기 값
for(int i = 1; i <= 9; ++i){
dp[1][i] = 1;
}
for(int i = 2; i <= n; ++i){
for(... | ALGO | 0.999973 | 4.711071 |
cef72fc0-7f01-4606-94ec-c96ce81c6063 | RomanBratchykov/labsatapcpp | Lab_15/Lab_15.cpp | #include <iostream>
#include <typeinfo>
#include <algorithm>
#include <cstdlib>
#include <vector>
std::string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
template <typename T>
void fillRand(T* &arr, int size){
std::string check = typeid(T).name();
// if (check == "c"){
// for (int... | TOOL | 0.970502 | 3.997684 |
bc6895ea-c2cc-4995-b94e-db7d7945e26c | reddragonnm/CSES_problemset | introductory_problems/creating_strings_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
string s;
getline(cin, s);
sort(s.begin(), s.end());
vector<string> ans{s};
while (next_permutation(s.begin(), s.end()))
ans.push_back(s);
std::cout << ans.size() << '\n';
fo... | ALGO | 0.999951 | 4.710007 |
570d2e81-c427-4c84-99c2-417101ff6c89 | AddictedK1/Data-structures | stack with linkedlist.cpp | // NOTE: we dont have any functionality for isFull function because the stack will nearly never overflow
// and we can also keep the track of the size variable and also without counting it everytime...
#include<iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Nod... | ALGO | 0.98943 | 5.011289 |
308cfa8a-dee1-49e6-bdfb-64acd550de3b | LEDA-GAO/LeetCodePractice | leetP13/leetP13/leetP13.cpp | // leetP13.cpp :
//
#include <string>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
class Solution {
public:
int romanToInt(string s) {
unordered_map<char, short int> umap = { {'I',1}, {'V',5},
{'X',10},{'L',50},{'C',100},{'D',500},{'M',1000} };
int sum =... | ALGO | 0.998855 | 6.221317 |
e9e7d792-3088-451b-b1bb-b1559e8e5ad2 | vedantchawla07/DSARepo | Neetcode/Stack/ValidParenthesis.cpp | class Solution {
public:
bool isValid(string s) {
int n = s.size();
stack<char> st;
for (int i = 0; i < n; i++) {
if (s[i] == '[' || s[i] == '(' || s[i] == '{')
st.push(s[i]);
else {
if ((st.size() == 0) || (s[i] == ']' && st.top() != ... | ALGO | 0.998304 | 6.190916 |
233cbe90-e135-4fc3-9393-83b087ad2350 | Henrik-Yao/NEUQ-ACM-Solution | winter-day1/0.题目/贺达/7-6.cpp | #include<bits/stdc++.h>
using namespace std;
stack<char> k;
int main()
{
string s;
cin>>s;
int l=s.length();
k.push(s[0]);
for(int i=1;i<l;i++)
{
if((s[i]==k.top())&&(k.size()!=0))
{
k.pop();
}
else
{
k.push(s[i]);
}
... | ALGO | 0.999989 | 4.022837 |
d9425f3c-222f-4f9f-be1e-e55add340890 | arjunQ21/DSA | Queue/CircularQueue.cpp | #include <iostream>
#include <conio.h>
#define SIZE 5
using namespace std ;
class CircularQueue{
//Usually, rear and front are used. insertAt and deleteFrom are more readable. so,
int insertAt , deleteFrom , arr[SIZE] ;
public:
CircularQueue(){
deleteFrom = 0 ;
insertAt = 0 ;
cout << "\nQueue initializ... | ALGO | 0.969201 | 4.588812 |
195d1bda-6ad6-45ae-a5e5-0d1115d04d30 | jakubkid/MPC_project | src/Eigen-3.3/unsupported/doc/examples/MatrixFunction.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
std::complex<double> expfn(std::complex<double> x, int)
{
return std::exp(x);
}
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::... | ALGO | 0.999385 | 4.353816 |
1f1565b5-1c24-46a8-bdcb-07d1f81d6d1e | cxyfer/OJ | NowCoder/Contest/牛客周赛/牛客周赛 Round 77/计树.cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define endl '\n'
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int n, u, v, k, x;
cin >> n;
vector<vector<int>> g(n);
for (int i = 0; i < n-1; i++) {
cin >> u >> v;
u--; v--;
... | ALGO | 0.999487 | 4.584195 |
f923d206-d73b-4d60-aea2-f1011d500490 | Ishikajain02/DS-Algo | 2210-find-target-indices-after-sorting-array/find-target-indices-after-sorting-array.cpp | class Solution {
public:
vector<int> targetIndices(vector<int>& nums, int target) {
sort(nums.begin(),nums.end());
auto smidx=upper_bound(nums.begin(),nums.end(),target);
auto lgidx=lower_bound(nums.begin(),nums.end(),target);
vector<int>ans;
// if(smidx ==-1 && lgidx==-1)retu... | ALGO | 0.999944 | 6.109275 |
fb3845a9-4840-411d-94a2-907092f7aa3a | PowerAlgorithm/Algorithm-Study | 2022/[Week8 - Two Pointer & Prefix Sum]/이현동/2461.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = std :: pair<int, int>;
int N, M;
vector<int> arr[1001];
priority_queue<pii,vector<pii>,greater<pii>> pq;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> N >> M;
for (int i = 0; i < N;i++){
for (int j = 0; j < M;j++){
... | ALGO | 0.999922 | 3.531469 |
24d7f043-e48c-430b-8314-30da17bd3251 | msussman42/amrex_implicit_interfaces | amrex-master/Tests/LinearSolvers/ABecLaplacian_C/MyTest.cpp | #include "MyTest.H"
#include <AMReX_MLABecLaplacian.H>
#include <AMReX_MLPoisson.H>
#include <AMReX_ParmParse.H>
#include <AMReX_MultiFabUtil.H>
using namespace amrex;
MyTest::MyTest ()
{
readParameters();
initData();
}
void
MyTest::solve ()
{
if (prob_type == 1) {
solvePoisson();
} else if ... | TEST | 0.958791 | 6.613766 |
a150dbfc-a246-4154-9df3-0c12c2587691 | Rammanideep-ghantasala/DSA_preparation | BIT_MANIPULATIONS/LEETCODE_BITMANIP_29.cpp | /*Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator.
The integer division should truncate toward zero, which means losing its fractional part. For example, 8.345 would be truncated to 8, and -2.7335 would be truncated to -2.
Return the quotient after... | ALGO | 0.999954 | 5.955438 |
4d1c4349-87ef-4cf1-862e-fa59042e8f48 | ishandutta2007/codeforces | golikovnik/normal/1091/A.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define szof(x) int32_t((x).size())
#define str(x) to_string(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll MOD998 = 998244353;
const int ... | ALGO | 0.999771 | 3.947062 |
83e9b646-dfca-4cf5-abbd-d996d0cce860 | hi2p-perim/hinatarender | src/src/hinatacore/bsdf.cpp | HINATA_NAMESPACE_BEGIN
double BSDF::CosTheta( const Vec3d& v )
{
return v.z;
}
double BSDF::SinTheta2( const Vec3d& v )
{
return 1.0 - v.z * v.z;
}
double BSDF::TanTheta( const Vec3d& v )
{
double t = 1 - v.z * v.z;
return t <= 0 ? 0 : std::sqrt(t) / v.z;
}
Vec3d BSDF::Reflect( const Vec3d& wi )
{
return Vec3d... | ALGO | 0.960026 | 6.635322 |
18773791-ee37-41a9-b7bd-e29c1d314a5f | AbhishekChauhan9036/Graviton-Batch | DSA Assignment/Trees, Binary Tree - In Class/Tree-from-Inorder-and-postorder.cpp | /**
* author: Abhishek Chauhan
* created: 14.03.2022 21:13:02
**/
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node* left;
struct Node* right;
Node(int x) {
data = x;
left = right = NULL;
}
};
void preOrder(Node* node) {
if (node... | ALGO | 0.999994 | 4.822465 |
e08033b9-e3a6-4a40-8f9c-e4ec42761984 | nguyentheminh04/NguyenTheMinh_monC | Chapter 04/Program/Program_2.cpp | // This program averages three test scores
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int HIGH_SCORE = 95; // A high score is 95 or greater
int score1, score2, score3; // To hold three test scores
double average; // TO hold the average score// Get the three t... | ALGO | 0.962207 | 4.745397 |
485a0333-6529-4e5c-a6de-52e954d8a260 | msalvato/pcl_kinfu_highres | tools/spin_estimation.cpp | #include <pcl/PCLPointCloud2.h>
#include <pcl/io/pcd_io.h>
#include <pcl/features/spin_image.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Histogram<153>... | ALGO | 0.950354 | 7.059959 |
487a2a9c-23c8-462d-aac8-df7312a63fa1 | Maxsmile123/MAI_DA | lab1/main.cpp | #include <iomanip>
#include <chrono>
#include "BucketSort.h"
const double infinum = -100.0;
const double supremum = 100.0;
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
std::cout.tie(nullptr);
std::vector<TElement> inputData;
TElement temp;
while(std::cin >> temp){
... | ALGO | 0.998849 | 5.030118 |
6fca47ac-472c-4a51-b1f4-12091a95d62a | krishna-baviskar/DSAL | heapMark.cpp | #include <iostream>
using namespace std;
class heap
{
public:
void MAX_HEAPIFY(int a[], int i, int n)
{
int largest = i;
int l = 2 * i;
int r = 2 * i + 1;
if (l <= n && a[l] > a[largest])
largest = l;
if (r <= n && a[r] > a[largest])
largest = r;... | ALGO | 0.999712 | 4.644183 |
6ee0bd8a-7f8d-4225-ac8c-8cc0c2442fbd | osom8979/external | opencv-4.1.0/modules/calib3d/src/ptsetreg.cpp | #include "precomp.hpp"
#include <algorithm>
#include <iterator>
#include <limits>
namespace cv
{
int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters )
{
if( modelPoints <= 0 )
CV_Error( Error::StsOutOfRange, "the number of model points should be positive" );
p = MAX(p, 0.);
... | ALGO | 0.998611 | 6.705051 |
f91ca484-cbe7-45cc-884a-5ebde280efdb | yzzupgo/MFTCG | Data/abc206_a/rajat850/ac/23582449.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using vi = vector<int>;
using vl = vector<ll>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
const int MOD = 1e9 + 7;
using pi = pair<int, int>... | ALGO | 0.999236 | 3.612806 |
5cced371-f57a-4100-bfb2-e08a4a9c7604 | zilani131/course3_week6- | module22_stack/reverseSentence.cpp | #include<bits/stdc++.h>
#include"MyStack.h"
using namespace std;
void reverseSentence(string chk){
Stack <string> st;
for(int i=0;i<chk.length();i++){
string word="";
while(i<chk.length()&&chk[i]!=' '){
word+=chk[i];
i++;
}
cout<<word<< " ";
st.push(word);
}
cout<<endl;
while(!st.em... | ALGO | 0.99965 | 4.797884 |
02922ce3-0375-45b4-9ba5-9cb4eb8f2b4a | shihab122/Competitive-Programming | UvaLive/UvaLive8081.cpp | #include<bits/stdc++.h>
using namespace std;
bool isLeapYear(int year){
if (year % 400 == 0) return true;
else if(year % 100 == 0) return false;
else if(year % 4 == 0) return true;
else return false;
}
int main(){
int n;
scanf("%d", &n);
for(int tes = 1; tes <= n; t... | ALGO | 0.999842 | 3.79381 |
811677bc-60dd-4b1b-88f3-6955a308835d | rpwoodbu/chromium_deps_icu | source/i18n/collation.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "collation.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
uint32_t
Collation::incTwoBytePrimaryByOffset(uint32_t basePrimary, UBool isCompressible, int32_t offset) {
// Extract the second byte, minus the minimum byte value,
// plus the offset, modulo... | TOOL | 0.905755 | 6.556263 |
cba8dd62-ac11-41a7-951c-bf799f104471 | thaituanUIT/23521706---CuNguyenHuyThaiTuan---KHMT4 | Bai077/Bai077.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
float k;
cin >> k;
int n;
cin >> n;
float s = 0;
int i = 1;
while (i <= n)
{
float s = s + pow(i, k);
i = i + 1;
}
cout << s;
return 0;
} | ALGO | 0.999815 | 3.659564 |
217ea628-05d7-4a99-a910-fd62d33d816f | mhw-mathcode/acm-algorithm | 数据结构/可持久化平衡树维护序列.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
int n, idx;
int dl, dr, temp;
struct node
{
int l, r;
int key, val;
int si;
bool tag;
ll sum;
} t[N * 100];
int rt[N];
void push_up(int pos)
{
t[pos].si = t[t[pos].l].si + t[t[pos].r].si + 1;
t[pos].sum = t[t[pos].l].sum +... | ALGO | 0.999758 | 4.461517 |
25f9156b-aa0e-4a3e-a6e1-bc07238de5f7 | liraymond04/usaco-practice | difference array/milktemp.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
freopen("milktemp.in", "r", stdin);
freopen("milktemp.out", "w", stdout);
int n, x, y, z;
cin >> n >> x >> y >> z;
map<int, int> range;
for (int i=0; i<n; i++) {
int a, b;
cin >> a >> b;
range[a] += y - x; ran... | ALGO | 0.998856 | 3.527372 |
b37f580f-1fb9-497d-b7e5-2027f73cd6d4 | ishandutta2007/codeforces | j.t.j.l/normal/575/B.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int MAXN = 1E5 + 10, MAXM = 20, MAXK = 1E6 + 100;
const int MOD = 1E9 + 7;
int n;
vector<int> E[MAXN];
vector<int> G[MAXN];
int type[MAXN];
int depth[MAXN];
int p[MAXN][MAXM];
int f[MAXN], g[MAXN];
int ans;
int exp2m[MAXK];
void D... | ALGO | 0.999912 | 4.239334 |
1d1356a5-769c-4cc6-8e23-12073e7f2dd3 | tonybeeth/DNASequencing | newImpl-not-optimized/Serial/DNASequencingSerial.cpp | /*
* Team: #HPCSquadGoals
* Team members: Anthony Enem, Ali Khalid
* Project: DNA Squencing with Shortest Common Superstring
* Code: Sequential Version
*
* Compilation Instructions: make
* Execution Instructions: make test
*/
#include "../common/StringProcessing.h"
#include<iostream>
#include<string>
#include<... | ALGO | 0.999892 | 4.081015 |
613145e5-cf09-4317-acb8-c7bcec21c51b | ishandutta2007/codeforces | alishahali1382/normal/1303/G.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<... | ALGO | 0.999912 | 3.832755 |
2fbec1bc-acec-443e-aaa1-d4c17d1df357 | zachDemsy/LeeetCode_Dsa-javaScript | 1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph/1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph.cpp | class Solution {
public:
vector<vector<int>> getAncestors(int n, vector<vector<int>>& edges) {
vector<vector<int>> adj(n);
vector<vector<int>> ancestors(n);
for (auto& edge : edges) {
adj[edge[0]].push_back(edge[1]);
}
function<void(int, int)> dfs = [&](int star... | ALGO | 0.999992 | 6.406366 |
a8423f1d-8d2f-4217-b2a5-81255771fce6 | kshitijgarg2609/Competitive-Coding | Hacker Rank/C++/Maps-STL/Solution.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
int q;
cin>>q;
map<string,int> mp;
for(int i=0;i<q;i++)
{
int qu;
cin>>qu;
string key;
int val;
switc... | ALGO | 0.997361 | 3.816523 |
68869412-fed9-4e52-b47c-15a43c289e1b | sontheteacher/Competitive-Programming | CSES_pset/graph/sr2.cpp | #include <climits>
#include <iostream>
#include <vector>
using namespace std;
int n, m, q;
typedef long long ll;
ll oo = 1e18;
vector<vector<ll>> dist;
void add_edge(int frm, int to, int w) {
dist[frm][to] = w < dist[frm][to] ? w : dist[frm][to];
dist[to][frm] = dist[frm][to];
}
void floyd_warshall() {
for (int ... | ALGO | 0.999992 | 4.728909 |
2d6bc248-79f9-4461-a800-090c5be38103 | manascb1344/CP_Practice | 06.01.2024/Luke_is_a_Foodie.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc;
cin >> tc;
while (tc--)
{
int n, x;
cin >> n >> x;
vector<pair<int, int>> v(n);
vi a;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999923 | 4.362779 |
b466a0b0-e92a-402d-a873-1af676a3cedd | Xuding0829/60Gogo | 竞赛创新实践/code/L3-009 长城.cpp | #include <bits/stdc++.h>
using namespace std;
long long n, top, ans, X[100005], Y[100005], tower[100005], vis[100005];
bool isConcave (const int &l, const int &mid, const int &r) {
return (Y[r] - Y[l]) * (X[mid] - X[l]) >= (Y[mid] - Y[l]) * (X[r] - X[l]);
}
int main() {
cin >> n;
for (int i = 0; i < n; i++)... | ALGO | 0.999927 | 4.868284 |
0f5a9e4a-f698-4aa6-aa4c-bb7c7cb229e2 | daFoggo/SREC-Code-IDE | problem_solving/problem1.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
for (int i = 0; i < 5; ++i) {
int N, A, B;
cin >> N >> A >> B;
cout << min(A, B) << " " << max(0, A + B - N) << endl;
}
return 0;
}
| ALGO | 0.999711 | 4.128818 |
9cd81265-986c-4bab-8441-858b69c3f8c9 | Miku-UI/platform_frameworks_av | media/module/codecs/amrnb/dec/src/d2_9pf.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/d2_9pf.c
Functions: decode_2i40_9bits
Date: 01/28/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified to place file in the... | ALGO | 0.99964 | 7.253563 |
ca1fa849-bac2-419d-9cf0-533e0af608e1 | peterzheng98/gpu-memory | src/save/pytorch/third_party/eigen/bench/product_threshold.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
#define END 9
template<int S> struct map_size { enum { ret = S }; };
template<> struct map_size<10> { enum { ret = 20 }; };
template<> struct map_size<11> { enum { ret = 50 }; };
template<> struct ... | TOOL | 0.970462 | 5.102006 |
212c528a-1641-465b-bea2-71db0e734579 | alpha74/iCC | E/ECAUG202.cpp | // Angry Delta
// https://www.codechef.com/ENAU2020/problems/ECAUG202
// Aman Kumar
/*
INSIGHT:
See code
*/
#include <bits/stdc++.h>
using namespace std ;
#define ll long long int
#define ff first
#define ss second
#define MOD 1000000007
#define FIO
void generalkenobi() ;
int main()
{
#ifdef FIO
ios_base::... | ALGO | 0.999461 | 5.47308 |
607cdcfb-e5e4-4619-9845-2e742c0d2896 | lsw6684/Cplusplus-Problem | Practices/3-2.cpp | #include <iostream>
void main() {
int dia = 6;
int i=1, j=0;
while (i <=dia) {
j = i;
while (j<dia) {
std::cout << " ";
j++;
}
std::cout << "*";
j = 2;
while (j < i*2-1) {
std::cout << " ";
j++;
}
j = i;
if (j > 1) {
std::cout<<"*";
}
std::cout << std::endl;
i++;
}
i = ... | ALGO | 0.996177 | 3.129897 |
e26b9628-596e-4b84-a90f-52bbc31dcc72 | ToXicSTR/Forknote | tests/CoreTests/ChainSplit1.cpp | #include "ChainSplit1.h"
using namespace std;
using namespace CryptoNote;
gen_simple_chain_split_1::gen_simple_chain_split_1()
{
REGISTER_CALLBACK("check_split_not_switched", gen_simple_chain_split_1::check_split_not_switched);
REGISTER_CALLBACK("check_split_not_switched2", gen_simple_chain_split_1::check_split_n... | TEST | 0.904399 | 3.627105 |
07eed0b8-5d13-4ed7-a02d-b377fcef178e | tos36/atcoder | 171/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();
int main(int, char**) {
int n; cin >> n;
vector<int> A(101010, 0);
ll S = 0;
for (int i=0; i<n; i++) {
int a; cin >> a;
S += a;
A[a]++;
}
int q; ... | ALGO | 0.99985 | 3.97585 |
5023fa36-95ee-42bc-9f40-1de9a7c57b43 | yanxinl4/CS225sp23 | lab_quacks/quackfun.cpp | /**
* @file quackfun.cpp
* This is where you will implement the required functions for the
* stacks and queues portion of the lab.
*/
namespace QuackFun {
/**
* Sums items in a stack.
* @param s A stack holding values to sum.
* @return The sum of all the elements in the stack, leaving the original
* stack i... | TEST | 0.987704 | 5.991367 |
6d794415-e5a5-44e3-90c4-7cc4525615e8 | marioyc/Online-Judge-Solutions | TJU/1809 - Playground.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int K;
double a[20];
while(1){
cin>>K;
if(K==0) break;
for(int i=0;i<K;i++) cin>>a[i];
sort(a,a+K);
double S=a[0];
bool found=false;
... | ALGO | 0.998323 | 3.717848 |
9dd738b1-dcc4-4772-a5a9-aa288739d9b5 | ishandutta2007/codeforces | mangooste/normal/1479/A.cpp | #include <bits/stdc++.h>
using namespace std;
map<int, int> before;
inline int ask(int pos) {
if (before.find(pos) != before.end())
return before[pos];
cout << "? " << pos + 1 << endl;
int x;
cin >> x;
before[pos] = x;
if (x == 1) {
cout << "! " << pos + 1 << endl;
exi... | ALGO | 0.999972 | 3.219388 |
c271e621-9f8e-420f-bfe2-2b4d984bb1d0 | arielgonzalez-1/desafios | C++/UADER/POO/1 repaso/fracciones_nahuel_ibarra.cpp | #include <iostream>
using namespace std;
struct Fraccion{
int num;
int den;
};
int mcd(int a, int b){
if(a>b){
return (mcd(a-b,b));
}
if(a<b){
return (mcd(a,b-a));
}
if(a==b){
return a;
}
return 1;
}
Fraccion suma(Fraccion a, Fraccion b){
Fraccion resSuma;
int x=a.den*b.den;
int y=(b.den*a.num)+(a.d... | ALGO | 0.999053 | 4.845724 |
2381f47b-44e4-4e56-8f72-8f70a275717e | tanvii-17/DSA | Easy/Peak element/peak-element.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/* The function should return the index of any
peak element present in the array */
// arr: input array
// n: size of array
class Solution
{
public:
int peakElement(int arr[], int n)
{ int s = 0;
int e = n-... | ALGO | 0.999806 | 5.505913 |
c25cdaa5-2f51-48fb-9d7d-082e08c215f2 | ThomasGrafNumerics/CheeEngine | neuron.cpp | #include "neuron.h"
#include "neural_network.h"
#include <algorithm>
#include <iostream>
Neuron::Neuron (int new_neuron_index, int output_num) : this_neuron_index (new_neuron_index), value (0.0), gradient (0.0)
{
this->output_weights.assign (output_num, Connection ());
}
void
Neuron::SetValue (double new_value)
{
... | ALGO | 0.99748 | 4.729406 |
5dfb8efd-bc6e-484f-b2b0-5fa0381b49bf | AksshayMathew/Leetcode-problems | 724-find-pivot-index/find-pivot-index.cpp | class Solution {
public:
int pivotIndex(vector<int>& nums)
{
int n = nums.size();
int lsum = 0;
int rsum = 0;
int total = 0;
for(int i=0; i<n; i++)
{
total += nums[i];
}
for(int i=0; i<n; i++)
{
rsum = total - lsum - nums[i];
... | ALGO | 0.999989 | 6.150083 |
5dd73983-f7d2-4cb5-b8d7-25e5ae9ec3d2 | kjyoa09/Cpp | Programmers/level 1/신규 아이디 추천.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string new_id) {
string answer = "";
for (int i = 0;i < new_id.size(); i++){
char tmp = new_id[i];
if (tmp == '.'){
if (answer.size() == 0){continue;}
else if (answer.back() != '.'){
... | ALGO | 0.99926 | 5.955991 |
d9e3d051-e709-4af4-b676-3d9f88f3775e | Taebee00/CodingTest | Inflearn_4/Baekjoon_1094.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int goalL, initL=64;
vector<int> v;
cin >> goalL;
v.push_back(64);
if (goalL==64){
cout << 1;
return 0;
}
while(1){
int half=v.back()/2;
v.pop_back();
v.push_back(half);
v.push_back(h... | ALGO | 0.999924 | 3.944065 |
b273a3b0-1a4f-4160-a438-e24b44ef4733 | ffallrain/lammps_waterbox | src/USER-OMP/npair_half_respa_bin_newton_omp.cpp | #include "npair_half_respa_bin_newton_omp.h"
#include "neighbor.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ----------------------------------------------------... | ALGO | 0.999152 | 5.91144 |
b3b0600f-02f1-4287-b235-7a0037192405 | dan-011/Cpp-Projects | Algorithms/RemoveDupPointers.cpp | //
// RemoveDupPointers.cpp
//
//
// Created by Yufeng Wu on 1/18/21.
//
//
#include <string>
#include <vector>
using namespace std;
//
void RemoveDupPointers(vector<string *> &arrayPtrs)
{
// arrayPtrs: STL vector of pointers to strings
// remove pointers that are pointed to identical strings in the arr... | ALGO | 0.996392 | 5.038082 |
16cd0a39-a6eb-44e1-8bc7-4a75047297a0 | sanjarbek-ismatov/c-learn | Problems/Leetcode/1929. Concatenation of Array/main.cpp | class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
short int size = (short int)nums.size();
for(short int i = 0; i < size; i++){
nums.push_back(nums[i]);
}
size = NULL;
return nums;
}
}; | ALGO | 0.997022 | 4.817867 |
628f9fa3-2fa0-41f7-b88d-6f37260cb588 | MrRanjan12/DSA_with_C- | SwapMaxMin_inArr.cpp | #include <iostream>
#include <algorithm> // For std::max and std::min
#include <climits> // For INT32_MAX and INT32_MIN // for only old version c++
using namespace std;
int swapMaxMin(int arr[], int size){
int minValue = INT32_MAX;
int maxValue = INT32_MIN;
int minValueIndex = 0;
int maxValueIndex = 0;
fo... | ALGO | 0.999941 | 4.669776 |
e32d5ada-2663-4737-83c6-0639312542f8 | bonizario/uri-solutions | tournaments/2020/Torneio 10 - FEELT (UFU)/f2562.cpp | // Using vectors
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
int dfs(const vector<vector<int>> &Vec, vector<int> &componente, int node) {
stack<int> Stk;
Stk.push(node);
int semelhantes = 0;
while (!Stk.empty()) {
node = Stk.top();
Stk.pop();
for... | ALGO | 0.999934 | 5.053515 |
92e2f930-4a5a-4fa5-9230-d15c0798a9cf | JingxueLiao/Data_Structures_and_Algorithms | graph/breadth_first_search.cpp | #include <vector>
#include <queue>
using std::vector;
using std::queue;
vector<int> breadth_first_search(const vector<vector<int>> &graph) {
vector<int> traverse;
vector<char> colors(graph.size(), 'w');
queue<int> path;
for (int i = 0; i < graph.size(); ++i) {
if (colors[i] == 'w') {
... | ALGO | 0.999834 | 5.74378 |
622587f2-2ebe-4a54-adad-e59754d802c5 | ishandutta2007/codeforces | leaf1415/normal/999/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, m, s;
vector<int> G[5005], revG[5005], g[5005], revg[5005];
vector<int> topo;
bool used[5005];
int scc[5005];
void tpsort(int v)
{
used[v] = true;
for(int i = 0; i < G[v].size(); i++){
if(!used[G[v][i]]) tpsort(G[v][i]);
}
t... | ALGO | 0.999933 | 4.458591 |
a76578f2-2233-4c83-8bfa-f2dc19973510 | ishandutta2007/codeforces | _twilight/normal/1161/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef bool boolean;
#define ll long long
void exgcd(int a, int b, int& x, int& y) {
if (!b) {
x = 1, y = 0;
} else {
exgcd(b, a % b, y, x);
y -= (a / b) * x;
}
}
int inv(int a, int n) {
int x, y;
exgcd(a, n, x, y);
return (x < 0) ? (x + n) : (x);
}
templat... | ALGO | 0.999993 | 4.836156 |
4753baf0-f948-47b3-a315-6efbe82b952e | GopeshGoswami/DSA-Notes | Array/alternateSwap.cpp | #include <iostream>
using namespace std;
void printArray(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
}
void alternateSwap(int arr[], int n)
{
for (int i = 0; i < n; i += 2)
{
if (i + 1 < n)
swap(arr[i], arr[i + 1]);
}
printArray(ar... | ALGO | 0.999549 | 5.2328 |
df5e663b-c433-4205-b8bc-8e58c9e133e5 | Pinkii-/LI | satSolver/satSolver.cpp | #include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <time.h>
#include <set>
using namespace std;
#define UNDEF -1
#define TRUE 1
#define FALSE 0
clock_t t;
uint numVars;
uint numClauses;
vector<vector<int> > clauses;
vector<int> model;
vector<int> modelStack;
//uint indexOfNextLit... | ALGO | 0.999573 | 4.330571 |
89c8207d-9cd6-495b-9101-b4593baabd3c | geeky01adarsh/DSA-Self-Paced-Course | SORTING/partitioning_around_range.cpp | #include <iostream>
using namespace std;
void twoWayPartioning(int arr[], int n, int pi, int pe)
{
int low=0, high=n-1, mid=0;
while(mid<=high){
if(arr[mid]<pi)
swap(arr[low++], arr[mid++]);
else if(arr[mid]<=pe && arr[mid]>=pi)
mid++;
else swap(arr[mid], arr[high--]);
... | ALGO | 0.999985 | 3.490787 |
eec6eb3f-e5ab-454e-9660-a844d20776fb | ScytheAkira/Basic-Codes | Friend_Function.cpp | #include<iostream>
using namespace std;
typedef class EquilateralTriangle
{
private:
float a;
float circumference;
float area;
public:
void SetLen(float length)
{
a = length;
circumference = a*3;
area = (1.73 * a * a) / 4;
}
// friend void PrintResult(EquilateralTriangle obj);
friend class Homework;
}... | TOOL | 0.936545 | 3.329653 |
6717725b-1652-47b3-9acd-76f531bf7199 | Tahsin005/Problem-Solving | ICPC Practice/Binary.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
/*
*/
int main(){
int n;
cin >> n;
string s;
cin >> s;
int zero = 0, one = 0;
for (int i = 0; i < s.length(); i++) {
zero += (s[i] == '0');
one += (s[i] == '1');
}
cout << zero << " " << one << endl;
... | ALGO | 0.999738 | 4.19003 |
83657240-b717-456f-b9d3-1f13c778b851 | tsahiasher/GSX | VIEW3/COMPARIS.CPP | /*----------------------------------------------------------------------------
comparison.c
------------------------------------------------------------------------------*/
#include <math.h>
#include "comparison.h"
#include "cext.h"
#define M_PI 3.141
/*--------------------------------... | TOOL | 0.994854 | 5.266837 |
2f400607-d4ed-4c8e-975f-afb07054e6e7 | SovietPower/My-OI-ACM | 高级数据结构/线段树/CF.1051G.Distinctification(线段树合并 并查集).cpp | /*
483ms 161100KB
$Description$
$n$$A_i,B_i$Խֲ
1. ѡһλ$i$$A_i=A_i+1$$B_i$һλ$j$$A_i=A_j,\ i\neq j$ſԽС
2. ѡһλ$i$$A_i=A_i-1$$-B_i$һλ$j$$A_i=A_j+1$ſԽС
Ҫ$i\in[1,n]$ʹ$A_1,A_2,...,A_i$ͬСǶ١
$n,A_i\leq2\times10^5,\ 1\leq B_i\leq nһͬ$
$Solution$
$A_i$ͬ$A_i+1=A_j$Խ$A_i,A_j$Ϊ$B_i-B_j$лᱻֳ$A_i$ɶΣÿ$B_i$ݼ
$A_i$пͬȰ$A_i$ɻͬͬλϵƵεҶ˵$+1$鼯άٽ... | ALGO | 0.99966 | 3.430927 |
f3cc50c3-9dc6-4c85-8370-670fbe01979b | adityaRajGit/Leetcode_problems | 21-merge-two-sorted-lists/21-merge-two-sorted-lists.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 *mergeTwoLis... | ALGO | 0.999951 | 6.222964 |
3fd70089-dcdc-408e-b3ac-5353076855a4 | ROCm/flang | flang-classic/17.0-4/llvm-classic/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp | #include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
#include "AggressiveInstCombineInternal.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/ConstantFolding.h"... | ALGO | 0.977959 | 7.804957 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.