uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0e8e79ac-56c0-4d00-895c-60a77177536c | NirobNabil/CP | CF_contest/1399/D.cpp | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
int main(){
int t, n, h, hi, a[(int)2e5], e[(int)2e5];
char s[(int)2e5];
// list<int> b;
set<int> is[2];
vector<vector<int> > c;
vector<int> d;
scanf("%d", &t);
while(t--){
hi=0;
c.clear();
is[0].clear();
is[1].clear();
// b.clear... | ALGO | 0.99989 | 3.466522 |
965ae283-fa33-4f3a-8cb2-c30210db5051 | 1gpm1/lab6.2.1 | lab6.2.1.cpp | #include <iostream>
#include <iomanip>
#include <conio.h>
#include <cstdlib>
#include <ctime>
using namespace std;
void CreateArray(int* a, const int n, int Low, int High)
{
for (int i = 0; i < n; i++)
{
a[i] = Low + rand() % (High - Low + 1);
}
}
void PrintArray(int* a, const int n)
{
for (int i = 0; i < n; i... | ALGO | 0.99902 | 3.736012 |
3103d538-4f1b-4eeb-853c-cd83138321ae | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/13/32/18.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <stdint.h>
#include <map>
#include <queue>
typedef int64_t ll;
using namespace std;
typedef pair < ll, ll > pos;
ll dx[] = {1, -1, 0, 0};
ll dy[] = {0, 0, 1, -1};
string directions[] = {"E", "W", "N", "S"};
string solve() {
ll... | ALGO | 0.999997 | 4.890286 |
bfefe3cf-dc83-4a23-9b3e-0d727ada9460 | splodster/codeforces-problemsets | 800/339A-Helpful-Maths.cpp | // 339A - Helpful Maths - Difficulty: 800
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
string s;
int array[100], count(0);
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] != '+') {
array[count] = s[i] - '0'; // convert char to int
... | ALGO | 0.999965 | 4.447413 |
f5c59b85-73fd-4ca0-8678-d96ee2d7863a | Forkteam/bai-tap-lap-trinh-C | NhapMonLapTrinhC/134.cpp | #include <stdio.h>
#include <conio.h>
void kiemTraNhap(int &n)
{
do
{
printf ("Nhap vao so luong phan tu mang phai lon hon 0: ");
scanf ("%d", &n);
}while(n < 0);
}
void nhapMang(int a[], int n)
{
for (int i = 0; i < n; i++)
{
printf ("a[%d] = ", i);
scanf ("%d", &a[i]);
}
}
int Max(int a[], int n)
{
in... | ALGO | 0.998678 | 3.271621 |
20123e61-3160-4230-bc22-851c2a35e602 | sejong-algorithm/Study | Jung-jaeho/짝지어제거.cpp | #include <iostream>
#include<string>
#include <stack>
using namespace std;
//스택을 활용하여 같은 것이 있으면 팝을 하고 같은것이 없으면 계속 넣는 형식으로 구현한다.
int solution(string s)
{
int answer = 0;
stack<char> stk;
stk.push(s[0]);
for(int i = 1 ; i < s.length(); i++)
{
if(stk.empty())
{
stk.pu... | ALGO | 0.99995 | 4.825657 |
dbff3ef2-804d-42b4-9269-be0ddd26ed86 | JunnKyuu/OOP_cpp | lecture/221129/remove.cpp | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int l[] = {1,2,3,4};
int* NewEnd = remove(l +0, l +4, 3);
cout << (NewEnd - l) << endl;
for(int e : l) {
cout << e << endl;
}
} | ALGO | 0.978732 | 3.85806 |
2edd68da-7ac6-48bf-8deb-d3758dca3f55 | BIT-zhangxin/AlogrithmLearning | 做题/实验一 样例.cpp | //#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <algorithm>
//#include <queue>
//#include <stack>
//using namespace std;
//const int INF = 0x7fffffff;
//
//int op;
//
//struct node {
// int pid;//̺
// int come;//̵ʱ
// int run;//ʱ
// int pri;//ȼ
// int rt;//ʱƬ
//}
//tmp;
//int cnt... | ALGO | 0.999661 | 3.213397 |
dfd16d03-a8b5-4e31-b66b-5c2f86569c4c | sarvex/leetcode-rockstar | solution/2000-2099/2017.Grid Game/Solution.cpp | using ll = long long;
class Solution {
public:
long long gridGame(vector<vector<int>>& grid) {
ll ans = LONG_MAX;
int n = grid[0].size();
ll s1 = 0, s2 = 0;
for (int& v : grid[0]) s1 += v;
for (int j = 0; j < n; ++j) {
s1 -= grid[0][j];
ans = min(ans,... | ALGO | 0.999985 | 5.543633 |
3ab64cfc-4dfb-4b78-9134-920db4f21a77 | tnqkr98/Algorithm-Study | BeakjoonOnlineJudge/baek10159(저울).cpp | #include <iostream>
#include <vector>
#include <climits>
#define INF INT_MAX
using namespace std;
long long d[101][101],n;
void floyd() {
for (int m = 1; m <= n; m++)
for(int s=1;s<=n;s++)
for (int e = 1; e <= n; e++)
if (d[s][e] > d[s][m] + d[m][e])
d[s][e] = d[s][m] + d[m][e];
}
int main() {
int m;... | ALGO | 0.999758 | 3.835026 |
863f5947-6c82-49bb-8cc0-135b59799f44 | Jay-Ppark/Algorithm | 14888_연산자끼워넣기.cpp | #include<iostream>
using namespace std;
int N;
int num[11];
int opnum[4];
int opchosen[11];
int maxnum=-1000000000;
int minnum=1000000000;
int cal(){
int result=num[0];
for(int i=0;i<N-1;i++){
if(opchosen[i]==0){
result=result+num[i+1];
}
else if(opchosen[i]==1){
result=result-num[i+1];
}
else if(opch... | ALGO | 0.999988 | 3.584432 |
ca1df0f0-5797-469b-b6d0-d235ee0be94c | sadiqur11210120595/Agri_Final25 | 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.998799 | 6.776823 |
5a290fe7-d8d6-4712-bedf-2774c3f47b7c | sonvule59/CUDA_and_OpenMP | weakLLM_openMP_examples/hpc_coder_OpenMP_Translated_p00001/s001061911_omp_fixed.cpp | #include <iostream>
#include <omp.h>
using namespace std;
int main() {
const int len = 10;
int arr[len];
for (int i = 0; i < len; i++)
cin >> arr[i];
bool swapped;
for (int i = 0; i < len - 1; i++) {
swapped = false;
#pragma omp parallel for
for (int j = 0; j < len... | ALGO | 0.999988 | 4.714377 |
383b61bc-ed3f-46fa-8dad-e0ff51768b16 | Slijeff/cs639 | hw3/Reductions.cpp | #include "Reductions.h"
#include <algorithm>
#include <mkl.h>
float Norm(const float (&x)[XDIM][YDIM][ZDIM])
{
float result = 0.;
int index = cblas_isamax (XDIM * YDIM * ZDIM, &x[0][0][0], 1);
result = x[index / (YDIM * ZDIM)][(index / ZDIM) % YDIM][index % ZDIM];
return std::abs(result);
}
float I... | ALGO | 0.996532 | 4.808778 |
f85d1199-4a42-4932-87ae-f0ddc662d565 | ordinary-developer/education | cpp/std-17/s_roth-clean_cpp/ch_06-object_orientation/01-liskov_substitution_principle/main.cpp | #include <memory>
#include <vector>
#include <iostream>
namespace example01 {
class Point final {
public:
Point() : x_{5}, y_{5} {}
Point(unsigned int const x, unsigned int const y)
: x_{x}, y_{y} {}
void setCoordinates(unsigned int const x, unsigned int const y) {
... | TOOL | 0.862124 | 5.17405 |
3b383cd2-3c69-4d1a-b687-19bba3bc919f | harinyoo/BAEKJOON | StepByStep/C++/Step 06/3052.cpp | #include <iostream>
using namespace std;
int main() {
int arr[10];
int remainder[10];
int cnt[42] = {0};
int ans = 0;
for(int i=0; i<10; i++) {
cin >> arr[i];
remainder[i] = arr[i] % 42;
}
for(int j=0; j<10; j++) {
for(int k=0; k<42; k++) {
if (remainde... | ALGO | 0.999735 | 3.627837 |
2a0da93d-a568-48de-b316-6cbcaf3a964f | dzhang1024/CodingChallenges | LeetCode/excelSheetNumber.cpp | class Solution {
public:
int titleToNumber(string s) {
int res = 0;
for(char c: s){
res = (res * 26) + (c - 'A' + 1);
}
return res;
}
}; | ALGO | 0.999953 | 6.469557 |
9818080d-d1b1-4ff6-a3a6-35197e91e304 | motokimura/AsteroidTracker | eigen-eigen-6b38706d90a9/doc/examples/Tutorial_ArrayClass_accessors.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf m(2,2);
// assign some values coefficient by coefficient
m(0,0) = 1.0; m(0,1) = 2.0;
m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0);
// print values to standard output
cout << m << endl << endl;
... | ALGO | 0.984093 | 3.536336 |
9d950a5c-dd81-4750-b1ee-e6ed4be44f0d | whynesspower/leetcode | Tree from Postorder and Inorder - GFG/tree-from-postorder-and-inorder.cpp | // { Driver Code Starts
/* program to construct tree using inorder and postorder traversals */
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct Node {
int data;
struct Node* left;
struct Node* right;
Node(int ... | ALGO | 0.999785 | 6.37977 |
bab405d7-8d6f-4b2e-a703-bcf11897fb44 | nirjhorJU/Data-Structure-and-Algorithms | Graph Theory/BFS_(2_D_grid).cpp | #include<bits/stdc++.h>
using namespace std;
int n,vis[15][15];
int dx[]= {2,2,1,1,-1,-1,-2,-2};
int dy[]= {1,-1,2,-2,2,-2,1,-1};
char a[5],b[5];
queue<int>q;
void bfs(int s,int e)
{
memset(vis,-1,sizeof(vis));
int x,y,xx,yy;
q.push(s);
q.push(e);
vis[s][e]=0;
while(!q.empty())
{
x=q... | ALGO | 0.999764 | 4.088954 |
03968aa4-8605-42ce-831b-795a93ed430c | ishandutta2007/codeforces | rajat1603/normal/568/B.cpp | #include "bits/stdc++.h"
using namespace std;
const int N = 4005;
const int mod = 1e9 + 7;
int n;
int pascal[N][N] = {0};
int bell[N] = {0};
int ans = 0;
void pre(){
pascal[0][0] = 1;
pascal[1][0] = 1;
pascal[1][1] = 1;
for(int i = 2 ; i <= n ; ++i){
pascal[i][0] = 1;
for(int j = 1 ; j <... | ALGO | 0.999991 | 4.846035 |
71bbd79f-5ef0-4181-b544-cc4db50cb749 | yfarge/algorithms | solutions/leetcode/time-based-key-value-store/main.cpp | #include <string>
#include <unordered_map>
#include <vector>
using namespace std;
class TimeMap {
private:
unordered_map<string, vector<pair<int, string>>> d;
public:
TimeMap() {}
void set(string key, string value, int timestamp) {
d[key].push_back({timestamp, value});
}
string get(string key, int ti... | ALGO | 0.995086 | 7.261495 |
c81fed0d-8afb-4d86-a971-1ca0a3e58083 | adarsh1722/Daily-Problems | Merge k Sorted Arrays - GFG/merge-k-sorted-arrays.cpp | // { Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
#define N 105
using namespace std;
void printArray(vector<int> arr, int size)
{
for (int i=0; i < size; i++)
cout << arr[i] << " ";
}
// } Driver Code Ends
//User function Template for C++
#define pii pair<int , pair<int , int>>
class Solut... | ALGO | 0.999463 | 4.814034 |
1ca01565-7635-4efe-9b83-dc0aa4be4ff0 | odysa/ICPCCompetitionCodes | modui.cpp | #include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cstdio>
#include<cmath>
#define maxn 100000
#define size 1000010
using namespace std;
int tmp;
struct node
{
int l,r,id;
friend bool operator < (node a,node b){ return a.l/tmp==b.l/tmp?a.r<b.r:a.l<b.l;}
}query[size];
int cnt[size],ans... | ALGO | 0.999944 | 3.505863 |
352986fc-67ac-40c0-9b22-5b736c30a379 | Franky03/C-CPP | C++/relatorio2.cpp | #include <iostream>
#include <string>
#include <cstring>
using namespace std;
typedef struct {
char descricao[50];
float peso;
char tipo;
} Movel;
int main(void){
int nMoveis;
cin >> nMoveis;
Movel moveis[nMoveis];
for(int i=0; i< nMoveis; i++){
cin.ignore();
cin.getl... | TOOL | 0.94063 | 3.966573 |
466224de-26cc-4bec-b51d-eea5ae090a2a | HuangDDU/hzy_algorithm | leetcode/top100/70.最小栈(155)/ref.cpp | #include <iostream>
#include <map>
#include <stack>
using namespace std;
class MinStack {
public:
stack<int> st; // 普通栈
stack<int> min_st; // 最小栈
MinStack() {
min_st.push(INT_MAX); // 最小栈栈底元素,方便push时的逻辑
}
void push(int val) {
st.push(val);
min_st.push(min(val, min_st.top()));
}
void po... | ALGO | 0.999653 | 5.646321 |
0c9a598b-2141-4796-8973-f8a19258643c | BernardoKrause/estudos-metodos-de-otimizacao | P1/mochila-multipla/cobertura-localizacao/main.cpp | #include "cabecalho.h"
void ler_dados (const char* arq) {
FILE* f = fopen(arq, "r");
fscanf(f, "%d %d", &num_dem, &num_loc);
for (int i = 0; i < num_dem; i++) {
for (int j = 0; j < num_loc; j++) {
fscanf(f, "%d", &mat_cob[i][j]);
}
}
for (int i = 0; i < num_loc; i ++) ... | ALGO | 0.988973 | 3.73686 |
3cc603bf-1874-456d-8634-df6163c09df3 | flowerinheart/acm | interview/array/1_lc_longest_substr.cpp | //leetcode 3. Longest Substring Without Ryyepeating Characters
static int fast_io = []() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
return 0;
}();
class Solution {
public:
int lengthOfLongestSubstring(string s) {
int pre[128];
std::fill_n(pre, 128, -1);
int res = 0, ... | ALGO | 0.999869 | 5.418753 |
f174022e-75f4-4541-9c7d-6dc364c7d9f0 | date3k2/Programming | C++/woeful_per.cpp | #include <bits/stdc++.h>
#define fo(i,l,h) for(int i=l;i<=h;++i)
#define ll long long
using namespace std;
int t;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>t;
while (t--)
{
int n;
cin>>n;
if (n%2==1)
{
cout<<1<<" ";
for(int i=2;i<=n;i+=2) cout<<i+1<<" "<<i<<" ";
}
... | ALGO | 0.999711 | 4.054707 |
62f2e601-cefe-4047-b3f7-c4691e81bf6f | khamkaradinath/Cpp-codes | addingString.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string num1;
string num2;
cin>>num1;
cin>>num2;
int x=stoi(num1);
int y=stoi(num2);
int sum=x+y;
string s=to_string(sum);
cout<<(s);
} | ALGO | 0.998873 | 4.681937 |
0c0f3dbb-bbeb-4fb0-bf4e-d9ba4505fe27 | prajogotio/spoj | LISA/a.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long Long;
Long inf = (Long) 1e18;
Long dp[103][103];
Long a[103];
int op[103]; //0:+, 1:*
Long rec(int i, int j, int st){
if(i == j) return a[i];
if(i+1 == j) {
if(op[i] == 0){
return a[i] + a[j];... | ALGO | 0.999926 | 3.352349 |
c95770f9-f634-4c9b-b765-60673a9b8224 | 7uyash/leetcode | 3468-find-the-encrypted-string/find-the-encrypted-string.cpp | class Solution {
public:
string getEncryptedString(string s, int k) {
int n = s.length();
string ans=s;
for(int i=0;i<n; i++){
ans[i]=s[(i+k)%n];
}
return ans;
}
}; | ALGO | 0.999946 | 5.524624 |
71662cbc-a8ec-45b9-8497-c81c19d1e94f | bytendpixel/Leetcode-Solution | Binary Tree Cameras.cpp | class Solution {
public:
#define NO_CAMERA 0
#define HAS_CAMERA 2
#define NOT_NEEDED 1
int ans = 0;
int dfs(TreeNode *root) {
if (!root) return NOT_NEEDED;
int l = dfs(root->left);
int r = dfs(root->right);
if (l == NO_CAMERA || r == NO_CAMERA) {
... | ALGO | 0.99984 | 6.562092 |
d7724602-377a-400c-89bb-8212d36ed54e | WolfRichard/meshlet-lod | thirdparty/meshoptimizer/demo/nanite.cpp | // This is a playground for experimenting with algorithms necessary for Nanite like hierarchical clustering
// The code is not optimized, not robust, and not intended for production use.
// It optionally supports METIS for clustering and partitioning, with an eventual goal of removing this code
// in favor of meshopt a... | ALGO | 0.998097 | 3.447703 |
3ae22af7-988f-4bef-8dd5-3d5be1488ff7 | svemuri9/svemuri9-LeetcodePractice | 3483-alternating-groups-ii/alternating-groups-ii.cpp | class Solution {
public:
int numberOfAlternatingGroups(vector<int>& colors, int k) {
colors.insert(colors.end(), colors.begin(), colors.begin() + k);
int n = colors.size();
if (k > n)
return 0;
int cnt = 0;
int ans = 0;
for (int i = 1; i < n; i++) {
... | ALGO | 0.999921 | 5.930312 |
54d1ff71-904f-4a00-99f6-252abc69ff08 | Aurialedge/DSA | 02_Functions/07_recursion.cpp | #include<iostream>
using namespace std;
int factorial(int n) {
if (n == 0) return 1;
return n * factorial(n - 1);
}
int main() {
cout << factorial(5); // 120
}
| ALGO | 0.99927 | 5.111268 |
62e8964d-c32d-40f6-8d9f-149690c61190 | sraihan73/Lucene- | spatial-extras/src/java/org/apache/lucene/spatial/composite/CompositeSpatialStrategy.cpp | using namespace std;
#include "CompositeSpatialStrategy.h"
namespace org::apache::lucene::spatial::composite
{
using Field = org::apache::lucene::document::Field;
using DoubleValuesSource = org::apache::lucene::search::DoubleValuesSource;
using Query = org::apache::lucene::search::Query;
using SpatialStrategy = org::... | ALGO | 0.972746 | 7.75246 |
4804b186-7b64-4b19-bffe-eaa477e67cb7 | Cam-Duc-Le/Data-structure-Algorithm | ass2-p1-DSA/submission.cpp | template <class K, class V>
class BKUTree {
public:
class AVLTree;
class SplayTree;
class Entry {
public:
K key;
V value;
int link;
Entry(K key, V value) : key(key), value(value) , link(0) {}
friend class SplayTree;
friend class AVLTree;
};
private... | ALGO | 0.998917 | 4.052405 |
8d86737f-3d14-40b6-818a-80e07199a840 | Doraemon9z/leetcode | Array/704.二分查找.cpp | /*
* @lc app=leetcode.cn id=704 lang=cpp
*
* [704] 二分查找
*/
// @lc code=start
class Solution {
public:
int search(vector<int>& nums, int target) {
// 二分查找
int left = 0, right = nums.size() - 1;
while (left <= right) {
int mid = left + ((right - left) >> 1);
int nu... | ALGO | 0.999829 | 6.382973 |
60eae9ee-5d0d-4ba5-bf57-51fb5e0849fb | Mamungithube/c--problem-solving | H_N_Times.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int T;
cin >> T;
while(T--)
{
int N;
char C;
cin >> N >> C ;
string s(N,C);
cout << s;
cout << endl;
}
cout << " ";
return 0;
} | ALGO | 0.998029 | 3.161773 |
cef00db1-2cb0-4328-ad91-a89de711347d | ishandutta2007/codeforces | sert/normal/1426/C.cpp | #include <bits/stdc++.h>
using namespace std;
bool D = false;
const int INF = (int)1e9 + 34;
void solve() {
int n;
cin >> n;
int ans = INF;
for (int i = 1; i * i <= n * 2; i++) {
ans = min(ans, i + (n + i - 1) / i - 2);
}
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdi... | ALGO | 0.999627 | 4.881909 |
f8f8d529-0342-41fc-b9b2-79908c038ee8 | abasse-dabere/INF443-FIND-ME-IF-YOU-CAN-PROJECT | cgp/library/cgp/geometry/transform/projection/projection.cpp | #include "cgp/core/base/base.hpp"
#include "projection.hpp"
namespace cgp
{
mat4 projection_perspective(float fov, float aspect, float z_near, float z_far)
{
const float fy = 1/std::tan(fov/2);
const float fx = fy / aspect;
const float L = z_near-z_far;
const float C = (z_far+z_near)... | TOOL | 0.852801 | 6.728639 |
561c0734-c34d-4b7a-a49d-d7333ec7a464 | ShreyasV7/Leetcode-Problems | 473-matchsticks-to-square/473-matchsticks-to-square.cpp | class Solution {
public:
//int dp[600][600][600][600] ;
bool helper(int ind,int a,int b,int c,int d,vector<int>&m,int n,int req){
if(ind==n){
return a==0 && b==0 && c==0 && d==0;
}
if(m[ind]<=a) if(helper(ind+1,a-m[ind],b,c,d,m,n,req)) return 1 ;
... | ALGO | 0.999966 | 5.478224 |
02e82c3f-fb98-4b72-ae1a-2bc6d0f0bf04 | polossk/Code-Archive | ZOJ/20 - 29/zoj2723.cpp | #include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int n){
if(n==1)return 0;
double ntemp;
ntemp=sqrt((double)n);
int nt;nt=(int)ntemp;
for(int i=2;i<=nt;i++){
if(n%i==0)return 0;
}
return 1;
}
bool isSemiPrim(int n){
double ntemp;
ntemp=sqrt((double)n);
... | ALGO | 0.999852 | 4.238988 |
c41b9521-89cc-4c5d-85b0-df89f3ecccab | michael-duan/Early-WRTK-Source-Code | Source/Lumos/RotationConstraint.cpp | #include "Lumos.h"
#include "RotationConstraint.h"
#include "RotationMonitor.h"
#include "WRTK/WRTK_Math.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
// Sets default values for this component's properties
URotationConstraint::URotationConstraint()
{
// Set this component to be initialized when th... | TOOL | 0.911713 | 7.744491 |
9a40e3a3-6a5e-4dec-adc5-26a3057551e6 | alexandrcoin/ferumcoin | src/Transfers/TransfersConsumer.cpp | #include "TransfersConsumer.h"
#include <numeric>
#include "CommonTypes.h"
#include "Common/BlockingQueue.h"
#include "CryptoNoteCore/CryptoNoteFormatUtils.h"
#include "CryptoNoteCore/TransactionApi.h"
#include "IWallet.h"
#include "INode.h"
#include <future>
using namespace Crypto;
namespace {
using namespace Cr... | TOOL | 0.906193 | 6.915096 |
f080a5b0-fa4b-46d2-91f0-24376ce5520f | Shivkisku/cplusplus | 74.cpp | #include <iostream>
#include <vector> // Include this header for std::vector
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode* next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
public:
ListNode* reverseBetween(ListNode* head, int m, int n) {
ListNode... | ALGO | 0.999957 | 6.379763 |
005159d5-406e-406a-b515-71a2d587461f | xiegy1118/opencv | 3rdparty/carotene/src/phase.cpp | #include <cfloat>
#include <cmath>
#include "common.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
#define FASTATAN2CONST(scale) \
f32 P1((f32)( 0.9997878412794807 * (180.0 / M_PI) * scale)), \
P3((f32)(-0.3258083974640975 * (180.0 / M_PI) * scale)), \
P5((f32)( 0.155578651... | ALGO | 0.998435 | 5.868984 |
5f94c389-bffd-453e-8221-5b7f17910124 | ihaagrawal/Daily-Coding-Practice | Striver A2Z DSA Sheet/Sliding Window & Two Pointer/Medium Problems/Fruit Into Baskets.cpp | // Fruit Into Baskets (MEDIUM)
// https://www.geeksforgeeks.org/problems/fruit-into-baskets-1663137462/1
//Brute: Check for each subarray the maximum count you can get
//Time: O(n^2)
//Space: O(n)
class Solution {
public:
int totalFruits(vector<int> &arr) {
int n = arr.size(), count = 0;
... | ALGO | 0.999983 | 6.358764 |
e522b2c6-5f0f-49e9-9ce9-f89602f3ee8e | jan-moeller/hseg | exec/train.cpp | //
// Created by jan on 29.08.16.
//
#include <BaseProperties.h>
#include <Energy/Weights.h>
#include <Energy/LossAugmentedEnergyFunction.h>
#include <helper/image_helper.h>
#include <Inference/InferenceIterator.h>
#include <Threading/ThreadPool.h>
#include <Energy/IStepSizeRule.h>
#include <Energy/AdamStepSizeRule.h>... | DATA | 0.961718 | 7.339903 |
45650e16-cd46-4e71-bf4f-1c1f3b526944 | esolty/HistogramFilter | tests.cpp | #include <iostream>
#include "simulate.cpp"
bool test_normalize() {
vector < vector <float> > unnormalized, normalized, result;
unnormalized = zeros(2, 2);
normalized = zeros(2,2);
int i,j;
for (i=0; i<2; i++) {
for(j=0; j<2; j++) {
unnormalized[i][j] = 1.0;
normalized[i][j] = 0.25;
}
}
result = no... | TEST | 0.994024 | 4.996935 |
e0955278-e834-4e91-a53e-7f04ac1df949 | donggoolosori/programmers-solve | Level2/34.숫자의표현/1.cpp | // 0.04ms
#include <string>
#include <vector>
using namespace std;
int solution(int n)
{
int answer = 0;
for (int i = 1; i <= n; i++)
{
int sum = 0;
for (int j = 0; j <= n / 2; j++)
{
sum += (i + j);
if (sum == n)
answer++;
else i... | ALGO | 0.99994 | 4.8949 |
2d1a2535-f32b-4e54-86c5-1c8dc043c401 | yuhixyz/XCPC-Templates | 字符串/KMP.cpp | /* 求出模板串P在模式串S中所有出现的位置的起始下标 */
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 10010, M = 100010;
int n, m; // n,m分别为p,s的长度
char p[N], s[M];
int ne[N]; // ne[i]表示以i结尾的真后缀能够匹配前缀的最大长度
int main() {
cin >> n >> p + 1 >> m >> s + 1;
for (int i = 2, j = 0; i <= n; i++) {
while ... | ALGO | 0.999945 | 3.791412 |
8d88a3e0-7573-4bcf-881b-229e3415b3b6 | CarlosYiip/Btree-with-Custom-Iterator | main.cpp | #include <algorithm>
#include <cstddef>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iostream>
#include <set>
#include <string>
#include <utility>
#include <map>
#include "btree.h"
int main() {
btree<int> btree1 {1};
for (int i = 0; i < 10; ++i) {
btree1.insert(i / 2);
}
st... | TOOL | 0.963617 | 4.237524 |
a1903c56-1fdb-4545-bacf-7d83db489758 | SpatikaP/DSA-solutions | 0118-pascals-triangle/0118-pascals-triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ans;
for(int i=0; i<numRows; i++){
vector<int> temp(i+1,1);
for(int j=1; j<temp.size()-1; j++){
temp[j]=ans[i-1][j]+ans[i-1][j-1];
}
ans.push_back(... | ALGO | 0.999982 | 5.566612 |
34436d1b-5043-48f5-9834-6c58d3028ce0 | Vzenun/Codeforces-Problems-Solutions | Tram.cpp | #include<iostream>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<numbers>
#include<numeric>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
int b[n];
int max=0;
int num=0;
for(int i=0;i<n;i++){
cin>>a[i]>>b[i];
}
... | ALGO | 0.999925 | 3.482522 |
7519d3df-7fc6-44a1-9476-42b71b5b0e1f | 22BCS16828/DSA_C- | PatternPrinting/PP01.cpp | #include<iostream>
using namespace std;
int main() {
int n, m;
cout << "Enter the number of rows: ";
cin >> n;
cout << "Enter the number of columns: ";
cin >> m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << " * ";
}
cout << endl;
}... | ALGO | 0.943932 | 4.011955 |
7c0a77c2-f86c-4129-85c8-c2d504d38308 | Ishwarendra/Contests | CODEFORCES_CONTEST/Previous Contests/847_Div3/B.cpp | #include "bits/stdc++.h"
#ifdef LOCAL
#include "F:\CPP\Debug\debug.h"
#else
#define print(...) 1;
#endif
using i64 = long long;
void solve()
{
int n, s, r;
std::cin >> n >> s >> r;
int last = s - r;
for (int i = n - 1; i >= 1; i--)
{
for (int j = last; j >= 1; j--)
{
... | ALGO | 0.999889 | 3.395101 |
43f3dc1a-adb2-410a-87ef-cfbae94a6281 | IMRAN-5740/Programming-Contest | CodE_ForceS/1626B.cpp |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int i,t,n,m;
string s;
void solve()
{
cin>>s;
bool kt=false;
for(int i=s.size()-1;i>0;i--)
{
int tmp=s[i]-48+s[i-1]-48;
if(tmp>9)
{
kt=true;
s[i]=tmp%10+48;
s[i-1]=tmp/10+48;
break;
}
}
if(kt)
{
cout<<s<<endl;
return ;
}
... | ALGO | 0.999934 | 4.951792 |
cee06299-710e-4623-a01e-edad20e4f096 | DevendraKumarSahu09/Solved_DSA_problems | 326-power-of-three/power-of-three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n <= 0) return false;
if(n == 1) return true;
if(n%3 != 0) return false;
return isPowerOfThree(n/3);
}
}; | ALGO | 0.999239 | 6.089942 |
a7bf1775-514d-4109-856c-846299c047eb | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J01831/chain/chain.cpp | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using v2=vector<vi>;
const int inf=0x3f3f3f3f;
int main(){
freopen("chain.in","r",stdin);
freopen("chain.out","w",stdout);
cin.tie(0)->sync_with_stdio(false);
int t;
cin>>t;
while(t--){
int n,k,q;
cin>>... | ALGO | 0.999807 | 3.416907 |
87e486ea-4c5b-44dd-a691-8d6767966d36 | Parzival1509/GFG_POTD | 2022/2022-07/GFG_POTD_2022-07-27_Adding_Array_Elements_Heap.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution{
public:
int minOperations(int arr[], int n, int k) {
// code here
priority_queue<int,vector<int>,greater<int>>pq;
for(int i=0;i<n;i++){
pq.push(arr[i]);
}
int ans=0;
while(!pq.empty() && pq.to... | ALGO | 0.999924 | 4.619954 |
1cbed279-a6b9-457f-a069-49ea31a78fa2 | lierererniu/cpp-learning | 剑指 Offer/09.用两个栈实现队列.cpp | //
// Created by 53110 on 2022/5/24.
//
#include <stack>
#include <queue>
using namespace std;
template<typename T>
class CQueue{
private:
stack<T> stk1;
stack<T> stk2;
public:
CQueue();
void appendTail(const T& val);
T deleteHead();
};
template<typename T>
CQueue<T>::CQueue() {
while(!stk1.... | ALGO | 0.999091 | 5.755355 |
da82f23d-f409-4ba9-9a18-22e5c828fbc3 | cryos/eigen | doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.962996 | 6.430674 |
2e05fd3b-6004-4f92-a14a-df847422689c | stellarscience/dakota-stellar | test/sobol_rational.cpp | #include <cstdlib>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
int main(int argc, char** argv)
{
// This application program reads and writes parameter and response data
// directly so no input/output filters are needed.
std::ifstream fin(argv[1]);
if (!fin) {
... | TOOL | 0.922529 | 4.516723 |
fe93dfde-4e5e-4d96-be9c-76963b575db7 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7121_3.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n;
cin >> n;
long long a, cnt = 0, cnt1 = 0;
while (n--) {
cin >> a;
if (a == 5)
cnt1++;
else
cnt++;
}
if (cnt == 0)
cout << "-1";
else {
... | ALGO | 0.999902 | 4.222914 |
82255b84-5f33-4d49-a79f-7fe910797b58 | kunalbandale/DSA_Practice_CPP | Basic Code/perfectSq.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main() {
int number;
cin >> number;
if(number>0) {
int sqrt_n = sqrt(number);
int res = sqrt_n * sqrt_n;
if(res == number) {
cout << "Perfect Square Number" << endl;
} else {
cout << "Not a Perfect Square Number" << endl;
... | ALGO | 0.999375 | 4.242259 |
d0bc9f3f-3846-488f-95b8-f52876aa29a5 | qiaozishun4/CSP2024_BJ | BJ-Senior/answers/BJ-S00629/color/color.cpp | #include<bits/stdc++.h>
using namespace std;
int a[200010];
bool flag[200010];
int score(int n){
int cnt = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j < i; j++){
if(a[i] == a[j] && flag[i] == flag[j]) cnt += a[i];
}
}
return cnt;
}
void f(int i){
int cur = 0;
whi... | ALGO | 0.999773 | 4.288744 |
a1dd3061-706b-486d-94d6-c876dad73bdb | harsh13579/CPP-Codeforces-Codes | 1000/count_no_of_pairs.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
int flag=0;
long long count=0,sum=0;
vector<int>up(26,0);
vector<int>low(26,0);
string s;
cin>>s;
for(int i=0;i<n;i++)
... | ALGO | 0.99997 | 4.023912 |
4a441061-0282-42bd-87ce-8fbae33a072a | ishandutta2007/codeforces | gepardo/normal/744/A.cpp | /*-------------------( alex256 )--------------------\
| Contest: Codeforces Round 385 (Div. 1) |
| Task: B |
| Date: 17. 12. 2016 |
\--------------------------------------------------*/
// Includes
#include <algorithm>
#include <cmath>
... | ALGO | 0.999961 | 4.269665 |
d4369caf-b2a2-40a9-8515-b9ce51efe454 | soyoung0317/codetree-TILs | 241106/더 긴 문자열/longer-string.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
string str_a = "", str_b = "";
cin >> str_a >> str_b;
if(str_a.length() > str_b.length())
cout << str_a << " "<< str_a.length() << endl;
else if (str_a.length() < str_b.length())
cout << str_b << " "<< str_b.l... | ALGO | 0.999798 | 3.840116 |
093208c1-c36a-4420-9085-839e244660c5 | Mo-taz/calculator | 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.998859 | 6.785645 |
2fd34523-2feb-40b4-a31e-295054520a8a | raincross7/code-similarity | codes/train_code/problem075/problem075_227.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int x;
cin >> x;
vector<bool> isexist(x+10, false);
isexist[0] = true;
for(int i = 1; i <= x; i++){
for(int j = 100; j <= 105; j++){
if(i-j >= 0 && isexist[i-j]) isexist[i] = true;
}
}
if(ise... | ALGO | 0.999813 | 3.81141 |
a7089119-8eaa-41bf-9c80-0e5668d3ddf5 | LaLiszka/Game-engine | Gems/Meshlets/Code/Source/Meshlets/MeshletsRenderObject.cpp | #include <AzCore/Math/Aabb.h>
#include <Atom/RHI/Factory.h>
#include <Atom/RPI.Public/Image/StreamingImage.h>
#include <Atom/RPI.Public/Image/ImageSystemInterface.h>
#include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
#include <Atom/RPI.Public/MeshDrawPacket.h>
#include <Atom/RPI.Reflect/Asset/AssetUtils.h>
#in... | TOOL | 0.948394 | 3.546045 |
8545ce56-002d-4f8c-9fdf-c38325d1c729 | Chetna3110/ACC45DAYSOFCODE2024 | day 41 BATH done.cpp | #include <iostream>
using namespace std;
int main() {
int T;
cin >> T;
while(T--){
int X , Y;
cin >> X >> Y;
int Det = Y * 2;
if(Det > X){
cout << "0"<< endl;
}else {
cout << X / Det << endl;
}
}
return 0;
} | ALGO | 0.999665 | 4.405214 |
ef8a3631-32ac-4c76-98f2-32052e01064b | ishandutta2007/codeforces | i_love_tigersugar/normal/431/E.cpp | #include<bits/stdc++.h>
#define MAX 200200
#define FOR(i,a,b) for (int i=(a);i<=(b);i=i+1)
#define REP(i,n) for (int i=0;i<(n);i=i+1)
#define FORE(i,v) for (__typeof((v).begin()) i=(v).begin();i!=(v).end();i++)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,ll> ii;
... | ALGO | 0.999921 | 3.701182 |
5b684155-0860-420a-a0b4-a4bcda773fdd | algoboy101/note_blog_leetcode | delete/source/cpp/[998]最大二叉树 II.cpp | //最大树定义:一个树,其中每个节点的值都大于其子树中的任何其他值。
//
// 给出最大树的根节点 root。
//
// 就像之前的问题那样,给定的树是从表 A(root = Construct(A))递归地使用下述 Construct(A) 例程构造的:
//
//
// 如果 A 为空,返回 null
// 否则,令 A[i] 作为 A 的最大元素。创建一个值为 A[i] 的根节点 root
// root 的左子树将被构建为 Construct([A[0], A[1], ..., A[i-1]])
// root 的右子树将被构建为 Construct([A[i+1], A[i+2], ..., A[A.le... | ALGO | 0.999972 | 6.088704 |
fda1d08a-0557-4dad-b8e9-164a66458c26 | right-x2/Algorithm_study | 2747.cpp | #include <iostream>
#include <queue>
using namespace std;
int arr[46];
int main(int argc, char const *argv[])
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
arr[0] = 0;
arr[1] = 1;
cin>>n;
for (int i = 2; i <= n; ++i)
{
arr[i] = arr[i-1]+ arr[i-2];
}
... | ALGO | 0.999963 | 4.409404 |
44b013bb-a620-434b-ae0e-45212760d532 | yousirong/Cpp-How-To-Program-9E-master | Chapter06/exercises/6.31/ex_631.cpp | /*
* =====================================================================================
*
* Filename: ex_631.cpp
*
* Description: Exercise 6.31 - Greatest Common Divisor
*
* Version: 1.0
* Created: 14/04/16 19:59:39
* Revision: none
* Compiler: g++
*
* Aut... | ALGO | 0.998691 | 5.277468 |
b7e95434-0757-4456-adee-37ec84b82d80 | asurada/banzaiGame | sangokuCut/libs/Box2D/Dynamics/b2WorldCallbacks.cpp | #include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Dynamics/b2Fixture.h>
// Return true if contact calculations should be performed between these two shapes.
// If you implement your own collision filter you may want to build from this implementation.
bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, ... | TOOL | 0.938633 | 7.142647 |
4e88fc90-9cbd-4396-9bf1-1636f49a1894 | viscrisn/mit-algo-cpp | CPP Projects/all_night_coding_tech_2012/q3q.cpp |
//Name1: Name2:
//Del1: Del2:
//Team ID:
//The Program aims to find the length of the longest array of prime numbers in a given array
//INPUT - the first line takes an integer n. the next n lines take elements of the array.
//OUTPUT - Outputs the length of longest array of prime numbers.
//SAMPLE INPUT- 6
/... | ALGO | 0.999868 | 3.800292 |
44a60853-d351-4336-a4b7-9ca20f9657b3 | KVSchandra/LeetCode | 1369-minimum-swaps-to-make-strings-equal/minimum-swaps-to-make-strings-equal.cpp | class Solution {
public:
int minimumSwap(string s1, string s2) {
int xy = 0, yx = 0;
for(int i = 0; i<s1.size(); i++){
if(s1[i] == 'x' && s2[i] == 'y') xy++;
else if(s1[i] == 'y' && s2[i] == 'x') yx++;
}
int count = xy + yx;
if(count&1) return -1;
... | ALGO | 0.999994 | 5.297942 |
8cfe4cf7-21b7-4c6f-b27a-9411da51a8af | xhaktmchl/Algorithm_study | Sejong Algorithm Training/[세종대 알고리즘 트레이닝 Level21.5 05번 O] counting 후 정렬하기.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
/*
[세종대 알고리즘 트레이닝 Level21.5 05번 O] counting 후 정렬하기
문제:
접근:
풀이: 완탐
//1.입력
//2.완탐: 숫자 갯수 카운팅
// bucket[숫자]에 카운트
//3.출력: bucket[idx] 에 갯수 만큰 idx출력
시간복잡도: O()=
*/
int vect[10], bucket[15];
... | ALGO | 0.999618 | 4.248171 |
acfd0a0b-f86f-4027-8318-159289c5b289 | TashfiaJ/MY-CP-PRACTICE | Bit Manipulation/Check if the bit is on.cpp | // problem link: https://codeforces.com/contest/1842/problem/B
bool isOn(ll x, int pos) {
return (x & (1LL<<pos));
}
| ALGO | 0.998528 | 3.551577 |
f388ffbc-3f0d-42c5-8106-2e251871f513 | Tomki2258/LeetCode | 2416-evaluate-boolean-binary-tree/evaluate-boolean-binary-tree.cpp | /**
*Definition for a binary tree node.
*struct TreeNode {
* int val;
* TreeNode * left;
* TreeNode * right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), r... | ALGO | 0.999942 | 5.991789 |
758d65e1-e7da-4aad-b8cd-910b5a557432 | LittleYang0531/CQ-CSP-S-2021 | CQ-00308/traffic/traffic.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=505,mod=1e9+7;
int n,m,k,t;
int a[N][N],b[N][N],v[N][N],p[N][N],s[N][N];
int main()
{
freopen("traffic.in","r",stdin);
freopen("traffic.out","w",stdout);
cin>>n>>m>>t;
int maa=0;
for(int i=1;i<=n-1;i++)
{
for(int j=1;j<=m;j++)
{
... | ALGO | 0.999778 | 3.326076 |
2a4f3997-b738-4a94-8dcc-7de85ec4c847 | sharc-lab/LightningSim | llvm-project/mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.cpp | #include "LSPServer.h"
#include "../lsp-server-support/Logging.h"
#include "../lsp-server-support/Transport.h"
#include "PDLLServer.h"
#include "Protocol.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/StringMap.h"
#define DEBUG_TYPE "pdll-lsp-server"
using namespace mlir;
using namespace mlir::lsp;
//==... | WEB | 0.88135 | 7.958658 |
94501956-1f25-435a-858c-cac9e8bfc9a0 | ishandutta2007/codeforces | christ/normal/1251/B.cpp |
// Problem : B. Binary Palindromes
// Contest : Educational Codeforces Round 75 (Rated for Div. 2)
// URL : https://codeforces.com/contest/1251/problem/B
// Memory Limit : 256.000000 MB
// Time Limit : 2000.000000 milisec
// Powered by CP Editor (https://github.com/coder3101/cp-editor)
#include<bits/stdc++.h>
using... | ALGO | 0.99994 | 4.341186 |
b91d5032-c665-4974-af2e-ca1c1bcc979a | sebastian-wong/WearableTechnology_Embedded-System-Design-Project | Hardware/libraries used/Pedometer libraries/Average.cpp | #include "Average.h"
#include <Arduino.h>
// Rolling average routines
int rollingAverage(int *store, int size, int entry)
{
int l;
long total = 0;
int result;
for(l=0; l<size-1; l++)
{
store[l] = store[l+1];
total += store[l];
}
store[size-1] = entry;
total += entry;
result = total / size;
return res... | ALGO | 0.998174 | 3.326311 |
d18748f8-92c1-4ab8-8203-a559f0cb70ea | JamesZFS/Pharosa | src/utils/sampling.cpp | //
// Created by James on 2019/5/16.
//
#include "sampling.h"
namespace Sampling
{
Vec3f uniformOnSphere(const Vec2f &xi)
{
auto cos_theta = 1 - 2 * xi[0]; // [-1, 1]
auto sin_theta = sqrtf(max2(0.f, 1 - cos_theta * cos_theta));
auto phi = 2 * M_PIF * xi[1];
return {sin_theta * cosf(phi), sin_theta * sinf(... | ALGO | 0.980926 | 6.634705 |
a664ad85-31ff-42d8-809f-d7f510cf9b38 | SastaStudent/Competetive_Programming | Number_Theory/09_Fermat_&_Seive.cpp | #include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
void seive(vector<long>&primes,int n)
{
bool arr[n+1];
for(int i=0;i<=n;i++) arr[i]=true;
arr[0]=arr[1]=false;
for(int i=2;i*i<=n;i++)
{
if(arr[i]==true)
{
for(int p=i*i;p<=n;p+=i)
... | ALGO | 0.999639 | 3.936372 |
661398a5-9eab-4416-aa2d-f5191e05bfa3 | momokchung/polmdqc | src/md/partyze.cpp | // Author: Moses KJ Chung
// Year: 2023
#include "action.h"
#include "energi.h"
#include "inform.h"
#include "mdqclimits.h"
#include "partyze.h"
#include "potent.h"
#include <cmath>
namespace polmdqc
{
///////////////////////////////////////////////////
// //
// partyz... | TOOL | 0.965388 | 3.921625 |
34550b54-2401-4186-946b-2b6e04e8b525 | sanchit-sinha/CP | Contests/Codeforces/CF-Contest/CODECRAFT20/B/sol.cpp | #include "bits/stdc++.h"
using namespace std;
#define f first
#define s second
#define pb push_back
#define ll long long
#define ld long double
#define lb lower_bound
#define ub upper_bound
#define m... | ALGO | 0.999963 | 4.627491 |
7ed9d0bb-ca91-4070-b966-c6b3f43232a2 | CyanogenMod/android_external_opencv | cv/src/cvundistort.cpp | #include "_cv.h"
static CvStatus
icvUnDistort_8u_CnR( const uchar* src, int srcstep,
uchar* dst, int dststep, CvSize size,
const float* intrinsic_matrix,
const float* dist_coeffs, int cn )
{
int u, v, i;
float u0 = intrinsic_matrix[2], v0 = intrins... | ALGO | 0.992359 | 5.836969 |
bebff2a1-9a93-4381-8cf7-51ba0d1d39ed | myawur/msuec-archive | cses-fi/sorting-and-searching/b.cpp | /**
* Apartments
* https://cses.fi/problemset/task/1084
*/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
void solve() {
int n, m, k;
cin >> n >> m >> k;
vector<int> a(n);
for (auto &i : a) {
cin >> i;
}
vec... | ALGO | 0.999936 | 4.209632 |
dca00c95-c344-42f6-b03a-ed859548b7be | wernerpe/csdecomp | csdecomp/src/cpp/hpolyhedron.cpp | #include "hpolyhedron.h"
#include <fmt/core.h>
#include <glpk.h>
#include <iostream>
#include <random>
#include <stdexcept>
namespace {
bool solveLP(const Eigen::MatrixXf& A, const Eigen::VectorXf& b,
const Eigen::VectorXf& c, Eigen::VectorXf& x_sol) {
int m = A.rows(); // Number of constraints
int... | ALGO | 0.999183 | 7.383716 |
4d8d497d-22b4-47f8-b814-8e263184025f | Azizanoorani/allmodules | C++/module 4.2/task3.cpp | #include<iostream>
using namespace std;
// class creat
class Circle{
// private access modifier
private:
float radius, area, PI=3.14,C;
// public access modifier
public:
round()
{
cout<<"Enter radius of circle:";
cin>>radius;
area=PI *radius * radius;
cout<< "Area of circle:"<<area;
C=2*PI... | TOOL | 0.926329 | 4.697944 |
f5c3ca39-61e4-44e3-9865-a52fd06bf04d | andrewcleung/leetcode | 1976.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;
class Solution
{
public:
int MOD = 1e9 + 7;
int countPaths(int n, vector<vector<int>> &roads)
{
vector<long long> travelTime(n, INT64_MAX);
vector<vector<pair<int, int>>> adj... | ALGO | 0.999915 | 4.862196 |
7b69f178-d378-4d22-8dd2-1a13fd231297 | miiitomi/atcoder | mayocon/20231211/2.cpp | // https://atcoder.jp/contests/abc210/tasks/abc210_c
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> c(N);
for (int i = 0; i < N; i++) {
cin >> c[i];
}
queue<int> Q;
map<int, int> mp;
int i = 0;
while (K--) {
Q.push(c[... | ALGO | 0.99996 | 4.697978 |
503ec341-a082-49c8-8ca4-542530f80397 | GrootTheDeveloper/OLP-ICPC | 800+BAI_CODE_HAY/Code/55c.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int n,k;
void sub1()
{
vector <int> oo,v,tem;
for (int i=0;i<=n;i++) v.push_back(i);
while (v.size())
{
if (k==v.size()) break;
for (int i=0;i<v.size();i++)
{
if (i%k==0) cout << v[i] << ' ';
else tem.push_back(v[i]);
}
v=(tem);
... | ALGO | 0.999948 | 3.508892 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.