uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
cb36e9c8-3e4b-4e27-94db-74cfe94e9c5f | MdAfsarHossain/Log2Base2 | 2.Data Structures/6.Queue/1.Intro/Intro.cpp | #include<iostream>
using namespace std;
#define n 3
int ara[3];
int fron = 0;
int rear = 0;
void enqueue(int val)
{
if(rear == n)
{
cout<<"Queue is Full."<<endl;
}
else
{
ara[rear] = val;
rear++;
}
}
void dequeue()
{
if(fron == rear)
{
cout<<"Queue is Em... | ALGO | 0.994958 | 3.858608 |
edb6f202-29d0-4115-8081-632e8869a42b | Jakub345/decision-tree-classifier | main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <unordered_map>
#include "funkcje.h"
using namespace std;
/**
* @brief Glowna funkcja programu.
*
* @param argc Liczba przekazanych argumentow.
* @param argv Tablica przekazanych argumentow.
* @return Kod zakon... | DATA | 0.858876 | 5.211589 |
7ea2c043-e6ed-4c9d-b76f-1ae034b07dd0 | sudhanshu2504/CrackYourPlacement | Graph/FloydWarshall.cpp | class Solution {
public:
void shortest_distance(vector<vector<int>>&matrix){
int rows = matrix.size();
int columns = matrix[0].size();
for( int k =0; k<rows; k++){
for(int i =0; i<rows; i++){
for(int j =0; j<columns; j++){
int x = matrix[i][k];
... | ALGO | 0.999976 | 5.478331 |
60dd8e9e-e88d-48b6-a0d5-6fa1b8341720 | BerrocalG/CALCULADORA-CONINTERRRUPCIONEs-ok | src/main.cpp | #define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
// Banderas
char SUBIR = 0;
char BAJAR = 0;
char SUMAR = 0;
char RESTAR = 0;
char ENTER = 0;
// Variables
uint8_t unidades = 0;
uint8_t decenas = 0;
uint8_t guardadou = 0;
uint8_t guardadod = 0;
uint8_t mate = 0; // 1 ... | TOOL | 0.925128 | 4.34802 |
25b8fc2b-d5eb-45c8-8cfd-72fe01b8444f | 9weeks-flutter-sfac/assignment-seongwan | day7/flutter_class/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998678 | 6.76073 |
5d7867f9-3252-4a69-996b-3a546af70ba2 | sai1999gaurav/CS213-Data-Structures-Algorithms | 170070008_A3/170070008_A3/170070008_A3/P2/p2-qs.cpp | #include <iostream>
using namespace std;
int part(int a[], int l, int r){
int k=a[r], i=l-1, temp;
for(int j=l;j<r; j++)
if(a[j]<=k)
{ i++;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
temp=a[i+1];
a[i+1]=a[r];
a[r]=temp;
return i+1;
}
void quicksort(int a[], int l, int r){
int p;
if(l<r){
p=part(a,l,r)... | ALGO | 0.999985 | 4.5321 |
f599e35c-4e5d-4081-a1c3-523dd9f74ee4 | nhh9905/Code-PTIT | DSA/Greedy/dsa03001.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[10] = {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
// freopen("a.inp", "r", stdin);
int t;
cin >> t;
while (t--) {
int n, idx = 9, ans = 0;
cin >> n;
for (int i = ... | ALGO | 0.999562 | 4.19331 |
2060bf3a-a014-4638-b3f9-42003d95ecac | zeroc-ice/doxygen | addon/doxyparse/doxyparse.cpp | /** @file
* @brief Code parse based on doxyapp by Dimitri van Heesch
*
*/
#include <stdlib.h>
#include <unistd.h>
#include "doxygen.h"
#include "outputgen.h"
#include "parserintf.h"
#include "classlist.h"
#include "config.h"
#include "filedef.h"
#include "util.h"
#include "filename.h"
#include "arguments.h"
#inclu... | TOOL | 0.864793 | 3.472544 |
dcd1cb38-4ec7-43ae-9937-be53fa2021d8 | loreniitalicona/math-project | src/13.cpp | #include <iostream>
using namespace std;
int main() {
int num1 = 5;
int num2 = 3;
cout << "The sum of " << num1 << " and " << num2 << " is: " << (num1 + num2) << endl;
return 0;
}
| TOOL | 0.974609 | 4.354957 |
ff5a0005-d527-4d27-9712-68f133cc90d8 | tripathiaman0709/-leetcode | Ways-to-Express-an-Integer-as-Sum-of-Powers.cpp | class Solution {
public:
int dp[301][6][302];
int M=1e9+7;
long long powerLL(int a, int b) {
long long res = 1;
for (int i = 0; i < b; i++) res *= a;
return res;
}
int solve(int val, int x, int num) {
if (val == 0) return 1;
if (val < 0) return 0;
... | ALGO | 0.99998 | 5.503853 |
0056ab0d-af98-4b75-995b-8650dd83572c | H-Shen/MyCodeCollection | Leetcode/1103/1103.cpp | class Solution {
public:
vector<int> distributeCandies(int candies, int num_people) {
vector<int> ans(num_people);
int currentCandy = 1;
int currentIndex = 0;
while (candies > 0) {
if (candies < currentCandy) {
ans[currentIndex] += candies;
... | ALGO | 0.999998 | 5.871504 |
45a287e5-4fa8-4e99-85e4-f21a77ff585a | fresher96/competitive-programming | Segment Tree DS/main.cpp | #include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true){
#ifdef LOCAL_TEST
freopen("in.in", "rt", stdin);
if(outToFile)
freopen("out.out", "wt", stdout);
#endif
}
//
// |x| stand for ceil(x) & n is the number of array nodes
// set 2^( |lgn| + 1 ) ans the size of ST
#define OO IN... | ALGO | 0.991954 | 3.634648 |
03cf10fb-f1dd-44b8-a468-557fa5e8acfe | Mastur4492/Cpp_100_questions | 06_questions.cpp | #include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"Enter number a: ";
cin>>a;
cout<<"Enter number b: ";
cin>>b;
cout<<"Enter number c: ";
cin>>c;
if (a<b)
{
if (b<c)
{
cout<<"C grater";
}
else{
cout<<"B grater";
}
}
else{
i... | ALGO | 0.999576 | 3.294129 |
fd975f82-fee8-42b3-b8df-19faaa1774db | Yash-YC/Source-Code-Plagiarism-Detection | gcj/gcj/188266/ged/190103/0/extracted/tc.cpp | #include <vector>
#include <list>
#include <cstring>
#include <cstdio>
#include <stdlib.h>
#include <iostream>
#include <queue>
#include <sstream>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
#define FN(i,n) for (int i=0; i<(int)(n); i++)
#define SZ(c) ((int)(c).size())
#define FBE(i,v,T) ... | ALGO | 0.997221 | 3.987118 |
83626875-bb01-41a0-b4f3-9dd9736183bf | yolunghiu/algo_code | nowcoder/class2/01_netherland_flag.cpp | #include <iostream>
using namespace std;
void swap(int *arr, int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
void partition(int *arr, int l, int r, int num, int *result) {
if (nullptr == arr || l == r)
return;
int cur = l, min = l - 1, max = r + 1;
while (cur < max... | ALGO | 0.999982 | 4.845756 |
e6780b2e-5db6-4eac-a497-3f86ae3455bf | Srajan-Jaiswal/Codeforces-Contests | Codeforces Round #667 (Div. 3).cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define fr(i,a,n) for(int i=a;i<n;i++)
#define fre(i,a,b) for(int i=a;i<=b;i++)
#define endl '\n'
#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define mem(name, value) memset(name, value, sizeof(name))
#define pb push_back
#define... | ALGO | 0.999889 | 4.127382 |
1562937e-a27c-44dc-9c88-5152c9155e0c | Etsuya233/CodeSyncEtsuya | Luogu/l2023h_1.cpp | #include <iostream>
#include <queue>
using namespace std;
typedef struct NNode {
int e, val, left, right, now;
} node;
struct cmpNNode{ //д()!!!
bool operator() (const node* a, const node* b){ //reverse
if(a->e != b->e) return a->e < b->e;
else if(a->val != b->val) return a->val > b->val;
... | ALGO | 0.999997 | 3.701859 |
0502d83c-8094-4a0b-9796-f6628db5f84f | snehil21/LeetCode | Making A Large Island - GFG/making-a-large-island.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
int dir[4][2] = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}};
void dfs(int i, int j, vector<vector<int> > &grid, vector<vector<bool> > &visited, int val){
grid[i][j]... | ALGO | 0.999895 | 6.657453 |
c08028cd-65d5-44b8-a547-11c6afd63d49 | pjulien21/Coding-Challenges | QuadTree/src/QuadTree.cpp | #include "QuadTree.h"
using namespace std;
QuadTree::QuadTree(const AABB& aabb)
: mAABB(aabb)
{
}
void QuadTree::ForEachPoint(function<void(const Point& point)> funct) const
{
for (const Point& point : mPoints)
funct(point);
if (mQuadTreeNorthWest != nullptr) mQuadTreeNorthWest->ForEachPoin... | ALGO | 0.865392 | 6.557204 |
04c12963-c442-4967-b2ce-677bf4dff2c6 | boostorg/contract | example/features/base_types.cpp | #include <boost/contract.hpp>
#include <vector>
#include <algorithm>
#include <cassert>
template<typename T>
class pushable {
public:
void invariant() const {
BOOST_CONTRACT_ASSERT(capacity() <= max_size());
}
virtual void push_back(T x, boost::contract::virtual_* v = 0) = 0;
protected:
virtu... | TOOL | 0.929624 | 7.173749 |
ea954870-d3b6-4991-b508-fb43f862b0cf | KBTUaccount/PP2 | ignore_me/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int count(vector <pair <int, int>> array, int endpoint, int stage, int sum){
if (stage == endpoint){
return sum % 2;
}
int branch_1 = count(array, endpoint, stage + 1, sum + array[stage].first);
int branch_2 = count(array, endpoint, stage + 1, su... | ALGO | 0.999175 | 3.612815 |
f9fe1eb1-0e69-42b1-86b4-ed3725663843 | merveille-572/Tontine | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998764 | 6.762122 |
0f48f306-ef3f-4eb9-b6ff-1db7631fb25d | Fabayu/Leetcode-problems | 322-coin-change/322-coin-change.cpp | class Solution{
public:
int coinChange(vector<int>& coins, int amount) {
int n = coins.size();
int ar[n+1][amount+1];
for(int i = 0; i<n+1; i++){
for(int j = 0; j<amount+1; j++){
if(i==0){
ar[i][j]=10001;
}
if(j==0... | ALGO | 0.999957 | 5.671579 |
90e281a4-8a9b-42f6-b6c9-7b0313598e72 | Pranesh-1905/LeetCode | 0032-longest-valid-parentheses/0032-longest-valid-parentheses.cpp | class Solution {
public:
void isvalid(string s,stack<int> &st,int &maxlen){
st.push(-1);
for(int i=0;i<s.size();i++){
if(s[i]=='('){
st.push(i);
}
else{
st.pop();
if(!st.empty()){
maxlen=max(maxle... | ALGO | 0.999866 | 5.860193 |
c29ab344-ff1d-41b0-b041-d7da99805458 | Jeetender999/DSA-using-Cpp | Strings/ReverseWords.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void reverseStr(char str[], int n)
{
int start = 0;
for(int end=0;end<n;end++)
{
if(str[end] == ' ')
{
reverse(str+start,str+end);
start = end+1;
}
}
reverse(str+start,str+n);
reverse(str,str+n);
}
int main(... | ALGO | 0.999786 | 3.86501 |
69950a99-817b-4a7e-8656-0d6fc6de725a | phumipatc/C_Competitive_Programming | Website/Codeforces/1256/1256D_Binary_String_Minimizing.cpp | /*
Author : Phumipat C.
School : RYW
Language: C++
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
char a[1000010];
int main(){
LL q,n,k,countt;
scanf("%lld",&q);
while(q--){
scanf("%lld %lld",&n,&k);
for(int i=1;i<=n;i++)
scanf(" %c",&a[i]);
... | ALGO | 0.999952 | 3.097823 |
213bab9d-6aa1-4d06-9c23-1771eefeb80c | Izumemori/muscord-cpp | src/common.cpp | #include "common.h"
#include <cstdlib>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
void muscord::replace(std::string& str, const std::string& from, const std::string& to) {
size_t start_pos = str.find(from);
if (sta... | TOOL | 0.903407 | 5.414506 |
632a6ae6-96eb-4bf0-8176-4e6599807c63 | nmaxwell/mathlib | math/grids/grid1D_Dn.cpp | #ifndef GRID1D_Dn_CPP
#define GRID1D_Dn_CPP
#ifndef GRID1D_Dn_H
#include "grid1D_Dn.h"
#endif
#ifdef GRID1D_Del1_FD
template<class Ytype,class St1,class Xt1,class St2,class Xt2 >
void Del1_FD(
grid1D<Ytype,St1,Xt1 > & in,
grid1D<Ytype,St2,Xt2 > & out,
int order,
int bdcond )
{
out.copy(in);
if ( bdcond == G... | ALGO | 0.992219 | 4.195463 |
1271590f-2624-42e4-9ae9-fc32f35aca22 | DhavalMavani/DSA_Leetcode | 3518-maximum-multiplication-score/3518-maximum-multiplication-score.cpp | class Solution {
public:
long long helper(int i, int k,vector<int>& a, vector<int>& b,vector<vector<long long>> &dp){
if(k>=4) return 0;
if(i==b.size()) return -5e10;
if(dp[i][k] != -5e10) return dp[i][k];
return dp[i][k]=max(helper(i+1,k,a,b,dp), (long long)a[k]*b[i] + helper(i+1,k... | ALGO | 0.999968 | 5.259053 |
462bf963-71bc-4466-beaa-948471db2511 | GeekyPratham/DP | dynamic_programming/B_Frog2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
vector<int> h; // height;
int k;
vector<int> dp; // cpr do like this
// // top down solution
// int f(int i){
// if(i>=h.size()){
// return INT_MAX;
// }
// if(i==h.size()-1){
// // last st... | ALGO | 0.999982 | 4.513902 |
317877a0-03d0-4e28-9d10-06713925a44d | TD2106/Competitive-Programming | Codeforces/C. Star sky.cpp | #include <bits/stdc++.h>
#define bug(x) cout << #x << " = " << x << endl
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define F first
#define S second
#define reset(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<pii,ll> piil;
ll ... | ALGO | 0.999861 | 3.520834 |
75672aea-d27f-4c34-80eb-9ff4b680810a | kyashwanth02/DSA | 229-majority-element-ii/majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int n=nums.size();
unordered_map<int,int> mp;
vector<int>ans;
for(auto i:nums)
{
mp[i]++;
}
for(auto i:mp)
{
if(i.second > n/3)
{
... | ALGO | 0.99996 | 5.733977 |
91d1b4c2-ff38-4cda-a985-bc4c3156aad7 | tao73bot/codes | codeforces_25_B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,a;
cin >> n;
char s[160];
cin >> s;
if(n%2==0){
a=2;
}
else{
a=3;
}
cout << s[0];
for(i=1;i<n;i++){
if(i%2==0 && i<=n-a){
cout <<"-";
}
cout << s[i];
}
... | ALGO | 0.999955 | 3.184225 |
9a02adad-19fd-4177-8798-02d42ac57688 | kawser25350/Problem-Solving | codeshef and codeforces contest/bestTimeToBuyAndSellStock.cpp | #include<bits/stdc++.h>
using namespace std;
int maxProfit(int k, vector<int> prices) {
int n=prices.size();
if(n==0)
{
return 0;
}
int dp[k+1][n+1];
memset(dp,0,sizeof(dp));
for(int i=1;i<=k;i++)
{
for(int j=1;j<n;j++)
{
dp[i][j]=dp[i][j-1];
... | ALGO | 0.999586 | 5.165027 |
ce3b446d-6cdf-44b3-860c-cab4fe3ab0ce | CallMeQan/Training-for-HSG-HCM-vietnam-2024 | cplusplus/mapp/XOA_PHAN_TU.cpp | #include<bits/stdc++.h>
using namespace std;
int n , k;
int a[1000005];
map < int , int > mp;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 1 ; i <= n ; i++){
cin >> a[i];
mp[a[i]]++;
}
if(mp.size() > 2)
cout << "0";
else if(mp.size() == 1)
... | ALGO | 0.999984 | 3.667048 |
b7a2f135-3a70-4cd3-b5eb-1ed5a3fc9a43 | sinian666/codes_102_3 | cpp_副本59/chapter_array_and_linkedlist/array.cpp | /**
* File: array.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 随机返回一个数组元素 */
int randomAccess(int *nums, int size) {
// 在区间 [0, size) 中随机抽取一个数字
int randomIndex = rand() % size;
// 获取并返回随机元素
int randomNum = nums[randomIndex];
return randomNum;
... | ALGO | 0.931887 | 4.819575 |
e127998b-183f-4973-b909-aa7a033a6c96 | kastur/artificial_birds | bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp | ///btSoftBodyHelpers.cpp by Nathanael Presson
#include "btSoftBodyInternals.h"
#include <stdio.h>
#include <string.h>
#include "btSoftBodyHelpers.h"
#include "LinearMath/btConvexHull.h"
#include "LinearMath/btConvexHullComputer.h"
//
static void drawVertex( btIDebugDraw* idraw,
const btVector3& x,btScal... | TOOL | 0.899231 | 5.580941 |
d9615ec9-53f4-4ea0-ae46-f98efbe46162 | marinamosaad/Embedded-Linux-New | CPP/Labs/Day1/callBack_Func.cpp | #include <iostream>
using namespace std;
int SumOfArr(int* arr, int size)
{
int sum=0;
for (int i = 0; i < size; ++i) {
sum += arr[i];
}
return sum;
}
typedef int(*Func_Ptr)(int* arr , int size);
int* Func(int **arr ,int NumofRows, int* RowSizeArr,Func_Ptr call)
{
int TwoD_ArrSize=0;
... | ALGO | 0.999607 | 4.48706 |
69fc2671-ec67-4d48-a13c-dd21997280be | prime-jd/Leetcode-stats | nextPermutationPalindrome.cpp | #include <bits/stdc++.h>
using namespace std;
bool palindromeString(string s) {
vector<int> freq(26, 0);
// Count character frequencies
for (char c : s) {
freq[c - 'a']++;
}
// Check how many characters have odd frequencies
int oddCount = 0;
for (int count : freq) {
if (co... | ALGO | 0.999896 | 5.807611 |
b2a42b71-61ae-43f4-a44b-48ceb987ade5 | RD-yuan/BUPT_OJ_st | st1/1G 老鼠和猫的交易/FileName.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <algorithm>
using namespace std;
struct cat {
int j, f;
double unit;
}a[1000];
bool cmp(cat x, cat y)
{
return x.unit > y.unit;
}
int main()
{
int M, N, O;
while (scanf("%d %d", &M, &N))
{
if (M == -1 && N == -1)
break;
for(int i=1;i<=N;i++)
{... | ALGO | 0.999782 | 3.401035 |
0126025d-0079-48eb-a714-c4c54d1dca4b | ishandutta2007/codeforces | tfg/normal/900/E.cpp | #include <iostream>
#include <cstdio>
const int ms = 100100;
const int INF = 1e9;
int n, m;
char buffer[ms];
int count[ms][2];
int dp[ms][2];
int ans[ms][2];
bool match(int i) {
char x = buffer[i];
if(x == '?') {
return true;
} else if(i % 2 == 1 && x == 'a') {
return true;
} else if(i % 2 == 0 && x == 'b')... | ALGO | 0.999949 | 3.474987 |
8d1bed3e-8868-44c4-984a-d16cb45c5c9a | lucaspereirap7/exerciciosIalg | ex8lista1.cpp | #include <iostream>
using namespace std;
int main() {
float x, y, area;
cin>>x>>y;
area = (x * y)/2.0;
cout<<"A area do losango de lado maior "<<x<<" e lado menor "<<y<<" e "<<area<<" metros quadrados."<<endl;
return 0;
}
| ALGO | 0.997179 | 3.8605 |
3b8102e8-e454-452d-86e7-2d333c5ff717 | kooreshakhbari/CSC317 | computer-graphics-meshes/libigl/include/igl/path_to_edges.cpp | #include "path_to_edges.h"
template <typename DerivedI, typename DerivedE>
IGL_INLINE void igl::path_to_edges(
const Eigen::MatrixBase<DerivedI> & I,
Eigen::PlainObjectBase<DerivedE> & E,
bool make_loop)
{
// Check that I is 1 dimensional
assert(I.size() == I.rows() || I.size() == I.cols());
if(make_loop)... | ALGO | 0.915427 | 5.142617 |
f79d0ff0-d01e-4fb6-9f68-c1dafc4f54bb | wyhboos/MPMDN | cpp/src/mpmdn.cpp | #include <ompl/base/StateSpace.h>
#include <ompl/base/ScopedState.h>
#include <ompl/base/SpaceInformation.h>
#include <ompl/base/ProblemDefinition.h>
#include <ompl/base/Planner.h>
#include <ompl/base/goals/GoalStates.h>
#include <ompl/base/goals/GoalState.h>
#include <ompl/geometric/PathGeometric.h>
#include <ompl/geo... | ALGO | 0.99981 | 3.611706 |
8213b29e-4718-4c65-bbb1-4c572c8daf11 | Jian-Zhe/Competitive-programing | cpp/cf/12-13-icpc-pacific-NRC/G.cpp | #include <bits/stdc++.h>
#define _ cin.tie(0) -> sync_with_stdio(0);
using namespace std;
using ll = long long int;
ll thr[56], two[56];
ll binomial(ll n, ll r) {
if(n - r < r) {
r = n - r;
}
if(r == 0) {
return 1;
}
ll res = 1;
for(ll i = r + 1; i <= n; ++i) {
res... | ALGO | 0.999917 | 4.140778 |
c25392ca-b434-46e9-9054-328e4369934e | privateLLM001/Private-LLM-Inference | OpenCheetah/deps/eigen/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.999366 | 3.093769 |
12f68ec0-eb6b-4d77-9f96-4f39c1981744 | whlprogram/CPP_Code | 上机实验/答案/zy-0302/zy-0302.cpp | // zy-0302.cpp: Ŀļ
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
#define S(a,b,c) (a+b+c)/2
#define AREA(a,b,c) sqrt(S(a, b, c)*(S(a, b, c) - a)*(S(a, b, c) - b)*(S(a, b, c) - c))
int main()
{
float a, b, c;
cout << "a,b,c:";
cin >> a >> b >> c;
if (a + b>c && a + c>b && b + c>a)
... | ALGO | 0.991424 | 3.704142 |
43e3a337-9dcf-4abf-a776-d974acb46a3d | Miner1033/Problem_Solving | String_Problems/string_2_operator_3_operend_detect.cpp | #include<bits/stdc++.h> // Includes all standard C++ libraries
using namespace std;
int main ()
{
// Declare 6 strings:
// s: to store the input expression
// s1: first operand
// s2: first operator
// s3: second operand
// s4: second operator
// s5: third operand
string s, s1, s2, s3, ... | ALGO | 0.972694 | 3.909183 |
a9ce0727-f16d-47e9-a24a-4db2667eede8 | ishandutta2007/codeforces | heart_blue/normal/986/C.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999943 | 4.574805 |
dda09ea5-62b4-4e41-8cf3-5876f463b238 | SaiVamshiK/Data-Structure-in-C- | Revised DS/Recursion _ Backtracking/Recursion/CB/Smart Keypad.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 Format
... | ALGO | 0.998738 | 3.867399 |
dc2b0423-f95d-43c5-825d-c6844b6e5779 | ishandutta2007/codeforces | oipotato/normal/1634/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define data dataa
#define rep(i,n) for(int i=1;i<=n;i++)
typedef long long LL;
char s[110];
int main()
{
int T;
for(scanf("%d",&T);T--;)
{
int n,k;
scanf("%d%d",&n,&k);
scanf("%s",s+1);
bo... | ALGO | 0.999906 | 3.098238 |
7ce48b46-f146-4467-9e86-2603d48dd467 | brodante/LeetCode | 2299-merge-nodes-in-between-zeros/merge-nodes-in-between-zeros.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* mergeNodes(... | ALGO | 0.999963 | 5.135906 |
229a03c1-5e41-47b3-82d5-54f667ebc5ff | lein32/PS | p_67256.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
struct Pos {
int x;
int y;
};
int get_distance(Pos& hand_pos, Pos& num_pos) {
return abs(hand_pos.x - num_pos.x) + abs(hand_pos.y - num_pos.y);
}
void move_hand(Pos& hand_pos, Pos& num_pos) {
hand_pos.x = ... | ALGO | 0.999984 | 5.669117 |
e7ccc7c1-943b-4c71-89f3-5fc5c28cc1fb | abhiXsliet/DSA-Busted-A-Complete-CPP-DSA-Series | Lecture 004 Patterns Problems & Output Questions/outputQues4.cpp | #include<iostream>
using namespace std;
//Question 4
int main(){
char ch;
cout << "Please give the input" << endl;
cin>>ch;
if(ch>='A'&&ch<='Z'){
cout << "This is a Uppercase " << endl;
}
else if(ch>='a'&&ch<='z'){
cout << "This is a Lowercase " << endl;
}
else if(ch>=... | ALGO | 0.965033 | 3.290557 |
7689ea56-6211-45f6-b3cc-a3e701e07ace | HussainHaris/EMG_Training | codegen/mex/ctrainingRoutineKNN2/sqrt.cpp | /* Include files */
#include "mwmathutil.h"
#include "rt_nonfinite.h"
#include "ctrainingRoutineKNN2.h"
#include "sqrt.h"
#include "ctrainingRoutineKNN2_data.h"
/* Function Definitions */
void b_sqrt(const emlrtStack *sp, real_T *x)
{
if (*x < 0.0) {
emlrtErrorWithMessageIdR2018a(sp, &yb_emlrtRTEI,
"Coder:... | ALGO | 0.999605 | 5.472106 |
de9c41c0-db47-4db9-9f8f-39186f2043ad | ishandutta2007/codeforces | jaroslavurban/normal/1407/D.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
//#define int ll
//#define endl '\n'
// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use... | ALGO | 0.999947 | 4.416861 |
b8321cf8-8cd8-4821-87ef-bbae3cee5392 | 123pk/100DaysCodingChallenege | Day43/Add two numbers.cpp | /*
Platform :- Leetcode
Problem :- Add two numbers
Approach :- traverse through the linked lists given and maintain a variable remainder which will be added to the numbers accordingly
*/
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode*temp=l1,*temp2=l2,*head=NULL,*t... | ALGO | 0.999974 | 6.378411 |
36fd0d71-401e-48fd-80ed-205e58b759f0 | LuJianBuPing/LeetCode | LeetCode/P089.cpp | #include "LeetCode.h"
class Solution {
public:
vector<int> grayCode(int n) {
vector<int> result = { 0 };
for (int i = 1; i <= n; ++i)
{
int size = result.size();
int x = 1 << (i - 1);
for (int j = size - 1; j >= 0; --j)
result.push_back(x | result[j]);
}
return result;
}
}; | ALGO | 0.999815 | 6.220188 |
d8b0065e-7ce6-4f50-8dbf-ad6939baf03f | choiyounji/algorithm | 프로그래머스/2/42577. 전화번호 목록/전화번호 목록.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool solution(vector<string> phone_book) {
bool answer = true;
//1.정렬
sort(phone_book.begin(), phone_book.end());
//2.접두어인지 확인
for(int i=0;i<phone_book.size()-1;i++){
if(phone_book[i+1].find(phone_book[i])==0)
... | ALGO | 0.999795 | 5.009017 |
907fa7a4-ef68-40e0-b85b-3f8903e2766d | ducthangbui/Learning | Btap/SPOJ/PTIT138A.cpp | #include<iostream>
using namespace std;
main()
{
int a,b,c;
while(1)
{
cin>>a>>b>>c;
if(a==0||b==0||c==0) break;
if(a*a+b*b==c*c||a*a+c*c==b*b||c*c+b*b==a*a) cout<<"right"<<endl;
else cout<<"wrong"<<endl;
}
}
| ALGO | 0.99991 | 3.363886 |
2facd5ac-5f70-46ff-8f6a-133c9af30202 | KSP-07/LeetCode-Questions | Find Maximum Equal sum of Three Stacks - GFG/find-maximum-equal-sum-of-three-stacks.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
int maxEqualSum(int N1,int N2,int N3,vector<int> &S1,vector<int> &S2,vector<int> &S3){
//teeno stacks ka sum leke, max sum wale se... | ALGO | 0.999946 | 5.444053 |
9aaa5186-1a7b-4251-81d7-ed65a376fa20 | truong0812/CTDLVGT-PTIT | tichmaxmin.cpp | #include <bits/stdc++.h>
using namespace std;
main()
{
int t;cin >> t;
while(t--)
{
long max=-10e8+5,min=10e8+5;
int n,m;cin >> n >> m;
long x;
for(int i=0;i <n;i++)
{
cin >> x;
if(max < x) max = x;
}
for(int i=0;i <m;i++)
... | ALGO | 0.999988 | 3.161345 |
49cf664e-aa80-4edd-980a-806bde1494e6 | vibek01/Advanced_DSA_Topic_Q-A-s | GREEDY_ALGOS/gas_station.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> gas(n), cost(n);
for (int i = 0; i < n; i++) {
cin >> gas[i];
}
for (int i = 0; i < n; i++) {
cin >> cost[i];
}
int start = 0;
int totalSurplus = 0;
int currentSurplus = 0;
... | ALGO | 0.999941 | 5.030909 |
908e5e43-13ea-47cc-b571-ef23492769a0 | shudhanshu435/LeetCode | 202-happy-number/202-happy-number.cpp | class Solution {
public:
bool isHappy(int n){
long long int sum=0,count=0,m=1;
while(m<100)
{
int t=n%10;
sum=sum+(t*t);
n/=10;
if(n==0)
{
n=sum;
sum=0;
if(n==1)return 1;
... | ALGO | 0.999983 | 5.582088 |
1b38dd2f-6261-4ebb-9c7b-5d165d4cb531 | JessicaSt0ne/bserv-main | dependencies/cryptopp/TestPrograms/test_x86_via_sha.cpp | // TODO: cut-in xsha1
#include <cstdlib>
int main(int argc, char* argv[])
{
unsigned int msr=0;
unsigned int divisor=2;
unsigned int buffer;
__asm__ __volatile__
(
#if defined(__x86_64__) || defined(__amd64__)
"mov %1, %%rdi ;\n"
"movl %2, %%edx ;\n"
#else
... | TOOL | 0.850023 | 4.57551 |
bd910acd-5310-49ea-82b9-8c590344c44f | azade1/ABM-project | PhysiCell/modules/PhysiCell_POV.cpp | /*
*/
#include "./PhysiCell_POV.h"
using namespace BioFVM;
Clipping_Plane::Clipping_Plane()
{
normal = {0,-1,0};
point_on_plane = {0,0,0};
coefficients.resize(4,0.0);
for( int i=0; i < 3 ; i++ )
{ coefficients[i] = normal[i]; }
for( int i=0; i < 3 ; i++ )
{
coefficients[3] -= ( normal[i]*point_on_pl... | TOOL | 0.936945 | 5.86791 |
59243dc6-6a33-4af6-ac09-815bc0db6cb4 | shubham21699/My-LeetCode-Solutions | 2455-average-value-of-even-numbers-that-are-divisible-by-three/2455-average-value-of-even-numbers-that-are-divisible-by-three.cpp | class Solution {
public:
int averageValue(vector<int>& nums) {
int n = nums.size();
int sum = 0;
int countEle = 0;
for(int i=0 ; i<n ; i++) {
if(nums[i] % 6 == 0) {
sum += nums[i];
countEle++;
}
}
... | ALGO | 0.999676 | 6.011695 |
1d3eae60-c059-44e2-9f45-ae025c8d4053 | wqrqwerqrw/Lerica | lyd/0x3A博弈论之SG函数/hdu1847.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
while(cin>>n){
puts(n%3?"Kiki":"Cici");
}
}
| ALGO | 0.999162 | 3.562366 |
802e21f0-b9c0-4744-bd0a-66b0fdf3276d | ritwikranjan/ImportantCodes | oops_complex.cpp | #include<iostream>
using namespace std;
class complex_no
{
int real;
int img;
public:
complex_no()
{
real = 0;
img = 0;
}
complex_no(const int r, const int i)
{
real = r;
img = i;
}
void setReal(const int r)
{
real = r;
}
void se... | ALGO | 0.886925 | 3.587871 |
0ed8d7f2-5a80-4928-9b79-2d1467a82d13 | tamirgrBGU/EngineForAnimationCourse | igl/massmatrix_intrinsic.cpp | template <typename Derivedl, typename DerivedF, typename Scalar>
IGL_INLINE void igl::massmatrix_intrinsic(
const Eigen::MatrixBase<Derivedl> & l,
const Eigen::MatrixBase<DerivedF> & F,
const MassMatrixType type,
Eigen::SparseMatrix<Scalar>& M)
{
const int n = F.maxCoeff()+1;
return massmatrix_intrinsic(l... | ALGO | 0.995351 | 6.212024 |
704a45b0-32dd-47ae-90f1-aca8fa9b001b | Prubdeep/Strath24 | dowhileloop excercise 3.cpp | #include <iostream>
using namespace std;
int main() {
int number;
int sum = 0;
cout << "Enter integers to sum (enter 0 to stop):" << endl;
do {
cin >> number;
sum += number;
} while (number != 0); // Continue until the user enters 0
cout << "The total sum is: " << sum << ... | ALGO | 0.993403 | 5.159465 |
d4ff3396-ba66-4b93-82b5-445987368ec8 | Pulakesh5/_DSA_ | FEBRUARY 24/01 February/Panagram Checking gfg.cpp | class Solution
{
public:
//Function to check if a string is Pangram or not.
bool checkPangram (string s) {
// your code here
vector<bool> present(26, false);
int len = s.size();
for(int i=0; i<len; i++)
{
if(isalpha(s[i]))
{
if(s[... | ALGO | 0.999695 | 5.619993 |
960f6a98-e29b-4b5c-9951-4576ea4673fc | sarvex/leetcode-giz | solution/0100-0199/0116.Populating Next Right Pointers in Each Node/Solution.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999946 | 6.030411 |
fd23d3f9-146e-4349-b79b-199d455347b3 | mapu/toolchains | llvm-3.8.0-r267675/lib/CodeGen/CalcSpillWeights.cpp | #include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "l... | ALGO | 0.986912 | 7.797811 |
7341b502-8364-4e58-8b95-fa4f4e2d3a8d | arin2002/Hacktoberfest-2022 | C++/Algorithms/hashing.cpp | // Hashing help us to count the frequency of an element in the array in time complexity of O(N). so this is
// an efficient method for calculating the frequency of an element in array
#include<bits/stdc++.h>
using namespace std;
const long long int M=1e5+5;
int main(){
int n; //size of the array
cin>>n;
int a[n];
int... | ALGO | 0.99998 | 5.44185 |
b989788d-abff-4010-a47f-c6ff87259157 | ArtiGaund/Leetcode | 0837-new-21-game/0837-new-21-game.cpp | class Solution {
public:
double new21Game(int n, int k, int maxPts) {
vector<double> dp(n + 1);
dp[0] = 1;
double s = k > 0 ? 1 : 0;
for (int i = 1; i <= n; i++) {
dp[i] = s / maxPts;
if (i < k) {
s += dp[i];
}
if (i - ... | ALGO | 0.99992 | 4.633114 |
7c7956a3-cddd-4764-8c09-60f5e897a713 | petarjukic/OOP_vjezbe | Vjezba3/vjezba3zad1.cpp | #include<iostream>
#include<vector>
using namespace std;
void trazenje(vector<int> vek, int& min, int& max)
{
min = vek[0];
max = vek[0];
vector<int>::iterator it;
vector<int>::iterator it2 = vek.end() - 1;
for (it = vek.begin(); it < it2; it++, it2--) {
if (min > * it) {
min = *it;
}
if (max < *it)... | ALGO | 0.999617 | 4.223232 |
258b60e6-4cb0-43ab-b7cb-c0b3c7d16558 | haokai-xuan/Competitive-Programming | CCC/2005/Senior/MouseMove.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int c, r;
cin >> c >> r;
pair<int, int> motion;
cin >> motion.first >> motion.second;
pair<int, int> pos = {0, 0};
while (motion != make_pair(0, 0))
{
if (pos.first + mo... | ALGO | 0.999928 | 3.052872 |
67d05c27-8e18-4e51-a09d-8ed16cd78c8d | claraaqwq/ALGORITMIA | TEMAS/Divide Y Venceras/Lab3_2022-2(PESOS).cpp | #include <iostream>
#define MAXDIAS 30
#include <fstream>
using namespace std;
//USO DIVIDE Y VENCERAS
void merge(int A[], int inicial, int medio, int final){
int longitud1, longitud2, i, p, q;
//Al lado izq tengo x elementos
longitud1=(medio+1)-inicial;//primera mitad del arreglo
//Al lado der tengo x elementos... | ALGO | 0.99953 | 3.378425 |
0af2075a-bd52-4020-96d1-40680a582676 | chenfu-user/racecar | src/robot_localization/src/filter_base.cpp | #include "robot_localization/filter_base.h"
#include "robot_localization/filter_common.h"
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>
#include <vector>
namespace RobotLocalization
{
FilterBase::FilterBase() :
accelerationGains_(TWIST_SIZE, 0.0),
accelerationLimits_(TWIST_SIZE... | TOOL | 0.966946 | 7.229558 |
df9e82f2-2d41-4f48-80bc-eaf403ce3dcb | ashanka234/DS_and_algo | Dynamic_programming/longest_palindrome_subseq.cpp | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int lps(char *str, int i, int j)
{
//only 1 char
if(i==j)
{
return 1;
}
//2 chars
if(i==j-1)
{
if(str[i] == str[j]) //both are same
{
return 2;
}
else ... | ALGO | 0.999898 | 4.17881 |
986214ff-511d-4d98-bf95-b151525128de | Yaro2709/AlgoProblems | 4/1452A.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
int x, y;
cin >> x >> y;
if (x == y) {
cout << y + x << endl;
}
else {
cout << (max(x, y) * 2) - 1 << endl;
}
}
return 0;
} | ALGO | 0.999643 | 4.334653 |
45ad76e1-3133-44ed-89e7-485611a5e0e4 | amounach42/CPP_Modules | mergeSort.cpp | #include <iostream>
#include <string>
#include <vector>
#include <deque>
#include "PmergeMe.hpp"
PmergeMe::PmergeMe()
{}
PmergeMe::~PmergeMe()
{
}
void PmergeMe::insertionSortDeque(std::deque<int> &deque)
{
for (std::deque<int>::iterator it = deque.begin(); it < deque.end(); it++)
{
std::deque<int>::... | ALGO | 0.999061 | 5.356905 |
4c455bc8-ff01-4df1-8fe8-ff16bd526dd0 | ghulammurtaza-id/Object-Oriented-Programming | OOP Lab Tasks/Lab Task 7/HW Question no 3.cpp | #include <bits/stdc++.h>
using namespace std;
class BigInteger{
private:
vector<int>digits;
bool isNegative;
void normalize() {
while (digits.size() > 1&& digits.back() ==0) {
digits.pop_back();
}
if (digits.empty()){
digits.push_back(0);
isNegative... | ALGO | 0.998985 | 4.877083 |
48de1ff8-6bf2-4009-8924-d8a0fbc4b5ed | satyam94/coding | cpp/IOPC 2013/save the princess.cpp | #include<cstdio>
using namespace std;
void array(long long k[],long long x[3]);
long long distance(long long[],long long[]);
int main()
{
long long t;
scanf("%lld",&t);
while(t--)
{
long long n;
scanf("%lld",&n);
long long a[n][3],ans[n];
for(long long i=0;i<n;i++)
... | ALGO | 0.999725 | 3.644581 |
4a0159f1-86e3-4d50-9b3e-1dfb6d9e69f8 | vimalprogrammer/Python-TQ | TwoSum2.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int,int>mp;
for(int i=0;i<nums.size();i++)
{
int val=target-nums[i];
if(mp.find(val)!=mp.end())
return {mp... | ALGO | 0.999921 | 5.791438 |
788c5f27-3a58-46bb-9420-0373604ffcc6 | tfg1434/cp | Codeforces/1516B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define IN(A, B, C) assert(B <= A && A <= C)
constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9;
constexpr ll INFF = 1e18;
int main() {
ios::sync_with_stdio(0);
c... | ALGO | 0.999946 | 5.143777 |
33190c80-07a8-4798-99fa-9a9f5a2c9c91 | geekygirl8/Hacktoberfest_2022_DSA | C++/C++/find-winner-on-a-tic-tac-toe-game.cpp | // Time: O(1)
// Space: O(1)
class Solution {
public:
string tictactoe(vector<vector<int>>& moves) {
vector<vector<int>> row(2, vector<int>(3));
vector<vector<int>> col(2, vector<int>(3));
vector<int> diag(2), anti_diag(2);
int p = 0;
for (const auto& move : moves) {
... | ALGO | 0.999818 | 6.771821 |
67bac9d1-4118-4f30-a5f3-a82802884654 | Eromoleon/Gruppe-6 | main.cpp | #include "opencv2/imgcodecs.hpp"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <vector>
#include <math.h>
#include <iostream>
using namespace cv;
//using namespace std;
//typedefs:
#include <iostream>
class SolutionElement
{
public:
Solu... | ALGO | 0.996812 | 4.276396 |
4df21319-4baf-4bab-841b-011bdd5e8c4e | LiyangTseng/AOOP-Final-Project | 1/1/longestpair.cpp | #include "longestpair.h"
#include <iostream>
#include <math.h>
#include <string>
#include <sstream>
#include <math.h>
#include <vector>
#include <iomanip>
using namespace std;
LongestPair::LongestPair()
{
}
string LongestPair::solve(string s){
stringstream ss;
ss<<s;
double x,y,z;
int counter = 0;
... | ALGO | 0.998737 | 3.640544 |
9b52e523-6540-4adf-b6df-de99401505eb | fengzhiwei1288/MCCS-PPI | jdock-src/src/array.cpp | #include <cmath>
#include <cassert>
#include "array.hpp"
//! Returns true if the absolute difference between a scalar and zero is within the constant tolerance.
inline bool zero(const double a)
{
return fabs(a) < 1e-4;
}
//! Returns true if the absolute difference between two scalars is within the constant tolerance... | TOOL | 0.963775 | 5.862569 |
b8cd9a10-e307-417f-bf76-7a73a9da495c | hibi6toshi/algo | aoj/n3.cpp | #include <iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main() {
double n;
while(cin>>n&&n!=0.0){
double s[1000],m=0.0;for(int i=0;i<n;i++)cin>>s[i],m+=s[i];
m/=n;
double a=0;for(int i=0;i<n;i++)a+=(s[i]-m)*(s[i]-m);
a/=n;
cout<<fixed<<setprecision(5)<<sqrt(a)<<endl;
}
return 0;
}
| ALGO | 0.999178 | 3.199122 |
f4b3701a-fb4f-42b9-aa9f-96eff6c88cee | IMIdealDragon/algorithm-learning | acwing/High precision subtraction.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
bool cmp(vector<int>& A, vector<int>& B)
{
if(A.size() != B.size()) return A.size() > B.size();
for(int i = A.size() - 1; i >= 0; i--)
if(A[i] != B[i])
return A[i] > B[i];
return true; // 这种情况属于两者相等... | ALGO | 0.999989 | 3.803466 |
279d6749-17ce-4b6c-afd4-bbe180bfa229 | Maxinne02/heraa | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998764 | 6.762122 |
0da673a7-9b15-47a4-972e-a1a194f1357f | andrew-crabb/recon | unused/DetectorControl/Util_GUI/remove_dnl.cpp | #include "remove_dnl.h"
#include "find_peak_1d.h"
void remove_dnl(long in[PP_SIZE], double out[PP_SIZE])
{
// local variables
long i = 0;
long j = 0;
long index = 0;
long Line_X[PP_SIZE_X];
long Line_Y[PP_SIZE_Y];
double Filter_X[PP_SIZE_X];
double Filter_Y[PP_SIZE_Y];
// initialize
for (j = 0 ; j < PP_SI... | ALGO | 0.974281 | 4.001615 |
d92de286-f174-4546-9198-b3018ea629b4 | ishandutta2007/codeforces | vladprog/normal/1131/D.cpp | #ifdef ONLINE_JUDGE
#pragma GCC optimize("O3")
#endif // ONLINE_JUDGE
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
#ifndef ONLINE_JUDGE
#define DEBUG
#endif
#ifdef DEBUG
#define IFD(...) __VA_ARGS__
#define IFN(...)
#define L cout<<__LINE__<<"\n";
#defi... | ALGO | 0.999999 | 3.205041 |
dc8a22f0-7a14-4cef-a424-2eecf2fcc3e9 | Ritika-jain27/DSA-Cpp | Arrays/maxSubarraySum.cpp | #include<iostream>
#include<climits>
using namespace std;
int main(){
int n;
cout<<"Enter the size of array: ";
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cout<<"Enter "<<i+1<<"th element of array :";
cin>>arr[i];
}
int currsum[n+1];
currsum[0]=0;
for(int i=1;i<=n;i++)
{
currsum[i]=currsum[i-1] + arr[i-1]... | ALGO | 0.99942 | 3.744408 |
e00b1251-02df-4399-a786-a3602afd14f7 | dsitum/matasano-crypto-challenges | Grupa 1/1.4/1.4.cpp | #include <iostream>
#include <cmath>
#include <fstream>
#include "..\Message.h"
using namespace std;
//function for scoring a piece of English plaintext
float CalculateScore(string message)
{
const int TESTED_CHARACTERS_NUM = 26;
struct CharacterFrequency
{
char c; // character
float f; /... | ALGO | 0.998694 | 4.411085 |
07414c44-ba89-4272-8e2c-6b824a442b66 | Natansh14687/rocking_CPP | StartingC++/Recursion/printNTo1.cpp | #include<bits/stdc++.h>
using namespace std;
void print(int n){
if(n==0) return;
cout << n << "\n";
print(n-1);
}
int main(){
int n;
cin >> n;
print(n);
return 0;
}
| ALGO | 0.999929 | 4.38772 |
7ae849ad-c690-4c1c-bf6e-cbcc19911b66 | merhawi212/CPP_Modules | CPP08/ex01/Span.cpp | #include "Span.hpp"
Span::Span(){}
Span::~Span(){}
Span::Span(const unsigned int size): _maxCapacity(size)
{
}
Span::Span(const Span & src){
*this = src;
}
Span &Span::operator =(const Span & other){
if (this != &other){
this->_maxCapacity = other._maxCapacity;
this->_numbers = other._numbers;
}
return ... | ALGO | 0.90316 | 4.705 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.