# Prime Generator

Sorry for late post i was too busy ….
this is a new problem
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!

### Input

The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, n-m<=100000) separated by a space.

### Output

For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.

### Example

`Input:21 103 5Output:235735`

`Solution :`

`CC Arun Kumar Gupta`

`import java.util.*;public class FastestPrime{ public static void main (String [] args) {  Scanner sc = new Scanner(System.in);  int test_cases = sc.nextInt();  if((test_cases <=10) && (test_cases > 0))  {  for(int i = 0 ; i   {    int m = sc.nextInt();    int n = sc.nextInt();    if((m<= 1000000000) &&(n<=1000000000)&&(n>0)&&(m>0))    {    if((n-m) <= 100000)    {     if((m % 2) == 0)     ++m;     for(int j = m ; j<= n ; ++j)     {      NextNum(j);      j = j+ 1;           }         }    }  System.out.println();    }  }   } static void  NextNum(int m) {  int div = 3;  int array [] = new int[1000];  int rem  = 1 ;  while((rem != 0) && (div <= (m/2)))   {    rem = m%div;    div = div+2;   }  if(rem != 0)  {  System.out.println(m);   }   }}`

# Sync Subtitles With The Video In VLC

I can’t stress the usefulness of subtitles enough, especially when you’re watching a movie in a foreign language. I was watching Heavenly Forest, a Japanese romantic drama, a few days back. The movie was wonderful, but I wouldn’t have understood anything had it not been for those English subtitles. I even tend to use English subtitles while watchingEnglish movies, because you guys talk so fast (Americans) or so weird (British) that it’s hard for me to grasp!
Handy as they are, subtitles can turn extremely irritating if they’re out of sync with the video. They distract you, and you end up understanding even less than what you’d have without the subs. Thankfully, if you’re using VLC player to watch the videos, you can make use of a nifty feature in the program to sync the subtitle with the video! Do note that it’ll only temporarily sync the subtitles with the video, and the sync will be gone the next time you watch the video.
Anyway, lets get started with how to implement it. I’m assuming that you’ve already loaded the video and subtitle files into VLC (you can just drag them both into its interface). Now, carefully take a look at the video and the subs, and see whether the subs are lagging behind or running ahead of the video. If you’re watching a foreign movie, it may seem like a very difficult job, but just try a little hard and you should be able to make this out. For example, if you see a girl screaming and running around wildly, and the subs show “Help me! Help me!” 3 seconds after that scene, this means that the titles are 3 seconds behind the movie.
Once you’ve figured out the lag / lead of the subtitle, it’s time to sync it with the video. In VLC, navigate to Tools > Track Synchronization, where you’ll find the Subtitles/Video section. Now comes the important part – syncing the subtitle. If the subtitle is lagging behind the video, you’ve to provide a negative value to ‘Advance of subtitles over video’. Say the subs display 3 seconds after the video, the value you got to enter is –3.000 s. Note that you can adjust the sync time to upto a thousandth of a second, although adjusting to the tenths does the job in all cases. Similarly if the subtitle is ahead of the video, enter the required positive number of seconds. Hit the Refresh button at the top right corner of the window, and you should see the change immediately.

# Alien Chef

A new programming Problem…..

/*

The aliens living in outer space are very advanced in technology, intelligence and everything, except one, and that is Cooking. Each year they spend millions of dollars in research, to crack famous recipes prepared by humans.

Recently they came to know about Khana-Academy, a non-profit organization streaming free cooking lesson videos on earth. There are N recipes, numbered 1 to N, and the video of the ith recipe is live in the time interval [Si, Ei]. An alien can visit earth but can not survive for more than just a small moment (earth is so advanced in pollution). An alien visits the earth at an integer time t and instantly downloads the complete video of all the lessons that are live at that moment of time t and leaves earth immediately. You are given the visiting times of a small group of K aliens. Find the number of different recipes aliens can learn by watching the downloaded videos. Not just one group of aliens, there are Q such groups, so you have to find the answer for each of these Q groups.
Input

The first line has an integer N. Each of the following N lines has two integers Si Ei. The next line has an integer Q, the number of groups. Each of the following Q lines has information of a group of aliens. The first integer is K, the number of aliens in that group, followed by K integers in the same line, the integer visiting times t of the aliens.

1 ≤ N ≤ 100000 (105)

1 ≤ Q ≤ 5000 (5 103)
1 ≤ K ≤ 20
1 ≤ Si, Ei, t ≤ 1000000000 (109)
Si < Ei

Output

For each of the Q groups, output the number of different recipes that group of aliens can learn by watching the downloaded videos.

Example

Input:

4
1 4
3 10
2 6
5 8
3
1 5
2 2 6
3 1 10 9

Output:

3
4
2

Explanation:

Given videos of 4 recipes in the following closed intervals.
1. [ 1 , 4 ]
2. [ 3 , 10 ]
3. [ 2 , 6 ]
4. [ 5 , 8 ]

In the first query, only one alien arrives at t = 5 and can download 3 recipes 2, 3, 4.

In the second query, two aliens arrive at t = 2 and 6. They can learn all the 4 recipes.

In the third query, three aliens arrive at t = 1, 10 and 9. They can learn only two recipes, 1 and 2.

*/

import java.util.*;
import java.lang.*;
/*public class Array
{
int num[]  = new int[20];

}

*/
public class AlienChefs
{
static int aaa[] = new int[100000];
static int end ;
//leng = 1;
static int start ;
public static void main(String [] args)
{

Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if((0
{
int a[] = new int[2*n];
for(int i = 0 ; i<(2*n) ; ++i)
{
//System.out.println(“Inside”);

a[i] = sc.nextInt();
if( (0
{
if((i%2) == 1   )
{
//System.out.println(“Inside”);
if((a[i-1] > a[i]))
System.exit(0);
}

}
else
System.exit(0);
}
int groups = sc.nextInt();
//System.out.println(“********************”);
for(int i = 0 ; i< groups; ++i)
{
int count = 0 ;
int alen = 0 ;
int times = sc.nextInt();
for(int j =0 ;j
{

alen = sc.nextInt();
if((0
{
//System.out.println(alen);
count = count+ cc(a , alen);

}

}
start = end – start;
start = start +end + add ;
end = start;
aaa[start] = 1000;
System.out.println(count);

}
}

}
static int cc(int a [] , int val)
{
int count = 0 ;

for(int i = 0 ; i< a.length; i++)
{ //static int a;
int abc =0;

if((a[i] <= val)&& (val <= a[i+1] ))
{
//System.out.println(“***************************************”);
abc = check(aaa , i);
if( abc == 0)
{
++count;
}

}
++i;

}
//System.out.println(“Count Returned :”+count);

return count;
}
static int check(int qw [], int i)
{
//System.out.println(“Check Function is called “);
//System.out.println(start+”:”+end);
//System.out.println(“i = “+i);
for(int j = start ; j<=end ; j++)
{
if(qw[j] == i)
return 1;
}
qw[end] = i;