uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8b802505-18e9-4d88-8dca-b3dcd46edf13 | kibeom-kim/Problem-Solving | BOJ/#1932.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int map[500][500], dp[500][500];
int N;
int main(void){
cin.tie(0);
ios_base::sync_with_stdio(false);
cin >> N;
for (int i = 0; i < N; i++){
for (int j = 0; j <= i; j++){
cin >> map[i][j];
dp[i][j] = map[i]... | ALGO | 0.999837 | 3.702355 |
6fb82874-3610-4ff9-ace3-88653a91ec1d | alexandraback/datacollection | solutions_5670465267826688_1/C++/ghk/jam03.cpp | /*************************************************************************
> File Name: jam03.cpp
> Author: Guo Hengkai
> Created Time: 2015/4/11 15:00:50
************************************************************************/
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#inc... | ALGO | 0.999947 | 3.223721 |
b89ee04d-dff8-45ae-92a8-c004e666b912 | SrjAdhikari/DSA-With-CPP | 08_Recursion/Recursion_Level-3/02_Count_Vowels.cpp | #include <iostream>
#include <string>
using namespace std;
// Function to count the number of vowels in a string using recursion
int countVowels(string str, int index) {
// Base case: When index is less than 0, return 0
if (index < 0) {
return 0;
}
// Check if the current character is a vowel
... | ALGO | 0.999817 | 7.157228 |
114f6530-e97a-4137-a391-d350a073634c | samek567/ZadaniaAlgorytmiczne | OIJ/prog_kwalifikacyjny.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n = 0;
int z = 0;
long long aktualna_liczba = 0;
long long szukana_liczba = 0;
long long suma = 0;
vector<long long> liczby;
... | ALGO | 0.999938 | 3.912533 |
9cc7877b-f9e1-48f3-ace3-aa96fd0f4253 | KlaraSystems/freebsd-relayd | gnu/llvm/llvm/lib/CodeGen/InterferenceCache.cpp | #include "InterferenceCache.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "... | ALGO | 0.980003 | 7.799297 |
18debe7e-c497-42b9-955d-201fab6774b5 | ecnerwala/icpc-book | xyz/codes/random_code2/神奇的treap.cpp | #include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define max(x,y) ((x)>(y)?(x):(y))
struct T{int sum,z,key,change,lt,rt,ss,ans;bool c,rr;T *l,*r;}f[600001],*f1=f,*null,*root,*q,*trash[4000001];
struct pp{T *l,*r;}*p;
int n,m,trashlen,c,tot,post,xx[600001];
char S[20];
inline void read(int ... | ALGO | 0.998938 | 3.661294 |
9d111511-2d3a-4184-99db-e31172b45dc9 | mmxsrup/procon | aoj/v5/0546.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
int main(void){
while(1){
int n, k;
scanf("%d %d", &n, &k);
if(n == 0 && k == 0) return 0;
//数字を文字列として扱う
vect... | ALGO | 0.999587 | 3.901985 |
b4b2dc5f-7a5f-4817-8e03-2213e7277eb9 | Xiaxikongying/c_code | 01_HeiMa/STL/STL_vector/test.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
void myPrint(int v)
{
cout << v << endl;
}
class person
{
public:
int age;
string name;
person(int age, string name)
{
this->age = age;
this->name = name;
}
};
void test01()
{
... | ALGO | 0.961135 | 3.485874 |
fc6df1e0-7828-4c28-88d9-90dbaaddfdb0 | IC3Contributor/DAC25 | modelchecker/cadical/src/instantiate.cpp | #include "internal.hpp"
namespace CaDiCaL {
/*------------------------------------------------------------------------*/
// This provides an implementation of variable instantiation, a technique
// for removing literals with few occurrence (see also 'instantiate.hpp').
/*--------------------------------------------... | ALGO | 0.999368 | 7.619528 |
fe38b50e-461f-49bc-b0eb-3203b55cb9c9 | Ramneantu/competitive_programming | INFOARENA/scc.cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a); i<=int(b); ++i)
#define rev(i,b,a) for(int i=int(b); i>=int(a); --i)
#define rec(i,a,b,c) for(int i=int(a); i<=int(b); i+=int(c))
#define recv(i,a,b,c) for(int i=int(a); i>=int(b); i-=int(c))
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back(x)
#def... | ALGO | 0.999973 | 4.331808 |
cb3c8162-1255-4eac-8c01-40ff17e9f82c | mohammadshahjahan/Data-Structure-Algorithms-CPP | 2D Array/largest_word_in_sentence.cpp | #include <iostream>
#include <climits>
using namespace std;
int main()
{
int n;
cout << "Enter Size OF Array = ";
cin >> n;
cin.ignore();
char arr[n + 1];
cin.getline(arr, n);
cin.ignore();
int i = 0;
int currlen = 0, maxlen = 0;
int st = 0, maxst = 0;
while (1)
{
... | ALGO | 0.999649 | 4.092995 |
85a7b263-419c-4150-b0e1-ba496ab327a0 | crime-story/University-Materials | Bachelor/Year 1/Semester 2/Structuri de date/Teme Laborator/Tema 2/vila 2/main.cpp | #include <fstream>
using namespace std;
ifstream f("vila2.in");
ofstream g("vila2.out");
int n, k;
int v[100001];
long long s = 0;
int coada1[100001];
int coada2[100001];
int st1 = 1, dr1 = 0;
int st2 = 1, dr2 = 0;
int maxi;
int main()
{
f>>n>>k;
k++;
for (int i = 1; i <= n; i++)
f>>v[i];
fo... | ALGO | 0.999973 | 3.643864 |
e78b8099-0f01-4ff5-a876-30e5b2fbef02 | AbuJubair7/CP | Platforms/CSES/DP/Counting Towers.cpp | /*
Author: jubair7
Date: 10/2/24
*/
#include<bits/stdc++.h>
using namespace std;
/*
* dp[i][0] = number of ways to make the tower such that there is 1*1 blocks
* is trying to push up
* dp[i][1] = number of ways to make the tower such that there is 1*2 block
* is trying to push up
*
* dp[i][0] = (4*dp[i-1][0] + dp[i-... | ALGO | 0.999987 | 5.73788 |
ac286036-5146-456b-b138-0735b9850530 | saurav7488/Revision | Array/Q7_Remove_Duplicates_from_Sorted_Array.cpp.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
for(int i=0;i<nums.size()-1;i++) {
if(nums[i]==nums[i+1]) {
nums.erase(nums.begin()+i);
i--;
}
}
return nums.size();
}... | ALGO | 0.999849 | 5.955896 |
3dd6c559-8c41-4666-8fbb-39a329682ddb | shishir1809019/DSA_OOP_DBMS | Algorithom/Practice_Day/W8_PD2/Delete.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 3003;
string s,t;
int n, m;
int dp[N][N];
int LCS(int i, int j){
if(i==n || j==m) return 0;
if(dp[i][j] != -1) return dp[i][j];
if(s[i] == t[j]){
return dp[i][j] = 1 + LCS(i+1, j+1);
}
return dp[i][j] = max(LCS(i+1, j), LCS(i, j... | ALGO | 0.999969 | 4.148175 |
398664b7-b3ca-46a6-8c2a-9a7651291f1a | plskz/competitive-programming | Junior Training Sheet/A/139.cpp | #include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
string a, b;
cin >> n >> a >> b;
int cnt = 0;
for (int i = 0; i < n; i++) {
//... | ALGO | 0.999753 | 4.004443 |
dfa99d53-df6e-4ab1-90a0-9bda69330d62 | dngtundt/KTLT_NICE | chuong_6/BT_3_2_khuDeQuy.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int sumEvenDigits_iterative(int N) {
int sum = 0;
while (N > 0) {
int digit = N % 10;
if (digit % 2 == 0) {
sum += digit;
}
N /= 10;
}
return sum;
}
int main() {
int N = 123456;
printf("Tổng các chữ ... | ALGO | 0.999479 | 5.881054 |
6226e501-fea7-4d7a-a830-11d5ecc18253 | muskanpunyani/TOP-INTERVIEW-QUESTIONS-LEETCODE | largest rectangle in histogram.cpp | /*Maximum Rectangular Area in a Histogram
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have the same width and the width is 1 unit.
Input:
The first line contains an integer 'T' denoting the t... | ALGO | 0.999614 | 7.005857 |
00b61a54-13d4-4147-b113-6c3efd1ac51c | trinhminhtriet/leetcode | solutions/2100-2199/2114.maximum-number-of-words-found-in-sentences/Solution.cpp | class Solution {
public:
int mostWordsFound(vector<string>& sentences) {
int ans = 0;
for (auto& s : sentences) {
int cnt = 1 + count(s.begin(), s.end(), ' ');
ans = max(ans, cnt);
}
return ans;
}
}; | ALGO | 0.999948 | 6.038869 |
3a6963fd-b371-42a5-b560-fe6773bc8a4d | danito7718/University-Exercises | 1stSemesterC/ConditionalOperator/02/01OlympicUSAYear.cpp |
#include <stdio.h>
int main()
{
/*1. Летните олимпийски игри се провеждат на
всеки 4 години през всяка година, която се дели точно на 4.
Преброяването на населението в САЩ се извършва на всеки 10 години,
през всяка която се дели на 10.Да се напише програма която проверява
година въведена от потре... | ALGO | 0.999501 | 4.330716 |
b0460b03-55fb-4836-b906-b50e082fd657 | Shankar-Singh-Mahanty/ApnaCollege-DSA-Sheet | Arrays/maximumSubArrayKadaneAlgo.cpp | #include<iostream>
#include <vector>
#include <climits>
using namespace std;
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int current_sum = nums[0];
int max_sum = nums[0];
for(int i=1; i<nums.size(); i++){
current_sum = max(nums[i], current_sum + nums[i]); // ... | ALGO | 0.999038 | 5.773208 |
7a84e5c3-cfff-444b-a7a0-015e94eaabfc | Khizarshah01/DSA_in_CPP | Pattern_Problems/pattern-16.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number of rows"<<endl;
cin>>n;
int rows = 1;
while(rows<=n){
int columns = 1;
char start = 'A'+n-rows;
while(columns<=rows){
cout<<start;
start++;
columns++;
}
cout<<endl;
rows++;
}
return 0;
} | ALGO | 0.9621 | 3.811691 |
95602796-1fa7-4288-879e-e449f531fa98 | csingh27/Principal-Component-Analysis | exercise2/include/eigen-3.3.8/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.999474 | 6.004565 |
d4001c79-2086-4f61-95af-7d7955bf9f03 | abhijeetaman007/Code-Practice-Backup | InterviewBit/#Practice/Daily/continious_charater.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int b;
string str,s;
cin>>str>>s;
cin>>b;
int i=0;
int j=0;
int n=str.size();
cout<<"size is "<<n<<endl;
int ans=0;
int t=b,x;
int temp;
vector<int> v;
for(int i=0;i<n;i++)
{
if(str[i]==s[0])
v.push_back(i);
}
int k=1;
while(j<n && i<n)
{
... | ALGO | 0.999797 | 3.763921 |
ecbd43d3-e050-4cab-aba7-0af2b21be92c | Kethen/android_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_poly_phase_synthesis.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_poly_phase_synthesis.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-----------... | ALGO | 0.999154 | 4.507547 |
bd36d666-b5a5-4cfd-af3b-5c89b6127df5 | RioKKH/AIZU_online_judge | ITP1_4_C_SimpleCalculator/src.cpp | #include <stdio.h>
int main(int argc, char const* argv[])
{
int a, b;
char op;
while(1) {
scanf("%d %c %d", &a, &op, &b);
if ( op != '?') {
if (op == '+') printf("%d\n", a + b);
else if (op == '-') printf("%d\n", a - b);
else if (op == '*') printf("%d\n", a * b);
else if (op == '/') printf("%d\n", a... | ALGO | 0.999674 | 3.2783 |
ab17abba-be52-4c80-821f-5454712de6a2 | Shrey123ansh/Placement | DSA/Bit Manipulation/Easy/4_Check if a number is power of 2 or not.cpp | bool isPowerOfTwo(int n)
{
return (n & n - 1) == 0;
} | ALGO | 0.969809 | 6.787857 |
e7388525-a9df-4f44-bb86-db911a283a54 | grudyszyn/gitrepoo | cbp/horner.cpp | /*
* horner.cpp
*
*/
#include <iostream>
using namespace std;
float horner_it(int stopien, float tb[], float x)
{
float wynik = tb[0];
for ( int i = 1; i < stopien+1; i++)
{
wynik = wynik * x + tb[i];
}
return wynik;
}
int main(int argc, char **argv)
{
int stopien = 3;
float x;
... | ALGO | 0.999878 | 4.005066 |
5d25d51f-947b-42dc-bc2a-abee426432f0 | shadowfax11/pbrt | pbrt-v3-dvs/src/lights/goniometric.cpp | // lights/goniometric.cpp*
#include "lights/goniometric.h"
#include "paramset.h"
#include "sampling.h"
#include "stats.h"
namespace pbrt {
// GonioPhotometricLight Method Definitions
Spectrum GonioPhotometricLight::Sample_Li(const Interaction &ref,
const Point2f &u, Vector3f ... | TOOL | 0.972716 | 6.828742 |
1d91d7e6-9d06-444b-8075-040033adf700 | Kuldeepagrahari/Programming-DSA-Shell-BashScripting-OOPS | CP/A_Raising_Bacteria.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int ans = __builtin_popcount(n);
cout << ans << endl;
} | ALGO | 0.999677 | 4.492671 |
4cfc01a5-41c2-48e2-aea7-8fff77f017e2 | AbdullahHaque1/DSA-With-CPP | 14-reverse_pairs.cpp | //Given an integer array nums, return the number of reverse pairs in the array.
#include <bits/stdc++.h>
using namespace std;
int ReversePair(vector<int> &nums)
{
int a = 0;
for (int i = 0; i < nums.size(); i++){
for (int j = i+1; j < nums.size(); j++)
{
if (nums[i] > 2 * nums[j])
... | ALGO | 0.999826 | 5.321214 |
370f052e-6290-41ad-9941-411e163ffd09 | Seyamalam/Codeforces | 601-800/612b-hddisoutdatedtechnology.cpp | #include <iostream>
#include <vector>
int main(){
long n; std::cin >> n;
std::vector<long> f(n + 1);
for(long p = 1; p <= n; p++){
long x; std::cin >> x;
f[x] = p;
}
int64_t total(0);
for(long p = 1; p < n; p++){
long diff = f[p + 1] - f[p];
if(diff < 0){diff =... | ALGO | 0.999753 | 3.703131 |
e169b2ae-0900-48de-9061-6b22a8c97da5 | hjiang13/LLMs-in-IR | POJ-104/66/461.cpp | #include <iostream>
using namespace std;
int week(int y,int m,int d)
{
int i;
long int sum=0;
int flagy;
flagy=y;
y=y%70000;
sum=(y-1)/4*(365*4+1)-(y-1)/100+(y-1)/400+((y-1)%4)*365;
switch(m)
{
case 1:sum=sum+0; break;
case 2:sum=sum+31; break;
case 3:sum=sum+59; break;
case 4:sum=sum+90; break;
case 5:sum=sum+120; bre... | ALGO | 0.999791 | 3.345281 |
1fda1f60-2613-41dc-abab-bf234da64c86 | Aman-droid/CP_Essentials | recents/C_Colored_Rooks.cpp | #include<bits/stdc++.h>
#define ll long long
#define int long long
#define endl '\n'
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vpll vector<pll>
#define SZ(x) ((int)x.size())
#define FIO ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define watch(x)... | ALGO | 0.999924 | 4.219029 |
9166ed44-db4c-4f73-99ab-75fcd7042bd5 | minseok128/Data_Structure_2-1 | Final/CH03/postfix_convertor.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
typedef enum {
lparen,
rparen,
plus_,
minus_,
times,
divide,
mod,
eos,
operand
} precedence;
int isp[] = {0, 19, 12, 12, 13, 13, 13, 0};
int icp[] = {20, 19, 12, 12, 13, 13, 13, 0};
string expr;
stack<char> s;
precedence getToken(c... | ALGO | 0.9997 | 4.458389 |
da74db2f-ea51-4756-9270-20520a36de8b | ParkSangsin/codetree-TILs | 240112/트리 정점 거리/node-distance.cpp | #include <iostream>
#include <cstring>
#include <vector>
#include <tuple>
using namespace std;
#define MAX_N 1000
vector<pair<int, int>> edges[MAX_N + 1];
bool visited[MAX_N + 1]; // visited[i]: i번 노드의 방문 여부 저장
int root; // 루트 노드 번호
int is_tree = 1;
int a, b, c;
int dist = 0;
int dest;
int res;
void dfs(int x) {... | ALGO | 0.99998 | 4.610304 |
42932fa5-0d20-4368-9689-7d8bc9fd88b0 | abansal15/codeforces-solutions | 4C.cpp | // Jai shree ram
// Author - Ajaybansal
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x.begin().x.end())
//#define for(i, n) for (int i = 0; i < n; i++)
#defi... | ALGO | 0.999831 | 4.743067 |
e599af86-a6be-4738-9d18-76553c440719 | h-hg/data-structure-and-algorithm | leetcode/142-linked-list-cycle-ii/solution.cpp | #include "solution.h"
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
if(!head)
return nullptr;
auto fast = head, slow = head;
while(fast && (fast = fast -> next)) {
fast = fast -> next;
slow = slow -> next;
if(fast == slow)
break;
}
if(!fast)
... | ALGO | 0.999764 | 5.885204 |
088f2115-f599-4bff-8f1d-f3d1d150956e | antoniak/PRI | lib/boost_1_67_0/libs/spirit/classic/example/fundamental/more_calculators/vmachine_calc.cpp | ////////////////////////////////////////////////////////////////////////////
//
// The calculator using a simple virtual machine and compiler.
//
// Ported to v1.5 from the original v1.0 code by JDG
// [ JDG 9/18/2002 ]
//
////////////////////////////////////////////////////////////////////////////
#include <boost/s... | ALGO | 0.998762 | 6.031153 |
87df97fe-bbc9-4fd8-994c-94fdcdce00df | panchanansahoo/cpp | DataStructures_with_C++/Google Competitions/Punched Cards.cpp | // Problem Link : https://codingcompetitions.withgoogle.com/codejam/round/0000000000876ff1/0000000000a4621b
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
for (int z = 1; z <= t; z++){
... | ALGO | 0.999745 | 4.284 |
196f633c-4442-46c8-a5ac-8a330737ca85 | guptasonu14/DSA-IN-Cpp | MyPractice/01Array/04AddEle.cpp | #include <iostream>
using namespace std;
int main() {
int n; //size of first array
int m; //size of second array
cin >> n >> m;
int array1[n];
int array2[m];
int result = 0;
// taking input in array1
for (int i = 0; i < n; i++) {
cin >> array1[i];
}
// taking input in arr... | ALGO | 0.999933 | 3.171723 |
fd6c2e78-f524-479d-9648-890bae8ed25a | tfcpanda/cBaseExercises | cBasicExercises12/experiment_4.cpp | #include"stdio.h"
#include"math.h"
/*
һnkηĺ书ǼnkĽ
Ҫøún0nkĽ
*/
int getpower(int n,int k);
main()
{
int n,k,i;
scanf("%d%d",&n,&k);
for(i=0;i<=k;i++)
printf("%d\n",getpower(n,i) ) ;
}
int getpower(int n,int k)
{
if (k == 1) {
return n;
}
else if (k == 0) {
return 1;
}
else {
return n *... | ALGO | 0.99978 | 3.3909 |
e6960565-9b37-4b4b-8500-6955d486dd74 | Son-OfAnton/Competitive-Programming | LeetCode/sortArrayByParity.cpp | // 905. Sort Array By Parity
class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
int temp, index = 0;
for(int i = 0; i < nums.size(); i++) {
if(nums[i] % 2 == 0) {
temp = nums[index];
nums[index] = nums[i];
nums[i] = ... | ALGO | 0.999994 | 5.608975 |
d51f92a5-32be-4bab-a993-b3e0f6522040 | ammiexhsanmiguelx092/stream-flix-player | src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp | #ifndef DISABLE_OPENGL
#include "TransparencyDepth.h"
#include <algorithm>
#include <cassert>
#include <map>
#include <vector>
namespace OpenRCT2::Ui
{
/*
* Structure to store locations of vertical bounding box edge.
*/
struct XData
{
int32_t xposition;
bool ... | ALGO | 0.996217 | 7.869014 |
a0dd8dc5-fac8-471f-b645-9b5ec66898e2 | ishandutta2007/codeforces | shayan.p/normal/872/C.cpp | #include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
int main(){
ll q;cin>>q;
for(ll i=0;i<q;i++){
ll n;cin>>n;
if(n==1||n==2||n==3||n==5||n==7||n==11)cout<<-1;
else{
if(n%4==0)cout<<n/4;
if(n%4... | ALGO | 0.999885 | 3.695198 |
6cf7e185-e692-44fb-9247-eca64ae000b9 | ishandutta2007/codeforces | lqs2015/normal/883/I.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,k,a[333333],dp[333333],sum[333333],l,r,mid;
bool check(int mid)
{
memset(dp,0,sizeof(dp));
memset(sum,0,sizeof(sum));
dp[0]=1;sum[0]=1;
int lb,rb;
for (int i=1;i<=n;i++)
{
rb=i-k;
lb=lower_bound(a+1,a+n+1,a[i]... | ALGO | 0.999989 | 3.902746 |
b6487f61-3c11-4d69-9597-edc9b45d8c6a | bweikertjr/Marlin-bugfix-2.1.x | Marlin/src/feature/backlash.cpp | #include "../inc/MarlinConfigPre.h"
#if ENABLED(BACKLASH_COMPENSATION)
#include "backlash.h"
#include "../module/motion.h"
#include "../module/planner.h"
AxisBits Backlash::last_direction_bits;
xyz_long_t Backlash::residual_error{0};
#ifdef BACKLASH_DISTANCE_MM
#if ENABLED(BACKLASH_GCODE)
xyz_float_t Backlas... | TOOL | 0.9411 | 6.738931 |
c639b82f-4783-4179-aa33-a7703f85c2c0 | alesaiko/android_frameworks_av | media/libstagefright/codecs/amrwb/src/scale_signal.cpp | /*
------------------------------------------------------------------------------
Filename: scale_signal.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
------------------------------------------------------------------------... | ALGO | 0.999269 | 5.946876 |
ef299281-5242-4b56-92d2-cd6fa78472a1 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4813_12.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int t;
cin >> t;
for (int cs = 1; cs <= t; cs++) {
int a, b, c, A, B, C;
cin >> a >> b >> c;
int res = INT_MAX;
for (int i = 1; i <= 10000; i++) {
for (int j = i; j <= 10000; j += i) {... | ALGO | 0.999803 | 3.9193 |
74bf395b-be17-4406-b2ff-f035b8c79833 | Mustafa-nox123/work-on-C | Consecutive_string.cpp | #include <iostream>
#include <vector>
bool isConsecutive(const std::string& str) {
if (str[0] == '\0') {
return false;
}
// Check ascending order
bool ascending = true;
for (size_t i = 1; i < str.length(); ++i) {
if (str[i] != str[i - 1] + 1) {
ascending = false;
... | ALGO | 0.999748 | 6.808037 |
395e6d9a-5c36-45cf-9173-f3b567906fd1 | LuisPalacios/cpp-libparchis | src/libparchis/PRobotSmart.cpp |
/**
* @class PRobotSmart PRobotSmart.cpp "PRobotSmart.cpp"
* @file PRobotSmart.cpp
* @brief Parchis Class: Derived from "Player", smarter robot decides based on weights.
*
* ---------------------------------------------------------------------------
*/
//-------------------------------------------------... | ALGO | 0.982181 | 4.858841 |
f2892cb5-172e-443d-9c14-2ae06d272e6c | shreejitverma/SDE-Interview-Prep | LeetCode/C++/print-foobar-alternately.cpp | // Time: O(n)
// Space: O(1)
class FooBar {
public:
FooBar(int n) : n_(n) {
}
void foo(function<void()> printFoo) {
for (int i = 0; i < n_; ++i) {
{
unique_lock<mutex> l(m_);
cv_.wait(l, [this]() { return !curr_; });
curr_ = !curr_;
... | ALGO | 0.996174 | 6.446633 |
b1af24ad-c8dd-4d48-930c-2d8ff70cfd67 | ZMoD-R/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/lsp.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsp.c
Functions:
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template.
Changed to accept the pOverflow flag for EPOC compatibility.
Description: Per review comments, added pOve... | ALGO | 0.896674 | 3.848159 |
77f00728-53fb-4df1-9d4b-ebeb27d7bcfd | MahtabTanim/UVA | UVA 11044 - Searching for Nessy.cpp | #include <bits/stdc++.h>
using namespace std;
#define MP ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
long long t,n,m,a,q,b,l,r,tcase=0;
string s;
int main()
{
cin>>t;
while(t--)
{
cin>>a>>b;
a-=2;
b-=2;
if(a%3) a=a/3+1;
else a=a/3;
if(b%3) ... | ALGO | 0.999871 | 3.948644 |
30e453c5-569d-455d-8807-d0133258a1d6 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12925_3.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
inline long long read() {
long long x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = (x << 1) + (x << 3) + c - '0';
c = getchar();
... | ALGO | 0.999995 | 4.424261 |
32f9f4d6-cfd0-4b7b-9321-2546844009e4 | Sangam-ghimire/DSA-PART-4 | src/ArrayBST.cpp | #include "AbstractBST.h"
#include "ArrayBST.h"
#include <iostream>
using namespace std;
ArrayBST::ArrayBST(){
int i=1;
while(i<10)
{
arr[i] = new Node();
arr[i]->key = -1;
i++;
}
}
ArrayBST::~ArrayBST(){}
bool ArrayBST :: isEmpty(){
if(arr[1]->key == -1){
return... | ALGO | 0.998326 | 3.224274 |
7f60755b-3911-4ea6-9a67-82902d7e801f | RookieZW/LintCode | 8旋转字符串/旋转字符串.cpp | #include <iostream>
#include <assert.h>
/*给定一个字符串(以字符数组的形式给出)和一个偏移量,根据偏移量原地旋转字符串(从左向右旋转)。
样例
样例 1:
输入: str="abcdefg", offset = 3
输出: str = "efgabcd"
样例解释: 注意是原地旋转,即str旋转后为"efgabcd"
*/
class Solution {
public:
/**
* @param str: An array of char
* @param offset: An integer
* @return: nothing
... | ALGO | 0.99843 | 5.171604 |
d34a01c6-1c74-4422-a659-b6863521a8a6 | AbhishekBiswal/Class11programs | series/1+(1+2)+n.cpp | /*
By Abhishek Biswal.
To accept a value for n.
and print the result of:
1 + (1+2) + (1+2+3)+...
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,s,i,n;
a = 0;
s = 0;
cout<<"Enter a number"<<endl;
cin>>n;
for(i=1;i<=n;i++)
{
s=(s+i);
a=(a+s);
}
cout<<"Answer = "<<a;
getch();... | ALGO | 0.999632 | 3.238724 |
d5c2a1fe-5437-49a3-a496-afe829cfc7e0 | LFTEC/atcoder | src/399/E.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
string s, t;
cin >> s >> t;
vector<int> a[256];
for (int i = 0; i < n; i++)
{
a[s[i]].push_back(i);
}
int ans = 0;
for (int i = 'a'; i <= 'z'; i++)
{
int sizeB = 0; char alphaB = 0;
for (auto j : a[i])
{
if (t[j] != alph... | ALGO | 0.99992 | 3.806669 |
6dbe71d4-f5d0-456e-a6ca-33dd13e0c1ea | yyyaoyuan/SHDA | Noise_Generation/Noise-10/bhtsne/tsne.cpp | #include <cfloat>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include "vptree.h"
#include "sptree.h"
#include "tsne.h"
using namespace std;
// Perform t-SNE
void TSNE::run(double* X, int N, int D, double* Y, int no_dims, double perplexity, double theta, int rand_seed,
... | ALGO | 0.999811 | 5.303456 |
4f3dd783-f194-47eb-828d-7d7f5c342487 | Jitendra-rec/LeetCode | 1786-count-the-number-of-consistent-strings/count-the-number-of-consistent-strings.cpp | class Solution {
public:
bool comp(unordered_map<char,int>mp,unordered_map<char,int>mp1)
{
for(auto i:mp1)
{
if(mp.count(i.first)==0)
return false;
}
return true;
}
int countConsistentStrings(string a, vector<string>& words) {
unordered_map... | ALGO | 0.999975 | 5.440976 |
a8745c70-d56b-4fbb-a69b-412c2833f9ad | Prakshenjay/Metro-System | Temp.cpp | #include <iostream>
#include <string>
#define MAX_STATIONS 8
class MetroSystem
{
private:
public:
std::string Grid[MAX_STATIONS][MAX_STATIONS];
float AdjacencyMatrix[MAX_STATIONS * MAX_STATIONS][MAX_STATIONS * MAX_STATIONS];
int stCounter = 0;
MetroSystem();
void displayMap();
void shortestP... | ALGO | 0.978796 | 4.844519 |
ded3b5ab-3d1a-4190-9722-812a88c902c9 | AMIRIOX/MyLuoguRepo | contest/official/CSP-J-2020-T1.cpp | #include <cstdio>
#include <iostream>
// #include <stack>
using namespace std;
const int maxn = 1e7 + 10;
// int n2[maxn];
int main() {
int n;
scanf("%d", &n);
if ((n & 1) || n < 2) {
printf("-1\n");
return 0;
}
// n2[0] = 1;
// n2[1] = 2;
// for (int i = 2; i < maxn; i++) {... | ALGO | 0.99997 | 4.426888 |
108db9fc-7f1c-4238-8c9f-1b3222f91bad | Sadam452/CAndCPlusPlusProgramming | Sales by Match.cpp | /*There is a large pile of socks that must be paired by color. Given an array of integers representing the color of each sock,
determine how many pairs of socks with matching colors there are.
*/
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> ... | ALGO | 0.999985 | 5.481943 |
877cf2d0-621e-4170-9288-4ac445b83941 | vingalalli/sumgra | src/SubgraphMatcher.cpp | #include "SubgraphMatcher.h"
#include "MaxMatch.h"
SubgraphMatcher::SubgraphMatcher()
{
//ctor
}
SubgraphMatcher::~SubgraphMatcher()
{
//dtor
}
bool bitSetMatch(const std::vector<std::bitset<DIM>>& dataBitSet, const std::vector<std::bitset<DIM>>& queryBitSet)
{
MaxMatch maxMatch;
bool matched = false;
... | ALGO | 0.999444 | 5.291404 |
15dfac6e-c2da-4523-addc-97c56764b719 | aviralsharmaa/ChatGPT-App | 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 |
e405e36d-6ae5-424e-86bf-73e42683231a | kingadarsh/Decode-C-Assignment | array/CheckIfNumIsArmstrong/main.cpp | /*
Examples of Armstrong Numbers:
153 (3-digit number)
1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 15313 +53 +33 =1+125+27=153 ✅ Armstrong number
9474 (4-digit number)
9^4 + 4^4 + 7^4 + 4^4 = 6561 + 256 + 2401 + 256 = 947494+44+74+44=6561+256+2401+256=9474 ✅ Armstrong
number
123 (3-digit number)
1^3 + 2^3 + 3^3 = 1 + 8... | ALGO | 0.999906 | 5.386949 |
76314940-bee3-45bb-adc7-7e66c1606382 | omelkonian/snap | src/graph_metrics/edgeBetweeness.cpp | /*
* edgeBetweeness.cpp
*
* Created on: 10 Jan 2015
* Author: Orestis Melkonian
*/
#include <cstdlib>
#include "../graph_metrics/metrics.h"
#include "../properties/Properties.h"
#include "../list/IntegerListItem.h"
#include "../list/EdgeListItem.h"
#include "../search/ExtendedBFS2.h"
long double** compute... | ALGO | 0.999276 | 5.844131 |
601476f2-fee9-4be5-97c6-3d03cc6ea005 | GonzaloPereira/CompetitiveProgramming | UVA/Problem-Solving-Paradigms/Dynamic-Programming/LIS/497.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL);
#define N
int lis(vector<int> const &a)
{
int n = a.size();
vector<int> d;
for (int i = 0; i < n; i++)
{
int j = upper_bound(d.begin(), d.end(), ... | ALGO | 0.999888 | 4.184996 |
a8c0d126-ccbb-4e72-b702-8ca94fd34c03 | JiangWZW/Gitea_Blender_NPR | extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodySphericalJointMotor.cpp | ///This file was written by Erwin Coumans
#include "btMultiBodySphericalJointMotor.h"
#include "btMultiBody.h"
#include "btMultiBodyLinkCollider.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "LinearMath/btTransformUtil.h"
#include "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Cons... | ALGO | 0.959588 | 7.323832 |
d6c86f25-d51d-4381-a12a-469f94f57c7e | down1013/MyLeetcode | algo/algo/66PlusOne.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <array>
#include <stack>
#include <algorithm>
using namespace std;
int lengthOfLastWord(string s){
if(s.empty()) return 0;
int lastPos=s.find_last_not_of(' ');
s=s.substr(0,lastP... | ALGO | 0.987312 | 4.068727 |
f1f7b28e-6003-475f-ad8b-6ab569498143 | TheStranger512/Competitive-Programming-Stuff | SPOJ/RPLH.cpp | /* Solved
* 11494. Hard Launching - math
* File: RPLH.cpp
* Author: Andy Huang
* Created on May 7, 2012, 12:51 AM
*/
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <fstream>
#include ... | ALGO | 0.999275 | 3.71069 |
999ed822-bfc6-4114-9aca-afbdffbb2e31 | savirsingh/dmoj-solutions | coci06c2p5.cpp | // code by savir singh
// https://dmoj.ca/problem/coci06c2p5
// 110/110
#include <iostream>
using namespace std;
#define pii pair<int, int>
#define ll long long
const int MM = 401;
int r, c, psa[MM][MM], best = 0;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> r >> c;
for (int i =... | ALGO | 0.999797 | 3.651294 |
bd2873e8-8ce6-4c07-b41a-e240336e8780 | RinatMambetov/cpp-modules-42school | m09/ex02/main.cpp | #include "PmergeMe.hpp"
int main(int argc, char *argv[])
{
try
{
if (argc < 2)
throw "Error: not the right number of arguments.";
PmergeMe test;
test.ft_sort(argv);
}
catch(const char *str)
{
std::cerr << str << '\n';
}
}
| ALGO | 0.907145 | 4.898671 |
9ffb38c9-9b55-4cc2-b56f-3727bed09ace | akashiitj/dsaprogram | sorting/quicksort.cpp | #include<bits/stdc++.h>
using namespace std;
void quickSort(int arr[], int left, int right) {
int i = left, j = right;
int tmp;
int pivot = arr[(left + right) / 2];
/* partition */
while (i <= j) {
while (arr[i] < pivot)
i++;
while (arr[j] > pivo... | ALGO | 0.999985 | 3.752333 |
cedbbd00-5312-4b67-9585-5eca0ccc3cc3 | shubham-githb/LeetCode-Accepted-Solutions | majority-element-ii/majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
vector<int> ans;
map<int,int> mp;
for(int i=0;i<nums.size();i++)
{
mp[nums[i]]++;
}
for (auto i=mp.begin();i!=mp.end();i++) if(i->second > nums.size()/3) ans.push_back(i->first);
... | ALGO | 0.999929 | 5.662534 |
d9afd92e-ede3-4186-bbb3-e68414b26fab | athul2002/DSA | Graph/adjacency_list.cpp | #include<iostream>
#include<vector>
using namespace std;
void adjacency(vector<int>adj[],int u,int v)
{
adj[u].push_back(v);
adj[v].push_back(u);
}
int main()
{
int v=4;
vector<int>adj[v];
adjacency(adj,0,1);
adjacency(adj,0,2);
adjacency(adj,1,2);
adjacency(adj,2,3);
} | ALGO | 0.999767 | 3.490227 |
cb41a131-a7d7-4e58-8e4a-f33f8b21188d | p-podsiadly/llvm-stm8 | mlir/lib/Dialect/Math/Transforms/AlgebraicSimplification.cpp | #include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/Math/Transforms/Passes.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/TypeUtilities.h"
#include <climits>
using namespace mlir;
//-----... | ALGO | 0.919413 | 7.710035 |
3b448849-75d2-4888-aa59-6aa91ffbd80d | preltyler006/CS1 | Unit8/consonantsV2.cpp | #include <iostream>
#include <string>
using namespace std;
int consonantCounter(char[]);
const int MAX_LENGTH = 50;
int main() {
int numOfConsonants = 0;
char userString[MAX_LENGTH];
cout << "Enter your string of max 50 characters: " << endl;
cin >> userString;
numOfConsonants = consonantCount... | ALGO | 0.992571 | 5.067764 |
fce04fa2-93d7-4b48-84de-f571467f25f1 | raincross7/code-similarity | codes/train_code/problem179/problem179_311.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ar[100005]={0},gsum[100005]={0},rsum[100005]={0};
int main(){
ll n,k;
cin>>n>>k;
for(int i=1;i<=n;i++){
ll a;
cin>>a;
ar[i]=a;
gsum[i]=gsum[i-1]+max(a,(ll)0);
rsum[i]=rsum[i-1]+a;
}
ll ans=0;
for(int i=0;i<n-k+1;i++){
... | ALGO | 0.999914 | 3.694443 |
3f99945f-3725-4d43-b452-95087ffb5b67 | walkccc/LeetCode | solutions/2352. Equal Row and Column Pairs/2352.cpp | class Solution {
public:
int equalPairs(vector<vector<int>>& grid) {
const int n = grid.size();
int ans = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) {
int k = 0;
for (; k < n; ++k)
if (grid[i][k] != grid[k][j])
break;
if (k == n) // R[... | ALGO | 0.999882 | 6.155944 |
90473b79-34ec-449d-be42-408681ec1fc7 | zenith82114/boj-solve | src/2162.cpp | /*
* Q2162 - Line segment intersection and disjoint sets
* Date: 2021.8.9
*/
#include<iostream>
#include<algorithm>
using namespace std;
constexpr int MAXN = 3000;
struct vec2 {
int x, y;
bool operator<(const vec2& v) const {
return y != v.y ? y < v.y : x < v.x;
};
vec2 operator-(const vec2... | ALGO | 0.999383 | 5.011975 |
607d1709-3bf3-418d-a97a-2fa5a56c4a04 | TaohidHossain/Neetcode | Sliding Window/bestTimeToBuyAndSellStock.cpp | /*
Leetcode: 121. Best Time to Buy and Sell Stock
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
Time: O(n)
Space: O(1)
*/
class Solution {
public:
int maxProfit(vector<int>& prices) {
int profit = 0;
int i = 0, j = 1;
while(j < prices.size()){
... | ALGO | 0.999886 | 6.649814 |
54f480c0-6efc-458b-b5f6-f1cc8893738c | compiler-tree-technologies/cil | llvm/tools/llvm-xray/xray-stacks.cpp | #include <forward_list>
#include <numeric>
#include "func-id-helper.h"
#include "trie-node.h"
#include "xray-registry.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatAdapters.h"
#include "llv... | TOOL | 0.985163 | 7.206606 |
e3754f78-89a5-4492-9a28-5012a2867a8c | eric-cw-hsu/uva | finished/uva11456.cpp | //LIS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
#define ll long long
#define C cases
#define pb push_back
#define maxn 2100
int main(void)
{
#ifndef file
freopen("in.in", "r", stdin);
freopen("out.out", "w", stdout);
#endif
int cases;
cin >> cases;
while... | ALGO | 0.999924 | 3.98908 |
fa4123ea-3a67-4628-8d5d-c99d09130bac | Leedogeon/Study | 프로그래머스/1/340199. [PCCE 기출문제] 9번 / 지폐 접기/[PCCE 기출문제] 9번 / 지폐 접기.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> wallet, vector<int> bill) {
int answer = 0;
bool chk = false;
if ((bill[0] <= wallet[0] && bill[1] <= wallet[1]) || (bill[0] <= wallet[1] && bill[1] <= wallet[0]))
return answer;
while (!chk)
... | ALGO | 0.999792 | 5.193301 |
3828a154-be5d-41e0-b48d-b7d12392d524 | OneBitPython/Codeforces | C_Maximum_Set.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(c) c.begin(), c.end()
#define endl "\n"
const double PI=3.141592653589;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << ... | ALGO | 0.999827 | 4.179208 |
a20ad7ac-79ae-4282-8253-2f9d41062d0d | MacThanhD21/CodePTIT | DSA/DSA01008-XAUNHIPHANCOKBIT1-XAUNHIPHANCOKBIT1.cpp | /*
Hãy in ra tất cả các xâu nhị phân độ dài N,
có K bit 1 theo thứ tự từ điển tăng dần.
Input:
Dòng đầu tiên là số lượng bộ test T (T ≤ 20).
Mỗi test gồm 2 số nguyên N, K (1 ≤ K ≤ N ≤ 16).
Output:
Với mỗi test, in ra đáp án tìm được, mỗi xâu in ra trên một dòng.
Ví dụ:
Input Output
2 0011
4 2 ... | ALGO | 0.999919 | 4.299963 |
e407a3b7-f12a-405b-ac07-77deb980e2ce | pnnv/hyprland-dotfiles | VSCodium/User/History/52a05704/zx4X.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void snu() {
int n; cin >> n;
multiset <ll> s;
vector <int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i]; s.insert(i);
}
cout << "YES\n";
vector <int> ans;
for (int r = n - 1 ; r >= 1; r--) {
map <int, int> m;
for(auto i: s) {
if(... | ALGO | 0.999957 | 3.821391 |
9628f6ac-f378-4a41-bcf4-6ac9f6f5a165 | egnchen/EI239-assignments | sort_algorithms_comparison/main.cpp | #include "mInt.hpp"
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
void insertion_sort(mInt to_sort[], int size) {
for (int i = 1; i < size; i++) {
mInt tmp = to_sort[i];
int j = i - 1;
for (; j >= 0 && to_sort[j] > tmp; j--)
to_sor... | ALGO | 0.999122 | 4.703239 |
fcdd954c-900e-4e3c-94fc-d2b501238fb0 | zhumingxuan2013/learning | 学习/课上/队列计算距离.cpp | #include <iostream>
#include <queue>
#include <math.h>
using namespace std;
int main()
{ queue<int>q;
for (int i=0; i<4; i++)
{ int x;
cin>>x;
q.push(x);}
int x;
x=q.front();
q.pop();
int y;
y=q.front();
q.pop();
x=x-q.front();
q.pop();
x=x*x;
y=y-q.front();
q.pop();
y=y*y;
cout<<sqrt(y+x);
ret... | ALGO | 0.999934 | 3.770787 |
fbf4984f-c7fd-47b6-9610-a78810f682ca | sarvex/leetcode-tcsh | solution/2400-2499/2426.Number of Pairs Satisfying Inequality/Solution.cpp | class BinaryIndexedTree {
public:
int n;
vector<int> c;
BinaryIndexedTree(int _n)
: n(_n)
, c(_n + 1) {}
void update(int x, int delta) {
while (x <= n) {
c[x] += delta;
x += lowbit(x);
}
}
int query(int x) {
int s = 0;
wh... | ALGO | 0.999997 | 6.077 |
04cb9eda-0bec-4860-aa08-6938f6bd93ea | swoleary5/Euro_Option_Calculator | OptionCalculator.cpp | // OptionCalculator.cpp
#include "OptionCalculator.h"
#include <iostream>
using namespace std;
double calculateNodeValues(std::shared_ptr<Node> currNode, double discount, double upProb, double downProb, double strike, char optionType) {
if(!currNode->upChild && !currNode ->downChild){
if(optionType == 'c'... | ALGO | 0.999306 | 6.643628 |
4294008e-4460-495e-9d37-174d89de3149 | DeepRobot2020/udacity_carnd | CarNDTerm2/T2P5-CarND-MPC/quizs/CarND-MPC-Quizzes/global_kinematic_model/src/Eigen-3.3/doc/examples/Tutorial_PartialLU_solve.cpp | #include <Eigen/Core>
#include <Eigen/LU>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vec... | ALGO | 0.99976 | 3.142099 |
e839bf1b-2f53-4214-af0d-ef0b0c7c1064 | HitarthThakkar/LeetCode-Submissions | 0207-course-schedule/0207-course-schedule.cpp | class Solution
{
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites)
{
int n = numCourses;
vector<vector<int>> adj(n);
for(auto ele : prerequisites)
{
adj[ele[0]].push_back(ele[1]);
}
vector<int> inDegree(n, 0);
for(in... | ALGO | 0.999527 | 6.221383 |
66f74617-4542-4f3f-a504-4a310d08033e | hjiang13/LLMs-in-IR | POJ-104/9/834.cpp | #include <iostream>
using namespace std;
struct pat
{
char *id;
int a;
int o;
struct pat *next;
}
;
int n;
int main()
{
struct pat *create(int n);
struct pat *arrange(struct pat *head);
struct pat *head,*p;
cin >> "%d",&n);
head=create(n);
head=arrange(head);
p=head;
while(p!=NULL)
{
cout << "%s",p->id);
if(p->next!=NU... | ALGO | 0.993328 | 3.424081 |
b15f6596-f829-40a6-9129-471b7d754e66 | Lokesh-ramesh/ADS-LAB | lab7-btree/btree.cpp | #include<iostream>
using namespace std;
struct BTree{
int *d;
BTree **child_ptr;
bool l;
int n;
};
struct BTree *r = NULL, *np = NULL, *x = NULL;
BTree* init(){
int i;
np = new BTree;
np->d = new int[3];//order 3
np->child_ptr = new BTree *[7];
np->l = true;
np->n = 0;
for (i = 0; i < ... | ALGO | 0.999991 | 4.728158 |
2bb668a4-9b49-4818-9e7f-7df3e1446f3f | badugunn/data-structures | sm_sbarr.cpp | #include<iostream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
void Print(int a[], int n)
{
cout<<"Start of array"<<endl;
for(int i=0; i<n; i++)
{
cout<<a[i]<<endl;
}
cout<<"End of the array"<<endl;
}
int simpleSbar(int a[], int n, int sum)
{
int min_len = n+1;
for(int i =0; i<n; i++)
... | ALGO | 0.999799 | 3.429899 |
f0aedc09-91ed-4100-a45d-6718fe71c600 | cicerocipriano/Programming-1 | extra_exercises/extras21-40/exercise25.cpp | #include <iostream>
using namespace std;
void check_sum (int a[], int n, int z) {
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i] + a[j] == z) {
cout << a[i] << " and " << a[j] << " ";
}
}
}
return;
}
int main (int argc, char **argv) {
int n, z;
cin >>... | ALGO | 0.999566 | 3.676443 |
15ee2af5-5c89-4cbf-81fe-9205af211224 | skarik/1Engine | oneEngine/oneGame/source-lib/bullet/BulletInverseDynamics/IDMath.cpp | #include "IDMath.hpp"
#include <cmath>
#include <limits>
namespace btInverseDynamics {
static const idScalar kIsZero = 5 * std::numeric_limits<idScalar>::epsilon();
// requirements for axis length deviation from 1.0
// experimentally set from random euler angle rotation matrices
static const idScalar kAxisLengthEpsil... | TOOL | 0.996755 | 7.35152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.