## Runtime error : How do I avoid it for a large test case?

I have been solving the CSES problem set and I am stuck on the following problem : CSES-Labyrinth

Here is my solution :

#include <bits/stdc++.h> using namespace std;  int main() {     int n,m,distance=0,x=0,y=0;     string str1="NO",str2="";     cin>>n>>m;     char grid[n+1][m+1];     int vis[n+1][m+1];     int dis[n+1][m+1];     string path[n+1][m+1];     int dx[]={0,0,1,-1};     int dy[]={1,-1,0,0};     char dz[]={'R','L','D','U'};     queue<pair<int,int>>s;      for(int i=0;i<n;i++)         for(int j=0;j<m;j++){             cin>>grid[i][j];             if(grid[i][j]=='A'){                 x=i; y=j;             }             vis[i][j]=0;             dis[i][j]=0;             path[i][j]="";         }          s.push({x,y});     while(!s.empty()){         pair<int,int>a=s.front();         s.pop();         if(grid[a.first][a.second]=='B'){             distance=dis[a.first][a.second];             str1="YES";             x=a.first; y=a.second;             break;         }         if(vis[a.first][a.second]==1)         continue;         else{             vis[a.first][a.second]=1;             for(int i=0;i<4;i++){                 if(a.first+dx[i]<n && a.first+dx[i]>=0 && a.second+dy[i]<m && a.second+dy[i]>=0 && (grid[a.first+dx[i]][a.second+dy[i]]=='.' || grid[a.first+dx[i]][a.second+dy[i]]=='B')){                     s.push({a.first+dx[i], a.second+dy[i]});                     dis[a.first+dx[i]][ a.second+dy[i]]=dis[a.first][a.second]+1;                     path[a.first+dx[i]][ a.second+dy[i]]=path[a.first][a.second]+dz[i];                 }             }         }     }     if(str1=="YES"){         cout<<str1<<endl<<distance<<endl<<path[x][y];     }     else     cout<<str1; } 

I am getting a Runtime error on 3/15 test cases and this was the best result I could reach (other 12 cases are accepted). How do I avoid runtime errors? What is wrong with my solution?

## How large is the planet of the Forgotten Realms?

How far can a ship "see" in 5e?

prompted the question whether the Forgotten Realms are on a disc or a planet. It is a planet, as evident from the answer to this question:

Where does the Sun go at night?

However, I’m wondering what size this planet is. This information would be relevant to calculate sight ranges. Barring any contradictory information I would assume, similar to the size of earth, but my question is, if there is any official information to corroborate this or give a different size. Information for 5E is preferable, since the other question was also specifically about 5E, although I suppose that this probably has not changed between editions, so prior editions are valid if there is nothing specifically from 5E.

## Recommendations about deleting large set of rows in MSSQL

I need to delete about 75+ million rows from a table everyday that contains around 3.5 billions of record.

Database recovery mode is simple, I have writen a code that deletes 15.000 rows in a while condition until all 75M records is deleted. (i use batch delete due to log file grow) However, with current deletion speed it looks like it will take at least 5 days, which means that amount of data required to be deleted is multiply faster than my deletion speed.

Basically what i’m trying to do is summarizing (in another table) and deleting data older than 2 months. There is no update operation in that table, only insert and delete.

I have an enterprise edition of MSSQL 2017

Any suggestions will be welcome.

## Rules for DM’ing large scale battles [duplicate]

I am working on a campaign and there is a very good chance that the PC’s may find themselves involved in a large mass battle, a large siege or possibly both if things go slightly sideways in regards to there actions and success through the campaign (of course they may just as equally decide to get out of dodge if it all goes sideways but that is the joy of running a free from open campaign).

I have experience of a system for large battles from 1st edition legend of the 5 rings, a combination of the players attempting to complete heroic actions to sway the battle, combined with dice rolling the skill of the generals behind the scenes to gauge the flow of the battle. Are there any official published 5th edition rules or suggestions as to how to run these kind of large scale battles for D&D?

## Does a size large or larger creature killed by Negative Energy Flood rise as a medium sized zombie?

The spell Negative Energy Flood (XGtE pg. 163) states:

A target killed by this damage rises up as a zombie at the start of your next turn.

And also,

Statistics for the zombie are in the Monster Manual.

This seems to imply that the creature killed rises as a zombie with exactly the statistics stated in the Monster Manual.

If I kill a gargantuan (or anything larger than medium) creature with Negative Energy Flood, does it rise as a size medium zombie?

## Set data structure for data too large to fit into memory

I’m trying to solve the following exercise:

Given N data items and memory that can hold M/B blocks of size B. Describe a data structure that needs at most N/B blocks of external memory and allows us to answer questions of the form “$$s \in S$$?” using $$log_BN$$ I/O operations.

We may assume a static set, i.e. we do not care for efficient insertion or deletion of elements to or from the set and do not care for efficient creation of the data structure. Furthermore, M and B are known.

If the data is ordered, I could sort the data using e.g. MergeSort for external memory, then partition the sorted data into N/B sections and create a B-tree, where each node consists of a block of memory with elements containing a value of the set and an external memory location pointing to the block which contains all elements larger or equal to the value and smaller than the value of the next element in the parent block. In that case we would need $$N/B$$ external memory locations to store the block and $$log_B N$$ I/O operations to search for a value.

My question is about how one would handle non-ordered data? I don’t see how one could encode the data as a numeric value and then use the B-tree construction.

## Sudden large amounts of ports and services on my router [closed]

I’ve conducted a scan of my network and I’ve noticed a worrying amount of ports and services now running on my router.

I have a Virgin Media Superhub2. Below are the ports and services that are open. I cannot find information on the internet.

Can anyone shed some light as to what has possessed my router? Some of the services are things I’ve never seen before!

## Do large creatures have reach?

Does a large creature (ogre) have reach with their weapons (club) or can they only hit opponents directly adjacent to them?

The Monster Manual says the ogre has a 5′ reach. Does that mean it only reaches right next to it or is it an additional 5′ for a total of a 10′ reach?

## Can a large corporation make a believable promise

Say there is a secret encryption key that a third party has to handle. The third party is supposed to destroy the secret key when they are done, and tell everyone else it was destroyed and therefor safe to use. However, if the third party makes a secret copy, then they can covertly sell it for large amounts of money.

Let’s say I want to get a large corporation to be that third party. It is possible for the corporation to make sure no employee can steal the key for themselves without conspiring with many other employees. How could the company show that it instructed the employees to destroy the key? I understand that no legal mechanism can totally prove that no one is lying, but I want to be close.

Sorry if this isn’t actually a legal question.

## How to improve wordpress mysql performance on large tables?

I’ve installed WordPress 5.4.1 on Ubuntu 20.04 LTS on AWS EC2 (free tier as I’m starting).

My instance has 30 GB of disk space and 1 GB of RAM.

My website has at about 9000 pages and I’ve imported 7800 so far with “HTML Import 2” plugin.

wp_posts table has 7,800 rows and 66 MB size and, since this table has grown, wordpress has become super slow. Any change I make to the database is super slow as well.

While trying to make changes, I keep getting this error:

Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /var/www/wordpress/wp-includes/wp-db.php on line 1626 No such file or directory

Error reconnecting to the database This means that we lost contact with the database server at localhost. This could mean your host’s database server is down.

What could I do in order to achieve a better speed and make it usable?