prob_desc_description
stringlengths
63
3.8k
prob_desc_output_spec
stringlengths
17
1.47k
lang_cluster
stringclasses
2 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
lang
stringclasses
7 values
prob_desc_output_to
stringclasses
3 values
prob_desc_memory_limit
stringclasses
19 values
file_name
stringclasses
111 values
tags
listlengths
0
11
prob_desc_created_at
stringlengths
10
10
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_notes
stringlengths
4
3k
exec_outcome
stringclasses
1 value
difficulty
int64
-1
3.5k
prob_desc_input_from
stringclasses
3 values
prob_desc_time_limit
stringclasses
27 values
prob_desc_input_spec
stringlengths
28
2.42k
prob_desc_sample_outputs
stringlengths
2
796
source_code
stringlengths
42
65.5k
hidden_unit_tests
stringclasses
1 value
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters > and <. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character >, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
e4b48fcce933373bf3c1e9cec20ec2dc
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n<>\n3\n><<\n1\n>"]
NoteIn the first test case we can delete any character in string <>.In the second test case we don't need to delete any characters. The string > < < is good, because we can perform the following sequence of operations: > < < $$$\rightarrow$$$ < < $$$\rightarrow$$$ <.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int main(void) { int t, n; char s[100]; int i, j, result, f1, f2, mf1, mf2, c1, c2, u; int d[100]; char test; scanf("%d", &t); for(i = u = 0; u < t; u++, i = 0){ scanf("%d", &n); test = getchar(); if(test = '\n' && i == 0); while(...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
fc864d4954307701584a14dcd2ee845b
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int main() { int t, n, i, c, r, c2; scanf("%d", &t); while(t--) { char s[101]; scanf("%d%s", &n, &s); c=0; for(i=0;s[i]!='\0';i++) { if(s[i]=='<') c++; else break; } ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
aa307339e84a7ca5bc2894a8d792be6f
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<stdlib.h> int main() { int t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); char a[n]; scanf("%s",a); int c=0,d=0; for(int i=0;i<n;i++) { if(a[i]!='>') { c++; } els...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
dc03547d5ee4319665c1407668bd5a31
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<stdlib.h> int main() { int t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); char a[n]; scanf("%s",a); int c=0,d=0; for(int i=0;i<n;i++) { if(a[i]!='>') { c++; } els...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
0c6ef85081c413e2bcaeb5ddeeab4089
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--) { int n,i,sum1=0,sum2=0; scanf("%d",&n); char a[n]; scanf("%s",a); for(i=0;i<n;i++) { if(a[i]=='<') sum1++; else break; } for(i=0;i<n;i++) { if(a[n-1-i]=='>') ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
0ce3793ad4120de7195cf3cd62e825df
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int main() { int t; scanf("%d", &t); while (t--) { int i,n,ans=0; scanf("%d", &n); char str[n]; scanf(" %s",str); for (i=0;i<=n/2;i++) if(str[i]=='>'||str[n-i-1]=='<') { ans = i; break; } ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
a754e972890fbd515235f7ccc6cc044c
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int main() { int t; scanf("%d", &t); while (t--) { int n, ans; scanf("%d", &n); char str[n + 1]; scanf(" %s", str); for (int i = 0; i <= n / 2; i++) if (str[i] == '>' || str[n - i - 1] == '<') { ans = i; ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
50a20c94d178fa11edd16a739bdabbd5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int main(int argc, char const *argv[]) { int t; scanf("%d", &t); while (t--) { int n, ans; scanf("%d", &n); char str[n + 1]; scanf(" %s", str); for (int i = 0; i <= n / 2; i++) if (str[i] == '>' || str[n - i - 1] == '<') { ans = i; break; } ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
bb53b6a46f56ed1878a34ff344453597
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> #define N 107 char s[N]; int min(int a, int b) { return (a<b) ? a : b; } int main() { int t; scanf("%d", &t); for (int ii=0; ii<t; ii++) { int n; scanf("%d", &n); getchar(); for (int i=0; i<n; i++) { char tmp; scanf("%c", &...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
9e8243eee30283a6f3dddb85ad8dcd27
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int nnn(int a,int b) { return (a<b)?a:b; } int main() { int t; scanf("%d",&t); while(t--) { int n,l=-1,r=-1,lcnt=0,rcnt=0; scanf("%d",&n); char s[101]={'\0'}; scanf("%s",s); for(int i=0;i<n;i++) { if(s[i]!='<') { l=i; break; } else lc...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
e2b1bf6d8ab17dccf4aeca5605612e78
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> int main() { int t,n,i,j,c; char s[105]; scanf("%d",&t); for(i=1;i<=t;i++){ scanf("%d\n",&n); gets(s); c=0; if(s[0]=='>'||s[n-1]=='<'){ c=0; } else{ for(j=0;j<n;j++){ if(s[j]=='>'){ c=j; break; } } for(j=n-1;j>=0;j--){ ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
c706e581cfab187842c6347a130ebcd3
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> int main() { int i,test; scanf("%d",&test); for(i=0;i<test;i++) { int j,ans,length; scanf("%d",&length); char string[length]; scanf("%s",string); for(j=0;j<length;j++) { if(string[j]=='>'||string[length-j-1]...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
0ccc9d9f3973659e1e5114a1d1e9b089
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int main(){ int ttl,n,i,j,rst[120],a = 0,b = 0; char stt,end,temp[120]; scanf("%d",&ttl); for(i = 0;i<ttl;i++){ scanf("%d",&n); scanf("%s",temp); stt = temp[0]; end = temp[n-1]; if(stt == '>'||end=='<') rst[i] = 0; else{ a = 0; b = 0; for(j = 0;j<n;j++){ if(temp[j]=='...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
5aca0368c3595388b5b854e05ef0f7d5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int main() { int i,j,n,t,p,num,num1,a[110]; char s[110]; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d",&n); getchar(); gets(s); num=0; num1=0; for(j=n-1;j>=0;j--) if(s[j]=='<') break; p=j; while(s[++p]=='>') num++; for(j=0;j<n;j++) if(s[j]=='>') break; p=j; whi...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
307cac4d276a375b73addacb1f72d33f
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> ///typedef long long ll; ///int minimum (int a, int b) {return a < b ? a : b;} ///ll gcd (ll a, ll b) {return b == 0 ? a : a%b;} ///ll diff (ll a, ll b) {return a < b ? b - a : a - b;} ///int str_len(char arr[]) {int i = 1; while (arr[i] != '\0') i++; return i;} ///char* str_copy (char arr[], int n) ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
af09c8c888f9976f3d36f458afa4b2ee
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int good_string(int n) { char s[n+1]; int i, j; for (i = 0, scanf("%s",s); i < n && s[i] != '>'; i++); for (j = 0; j < n && s[n-1-j] != '<'; j++); if (i > j) { return j; } return i; } int main(void) { int t, n; for (scanf("%d",&t); t > 0 && scanf("%d",&n)...
You are given an array $$$s$$$ consisting of $$$n$$$ integers.You have to find any array $$$t$$$ of length $$$k$$$ such that you can cut out maximum number of copies of array $$$t$$$ from array $$$s$$$.Cutting out the copy of $$$t$$$ means that for each element $$$t_i$$$ of array $$$t$$$ you have to find $$$t_i$$$ in $...
Print $$$k$$$ integers — the elements of array $$$t$$$ such that you can cut out maximum possible number of copies of this array from $$$s$$$. If there are multiple answers, print any of them. The required array $$$t$$$ can contain duplicate elements. All the elements of $$$t$$$ ($$$t_1, t_2, \dots, t_k$$$) should sati...
C
cfccf06c4d0de89bf0978dc6512265c4
20e0cc649708d37904b53aac5e9a21c1
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "sortings" ]
1542378900
["7 3\n1 2 3 2 4 3 1", "10 4\n1 3 1 3 10 3 7 7 12 3", "15 2\n1 2 1 1 1 2 1 1 2 1 2 1 1 1 1"]
NoteThe first example is described in the problem statement.In the second example the only answer is $$$[7, 3, 1, 3]$$$ and any its permutations. It can be shown that you cannot choose any other array such that the maximum number of copies you can cut out would be equal to $$$2$$$.In the third example the array $$$t$$$...
PASSED
1,600
standard input
3 seconds
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$s$$$ and the desired number of elements in $$$t$$$, respectively. The second line of the input contains exactly $$$n$$$ integers $$$s_1, s_2, \dots, s_n$$$ ($$$1 \le s_i \le 2 \cdo...
["1 2 3", "7 3 1 3", "1 1"]
#include<stdio.h> int num[200002],n,r,temp[200002]; void mergesort(int low, int high, int num[]){ if(low == high){ return; } int mid = (low + high)/2; mergesort(low, mid,num); mergesort(mid + 1, high,num); int i,j,k; for(i = low,j = mid + 1, k = low; k <= high; k++){ ...
You are given an array $$$s$$$ consisting of $$$n$$$ integers.You have to find any array $$$t$$$ of length $$$k$$$ such that you can cut out maximum number of copies of array $$$t$$$ from array $$$s$$$.Cutting out the copy of $$$t$$$ means that for each element $$$t_i$$$ of array $$$t$$$ you have to find $$$t_i$$$ in $...
Print $$$k$$$ integers — the elements of array $$$t$$$ such that you can cut out maximum possible number of copies of this array from $$$s$$$. If there are multiple answers, print any of them. The required array $$$t$$$ can contain duplicate elements. All the elements of $$$t$$$ ($$$t_1, t_2, \dots, t_k$$$) should sati...
C
cfccf06c4d0de89bf0978dc6512265c4
1b51e33e92375e471bd7fc4e1505aa5b
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "sortings" ]
1542378900
["7 3\n1 2 3 2 4 3 1", "10 4\n1 3 1 3 10 3 7 7 12 3", "15 2\n1 2 1 1 1 2 1 1 2 1 2 1 1 1 1"]
NoteThe first example is described in the problem statement.In the second example the only answer is $$$[7, 3, 1, 3]$$$ and any its permutations. It can be shown that you cannot choose any other array such that the maximum number of copies you can cut out would be equal to $$$2$$$.In the third example the array $$$t$$$...
PASSED
1,600
standard input
3 seconds
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$s$$$ and the desired number of elements in $$$t$$$, respectively. The second line of the input contains exactly $$$n$$$ integers $$$s_1, s_2, \dots, s_n$$$ ($$$1 \le s_i \le 2 \cdo...
["1 2 3", "7 3 1 3", "1 1"]
#include<stdio.h> int num[200002],n,r,temp[200002]; void mergesort(int low, int high, int num[]){ if(low == high){ return; } int mid = (low + high)/2; mergesort(low, mid,num); mergesort(mid + 1, high,num); int i,j,k; for(i = low,j = mid + 1, k = low; k <= high; k++){ ...
You are given an array $$$s$$$ consisting of $$$n$$$ integers.You have to find any array $$$t$$$ of length $$$k$$$ such that you can cut out maximum number of copies of array $$$t$$$ from array $$$s$$$.Cutting out the copy of $$$t$$$ means that for each element $$$t_i$$$ of array $$$t$$$ you have to find $$$t_i$$$ in $...
Print $$$k$$$ integers — the elements of array $$$t$$$ such that you can cut out maximum possible number of copies of this array from $$$s$$$. If there are multiple answers, print any of them. The required array $$$t$$$ can contain duplicate elements. All the elements of $$$t$$$ ($$$t_1, t_2, \dots, t_k$$$) should sati...
C
cfccf06c4d0de89bf0978dc6512265c4
3fe290f79f711ba7ab4343fa67790e85
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "sortings" ]
1542378900
["7 3\n1 2 3 2 4 3 1", "10 4\n1 3 1 3 10 3 7 7 12 3", "15 2\n1 2 1 1 1 2 1 1 2 1 2 1 1 1 1"]
NoteThe first example is described in the problem statement.In the second example the only answer is $$$[7, 3, 1, 3]$$$ and any its permutations. It can be shown that you cannot choose any other array such that the maximum number of copies you can cut out would be equal to $$$2$$$.In the third example the array $$$t$$$...
PASSED
1,600
standard input
3 seconds
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$s$$$ and the desired number of elements in $$$t$$$, respectively. The second line of the input contains exactly $$$n$$$ integers $$$s_1, s_2, \dots, s_n$$$ ($$$1 \le s_i \le 2 \cdo...
["1 2 3", "7 3 1 3", "1 1"]
#include<stdio.h> int num[200002],n,r,temp[200002]; void mergesort(int low, int high, int num[]){ if(low == high){ return; } int mid = (low + high)/2; mergesort(low, mid,num); mergesort(mid + 1, high,num); int i,j,k; for(i = low,j = mid + 1, k = low; k <= high; k++){ ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
940d36bab5f8e88ca758fdf883ab7de0
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> int main() { int n, i, j,a[4] = { 0 }, OK = 1; char s[300], ch[] = { "ACGT" }; scanf("%d %s", &n, s); for (i = 0; i < n; i++) { if (s[i] == 'A') a[0]++; else if (s[i] == 'C') a[1]++; else if (s[i] == 'G') a[2]++; else if (s[i] == 'T') a[3]++; } // check if possible if (n % 4 != 0) OK =...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
febd9010593c2d3d1f5f19536e39c540
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main() { int n,i,count[4]; char s[260]; scanf("%d%s",&n,s); if(n%4) puts("==="); else { for(i=0;i<4;i++) count[i]=n/4; for(i=0;i<n;i++) { switch(s[i]) { case 'A':count[0]--; break; case 'C':count[1]--; break; case 'G':count[2]--; break; case...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
70e4dfc52795b10531ab85481782231c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
/* * */ #include <stdio.h> #include <stdlib.h> int max(int a, int b){ return a > b ? a : b; } int main(int argc, char* argv[]){ int n, i; scanf("%d", &n); char* s = malloc((n+1)*sizeof(char)); scanf("%s", s); *(s+n) = '\0'; int a = 0, c = 0, g = 0, t = 0, free = 0; for(i = 0; i < n; i++){ if(*(s+i) == '...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
cb72737fccbd65377f78cc9dfcc371f9
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main(void){ int n,i,j,aver,a[6],flag; char s[260]; while(scanf("%d",&n)!=EOF){ scanf("%s",s); if(n%4){ printf("===\n"); continue; } aver=n/4; int a[6]={0}; for(i=0;i<n;i++){ if(s[i]=='A') a[0]++; ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
833bd0b5484bcae382a4dec44ff47be6
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int n,flag=0,l,i,arr[4]={0},r,max=0,j; scanf("%d",&n); char s[257],genes[5]={'A','C','G','T'}; scanf("%s",s); l=strlen(s); for(i=0;i<l;i++) { if(s[i]=='A') arr[0]++; if(s[i]=='C') arr[1]++; if(s[i]=='G') arr[2]++; if(s[i]=='T') arr[3]++; } r=n/4,max=0; ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
aa1f643da67395bd06dae60cb2a7791c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int n,i,j,k,a1,a2,a3,a4,a5,m1,m2,m3,m4,b[300]; char s[300]; while(~scanf("%d",&n)) { getchar(); a1=a2=a3=a4=a5=0; j=0; memset(b,0,sizeof(b)); k=n/4; for(i=0; i<n; i++) { scanf("%c",&s[i]...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
1b60ae4ca57f55ea78f24e4bc1810a2f
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int b[5]; int main() { int n,i,j,len,IS=1; char a[255],c[5]={'?','A','C','G','T'}; scanf("%d",&n); getchar(); for(i=0;i<n;i++) scanf("%c",&a[i]); if(n%4!=0) printf("==="); else { len=n/4; for(i=0;i<n;i++) switch(a[i]) { case 'A': b[1]++;break; case 'C': b[2]++;b...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
7d1490c349de788d6aa3c216e8287d3f
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> int main(void) { int n, a['T'+3]={0}; char s[259]; scanf("%d %s", &n, &s); if(n%4!=0){printf("===");return 0;} for(int i=0; i<n; i++) a[s[i]]++; if(a['A']>n/4 || a['C']>n/4 || a['G']>n/4 || a['T']>n/4){printf("===");return 0;} for(int i=0; i<n; i++) if(s[i]!='?') putchar(s[i]); else if (a...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
251348d52d10b9638cf323573b83b23d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <stdlib.h> int main() { int n; char s[300]; while(~scanf("%d",&n)) { int a,b,c,d,e,max,i; a=b=c=d=e=0; scanf("%s",s); for(i=0; i<n; i++) { if(s[i]=='A') a++; else if(s[i]=='G') b++...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
89b531e6c40a559dd8d990a58a56a521
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main(){ int n,b[4]={0,0,0,0},i,j,f=0;char a[259]; scanf("%d",&n); scanf("%s",a); if(n%4!=0) printf("==="); else { for(i=0;i<n;i++) { if(a[i]=='A') b[0]++; else if(a[i]=='C') b[1]++; else if(a[i]=='G') b[2]++; else if(a[i]=='T') b[3]++; } for(i=0;i<4;i++)...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
bed11d3ba466d77d8c0550739633b5a3
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> int main() { int n; scanf("%d", &n); char A[256]; int N[] = {0, 0, 0, 0}; scanf("%s", &A); if (n % 4 != 0) printf("==="); else { int c = 0; while (c < n) { char curr = A[c]; if (curr == 'A') N[0]++; else if (curr == 'C') N[1]++; else if (curr == 'G') N[2]++; ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
f8df51e7461f7ef2d9729e7953409cb3
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> typedef unsigned u; char S[999];u F[128]; int main() { u n,i; scanf("%u%s",&n,S); for(i=-1;S[++i];)++F[(u)S[i]]; if(n%4||F['A']>n/4||F['C']>n/4||F['G']>n/4||F['T']>n/4){printf("===\n");return 0;} F['A']=n/4-F['A']; F['C']=n/4-F['C']; F['G']=n/4-F['G']; F['T']=n/4-F['T']; for(i=-1;S[++i];)if(S...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
f692105dbc301a911c547953dc5b21c0
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <string.h> #define MAX 256 int Func(int a, int b, int c, int d, int *rez) { int m[4], fl, i, t; m[0]=a; m[1]=b; m[2]=c; m[3]=d; do { fl=1; for (i=0; i<3; i++) if (m[i]<m[i+1]) { t=m[i]; m[i]=m[i+1]; m[i+1]=t; fl=0; } } while (fl==0); *rez=m[0]; return...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
d6cc592fecf2fff3e5292d910fe0fe92
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <string.h> #define MAX 256 int main() { int n, i, kA=0, kC=0, kG=0, kT=0, kQ=0; char s[MAX]; scanf("%d%s", &n, s); if (n%4!=0) printf("==="); else { for (i=0; i<n; i++) { switch (s[i]) { case 'A': kA++; break; case 'C': kC++; break; ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
96c3ddad531e2ffb411bee5d3b234b27
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> main() { int n,i,j,t=0,a=0,g=0,c=0; scanf("%d\n",&n); char s[n+1]; gets(s); if(n%4!=0) { printf("===");return 0; } for(i=0;i<n;i++) { if(s[i]=='A')a++; if(s[i]=='G')g++; if(s[i]=='C')c++; if(s[i]=='T')t++; } if(a>n/4||g>n/4||c>n/4||t>n/4) { printf("===");return 0; } a=n/4-a;g...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
01d07ed08188c87d76431ebbc9ae6b8f
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main() { int n; scanf(" %d", &n); if( n % 4 != 0 ) { printf("===\n"); return 0; } char s[n+1]; scanf(" %s", s); s[n] = '\0'; int a, g, c, t, q = 0; a = g = c = t = n/4; for(int i = 0; i < n; i++) { if( s[i] == 'A' ) a--; else if( s[i] == 'G' ) g--; else if( s[i...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
ec3e156125a2480fa6ced719d9e10750
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <string.h> int main() { int n,i,a=0,g=0,c=0,t=0,j=-1; scanf("%d",&n); char s[256]; int gen[5]={0}; int que[256]={0}; scanf("%s",&s); for(i=0;i<n;i++) { if(s[i]=='A') ++gen[0]; else if(s[i]=='C') ++gen[1]; else if(s[i]=='G') ++gen[2]; else if(s[i]=='T') ++gen[3]; els...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
4b521d4207c41cdf97ebda5c28593126
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int maximum(int a,int b,int c,int d) { if(a>=b&&a>=c&&a>=d) return a; else if(b>=c&&b>=d) return b; else if(c>=d) return c; else return d; } int main() { int n; scanf("%d",&n); int count[5]={0}; char s[n+1]; scanf("%s",s); int i; for(i=0;i<n;i++) { if(s[i]=='A...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
4dfea1b9fc91f70db89d7e5798a3d805
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int occ(char c , char ch[]) { int i,k=0 ; for(i=0;i<strlen(ch);i++) { if(ch[i]==c) k++ ; } return k ; } int main() { int n ; scanf("%d",&n); char ch[n]; scanf("%s",ch); if ((n%4!=0)||(occ('A',ch)>n...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
4e78d259e152c240a228d0386fac560e
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <string.h> int main(void) { char s[256]; int n,i,x; int A=0,C=0,G=0,T=0,U=0,j=0; int aA=0,aC=0,aG=0,aT=0; scanf("%d\n",&n); if(n%2 == 1) printf("==="); else { fgets(s, sizeof(s), stdin); for(i=0;i<n;i++) { switch(s[i]) { case'A': A++; break; case'C': ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
c186444f9c094d68acbc61fffc5ea115
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { char str[256]; int count[4],i,length=0,flag=0,n; scanf("%d",&n); scanf("%s",str); for(i=0;i<4;i++) count[i]=0; if(strlen(str)%4!=0) printf("===\n"); else { for(i=0;i<strlen(str);i++) { if(str[i]=='A...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
6bc8a2693d0792954b2e2d046ac936c0
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
//Created by Pratik Mandlecha #include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int main() { int n,flag=0; scanf("%d",&n); char s[257],ss[5]={'A','C','G','T'}; scanf("%s",s); int l=strlen(s); int i,a[4]={0}; for(i=0;i<l;i++) { if(s[i]=='A') a[0]++; if(s[i]=='C') a[1]++; if(s[i]=='G...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
14ab07e7dbcad5042f7f9245432366b2
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main() { int n,a=0,g=0,c=0,t=0,question=0,q; scanf("%d",&n); char s[n]; scanf("%s",s); if(n==0) return 0; if(n%4==0) { q=n/4; for(int z=0;z<n;z++) { if(s[z]=='?') question++; if(s[z]=='A') a++; if(s[z]=='C') c++; if(s[z]=='G') g++; if(s[z]=='T') t++;...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
80ef075a8d091477b8e431e873eee6c9
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<math.h> #include<string.h> int main() { int i, n, na = 0, nc = 0, ng = 0, nt = 0, nn = 0, ni[300], pd = 1; char ch[300]; scanf("%d", &n); if (n % 4 == 0) { scanf("%s", ch); for (i = 0; i < n; i++) { switch (ch[i]) { case 'A': { na++; break; } case 'C': { nc++;...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
a0e84b39e1e6564f1ca7c9e6a595560a
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include<string.h> int main(void) { int i,j=0,a=0,c=0,g=0,t=0,q=0,n,w=0; scanf("%d",&n); char s[n+2]; int r[n]; scanf("%s",s); if(n%4!=0) {printf("===");return 0;} for(i=0;i<strlen(s);i++) { if(s[i]=='A') {a++;} if(s[i]=='C') {c++;} if(s[i]=='G') {g++;} i...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
70a4b24288db6a1281d657c6a603225c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include<string.h> int main(void) { int i,j=0,a=0,c=0,g=0,t=0,q=0,n,w=0; scanf("%d",&n); char s[n+2]; int r[n]; scanf("%s",s); if(n%4!=0) {printf("===");return 0;} for(i=0;i<strlen(s);i++) { if(s[i]=='A') {a++;} if(s[i]=='C') {c++;} if(s[i]=='G') {g++;} i...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
6ce5ccae99d900672861667e5a7f7393
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int n;int i; char ch2[4]; char ch[300]; scanf("%d",&n); scanf("%s",ch); for(i=0;i<4;i++) ch2[i]=0; int a,b,c,d; ch2[0]=n/4; ch2[1]=n/4; ch2[2]=n/4; ch2[3]=n/4; for(i=0;i<n;i++) { switch(ch[i]) { ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
191bd7e351ee46488b921ae9a4fefa2b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> int n; char s[300]; int A,C,G,T; int main() { int i; scanf("%d%s",&n,s+1); if(n%4) { printf("==="); return 0;} A = C = G = T = n/4; for(i=1;s[i];i++) { if(s[i] == 'A') A--; else if(s[i] == 'C') C--; else if(s[i] == 'G') G--; else if...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
0cba0e22f76390945e7215d076c0951a
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> int main() { int n,i,q=0,k=0,a=0,g=0,c=0,t=0; char ch,p; scanf("%d",&n); char s[n]; scanf("%s",&s); if((n%4)!=0) printf("==="); else { for(i=0;i<n;i++) { ch=s[i]; if(ch=='A') a++; else if(ch=='G') g++; else if(ch=='C') c++; e...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
d74e30a3e24234a6f280ef9cb7ac0033
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> #include<math.h> int main(){ int a=0,c=0,g=0,t=0,x=0,l,i,j; char s[256]; scanf("%d",&l); int k=l/4; getchar(); gets(s); for(i=0;i<l;i++){ if(s[i]=='A') a++; if(s[i]=='C') c++; if(s[i]=='G') g++; ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
581a70a0dbdf058fc670b27701c2e34c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <math.h> int main() { int n; scanf(" %d",&n); char str[n]; scanf(" %s",str); int i,a=0,c=0,g=0,t=0,x=0,y=0; if(n%4!=0){ printf("===\n"); return 0; } for(i=0;i<n;i++){ if(str[...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
75a7e0769820dca5fa51d373e61e3aec
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <string.h> char find(int a,int g,int c,int t) { int min=a; if(g<min) min=g; if(c<min) min=c; if(t<min) min=t; if(min==a) return 'A'; else if(min==g) return 'G'; else if(min==c) return 'C'; else return 'T'; } int main() { int n,a=0,g=0,c=0,t=0,i=0; char...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
865e72511bb58631395c083666cefa3d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int mx(int a, int b){if(a > b) return a; else return b;} int main(){ int n; scanf("%d", &n); char str[n + 1]; scanf(" %s", str); int sdiff = 0, i, a[5]; for(i = 0; i < 5; i++) a[i] = 0; for(i = 0; str[i] != '\0'; i++){ if(str[i] == 'A') a[0]++; else if(str[i] == 'G') a[1]++; else...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
ae221013f10c51ce472530c2ce0e27b8
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<stdlib.h> int main() { short n,x=0,c=0,v=0,b=0,i; scanf("%hi",&n); char *s=(char *)malloc(n+1); scanf("\n%s",s); if(n%4!=0) printf("==="); else { for(i=0;i<n;i++) { switch(s[i]) { case 'A': ++x; break; case 'T': ++c; break; ca...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
cfac658658757ae29a204b06e255a0fb
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> main() { int n,i,j,t=0,a1=0,g=0,c=0; scanf("%d\n",&n); char a[n+1],b[n+1]; gets(a); if(n%4!=0) { printf("===");return 0; } for(i=0;i<n;i++) { if(a[i]=='A')a1++; if(a[i]=='G')g++; if(a[i]=='C')c++; if(a[i]=='T')t++; } if(a1>n/4||g>n/4||c>n/4||t>n/4) { printf("===");return 0; } ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
8fb98c4d858fb30ee02e6c95b54eb22e
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> char cc[] = { 'A', 'C', 'G', 'T' }; int cnt[4]; void incr(char c) { int i; for (i = 0; i < 4; i++) if (cc[i] == c) { cnt[i]++; return; } } int main() { int i, j, n, yes; static char s[512]; scanf("%d", &n); scanf("%s", s); yes = 1; if (n % 4 != 0) yes = 0; for (i = 0; i < n;...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
b72d5d020aceb87f9f6914ed34aac7f4
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int ns,b,a,c,g,t,q,nd; void m(){ return; printf("%d\n", a); printf("%d\n", c); printf("%d\n", g); printf("%d\n", t); printf("%d\n", q); } int main(){ char s[255]; scanf("%d", &nd); scanf("%s", s); b=0; while (s[b]!='\0'){ if(s[b]=='A') a++; e...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
b9139f918e6ec9b8a6ea976c587c1193
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include <stdio.h> #include <malloc.h> int main(int argc, char **argv) { unsigned long lengthOfGenome, runner, counts[300] = {0}; scanf("%lu", &lengthOfGenome); if( lengthOfGenome%4 != 0 ) { scanf("%*s"); printf("===\n"); return 0; } unsigned char *genome = (unsigned char*) malloc((lengthOfGenome+1)*sizeof(unsigned...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
73584d9d0b7f72120a780d63ac17631d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int n,i,a=0,c=0,t=0,g=0,x=0; char str[300]; scanf("%d",&n); scanf(" %[^\n]",str); if(n%4!=0) { printf("===\n"); return 0; } for(i=0;i<n;i++) { if(str[i]=='A') a++; else if(str[i]=='C') c++; e...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
39582d1f606c52f3cd8adda70f88cf04
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int n,i,j,t=0,a=0,g=0,c=0; scanf("%d\n",&n); char s[n+1]; gets(s); if(n%4!=0) { printf("==="); return 0; } for(i=0;i<n;i++) { if(s[i]=='A')a++; if(s[i]=='G')g++; if(s[i]=='C')c++; if(s[i]=='T')t++; } if(a>n/4||g>n/4||c>n/4||t>n/4) { printf("===...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
585693c786f38693e267362da5976fd6
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<limits.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<stdbool.h> int main() { int n; scanf("%d",&n); char a[260]; scanf("%s",a); int bucket[4]={0},q=0; for(int i=0;i<n;i++) { if(a[i]=='A') bucket[0]++; if(a[i]=='C') bucket[1]++; if(a[i]=='G') bucket[2]++; if...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
34080221a80015d5fe968542492ea15c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main() { int n,i; char arr[256]; scanf("%d\n",&n); if(n%4!=0) { printf("==="); return 0; } int a=0,b=0,c=0,d=0; for(i=0;i<n;i++) { scanf("%c",&arr[i]); if(arr[i]=='A')a++;else if(arr[i]=='C')b++;else if(arr[i]=='T')c++;else if(arr[i]=='G')d++; } if(a>n/4||b>n/4||c>n/4||d>n/4) {...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
47627fe6230e2ab090c75e2c8f79cac4
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> char value[4]={'A','C','G','T'}; int a[4]={0}; int main() { int n,i,j; scanf("%d\n",&n); char str[n+1]; gets(str); if(n%4 != 0) { printf("===\n"); return 0; } int max = n/4; for(i=0;i<n;i++) { if(str[i]=='A') { a[0]++; if(a[0]>max) { ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
1721fc7e3567761a14a0ad3650fe95f8
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int a[300],m[300],n[300],i,k,l=0,t,j,m1=0,m2=0,m3=0,m4=0,o=0,p=0,s1=0,s2=0,s3=0,s4=0,s=0,t1=0,t2=0,t3=0,t4=0; char c[300],d[300],b[300]; scanf("%d ",&t);gets(c); if(t%4!=0)printf("===\n");else{ for(i=0;i<strlen(c);i++) { if(c[i]=='A')m1++...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
bf6f7d9e274732a6b38c4da3f7be1729
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> int main() { char s[256]; int a=0,g=0,c=0,t=0,l,i,j=0,max=0,max2=0,x[256]={0}; scanf("%d",&l); scanf("%s",s); max=0; if(l%4==0 && l>=4) { for(i=0;i<l;i++) { if(s[i]=='A') { a++; if(a>max) ...
The process of mammoth's genome decoding in Berland comes to its end!One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a...
If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).
C
d6423f380e6ba711d175d91e73f97b47
29ba48089c33c19c1a7f85f28b0a25b4
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1482113100
["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??"]
NoteIn the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.In the second example the genome is already decoded correctly and each nucleotide i...
PASSED
900
standard input
1 second
The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome. The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.
["AGACGTCT", "AGCT", "===", "==="]
#include<stdio.h> #include<string.h> int main() { int n,c1=0,c2=0,c3=0,c4=0,i; char a[260]; scanf("%d",&n); scanf("%s",a); if(n%4!=0) printf("==="); else { for(i=0;i<n;i++) { if(a[i]=='A') c1++; if(a[i]=='G') c2++; if(a[i]=='C') c3++; if(a[i]==...
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
f91e49258df1da9b92fa2c8642a8bb0b
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int count = 0; int n, a, b, c, i; scanf("%d", &n); for(i = 0; i < n; i++) { scanf("%d %d %d", &a, &b, &c); if (a + b + c > 1) { count++; } } printf("%d", count); return 0; }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
cba02c862a1376355d7b8fb4a3e194d1
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n,output=0; scanf("%d",&n); while(n!=0) { int a,b,c; scanf("%d %d %d",&a,&b,&c); int count=0; if(a==1) count++; if(b==1) count++; if(c==1) count++; if(count>=2) output++; n--; } printf("%d",output); }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
c2a9eef0faa32aff8d26f91fe095aa91
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include <stdio.h> int main () { int n,i,a,b,c,d=0; scanf("%d",&n); for (i=0;i<n;i++){ scanf("%d %d %d",&a,&b,&c); if((a+b+c)>=2){ d++;} } printf("%d",d); }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
c5b78c57d30cc19b8e15d832bf2a6e0d
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n, p, v,i, t, solve = 0; scanf("%d",&n); for ( i = 0; i < n; i++) { scanf("%d%d%d", &p ,&v ,&t); if (p + v + t > 1) { solve++; } } printf("%d\n",solve); return 0; }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
269f2eb966a0e1ab82cd91a2e69d7ed5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include <stdio.h> int main() { int n; int Petya,Vasya,Tonya,sum,count=0,number=0; scanf("%d\n",&n); for (count=0;n>count;count++) { scanf("%d",&Petya); scanf("%d",&Vasya); scanf("%d",&Tonya); sum=Petya+Vasya+Tonya; if(sum>1) number ++; ...
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
21db883141baa1cce5f947902299e87d
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include <stdio.h> int main(void) { // your code goes //codeforces 231A TEAM int n; int count = 0, num1, num2, num3; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d %d", &num1, &num2, &num3); if ((num1 && num2 == 1) || (num1 && num3 == 1) || (num2 && num3 == 1)) { count++; } } printf("...
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
6d9b9193e42323b958464b0af7a003de
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
int main() { int p, v, t, n, i = 0; scanf("%d", &n); while (n--) { scanf("%d %d %d", &p, &v, &t); if (p + v + t > 1) i++; } printf("%d", i); }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
098e0cdbe354144f2bf9fb2627ceb0e2
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> main(){ int n,a,b,c,d=0; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d %d %d",&a,&b,&c); if(a+b+c>1) d++; } printf("%d",d); }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
05f78f336e552428970b6e3aab11fdb4
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int a,b,c,k=0,n,x; int main() { scanf("%d",&n); for(x=0;x<n;x++) { scanf("%d%d%d",&a,&b,&c); if((a+b+c)>1) k++; } printf("%d",k); return 0; }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
3be16db068277f1d9a2d48368140582d
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n,i,a[5],sum=0,count=0; scanf("%d",&n); while(n--){ for(i=0;i<3;i++){ scanf("%d",&a[i]); } sum=0; for(i=0;i<3;i++){ if(a[i]==1) sum++; } if(sum>=2) count++; } printf("%d\n",count); return 0; }
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
e0191f351c3312b24b86bd6ca5b1d6dc
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n , count = 0 , sum = 0 , a[3] , i , j ; scanf("%d",&n); for(i = 0 ; i < n ; i = i + 1) { for(j = 0 ; j < 3 ; j = j + 1) { scanf("%d",&a[j]); sum = sum + a[j] ; } if(sum == 2 || sum == 3) { cou...
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
c308b9c210075f7c236011617f778aad
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n , count = 0 , sum , a , b , c, i ; scanf("%d",&n); for(i = 0 ; i < n ; i = i + 1) { scanf("%d%d%d",&a,&b,&c); if(a + b + c == 2 || a + b + c == 3) { count = count + 1 ; } } printf("%d\n",count); ...
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
2bcd8de20597326968841258eb84e8cf
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n , count = 0 , sum , a , b , c, i ; scanf("%d",&n); for(i = 0 ; i < n ; i = i + 1) { scanf("%d%d%d",&a,&b,&c); sum = a + b + c ; if(sum == 2 || sum == 3) { count = count + 1 ; } } prin...
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
Print a single integer — the number of problems the friends will implement on the contest.
C
3542adc74a41ccfd72008faf983ffab5
2d74e6477b8d0077538d3971450795cb
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1349623800
["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1"]
NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won'...
PASSED
800
standard input
2 seconds
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Va...
["2", "1"]
#include<stdio.h> int main() { int n,i,j; int a[3],s=0,count=0; scanf("%d",&n); for(i=0;i<n;i++) {s=0; for(j=0;j<3;j++) { scanf("%d",&a[j]); s=s+a[j]; } if(s>=2) count++; } printf("%d",count); return 0; }
In his spare time Vladik estimates beauty of the flags.Every flag could be represented as the matrix n × m which consists of positive integers.Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there e...
For each segment print the result on the corresponding line.
C
167594e0be56b9d93e62258eb052fdc3
2ca5f2e76142093ad49eb6c3f811570b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "dsu", "graphs" ]
1495877700
["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5"]
NotePartitioning on components for every segment from first test case:
PASSED
2,600
standard input
2 seconds
First line contains three space-separated integers n, m, q (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 105) — dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers — description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next...
["6\n7\n3\n4"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 10 #define M 100000 struct T { int *dsu; int cnt; } *tt[M * 4]; int find(int *dsu, int x) { return dsu[x] < 0 ? x : (dsu[x] = find(dsu, dsu[x])); } int join(int *dsu, int x, int y) { x = find(dsu, x); y = find(dsu, y); if (x == y) return 0...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
ccbbe968abe8781dad0e8c00e444de11
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include <stdio.h> int main() { int n,m,i, min=0, max=0, temp, people; scanf("%d%d", &n, &m); int arr[m], arr2[m]; people=n; // printf("people is %d\n" ,people); for(i=0;i<m;i++) { scanf("%d", &arr[i]); } for (i=0;i<m-1; i++) { for(...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
308b5c4766fed480624be8c51adf9b79
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include<stdio.h> struct pair { int e; int i; }; int sort(int n,int *arr) { int i,j,temp; for(i=0;i<n-1;i++) for(j=0;j<n-i-1;j++) if(arr[j]>arr[j+1]) { temp=arr[j]; ...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
d4cc8226ae2ad4f5ac9e8b0323af6d2a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include<stdio.h> #include<stdlib.h> int main() { int n,m; scanf("%d %d",&n,&m); int* A=(int*)calloc(m,sizeof(int)); int* B=(int*)calloc(m,sizeof(int)); for(int i=0;i<m;i++) { scanf("%d",A+i); B[i]=A[i]; } int max=0; int p=0; while(p!=n) { int k=A[0],pos=0; ...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
11797fb5a203c7d35069f41c63911830
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include<stdio.h> int max(int arr[],int n) { int max=0; int j; for(int i=0;i<n;i++) { if(arr[i]>max) { max=arr[i]; j=i; } } return j; } int min(int arr[],int n) { int min=2000; int j; for(int i=0;i<n ;i++) { if(arr[i]<min && arr[i]>0) { min=arr[i]; j=i; } } return j; } int main () { ...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
44fc52ae7114f24ae4a4cbb9a336f4fe
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n,m,count=0,temp; int tab[1000],tab2[1000],min=0,max=0; scanf("%d %d",&n,&m); for (int i = 0; i < m; i++) { scanf("%d",&tab[i]);count++; temp=tab[i]; if(i>0)for (int j = 0; j < count; j++) { if(tab[j]>tab[i]){ ...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
c3421588bde2af55533a40dc224e680b
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include<stdio.h> int main() { int n, m, a[1000], b[1000], i, j, t, x=0, y=0, k, z; scanf("%d %d", &n, &m); for(i=0; i<m; i++) scanf("%d", &a[i]); for(i=0; i<m; i++) { for(j=i+1; j<m; j++) { if(a[i]<a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } } a[m]=0; for(i=0; i<m; i++) b[i]=a[i]; t...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
47e827ccffd77c40287fa069ba3129e0
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include<stdio.h> void mergesort(int arr[], int l, int r) { if (l < r) { int m = l+(r-l)/2; mergesort(arr, l, m); mergesort(arr, m+1,r); merge(arr, l, m, r); } } void merge(int arr[], int l, int m, int r) { int i, j, k; int n1 = m - l + 1; int n2 = r - m; int L[n1], R[n2]; for (i = 0; i < n1; i++) L[i] = arr[l + i]; fo...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
4652fe5e672d7adf502bd1a563ed99a6
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include <stdio.h> void merge(int arr[], int l, int m, int r) { int i, j, k; int n1 = m - l + 1; int n2 = r - m; /* create temp arrays */ int L[n1], R[n2]; /* Copy data to temp arrays L[] and R[] */ for (i = 0; i < n1; i++) L[i] = arr[l + i]; for (j = 0; j < n2; j...
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has x (x &gt; 0) empty seats at the given moment, then the ticket for such a plane costs x zlo...
Print two integers — the maximum and the minimum number of zlotys that the airport administration can earn, correspondingly.
C
6dea4611ca210b34ae2da93ebfa9896c
d3d4f80e5ab41414ca832f38aa1a306d
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation" ]
1345273500
["4 3\n2 1 1", "4 3\n2 2 2"]
NoteIn the first test sample the number of passengers is equal to the number of empty seats, so regardless of the way the planes are chosen, the administration will earn the same sum.In the second sample the sum is maximized if the 1-st person in the queue buys a ticket to the 1-st plane, the 2-nd person — to the 2-nd ...
PASSED
1,100
standard input
2 seconds
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of passengers in the queue and the number of planes in the airport, correspondingly. The next line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000) — ai stands for the number of empty seats in the i-th plane before the ticket office starts s...
["5 5", "7 6"]
#include <stdio.h> #include <stdlib.h> int cmp1 (const void * a, const void * b){ return (*(int*)b - *(int*)a); } int cmp2 (const void * a, const void * b){ return (*(int*)a - *(int*)b); } int main(){ int n, m; scanf("%d %d", &n, &m); int i, x[1000], y[1000], min = 0, max = 0, p = n; for(i = 0; i < m; ++i){ ...
Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has $$$n$$$ positions to install lamps, they correspond to the integer numbers from $$$0$$$ to $$$n - 1$$$ on the OX axis. However, some positi...
Print the minimal total cost of the post lamps of exactly one type Adilbek can buy to illuminate the entire segment $$$[0; n]$$$ of the street. If illumintaing the entire segment $$$[0; n]$$$ is impossible, print -1.
C
6f26747e5ed41d6eb1bfcef48a2dc46d
efe7d3b4ddba084a8adcbed36b736715
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1528625100
["6 2 3\n1 3\n1 2 3", "4 3 4\n1 2 3\n1 10 100 1000", "5 1 5\n0\n3 3 3 3 3", "7 4 3\n2 4 5 6\n3 14 15"]
null
PASSED
2,100
standard input
2 seconds
The first line contains three integer numbers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^6$$$, $$$0 \le m \le n$$$) — the length of the segment of the street Adilbek wants to illuminate, the number of the blocked positions and the maximum power of the post lamp available. The second line contains $$$m$$$ int...
["6", "1000", "-1", "-1"]
#include <stdio.h> #define MAX_PLACES 1000000 #define MAX_LAMPS 1000000 typedef long long int int64; int point[MAX_PLACES]; int costs[MAX_LAMPS]; int64 min(int64 a, int64 b) { return a < b ? a : b; } int64 max(int64 a, int64 b) { return a > b ? a : b; } int64 GetCost(int n, int power, int cost) { int64 total_cost...
Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has $$$n$$$ positions to install lamps, they correspond to the integer numbers from $$$0$$$ to $$$n - 1$$$ on the OX axis. However, some positi...
Print the minimal total cost of the post lamps of exactly one type Adilbek can buy to illuminate the entire segment $$$[0; n]$$$ of the street. If illumintaing the entire segment $$$[0; n]$$$ is impossible, print -1.
C
6f26747e5ed41d6eb1bfcef48a2dc46d
16864688358bcb4bcfb5ffd7a81acaaa
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "brute force" ]
1528625100
["6 2 3\n1 3\n1 2 3", "4 3 4\n1 2 3\n1 10 100 1000", "5 1 5\n0\n3 3 3 3 3", "7 4 3\n2 4 5 6\n3 14 15"]
null
PASSED
2,100
standard input
2 seconds
The first line contains three integer numbers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^6$$$, $$$0 \le m \le n$$$) — the length of the segment of the street Adilbek wants to illuminate, the number of the blocked positions and the maximum power of the post lamp available. The second line contains $$$m$$$ int...
["6", "1000", "-1", "-1"]
/* upsolve with Dukkha */ #include <stdio.h> #define N 1000000 #define INF ((long long) 2e12) int aa[N], pp[N], qq[N]; int count(int n, int p) { int i, cnt = 0; for (i = 0; i < n; ) if (aa[i] == 0) { cnt++; i += p; } else { if (pp[i] + qq[i] - 1 >= p) return -1; i -= pp[i]; } return cnt; } ...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
a05cdb2451375a162b1c38cd4e956669
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { char s[1000000], pilha[1000000]; int i, topo = 0, count = 0; scanf(" %s", s); for(i = 0; i < strlen(s); i++){ if(s[i] == '[' || s[i] == '(' || s[i] == '{' || s[i] == '<'){ pilha[...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
181cf1dd4ef33a40496efc514cb893d1
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include <stdio.h> #include <string.h> int main(){ char aberto[1000000]; int FilaAberto,FilaFechado; int ordem,i,j,tam,ok; char formula[1000000]; int a,b; scanf(" %s",formula); tam = strlen(formula); ok = 1; ordem = 0; if(tam%2==1){ printf("Impossible"); } else{ FilaAberto = 0; for(i=0;i<tam;i++...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
decadb50bde5b1b0565f2c3f8d1104dd
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */ /* رَّبِّ زِدْنِى عِلْمًا */ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #define OUTPUT freopen("myfile.txt","w",stdout); #define INPUT freopen("input.txt","r",stdin); #define pi acos(-1.0) #define MAX 1000005 int main...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
519dc74e9a7f5649f2d52cfa13318495
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <stdbool.h> #include <time.h> #define SIZE 1000002 struct Node { long key; struct Node *next; }; typedef struct Node Node; void push(Node **Stack, long x) { Node *temp = malloc(sizeof *temp); temp -> next = *Stack;...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
f23441cc5ef88f29cff6401ba749d097
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include <stdio.h> #include <string.h> int cast(char ch) { if (ch=='[') return 1; if (ch==']') return -1; if (ch=='(') return 2; if (ch==')') return -2; if (ch=='{') return 3; if (ch=='}') return -3; if (ch=='<') return 4; if (ch=='>') return -4; } int main() { int i,j,n,ans=0,t=0; char a[1001000]; int b[1...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
06aafac57d63669aa015ce58c28325e1
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include <stdio.h> #include <string.h> int main(void) { char seq[1000005]; char temp; int j=0; int ans=0; for(;;) { if(scanf("%c", &temp)==-1 || temp=='\n') { break; } if(temp=='(' || temp=='<' || temp=='[' || temp=='{') { ...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
d49239f7fbfd38e52aab251fb65e936f
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include "stdio.h" #include "stdlib.h" char Openings[] = { '{' , '<' , '(' , '[' }; char Closings[] = { '}' , '>' , ')' , ']' }; int IsOpening( char cToken ) { int i; for( i = 0 ; i < sizeof(Openings) ; i++ ) { if( cToken == Openings[i] ) ...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
32df8a135908388bc0d713437515c0b6
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include<stdio.h> //#include<conio.h> #include<string.h> char brackets[1000005]; int tos,need; void push(char c){ brackets[tos]=c; tos++; } void pop(char c){ if(tos==0){ need=-1; return; } if(c==brackets[tos-1]){ brackets[tos-1]='\0'; tos--; } else{ need++; tos--; } } int main(){ int i,l; char...
You are given string s consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace &lt; by the bracket {, but you can't replace it by ) or &gt;.The following defin...
If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s.
C
4147fef7a151c52e92c010915b12c06b
7e96ba442985acc1f721a77b9e5d3c34
GNU C
standard output
256 megabytes
train_001.jsonl
[ "data structures", "math", "expression parsing" ]
1451055600
["[&lt;}){}", "{()}[]", "]]"]
null
PASSED
1,400
standard input
1 second
The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.
["2", "0", "Impossible"]
#include<stdio.h> #include<stdlib.h> int main(){ char sinal; char Pilha[1000001]; int topo=-1; int cont=0,erro=0; scanf("%c",&sinal); while (sinal!='\n'&& erro==0) { if(sinal=='{'||sinal=='['||sinal=='<'||sinal=='('){ topo++; ...