uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
27ac831c-a474-46c9-b253-8021f5086412 | ishandutta2007/codeforces | cxy07/normal/1637/F.cpp | //Code By CXY07 - It's My Fiesta.
#include<bits/stdc++.h>
using namespace std;
//#define FILE
#define int long long
#define randint(l, r) (rand() % ((r) - (l) + 1) + (l))
#define abs(x) ((x) < 0 ? (-(x)) : (x))
#define popc(x) __builtin_popcount(x)
#define inv(x) qpow((x), mod - 2)
#define lowbit(x) ((x) & (-(x)))
#de... | ALGO | 0.999909 | 3.826505 |
e9b387c3-c684-4903-8dd2-3d1004b210dd | nvdinh185/tin-dai-cuong | for/kiem-tra-hoan-hao.cpp | #include<stdio.h>
#include<math.h>
main()
{
int i, n, sum = 0;
printf("Nhap n = ");
scanf("%d", &n);
for(i=1; i<n; i++)
{
if(n%i==0) sum += i;
}
if(sum==n) printf("%d la so hoan hao!", n);
else printf("%d khong la so hoan hao!", n);
}
| ALGO | 0.999856 | 3.570973 |
697e3898-f9f8-463e-a8cb-0e90bb459bf4 | ZhouShijie123/Calculate-Value-at-Risk | Variance-Gamma Simulation VaR/NelderMead.cpp | #include "StdAfx.h"
#include "NelderMead.h"
CNelderMead::CNelderMead(void) { }
CNelderMead::~CNelderMead(void) { }
// Function to find the standard deviation of a vector
double CNelderMead::stdev(vector<double> x) {
double n = x.size();
double sum = 0.0;
for (int j=0; j<=n-1; j++)
sum += x[j];
double xbar = ... | ALGO | 0.999992 | 5.553895 |
eb15a175-a00f-4cc4-ba5d-73cf2083de5a | saumya1singh/DSAImportantQuestionScratch | Weekly_Tests/TestWavePrint.cpp | #include <iostream>
using namespace std;
int main() {
//Print teh 2D array in form of wave
int m,n;
cin>>m>>n;
int a[m][n];
for(int i=0;i<m;++i){
for(int j=0;j<n;++j){
cin>>a[i][j];
}
}
for(int col=0;col<n;++col){
if(col%2==0){
for(int... | ALGO | 0.99986 | 3.268658 |
4d3ae3af-1322-4702-bce4-107fe00fd229 | Skywt2003/codes | XJOI/CONTEST/xjoi.net/1323/problem3/problem30.cpp | #include<bits/stdc++.h>
#define int long long
#define sqr(_) ((_)*(_))
using namespace std;
inline int read(){
int ret=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
return ret*f;
}
const int maxn=2e5+5,maxe=4e5+5;
int n... | ALGO | 0.999706 | 3.721989 |
ffdab0cf-e261-4885-beb8-2cf54efe21ca | suyundukov/LIFAP1 | TP/TP5/Code/1C.cpp | /* Modifier une chaîne de caractère en son mirroir */
#include <cstring>
#include <iostream>
/* Procèdure */
void chMirroir(char c[])
{
char temp;
for (int i = 0; i < (strlen(c) / 2); ++i) { // Longueur / 2
temp = c[i];
c[i] = c[(strlen(c) - 1) - i];
c[(strlen(c) - 1) - i] = temp;
}
}
/* Utilisat... | ALGO | 0.964175 | 3.879536 |
2def1d1f-af65-4113-9d47-31774a415c08 | MaicolGomez/ACM | 4110.cpp | #include<bits/stdc++.h>
using namespace std;
#define pi (2.0*acos(0.0))
#define eps 1e-6
#define ll long long
#define inf (1<<30)
#define vi vector<int>
#define vll vector<ll>
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin() , v.end()
#define me(a,val) memset( a , val ,sizeof(a) )
#... | ALGO | 0.998507 | 3.634143 |
1133af4e-9980-4edf-a438-ec8765af88e6 | hagukin/PS | programmers/2020_KAKAO_BLIND_RECRUITMENT/자물쇠와_열쇠.cpp | #include <string>
#include <iostream>
#include <vector>
using namespace std;
void turnCCW(const vector<vector<int>>& origin, vector<vector<int>>& ret)
{
int M = origin.size();
for (int i=0;i<M;++i)
{
for (int j=0;j<M;++j)
{
ret[M-1-j][i] = origin[i][j];
}
}
retu... | ALGO | 0.999956 | 5.403683 |
b877d1e1-cca0-4c6a-a52a-7c68c7c9f200 | ttamx/Competitive-Programming | programming.in.th/codecube_160.cpp | //unfinished
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,q;
int pos[N],cnt[N];
struct fenwick{
int t[N];
void add(int i,int v){
while(i<N)t[i]+=v,i+=i&-i;
}
int read(int i){
int res=0;
while(i>0)res+=t[i],i-=i&-i;
return res;
}
}f;
int m... | ALGO | 0.99996 | 3.988548 |
51297011-e36e-4301-b6d2-23b42746fde6 | paragons/interviews | disjoint_set.cpp | #include <iostream>
using namespace std;
int findset(int parent[],int i);
void link(int parent[],int rank[],int i,int j);
void un(int parent[],int rank[],int i,int j){
link(parent,rank,findset(parent,i),findset(parent,j));
}
void link(int parent[],int rank[],int i,int j){
if(i==j)
return;
if(rank[i]>rank[j]){
pa... | ALGO | 0.999895 | 3.862054 |
3ba5c70a-9750-41dc-ba5e-672c021c53d5 | BaileySri/Practical-Software-Defense-for-GPS-Spoofing-on-a-Hobby-UAV | libraries/AC_PID/AC_PI.cpp | /*
Generic PI algorithm for controllers that don't need filtering (such as heaters)
*/
#include <AP_Math/AP_Math.h>
#include "AC_PI.h"
const AP_Param::GroupInfo AC_PI::var_info[] = {
// @Param: P
// @DisplayName: PID Proportional Gain
// @Description: P Gain which produces an output value that is propor... | ALGO | 0.999622 | 5.622659 |
001d6810-4b73-4741-90a6-84adbb053233 | ahr9n/psolving-paradigms | 4.dynamic-programming/12.strings/CodeForces 1096D - Easy Problem.cpp | #include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O2")
using namespace std;
using ll = long long;
using ld = long double;
int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int N = 2E5 + 5, M = 2E6 + 10, MOD = 1E9 + 7, OO = 0x3f3f3f3f;
ll n, a[N], mem[... | ALGO | 0.999903 | 4.060837 |
26e8aa30-4b24-469f-96ee-d058917af66d | PranjalPandey77/Competitive-Programming | ANNUNAD.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int N,i,j,k;
scanf("%d",&N);
int A[N],B[N];
for(i=0;i<N;i++)
{
scanf("%d",&A[i]);
B[i]=A[i];
}
j=N-1;
i=0;
int cnt=0;
sort(A,A+N);
for(k=0;k... | ALGO | 0.999979 | 3.664066 |
c01514b9-559d-4d9f-a5ff-32b9f2def210 | hamza26051/OOPSpring2024 | Lab/L6/l6 q3.cpp | /*
Name: Hamza Sheikh
Date:20/3/24
Roll no: 23k-0060
*/
#include <iostream>
#include <string>
using namespace std;
class Appointment {
private:
string clientName;
float cost;
static int totalAppointments;
static float totalEarnings;
public:
Appointment(string name, float price){
c... | TOOL | 0.968871 | 5.98318 |
5790b9c6-85e8-4f31-a5fb-b473f17300b7 | ywsoliman/ProblemSolvingTraining | level-2/hackerrank/algorithms-basics/implementation-i/05 Breaking the Records.cpp | vector<int> breakingRecords(vector<int> scores) {
int minScore = scores[0], maxScore = scores[0], minCounter = 0, maxCounter = 0;
for (int i = 1; i < scores.size(); i++) {
if (maxScore < scores[i]) {
maxScore = scores[i];
maxCounter++;
}
else if (minScore > scores... | ALGO | 0.997941 | 5.699499 |
391a6a13-bda0-4484-a67a-c4b39b26ef2c | ArekX/rage-v1 | win32/msvc/RAGE/RAGE/RAGE/box2d-mod/Dynamics/Joints/b2WheelJoint.cpp | #include "b2WheelJoint.h"
#include "../b2Body.h"
#include "../b2TimeStep.h"
// Linear constraint (point-to-line)
// d = pB - pA = xB + rB - xA - rA
// C = dot(ay, d)
// Cdot = dot(d, cross(wA, ay)) + dot(ay, vB + cross(wB, rB) - vA - cross(wA, rA))
// = -dot(ay, vA) - dot(cross(d + rA, ay), wA) + dot(ay, vB) + do... | ALGO | 0.938132 | 6.874608 |
d3e6e447-3385-4fb5-85e9-f5bb9801f672 | PmecSimulation/Allejos2D | allejos2d/src/role_center_forward.cpp | // -*-c++-*-
/////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "role_center_forward.h"
#include "bhv_chain_action.h"
#include "bhv_basic_offensive_kick.h"
#include "bhv_basic_move.h"
#include <rcsc/player/player_agent.h>
#include <rcsc/pl... | TOOL | 0.959888 | 6.259326 |
0826aa86-729a-48bb-b2d8-fa09d00eb0ae | wassimalharaki/Codeforces | 1500/FactorialsandPowersofTwo.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl '\n'
#define v vector
#define all(v) v.begin(), v.end()
#ifdef WASSIM
#include "debug.h"
#else
#define dbg(...)
#endif
int fact[16];
int popcnt(int n) {
return __builtin_popcountll(n);
}
void solve() {
int n; cin >> n;
int a... | ALGO | 0.99984 | 5.507809 |
359e9e88-8265-49c9-9b61-06579040dc0e | AsifMK123/Algorithm | Insertionsort.cpp | #include<iostream>
using namespace std;
void insertion_sort(int a[],int n){
int temp;
for(int i=1;i<n;i++){
temp=a[i];
int j=i-1;
while( j>=0 && a[j]>temp){
a[j+1]=a[j];
j--;
}
a[j+1]=temp;
}
}
void input_Array(int a[],int n){
for(int i=0;i<n;i++){
cin>>a[i];
}
}
void output_Array(int a[],i... | ALGO | 0.999958 | 4.566239 |
4efe3cf2-4df0-4d99-ae85-f6721716016a | SnehalMarutiSalokhe/CrackYourPlacement | 8-Tree/all-nodes-distance-k-in-binary-tree.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
return 0;
}
// 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(nullpt... | ALGO | 0.999998 | 5.745305 |
48c128e5-43ae-4cb8-a714-b80200a0a136 | ugidol/atcoder | abc336/d.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int N;
cin >> N;
vector<int> A(N);
for(int i=0;i<N;i++){
cin >> A[i];
}
vector<int> B(N+2);
for(int i=0;i<N;i++){
int idx = i+1;
B[idx] = min({B[idx-1]+1,A[idx-1],idx});
}
vector<int> C(N+2);
for(int i=0;i<N;i++){
int idx ... | ALGO | 0.999951 | 4.07202 |
09c5e28d-e4f5-4e81-9afb-b2577c10c9f5 | yuanhang690/c-learning | Contact(三个版本)/test.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include "contact.h"
//ͨѶ¼-̬汾
//1.ͨѶ¼ܴ1000˵Ϣ
//Ϣ
//++Ա+绰+סַ
//2.˵Ϣ
//3.ɾָ˵Ϣ
//4.ָ˵Ϣ
//5.ָ˵Ϣ
//6.ͨѶ¼Ϣ
//
//汾2̬汾
//1.ʼͨѶ¼ʼܴ3Ϣ
//2.ռʱϢ
//汾3ļ
//ͨѶ¼˳ʱϢ浽ļ
//ͨѶ¼ʱϢļм
void menu() {
printf("************************************\n");
printf("***** 1.add 2.del ********\n");
printf("... | TOOL | 0.998879 | 3.164556 |
51aee076-4609-4d2a-9325-5029f47d1a69 | ishandutta2007/codeforces | sd0061/normal/285/D.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <utility>
#include <map>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using n... | ALGO | 0.999993 | 3.927181 |
62707c6c-6bf3-429e-9c76-edaf8d89f6ba | Dunnnnn/cuda-accelerated-ORB-SLAM2 | Thirdparty/DBoW2/DBoW2/BowVector.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include "BowVector.h"
namespace DBoW2 {
// --------------------------------------------------------------------------
BowVector::BowVector(void)
{
}
// -------------------------------------------------------------------... | TOOL | 0.940455 | 5.33147 |
a908101e-e711-4d38-9059-1c769dc423f8 | CGCL-codes/LoomIO | src/boost/libs/hana/example/minimum.cpp | #include <boost/hana/assert.hpp>
#include <boost/hana/equal.hpp>
#include <boost/hana/greater.hpp>
#include <boost/hana/integral_constant.hpp>
#include <boost/hana/minimum.hpp>
#include <boost/hana/tuple.hpp>
namespace hana = boost::hana;
int main() {
// without a predicate
BOOST_HANA_CONSTANT_CHECK(
h... | TEST | 0.981153 | 5.721451 |
7bd52621-30d6-4e18-8bda-ae240afd350e | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/09/31/2.cpp | #include<iostream>
using namespace std;
#define LL long long
const LL inf = 1000000000000000001ll;
char s[1000];
int rep[256], a[256], vst[100];
int N;
int run() {
scanf("%s", s);
memset(rep,-1,sizeof(rep));
memset(vst,0,sizeof(vst));
N=strlen(s);
int n = 1;
rep[s[0]]=1;vst[1]=1;
for(int i=1;i<N;++i)
if... | ALGO | 0.999984 | 4.005391 |
7f9247eb-ceff-4245-8a4c-6805242e3938 | Sudhir769/Sudhirleet769 | Easy/Selection Sort/selection-sort.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
// } Driver Code Ends
class Solution
{
public:
int select(int arr[], int i, int n)
{
int minInd = i;
for(int j=i+1; j<n; j++){
... | ALGO | 0.999901 | 6.340478 |
1b9e0bf4-f74e-4427-ac8e-d3ff2c865450 | Deepsavani/Post-Quantum-Crypto---NTRU | Reference_Implementation/crypto_kem/ntru-hrss701/ntru01/enc/syn/systemc/keccak_absorb.cpp | #include "keccak_absorb.h"
#include "AESL_pkg.h"
using namespace std;
namespace ap_rtl {
const sc_logic keccak_absorb::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic keccak_absorb::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<16> keccak_absorb::ap_ST_fsm_state1 = "1";
const sc_lv<16> keccak_absorb::ap_ST_fsm_state2... | ALGO | 0.985363 | 5.723648 |
65da42f6-3afc-492e-840b-c7e868984c97 | adityarajnetajigaikwad/cpp | stack.cpp | #include <iostream>
using namespace std;
int maxsize=4;
class stack
{
private:
int arr[4],top;
public:
stack()
{
top=-1;
if(top==-1)
cout<<"Stack is empty."<<endl;
else
for (int i=top;i>=0;i--)
cout<<"value "<<i+1<<": "<<arr[i]<<endl;
}
void push(int number)
{
if(top==maxsize-1)
... | ALGO | 0.948985 | 3.868766 |
1ce08ed0-d3bb-42ff-93cc-dd3496b6c576 | tsawke/OI | Luogu/Races/2022_08/PMTD.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define PI M_PI
#define E M_E
#define abbr
using namespace std;
mt19937 rnd(random_device{}());
int rndd(int l, int r){return rnd() % (r - l + 1) + l;}
typedef unsigned int uint;
typedef unsigned long long unll;
typedef long long ll;
#define int ll
template<type... | ALGO | 0.999656 | 3.220639 |
cb1694b0-de66-4121-877e-e6f6bdbb49bc | Changfei-Fu/RUMI-SLAM | src/rumi-slam/Thirdparty/DBoW2/DBoW2/BowVector.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include "BowVector.h"
namespace DBoW2 {
// --------------------------------------------------------------------------
BowVector::BowVector(void)
{
}
// -------------------------------------------------------------------... | TOOL | 0.941501 | 5.33147 |
8fa47b34-3d83-4fe3-9596-6d6647d57bf3 | ishandutta2007/codeforces | holidin/normal/1216/E1.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;
const int N = 5e5;
long long pr[N], dp[N];
set <pair<long long, int> > s;
long long cf(long long x) {
return (x * (x + 1)) / 2;
}
long long f(long long x) {
long long cnt = 1, ans = 0, t;
for (t = 10; t ... | ALGO | 0.999833 | 4.084825 |
6b26c6d6-ade5-407d-88cf-eb3c94813ffd | xujzouyyz/loongarch | mlir/lib/Query/QueryParser.cpp | #include "QueryParser.h"
#include "llvm/ADT/StringSwitch.h"
namespace mlir::query {
// Lex any amount of whitespace followed by a "word" (any sequence of
// non-whitespace characters) from the start of region [begin,end). If no word
// is found before end, return StringRef(). begin is adjusted to exclude the
// lexe... | TOOL | 0.87568 | 4.567331 |
f18cc1b6-981c-4a50-9d6d-1f36c52b7f61 | yusui-shun/hello- | 二叉树.cpp | #include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#define MAX_SIZE 100
typedef struct TreeNode{
int val;
int height;
struct TreeNode *left;
struct TreeNode *right;
}TreeNode;
int *arr=(int*)malloc(sizeof(int)*MAX_SIZE);
TreeNode *newTreeNode(int val){
TreeNode *node;
node=(TreeNode*)malloc(sizeof(TreeNode))... | ALGO | 0.99999 | 4.772102 |
b855e3f7-9a09-420e-ba30-1c477331b612 | ser94mor/lidar-obstacle-detection | third_parties/eigen-3.3.7/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.999688 | 4.010038 |
d0700772-d9a2-401d-86c1-f1d8407727e5 | G-nad/Wecode_DSA | Bài tập về nhà 02/Số lớn nhất nhỏ hơn n không có chữ số chẵn/CODE.cpp | #include "bits/stdc++.h"
using namespace std;
string s;
string ans;
int n;
bool compare(const string & x1, const string & x2){
if (x1.size() > x2.size()) return 1;
else if (x1.size() < x2.size()) return 0;
else
{
for (int i = 1 ; i <= n ; i++)
{
if (x1[i] > x2[i]) return 1;
else if (x1[i] < x2[i]) return... | ALGO | 0.999928 | 4.21492 |
44da2be2-91c7-4681-a3da-eb2b17359131 | azzyr/fortressforever-2013-reborn | src/game/shared/script_intro_shared.cpp | //-----------------------------------------------------------------------------
// Purpose: Calculate the FOV for the intro sequence (needed by both server and client)
//-----------------------------------------------------------------------------
float ScriptInfo_CalculateFOV( float flFOVBlendStartTime, float flNextFO... | ALGO | 0.988319 | 5.855017 |
144e5637-3918-42bf-ae83-1c465eb21233 | cbkpar/BOJ | boj_27516.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long gcd(long long lA, long long lB)
{
if (lB % lA == 0) return lA;
return gcd(lB % lA, lA);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long lX, lY;
cin >> lX >> lY;
vector<pair<lo... | ALGO | 0.999954 | 4.58456 |
06d7321e-b911-43bf-8f76-739bce9994be | Chris1221/mchg | lib/boost_1_61_0/libs/math/example/bessel_zeros_interator_example.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4512) // assignment operator could not be generated.
# pragma warning (disable : 4996) // assignment operator could not be generated.
#endif
#include <iostream>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <iterator>
//[bessel_zeros... | ALGO | 0.984781 | 6.462949 |
dcf6ce67-5277-4864-b32d-93425765d772 | dyan03/boj | boj/1652/main.cpp | #include <stdio.h>
#include <stdlib.h>
int isRow(char** map,int size) {
int i, j;
int count=0;
int numRow = 0;
for (i = 0; i < size; ++i) {
count = 0;
for (j = 0; j < size; ++j) {
if (map[i][j] == '.') {
if (++count == 2) {
numRow++;
}
else if (count > 2) {
continue;
}
... | ALGO | 0.999642 | 3.690142 |
924aac54-a98f-4bb7-ad1c-b6f992e94b32 | hihiroo/BOJ | DP/2225.cpp | //합분해
#include <bits/stdc++.h>
using namespace std;
#define lli long long
lli dp[205][205], mod = 1000000000, n, k;
lli f(lli sum, lli cnt){
if(sum == 0 && cnt == 0) return 1;
if(sum < 0 || cnt <= 0) return 0;
if(dp[sum][cnt] != -1) return dp[sum][cnt];
dp[sum][cnt] = 0;
for(lli i=0; i<=sum; i... | ALGO | 0.999983 | 4.543768 |
45e0cb51-9994-4870-baa2-97bdeacc8585 | WanThinnn/IT001_Introduction-to-Programming-Course | Labs/Lab_1/IT001-1/7-Dotre.cpp | #include <iostream>
using namespace std;
long long n;
int res = 0;
int main()
{
cin >> n;
while (n > 0 && n % 10ll == 0ll)
n = n / 10ll;
while (n > 0)
{
if (n % 10ll == 0ll) res++;
n = n / 10ll;
}
cout << res;
cout << endl;
} | ALGO | 0.999712 | 4.600318 |
1d76a04e-a3e6-4a71-ab2f-f6e91f70fcc9 | DSC-SPIDAL/harpgbdt | sub/lightgbm/compute/perf/perf_stl_partial_sum.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
using boost::compute::int_;
perf_parse_args(argc, argv... | ALGO | 0.997239 | 5.875501 |
216f797d-a309-48c0-8953-f1292a8d7460 | Pirolye/ProjectCube | deps/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp | #include "foundation/PxPreprocessor.h"
#include "foundation/PxVecMath.h"
#include "foundation/PxFPU.h"
#include "DySolverBody.h"
#include "DySolverContactPF4.h"
#include "DySolverConstraint1D.h"
#include "DySolverConstraintDesc.h"
#include "DyThresholdTable.h"
#include "DySolverContext.h"
#include "foundation/PxUtiliti... | ALGO | 0.997564 | 3.412112 |
63073e9e-61f7-4f34-919f-3d596abd9070 | rajatvaidhya/dynamic-programming | 01Knapsack.cpp | //0/1 Knapsack (Memoization)
#include<bits/stdc++.h>
using namespace std;
int solve(vector<int>&wt, vector<int>&val, int W, int index, vector<vector<int>>&dp)
{
if(index==0)
{
if(wt[0]<=W)
{
return val[index];
}
else
{
return 0;
}
}
... | ALGO | 0.999996 | 4.480775 |
9ad682f1-fbb2-4139-a1df-58445ae45933 | Lunka/lab3-Linked-list | main (6).cpp | #include <iostream>
#include <vector>
#include <queue>
// Визначення структури вузла
struct ListNode {
int val;
ListNode* next;
ListNode(int x) : val(x), next(nullptr) {}
};
// Порівняння для пріоритетної черги
struct Compare {
bool operator()(ListNode* a, ListNode* b) {
return a->val > b->val... | ALGO | 0.999936 | 6.162532 |
ab818d87-4825-49f7-ac62-59a8d3c40cfe | WiseCow/algorithm | BOJ/축사배정.cpp | #include<cstdio>
#include<vector>
#include<cstring>
using namespace std;
vector<int> in[201];
bool visit[201];
int ans[201];
bool serch(int now)
{
if (visit[now])
return 0;
visit[now] = 1;
for (int i = 0; i<in[now].size(); i++)
{
int k = in[now][i];
if (ans[k] == 0 || serch(ans[k]))
{
ans[k] = now;
re... | ALGO | 0.99968 | 3.539852 |
b1e5bc25-e575-4ba6-9833-8c17e2a2e96d | ParthKansara98/leetcode-2025 | 1/ShiftingLettersII2318.cpp | #include <iostream>
#include <vector>
using namespace std;
string shiftingLetters1(string s, vector<vector<int>> shifts) {
vector<string> shiftingLetters = {{"zabcdefghijklmnopqrstuvwxy"},{"bcdefghijklmnopqrstuvwxyza"}};
for(vector<int> shift:shifts) {
for (int i = shift[0]; i <= shift[1]; i++) {
... | ALGO | 0.999687 | 5.304498 |
4b04495b-5508-418c-936b-e9ea165c8f16 | hannahbellelee/Code-Fast.github.io | codes/cpp/chapter_dynamic_programming/climbing_stairs_dfs_mem.cpp | /**
* File: climbing_stairs_dfs_mem.cpp
* Created Time: 2023-06-30
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 记忆化搜索 */
int dfs(int i, vector<int> &mem) {
// 已知 dp[1] 和 dp[2] ,返回之
if (i == 1 || i == 2)
return i;
// 若存在记录 dp[i] ,则直接返回之
if (mem[i] != -1)
return m... | ALGO | 0.999994 | 5.939432 |
29e04415-dc8a-4e27-9329-3f63cba745ab | A-Spiral-Forge/Strivers-SDE-Sheet-Challenge | Greedy-Algorithms/Fractional-Knapsack-Problem.cpp | #include <bits/stdc++.h>
using namespace std;
bool comparator(pair<int, int> &a, pair<int, int> &b) {
// We will sort the items in decreasing order of their value/weight ratio
// Note that we are not using divide operation to avoid floating point numbers
// We are using corss multiplication to compare the... | ALGO | 0.999988 | 5.213635 |
58ac4925-6745-47f3-9050-8f548ce4b17a | fweilun/leetcode-solved | 0020-valid-parentheses/0020-valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
std::map<char, int> mapping = {
{'(', 1}, {')', -1},
{'[', 2}, {']', -2},
{'{', 3}, {'}', -3}
};
stack<int> stk;
for (char c:s){
if (stk.size() == 0){
stk.push(mapping[... | ALGO | 0.999661 | 6.620373 |
05a72a25-7e45-4e49-b20d-c2b25f9a19a1 | smitrajput/ArduousAlgorithms | JhonsonAlgo.cpp | #include<bits/stdc++.h>
using namespace std;
int min(int a, int b);
int cost[10][10], a[10][10], i, j, k, c;
int min(int a, int b)
{
if (a < b)
{
return a;
}
else
{
return b;
}
}
int main(int argc, char **argv)
{
int n, m;
cout << "Enter no of vertices";
cin >> n;
... | ALGO | 0.999979 | 4.141195 |
2fb7ccc8-406b-4cf3-87c1-4ae8efd157c9 | ishandutta2007/codeforces | ohweonfire/normal/650/E.cpp | // This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using ... | ALGO | 0.999931 | 3.841616 |
c379736c-794d-4258-b35e-1efbc6498f32 | namoto31/namoto | src/key.cpp | #include <openssl/ecdsa.h>
#include <openssl/rand.h>
#include <openssl/obj_mac.h>
#include "key.h"
// anonymous namespace with local implementation code (OpenSSL interaction)
namespace {
// Generate a private key from just the secret parameter
int EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key)
{
int ok =... | TOOL | 0.984974 | 7.681853 |
e26db6de-9738-42a3-aa94-096473fe77d9 | alice-MUGUI/game-of-game-theaory | game of game theory_3.0/pk.cpp | #define _CRT_SECURE_NO_WARNINGS
#include "head.h"
void mode_1_pk(ExMessage* msg) {
int whether = 0;
const int position = 820;
//˼ǷиӼı ܲһAnameȻŵظȥ->ƵIJ
rule();
if (msg->message == WM_LBUTTONDOWN) {
/*ҪʵֵĶ
1.ʼԵ
2.ʼmeIJ n score
ֻڵһνʱУҪһֲ̬ƴ
3.ÿѡһξPKһΣѡpk ѡҪڸλòҰ pkmeѡҪ¼em
4.
5.7֮ʤ
6.˵
7.
*/
if (... | TOOL | 0.932914 | 3.029824 |
70073547-03e6-4d5f-b4bd-08f174d43413 | dchristopherfennell/OpenSceneGraph | examples/osgposter/PosterPrinter.cpp | #include <osg/ClusterCullingCallback>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <string.h>
#include <iostream>
#include <sstream>
#include "PosterPrinter.h"
/* PagedLoadingCallback: Callback for loading paged nodes while doing intersecting test */
struct PagedLoadingCallback : public osgUtil::Inter... | TOOL | 0.879859 | 5.914786 |
91210131-fc6d-47f9-b514-2b685df6685b | fepaf/Competitive-Programming | Resoluções OJ/uri/1209 - Festas de São Petesburgo.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define INF 0x3f3f3f3f
#define MAX (1<<10)
#define MOD 1000000007
#define i64 unsigned long long
#define all(x) (x).begin() , (x).end()
#define sz(x) (int)(x).size()
#define ii pair<int, int>
#define fs first
#define pi 2*acosl(0.0... | ALGO | 0.999991 | 4.004436 |
a03c3835-5616-4c2b-a61b-04a8d6c4fbeb | leventex1/NeuralFramework | Dependencies/opencv/sources/modules/imgproc/src/rotcalipers.cpp | #include "precomp.hpp"
namespace cv
{
struct MinAreaState
{
int bottom;
int left;
float height;
float width;
float base_a;
float base_b;
};
enum { CALIPERS_MAXHEIGHT=0, CALIPERS_MINAREARECT=1, CALIPERS_MAXDIST=2 };
/*F//////////////////////////////////////////////////////////////////////////... | ALGO | 0.999862 | 5.713398 |
6ffea404-a5c3-4353-ae16-60b04af419da | pepe2405/FMI_SDA | Homeworks/Week 05/Max Area.cpp | #include <iostream>
#include <vector>
int main() {
long long n = 0, maxArea = 0;
std::cin >> n;
std::vector<long long> arr;
for (int i = 0; i < n; i++) {
int k = 0;
std::cin >> k;
arr.push_back(k);
}
for (int i = 0; i < n; i++) {
long long curr = arr[i];
... | ALGO | 0.999951 | 5.013643 |
a21666e4-b103-4357-bc5f-9d49e38ed7eb | rudenko-gold/LeetCode | 401-500/#0443 String Compression/solution #1.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int last_pos = 0;
char last = chars[0];
int cnt = 1;
for (int i = 1; i < chars.size(); i++) {
if (chars[i] == last) {
cnt++;
} else {
chars[last_pos] = last;
... | ALGO | 0.999977 | 6.393412 |
2820901c-4fa1-4ac3-b145-23c2ac0423ff | Rimki/boj_algorithm | 9251.cpp | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int dp[1001][1001];
int main(void){
string s1,s2;
cin>>s1>>s2;
for(int i=1;i<=s1.size();i++){
for(int j=1;j<=s2.size();j++){
if(s1[i-1]==s2[j-1])
dp[i][j]=dp[i-1][j-1]+1;
... | ALGO | 0.999807 | 3.84577 |
2032d3c6-6e32-4b5f-8e74-b7506fa6f048 | MyselfLeo/msfl2D | msfl2D/Vec2D.cpp | //
// Created by myselfleo on 5/19/23.
//
#include <cmath>
#include "Vec2D.hpp"
#include "Line.hpp"
namespace Msfl2D {
const Vec2D Vec2D::ZERO = {0, 0};
bool Vec2D::operator==(const Vec2D &other) const {
return x == other.x && y == other.y;
}
bool Vec2D::operator!=(const Msfl2D::Vec2D &othe... | ALGO | 0.921878 | 5.753868 |
9d73ea6b-adc9-4a05-aa67-32cd44ebdb15 | kabir-afk/C-and-Cpp | Sorting-Algos/selection-sort.cpp | // SPACE COMPLEXITY : O(1)
// TIME COMPLEXITY :O(N^2)
// BETTER USE IT FOR SMALLER ARRAYS
// UNSTABLE SORTING ALGORITHM
// TRAVERSES THROUGH WHOLE ARRAY
#include <iostream>
using namespace std;
int main()
{
int arr[] = {14, 10, 7, 6, 1, 5};
int size = sizeof(arr) / sizeof(int);
for (int i = 0; i < size; i++... | ALGO | 0.999893 | 4.43723 |
f4990730-a3fb-4141-b7f2-6397da867379 | ayoubmajid67/Basic-roadmap | 07 - Algorithms & Problem Solving Level 3/CODE/problem29.cpp | /*
problem 29 :
write a program to read a string then count small/capital letters in that sting
*/
#include <iostream>
#include "myLib.h"
#include <cctype>
#include <string>
using namespace std;
int getNumberOfCapitaLetterInString(string str)
{
int count = 0;
for (int i = 0; i < str.length(); i++)
{
... | TOOL | 0.976275 | 5.410896 |
f8195cec-0d73-4a90-933f-9b5d7b4d1d43 | uniking/study-linux-Demo | hadoop/ml/bandit-algorithms/eigen-3.2.4/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.992092 | 3.669638 |
a0599771-5d13-4982-a6e0-9a5880bedbbb | nvidia-holoscan/holoscan-sdk | src/core/distributed/app_worker/client.cpp | #include "client.hpp"
#include <limits>
#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include "holoscan/core/fragment.hpp"
#include "holoscan/logger/logger.hpp"
namespace holoscan::distributed {
AppWorkerClient::AppWorkerClient(const std:... | WEB | 0.898017 | 6.805459 |
8ed8a4a1-d7ae-4400-b94d-760a1e08a194 | Aunkon/URI | 1046_Game Time.cpp | /**** Md. Walid Bin khalid Aunkon ****/
/**** Daffodil International University ****/
/**** ID: 121-15-1669 ****/
/**** Email: <EMAIL> ****/
/**** Mobile No: +88-01916-492926 ****/
#include<bits/stdc++.h>
using ... | ALGO | 0.999341 | 3.099123 |
7422415a-6cb8-48d1-9909-eacd5cdbe26d | SyedHanzalaAli/ICT | OOP/opp/opp5.cpp | //polymorphism
#include <iostream>
#include <string>
using namespace std;
class Student{
public:
string name;
Student (){
cout << "non parameterized\n";
}
Student (string name){
this->name = name;
cout << "Parameterized\n";
}
};
//Compile time polymorphism
//functio... | TOOL | 0.888179 | 4.543841 |
ee9d0134-8b35-4583-bde8-d619a90d66c3 | Bobue/GameBase | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.94874 | 6.933585 |
7d4c2051-c177-47b3-9684-d35eef6e364e | anfishka/checkersRevolution | checkersRevolution/Source.cpp |
#include <iostream>
using namespace std;
const int BOARD_S = 8;
const char EMPTY = '-';
const char O = 'O';
const char X = 'X';
const char O_KING = 'o';
const char X_KING = 'x';
char board[BOARD_S][BOARD_S] = {
{ EMPTY, X, EMPTY, X, EMPTY, X, EMPTY, X },
{ X, EMPTY, X, EMPTY, X, EMPTY, X, EMPTY },
{ EMPT... | ALGO | 0.999024 | 5.745392 |
38969160-05d5-4ed2-8d80-d8d6a39185fe | ssolo/ALE---exODT- | ML_util.cpp | #include "ML_util.h"
using namespace bpp;
using namespace std;
scalar_type tree_LL(string tree,string aln_filename,bool optimize_bls,scalar_type tolerance)
{
const Alphabet* alphabet = new ProteicAlphabet();
OrderedSequenceContainer *alignment;
VectorSiteContainer* sites;
Fasta Reader;
//Phylip * Reader=new Phy... | ALGO | 0.999746 | 5.731291 |
a444f4a1-5b87-45b8-ada1-a48256690783 | albertomontesg/algorithms-lab | examples/cgal/lp_qp/cancer_therapy.cpp | // example: decide whether there exists a disk that covers a given set
// of points R in the plane and is disjoint from another set of points B
#include <iostream>
#include <cassert>
#include <CGAL/basic.h>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
#include <CGAL/Gmpz.h>
// choose exact integral type
... | ALGO | 0.99995 | 5.909384 |
e170e915-a119-4bf6-bf0b-8a81556323e0 | Anup0099/450DSA_Question | src/Cpp/goodsequence.cpp | #include <bits/stdc++.h>
using namespace std;
// Suppose you have a binary array BB of length NN.
// A sequence x_1, x_2, \ldots, x_kx
// 1
//
// ,x
// 2
//
// ,…,x
// k
//
// is called good with respect to BB if it satisfies the following conditions:
// 1 \leq x_1 \lt x_2 \lt \ldots \lt x_k \leq N+11≤x
/... | ALGO | 0.999957 | 5.038035 |
857d5e92-1eb0-47b6-a4b3-0ba7e29fb2b6 | MarekPelowski/Polish-Junior-IT-Olympiad | old_problems2/stage 1/log/log.cpp | #include <iostream>
#include <vector>
std::string findWord(std::string text, int wordIndex) {
std::string newWord = "";
int count = 0;
for(int i = 0; i < text.length(); i++) {
if(text[i] == ' ') {
count++;
if(count == wordIndex) break;
else {newWord = ""; continu... | ALGO | 0.988735 | 4.573083 |
c443482d-714a-440a-9f67-722c8f27dc3e | devararendy/tcp_proxy | sdk/boost_1_77_0/libs/bimap/example/tutorial_info_hook.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TOOL | 0.930247 | 6.843679 |
a54259a6-c80c-424d-923a-b5635cf76737 | yerkeboolan/PL_2016 | week4/change.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int a,b,c,d;
cout <<"The dollar of product:"<<endl;
cin >>a;
cout <<"The cent of product:"<<endl;
cin >>b;
cout <<"Someone paid (dollar):"<<endl;
cin >>c;
cout <<"Someone paid (cent):"<<endl;
cin >>d;
if (a<c && b<d) {
int e ... | ALGO | 0.996299 | 3.625405 |
d04a0d1a-8530-4c36-901f-8b0178db0c9b | Vivek1898/leetcode-practice | 0376-wiggle-subsequence/0376-wiggle-subsequence.cpp | class Solution {
public:
int wiggleMaxLength(vector<int>& nums) {
int n=nums.size();
int inc=1;
int dec=1;
for(int i=1;i<n;i++){
if(nums[i]>nums[i-1]) inc=dec+1;
else if(nums[i]<nums[i-1]) dec=inc+1;
}
return max(inc,dec);
}
}; | ALGO | 0.999989 | 5.613103 |
a57ad45f-b4cf-4358-9621-94d22e84dff5 | Shinimani/CompC | C++/IIT_contests/Codemania_3/shortest.cpp | #include<bits/stdc++.h>
using namespace std;
#define repn(i,n) for(int i=0;i<n;i++)
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define pb push_back
#define endl '\n'
// #define pii pair<ll int,ll int>
// #define vi vector<... | ALGO | 0.999968 | 4.296134 |
9ac1f5e0-fcca-45c3-8a6c-43db6d3958e3 | JinnyWanna/cpp_practice | stack/17298_rightbignum_re.cpp | #include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <stack>
std::vector<int> input_vec;
std::vector<int> size_vec;
std::stack<int> stack;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr); std::cout.tie(nullptr);
int N;
std::cin >> N;
std::vecto... | ALGO | 0.999988 | 4.84966 |
27c07a8b-f16c-4da3-9824-03b7b7936ad7 | srishti-agarwal/Artificial-Intelligence | A(star)/main.cpp | /*This is the entry application which generates the problem to be fed
to the BlocksWorld and provide the final result for the final steps*/
#include <iostream>
#include <random>
#include <vector>
#include <stack>
#include <random>
#include "BlocksWorld.h"
using namespace std;
void mockGenerator(int stacks, int block... | ALGO | 0.995405 | 3.114338 |
a5ea279d-b486-40f9-98bc-885499939e36 | WymanMills/Hacktober2022 | CPP/task/PairSum.cpp | //You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.
// Note:
// Each pair should be sorted i.e the first value should be less than or equals to the second value.
// Return the list of pair... | ALGO | 0.999961 | 4.207366 |
5109ab90-b022-4016-9f55-5b3195557d8b | AlexandreFoley/QuantiT | sources/btensor_linalg.cpp |
#include "LinearAlgebra.h"
#include "blockTensor/LinearAlgebra.h"
#include "torch_formatter.h"
#include <ATen/TensorIndexing.h>
#include <c10/core/ScalarType.h>
#include <c10/util/ArrayRef.h>
#include <cstdint>
#include <iterator>
#include <numeric>
#include <stdexcept>
#include <tuple>
namespace quantit
{
namespace ... | ALGO | 0.979399 | 4.487205 |
94ef8898-7cc9-4fea-b9f8-dc6a7bba43d9 | MoritzMoreira/geodetic-calculator | Georechner_C++/schnitte/rueckwaertsschnitt.cpp | #include "mainwindow.h"
#include <iostream>
Rueckwaertsschnitt::Rueckwaertsschnitt(Punkt& p_p1, Punkt& p_p2, Punkt& p_p3, float& p_r1, float& p_r2, float& p_r3)
: m_p1(p_p1), m_p2(p_p2), m_p3(p_p3), m_r1(p_r1), m_r2(p_r2), m_r3(p_r3){}
std::vector<float> Rueckwaertsschnitt::berechne(){
// Definition von V... | ALGO | 0.983366 | 3.686289 |
06c26f72-e5a7-4b30-8ae4-9494a4a2ff89 | LucenZhao/graphics_project3 | src/SceneObjects/Quadric.cpp | #include <cmath>
#include <assert.h>
#include "Quadric.h"
bool Quadric::intersectLocal(const ray& r, isect& i) const
{
if (intersectFace(r, i) == true) return true;
return false;
}
bool Quadric::intersectFace(const ray& r, isect& i) const
{
vec3f p = r.getPosition();
vec3f d = r.getDirection();
double A = d[0] ... | ALGO | 0.996518 | 5.404714 |
45cba7cf-fb30-4ef1-82cd-d5af54cdb134 | Lohithnath2910/Leetcode | 2748-calculate-delayed-arrival-time/calculate-delayed-arrival-time.cpp | class Solution {
public:
int findDelayedArrivalTime(int arrivalTime, int delayedTime)
{
return ((arrivalTime + delayedTime)%24);
}
}; | ALGO | 0.999058 | 5.657423 |
983373cf-651e-4007-adaa-179f2b4b0c34 | sensen963/AtCoder | ABC/ABC117/D.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long... | ALGO | 0.999988 | 4.156691 |
b572ecdf-fafd-4d6f-85b2-be03c623d4a7 | jsox1204/c-test | test/exclude/숫자 맞추기 게임.cpp | #include <iostream>
#include <random>
int main() {
// 시드값을 얻기 위한 random_device 생성
std::random_device random_device;
// random_device 를 통해 난수 생성 엔진을 초기화
std::mt19937 gen_mt19937(random_device());
// 0 부터 100 까지 균등하게 나타나는 난수열을 생성하기 위해 균등 분포 정의
std::uniform_int_distribution<int> distribution(1,... | TOOL | 0.898324 | 4.214912 |
3f7bb53a-a29c-49d2-8f2e-88fc3de3adff | happydabas/C- | lecture-7/11checkPrime.cpp | #include<iostream>
#include<cmath>
using namespace std;
bool isPrime(int n) {
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
// you've found a factor of n in the range 2 to sqrt(n)
return false; // n cannot be prime
}
}
// n is prime
return true;
}
int main() {
int n;
cin >> n;
isPrime(n)... | ALGO | 0.999847 | 4.365172 |
b307daca-98a8-478c-855d-8cc33801e7ed | ishandutta2007/codeforces | maroonrk/normal/850/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
... | ALGO | 0.999808 | 3.672503 |
fa89197e-5c6e-4c8c-8abe-8a8eb0bce950 | Mahfuzul-Islam55/Programming | UVa/uva11572.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long t,n,m,i,j,num=0,a,b;
cin>>t;
vector<long long> vec;
map<int,int>mp;
vector<vector<int>> vec2;
set<long long> st;
while(t--){
num++;
cin>>n;
while(n--){
cin>>a;
st.insert(a);
... | ALGO | 0.999367 | 4.000914 |
f35cbf33-86dd-432c-b49f-a3db271df68d | iaGuoZhi/Leetcode | daily-problems/2038-如果相邻两个颜色均相同则删除当前颜色/solution.cpp | class Solution {
public:
bool winnerOfGame(string colors) {
int size = colors.size();
int n_a = 0, n_b = 0;
for(int i = 1; i < size - 1; ++i)
{
if(colors[i] == 'A' && colors[i-1] == 'A' && colors[i+1] == 'A'){
n_a += 1;
}
if(colors... | ALGO | 0.999781 | 6.025104 |
69c65d23-fa95-4869-99e2-a6d7f8b0d6c3 | PixelBuildsROM/android_frameworks_av | media/module/codecs/mp3dec/src/pvmp3_alias_reduction.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_alias_reduction.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
----------------... | ALGO | 0.99878 | 3.916914 |
ee595fe5-015b-4155-8259-3fe332f36e99 | luizcdc/trying-new-things | coding_exercises/week.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string week[7] = {"Sunday\n", "Monday\n", "Tuesday\n", "Wednesday\n", "Thursday\n", "Friday\n", "Saturday\n"};
int day;
cin>>day;
day %= 7;
switch (day)
{
case 0:
cout<<week[6];
break;
case 1:
... | ALGO | 0.998103 | 3.454376 |
944348ab-1ac5-4376-8cab-dd85169b4c0c | 0-0Jay/Record-of-study | 알고리즘 학원 예제/369.cpp | // 백준 17614번 369 : https://www.acmicpc.net/submit/17614
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, cnt;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int tmp = i;
while (tmp > 0) { // 각 자릿수가 3, 6, 9일때마다 카운팅
if (tmp % 10 == 3 || tmp % 10 == 6 || tmp % 10 == 9) cnt++;
... | ALGO | 0.999434 | 4.368843 |
a058a94d-12a0-40a9-b4bb-20ed4487a47b | Alaxe/noi2-ranking | 2017/solutions/D/BSS-Varna/dentist.cpp | #include<bits/stdc++.h>
using namespace std;
struct str
{
int p,v;
};
int cmp(str x,str y)
{
if(x.p>y.p)return x.p<y.p;
}
int main()
{
str a[10000];
int n=0,i,t;
while(!cin.eof())
{
cin>>a[n].p>>a[n].v;
n++;
}
n--;
sort(a,a+n,cmp);
t=a[n-1].p;
for(i=0;i<n-1;i+... | ALGO | 0.999785 | 3.525734 |
b249d8d4-cd9e-4be0-bbf2-344f117e1c05 | Autumnal-Joy/leetcode | 2001-3000/2931/main.cpp | #include <bits/stdc++.h>
using namespace std;
static auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
#ifdef LEETCODE
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
explicit TreeNode(const int x) : val(x), left(nullptr), rig... | ALGO | 0.999951 | 5.456952 |
256d5c0d-4b32-4684-b9cc-8101f278c5ea | satyasuryasaipavan/LOOPS-AND-CONDITIONS | decimal to binary.cpp | #include<stdio.h>
int main()
{
int n,i = 0,a[100];
printf("enter the decimal :");
scanf("%d",&n);
while (n != 0) {
a[i] = n % 2;
i ++;
n /= 2;
}
while (i > 0) {
i --;
printf("%d",a[i]);
}
}
| ALGO | 0.999916 | 3.303978 |
31aa53ba-82b7-4dea-9de4-65ebac71fd16 | patrik-knaperek/sgtdv-path_planning | src/path_planning_disciplines.cpp | /*****************************************************/
/* Organization: Stuba Green Team
/* Authors: Pavel Sadloň, Juraj Krasňanský
/*****************************************************/
#include "../include/path_planning_disciplines.h"
PathPlanningDiscipline::PathPlanningDiscipline()
{
}
PathPlanningDiscipline::... | TOOL | 0.979558 | 4.245965 |
ee9bf94a-9ff1-4c49-9c68-fa071cd182a9 | alexandraback/datacollection | solutions_2692487_1/C++/peterz/a.cpp | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<map>
using namespace std;
#define PII pair<int,int>
#define X first
#define Y second
#define PB push_back
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#de... | ALGO | 0.999863 | 3.331173 |
fd95bcd6-69fe-4c4f-900c-7f61771b7fd7 | Al-mizan/Competitive-Programming | codeforces/contests/918 (Div. 4)/A_Odd_One_Out.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define endl '\n'
#define ff first
#define ss second
#define pi acos(-1)
#define mod 1000000007
#define newline cout << '\n'
#define no ... | ALGO | 0.999983 | 5.16735 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.