exec_outcome
stringclasses
1 value
code_uid
stringlengths
32
32
file_name
stringclasses
111 values
prob_desc_created_at
stringlengths
10
10
prob_desc_description
stringlengths
63
3.8k
prob_desc_memory_limit
stringclasses
18 values
source_code
stringlengths
117
65.5k
lang_cluster
stringclasses
1 value
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_time_limit
stringclasses
27 values
prob_desc_sample_outputs
stringlengths
2
796
prob_desc_notes
stringlengths
4
3k
lang
stringclasses
5 values
prob_desc_input_from
stringclasses
3 values
tags
listlengths
0
11
src_uid
stringlengths
32
32
prob_desc_input_spec
stringlengths
28
2.37k
difficulty
int64
-1
3.5k
prob_desc_output_spec
stringlengths
17
1.47k
prob_desc_output_to
stringclasses
3 values
hidden_unit_tests
stringclasses
1 value
PASSED
a30dc1734bad3ab473b2a7ba42020084
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Rough { public static void main(String[] args) { HashSet<Character> set = new HashSet<>(); Scanner sc = new Scanner(System.in); long t = sc.nextInt(); while(t-->0){ long n = sc.nextLong(); String s = "Timur"; String str = sc.next(); if(n==s.length()) { for(int i=0; i<s.length(); i++) { char v = str.charAt(i); set.add(v); } boolean flag = false; for(int i=0; i<s.length(); i++) { char k = s.charAt(i); if(!set.contains(k)) { flag = true; break; } } if(flag == false) { System.out.println("YES"); }else { System.out.println("NO"); } set.clear(); }else { System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
29323ef62f66178c5c8542d8c6e6e595
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0;i<t;i++) { int n = sc.nextInt(); String s = sc.next(); HashMap<Character,Integer> map = new HashMap<>(); int count=0; for(int j=0;j<n;j++) { char c = s.charAt(j); if (c == 'T' || c == 'm' || c == 'i' || c == 'u' || c == 'r') { if (map.containsKey(s.charAt(j))) { map.put(s.charAt(j), map.get(s.charAt(j)) + 1); } else { map.put(s.charAt(j), 1); } } } if(map.size()==5 && s.length()==5){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
65fd98570fe4a35cf0b526a0a54e201c
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class Codeforce21 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t= sc.nextInt(); for(int x=0;x<t;x++){ String a="Timur"; int n=sc.nextInt(); String b=sc.next(); int[] count=new int[256]; if(a.length()!=b.length()){ System.out.println("NO"); continue; } for(int i=0;i<a.length();i++){ count[a.charAt(i)]++; count[b.charAt(i)]--; } boolean flag=false; for(int i=0;i<256;i++){ if(count[i]!=0){ System.out.println("NO"); flag=true; break; } } if(flag==false) System.out.println("YES"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
27b08697d11a8777c9b9df7f72901556
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.*; import java.math.*; import java.util.*; // public class Main { static final int INF = 0x3f3f3f3f; static final long LNF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) throws IOException { initReader(); int t=nextInt(); while (t--!=0){ int n=nextInt(); String s=next(); String aim="Timur"; boolean ans=true; if(s.length()!=aim.length())ans=false; if(ans){ for(int i=0;i<aim.length();i++){ String a=aim.substring(i,i+1); if(!s.contains(a)){ ans=false; break; } } } if(ans)pw.println("YES"); else pw.println("NO"); } pw.close(); } /***************************************************************************************/ static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter pw; public static void initReader() throws IOException { reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = new StringTokenizer(""); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 从文件读写 // reader = new BufferedReader(new FileReader("test.in")); // tokenizer = new StringTokenizer(""); // pw = new PrintWriter(new BufferedWriter(new FileWriter("test1.out"))); } public static boolean hasNext() { try { while (!tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine()); } } catch (Exception e) { return false; } return true; } public static String next() throws IOException { while (!tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine()); } return tokenizer.nextToken(); } public static String nextLine() { try { return reader.readLine(); } catch (Exception e) { return null; } } public static int nextInt() throws IOException { return Integer.parseInt(next()); } public static long nextLong() throws IOException { return Long.parseLong(next()); } public static double nextDouble() throws IOException { return Double.parseDouble(next()); } public static char nextChar() throws IOException { return next().charAt(0); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
0166f2f6ff897f5b6fe2d11bec5607bd
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); for (int i = 0; i < n; i++) { int tempN = s.nextInt(); String name = s.next(); Boolean res = true; StringBuilder str = new StringBuilder("zxcvb"); if (tempN == 5) { for (int j = 0; j < tempN; j++) { if (name.charAt(j)=='T') { str.setCharAt(0, 'T'); } else if (name.charAt(j) == 'i') { str.setCharAt(1, 'i'); } else if (name.charAt(j) == 'm') { str.setCharAt(2, 'm'); } else if (name.charAt(j) == 'u') { str.setCharAt(3, 'u'); } else if (name.charAt(j) == 'r') { str.setCharAt(4, 'r'); } } String summ=str.toString(); String temp ="Timur".toString(); if (!summ.equals(temp)) { res = false; } } else { res = false; } if (res){ System.out.printf("YES \n"); } else{ System.out.printf("NO \n"); } } s.close(); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3cf229fc42644d9859d57308734b2363
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class HelloWorld { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t--> 0) { long n = sc.nextLong(); String s = sc.next(); // System.out.println(); boolean T = false; boolean i = false; boolean m = false; boolean u = false; boolean r = false; if(n>5 || n<5) { println("NO"); } else { for(int ii=0; ii<5; ii++) { if(s.charAt(ii)=='T') T=true; else if(s.charAt(ii)=='i') i=true; else if(s.charAt(ii)=='m') m=true; else if(s.charAt(ii)=='u') u=true; else if(s.charAt(ii)=='r') r=true; } if(T&&i&&m&&u&&r)println("YES"); else println("NO"); } } } public static long sum(long n) { return (n*(n+1))/2; } ///////////////////////////////////////////////////////////////////////////////// public static void printArray(int[] arr) { for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + " "); } System.out.println(); } public static void print(String s) { System.out.print(s + " "); } public static void print(int s) { System.out.print(s + " "); } public static void print(long s) { System.out.print(s + " "); } public static void println(String s) { System.out.println(s); } public static void println(int s) { System.out.println(s); } public static void println(long s) { System.out.println(s); } public static void swap(int[] arr) { for (int i = 0; i < arr.length; i = i + 2) { int temp = arr[i]; arr[i] = arr[i + 1]; arr[i + 1] = temp; } } public static boolean isPrime(int n) { // Corner cases if (n <= 1) return false; if (n <= 3) return true; // This is checked so that we can skip // middle five numbers in below loop if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } static int maxInArray(int[] arr) { int max = arr[0]; for (int i = 0; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; } } return max; } static void printN() { System.out.println("NO"); } static void printY() { System.out.println("YES"); } static int findfrequencies(int a[], int n) { int count = 0; for (int i = 0; i < a.length; i++) { if (a[i] == n) { count++; } } return count; } static int gcd(int a, int b) { while (b != 0) { int t = a; a = b; b = t % b; } return a; } static int lcm(int a, int b) { return (a / gcd(a, b)) * b; } static int binary_search(int a[], int value) { int start = 0; int end = a.length - 1; int mid = start + (end - start) / 2; while (start <= end) { if (a[mid] == value) { return mid; } if (a[mid] > value) { end = mid - 1; } else { start = mid + 1; } mid = start + (end - start) / 2; } return -1; } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
7015837d3fa8ca8a6c4cbc4e7ed9436c
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Codeforces { private static final String TIMUR = "Timur"; public static void main (String[] args) throws IOException { PrintWriter pt=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int xyz=0; xyz<t; xyz++) { int n=sc.nextInt(); String s = sc.next(); Boolean check = true; if(s.length() != 5) check = false; else { for(int i = 0; i < TIMUR.length(); ++i) { if(s.indexOf(TIMUR.charAt(i)) == -1) { check = false; break; } } } if(check == true) System.out.println("Yes"); else System.out.println("No"); } pt.close(); } public static void recurPermut(String S, List<String> ls, int index) { if(index == S.length()) { String s = ""; for(int i = 0; i < S.length(); ++i) { s = s + S.charAt(i); } ls.add(s.trim()); } if(index < S.length()) { for(int i = 0; i < S.length(); ++i) { S = swap(i, index, S); recurPermut(S, ls, index + 1); S = swap(i, index, S); } } } public static String swap(int i, int j, String a) { char temp; char[] charArray = a.toCharArray(); temp = charArray[i] ; charArray[i] = charArray[j]; charArray[j] = temp; return String.valueOf(charArray); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
94f66ab73f37b965e21bc4eb2c9293e4
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class A { public static void main(String args[]) { FastReader sc =new FastReader(); PrintWriter out=new PrintWriter(System.out); // int t=1; int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); String s=sc.next(); int len=s.length(); if(len==5){ if(s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r")){ out.println("YES"); } else out.println("NO"); } else{ out.println("NO"); } } out.close(); } static void sort(int[] a) { ArrayList<Integer> l=new ArrayList<>(); for (int i:a) l.add(i); Collections.sort(l); for (int i=0; i<a.length; i++) a[i]=l.get(i); } static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while (st == null || !st.hasMoreElements()) { try {st = new StringTokenizer(br.readLine());} catch (IOException e) {e.printStackTrace();} } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() {return Double.parseDouble(next()); } String nextLine(){ String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
28004df59e4ad578dfd4770b45067f7f
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { // static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } public String nextLine(){ String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { MyScanner s=new MyScanner(); int n=s.nextInt(); char[]aim=new char[]{'T','m','i','u','r'}; Arrays.sort(aim); for(int i=0;i<n;i++){ int b=s.nextInt(); char[]str=s.next().toCharArray(); if(str.length!=aim.length){ System.out.println("NO"); continue; } boolean flag=false; Arrays.sort(str); for(int j=0;j<str.length;j++){ if(str[j]!=aim[j]){ flag=true; break; } } if(!flag) System.out.println("YES"); else System.out.println("NO"); } } } //传送题加一个自己传送自己
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
9ca7444fdba258a953694d4030526003
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static Scanner in = new Scanner(System.in); static BufferedReader re = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out)); //String[] strs = re.readLine().split(" "); int a = Integer.parseInt(strs[0]); public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); //String[] strs = re.readLine().split(" "); //int T=Integer.parseInt(strs[0]); int T=in.nextInt(); while(T>0){ //String[] strs1 = re.readLine().split(" "); //int n=Integer.parseInt(strs1[0]); //String s=re.readLine(); //char arr[]=s.toCharArray();Timur Map<Character,Integer>map=new HashMap<>(); int n=in.nextInt(); String s=in.next(); char arr[]=s.toCharArray(); int t=0;int v=0; if(arr.length!=5)t++; for(int i=0;i<arr.length;i++){ if(arr[i]>='A'&&arr[i]<='Z'){ if(arr[i]!='T')t++; else {map.put(arr[i],1);} } if(arr[i]>='a'&&arr[i]<='z'){ if(arr[i]=='i'){ if(map.getOrDefault(arr[i], 0)==0){map.put(arr[i],1);} else{v++;} } else if(arr[i]=='m'){ if(map.getOrDefault(arr[i], 0)==0){map.put(arr[i],1);} else{v++;} } else if(arr[i]=='u'){ if(map.getOrDefault(arr[i], 0)==0){map.put(arr[i],1);} else{v++;} } else if(arr[i]=='r'){ if(map.getOrDefault(arr[i], 0)==0){map.put(arr[i],1);} else{v++;} } else v++; } } if(map.getOrDefault('u', 0)==0)v++; if(map.getOrDefault('r', 0)==0)v++; if(map.getOrDefault('m', 0)==0)v++; if(map.getOrDefault('i', 0)==0)v++; if(map.getOrDefault('T', 0)==0)v++; if(t>0||v>0)System.out.println("NO"); else System.out.println("YES"); T--; } out.flush(); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ab7d05d1284a4c06c17f3ee9e845e09a
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
// Working program with FastReader import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.*; import java.util.Scanner; import java.util.StringTokenizer; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); String s = sc.next(); if(n>5 || n<5) System.out.println("NO"); else { int cap = 0, I = 0, M = 0, U = 0, R = 0; for(int i = 0;i<s.length();i++) { if(s.charAt(i)=='T') cap = 1; if(s.charAt(i) == 'i') I = 1; if(s.charAt(i) == 'm') M = 1; if(s.charAt(i) == 'u') U = 1; if(s.charAt(i) == 'r') R = 1; } if(cap == 1 && I == 1 && M == 1 && U == 1 && R == 1) System.out.println("YES"); else System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3b87fd519801e0154235d75c3b9c6ba1
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static int N = 200010, INF = 0x3f3f3f3f; public static void main(String[] args) throws IOException { FastScanner f = new FastScanner(); PrintWriter w = new PrintWriter(System.out); int T = f.nextInt(); while (T-- > 0) { int n = f.nextInt(); String str = f.nextString(); char[] c = str.toCharArray(); //Timur, miurT, Trumi, mriTu Arrays.sort(c); if (new String(c).equals("Timru")) w.println("YES"); else w.println("NO"); } w.flush(); } private static class FastScanner { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; private FastScanner() throws IOException { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } private short nextShort() throws IOException { short ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do ret = (short) (ret * 10 + c - '0'); while ((c = read()) >= '0' && c <= '9'); if (neg) return (short) -ret; return ret; } private int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do ret = ret * 10 + c - '0'; while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do ret = ret * 10 + c - '0'; while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } private char nextChar() throws IOException { byte c = read(); while (c <= ' ') c = read(); return (char) c; } private String nextString() throws IOException { StringBuilder ret = new StringBuilder(); byte c = read(); while (c <= ' ') c = read(); do { ret.append((char) c); } while ((c = read()) > ' '); return ret.toString(); } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
948241d253063a31d011754678ed1da6
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public class spell_check2 { public static void main(String[] args) throws java.lang.Exception { Scanner scn = new Scanner(System.in); int test_case = scn.nextInt(); int flag = 0; for (int t = 0; t < test_case; t++) { HashSet<Character> hs = new HashSet<>(); String Tim = "Timur"; for (int i = 0; i < 5; i++) { char chara = Tim.charAt(i); hs.add(chara); } int num = scn.nextInt(); String stringg = scn.next(); if (num != 5) { System.out.println("NO"); } else { for (int i = 0; i < num; i++) { char chara = stringg.charAt(i); if (hs.contains(chara)) { hs.remove(chara); } else { // System.out.println("NO"); flag= 1; // break; } } if(flag==0){ System.out.println("YES"); } else{ System.out.println("NO"); flag=0; } } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
cf60ca6550393dce3fdd11912a87485f
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Spell{ public static void main(String[] kk){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String s=sc.next(); int T=0,i=0,m=0,r=0,u=0; for(int k=0;k<n;k++){ char ch=s.charAt(k); if(ch=='T') T++; else if(ch=='i')i++; else if(ch=='m')m++; else if(ch=='u')u++; else if(ch=='r')r++; } if(s.length()==5 && T==1 && i==1 && m==1 && u==1 && r==1) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
2408b4df12a8e6fb04999b0387a1bb21
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class SpellCheck { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int cnt=0; cnt<t; cnt++) { int n = sc.nextInt(); String s = sc.nextLine(); String str = sc.nextLine(); if (n!=5) { System.out.println("NO"); continue; } int c1=0,c2=0,c3=0,c4=0,c5=0; for (int i=0; i<n; i++) { char ch = str.charAt(i); if (ch=='T')c1=1; if (ch=='i')c2=1; if (ch=='m')c3=1; if (ch=='u') c4 = 1; if (ch=='r')c5=1; } if (c1==1 && c2==1 && c3==1 && c4==1 && c5==1) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
deaa05c4be8636550d31c737cd3db778
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Spellcheck { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n,t,i,j,m,x,S=0; t=in.nextInt(); String s,s1="Timur",st,st2; x=529; String ans[]=new String[t]; for(i=0;i<t;i++) { n=in.nextInt(); s=in.next(); char array[] = s.toCharArray(); Arrays.sort(array); st= new String(array); char array2[] = s1.toCharArray(); Arrays.sort(array2); st2= new String(array2); if(n>5) { ans[i]="no"; } else if((st.equals(st2)||S==x)&&(n==5)) { ans[i]="Yes"; } else { ans[i]="no"; } S=0; } for(i=0;i<t;i++) { System.out.println(""+ans[i]); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
001a8c006a5afb7444e41e819f5b549e
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.lang.*; import java.util.*; public class demo{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int T=sc.nextInt(); for(int p=0;p<T;p++){ int N=sc.nextInt(); String str=sc.next(); int s1=0,s2=0,s3=0,s4=0,s5=0; if(N==5){ for(int i=0;i<5;i++){ if(str.charAt(i)=='T'){ s1++; } else if(str.charAt(i)=='m'){ s2++; } else if(str.charAt(i)=='i'){ s3++; } else if(str.charAt(i)=='u'){ s4++; } else if(str.charAt(i)=='r'){ s5++; } } } if(s1==1 && s2==1 && s3==1 && s4==1 && s5==1){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
cb06c008d12297b0cb8d655acea778b8
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; import java.io.*; public class Main{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || !st.hasMoreTokens()){ try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt(){ return Integer.parseInt(next()); } long nextLong(){ return Long.parseLong(next()); } double nextDouble(){ return Double.parseDouble(next()); } String nextLine(){ String str=""; try { str=br.readLine().trim(); } catch (Exception e) { e.printStackTrace(); } return str; } } static class FastWriter { private final BufferedWriter bw; public FastWriter() { this.bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public void print(Object object) throws IOException { bw.append("" + object); } public void println(Object object) throws IOException { print(object); bw.append("\n"); } public void close() throws IOException { bw.close(); } } public static void main(String[] args) { try { FastReader in = new FastReader(); FastWriter out = new FastWriter(); int testCases = in.nextInt(); while(testCases --> 0){ // write code here HashSet <Character> set = new HashSet<Character>(); set.add('T'); set.add('m'); set.add('i'); set.add('u'); set.add('r'); int n = in.nextInt(); String str = in.nextLine(); int i = 0, wrong = 0; if (n != 5) { System.out.println("No"); continue; } for(i = 0; i < 5; i++) { if (set.contains(str.charAt(i))) { set.remove(str.charAt(i)); } else wrong = 1; } if (wrong == 1) System.out.println("NO"); else System.out.println("YES"); } out.close(); } catch (Exception e) { return; } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
a8ab4cc8f074a655866ea3cc60c6ab09
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); char[] c=new char[256]; String x="Timur"; for(int i=0;i<x.length();i++) { int index=x.charAt(i); c[index]=1; } int len=5; int n=sc.nextInt(); for(int i=0;i<n;i++) { int t=sc.nextInt(); String xx=sc.next(); if(len!=t) { System.out.println("NO"); } else { char[] temp=new char[256]; for(int j=0;j<xx.length();j++) { int index=xx.charAt(j); temp[index]=1; } if(Arrays.equals(temp, c)) { System.out.println("YES"); } else { System.out.println("NO"); } } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
5cff4dbb9537935869317a6fd32ff664
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class sol { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i<n;i++){ int n1 = sc.nextInt(); String spell = sc.next(); if(n1!=5) System.out.println("NO"); else{ if(spell.contains("T") && spell.contains("i") && spell.contains("m") && spell.contains("u") && spell.contains("r")) { System.out.println("YES"); } else System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
521d2ecd1bcea7a0eca792db0cfe811d
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class Timur { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); String s = null; for (int i = 0; i < x; i++) { int y = sc.nextInt(); s = sc.next(); if (s.length() == 5 && s.contains("m") && s.contains("i") && s.contains("T") && s.contains("r") && s.contains("u")) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
da020cd15e6814ceae8d492ca05790c4
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.*; import java.util.*; public class Main { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) throws IOException { int TC = in.nextInt(); while (TC-- > 0) { Solver(); } out.flush(); } private static void Solver() { int n = in.nextInt(); String Timur = "Timur"; String s = in.nextLine(); char[] a = Timur.toCharArray(); char[] b = s.toCharArray(); Arrays.sort(a); Arrays.sort(b); out.println(Arrays.equals(a, b) ? "YES" : "NO"); } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { if (st.hasMoreTokens()) { str = st.nextToken("\n"); } else { str = br.readLine(); } } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d530e95247589cf484233960d2866fb8
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; import java.lang.*; public class tes { public static void main (String[] args)throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); String s=sc.next(); if(n!=5) { System.out.println("No"); continue; } if((s.indexOf('r')!=-1)&&(s.indexOf('u')!=-1)&&(s.indexOf('T')!=-1)&&(s.indexOf('i')!=-1)&&(s.indexOf('m')!=-1)) System.out.println("Yes"); else System.out.println("No"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
29d0dbe4ce543d2f3d74d54991a0f0b6
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class solution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String p="Timur"; char[] ch=p.toCharArray(); Arrays.sort(ch); String q=new String(ch); while(n-->0) { int a=sc.nextInt(); String temp=sc.nextLine(); String s=sc.nextLine(); char[] ch1=s.toCharArray(); Arrays.sort(ch1); String q1=new String(ch1); if(q1.equals(q)) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
125f8f68b505008c33deb864f5279b76
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws Exception { //code BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); while(t-->0) { HashSet<Character> hs=new HashSet<Character>(); hs.add('T'); hs.add('i'); hs.add('m'); hs.add('u'); hs.add('r'); int n=Integer.parseInt(br.readLine()); String str=br.readLine(); if(n!=5) { System.out.println("NO"); continue; } else { int flag=0; for(int i=0;i<n;i++) { if(hs.contains(str.charAt(i))==false) { System.out.println("NO"); flag=1; break; } else { hs.remove(str.charAt(i)); } } if(flag==1) { continue; } } System.out.println("YES"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ca4679c258c190f5fae875764e836851
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
//KENAA import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public class A { public static void main(String[] args) { FastReader fr = new FastReader(); PrintWriter out = new PrintWriter(System.out); StringBuilder st = new StringBuilder(); int tt = fr.nextInt(); outer:while (tt-->0) { HashMap<Character, Boolean> mapy = new HashMap<>(); mapy.put('T', false); mapy.put('i', false); mapy.put('m', false); mapy.put('u', false); mapy.put('r', false); int n = fr.nextInt(); String s = fr.next(); if (n!=5) { st.append("NO\n"); continue outer; }else { for (int i = 0; i < s.length(); i++) { if (!mapy.containsKey(s.charAt(i))) { st.append("NO\n"); continue outer; }else { if (mapy.get(s.charAt(i))==false) { mapy.put(s.charAt(i), true); }else { st.append("NO\n"); continue outer; } } } st.append("YES\n"); } } out.print(st); out.close(); } static class FastReader { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { } return st.nextToken(); } int[] readArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } } public static long lcm(long a, long b) { return a * b / gcd(a, b); } public static long gcd(long a, long b) { while (b != 0) { long m = a % b; a = b; b = m; } return a; } public static long factorial(int n) { if (n == 0) return 1; long res = 1; for (int i = 2; i <= n; i++) res = res * i; return res; } public static long nCr(int n, int r) { return factorial(n) / (factorial(r) * factorial(n - r)); } public static ArrayList<Integer> factors(long n) { ArrayList<Integer> list = new ArrayList<>(); for (int i = 2; i < n / i; i++) { while (n % i == 0) { if (!list.contains(i)) { list.add(i); n /= i; } } } if (n > 2) { if (!list.contains((int) n)) { list.add((int) n); } } return list; } public static int numOfPrimes(int n) { if (n < 2) { return 0; } boolean[] bool = new boolean[n + 1]; outer: for (int i = 2; i < bool.length / i; i++) { if (bool[i]) { continue outer; } for (int j = 2 * i; j < bool.length; j += i) { bool[j] = true; } } int counter = 0; for (int i = 0; i < bool.length; i++) { if (!bool[i]) { counter++; } } return counter; } public static void sort2DGivenArray(Object[][] arr, int colNum) { Arrays.sort(arr, (val1, val2) -> { if (val1[colNum] == val2[colNum]) { return 0; } else if (((Integer) (val1[colNum])).compareTo(((Integer) (val2[colNum]))) < 0) { return 1; } else { return -1; } }); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
40d3d95994a080d5b82a82389855eb2a
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-- > 0){ int n = scn.nextInt(); String s = scn.next(); HashSet<Character> set = new HashSet<>(); set.add('T'); set.add('i'); set.add('m'); set.add('u'); set.add('r'); if(n != 5){ System.out.println("No"); } else{ for(char ch: s.toCharArray()){ if(set.contains(ch)){ set.remove(ch); } } if(set.size() == 0){ System.out.println("Yes"); } else{ System.out.println("No"); } } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
4151ff792232c1bfb9f2a8378de0e243
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.lang.Math; import java.util.*; public class find{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++){ int n=sc.nextInt(); String s=sc.next(); if(n!=5){ System.out.println("NO"); } else if(!s.contains("T") || !s.contains("i") || !s.contains("m") || !s.contains("u") || !s.contains("r")){ System.out.println("NO"); } else System.out.println("YES"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
2d5270f6e9e1affff17a736316c27308
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
/* @Author Shubham Chaudhari */ import java.io.*; import java.util.*; public class Main { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Long>map=new HashMap<>(); public static void main(String[] args) { int t=in.nextInt(); StringBuilder res=new StringBuilder(); HashSet<String>set=new HashSet<>(); loop: while(t-->0) { int n=in.nextInt(); String name="Timur"; char a[]=in.next().toCharArray(); char b[]=name.toCharArray(); Arrays.sort(a); Arrays.sort(b); if(a.length==b.length&&a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2]&&a[3]==b[3]&&a[4]==b[4]){ res.append("YES\n"); } else{ res.append("NO\n"); } } System.out.println(res); } static class Pair implements Comparable<Pair>{ int a,b; public Pair(int a,int b){ this.a=a; this.b=b; } @Override public int compareTo(Pair o) { if(a>o.a){ return 1; }else if(a==o.a){ return 0; } return -1; } } static boolean isPalindrome(int n){ int tmp=n; int tmp2=0; while (n>0){ tmp2=tmp2*10+n%10; n/=10; } return tmp==tmp2; } static long calculateSum(long n) { if(n<0) { return 0; } return n*(n+1)/2; } static void ruffleSort(int[] a) { int n=a.length; for (int i=0; i<n; i++) { int oi=random.nextInt(n), temp=a[oi]; a[oi]=a[i]; a[i]=temp; } Arrays.sort(a); } static void ruffleSort(long[] a) { int n=a.length; for (int i=0; i<n; i++) { int oi=random.nextInt(n); long temp=a[oi]; a[oi]=a[i]; a[i]=temp; } Arrays.sort(a); } static int gcd(int a,int b) { if(b==0) { return a; } return gcd(b,a%b); } static int lcm(int a, int b) { return (a / gcd(a, b)) * b; } static int abs(int a) { if(a<0) return -1*a; return a; } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int [] readintarray(int n) { int res [] = new int [n]; for(int i = 0; i<n; i++)res[i] = nextInt(); return res; } long [] readlongarray(int n) { long res [] = new long [n]; for(int i = 0; i<n; i++)res[i] = nextLong(); return res; } } static class Node implements Comparable<Node> { int val; long cost; public Node(int val,long cost) { this.val=val; this.cost=cost; } public int compareTo(Node x) { return Long.compare(this.cost,x.cost); } } static class UWGraph{ public static ArrayList<WNode> graph[]; public int V; public static PriorityQueue<WNode> pq; public UWGraph(int V){ graph=new ArrayList[V]; for(int i=0;i<V;i++){ graph[i]=new ArrayList<WNode>(); } this.V=V; } public void addEdge(int v,int u,int w){ graph[v].add(new WNode(u,w)); graph[u].add(new WNode(v,w)); } public int[] dijkstra(int src) { int[] distance = new int[V]; for (int i = 0; i < V; i++) distance[i] = Integer.MAX_VALUE; distance[src] = 0; pq = new PriorityQueue<>(); pq.add(new WNode(src, 0)); boolean done[]=new boolean[V]; while (pq.size() > 0) { WNode current = pq.poll(); if(done[current.getVertex()]) continue; done[current.getVertex()]=true; for (WNode n : graph[current.getVertex()]) { if (distance[current.getVertex()] + n.getWeight() < distance[n.getVertex()]) { distance[n.getVertex()] = n.getWeight() + distance[current.getVertex()]; pq.add(new WNode(n.getVertex(), distance[n.getVertex()])); } } } return distance; } } static class WNode implements Comparable<WNode>{ public int vertex, weight; WNode(int v, int w) { vertex = v; weight = w; } int getVertex() { return vertex; } int getWeight() { return weight; } @Override public int compareTo(WNode o) { return weight-o.weight; } } static class UNGraph{ public ArrayList<Integer> graph[]; public int V; public UNGraph(int V){ graph=new ArrayList[V]; for(int i=0;i<V;i++){ graph[i]=new ArrayList<Integer>(); } this.V=V; } public void addEdge(int v,int u){ graph[v].add(u); graph[u].add(v); } } static class SegmentTree{ long st[]; int minCount; long minVal; public SegmentTree(long arr[],int n){ int x = (int) (Math.ceil(Math.log(n) / Math.log(2))); minCount=0; //Maximum size of segment tree int max_size = 2 * (int) Math.pow(2, x) - 1; st = new long[max_size]; // Memory allocation constructSTUtil(arr, 0, n - 1, 0); } long constructSTUtil(long arr[], int ss, int se, int si) { if (ss == se) { st[si] = arr[ss]; return arr[ss]; } int mid = getMid(ss, se); st[si] = Math.min(constructSTUtil(arr, ss, mid, si * 2 + 1), constructSTUtil(arr, mid + 1, se, si * 2 + 2)); return st[si]; } int getMid(int s, int e) { return s + (e - s) / 2; } long updateValueUtil(int ss, int se, int i, long diff, int si) { // Base Case: If the input index lies outside the range of // this segment if (i < ss || i > se) return st[si]; // If the input index is in range of this node, then update the // value of the node and its children if (se != ss) { int mid = getMid(ss, se); st[si] = Math.min( updateValueUtil(ss, mid, i, diff, 2 * si + 1), updateValueUtil(mid + 1, se, i, diff, 2 * si + 2)); } else{ st[si]=diff; } return st[si]; } // The function to update a value in input array and segment tree. // It uses updateValueUtil() to update the value in segment tree void updateValue(long arr[], int n, int i, int new_val) { // Check for erroneous input index if (i < 0 || i > n - 1) { return; } // Get the difference between new value and old value long diff = new_val; // Update the value in array arr[i] = new_val; // Update the values of nodes in segment tree updateValueUtil(0, n - 1, i, diff, 0); } // End of template public long getSum(int n,int l, int r){ minCount=0; minVal= getSumUtil(0,n-1,l,r,0); return minVal; } public long getSumUtil(int ss, int se,int l, int r, int si){ int mid = getMid(ss,se); if(si>=st.length){ return Integer.MAX_VALUE; } if(ss>=l&&se<=r){ if(ss==se && minVal==st[si]){ minCount++; } getSumUtil(ss,mid,l,r,2*si+1); getSumUtil(mid+1,se,l,r,2*si+2); return st[si]; } if (se < l || ss > r) return Integer.MAX_VALUE; if(ss==se && minVal==st[si]){ minCount++; } return Math.min(getSumUtil(ss,mid,l,r,2*si+1),getSumUtil(mid+1,se,l,r,2*si+2)); } void printSegmentTree(){ for(long x: st){ System.out.print(x+" "); } System.out.println(); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3b376fefd5e7122ba4fad1b00a1c60ed
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.*; import java.util.Scanner; import java.lang.Math; import java.util.StringTokenizer; public class Solve_1 { public static void main(String[] args) throws FileNotFoundException { /*Scanner scanner = new Scanner(new File("input.txt")); FileOutputStream fos = new FileOutputStream("output.txt"); PrintStream out = new PrintStream(fos); */ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); char[] N = "Timur".toCharArray(); while (n > 0){ n--; int k = scanner.nextInt(); String name = scanner.next(); int flag = 0; if (k == 5) { for (char ch : N){ if (name.indexOf(ch) != -1){ flag++; } } if (flag == 5) { System.out.println("YES"); } else System.out.println("NO"); } else System.out.println("NO"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
a24e07076fae0fe12ced8c58b0fadf88
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class TaskA { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int p = 0; p < t; p++) { int n = scanner.nextInt(); scanner.nextLine(); String s = scanner.nextLine(); if (s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r") && s.length()==5){ System.out.println("YES"); }else System.out.println("NO"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
719927ae2b744544a9a356953ae0e48b
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class Awkadiv4 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i =0;i<n;i++){ int k = sc.nextInt(); String s=sc.next(); if(s.contains("T")&&s.contains("T")&&s.contains("i")&&s.contains("m")&&s.contains("u")&&s.contains("r")&&s.length()==5){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
2344ba244db07838706aa2a0fe801130
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
/** * @Jai_Bajrang_Bali * @Har_Har_Mahadev */ //@Author : Sanat04 import java.net.Inet4Address; import java.util.*; public class practice2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder res = new StringBuilder(); int t = sc.nextInt(); //int t = 1; while (t-- > 0) { int n = sc.nextInt(); String str=sc.next(); String str1="Timur"; char[] chh=str.toCharArray(); char[] ch=str1.toCharArray(); Arrays.sort(chh); Arrays.sort(ch); String ans=new String(chh); String ans1=new String(ch); if(n>5) res.append("NO").append("\n"); else{ if(ans.equals(ans1)) res.append("YES").append("\n"); else res.append("NO").append("\n"); } } System.out.println(res.toString()); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d9f515ffb6cc2b59c2080fcffcdfcfdc
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
/** * @Jai_Bajrang_Bali * @Har_Har_Mahadev */ //@Author : Sanat04 import java.net.Inet4Address; import java.util.*; public class practice2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder res = new StringBuilder(); int t = sc.nextInt(); //int t = 1; while (t-- > 0) { int n = sc.nextInt(); String str=sc.next(); char[] chh=str.toCharArray(); Arrays.sort(chh); String ans=new String(chh); if(n>5) res.append("NO").append("\n"); else{ if(ans.compareTo("Timru")==0) res.append("YES").append("\n"); else res.append("NO").append("\n"); } } System.out.println(res.toString()); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
93dc909941019e627687a79694c983b3
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Practice1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String name = "Timur"; char[] arr = name.toCharArray(); Set<Character> set = new HashSet<>(); for (int i = 0; i < arr.length; i++) { set.add(arr[i]); } int t = scanner.nextInt(); for (int i = 0; i < t; i++) { String flag = "yes"; int n = scanner.nextInt(); String s = scanner.next(); if(s.length()!=name.length()) flag = "no"; for (int j = 0; j < n; j++) { if(!set.contains(s.charAt(j))){ flag = "no"; }else{ set.remove(s.charAt(j)); } } for (int k = 0; k < arr.length; k++) { set.add(arr[k]); } System.out.println(flag); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
b8ba550bc603b637b3646de221f87842
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.*; public class Cf_0 { public static void main(String[] args) throws IOException { // Reader r= new Reader(); FastReader fr= new FastReader(System.in); int t= fr.nextInt(); for(int i=0;i<t;i++){ int n= fr.nextInt(); String temp= fr.next(); System.out.println(solve800(n,temp)?"YES":"NO"); } } // public static boolean solve800(int n,String str){ if(n!=5) return false; HashMap<Character,Integer>temp=new HashMap<>(); for(int i=0;i<str.length();i++){ temp.put(str.charAt(i),temp.getOrDefault(temp.get(str.charAt(i)),0)+1); } try{ if(temp.get('T')==1 && temp.get('i')==1 && temp.get('m')==1 && temp.get('u')==1 && temp.get('r')==1 ) return true; } catch (Exception e){ return false; } return false; } public static void print(int []a){ for(int t:a){ if(t!=0) System.out.print(t+" "); } System.out.println(); } } class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public Reader(String file_name) throws IOException { din = new DataInputStream( new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[64]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') { if (cnt != 0) { break; } else { continue; } } buf[cnt++] = (byte)c; } return new String(buf, 0, cnt); } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') { c = read(); } boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if (din == null) return; din.close(); } } class FastReader { InputStream is; private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; public FastReader(InputStream is) { this.is = is; } public int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } public boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } public String next() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public String nextLine() { int c = skip(); StringBuilder sb = new StringBuilder(); while (!isEndOfLine(c)) { sb.appendCodePoint(c); c = readByte(); } return sb.toString(); } public int nextInt() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = (num << 3) + (num << 1) + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } public long nextLong() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = (num << 3) + (num << 1) + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } public double nextDouble() { return Double.parseDouble(next()); } public char[] next(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } public char readChar() { return (char) skip(); } public long[] readArrayL(int n) { long[] arr = new long[n]; for (int i = 0; i < n; i++) arr[i] = nextLong(); return arr; } public int[] readArray(int n) { int[] arr = new int[n]; for (int i = 0; i < n; i++) arr[i] = nextInt(); return arr; } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
49ce28b431f6a4e31446c3e3559be5ef
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import sun.font.FontRunIterator; import java.util.*; import java.util.ArrayList; public class codforce { // public static final int ARRAY_SIZE = 20; // public static final int TOP_VALUE = 10; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); for (int i = 0; i < x; i++) { int y = scan.nextInt(); String h = scan.next(); if(h.contains("T") && h.length()==5 && h.contains("u") && h.contains("m") && h.contains("i") && h.contains("r")){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
45c7ad7a9e4a4067ec4259c066220442
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class Code { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while (n-- > 0) { int val = 0; int count = 0; int a = scan.nextInt(); String s = scan.next(); char[] arr = s.toCharArray(); if (a == 5) { for (int i = 0; i < arr.length - 1; i++) { for (int j = i + 1; j < arr.length; j++) { if (arr[i] == arr[j]) { val++; } } } if (val == 0) { for (int i = 0; i < s.length(); i++) { if (arr[i] == 'T') { count++; } else if (arr[i] == 'i') { count++; } else if (arr[i] == 'm') { count++; } else if (arr[i] == 'u') { count++; } else if (arr[i] == 'r') { count++; } } } if (count == a) { System.out.println("YES"); } else if(count != a){ System.out.println("NO"); } } else if (a != 5) { System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
04462ea96278da373da04f30c11247de
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
// Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.*; public class timur{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n =sc.nextInt(); String s = sc.next(); System.out.println(helper(s)); } } public static String helper(String s){ if(s.length()<5||s.length()>5){ String s1 ="NO"; return s1; } String alphas = "Timur"; for (int i = 0; i < alphas.length(); i++) { if (s.indexOf(alphas.charAt(i)) == -1) { String s2 = "NO"; return s2 ; } } String s3 = "YES"; return s3 ; } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
5be541f455ba59df5aa8725dd021f106
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
/* * * * * * * * * * * P A U L A * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ import javax.swing.*; import java.awt.*; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Double.*; import static java.lang.Float.*; public class Main { static final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); static final InputStream inputStream = System.in; static final FastReader in = new FastReader(inputStream); public static void main(String[] args) throws IOException { int numOfTestCase = 1;//in.nextInt() ; while (numOfTestCase-- > 0) Task.solve(in, out); finish(); } static class Task { public static void solve(FastReader input, BufferedWriter out) throws IOException { /* ---------------------------------------------------------------------------------------------------------- كود بيتاكد ان كل الحروف الابجدية موجودة ف الاسترنج distinct() ميثود بتحذف تكرار الحروف يعني مثلا aabbcc هتكون abc int n=input.nextInt(); System.out.println(input.next().toLowerCase().chars().distinct().count()>=26?"YES":"NO"); ---------------------------------------------------------------------------------------------------------- >>>>>>>>> soooooort String <<<<<<<<<<<< String s = in.next(); //cba char[] Arr = s.toCharArray(); Arrays.sort(Arr); String x = new String(Arr); System.out.println(x); ---------------------------------------------------------------------------------------------------------- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>MMMMMMAAAAAAAAPPPPPPPP<<<<<<<<<<<<<<<<<<<<<<< int n = in.nextInt(); HashMap<String,Integer> mp = new HashMap<>(); for (int i = 1 ; i<=n ; i++) { String s = in.next(); if (!mp.containsKey(s)) { mp.put(s,0); System.out.println("OK"); } else { mp.put(s,mp.get(s)+1); System.out.println(s+mp.get(s)); } } ---------------------------------------------------------------------------------------------------------- >>>>>>>>>>>>>>>مودلس للاسترنج>>>>>>>>>>>>>>>>> String s= input.next(); BigInteger b =new BigInteger(s); if (b.mod(new BigInteger("9")).equals(new BigInteger("0"))) System.out.println("YES"); else System.out.println("NO"); ********************************************** String s= input.next(); int i=0; for (int j = 0; j <s.length() ; j++) { i=(i+(s.charAt(s.length()-1-j) -'0')%9) % 9; } System.out.println(i==0?"YES" : "NO"); ------------------------------------------------------------------------------------------------------------ <<<<<<<<<<<<<<<<<<<< PREFEX SUM<<<<<<<<<<<<<<<<<<<<<<< int size=input.nextInt(); int range=input.nextInt(); long arr[]=new long [size]; for (int i = 0; i <size ; i++) { arr[i]=input.nextInt(); if (i==0) continue; arr[i]+=arr[i-1]; } for (int i = 0; i <range ; i++) { int ind1=input.nextInt(); int ind2=input.nextInt(); System.out.print(ind1 -1 ==0?arr[--ind2] +"\n" : arr[--ind2] - arr[ind1-2]+"\n"); } ----------------------------------------------------------------------------------------------------------------- GCD قانون BigInteger b1=BigInteger.valueOf(input.nextInt()); BigInteger b2=BigInteger.valueOf(input.nextInt()); BigInteger b3=b1.gcd(b2); System.out.println(b3); ------------------------------------------------------------------------------------------------------------------- قانونLCM BigInteger b1=BigInteger.valueOf(input.nextInt()); BigInteger b2=BigInteger.valueOf(input.nextInt()); BigInteger b3=b1.gcd(b2); System.out.println((b1.multiply(b2)) .divide(b3)); -------------------------------------------------------------------------------------------------------------------- */ //---------------------------------------------------------------------------------------------------------// int n = in.nextInt(); while(n-->0) { int m = in.nextInt(); String s = in.next(); if (m==5 && s.contains("m") && s.contains("i") && s.contains("T") && s.contains("r") && s.contains("u")) System.out.println("YES"); else System.out.println("NO"); } // -----------------------------------------------------------------------------------------------------------/ } } static int[] readArray1d(int n) throws IOException { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = in.nextInt(); return a; } static int[][] readArray2d(int row, int col) throws IOException { int[][] a = new int[row][col]; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { a[i][j] = in.nextInt(); } } return a; } static long[][] readArray2d(long row, long col) throws IOException { long[][] a = new long[(int) row][(int) col]; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { a[i][j] = in.nextLong(); } } return a; } private static void printArray(int[] numbers) throws IOException { for (int number : numbers) { out.write(number + " "); } } private static void printArray(long[] numbers) throws IOException { for (long number : numbers) { out.write(number + " "); } } static class FastReader { private static byte[] buf = new byte[1024]; private static int index; private static InputStream in; private static int total; public FastReader(InputStream in) { FastReader.in = in; } public static int scan() throws IOException { if (total < 0) throw new InputMismatchException(); if (index >= total) { index = 0; total = in.read(buf); if (total <= 0) return -1; } return buf[index++]; } public int nextInt() throws IOException { int integer = 0; int n = scan(); while (isWhiteSpace(n)) n = scan(); int neg = 1; if (n == '-') { neg = -1; n = scan(); } while (!isWhiteSpace(n)) { if (n >= '0' && n <= '9') { integer *= 10; integer += n - '0'; n = scan(); } else { throw new InputMismatchException(); } } return neg * integer; } public double nextDouble() throws IOException { return parseDouble(next()); } public double nextFloat() throws IOException { return parseFloat(next()); } public long nextLong() throws IOException { long integer = 0; long n = scan(); while (isWhiteSpace(n)) n = scan(); long neg = 1; if (n == '-') { neg = -1; n = scan(); } while (!isWhiteSpace(n)) { if (n >= '0' && n <= '9') { integer *= 10; integer += n - '0'; n = scan(); } else { throw new InputMismatchException(); } } return neg * integer; } public String next() throws IOException { StringBuilder sb = new StringBuilder(); int n = scan(); while (isWhiteSpace(n)) n = scan(); while (!isWhiteSpace(n)) { sb.append((char) n); n = scan(); } return sb.toString(); } public String nextLine() throws IOException { StringBuilder sb = new StringBuilder(); int n = scan(); while (isWhiteSpace(n)) n = scan(); while (!newLine(n)) { sb.append((char) n); n = scan(); } return sb.toString(); } private static boolean isWhiteSpace(long n) { return n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1; } private boolean newLine(long n) { return n == '\n' || n == -1; } } static void finish () throws IOException { out.flush(); out.close(); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
56396c4cdcd42d98f5d5335604bbfda4
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main{ static class FastScanner { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } int[] readArray(int n) { int[] a=new int[n]; for (int i=0; i<n; i++) a[i]=nextInt(); return a; } long nextLong() { return Long.parseLong(next()); } } static FastScanner in = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int t = in.nextInt(); while(t-- != 0){ int n = in.nextInt(); String s = in.next(); if(n != 5 || s.indexOf('i') == -1 || s.indexOf('T') == -1 || s.indexOf('m') == -1 || s.indexOf('u') == -1 || s.indexOf('r') == -1) out.println("NO"); else out.println("YES"); } out.close(); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ee99ba5ec476ce55cef962e9165c344a
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.HashMap; import java.util.*; import java.io.*; public class SpellCheck { public static void main(String[] args)throws Exception{ FastReader f=new FastReader(System.in); int t=f.nextInt(); while (t-->0){ int n=f.nextInt(); String s=f.nextString(); int[] ct=new int[5]; HashMap<Character, Integer> map=new HashMap<Character, Integer>(); map.put('T',0); map.put('i',1); map.put('m',2); map.put('u',3); map.put('r',4); boolean isCorrect=true; for (int i=0;i<n;i++){ char c=s.charAt(i); int pos=map.getOrDefault(c,-1); if (pos==-1){ isCorrect=false; break; } ct[pos]++; if (ct[pos]>1){ isCorrect=false; break; } } for (int i=0;i<5;i++){ if (ct[i]==0){ isCorrect=false; break; } } System.out.println(isCorrect?"YES":"NO"); //hi } } } class FastReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar; private int pnumChars; private FastReader.SpaceCharFilter filter; public FastReader(InputStream stream) { this.stream = stream; } public int read() { if (pnumChars == -1) { throw new InputMismatchException(); } if (curChar >= pnumChars) { curChar = 0; try { pnumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (pnumChars <= 0) { return -1; } } return buf[curChar++]; } public String next() { return nextString(); } public int nextInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c == ',') { c = read(); } if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public String nextString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
003c34a71e9ecb305af8b7080fb229df
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.HashMap; import java.util.*; import java.io.*; public class SpellCheck { public static void main(String[] args)throws Exception{ FastReader f=new FastReader(System.in); int t=f.nextInt(); while (t-->0){ int n=f.nextInt(); String s=f.nextString(); int[] ct=new int[5]; HashMap<Character, Integer> map=new HashMap<Character, Integer>(); map.put('T',0); map.put('i',1); map.put('m',2); map.put('u',3); map.put('r',4); boolean isCorrect=true; for (int i=0;i<n;i++){ char c=s.charAt(i); int pos=map.getOrDefault(c,-1); if (pos==-1){ isCorrect=false; break; } ct[pos]++; if (ct[pos]>1){ isCorrect=false; break; } } for (int i=0;i<5;i++){ if (ct[i]==0){ isCorrect=false; break; } } System.out.println(isCorrect?"YES":"NO"); } } } class FastReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar; private int pnumChars; private FastReader.SpaceCharFilter filter; public FastReader(InputStream stream) { this.stream = stream; } public int read() { if (pnumChars == -1) { throw new InputMismatchException(); } if (curChar >= pnumChars) { curChar = 0; try { pnumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (pnumChars <= 0) { return -1; } } return buf[curChar++]; } public String next() { return nextString(); } public int nextInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c == ',') { c = read(); } if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public String nextString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
611718819fd776ce3af88d84d9e31cdb
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.IOException; import java.io.Flushable; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Submit { public static void main(String[] args) { try (InputReader reader = new InputReader(); OutputWriter writer = new OutputWriter(true)) { char[] timurLetters = new char[] { 'T', 'i', 'm', 'r', 'u' }; int testCase = reader.nextInt(); for (int i = 0; i < testCase; i++) { int wordLength = reader.nextInt(); char[] wordToResolve = reader.nextLine().toCharArray(); if (wordLength != timurLetters.length) { writer.println("NO"); } else { Arrays.sort(wordToResolve); if(Arrays.hashCode(timurLetters) == Arrays.hashCode(wordToResolve)){ writer.println("YES"); } else { writer.println("NO"); } } } } } } class InputReader implements AutoCloseable { private BufferedReader bufferedReader; private StringTokenizer tokenizer; public InputReader() { bufferedReader = new BufferedReader(new InputStreamReader(System.in)); } public String next() { while (tokenizer == null || !tokenizer.hasMoreElements()) { try { tokenizer = new StringTokenizer(bufferedReader.readLine()); } catch (IOException ex) { ex.printStackTrace(); } } return tokenizer.nextToken(); } public char nextChar() { char character = ' '; try { character = (char) bufferedReader.read(); } catch (IOException e) { e.printStackTrace(); } return character; } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String nextLine() { String line = ""; try { line = bufferedReader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } return line; } @Override public void close() { try { this.bufferedReader.close(); } catch (IOException ex) { ex.printStackTrace(); } } } class OutputWriter implements AutoCloseable, Flushable { private final BufferedWriter writer; private boolean autoFlush; public OutputWriter() { this.writer = new BufferedWriter(new OutputStreamWriter(System.out)); } public OutputWriter(boolean autoFlush) { this(); this.autoFlush = autoFlush; } public void printWithSpace(int input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(int input) { try { writer.append(input + ""); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(int input) { try { writer.append(input + System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printWithSpace(String input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(String input) { try { writer.append(input); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(CharSequence input) { try { writer.append(input); writer.append(System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printArray() { // implement if (autoFlush) { flush(); } } @Override public void flush() { try { this.writer.flush(); } catch (IOException e) { e.printStackTrace(); } } @Override public void close() { try { writer.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
0afca4e88a7d0c85bc6d8fd027a2e8a9
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.IOException; import java.io.Flushable; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Submit { public static void main(String[] args) { try (InputReader reader = new InputReader(); OutputWriter writer = new OutputWriter(true)) { char[] timurLetters = new char[] { 'T', 'i', 'm', 'r', 'u' }; int testCase = reader.nextInt(); for (int i = 0; i < testCase; i++) { int wordLength = reader.nextInt(); char[] wordToResolve = reader.nextLine().toCharArray(); if (wordLength != timurLetters.length) { writer.println("NO"); } else { Arrays.sort(wordToResolve); if (Arrays.equals(timurLetters, wordToResolve)) { writer.println("YES"); } else { writer.println("NO"); } } } } } } class InputReader implements AutoCloseable { private BufferedReader bufferedReader; private StringTokenizer tokenizer; public InputReader() { bufferedReader = new BufferedReader(new InputStreamReader(System.in)); } public String next() { while (tokenizer == null || !tokenizer.hasMoreElements()) { try { tokenizer = new StringTokenizer(bufferedReader.readLine()); } catch (IOException ex) { ex.printStackTrace(); } } return tokenizer.nextToken(); } public char nextChar() { char character = ' '; try { character = (char) bufferedReader.read(); } catch (IOException e) { e.printStackTrace(); } return character; } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String nextLine() { String line = ""; try { line = bufferedReader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } return line; } @Override public void close() { try { this.bufferedReader.close(); } catch (IOException ex) { ex.printStackTrace(); } } } class OutputWriter implements AutoCloseable, Flushable { private final BufferedWriter writer; private boolean autoFlush; public OutputWriter() { this.writer = new BufferedWriter(new OutputStreamWriter(System.out)); } public OutputWriter(boolean autoFlush) { this(); this.autoFlush = autoFlush; } public void printWithSpace(int input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(int input) { try { writer.append(input + ""); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(int input) { try { writer.append(input + System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printWithSpace(String input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(String input) { try { writer.append(input); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(CharSequence input) { try { writer.append(input); writer.append(System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printArray() { // implement if (autoFlush) { flush(); } } @Override public void flush() { try { this.writer.flush(); } catch (IOException e) { e.printStackTrace(); } } @Override public void close() { try { writer.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e6ef24d58a84436af44ea523534d3b86
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.Flushable; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Submit { private static final String YES = "YES"; private static final String NO = "NO"; public static void main(String... strings) throws IOException { final char[] picus = {'T', 'i', 'm', 'r', 'u'}; // sorted try (InputReader reader = new InputReader(); OutputWriter writer = new OutputWriter(true)) { int t = reader.nextInt(); while (t-- > 0) { int length = reader.nextInt(); // unused char[] other = reader.nextLine().toCharArray(); if (other.length != picus.length) { writer.println(NO); } else { Arrays.sort(other); if (Arrays.equals(picus, other)) { writer.println(YES); } else { writer.println(NO); } } } } } } class InputReader implements AutoCloseable { private BufferedReader bufferedReader; private StringTokenizer tokenizer; public InputReader() { bufferedReader = new BufferedReader(new InputStreamReader(System.in)); } public String next() { while (tokenizer == null || !tokenizer.hasMoreElements()) { try { tokenizer = new StringTokenizer(bufferedReader.readLine()); } catch (IOException ex) { ex.printStackTrace(); } } return tokenizer.nextToken(); } public char nextChar() { char character = ' '; try { character = (char) bufferedReader.read(); } catch (IOException e) { e.printStackTrace(); } return character; } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String nextLine() { String line = ""; try { line = bufferedReader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } return line; } @Override public void close() { try { this.bufferedReader.close(); } catch (IOException ex) { ex.printStackTrace(); } } } class OutputWriter implements AutoCloseable, Flushable { private final BufferedWriter writer; private boolean autoFlush; public OutputWriter() { this.writer = new BufferedWriter(new OutputStreamWriter(System.out)); } public OutputWriter(boolean autoFlush) { this(); this.autoFlush = autoFlush; } public void printWithSpace(int input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(int input) { try { writer.append(input + ""); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(int input) { try { writer.append(input + System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printWithSpace(String input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(String input) { try { writer.append(input); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(CharSequence input) { try { writer.append(input); writer.append(System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printArray() { // implement if (autoFlush) { flush(); } } @Override public void flush() { try { this.writer.flush(); } catch (IOException e) { e.printStackTrace(); } } @Override public void close() { try { writer.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
eb743b6a360581a77905c516117d2347
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.Flushable; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Submit { private static final String YES = "YES"; private static final String NO = "NO"; public static void main(String... strings) throws IOException { final char[] picus = {'T', 'i', 'm', 'r', 'u'}; // sorted try (InputReader reader = new InputReader(); OutputWriter writer = new OutputWriter(true)) { int t = reader.nextInt(); while (t-- > 0) { int length = reader.nextInt(); // unused char[] other = reader.nextLine().toCharArray(); if (other.length != picus.length) { writer.println(NO); } else { Arrays.sort(other); if (Arrays.hashCode(picus) == Arrays.hashCode(other)) { writer.println(YES); } else { writer.println(NO); } } } } } } class InputReader implements AutoCloseable { private BufferedReader bufferedReader; private StringTokenizer tokenizer; public InputReader() { bufferedReader = new BufferedReader(new InputStreamReader(System.in)); } public String next() { while (tokenizer == null || !tokenizer.hasMoreElements()) { try { tokenizer = new StringTokenizer(bufferedReader.readLine()); } catch (IOException ex) { ex.printStackTrace(); } } return tokenizer.nextToken(); } public char nextChar() { char character = ' '; try { character = (char) bufferedReader.read(); } catch (IOException e) { e.printStackTrace(); } return character; } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String nextLine() { String line = ""; try { line = bufferedReader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } return line; } @Override public void close() { try { this.bufferedReader.close(); } catch (IOException ex) { ex.printStackTrace(); } } } class OutputWriter implements AutoCloseable, Flushable { private final BufferedWriter writer; private boolean autoFlush; public OutputWriter() { this.writer = new BufferedWriter(new OutputStreamWriter(System.out)); } public OutputWriter(boolean autoFlush) { this(); this.autoFlush = autoFlush; } public void printWithSpace(int input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(int input) { try { writer.append(input + ""); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(int input) { try { writer.append(input + System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printWithSpace(String input) { try { writer.append(input + " "); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void print(String input) { try { writer.append(input); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void println(CharSequence input) { try { writer.append(input); writer.append(System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } if (autoFlush) { flush(); } } public void printArray() { // implement if (autoFlush) { flush(); } } @Override public void flush() { try { this.writer.flush(); } catch (IOException e) { e.printStackTrace(); } } @Override public void close() { try { writer.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
cf9280cbdba45280b7feeb6403143b10
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class prog1 { static String solve(String str, int n) { Scanner sc = new Scanner(System.in); if(n!=5) { return "NO"; } HashSet<Character> hs = new HashSet<>(); char arr[] = new char[5]; arr[0] = 'T'; arr[1] = 'i'; arr[2] = 'm'; arr[3] = 'u'; arr[4] = 'r'; for(int i = 0;i<n;i++) { char ch = str.charAt(i); hs.add(ch); } if(hs.size()!=5) { return "NO"; } else { for(char ch :arr) { if(!hs.contains(ch)) { return "NO"; } } return "YES"; } } public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=1;i<=t;i++) { int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); String str = solve(s,n); System.out.println(str); } sc.close(); } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
99b6170b638a460ee5e43690b03ecea8
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String s=sc.next(); if(n==5 && s.contains("T")&&s.contains("i")&&s.contains("m")&&s.contains("u")&&s.contains("r")){ System.out.println("yes"); } else{ System.out.println("no"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e936879f5626d1644b2150dead7e9922
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String [] args){ int t , n ,c=0 , l=0; Scanner sc=new Scanner(System.in); t=sc.nextInt(); String s=""; String s1="Timur"; for(int i=0;i<t;i++){ n=sc.nextInt(); sc.nextLine(); s=sc.nextLine(); if(s.length()==s1.length()){ for(int j=0;j<5;j++){ char ch=s1.charAt(j); for(int k=0;k<n;k++){ if(ch==s.charAt(k)) c++; } if(c==1) l++; c=0; } if(l==5) System.out.println("Yes"); else System.out.println("No"); l=0; } else System.out.println("No"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ee6e306f6fbd347ce0d07a375a856303
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t; t=sc.nextInt(); while (t>0) { int n; n = sc.nextInt(); String s1, s2 = "Timur"; s1 = sc.next(); char so[] = s1.toCharArray(); Arrays.sort(so); String sn = new String(so); char so1[] = s2.toCharArray(); Arrays.sort(so1); String sn1 = new String(so1); if (sn.equals(sn1)) { System.out.println("YES"); } else { System.out.println("NO"); } t--; } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
bc5a10f2168d2c33d382ec76f9b8cc48
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class A { public static void main(String abs[]){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); char arr[] = {'T', 'i', 'm', 'u', 'r'}; while(t-- > 0){ int n = sc.nextInt(); String ln = sc.next(); if (n == 5) { boolean ans = true; boolean used[] = new boolean[5]; char[] line = ln.toCharArray(); for(int i = 0; i < n; i++){ char a = line[i]; boolean flag = false; for(int j = 0; j < n && !flag; j++){ if(a == arr[j] && !used[j]){ flag = true; used[j] = true; } } if(!flag){ ans = false; System.out.println("NO"); break; } } if(ans) System.out.println("YES"); } else System.out.println("NO"); } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e7f1475d7feed64ec536669af8b55afa
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.util.Scanner; public class codeforces { public static void main(String[] args) { try { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String str=sc.next(); int count=0; boolean k=true; if(n==5){ if(str.contains("m")==k && str.contains("u")==k && str.contains("r")==k && str.contains("T") && str.contains("i")==k){ System.out.println("YES"); } else{ System.out.println("NO"); } } else if(n!=0){ System.out.println("NO"); } } } catch (Exception e) { //TODO: handle exception } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
f50445bf69530b2e7abb1e4f99223575
train_109.jsonl
1661871000
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
256 megabytes
import java.lang.reflect.Array; import java.util.Arrays; import java.util.Scanner; public class ATeam231 { public static void main(String []args) { Scanner sc= new Scanner(System.in); int count=-1; String a="Timur"; char arr[]= a.toCharArray(); Arrays.sort(arr); int n=sc.nextInt(); for(int j=0; j<n; j++) { int g=sc.nextInt(); String f=sc.nextLine(); f=sc.nextLine(); char[]raa=f.toCharArray(); Arrays.sort(raa); if(arr.length==raa.length) { for(int i=0;i<arr.length;i++) { if(arr[i]!=raa[i]) { count=0; } else if(arr[i]=='T'){ count=1; } } if(count==1) { System.out.println("YES"); } else { System.out.println("NO"); } } else { System.out.println("NO"); } } } }
Java
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
1 second
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
null
Java 8
standard input
[ "implementation" ]
6c137a74b36dede61037cb3b05167329
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
800
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
adf302e26eae5fc01888c6012aad2365
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); byte t = Byte.parseByte(sc.nextLine()); String output = ""; for (byte i = 0; i < t; i++) { byte n = Byte.parseByte(sc.nextLine()); boolean check = true; String a = sc.nextLine().replace("B", "G"); String b = sc.nextLine().replace("B", "G"); for (int j = 0; j < n; j++) { if (a.charAt(j) == 'R') { if (b.charAt(j) != 'R') { check = false; break; } } else { if (b.charAt(j) != 'G') { check = false; break; } } } output += check ? "YES\n" : "NO\n"; } System.out.println(output); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
92fd06e7da6a37365ff4d09b048b2eb6
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t =sc.nextInt(); while(t-->0){ int n=sc.nextInt(); sc.nextLine(); String s=sc.nextLine(); String s1=sc.nextLine(); String ans=""; String ans1=""; for(int i=0;i<n;i++){ char cr=s.charAt(i); char tr=s1.charAt(i); if(cr=='G' || cr=='B'){ ans+="0"; }else{ ans+="1"; } if(tr=='G' || tr=='B'){ ans1+="0"; }else{ ans1+="1"; } } if(ans.equals(ans1)){ System.out.println("YES"); }else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
9994c0275c57ab3bfbf5c74992fc71cc
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Colourblindness{ void color() { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int n; for (int i = 0; i < t; i++) { n = 1; n = sc.nextInt(); int[] pos1 = new int[n]; int[] pos2 = new int[n]; String ln1 = sc.next(); String ln2 = sc.next(); for (int j = 0; j <= n - 1; j++) { if (ln1.charAt(j) == ('R')) { pos1[j] = 1; } else { pos1[j] = 0; } if (ln2.charAt(j) == ('R')) { pos2[j] = 1; } else { pos2[j] = 0; } } ln1 = ""; ln2 = ""; for (int ij = 0; ij <= n - 1; ij++) { ln1 += Integer.toString(pos1[ij]); ln2 += Integer.toString(pos2[ij]); } if (ln1.equals(ln2)) { System.out.println("yes"); } else { System.out.println("no"); } } sc.close(); } public static void main(String[] args) { new Colourblindness().color(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
57cbcdc2a27acaa7c0d4644f7b74d68c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; import java.util.*; public class CF1722B { public static String f(String s) { char arr[] = s.toCharArray(); for (int i = 0; i < s.length(); i++) if (arr[i] == 'G') arr[i] = 'B'; return new String(arr); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out)); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String s1 = f(new String(sc.next())); String s2 = f(new String(sc.next())); //pr.println(s1); //pr.println(s2); if (s1.compareTo(s2) == 0) pr.println("YES"); else pr.println("NO"); } sc.close(); pr.flush(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
8a01d5589315445575a4a891311471a0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=1;i<=t;i++) { int n=sc.nextInt(); sc.nextLine(); String s1=sc.next(); sc.nextLine(); String s2=sc.next(); if(s1.length()==n && s2.length()==n){ String s3=s1.replace('B','G'); String s4=s2.replace('B','G'); if(s3.equals(s4)) System.out.println("YES"); else System.out.println("NO"); } else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
0212ff09f42de83aaac029204da0366b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Colourblindness { public static void main(String[] args) { int t; Scanner in = new Scanner(System.in); t = in.nextInt(); String[] result = new String[t]; for(int i=0; i<t; i++){ int n,temp=0, r1=0, g1=0, b1=0 , r2=0, g2=0, b2=0; n = in.nextInt(); in.nextLine(); String c1 = new String(); String c2 = new String(); c1= in.nextLine(); c2= in.nextLine(); for(int j=0; j<n; j++){ if(c1.charAt(j)=='R'){ r1++; } else if(c1.charAt(j)=='G'){ g1++; } else{ b1++; } } for(int j=0; j<n; j++){ if(c2.charAt(j)=='R'){ r2++; } else if(c2.charAt(j)=='G'){ g2++; } else{ b2++; } } if(r1==r2 && r1!=0){ for(int j=0; j<n; j++){ if(c1.charAt(j)=='R' && c2.charAt(j)=='R'){ temp++; } } if(temp==r1){ result[i]="YES"; } else{ result[i]="NO"; } } else if(r1==r2 && r1==0){ result[i]="YES"; } else{ result[i]="NO"; } } for(int i=0; i<t; i++){ System.out.println(result[i]); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d857066a0aea0b002e37352a5762fdfc
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class ColorBlindness { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cases = sc.nextInt(); for(int i =0; i<cases; i++){ int letters = sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); System.out.println(sol(letters,s1,s2)); } } public static String sol(int letters, String s1, String s2){ Scanner sc = new Scanner(System.in); // int letters = sc.nextInt(); // char[] s1 = new char[letters]; // char[] s2 = new char[letters]; char[] s1Char = s1.toCharArray(); char[] s2Char = s2.toCharArray(); for(int j = 0; j<letters; j++){ if((s1Char[j] == 'R' && s2Char[j] != 'R')||(s1Char[j] != 'R' && s2Char[j] == 'R')) return "No"; } return "YES"; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
42033437218fa7fa624c98c564904171
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner input =new Scanner(System.in); Set set = new HashSet(); ArrayList<Integer> arr = new ArrayList<Integer>(); int narr [] = new int[100000]; int t =input.nextInt(); while(t!=0){ boolean result =true; int c =input.nextInt(); String s =input.next(); String s1 =input.next(); for (int i=0;i<c;i++){ if (s.charAt(i)=='R'&&s1.charAt(i)!='R'){ result =false; } else if (s1.charAt(i)=='R'&&s.charAt(i)!='R'){ result =false; } } if (result ==true){ System.out.println("YES"); }else{ System.out.println("NO"); } t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6dd8781e9fef86dfe8907de54f902224
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Peter has a grid with 2 rows and n columns. He colours each cell red, green, or blue. * * Peter is colourblind and can't distinguish green from blue. * Determine if Peter will consider the two rows of the grid to be coloured the same. */ public class Colourblindness { private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int testCases = Integer.parseInt(reader.readLine()); for (int i = 0; i < testCases; i++) { checkRows(); } } private static void checkRows() throws IOException { int columns = Integer.parseInt(reader.readLine()); String firstRow = reader.readLine(); String secondRow = reader.readLine(); for (int j = 0; j < columns; j++) { if ((firstRow.charAt(j) == 'R' && secondRow.charAt(j) != 'R') || (firstRow.charAt(j) != 'R' && secondRow.charAt(j) == 'R')) { System.out.println("No"); return; } } System.out.println("Yes"); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c8e60b313b6b0ad02bb9e968214c2098
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Peter has a grid with 2 rows and n columns. He colours each cell red, green, or blue. * * Peter is colourblind and can't distinguish green from blue. * Determine if Peter will consider the two rows of the grid to be coloured the same. */ public class Colourblindness { private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int testCases = Integer.parseInt(reader.readLine()); for (int i = 0; i < testCases; i++) { checkRows(); } } private static void checkRows() throws IOException { int columns = Integer.parseInt(reader.readLine()); String firstRow = reader.readLine(); String secondRow = reader.readLine(); for (int j = 0; j < columns; j++) { if ((firstRow.charAt(j) == 'R' && secondRow.charAt(j) != 'R') || (firstRow.charAt(j) != 'R' && secondRow.charAt(j) == 'R')) { System.out.println("No"); return; } } System.out.println("Yes"); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
13fd71a5a4288a4e9230cb7ace9c53ba
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; /** * Peter has a grid with 2 rows and n columns. He colours each cell red, green, or blue. * * Peter is colourblind and can't distinguish green from blue. * Determine if Peter will consider the two rows of the grid to be coloured the same. */ public class Colourblindness { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int testCases = scanner.nextInt(); for (int i = 0; i < testCases; i++) { checkRows(); } } private static void checkRows() { int columns = scanner.nextInt(); String firstRow = scanner.next(); String secondRow = scanner.next(); for (int j = 0; j < columns; j++) { if ((firstRow.charAt(j) == 'R' && secondRow.charAt(j) != 'R') || (firstRow.charAt(j) != 'R' && secondRow.charAt(j) == 'R')) { System.out.println("No"); return; } } System.out.println("Yes"); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3da426638464721435488edc0ed918aa
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String s1=sc.next(); String s2=sc.next(); int c=0; for(int i=0;i<n;i++){ if(s1.charAt(i)==s2.charAt(i) || (s1.charAt(i)=='G' && s2.charAt(i)=='B') || (s1.charAt(i)=='B' && s2.charAt(i)=='G')) { c++; } } if(c==s1.length()){ System.out.println("Yes"); }else{ System.out.println("No"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
9bbe750bf0a81483301ce94c5169c5fd
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
///WizardAP - 当你休息的时候,很多人比你付出更多的努力!不放弃 ! /// Time : 2022-10-12, Wed, 12:27 import java.io.*; import java.util.*; import static java.lang.Double.parseDouble; import static java.lang.System.in; import static java.lang.System.out; public class B { static final int MOD = (int) 1e9 + 7; public static void main(String[] args) throws Exception { FastIO io = new FastIO(); int t = io.nextInt(); while(t-- >0) { int n = io.nextInt(); String s = io.next(); char a[] = s.toCharArray(); s=io.next(); char b[] = s.toCharArray(); boolean ok =true; for (int i =0 ; i<n;i++) if (a[i] !=b[i] && ( a[i] == 'R' || b[i] == 'R')) { ok = false; break; } System.out.println(ok ? "YES": "NO"); } io.close(); } } //BeginCodeSnip{FastIO} class FastIO extends PrintWriter { private InputStream stream; private byte[] buf = new byte[1 << 16]; private int curChar; private int numChars; // standard input public FastIO() { this(in, System.out); } public FastIO(InputStream i, OutputStream o) { super(o); stream = i; } // file input public FastIO(String i, String o) throws IOException { super(new FileWriter(o)); stream = new FileInputStream(i); } // throws InputMismatchException() if previously detected end of file private int nextByte() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars == -1) { return -1; // end of file } } return buf[curChar++]; } // to read in entire lines, replace c <= ' ' // with a function that checks whether c is a line break public String next() { int c; do { c = nextByte(); } while (c <= ' '); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = nextByte(); } while (c > ' '); return res.toString(); } public int nextInt() { // nextLong() would be implemented similarly int c; do { c = nextByte(); } while (c <= ' '); int sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res = 10 * res + c - '0'; c = nextByte(); } while (c > ' '); return res * sgn; } public double nextDouble() { return parseDouble(next()); } } //EndCodeSnip
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
61cb30b0bbcf0b3f2a9a458fe531d62b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Tr { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-->0) { int n = in.nextInt(); String s1 = in.next(); String s2 = in.next(); int flag=1; for(int i=0;i<n;i++) { if(((s1.charAt(i)=='R') && (s2.charAt(i)!='R')) || ((s1.charAt(i)!='R') && (s2.charAt(i)=='R'))) { flag=0; break; } } if(flag==1) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
592fdaa925808bbf0726a19458c3b56f
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class cls{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int l=sc.nextInt(); String garb=sc.nextLine(); String a=sc.nextLine(); String b=sc.nextLine(); int flag=0; for(int i=0;i<l;i++){ if(a.charAt(i)=='R' || b.charAt(i)=='R'){ if(a.charAt(i)=='R' && b.charAt(i)=='R'){ continue; } else{ flag=1; System.out.println("NO"); break; } } } if(flag==0){ System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
4e7c858cedc3a7ef4afb225d85ddcffb
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *******************************************************************************/ import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int j=0;j<t;j++){ int n=sc.nextInt(); String s=sc.next(); String s1=sc.next(); int f=0; for(int i=0;i<n;i++){ if(s.charAt(i)=='R'&&s1.charAt(i)=='B'){ f=1; } else if(s.charAt(i)=='B'&&s1.charAt(i)=='R'){ f=1; } else if(s.charAt(i)=='G'&&s1.charAt(i)=='R'){ f=1; } else if(s.charAt(i)=='R'&&s1.charAt(i)=='G'){ f=1; } } if(f==1){ System.out.println("NO"); } else{ System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
356e72005efbb787e7f8707ccc8e08d1
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { //BufferedReader buf = new BufferedReader(new FileReader("input/Colourblindness/input.txt")); BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); int testCases = Integer.parseInt(buf.readLine()); for (int i = 0; i < testCases; i++) { int numberOfColumns = Integer.parseInt(buf.readLine()); String firstRow = buf.readLine(); String secondRow = buf.readLine(); boolean diff = false; for (int c = 0; c < numberOfColumns; c++) { if ((firstRow.charAt(c) == 'R' && secondRow.charAt(c) != 'R') || (firstRow.charAt(c) != 'R' && secondRow.charAt(c) == 'R')) { diff = true; System.out.println("NO"); break; } } if (!diff) { System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d2dad82cfc85f15eebb9533b6d0b90c5
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { //BufferedReader buf = new BufferedReader(new FileReader("input/Colourblindness/input.txt")); BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); int testCases = Integer.parseInt(buf.readLine()); for (int i = 0; i < testCases; i++) { int numberOfColumns = Integer.parseInt(buf.readLine()); String firstRow = buf.readLine(); String secondRow = buf.readLine(); boolean diff = false; for (int c = 0; c < numberOfColumns; c++) { if ((firstRow.charAt(c) == 'R' && secondRow.charAt(c) != 'R') || (firstRow.charAt(c) != 'R' && secondRow.charAt(c) == 'R')) { diff = true; break; } } if (diff) { System.out.println("NO"); } else { System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
45d956d1cd2e07ed034446dd02ec1cda
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class test2 { public static void main(String args[]) { Scanner in = new Scanner(System.in); String st1="",st2=""; int t,n,i,c=0,l1,l2;char ch1,ch2; t=in.nextInt(); while(t!=0) { n=in.nextInt(); st1=in.next(); l1=st1.length(); st2=in.next(); l2=st2.length(); if(l1==l2&&l1==n) { for(i=0;i<l1;i++) { ch1=st1.charAt(i); ch2=st2.charAt(i); if(ch1=='R') { if(ch2=='R') c++; } if(ch1=='B') { if(ch2=='G'||ch2=='B') c++; } if(ch1=='G') { if(ch2=='B'||ch2=='G') c++; } }if(c==l1) System.out.println("YES"); else System.out.println("NO"); c=0; t--;} else System.out.println("NO"); }in.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e3782778f35ebdc98c2a98bf1b00c909
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class rough { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); boolean flag=true; for(int j=0;j<n;j++) { if((s1.charAt(j)=='R' && s2.charAt(j)=='R') || (s1.charAt(j)=='G' && s2.charAt(j)=='G') || (s1.charAt(j)=='B' && s2.charAt(j)=='B') || (s1.charAt(j)=='G' && s2.charAt(j)=='B')||(s1.charAt(j)=='B' && s2.charAt(j)=='G')) { continue; } else { flag=false; break; } } if(flag==true) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d81407b97d37b3e717a1b6b5880f183f
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//package project1; import java.util.Scanner; public class Problem2 { public static void main(String args[]) { Scanner Sc=new Scanner(System.in); int n=0; String R1=""; String R2=""; int t=0; boolean flag=false; t=Sc.nextInt(); while (t>0) { n=Sc.nextInt(); R1=Sc.next(); R2=Sc.next(); for(int i=0;i<n;i++){ if (R1.charAt(i)=='R' && R2.charAt(i)!='R') { flag=true; break; } if (R1.charAt(i)!='R' && R2.charAt(i)=='R') { flag=true; break; } } if(!flag) { System.out.println("YES"); } else { System.out.println("NO"); } flag=false; --t; } Sc.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ef3139e6b09cfb99fde5c5e88cf4c3eb
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class colour { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0) { int n = sc.nextInt(); String s1= sc.next(); String s2= sc.next(); int count=0; for(int i=0;i<n;i++) { if((s1.charAt(i) == s2.charAt(i) ) || (s1.charAt(i) =='G' && s2.charAt(i)== 'B') || (s1.charAt(i) =='B' && s2.charAt(i)== 'G')) { count++; } } if(count==n) { System.out.println("YES"); } else { System.out.println("NO"); } t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
19cc9194092c37dd6acb23305f31709a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scn=new Scanner(System.in); int t=scn.nextInt(); while(t-->0){ int n=scn.nextInt(); String[] ch=new String[2]; for(int i=0;i<2;i++){ ch[i]=scn.next(); } boolean flag=true; for(int i=0;i<n;i++){ if(ch[0].charAt(i)==ch[1].charAt(i)&&ch[0].charAt(i)=='R'){ continue; } else if(ch[0].charAt(i)!=ch[1].charAt(i)&&ch[0].charAt(i)!='R'&&ch[1].charAt(i)!='R'){ continue; } else if(ch[0].charAt(i)==ch[1].charAt(i)&&(ch[0].charAt(i)=='G'||ch[0].charAt(i)=='B'))continue; flag=false; } if(flag){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
9a1f111a9f67e18482d648d8bae0aa1a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Solution{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); int cnt = 0; for (int i = 0; i < n; i++) { char c1 = s1.charAt(i), c2 = s2.charAt(i); if (c1 == c2 || (c1 == 'G' && c2 == 'B') || (c1 == 'B' && c2 == 'G')) cnt++; } if (cnt == n) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
cc7c0be95292bea8936ea4e905b45456
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int j=0;j<t;j++) { int n=sc.nextInt(); String s=sc.next(); String s1=sc.next(); int count=0; char d='F'; for(int i=0;i<n;i++) { if(s.charAt(i)=='G'||s.charAt(i)=='B') { s=s.substring(0,i)+d+s.substring(i+1); } } for(int i=0;i<n;i++) { if(s1.charAt(i)=='G'||s1.charAt(i)=='B') { s1=s1.substring(0,i)+d+s1.substring(i+1); } } for(int i=0;i<n;i++) { if(s.charAt(i)==s1.charAt(i)) { count=count+1; } } if(count==n) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
001af64fd1b148c18095d3f877b3b9ef
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while(t>0){ int n = scanner.nextInt(); scanner.nextLine(); String s1 = scanner.nextLine(); String s2 = scanner.nextLine(); char[] s_1 = s1.toCharArray(); char[] s_2 = s2.toCharArray(); for(int i=0;i<n;i++){ if(s_1[i]=='G'){ s_1[i]='B'; } if(s_2[i]=='G'){ s_2[i]= 'B'; } } String finals1 = new String(s_1); String finals2 = new String(s_2); //System.out.println(finals1); if(finals1.equals(finals2)){ System.out.println("YES"); }else{ System.out.println("NO"); } t--; } scanner.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
fcde25149e6e1a3fe19db21f030efbc1
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; public class Colorblind { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int tests = Integer.parseInt(reader.readLine()); for (int i = 0; i < tests; i++) { int n = Integer.parseInt(reader.readLine()); String s1 = reader.readLine(); String s2 = reader.readLine();; boolean no = false; for (int j = 0; j < n; j++) { if (s1.charAt(j) == 'R') { if (s2.charAt(j) != 'R') { System.out.println("NO"); no = true; break; } } if (s2.charAt(j) == 'R') { if (s1.charAt(j) != 'R') { System.out.println("NO"); no = true; break; } } } if (!no) System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ae3db337411f6c9c065cf8da2f43cc3c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class RGB { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String a = sc.next(); String b = sc.next(); boolean ok = true; for (int i = 0; i < n; i++) { if((a.charAt(i) == 'R' && b.charAt(i) != 'R') || (a.charAt(i) != 'R' && b.charAt(i) == 'R')) ok = false; } System.out.println(ok? "YES" : "NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
396ac1633445a31e55a1219975be8903
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class rgb_dalt { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); String a = sc.next(); String b = sc.next(); String res1 = ""; String res2 = ""; for (int i = 0; i < n; i++) { if (a.charAt(i) == 'G') res1 += "G"; else if(a.charAt(i) == 'B') res1 += "G"; else res1 += "R"; if (b.charAt(i) == 'G') res2 += "G"; else if(b.charAt(i) == 'B') res2 += "G"; else res2 += "R"; } if(res1.equals(res2)) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
be3ac695c22514e61b0efaf81025d4fa
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class B { public static Scanner in = new Scanner(System.in); public static void solve() { int n = in.nextInt(); in.nextLine(); String l1 = in.nextLine().replace('G', 'B'); String l2 = in.nextLine().replace('G', 'B'); if (l1.equals(l2)) { System.out.println("YES"); } else { System.out.println("NO"); } } public static void main(String[] args) { int t = in.nextInt(); in.nextLine(); while(t > 0) { solve(); t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6606ff6114e1bec9a52caa21f157a02c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; public class Main { private void solution() { int t = readInt(); while (t-- != 0) { int n = readInt(); char[] firstRaw = readCharArray(), secondRaw = readCharArray(); boolean flag = true; for (int i = 0; i < n; ++i) { if (!((firstRaw[i] == secondRaw[i]) || (firstRaw[i] == 'G' && secondRaw[i] == 'B') || (firstRaw[i] == 'B' && secondRaw[i] == 'G'))) { flag = false; break; } } out.println(flag ? "YES" : "NO"); } } private double readDouble() { return Double.parseDouble(readString()); } private float readFloat() { return Float.parseFloat(readString()); } private long readLong() { return Long.parseLong(readString()); } private int readInt() { return Integer.parseInt(readString()); } private char[] readCharArray() { return readString().toCharArray(); } private String readString() { while (!tok.hasMoreTokens()) { String nextLine = readLine(); if (nextLine == null) return null; tok = new StringTokenizer(nextLine); } return tok.nextToken(); } private String readLine() { try { return in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } private void initFileIO(String inputFileName, String outputFileName) throws FileNotFoundException { in = new BufferedReader(new FileReader(inputFileName)); out = new PrintWriter(outputFileName); } private void initConsoleIO() { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } private void initIO() throws IOException { String fileName = ""; if (!fileName.isEmpty()) { initFileIO(fileName + ".in", fileName + ".out"); } else { if (new File("input.txt").exists()) { initFileIO("input.txt", "output.txt"); } else { initConsoleIO(); } } tok = new StringTokenizer(""); } BufferedReader in; PrintWriter out; StringTokenizer tok; public void start() throws IOException { long timeStart = System.currentTimeMillis(); initIO(); solution(); long timeEnd = System.currentTimeMillis(); // System.err.println("Finished in: " + (timeEnd - timeStart) + " (ms)"); out.close(); } @Override public String toString() { return "Data"; } public static void main(String[] args) throws IOException { new Main().start(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
b5bdb4c727bc40dcd9118053bfdc955c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class B1722{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); sc.nextLine(); String s1 = sc.nextLine(); String s2 = sc.nextLine(); boolean flag = true; for (int i = 0; i < n; i++) { if (s1.charAt(i) == 'R' && s2.charAt(i) != 'R' || s1.charAt(i) != 'R' && s2.charAt(i) == 'R') flag = false; } System.out.println(flag ? "YES" : "NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
7c9d2583f276781531e31667fc6e66d8
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/** * B_Colourblindness */ import java.util.*; public class B_Colourblindness { public static void main(String[] args) { Scanner inp = new Scanner(System.in); int t = inp.nextInt(); while(t-- > 0){ int n =inp.nextInt(); String S1 = inp.next(); String S2 = inp.next(); Boolean get = true; for(int i=0;i<n;i++){ if((S1.charAt(i)=='R' && S2.charAt(i)!='R') || (S1.charAt(i)!='R' && S2.charAt(i)=='R')){ get = false; break; } } // for(int i=0;i<S2.length();i++){ // if(S2.charAt(i)=='R'){ // countR2++; // } // } if(get){ System.out.println("YES"); } else{ System.out.println("NO"); } } inp.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
f65041a93bf21be80d3dbd469d7a3d4c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; import java.util.*; public class S { public static int[][] arr; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); out:for (int i=0;i<t;i++){ int n = Integer.parseInt(br.readLine()); arr=new int[2][n]; for (int j=0;j<2;j++){ String s = br.readLine(); for (int k=0;k<n;k++){ if (s.charAt(k)=='R'){ arr[j][k]=0; }else{ arr[j][k]=1; } } } for (int a=0;a<n;a++){ if (arr[0][a]!=arr[1][a]){ System.out.println("NO"); continue out; } } System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
75a85fcac66f67b3acfded2c8f1f1f26
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//package com.company; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-- > 0){ int num = in.nextInt(); int count = 0; in.nextLine(); String s1 = in.nextLine(); String s2 = in.nextLine(); for (int i = 0; i < num; i++) { if(s1.charAt(i) == 'R' && s2.charAt(i)== 'R'){ count++; }else if((s1.charAt(i) == 'B' && s2.charAt(i)== 'B') || (s1.charAt(i) == 'G' && s2.charAt(i)== 'G')){ count++; }else if((s1.charAt(i) == 'B' && s2.charAt(i)== 'G') || (s1.charAt(i) == 'G' && s2.charAt(i)== 'B')){ count++; } } if(count == num){ System.out.println("YES"); }else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c3405db6a2226e794027ba75e5dd95a8
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.PriorityQueue; import java.util.Queue; import java.util.Scanner; public class MyClass { static Scanner in = new Scanner(System.in); public static void printArray(int[] arr) { for(int i=0; i<arr.length; i++) { System.out.print(arr[i] + " "); } } public static void printArray(String[] arr) { for(int i=0; i<arr.length; i++) { System.out.println(arr[i]); } } public static void minimumVariedNumber() { int t = in.nextInt(); int[] cases = new int[t]; for(int i=0; i<t; i++) { cases[i] = in.nextInt(); } int[] res = new int[t]; for(int i=0; i<t; i++) { int num = cases[i]; int k = 1; if(num/10 == 0) { res[i] = num; continue; } int temp = num; for(int j=9; j>0; j--) { if(temp>=j) { temp = temp - j; res[i] = res[i] + j*k; k*=10; } } } printArray(res); } public static boolean allOpen(int x, int[] doors) { int t = x -1; int count = 1; while(doors[t]!=0) { t = doors[t] - 1; count++; } if(count != 3) return false; else return true; } public static void threeDoors() { int t = in.nextInt(); String[] res = new String[t]; int[] doors = new int[3]; for(int i=0; i<t; i++) { int x = in.nextInt(); for(int j=0; j<3; j++) { doors[j] = in.nextInt(); } if(allOpen(x,doors)) { res[i] = "YES"; } else { res[i] = "NO"; } } printArray(res); } public static void swap(int[] arr, int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } public static void sortAsc(int[] arr) { int n = arr.length; for(int i=0; i<n-1; i++) { for(int j=i+1; j<n; j++) { if(arr[i] > arr[j]) { swap(arr, i, j); } } } } public static PriorityQueue<Integer> generateNew(PriorityQueue<Integer> pq) { PriorityQueue<Integer> new_pq = new PriorityQueue<Integer>(); int a = 0; int b = 0; while(pq.size()!=new_pq.size() || (pq.size() != 1 && new_pq.size() != 1)) { if(pq.size() == 1) { pq.clear(); PriorityQueue<Integer> tmp = pq; pq = new_pq; new_pq = tmp; } a = pq.poll(); b = pq.peek(); new_pq.add(b-a); } return new_pq; } public static void differenceArray() { int t = 1; //int t = in.nextInt(); int res[] = new int[t]; for(int i=0; i<t; i++) { int n = 100000; //int n = in.nextInt(); PriorityQueue<Integer> pq = new PriorityQueue<Integer>(); for(int j=0; j<n; j++) { //pq.add(in.nextInt()); pq.add(0); } pq = generateNew(pq); res[i] = pq.poll(); } printArray(res); } /*public static void wordGame() { int t = in.nextInt(); HashMap<String, Par> mapa = new HashMap<String, Par>(); for(int test = 0; test < t; test++) { int n = in.nextInt(); for(int i=0; i<3; i++) { for(int j=0; j<n; j++) { String rijec = in.next(); if(mapa.containsKey(rijec)) { mapa.get(rijec).dodajIgraca(i); } else { Par p = new Par(i); mapa.put(rijec, p); } } } int ukupni_bodovi[] = new int[3]; for(Map.Entry<String, Par> entry: mapa.entrySet()) { for(int i=0; i<3; i++) { ukupni_bodovi[i] += entry.getValue().getBodovi()[i]; } } printArray(ukupni_bodovi); System.out.println(); mapa.clear(); } } */ public static void colourBlindness() { int t = in.nextInt(); for(int test = 0; test < t; test++) { int n = in.nextInt(); String arr[] = new String[2]; for(int i=0; i<2; i++) { arr[i] = in.next(); } boolean identical = true; char tmp1[] = arr[0].toCharArray(); char tmp2[] = arr[1].toCharArray(); for(int i=0; i<n; i++) { if(tmp1[i] != tmp2[i] && (tmp1[i] == 'R' || tmp2[i] == 'R')) { identical = false; } } if(identical == true) System.out.println("yes"); else System.out.println("no"); } } public static void main(String[] args) { // TODO Auto-generated method stub //minimumVariedNumber(); //threeDoors(); //wordGame(); colourBlindness(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
b844d3c6391f4500afa2837da9ef816c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Maqin{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); int count= 0; for(int i = 0; i < n ;i++){ if(s2.charAt(i) == 'R' && s1.charAt(i) == 'R'){ count++; } else if((s1.charAt(i) == 'B' || s1.charAt(i)=='G') && (s2.charAt(i) == 'B' || s2.charAt(i) == 'G')){ count++; } } if(count== n){ System.out.println("YES"); }else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ba9ea37ebfbafbfc124a787449458861
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int nn; nn = scan.nextInt(); while(nn > 0) { int n = scan.nextInt(); scan.nextLine(); String a = scan.nextLine(); String b = scan.nextLine(); char arr_1[] = a.toCharArray(); char arr_2[] = b.toCharArray(); for (int i = 0; i < n; i++) { if (arr_1[i] == 'B') { arr_1[i] = 'G'; } if (arr_2[i] == 'B') { arr_2[i] = 'G'; } } boolean flag = true; for (int i = 0 ; i < n; i ++) { if (arr_1[i] != arr_2[i]) { System.out.println("NO"); flag = false; break; } } if (flag == true) { System.out.println("YES"); } nn--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
722d89994c4b2734588c3970c70c23d3
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while (t > 0) { int n = input.nextInt(); String s1 = input.next(); String s2 = input.next(); s1 = s1.replaceAll("G", "."); s1 = s1.replaceAll("B", "."); s2 = s2.replaceAll("G", "."); s2 = s2.replaceAll("B", "."); if (s1.equals(s2)) { System.out.println("YES"); } else { System.out.println("NO"); } t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ed4ab4899f617fa568226035fcf3d2e0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Problem1722b { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-->0){ int col = sc.nextInt(); String s = sc.next(); String s1 = sc.next(); char[] c = s.toCharArray(); boolean b = false; char [] c1 = s1.toCharArray(); for(int i = 0 ; i<col;i++){ if(c[i] == c1[i] || (c[i] == 'G'&& c1[i] == 'B')|| (c[i] == 'B'&& c1[i] == 'G')){ b = true; }else{ b = false; break; } } if(b){ System.out.println("Yes"); }else{ System.out.println("No"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
86a70ab0ab8f6f80a0d48217fd3daee8
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Problem1722b { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-->0){ int col = sc.nextInt(); String s = sc.next(); String s1 = sc.next(); char[] c = s.toCharArray(); boolean b = false; char [] c1 = s1.toCharArray(); for(int i = 0 ; i<col;i++){ if(c[i] == c1[i] || (c[i] == 'G'&& c1[i] == 'B')|| (c[i] == 'B'&& c1[i] == 'G')){ b = true; }else{ b = false; break; } } if(b){ System.out.println("Yes"); }else{ System.out.println("No"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
38062ea1b39197e3a77e8472a3628094
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class CodeForces { public static void main(String[] args) { Scanner scn=new Scanner(System.in); int t=scn.nextInt(); StringBuilder sb=new StringBuilder(); while(t-->0) { int n=scn.nextInt(); String up=scn.next(); String down=scn.next(); up=up.replace('G','B'); down=down.replace('G','B'); //sb.append(up+" "+down+"\n"); if(up.equals(down)) sb.append("YES\n"); else sb.append("NO\n"); } System.out.print(sb); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
db7f68b6cc1ac3fd290125604052b521
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class CodeForces { public static void main(String[] args) { Scanner scn=new Scanner(System.in); ////// int t=Integer.parseInt(scn.nextLine()); //int t=1; while(t-->0) { int n=scn.nextInt(); String one=scn.next(); String two=scn.next(); boolean flag=true; for(int i=0;i<n;i++) { char ch1=one.charAt(i); char ch2=two.charAt(i); if(ch1==ch2 || (ch1=='G'&&ch2=='B') || (ch2=='G'&&ch1=='B')) continue; else {System.out.println("NO");flag=false;break;} } if(flag) System.out.println("YES"); } ////// } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
f99a3bfb15bb9c1d0e8794879dd0d292
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t > 0){ int n = sc.nextInt(); sc.nextLine(); String s1 = sc.nextLine(); String s2 = sc.nextLine(); Boolean c = true; for(int i = 0; i < n; i++){ if(s1.charAt(i) != s2.charAt(i)){ if(s1.charAt(i) == 'G' && s2.charAt(i) == 'B'){ continue; } else if(s1.charAt(i) == 'B' && s2.charAt(i) == 'G'){ continue; } else{ c = false; break; } } } if(c){ System.out.println("YES"); } else{ System.out.println("NO"); } t --; } sc.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
7d39fc07b9fc2e41a98fac6fc4fca55f
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { final private static FastReader reader = new FastReader(); final private static PrintWriter writer = new PrintWriter(System.out); public static void main(String[] args) { //solveTestCase(); runTestCases(false); writer.flush(); } public static void solveTestCase() { final String yes = "YES", no = "NO"; int n = reader.nextInt(); String rowOne = reader.nextLine(); String rowTwo = reader.nextLine(); boolean answer = true; for (int i = 0; i < n; i++) { if((rowOne.charAt(i) == 'R') ^ (rowTwo.charAt(i) == 'R')) { answer = false; break; } } writer.println(answer ? yes : no); } private static void runTestCases(boolean forGoogle) { int T = reader.nextInt(); final String cases = "Case #"; final String colon = ": "; for (int _t = 0; _t < T; _t++){ if(forGoogle) { writer.print(cases); writer.print(_t); writer.print(colon); } solveTestCase(); } } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { if(st.hasMoreTokens()){ str = st.nextToken("\n"); } else { str = br.readLine(); } } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6e95f2b3ece900349705f0df68a40824
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class B { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(infile.readLine()); int T = Integer.parseInt(st.nextToken()); StringBuilder sb = new StringBuilder(); while(T-- > 0) { st = new StringTokenizer(infile.readLine()); int N = Integer.parseInt(st.nextToken()); // int[] arr = readArr(N, infile, st); st = new StringTokenizer(infile.readLine()); String first = new String(st.nextToken()); st = new StringTokenizer(infile.readLine()); String second = new String(st.nextToken()); boolean flag = true; for (int i = 0; i < N; i++) { if ((first.charAt(i) == 'R' || second.charAt(i) == 'R') && first.charAt(i) != second.charAt(i)) { flag = false; } } if (flag == true) { out.println("YES"); } else { out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 17
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output