seed stringlengths 16 5.99k | id int64 0 213 |
|---|---|
int main() {
// your code goes here
string s1,s2;
cin>>s1>>s2;
int m,n;
m=s1.length();
n=s2.length();
cout<<editDistance(s1,s2,m,n);
return 0;
} | 0 |
void read_sensors() {
num_hits = 0; // global variable
num_hits += digitalRead(radar);
num_hits += digitalRead(pir1);
num_hits += digitalRead(pir2);
digitalWrite (led, (num_hits==0)); // active low
} | 1 |
inline double getBilinearInterpolatedValue(const Mat &img, const Vector2d &pt)
{
uchar *d = &img.data[int(pt(1, 0)) * img.step + int(pt(0, 0))];
double xx = pt(0, 0) - floor(pt(0, 0));
double yy = pt(1, 0) - floor(pt(1, 0));
return ((1 - xx) * (1 - yy) * double(d[0]) +
xx * (1 - yy) * double... | 2 |
int main() {
float acum;
float dato;
int i;
int n;
float prom;
cout << "Ingrese la cantidad de alumnos:" << endl;
cin >> n;
acum = 0;
for (i=1;i<=n;i++) {
cout << "Ingrese la edad " << i << ":" << endl;
cin >> dato;
acum = acum+dato;
}
prom = acum/n;
cout << "El promedio de las edades del grupo de " <... | 3 |
int main(){
string N;
cin>>N;
int d[10]={0};
int len=N.length();
for(int i=0;i<len;i++)
d[N[i]-'0']++;
for(int i=0;i<10;i++){
if(d[i]!=0)
cout<<i<<":"<<d[i]<<endl;
}
return 0;
} | 4 |
inline bool e_server_msg_type_Parse(
const ::std::string& name, e_server_msg_type* value) {
return ::google::protobuf::internal::ParseNamedEnum<e_server_msg_type>(
e_server_msg_type_descriptor(), name, value);
} | 5 |
void add(int u,int v,int w){e[++ecnt]={v,w,head[u]};head[u]=ecnt;} | 6 |
int main()
{
int s;
for(int a=1; a<=100;a=a+2)
{
s=s+a;
} printf("Tong so le den so 100 la: %d \n",s);
return 0;
} | 7 |
void low_volt_alert() // Function to send blynk push notifiction if low voltage is detected
{
if(lowvoltagenotificationflag == true && underVoltageAlertOnOffState == 0 && blynkConnectionStatusForNotification == true){
Serial.println("Sending Under voltage Blynk notification");
Bl... | 8 |
void setup(){
//setup all VCC main settings
VCC.setup();
} | 9 |
static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
{
/* USER CODE BEGIN 5 */
switch (cmd)
{
case CDC_SEND_ENCAPSULATED_COMMAND:
break;
case CDC_GET_ENCAPSULATED_RESPONSE:
break;
case CDC_SET_COMM_FEATURE:
break;
case CDC_G... | 10 |
bool cmp(const eg& e1,const eg&e2)
{
return e1.v<e2.v;
} | 11 |
void fpcM_Execute(void* pProc) {
fpcEx_Execute((base_process_class*)pProc);
} | 12 |
void loop() {
// The transmitter sends in this example the signal A90 (hex. dezimal form) in the encoding "RC5"
// It will be transmitted 3 times after that it will make a 5 second break
for (int i = 0; i < 3; i++) {
// irsend.sendRC5(0xA90, 12); // [0xA90] signal | [12] Bit-length signal (h... | 13 |
void Exact_Source(float *b, int Nx)
{
int i,j;
float x, y, h;
h = 1.0/(Nx+1);
#pragma acc parallel loop gang present(b)
for(i=0;i<Nx;++i)
{
x = (i+1)*h;
#pragma acc loop vector
for(j=0;j<Nx;++j)
{
//k = j + i*(N-1);
y = (j+1)*h;
b[Nx*i+j] = -(1.0+4.0)*h*h*M_PI*M_PI*sin(M_PI*x)*sin(2... | 14 |
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> m >> n >> h; totalnum = m * n * h;
for (int k = 1; k <= h; k++) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> map1[i][j][k];
if (map1[i][j][k] == '1') {
q.push({ i,j,k });
tomato++;... | 15 |
void p3(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 || pnnn->c != '.') {
p = p->next;
continue;... | 16 |
void DiscreteMasterProperty__float4___ObjInit_2(DiscreteMasterProperty__float4* __this, ::app::Uno::UX::Property__float4* property, ::app::Fuse::Animations::MixerBase* mixerBase)
{
::app::Fuse::Animations::MasterProperty__float4___ObjInit_1(__this, property, mixerBase);
} | 17 |
void ticker(){
read_sensors(); // read PIR and radar...
update_status(); // ...and then compute occupancy status
if (network.available()) // this is usually a while() loop
read_command();
} | 18 |
void sendtoBlynk() // Here we are sending PZEM data to blynk
{
Blynk.virtualWrite(vPIN_VOLTAGE_1, voltage_usage_1);
Blynk.virtualWrite(vPIN_CURRENT_USAGE_1, current_usage_1);
Blynk.virtualWrite(vPIN_ACTIVE_POWER_1, active_pow... | 19 |
void printDateTime(time_t t, const char *tz)
{
char buf[32];
char m[4]; // temporary storage for month string (DateStrings.cpp uses shared buffer)
strcpy(m, monthShortStr(month(t)));
sprintf(buf, "%.2d:%.2d:%.2d %s %.2d %s %d %s",
hour(t), minute(t), second(t), dayShortStr(weekday(t)), ... | 20 |
bool isScramble(string& s1, string& s2) {
if (s1.size() != s2.size()) return false;
if (s1.size() == 1) return s1 == s2;
string combined(s1);
combined.append(s2);
if (memo.find(combined) != memo.end()) return memo.at(combined);
int size = s1.size();
int part_length = 1;
... | 21 |
void dfs(ll i, ll sum,ll arr[])
{
if(i==n)
{
st[sum]++;
return;
}
dfs(i+1,sum+arr[i],arr);
dfs(i+1,sum,arr);
} | 22 |
void checkPhysicalButton() // Here we are going to check push button pressed or not and change relay state
{
if (digitalRead(PUSH_BUTTON_1) == LOW) {
if (pushButton1State != LOW && (lowvoltageflag == false && highvoltageflag == false && phasefailureflag == false) ) { ... | 23 |
void p11(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 || pnnn->c != ' '){
p = p->next;
continue;... | 24 |
int Pow(int x,int k){int t=1;for(;k;k>>=1,x=1ll*x*x%mod) if(k&1) t=1ll*t*x%mod;return t;} | 25 |
void calc_error(const char *s)
{
std::cout << s << std::endl;
} | 26 |
void p12(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 != 's' &&
pnn->c != 'S' &&
pnn->c != 'm' &&
pnn->c != 'M' &&
pnn->c != 'd' &&
pnn->c != 'D')){
p = p... | 27 |
int main(int argc,char **argv){
ros::init(argc,argv,"listener");
ros::NodeHandle n;
ros::Subscriber sub=n.subscribe("filePub",1000,chatterCallback);
ros::spin();//第一次操作
} | 28 |
void p8(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;
}
// cout<<"p8"<<endl;
Node *node = new Node(' ');
p = insert(p,node);
node = new Node(' '... | 29 |
int test(int size) {
if (size <= 0) return 0;
double *A = new double[size * size];
std::fill(A, A + size * size, 0.0);
if (size > 1) {
A[0] = 2.0;
A[1] = -1.0;
for (int i = 1; i < size - 1; ++i) {
A[i * size + i - 1] = -1.0;
A[i * size + i ] = 2.0;
A[i * ... | 30 |
void p1(Node *h){
Node *p = h;
Node *pn = p->next;
if(pn != NULL && pn->c == '\"'){
// cout<<"p1"<<endl;
Node *node;
node = new Node('`');
p = insert(p,node);
node = new Node('`');
p = insert(p,node);
node = new Node(' ');
p = insert(p,node);
del(p);
}
} | 31 |
static int8_t CDC_DeInit_FS(void)
{
/* USER CODE BEGIN 4 */
return (USBD_OK);
/* USER CODE END 4 */
} | 32 |
int main(int argc, char** argv){
string a;
Node* h;
char c[20];
istream *in;
if(argc >= 2) in = new ifstream(argv[1]);
else in = &std::cin;
ostream *out;
if(argc >= 3) out = new ofstream(argv[2]);
else out = &std::cout;
while(getline(*in,a)){
h = new Node();
init_List(h,a);
p1(h);
p2(h);
p3(h);
... | 33 |
int main()
{
int n;
int avgta=0;
int avgwt=0;
cout<<"Enter number process:";cin>>n;
Priority*ob=new Priority[n];
for(int i=0;i<n;i++)
{
cin>>ob[i];
}
for(int i=0;i<n;i++)
{
for(int j=i;j<n;j++)
{
if(ob[i].pt<ob[j].pt)
{
Myswap(ob[i],ob[j]);
}
if(ob[i].pt==ob[j].pt&&ob[i... | 34 |
double rootMeanSquare(double valueSum, int valueCount) {
return sqrt(valueSum / valueCount);
} | 35 |
void bfs() {
while (!q.empty()) {
bool flag = true;
int qs = q.size();
cnt++;
while (qs--) {
int x = q.front().x;
int y = q.front().y;
int z = q.front().z;
q.pop();
for (int i = 0; i < 6; i++) {
int nx = x + dr[i];
int ny = y + dc[i];
int nz = z + dz[i];
if (nx <= 0 || nx > n ||... | 36 |
void loop() {
measureAndCalculateRMS();
sendValuesAsIntegerPerPrint(rmsFrontSensor, rmsBackSensor);
} | 37 |
int main() {
ProductManager manager;
while (manager.canAddProduct()) {
handleUI(manager);
}
} | 38 |
int main()
{
deque<int> coll;
for(int i=1; i<=9; ++i) {
coll.push_back(i);
coll.push_front(i);
}
PrintAll(coll, "coll default without sort");
sort(coll.begin(), coll.end());
PrintAll(coll, "coll sort default");
sort(coll.begin(), coll.end(), greater<int>());
PrintAll(coll, "coll s... | 39 |
void DisplayItem(InventoryItem* const e)
{
for(int index = 0; index < 5; index++)
{
cout << setw(5) << index + 1
<< setw(20) << e[index].getDescription()
<< setw(20) << e[index].getUnits() << endl;
}
} | 40 |
int main()
{
int T;
cin >> T;
while (T--) {
int N, M;
cin >> N >> M;
int u, v;
Graph g(N);
while (M--) {
cin >> u >> v;
g.addEdge(u, v);
}
int s, e;
cin >> s >> e;
cout << g.countPaths(s, e) << endl;
}
return 0;
} | 41 |
void update_status() {
if (!occupied && auto_mode)
if (num_hits > 1) // at least two sensors fired - occupy the room
occupy_room();
if (num_hits > 0) // at least one fired; so the room is in use
tick_counter = 0; // keep resetting it, if there is any motion
tick_... | 42 |
void beeper (int mode) {
switch (mode) {
case 0: // useful before entering T.update loop
digitalWrite(buzzer, LOW); // active low
delay(200);
digitalWrite(buzzer, HIGH);
break;
case 1:
T.pulse(buzzer, 4000, HIGH); // active low
break;
... | 43 |
int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return(gcd(b,a%b));
} | 44 |
void loop() {
T.update();
mesh.update(); // keep the network updated
} | 45 |
int main(int argc, char** argv)
{
int next_option;
/* A string listing valid short options letters. */
const char* const short_options = "hc:sxgvna:";
/* An array describing valid long options. */
const struct option long_options[] =
{
{ "help", 0, NULL, 'h' },
{ "config", 1, NULL, 'c' },
{ "st... | 46 |
int main(int argc, char *argv[]) {
SwarmValues *v = new SwarmValues();
v->proj_weight = 0;
v->align_weight = 0;
v->noise_weight = 1-v->proj_weight-v->align_weight;
environment_food_init(200);
Environment *env = new Environment();
env->onDraw = &environment_food_onDraw;
env->onFrame = &e... | 47 |
int main(int argc, char *argv[]) {
Elev elev;
cout << elev.GetAge() << endl;
++elev;
cout << elev.GetAge() << endl;
elev++;
cout << elev.GetAge() << endl;
return 0;
} | 48 |
void p2(Node *h){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL || (pn->c != '(' &&
pn->c != '[' &&
pn->c != ' ' &&
pn->c != '{' &&
pn->c != '<')){
p = p->next;
continue;
}
Node *pnn = pn->next;
if(pnn == NULL || pnn->c != '\"'){
p = p->next;
continue;
}
// cout... | 49 |
static int8_t CDC_Init_FS(void)
{
/* USER CODE BEGIN 3 */
/* Set Application Buffers */
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
return (USBD_OK);
/* USER CODE END 3 */
} | 50 |
void setup()
{
} | 51 |
void fpcM_PauseDisable(void* pProc, u8 param_2) {
fpcPause_Disable((process_node_class*)pProc, param_2 & 0xFF);
} | 52 |
void DiscreteMasterProperty__bool___ObjInit_2(DiscreteMasterProperty__bool* __this, ::app::Uno::UX::Property__bool* property, ::app::Fuse::Animations::MixerBase* mixerBase)
{
::app::Fuse::Animations::MasterProperty__bool___ObjInit_1(__this, property, mixerBase);
} | 53 |
void DiscreteMasterProperty__float__OnComplete(DiscreteMasterProperty__float* __this)
{
float nv = __this->RestValue();
float str = 0.5f;
for (::app::Uno::Collections::List1_Enumerator__Fuse_Animations_MixerHandle_float_ enum_123 = ::uPtr< ::app::Uno::Collections::List__Fuse_Animations_MixerHandle_float_*>... | 54 |
float getFilteredSignal(int pin_x, int pin_y, int pin_z)
{
float instant_value_x = analogRead(pin_x) - mean_x;
float instant_value_y = analogRead(pin_y) - mean_y;
float instant_value_z = analogRead(pin_z) - mean_z;
float instant_value = sqrt(pow(instant_value_x,2) + pow(instant_value_y,2) + pow(instant_value_z... | 55 |
void release_room() {
if (!NORELAY)
digitalWrite(relay, LOW); // active high
occupied = false;
send_status();
} | 56 |
int main()
{
Game game;
if(!game.init())
return EXIT_FAILURE;
return game.run();
} | 57 |
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
uint8_t n = *Len;
uint8_t i;
for (i = 0; i < n; i++)
{
if (Buf[i] == '\r')
{
//slcan_parse_str(slcan_str, slcan_str_index);
//slcan_str_index = 0;
auto... | 58 |
void sendValuesAsIntegerPerPrint(double value1, double value2) {
int v1 = value1 * 100;
int v2 = value2 * 100;
Serial.print(v1);
Serial.print(',');
Serial.println(v2);
} | 59 |
void clean_List(Node *h){
Node *p;
while(h){
p = h->next;
delete h;
h = p;
}
} | 60 |
void setup() {
pinMode(led, OUTPUT);
pinMode(relay, OUTPUT);
pinMode(buzzer, OUTPUT);
if (!NORELAY)
digitalWrite(relay, HIGH); // active high; start with relay operated
digitalWrite(led, HIGH); // active low
digitalWrite(buzzer, HIGH); // active low
pinMod... | 61 |
inline void getline(std::istream& cin, std::string& s) {
char c = cin.get();
std::getline(cin, s);
if (c != '\n') s = c + s;
} | 62 |
void read_temperature() {
// Reading the DHT11 takes about 250 milliseconds
D.read11(dhtsensor);
temperature = D.temperature;
humidity = D.humidity;
} | 63 |
void generate()
{
//set crop height and width
if (crop_height < 1)
crop_height = tmap_size;
if (crop_width < 1)
crop_width = tmap_size;
//if a crop value is set
//set tmap_size to fit the cropped values
int max_size = std::max(crop_height, crop_width);
int max_size_tmp = max_size - 1;
if ((... | 64 |
void solve()
{
double k1, k2, k3, v;
cin >> k1 >> k2 >> k3 >> v;
const int DISTANCE = 100,RECORD = 958;
double speed = k1*k2*k3*v;
int time = round(100*DISTANCE/speed);
cout << (time < RECORD ? "Yes" : "No") << "\n";
} | 65 |
int setColor(String command) {
// Look through the list of colors to find the one that was requested
for(int iColor = 0; iColor < NUM_COLORS; iColor++)
{
if(command == colorName[iColor]) {
// When it matches, look up the RGB values for that color in the table,
// and write... | 66 |
int main(int argc, char const *argv[])
{
goodGrowArray<double> a(4);
a.insertStart(10.1);
a.insertStart(20.1);
a.insertStart(30.1);
a.insertStart(40.1);
a.insert(2, 1111);
a.remove(3);
int len = a.getlen();
int capacity = a.getCapacity();
double* data = a.getData();
cout << len << " " << capacity << endl;
... | 67 |
char checkForFloat(char *s) {
char decimalPoint = false;
int i;
for(i=0; s[i] != '\0'; i++) {
switch(s[i]) {
case '.':
if(decimalPoint) return false;
decimalPoint = true;
break;
case '0':
case '1':
case '... | 68 |
void fpcM_PauseEnable(void* pProc, u8 param_2) {
fpcPause_Enable((process_node_class*)pProc, param_2 & 0xFF);
} | 69 |
void init_List(Node *h, const string &a){
Node *p = h;
for(int i = 0; i < a.size(); i ++){
Node *current = new Node(a[i]);
p->next = current;
p = current;
}
} | 70 |
bool comp(ll i,ll j)
{
return i>j;
} | 71 |
float RMS(float values[])
{
float result;
result = 0;
for(int i = 0; i < RMS_window; i++)
{
result += pow(values[i], 2);
}
result = sqrt(result/10);
return result;
} | 72 |
void high_voltage_check()
{
if(voltage_usage_1 > HIGH_VOLTAGE_1_CUTOFF || voltage_usage_2 > HIGH_VOLTAGE_2_CUTOFF || voltage_usage_3 > HIGH_VOLTAGE_3_CUTOFF){
Serial.println("High voltage detected...");
highvoltageflag = true;
swith_off();
} else {
highvoltageflag = false;
}
} | 73 |
bool renew_network() {
if (mesh.checkConnection()) {
return (true);
}
else {
Serial.println(F("Renewing network address..."));
unsigned int addr = mesh.renewAddress(3000UL);
if (addr != 0) {
Serial.print(F("New address: "));
Serial.println(ad... | 74 |
void pzemdevice3() // Function to get PZEM device 1 data
{
Serial.println("===================================================="); // PZEM Device 1 data fetching code starts here
Serial.println("Now checking PZEM Device 3");
uint8_t result3;
ESP.wd... | 75 |
void p6(Node *h){
Node *p = h;
while(p){
Node *pn = p->next;
if(pn == NULL || (pn->c != '?' && pn->c != '!')){
p = p->next;
continue;
}
// cout<<"p6"<<endl;
Node *node = new Node(' ');
p = insert(p,node);
node = new Node(' ');
pn = insert(pn,node);
p = pn;
}
} | 76 |
int askdist(int u,int v)
{
int res=0;
if(deep[u]<deep[v]) std::swap(u,v);
for(int i=19;~i;i--) if(deep[fa[u][i]]>=deep[v]) res=mul(res+val[u][i]),u=fa[u][i];
if(u==v) return res;
for(int i=19;~i;i--)
if(fa[u][i]!=fa[v][i]) res=(res+val[u][i]+val[v][i])%mod,u=fa[u][i],v=fa[v][i];
res=mul(res+val[u][0]+val[v][0])... | 77 |
void full_to_csr_ref(
int m, int n,
double *A, int lda,
int **rowptr, int **colidx, double **values) {
*rowptr = new int[m + 1];
int zero = 0;
std::fill(*rowptr, *rowptr + m + 1, zero);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
rowptr[0][j + 1] += (A[i... | 78 |
void PrintMs(const char* text = "") {
static long long last = 0;
long long cur = getTickCount();
if (last == 0) {
last = cur;
return;
}
long long ms = 0;
ms = ((double)(cur - last) / getTickFrequency()) * 1000;
if (*text != 0) {
printf("%s = %dms\n", text, ms);
}
last = getTickCount();
} | 79 |
void print_matrix(float *x, int N)
{
int i, j;
for(i=0;i<N;i++)
{
for (j=0;j<N;j++) printf(" %f ", x[N*i+j]);
printf("\n");
}
} | 80 |
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
string s, t;
cin >> s >> t;
set<ll> s0, s1;
f(0, n)
{
if (s[i] != t[i])
{
... | 81 |
void loop(void)
{
//////////STILL TRYING TO GET ZULU WITH A DIFFERENT LIBRARY
time_t utc = now();
time_t local = myTZ.toLocal(utc, &tcr);
Serial.println();
printDateTime(utc, "UTC");
printDateTime(local, tcr -> abbrev);
delay(10000);
//THIS WORKS - Now integrate it into the... | 82 |
void setup()
{
Serial.begin(9600);
pzemSerial.begin(9600);
/* start Modbus/RS-485 serial communication */
node1.begin(pzemSlave1Addr, pzemSerial);
node2.begin(pzemSlave2Addr, pzemSerial);
node3.begin(pzemSlave3Addr, pzemSerial);
/*************************************************************************... | 83 |
void warn() {
T.oscillate (buzzer,50, HIGH, 4);
// the end state is HIGH, i.e, buzzer is off *
} | 84 |
void resetEnergy(uint8_t slaveAddr) // Function to reset energy value on PZEM device.
{
/* The command to reset the slave's energy is (total 4 bytes):
Slave address + 0x42 + CRC check high byte + CRC check low byte. */
uint16_t u16CRC = 0xFFFF;
static uint8_t re... | 85 |
void setup() {
analogReference(EXTERNAL);
pinMode(X_ACCEL, INPUT);
pinMode(Y_ACCEL, INPUT);
pinMode(Z_ACCEL, INPUT);
pinMode(ledPin, OUTPUT);
queue_position = 0;
Serial.begin(9600);
Serial1.begin(9600);
mean_x = 0;
mean_y = 0;
mean_z = 0;
mean_counter = 0;
// Serial.begin(9600);
filtered_... | 86 |
void defineConstantFunction(MincBlockExpr* scope, const char* name, PawsType* returnType, std::vector<PawsType*> argTypes, std::vector<std::string> argNames, FuncBlock body, void* funcArgs)
{
PawsFunc* pawsFunc = new PawsConstFunc(name, returnType, argTypes, argNames, body, funcArgs);
scope->defineSymbol(name, PawsFu... | 87 |
void transpose(float *data_in, float *data_out, int Nx, int Ny)
{
int i, j;
#pragma acc parallel loop independent present(data_in[0:Nx*Ny],data_out[0:Ny*Nx])
for(i=0;i<Ny;i++)
{
#pragma acc loop independent
for(j=0;j<Nx;j++)
{
data_out[i+j*Ny] = data_in[i*Nx+j];
}
}
} | 88 |
void fdst_gpu(float *data, float *data2, float *data3, int Nx, int Ny, int Lx)
{
float s;
s = sqrt(2.0/(Nx+1));
#pragma acc data present(data3[0:2*Lx*Ny],data[0:Nx*Ny],data2[0:Lx*Ny])
{
expand_data(data, data2, Nx, Ny, Lx);
expand_idata(data2, data3, Nx, Ny, Lx);
// Copy data to device at start of ... | 89 |
void myOnFrame(void *simulation) {
cout << "FRAME!" << endl;
} | 90 |
double toKilo(double x){
double numKilo = x * kilograms;
return numKilo;
} | 91 |
inline bool inside(const Vector2d &pt) {
return pt(0, 0) >= boarder && pt(1, 0) >= boarder
&& pt(0, 0) < width - boarder && pt(1, 0) <= height - boarder;
} | 92 |
int main()
{
long int t,a[3],i;
scanf("%li", &t);
while(t--)
{
for(i=0;i<3;++i)
scanf("%li", &a[i]);
sort(a,a+3);
printf("%li\n", a[1]);
}
return 0;
} | 93 |
int main()
{
char choice = 'N';
int numSelected; // Entered by user
int qtySelected; // Entered by user
double subTotal; // Local variable for subTotal
double tax; // Local variable for tax
double total; // Local variable for total
InventoryItem inventory[5] = { InventoryItem("Adjustable Wrench", 3.49, 10),
... | 94 |
int main() {
UnitTest test;
test.run();
} | 95 |
void dfs(int u,int fath)
{
fa[u][0]=fath;deep[u]=deep[fath]+1;
for(int i=head[u];i;i=e[i].next)
{
int v=e[i].v;
if(v==fath) continue;
val[v][0]=e[i].w;
dfs(v,u);
}
} | 96 |
int main()
{
int p, q, r, s, Nx, Ny, Lx;
float *x, *u, *b, *data2, *data3;
clock_t t1, t2;
// Initialize the numbers of discrete points.
// Here we consider Nx = Ny.
printf("\n");
printf(" Input N = 2^p * 3^q * 5^r * 7^s - 1, (p, q, r, s) = ");
scanf("%d %d %d %d", &p, &q, &r, &s);
Nx = pow(2, p) * po... | 97 |
void TriggerDictionaryInitialization_BMHitClusterDict() {
TriggerDictionaryInitialization_BMHitClusterDict_Impl();
} | 98 |
int main()
{
int t;
cin>>t;
getchar();
while(t--)
{
char a[1001];
cin.getline(a,1001);
int n=strlen(a);
for(int i=0;i<n;i++)
{
int k=i;
while(a[k]!=' '&&a[k]!='\0') k++;
for(int j=k-1;j>=i;j--)
cout<<a[j]; i=k;... | 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.