Dataset Viewer
Auto-converted to Parquet Duplicate
input
stringlengths
28
6.46k
output
stringlengths
750
92.6k
solution
stringlengths
0
10.6k
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's read the problem statement carefully. The problem is about stones arranged in a row, each being red, green, or blue. We have to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the key is to check co...
n = int(input()) s = input().strip() count = 0 for i in range(n - 1): if s[i] == s[i + 1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. So, the idea is that after removing those stones, every adjacent pair must be different. Hmm. So, how do we approach this? Let me think. Let's take the example given. For insta...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So, the idea is that after removing some stones, any two adjacent stones in the resulting sequence must be different. Wait, right. So for example, if there's a sequence lik...
n = int(input()) s = input().strip() count = 0 for i in range(n - 1): if s[i] == s[i + 1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is about stones arranged in a row, each colored red, green, or blue. We need to find the minimum number of stones to remove so that no two adjacent stones have the same color. Hmm. So the input is a string s of length n, and we have to process this string. The output is the count o...
n = int(input()) s = input().strip() if n <= 1: print(0) else: count = 0 prev = s[0] for c in s[1:]: if c == prev: count += 1 else: prev = c print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that all neighboring stones have different colors. Hmm. So, any two adjacent stones after removal must be different. The approach is to count the consecutive duplicates and determine how many need to be removed. Wait, for exampl...
n = int(input()) s = input().strip() if n <= 1: print(0) else: res = 0 prev = s[0] count = 0 for i in range(1, n): if s[i] == prev: count += 1 else: res += count count = 0 prev = s[i] res += count print(res)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's see the problem statement again. The task is to find the minimum number of stones to remove so that any two neighboring stones have different colors. Hmm. So, the idea is that after removing some stones, no two adjacent stones are the same. The way to minim...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's read the question carefully. The problem says that we have a row of stones, each colored red, green, or blue. We need to find the minimum number of stones to remove so that any two neighboring stones are different colors. So, the task is to count how many s...
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this problem where I have to find the minimum number of stones to remove so that no two adjacent stones have the same color. Let's see. So the input is a string of R, G, B characters. The problem is to count how many stones we need to take out so that the remaining sequence has all differ...
n = int(input()) s = input().strip() count = 0 for i in range(n - 1): if s[i] == s[i + 1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's see the problem statement again. The task is to count the minimum number of stones to remove so that any two neighboring stones have different colors. Hmm. So, the input is a string representing the stones, and I have to find out how many stones need to be ...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So, the key is that any two adjacent stones must be different. How do I approach this? Wait, the question is asking for the minimum stones to take away. So, maybe we can th...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is about stones arranged in a row, each being red, green, or blue. We need to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the idea is to check consecutive stones and count how many times the same color appears consecuti...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the approach should be to look for consecutive stones with the same color and count how many need to be removed. Wait, for example, if there's a sequence like "RRG", th...
n = int(input()) s = input().strip() count = 0 for i in range(len(s)-1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So, the approach here is probably to check consecutive stones and count the duplicates. Because whenever two consecutive stones are the same, we need to remove one of them. ...
n = int(input()) s = input().strip() count = 0 for i in range(len(s)-1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the main idea is to check consecutive stones and if they are the same, remove one. But how do we count the number of stones to remove efficiently? Wait, the problem says...
n = int(input()) s = input().strip() count = 0 for i in range(n-1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's read the problem statement carefully. The task is to find the minimum number of stones to remove so that any two neighboring stones have different colors. Hmm. So the idea is to eliminate consecutive stones of the same color. Wait, but how? Let's think. Fo...
n = int(input()) s = input().strip() if not s: print(0) else: total = 0 prev_char = s[0] run_length = 1 for c in s[1:]: if c == prev_char: run_length += 1 else: total += run_length - 1 prev_char = c run_length = 1 total += run_leng...
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. I need to solve this problem where I have to count the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. The input is a string of R, G, B characters. So, the problem is to find the number of consecutive duplicates in the string because each consecuti...
n = int(input()) s = input().strip() count = 0 for i in range(len(s) - 1): if s[i] == s[i + 1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's read the question carefully. So, the task is to find the minimum number of stones to remove so that any two neighboring stones have different colors. Hmm. So the problem is about ensuring that in the resulting sequence, no two adjacent stones are the same. A...
n = int(input()) s = input().strip() count = 0 for i in range(len(s) - 1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that any two neighboring stones have different colors. Hmm. So, the approach here would be to check consecutive stones and count how many times the same color appears in a row. Because whenever two same-colored stones are next to ...
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. I need to solve this programming problem. The task is to count the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the input is a string of R, G, B characters. The output is the number of stones to take. Wait, but how do the stones need to be a...
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So, for example, if there's a sequence like RRG, the answer is 1. Because the two Rs are next to each other. So we need to remove one of them. So the approach here is proba...
n = int(input()) s = input().strip() count = 0 for i in range(len(s) - 1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's read the question carefully. The problem is about stones arranged in a row, each being red, green, or blue. We have to find the minimum number of stones to remove so that no two adjacent stones have the same color. The output is the count of stones to take....
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, so I need to solve this programming problem where I have to find the minimum number of stones to remove so that no two adjacent stones have the same color. Let me think about how to approach this. First, the problem says that the stones are in a row, and any two neighboring stones must be different. So i...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. I need to solve this problem where I have to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the input is a string of characters, each being R, G, or B. The problem is to count how many stones are consecutive duplicates. Because every ...
n = int(input()) s = input().strip() count = 0 for i in range(len(s) - 1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two adjacent stones have the same color. Hmm. So, for example, if there are consecutive stones of the same color, we need to remove some of them so that after removal, all adjacent ones are different. Let me think about t...
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this problem where I have to find the minimum number of stones to remove so that no two adjacent stones have the same color. Let's think about how to approach this. Hmm, so the problem is about checking consecutive stones. Whenever two stones next to each other have the same color, we nee...
n = int(input()) s = input().strip() if n <= 1: print(0) else: count = 0 prev = s[0] run_length = 1 for c in s[1:]: if c == prev: run_length += 1 else: count += run_length - 1 prev = c run_length = 1 count += run_length - 1 pri...
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. I need to solve this problem where I have to find the minimum number of stones to remove so that no two adjacent stones have the same color. Hmm. The input is a string of R, G, B characters, and the output is the count of stones to remove. So the approach here is probably to iterate through t...
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones we need to remove so that no two neighboring stones have the same color. Hmm. So, the input is a string of characters R, G, B. We need to check consecutive stones. If two are the same, one of them must be removed. But how to count the minimal...
n = int(input()) s = input().strip() count = 0 for i in range(len(s) - 1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this programming problem. Let's read the problem statement carefully. The task is to find the minimum number of stones to remove so that any two neighboring stones have different colors. So, the remaining stones must alternate in color with no two adjacent stones being the same. The input...
n = int(input()) s = input().strip() count = 0 for i in range(1, n): if s[i] == s[i-1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two adjacent stones have the same color. Hmm. So the approach is to check consecutive stones and count how many times the same color appears next to each other. Because each time there's a pair, we need to remove one. Wait...
n = int(input()) s = input().strip() count = 0 for i in range(len(s)-1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. The problem is to find the minimum number of stones to remove so that no two neighboring stones have the same color. Hmm. So the idea is that after removing some stones, every adjacent pair must be different. So, how do I approach this? Let's think. For each consecutive group of the same colo...
n = int(input()) s = input().strip() count = 0 for i in range(len(s) - 1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, I need to solve this problem where I have to find the minimum number of stones to remove so that no two neighboring stones have the same color. Let's see. So the input is a string of R, G, B characters. The problem is to count how many stones are part of consecutive same colors. Because whenever there's ...
n = int(input()) s = input().strip() count = 0 for i in range(len(s)-1): if s[i] == s[i+1]: count += 1 print(count)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. Input The first line contains intege...
<think> Okay, let's see. I need to find the minimum number of stones to remove so that no two adjacent stones have the same color. Hmm. So the problem is basically to make sure that in the resulting sequence, every consecutive pair is different. So how do I approach this? Let's think of the input string. For example, ...
n = int(input()) s = input().strip() count = 0 for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 print(count)
These days, Sid and Jake are learning about number theory. They have just visited the zoo and during the visit they have counted(yes, they are superb at counting :) ) the number of animals at the zoo. Now, after visiting the zoo, Sid is saying that f is a factor of the total number of animals at the zoo and Jake is say...
<think> Okay, let's see. The problem is to determine whether both Sid and Jake are correct based on the given factors and multiples. So Sid says that f is a factor of the total number of animals, and Jake says m is a multiple of that same number. So the total number N must satisfy two conditions: f divides N (so N % f ...
import sys t = int(sys.stdin.readline()) for _ in range(t): f, m = map(int, sys.stdin.readline().split()) if m % f == 0: print("CORRECT") else: print("WRONG")
These days, Sid and Jake are learning about number theory. They have just visited the zoo and during the visit they have counted(yes, they are superb at counting :) ) the number of animals at the zoo. Now, after visiting the zoo, Sid is saying that f is a factor of the total number of animals at the zoo and Jake is say...
<think> Okay, let's see. The problem is to determine if both Sid and Jake are correct. Sid says that f is a factor of the total number of animals, which means the total is divisible by f. Jake says that m is a multiple of the total, so the total is a divisor of m. So the total must satisfy both conditions: total mod f ...
import sys t = int(sys.stdin.readline()) for _ in range(t): f, m = map(int, sys.stdin.readline().split()) if m % f == 0: print("CORRECT") else: print("WRONG")
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
233