seed stringlengths 16 5.99k | id int64 0 213 |
|---|---|
int main(int argc, char *argv[])
{
yyparse();
return 0;
} | 100 |
float getSimpleValue(int pin_x, int pin_y, int pin_z)
{
float instant_value_x = analogRead(pin_x);
float instant_value_y = analogRead(pin_y);
float instant_value_z = analogRead(pin_z);
float result = sqrt(pow(instant_value_x,2) + pow(instant_value_y,2) + pow(instant_value_z,2));
return result;
} | 101 |
void avg_pool_backprop(const T* delta,
T* out,
const Shape& delta_shape,
const Shape& out_shape,
const Shape& window_shape,
const Strides& window_movement_strides,
const Shape& paddi... | 102 |
void setup() {
Serial.begin(9600);
} | 103 |
static bool
getBoolBuffer(cstring buffer)
{
return buffer[0] == 't' &&
buffer[1] == 'r' &&
buffer[2] == 'u' &&
buffer[3] == 'e';
} | 104 |
void addPark (Park parks[], string parkname, string state, int area, int length)
{
//adds the park struct type to the array
parks[length].parkname = parkname;
parks[length].state = state;
parks[length].area = area;
} | 105 |
int calc_get_var(const char *s, int *val)
{
var_map::iterator it = calc_var_map.find(s);
if (it != calc_var_map.end()) {
*val = it->second;
return 0;
} else {
std::cerr << "variable " << s << " is not set" <<std::endl;
return -1;
}
} | 106 |
void blinker() {
for (int i=0; i<5; i++) { // 10
digitalWrite(led, LOW);
delay(100);
digitalWrite(led, HIGH);
delay(100);
}
} | 107 |
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
} | 108 |
void myOnDraw(Display* d) {
cout << "Display" << endl;
} | 109 |
int main(int argc, char *argv[]){
m_error_t res;
size_t tests, errors;
tests = errors = 0;
try {
Forker Mother;
printf("Test %d: InetStreamSocket CTROR\n",++tests);
InetStreamSocket socket;
puts("+++ CTOR finished OK!");
printf("Test %d: InetStreamSocket::hostname()\n",++tests);
... | 110 |
int main()
{
int start1, start2, n;
scanf("%d%d%d", &start1,&start2, &n);
for(int i = 0; i < n; i++)
{
int add, nt;
char c;
scanf("%d %c %d", &add, &c, &nt);
node n1 = {c, nt};
arr[add] = n1;
}
set<int> s1;
int i1 = start1;
while(i1 != -1)
{
... | 111 |
void sumofpzem()
{
Serial.println("Sum of all 3 PZEM devices");
sum_of_voltage = (voltage_usage_1 + voltage_usage_2 + voltage_usage_3);
sum_of_current = (current_usage_1 + current_usage_2 + current_usage_3);
sum_of_power = (active_power_1 + active_power_2 + active_power_3);
... | 112 |
int main()
{
int totcas;
scanf("%d",&totcas);
while (totcas--)
{
gets(s);
gets(s);
scanf("%d%d%d",&b,&p,&n);
res = 0;
if (b == 0)
{
for (int i = 0; s[i] != 0; i++)
if (s[i]%p == n)
res += i+1;
... | 113 |
void DiscreteMasterProperty__float___ObjInit_2(DiscreteMasterProperty__float* __this, ::app::Uno::UX::Property__float* property, ::app::Fuse::Animations::MixerBase* mixerBase)
{
::app::Fuse::Animations::MasterProperty__float___ObjInit_1(__this, property, mixerBase);
} | 114 |
void Exact_Solution(float *u, int Nx)
{
// put the exact solution
int i, j;
float x, y, h;
h = 1.0/(Nx+1);
for(i=0;i<Nx;++i)
{
x = (i + 1)*h;
for(j=0;j<Nx;++j)
{
//k = j + i*(N-1);
y = (j + 1)*h;
u[Nx*i+j] = sin(M_PI*x)*sin(2*M_P... | 115 |
void changeAddress(uint8_t OldslaveAddr, uint8_t NewslaveAddr) // Function to change/assign pzem address
{
static uint8_t SlaveParameter = 0x06;
static uint16_t registerAddress = 0x0002; // Register address to be changed
uint16_t u16CRC = 0xFFFF;
u16CRC =... | 116 |
void handleUI(ProductManager& manager) {
int cmd;
std::cout << "Add Product(1) / View All Products(2) / Exit(3) ? ";
std::cin >> cmd;
switch (cmd) {
case ADD_PRODUCT:
std::cout << "Book(1) / MusicCD(2) / ConversationBook(3) ? ";
std::cin >> cmd;
switch (cmd) {
case ... | 117 |
void occupy_room() {
if (!NORELAY)
digitalWrite(relay, HIGH); // active high
occupied = true;
if (!mute_buzzer)
T.pulse (buzzer, 200, HIGH); // active low // 100
// the end state is HIGH, i.e, buzzer is off *
send_status();
} | 118 |
void avg_pool(const T* arg,
T* out,
const Shape& arg_shape,
const Shape& out_shape,
const Shape& window_shape,
const Strides& window_movement_strides,
const Shape& padding_below,
const Shape& padding_above,
b... | 119 |
int main() {
assert(test(1024) == 0);
std::vector<int> test_sizes = {{ 64, 128, 256, 512, 1024, 2048, 4096 }};
for (auto size: test_sizes) {
std::vector<double> A(size * size, 0.0);
A[0] = 2.0;
A[1] = -1.0;
for (size_t i = 1; i < size - 1; ++i) {
A[i * size + ... | 120 |
int editDistance(string s1,string s2,int m,int n)
{
int dp[m+1][n+1];
memset(dp,0,sizeof dp);
for(int i=0;i<=m;i++)
{
for(int j=0;j<=n;j++)
{
if(i==0)
dp[i][j]=j;
else if(j==0)
dp[i][j]=i;
else if(s1[i-1]==s2[j-1])
{
... | 121 |
void defineFunction(MincBlockExpr* scope, const char* name, PawsType* returnType, std::vector<PawsType*> argTypes, std::vector<std::string> argNames, MincBlockExpr* body)
{
PawsFunc* pawsFunc = new PawsRegularFunc(name, returnType, argTypes, argNames, body);
scope->defineSymbol(name, PawsFunctionType::get(pawsSubrout... | 122 |
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
/* USER CODE BEGIN 7 */
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) hUsbDeviceFS.pClassData;
if (hcdc->TxState != 0)
{
return USBD_BUSY;
}
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Le... | 123 |
void
OLD_ClientUnregister (
HANDLE hDevice
)
{
HDSTATE Activity;
Activity.Activity = _AS_Unload;
Activity.AppID = InstallerProtection;
DWORD dwRet;
DeviceIoControl (
hDevice,
IOCTLHOOK_Activity,
&Activity,
sizeof(Activity),
&Activity,
sizeof(Activity),
&dwRet,
NULL
);
} | 124 |
int
getBufferInt(cstring charBuffer)
{
return atoi(charBuffer);
} | 125 |
void _stdcall SubCureTrace(tag_TRACE_LEVEL dTraceLevel,char* chMask)
{
//INT3;
PR_TRACE((g_root,dTraceLevel,chMask));
return;
} | 126 |
void measureAndCalculateRMS() {
double sum = 0, sum2 = 0;
int delayBetweenMeasures = 1;
int measureCount = 2000;
for(int i = 0; i < measureCount; i++) {
//sensor 1
double rawValue = analogRead(SENSOR_INPUT_FRONT) - 500; //sensor nr.: 515
sum += rawValue * rawValue;
//sensor 2
doubl... | 127 |
void calc_set_var(const char *s, int val)
{
calc_var_map[s] = val;
std::cout << val << std::endl;
} | 128 |
int compare(char* string1, char* string2)
{
int i = 0;
while(string1[i] != '\0' && string2[i] != '\0') {
if(string1[i] != string2[i]) {
if(string1[i] < string2[i]) {
return 1;
} else {
return -1;
}
}
i++;
}
retu... | 129 |
void get_pzem_data() // Function to check time to see if it reached mentioned time to fetch PZEM data
{
pzemdevice1();
pzemdevice2();
pzemdevice3();
sumofpzem();
} | 130 |
int findMaxFlow(adjmattype graph, int s, int t, adjmattype &fGraphvect, vector<int> parentorig)
{
int u, v;
if (-1 == s|| -1 == t)
return 0;
// Create a residual graph and fill the residual graph with
// given capacities in the original graph as residual capacities
// in residual graph
ad... | 131 |
void read_json_config()
{
std::string json = get_file_contents(config_file.c_str());
rapidjson::Document d;
d.Parse<0>(json.c_str());
output_file = d["output_file"].GetString();
crop_width = d["height"].GetInt();
crop_height = d["width"].GetInt();
scale = d["scale"].GetInt();
seed = d["seed"].GetIn... | 132 |
int main()
{
ll t;
cin>>t;
while(t--)
solve();
} | 133 |
int main(){
c_p_c();
int t; t = 1;
while(t--){
solve();
}
} | 134 |
void loop_FunkCheck()
{
//===== Receiving =====//
network.update();
while (network.available()) // Is there any incoming data?
{
RF24NetworkHeader header(FunkMasterSwitchcabinet);
network.read(header, &dataIncoming, sizeof(dataIncoming)); // Read the incoming data
if ((header.from_node == FunkMast... | 135 |
int main()
{
//// 1. 일반 함수가 템플릿 함수보다 먼저 불리기 때문에 void goo(double) = delete; 가 있으면 이 밑에서 오류남
goo(3.4);
//// 2. Mutex는 복사 생성자를 사용할 수 없음.
Mutex m1;
Mutex m2 = m1; // 복사 생성자.
} | 136 |
int main(int argc, char *argv[])
{
//Initialize variables
ifstream inFile(argv[1]);
Park prk[100];
string parkData;
string parkName;
string parkState;
int arrayLength = 0;
int parkArea;
int minArea;
if (inFile.is_open())
while (!inFile.eof())
{
getline (inFile, pa... | 137 |
int main ()
{
int TT;
scanf("%d", &TT);
for (int tt = 1; tt <= TT; tt++) {
int R, C, N;
scanf("%d %d %d", &R, &C, &N);
ULL sol = get_min(R, C, N);
printf("Case #%d: %llu\n", tt, sol);
}
return 0;
} | 138 |
int RolFromXCoord(double xCoord){
double xLeft = -374495.83635;
double cellSize = 270.0;
double result;
int retVal;
result = (xCoord - xLeft)/cellSize;
retVal = result;
return retVal;
} | 139 |
double toPounds(int x){
double numPounds = x * lbs;
return numPounds;
} | 140 |
int main()
{
freopen("path.in","r",stdin);
freopen("path.ans","w",stdout);
fac[0]=1;
for(int i=1;i<N;i++) fac[i]=1ll*fac[i-1]*i%mod;
scanf("%d",&Case);
scanf("%d",&n);
for(int i=1,u,v,w;i<n;i++) scanf("%d%d%d",&u,&v,&w),add(u,v,w),add(v,u,w);
scanf("%d",&k);
for(int i=1;i<=k;i++) scanf("%d",&A[i]),mark[A[i]]=1... | 141 |
void pfMemFree(hOBJECT hObj,void* Obj)
{
if (!Obj) return;
CALL_SYS_ObjHeapFree(hObj,Obj);
return;
} | 142 |
void process()
{
for(int j=1;j<20;j++)
for(int i=1;i<=n;i++)
fa[i][j]=fa[fa[i][j-1]][j-1],val[i][j]=mul(val[i][j-1]+val[fa[i][j-1]][j-1]);
} | 143 |
void setCoin(int w)
{
int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < s[i].size(); j++)
if (!ox[s[i][j] - 'A'])
coin[s[i][j] - 'A'] += w * ((i == 1) * 1 + (-1) * (i == 0));
return ;
} | 144 |
void p4(Node *h){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL || (
pn->c != ',' &&
pn->c != ';' &&
pn->c != ':' &&
pn->c != '@' &&
pn->c != '#' &&
pn->c != '$' &&
pn->c != '%' &&
pn->c != '&')){
p = p->next;
continue;
}
// cout<<"p4"<<endl;
Node *node;
node = new ... | 145 |
void loop() {
if (millis() - t0 > 1000)
{
state++;
t0 = millis();
}
accel = getSimpleValue(X_ACCEL, Y_ACCEL, Z_ACCEL);
// Serial.print("Simple value: ");
// Serial.print(accel);
float accel_rms = getFilteredSignal(X_ACCEL, Y_ACCEL, Z_ACCEL);
Serial.print(accel_rms);
Serial.print(",");
accel_rm... | 146 |
int ledToggle(String command) {
/* Particle.functions always take a string as an argument and return an integer.
Since we can pass a string, it means that we can give the program commands on how the function should be used.
In this case, telling the function "on" will turn the LED on and telling it "off"... | 147 |
void del(Node *p){
if(p->next){
Node *pnext = p->next;
Node *pnextnext = pnext->next;
p->next = pnextnext;
delete pnext;
}
} | 148 |
void p7(Node *h){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL ||
(pn->c != ']' &&
pn->c != '[' &&
pn->c != '(' &&
pn->c != ')' &&
pn->c != '{' &&
pn->c != '}' &&
pn->c != '<' &&
pn->c != '>')){
p = p->next;
continue;
}
// cout<<"p7"<<endl;
Node *node = new N... | 149 |
int mul(int x){return x>=mod?x-mod:x;} | 150 |
void setup_Funk()
{
SPI.begin();
radio.begin();
network.begin(FunkChannel, FunkSlaveJoystick); //(channel, node address)
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_2MBPS);
radio.setAutoAck(1); // Ensure autoACK is enabled
radio.setRetries(15, 15);
// delay How long to wait between each retry,... | 151 |
void phasefailurenotification()
{
if(phasefailurenotificationflag == true && phaseFailureAlertOnOffState == 0 && blynkConnectionStatusForNotification == true){
Serial.println("Sending Phase Failure Blynk notification");
Blynk.notify("Phase Failure Detected!");
phasefailurenotificationflag = false;
... | 152 |
void calc_expr(int val)
{
std::cout << val << std::endl;
} | 153 |
void DiscreteMasterProperty__bool__OnComplete(DiscreteMasterProperty__bool* __this)
{
bool nv = __this->RestValue();
float str = 0.5f;
for (::app::Uno::Collections::List1_Enumerator__Fuse_Animations_MixerHandle_bool_ enum_123 = ::uPtr< ::app::Uno::Collections::List__Fuse_Animations_MixerHandle_bool_*>(__th... | 154 |
int main(){
int n,v;
fin>>n;
int en=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
fin>>v;
if(j<=i)
continue;
edg[en].v=v;
edg[en].x=i;
edg[en].y=j;
en++;
}
}
//
sort(edg,edg... | 155 |
int main()
{
Proxy c;
c.set_X(4);
c.set_Y(4.5);
c.set_Z("Hello");
for(int i=0; i<5; i++){
c.g();
c.f(4);
}
} | 156 |
void expand_idata(float *data2, float *data3, int Nx, int Ny, int Lx)
{
#pragma acc parallel loop independent present(data2[0:Lx*Ny],data3[0:2*Lx*Ny])
for (int i=0;i<Ny;i++)
{
#pragma acc loop independent
for (int j=0;j<Lx;j++)
{
data3[2*Lx*i+2*j] = data2[Lx*i+j];
data3[2*Lx*i+2*j+1] = 0.0;
}... | 157 |
void pzemdevice2() // Function to get PZEM device 2 data
{
Serial.println("====================================================");
Serial.println("Now checking PZEM Device 2");
uint8_t result2;
ESP.wdtDisable();
result2 = node2.readInputRegisters... | 158 |
void print_usage(FILE* stream, int exit_code, char* program_name)
{
fprintf(stream,
"A program to generate terrain and features with variable formats.\n\n");
fprintf(stream, "Usage: %s [options]\n", program_name);
fprintf(stream,
" -h --help Display this usage information.\n"
" ... | 159 |
float
getBufferFloat(cstring charBuffer)
{
return (float) atof(charBuffer);
} | 160 |
int main()
{
Student s[3]={{1001,"Sunny",90},{1002,"Tom",80},{1003,"Kitty",85}};
Student *p,*head;
head=s;
s[0].next=&s[1];
s[1].next=&s[2];
s[2].next=NULL;
p=head;
while(p!=NULL)
{
printf("%6d %6s %6.2f",p->num,p->name,p->score);
p=p->next;
printf("\n");
}
return 0;
} | 161 |
int main()
{
string s1 = "eebaacbcbcadaaedceaaacadccd";
string s2 = "eadcaacabaddaceacbceaabeccd";
bool result = isScramble(s1, s2);
cout << "result = " << result << endl;
return 0;
} | 162 |
void accel_values_put(float value_in)
{
if (queue_position == RMS_window)
queue_position = 0;
accel_values[queue_position] = value_in;
queue_position++;
} | 163 |
int main() {
Foo s1, s2(1);
bar(s1);
bar(2);
} | 164 |
float getSeparatedValues(int pin)
{
float instant_value = analogRead(pin);
return instant_value;
} | 165 |
void p13(Node *h, char *c){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL || pn->c != c[0]){
p = p->next;
continue;
}
Node *pnn = pn->next;
if(pnn == NULL || pnn->c != c[1]){
p = p->next;
continue;
}
Node *pnnn = pnn->next;
if(pnnn == NULL || pnnn->c != c[2]){
p = p->next;
... | 166 |
void solve(){
string s; cin>>s;
bool w = false;
bool com = false;
bool fwd = false;
int w_cnt = 0;
int fw_cnt = 0;
for(int i = 0; i < s.length(); i++){
if(w_cnt == 3 && !w){
cout<<".";
w = true;
}
if(s[i] == 'w'){
w_cnt++;
}... | 167 |
int main(){
//use double otherwise it will overflow
double m,n;
vector<double>top;
vector<double>bottom;
while(cin>>m>>n){
if(m==0&&n==0)
break;
if(n==0){
cout<<1<<endl;
continue;
}
n=min(n,m-n);
for(double i=0;i<n;i++){
... | 168 |
int main(int argc, char* argv[]) {
// g++ -I./include -o a.out oddEvenLinkedList.cpp include/list_node.cpp -g
// createLink 总是不delete,所以,其实这个main会内存泄露
Solution *solu = new Solution();
cout << "begin run:" << endl;
ListNode *head = createLink(5);
echoList(head);
head = solu->oddEvenList(he... | 169 |
void bar(const Foo i) {
static Foo s3 = i + 1;
++s3;
} | 170 |
void fast_poisson_solver_gpu(float *b, float *x, float *data2, float *data3, int Nx, int Ny, int Lx)
{
int i, j;
float h, *lamda, *temp;
temp = (float *) malloc(Nx*Ny*sizeof(float));
lamda = (float *) malloc(Nx*sizeof(float));
h = 1.0/(Nx+1);
#pragma acc data create(lamda[0:Nx],temp[0:Nx*Ny]), present(b[0:Nx*N... | 171 |
void read_command() {
network.read(in_header, &command_payload, sizeof(command_payload));
Serial.print(F("Received <- Header.From: 0"));
Serial.print(in_header.from_node, OCT);
Serial.print(F(" command: "));
Serial.println(command_payload.command);
//Serial.print(F(" value: "));
//Serial.pr... | 172 |
void p10(Node *h){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL || pn->c != '\"'){
p = p->next;
continue;
}
// cout<<"p10"<<endl;
Node *node;
node = new Node(' ');
p = insert(p,node);
node = new Node('\'');
p = insert(p,node);
node = new Node('\'');
p = insert(p,node);
node = ... | 173 |
int main() {
for (int i = 0; i < 100; ++i) {
pid_t pid = fork();
if (pid == -1) {
std::cout << "Failed to fork (i = " << i << "): " << strerror(errno) << std::endl;
break;
}
if (pid == 0) {
sleep(1);
return 0;
}
}
return... | 174 |
void loop() {
//LECTURA DE ESTADOS
isDoorOpen = digitalRead(pinDoor);
hasDetection = !digitalRead(pinSensor);
isRinging = !digitalRead(pinDoorBell);
//MOSTRAR INFO EN LED
if (isRinging==true) {
ledToggle("on");
} else {
ledToggle("off");
}
/*
//MOSTRAR INFO EN LED
... | 175 |
int main(){
while(~scanf("%d",&N)){
for(int i=1;i<=N;i++)
scanf("%d",&a[i]);
sort(a+1,a+N+1);
dp[1]=a[1];
dp[2]=a[2];
for(int i=3;i<=N;i++)
dp[i]=min(dp[i-1] + a[1] + a[i],dp[i-2] + a[1] + a[i] + 2*a[2]);
printf("%d\n",dp[N]);
... | 176 |
void send_status() {
if (SIMULATION) {
status_payload.occupied = random(0,2); // [min, max)
status_payload.temperature = random(0, 40);
status_payload.humidity = random(0,100);
}
else {
status_payload.occupied = occupied;
status_payload.temperature = temperature;... | 177 |
void fpcM_Draw(void* pProc) {
fpcDw_Execute((base_process_class*)pProc);
} | 178 |
void Myswap(Priority &ob1,Priority &ob2)
{
Priority temp;
temp =ob1;
ob1=ob2;
ob2=temp;
} | 179 |
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
int q;
cin>>q;
while(q--)
{
int l,r;
cin>>l>>r;
int result=arr[l];
for(int i=l+1;i<=r;i++)
{
result = gcd(arr[i],result);
}
cout<<result<<endl;
}
ret... | 180 |
int main(int argc, char const *argv[]){
int a, b, c, d;
scanf("%d %d %d %d",&a, &b, &c, &d);
if(a*b >= c*d){
printf("%d\n", a*b);
}
else{
printf("%d\n", c*d);
}
return 0;
} | 181 |
int main (int argc, char** argv)
{
char * hostName;
if (argc > 1)
hostName = argv[1];
else return -1;
/*
hostent* node = gethostbyname(hostName);
servent* service = getservbyname(hostName, NULL);
*/
struct addrinfo* res;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
... | 182 |
void p9(Node *h){
Node *p = h;
Node *node = new Node(' ');
p = insert(p,node);
while(p->next){
p = p->next;
}
node = new Node(' ');
p = insert(p, node);
} | 183 |
int main()
{
int n;
cin >>n;
int a[n];
int mx=INT_MIN;
int mn=INT_MAX;
for(int i=0;i<n;i++){
cin >>a[i];
mx=max(mx,a[i]);
mn=min(mn,a[i]);
}
int mnI,mxI;
for(int i=0;i<n;i++){
if(mx==a[i]){mxI=i;}
if(mn==a[i]){mnI=i;}
}
int ans;
if(... | 184 |
void swith_off() // Function to switch off relays
{
Serial.println("Switching off Relay 1 now..");
digitalWrite(RELAY_PIN_1, HIGH); // Turnoff Relay 1
Serial.println("Relay 1 OFF..");
Blynk.virtualWrite(VPIN_BUTTON_1, HIGH); // Up... | 185 |
void solve()
{
cin>>n;
ll arr[n];
for(ll i=0;i<n;i++)
cin>>arr[i];
dfs(0,0,arr);
// cout<<41243431;
map<ll,ll>::iterator itr;
for(itr=st.begin();itr!=st.end();itr++)
{
while(itr->second!=0)
{
cout<<itr->first<<" ";
itr->second--;
}
... | 186 |
void printList (const Park parks[], int length)
{
for (int i = 0; i < length; i++)
{
cout << parks[i].parkname << " [" << parks[i].state << "] area: " << parks[i].area << endl;
}
} | 187 |
float Error(float *x, float *u, int Nx)
{
// return max_i |x[i] - u[i]|
int i, j;
float v, e;
v = 0.0;
for(i=0;i<Nx;++i)
{
for(j=0;j<Nx;j++)
{
e = fabs(x[Nx*i+j] - u[Nx*i+j]);
if(e > v) v = e;
//v = max(v, e);
}
}
return v;
} | 188 |
int main(int argc, char* argv) {
Mat src = imread("lena.jpg");
Mat gsrc;
Mat lsrc;
pyrDown(src, gsrc);//高斯金字塔 成倍向下采样
pyrUp(src, lsrc);//拉普拉斯金字塔 向上采样
namedWindow("src");
moveWindow("src", 0, 0);
namedWindow("gsrc");
moveWindow("gsrc", 512, 0);
namedWindow("lsrc");
moveWindow("lsrc", 0, 512);
imshow("src"... | 189 |
void pzemdevice1() // Function to get PZEM device 1 data
{
Serial.println("===================================================="); // PZEM Device 1 data fetching code starts here
Serial.println("Now checking PZEM Device 1");
uint8_t result1;
ESP.wd... | 190 |
int main()
{
#pragma region "Bubble Sort"
char word[] = { "TOLEARNSORTALGORITHMK" };
printf( "%s\n", word );
BubbleSort( word, strlen( word ) );
printf( "%s\n", word );
#pragma endregion
return 0;
} | 191 |
void chatterCallback(const std_msgs::String::ConstPtr& msg){
ROS_INFO("I got:[%s]",msg->data.c_str());
} | 192 |
int main()
{
const int size = 30005;
int n, m, max = 0;
scanf("%d",&n);
int p[size];
for (int i = 0; i < size; i++)
{
p[i] = 0;
}
while (n--)
{
scanf("%d",&m);
p[m] ++;
}
for (int i = 0; i < size; i++)
{
max = p[i] > max ? p[i] : max;
}... | 193 |
void p15(Node *h){
Node *p = h;
while(p->next){
if((p->next)->c == ' ') del(p);
else break;
}
// cout<<"p15"<<endl;
while(p){
if(p->c == ' '){
while(p->next){
if((p->next)->c == ' ') del(p);
else break;
}
}
p = p->next;
}
} | 194 |
void low_voltage_check()
{
if(voltage_usage_1 == 0 || voltage_usage_2 == 0 || voltage_usage_3 == 0){
Serial.println("Phase failure detected...");
phasefailureflag = true;
phasefailurenotification();
} else if(voltage_usage_1 < LOW_VOLTAGE_1_CUTOFF || voltage_usage_2 < LOW_VOLTAGE_2_CUTOFF || voltage_usa... | 195 |
void BubbleSort( char* target, size_t count )
{
for ( size_t i = 0; i < count - 1; ++i )
{
for ( size_t j = 1; j < count - i; ++j )
{
if ( target[ j - 1 ] > target[ j ] )
{
char temp = target[ j ];
target[ j ] = target[ j - 1 ];
target[ j - 1 ] = temp;
}
}
}
} | 196 |
int main()
{
List<int> l1;
l1.PushBack(1);
l1.PushBack(2);
l1.PushBack(3);
l1.PushBack(4);
l1.PrintList();
return 0;
} | 197 |
void p5(Node *h){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL || pn->c == '.'){
p = p->next;
continue;
}
Node *pnn = pn->next;
if(pnn == NULL || pnn->c != '.'){
p = p->next;
continue;
}
Node *pnnn = pnn->next;
if(pnnn == NULL){
// cout<<"p5_1 "<<p->c<<endl;
Node *node;
... | 198 |
int RowFromYCoord(double yCoord){
double yBot = -616153.33419;
double cellSize = 270.0;
double result;
int retVal;
result = (yCoord - yBot)/cellSize;
retVal = result;
return retVal;
} | 199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.