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
5056adca2d25519d97e726e9836af8b6
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Magnets { public static void main(String[] args) { Scanner in = new Scanner(System.in); int magnets = Integer.parseInt(in.nextLine()), groups = 1; String[] magnetArray = new String[magnets]; for(int i = 0; i < magnetArray.length; i++) { ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
85667c29c44a1b29b8335b132cce4de6
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Magnets { public static void main(String args[]) throws IOException { Scanner in = new Scanner(System.in); int n = in.nextInt(); int magnets[] = new int[n]; for (int i = 0; i < n; i++) { magnets[...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
0bd30ac00849ca7d4a33878e380b33b4
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String[] arr = new String[n]; int s = 0; scan.nextLine(); if(n==1){ System.out.println("1"); } else{ for(int i=0;i...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
94ea5b696a6da0d85ed39ec61a754e77
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Codeforces344A_Mock { public static void main(String args[]) { Scanner input = new Scanner(System.in); int n = input.nextInt(); input.nextLine(); int count = 0; int i; char orient2 = input.nextLine().charAt(0); char orient; for (i = 1; i < n; i++) { orient = o...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
8dbd0d267e9bcc9b4b275135287e5449
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class intInput { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) { a[i] = in.nextInt(); } int y = 1; for(int i = ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
9c4583d5bc91f0a016a3790d3dcb2157
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //http://codeforces.com/problemset/problem/344/A public class Problem344A { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
e73941f0c64434798844699775cf6588
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int m = sc.nextInt(); String a[] = new String[m]; for (int i = 0; i < m; i++) { a[i] = sc.next(); } int count =1; for (in...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
62205513cb181289504a29b1095fc1b2
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; public class A { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int res = 1; int cur = scanner.nextInt(); for(int i =0;i<n-1;i++){ int curtemp = scanner.nextInt(); if(cur != curtemp){ res++; ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
1610fc78e07e88a57a975ea422c5d129
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; /** * * @author GTS */ public class GirlsAndBoys { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner in=new Scanner(System.in); int num=in.nextInt(); int m=0; int count=0; for (int i...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
c5041ebf83b0835f605f0ec3a6bf0694
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; /** * * @author Hoang IT */ public class Main { public static void main(String args[]){ // System.out.println("Nhap chieu dai cua khan dai:"); Scanner sc = new Scanner(System.in); int w = sc.nextInt(); String rac = sc.nextLine(); String a...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
7c14753763ae3b87ed331c9f8bf8263a
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main (String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int count = 1; int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = scanner.nextInt();...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
465f030fa9090c5dfd12c6bc59959721
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
//package com.company; import java.util.ArrayList; import java.util.LinkedList; import com.sun.security.jgss.GSSUtil; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { ArrayList<Integer> list = new Arra...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
5528acfee54633cdb23a3875ae2e3698
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); String[] a=new String[t]; for(int i=0;i<t;i++) { a[i]=sc.next(); } int c=1; for(int i=0;i<t-1;i++) { if(!(a[i].equals(a[i+1]))) { ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
e7c2c9463c17ccd8a5963c9305cf9fcd
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] shy){ Scanner s = new Scanner(System.in); int n = s.nextInt(); int arr[] = new int[n]; for(int i = 0; i < n; i++) arr[i] = s.nextInt(); int res = 0; for(int i = 0;i < n - 1;i++){ ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
d18bb628d372fd4c8e694d2f8c6366e4
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.util.*; import java.io.InputStreamReader; public class magnets { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; for(int i=0;i<n;i++){...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
1d9330c59e6b536db57f4580da011ff9
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.ArrayList; import java.util.Scanner; public class A_Winner { public static void main(String[] args) { Scanner in = new Scanner(System.in); //players names ArrayList <String> names=new ArrayList<String>(); // Accumulated scores of players names in names array //note that the s...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
6589cbe09c55520bc4104b15e6be7176
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.*; import java.util.Map.Entry; public class P2A { public static void main(String [] args) { String[]strs = new String[1001]; int[] scores = new int[1001]; Map<String , Integer> mp = new TreeMap<String , Integer>(); Map<String , Integer> mp2 = new TreeMa...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
2de36aa28d462dbfa4cf1009bda0661c
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.*; import java.util.Map.Entry; public class P2A { public static void main(String [] args) { String[]strs = new String[1001]; int[] scores = new int[1001]; Map<String , Integer> mp = new TreeMap<String , Integer>(); Map<String , Integer> mp2 = new TreeMa...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
02e5d23ed313690ca077f6355cbe4574
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.*; import java.util.Map.Entry; public class P2A { public static void main(String[] args) { String[] strs = new String[1001]; int[] scores = new int[1001]; Map<String, Integer> mp = new TreeMap<String, Integer>(); Map<String, Integer> mp2 = new TreeMap<String, Inte...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
666528c6937679d9acd106fe518952d3
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author edwardhui */ public class Test { static int n; public static void main(String[]...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
f41147a747afac165faee379f1061338
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.*; public class MA { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n=0; n=input.nextInt(); ArrayList<String>names=new ArrayList<>(); ArrayList<Integer>scores=new ArrayList<>(); for(int i=0;i<n;i++) { names.ad...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
886c0cc69188270eb6ab7ad5da63bee4
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.io.BufferedReader; import java.io.IOError; import java.io.IOException; import java.io.InputStreamReader; import java.lang.Comparable; import java.util.*; public class Main { static BufferedReader reader; public static String readString(){ try { return reader.readLine().trim(); ...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
19ae88d2e025bfeaaee6e6afe20a8b82
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class Winner { public static void main(String[] args) { FastReader input = new FastReader(); Map<String,Integer> map = n...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
363e0bc737261e2b06de8fb533d28622
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class Winner_2A { private static class Player { String name; int points; List<RoundPoints> roundPoints; Player(String name, int points, int round) { this.name = name; this.points = points; roundPoints = new LinkedL...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
256158628b52f2ccc1454f58cecc3d0d
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.util.ArrayList; 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 line = in.nextInt(); Map <String, Integer> table = new HashMap<String, Integer>(); ArrayList<Str...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
f51d9e44f4b81c0a6517a984e3da8359
train_002.jsonl
1267117200
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
64 megabytes
import java.io.PrintWriter; import java.util.*; import java.util.Scanner; /** * Created by abdujabbor on 3/11/17. */ public class Winner { public static void main(String args[]) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); Map<String, Integer>...
Java
["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"]
1 second
["andrew", "andrew"]
null
Java 8
standard input
[ "implementation", "hashing" ]
c9e9b82185481951911db3af72fd04e7
The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe...
1,500
Print the name of the winner.
standard output
PASSED
e381d1e3e375b29cfafda7510f1639ee
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class ss_948A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int R = s.nextInt(), C = s.nextInt(); char[][] pasture = new char[R][C]; for (int i = 0; i < R; i++) { String tmp = s.next(); for (...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
6eea10ace3fb8038a6fe1a74662a2bfb
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class ss_948A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int R = s.nextInt(), C = s.nextInt(); char[][] pasture = new char[R][C]; for (int i = 0; i < R; i++) { String tmp = s.next(); for (...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
d3b66c855b9728132bb86124da83fa1c
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { private static String line; private static int indexLine; public static void readLine(BufferedReader reader) throws IOException { line = reader.readLine()...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
8668e60dcfbd12782d610843e2825168
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.*; public class Task948A { public static void main(String... args) throws NumberFormatException, IOException { Solution.main(System.in, System.out); } static class Scanner { private final BufferedReader br; private String[] cache; private int ca...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
4f8508663bd767cd8def99f7efbe65bd
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; // https://codeforces.com/problemset/problem/948/A public class A948 { static Scanner sc; public static void solve() { } public static void main(String[] args) { sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); char[][] map = new char[r][c]; boolean ha...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
d3f878a6bd54990c465473891be69f69
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { // Use the Scanner class Scanner sc = new Scanner(System.in); /* int n = sc.nextInt(); // read input as integer long k = sc.nextLong(); // read input as long double d = sc.n...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
87e02b44b9fa57b73dc7d5b23b73f75d
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner r = new Scanner(System.in); int t=1; /...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
2003b88e60d23d79ca5b776fa18e4110
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int r = scanner.nextInt(); int c = scanner.nextInt(); int[][] field = new int[r][c]; for (int i = 0; i < r; i++) { String row = s...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
7df0e8488a30f743bd78fa9f2b47dcf3
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
//package CodeForces; import java.util.Scanner; public class ProtectSheep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(), C = sc.nextInt(); String [] row = new String[R]; char [][] Tr = new char [R][C]; for(int i = 0; i<R; i++) { Tr[i] = sc.next().t...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
12710cc0fef4104f29fb6486ed7d0669
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
//package CodeForces; import java.util.Scanner; public class ProtectSheep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(), C = sc.nextInt(); String [] row = new String[R]; for(int i = 0; i<R; i++) { row [i] = sc.next(); } sc.close(); char [][] Tr...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
57dcc702812f812e79489af59faf24be
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
//package CodeForces; import java.util.Scanner; public class ProtectSheep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(), C = sc.nextInt(); String [] row = new String[R]; char [][] Tr = new char [R][C]; for(int i = 0; i<R; i++) { Tr[i] = sc.next().t...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
5b4c0ef69af2f7397c21eac217b95492
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class ProtectSheep { static char[][] pasture; static int r, c; public static void main(String[] args) { Scanner in = new Scanner(System.in); r=in.nextInt(); c=in.nextInt(); pasture = new char[r][c]; for(int i=0; i<r; i++) pasture[i]=in.next().toCharArray(); int cons...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
61aceb61d1fb2899bf62dd5de289c9e0
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
//package javaapplication3; import java.util.ArrayList; import java.util.Scanner; import java.util.Collection; import java.util.Arrays; import java.util.Collections; public class JavaApplication3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(), C = sc.nextI...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
7f7bfe4047953e241e7a0e80acca8430
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
//package javaapplication3; import java.util.ArrayList; import java.util.Scanner; import java.util.Collection; import java.util.Arrays; import java.util.Collections; public class JavaApplication3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(), C = sc.nextI...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
464415f55c7b67b46035ce22e906ba7c
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; /** * _948A */ public class _948A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int r=sc.nextInt(); int c=sc.nextInt(); char a[][]=new char[r][c]; sc.nextLine(); for(int i=0;i<r;i++){ String s=sc.nextL...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
2fa5e19963cb65933b1763ea4932cc10
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.awt.Point; import java.util.ArrayList; import java.util.Scanner; public class ProtectSheep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); char[][] adj = new char[r][c]; for (int i = 0; i < r; i++) { adj[i] = sc.ne...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
8721f51dbd29cb25253e51e255cfd800
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class CF_948_Problem1 { public static void main(String[] args) { char[][] matrix = readInput(); boolean possible = process(matrix); System.out.println(possible ? "Yes" : "No"); if(possible) { print(matrix); } // print(ma...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
87fc546cc32acc70cf031d1c0cdc9eb3
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int R = scanner.nextInt(); int C = scanner.nextInt(); char[][] chars = new char[R][C]; boolean check = true; for (int i = 0; i < R; i++) {...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
33c77ec3c51f573921a42393c84e28da
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ //FastScanner in = new FastScanner(new FileInputStream(new File("phi.in"))); //PrintWriter out = new PrintWriter(new File("output.txt")); PrintWriter o...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
1798378d0d7834f97ccaa1ac8511124d
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; import org.omg.PortableInterceptor.INACTIVE; import java.awt.List; import java.io.*; import java.lang.*; public class code2 { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); //Code starts.. ...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
17acfb79fbdf3cde142df84150becc07
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import javax.sound.midi.MidiChannel; public class Main { public static void main(String[] args) { // Scanner reader = new Scanner(System.in); InputReader reader = new InputReader(); int...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
844a6b421643d78b2b8810ce60e524cb
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; public class Prob948A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); boolean canProtect = true; //use stringbuffer will avoid string immutable in java StringBuffer[] mat...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
555a0f9d51ed1499c37e2b3a1ce5263c
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; import java.io.*; public class Main{ /* . . . . . . . some constants . */ static int i=0,j=0,k=0,l=0; /* . . . if any . . */ public static void main(String[] args) throws IOException{ /* . . . . . . */ int r=ni(); int c=ni(); char...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
3e24e4904b50a2d433c0ea5d1ca93290
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream i...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
d2c19773d99fa1c91c798f3e8b149b79
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class Solution { private static void printAns(char [][] chs,int r, int c) { for(int i =0;i<r;i++) { for(int k=0;k<c;k++) { if(chs[i][k]=='S') { if(i-1>-1) { if(chs[i-1][k]=='W') { System.out.println("No"); return; } ...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
be035cd1df9b97f5165e17f505850c2d
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; public class ProtectSheep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); char[][] animals = new char[n][m]; sc.nextLine(); for (int i = 0; i < animals.length; i++) { animals[i] = sc.nextLine().toCharA...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
f309d552b347920ca36003d425236559
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); int r...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
2e1b7b323d8ba1b02bdae0aa933495b5
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; import java.io.*; public class _948A { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = br.readLine().split(" "); int r = Integer.parseInt(str[0]); int c...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
3f49e445c085be81a4acd08f2cae70bd
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); DecimalFormat df=new DecimalFormat("######0.0000"); int R=sc.nextInt(); int C=sc.nextInt(); char[][] arr=new char[R...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
221a2e524f27e758aa833adfa9036b72
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; //Mann Shah [ DAIICT ]. //fast io public class Main { public static int mod = (int) (1e9+7); static InputReader in; static PrintWriter out; public static int gcd(int a, int b) { if (a == 0) return b; ...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
7f707c5d35f1366ff0cc147c81a9e6cd
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.*; public class B { public static void main(String args[]) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String inp[]=br.readLine().split(" "); int r=Integer.parseInt(inp[0]); int c=Integer.parseInt(inp[1]); char ar[][]=new char[r][c]; int i,j; char in[]; fo...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
90d615aff57fedcb0f428bf718eead6d
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.*; import java.io.*; /** * @author mostafa */ public class B { static int [] dx = {1,-1,0,0}; static int [] dy = {0,0,1,-1}; static final int dir = 4 ; static char [][]arr ; static boolean [][] marked ; static int n , m ; static boolean status = true ; public sta...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
09e0178bddf955a76d35e9fc97147181
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.util.Scanner; import java.util.Stack; public class A { static final int MAXN = 505; static int fd [][] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; static char map [][] = new char [MAXN][MAXN]; static int R, C; static class Node{ int x, y; Node(){} Node(int xx, int yy){...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
757dba7ebfd09282df91d5a7c1f061ce
train_002.jsonl
1520696100
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; public class Xorq { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedR...
Java
["6 6\n..S...\n..S.W.\n.S....\n..W...\n...W..\n......", "1 2\nSW", "5 5\n.S...\n...S.\nS....\n...S.\n.S..."]
1 second
["Yes\n..SD..\n..SDW.\n.SD...\n.DW...\nDD.W..\n......", "No", "Yes\n.S...\n...S.\nS.D..\n...S.\n.S..."]
NoteIn the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.In the second example, there are no empty spots to put dogs that would guard the lone sheep.In the third example, there are no wolves...
Java 8
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f55c824d8db327e531499ced6c843102
First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively. Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.
900
If it is impossible to protect all sheep, output a single line with the word "No". Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep ...
standard output
PASSED
56410d4beb2241e4bb56a336f9e94525
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.InputMismatchException; import java.math.BigInteger; import java.io.*; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public static void main(String[] args) { InputReader in = new StreamInpu...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 8
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
abf6936e00d45b015aa48fa9e55c32a3
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import java.util.*; import static java.lang.Math.*; public class E { public static void main(String[] args){ Scanner in = new Scanner(System.in); st = new Point(in.nextInt(), in.nextInt()); en = new Point(in.nextInt(), in.nextInt()); int N = in.nextInt(); Point[] P = new Point[N]; for(int i = 0; i < N;i++...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
ea1820617da751efbcac4f7b82b0a2a8
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
22b109a1b745e452b8a76873996d72bb
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.InputMismatchException; import java.math.BigInteger; import java.io.*; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public static void main(String[] args) { InputReader in = new StreamInputR...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
9b3ba54eb7b3f451b777a6a132ff4dae
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import java.util.Scanner; public class ShipShortestPath { static class Line { double a, b, c, x1, x2, y1, y2; public Line(double x1, double y1, double x2, double y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; a = -1 * (y2 ...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
68a4ad8235d9eeab80f62c0f70eeef28
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import java.util.*; public class Ship { public static double EPS = 1e-9; public static void main(String[] args){ Scanner reader = new Scanner(System.in); Point s = new Point(reader.nextDouble(), reader.nextDouble()); Point t = new Point(reader.nextDouble(), reader.nextDouble()); int n = reader.nextInt(...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
451d9e2020b5dac244cb3521af0afb34
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
//package round67; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Locale; import java.util.StringTokenizer; public class E { static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static StringToken...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
bcc496c5874c57dca746f7a3ca42f7a9
train_002.jsonl
1302706800
You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 poin...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { BufferedReader in; StringTokenizer st; PrintWriter out; static class Point { double x, y; public Point(double x, double y) { this.x = x; this.y = y; } } ...
Java
["1 7 6 7\n4\n4 2 4 12 3 12 3 2", "-1 0 2 0\n4\n0 0 1 0 1 1 0 1"]
2 seconds
["6.000000000", "3.000000000"]
null
Java 6
standard input
[ "geometry", "shortest paths" ]
732c0e1026ed385888adde5ec8b764c6
The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x,...
2,400
Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.
standard output
PASSED
3559d296cb6beff423e1fa1558d6fe71
train_002.jsonl
1527608100
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $$$1$$$ to $$$n$$$ and then $$$3n$$$ times takes a random pair of different elements and swaps them. Alex ...
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.Arrays; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; public class Solution{ public static void main(S...
Java
["5\n2 4 5 1 3"]
2 seconds
["Petr"]
NotePlease note that the sample is not a valid test (because of limitations for $$$n$$$) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.Due to randomness of input hacks in this problem are forbidden.
Java 11
standard input
[ "combinatorics", "math" ]
a9cc20ba7d6e31706ab1743bdde97669
In the first line of input there is one integer $$$n$$$ ($$$10^{3} \le n \le 10^{6}$$$). In the second line there are $$$n$$$ distinct integers between $$$1$$$ and $$$n$$$ — the permutation of size $$$n$$$ from the test. It is guaranteed that all tests except for sample are generated this way: First we choose $$$n$$$ —...
1,800
If the test is generated via Petr's method print "Petr" (without quotes). If the test is generated via Alex's method print "Um_nik" (without quotes).
standard output
PASSED
fb2e65b686158bf495731239160675e2
train_002.jsonl
1527608100
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $$$1$$$ to $$$n$$$ and then $$$3n$$$ times takes a random pair of different elements and swaps them. Alex ...
256 megabytes
import java.io.*; import java.util.*; // CODE JAM SHIT public class Q2 { static int find(int x,int[] arr){ if(x==arr[x]) return x; arr[x]=arr[arr[x]]; return find(arr[x],arr); } public static void main(String[] args) { InputReader in = new InputReader(true); ...
Java
["5\n2 4 5 1 3"]
2 seconds
["Petr"]
NotePlease note that the sample is not a valid test (because of limitations for $$$n$$$) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.Due to randomness of input hacks in this problem are forbidden.
Java 11
standard input
[ "combinatorics", "math" ]
a9cc20ba7d6e31706ab1743bdde97669
In the first line of input there is one integer $$$n$$$ ($$$10^{3} \le n \le 10^{6}$$$). In the second line there are $$$n$$$ distinct integers between $$$1$$$ and $$$n$$$ — the permutation of size $$$n$$$ from the test. It is guaranteed that all tests except for sample are generated this way: First we choose $$$n$$$ —...
1,800
If the test is generated via Petr's method print "Petr" (without quotes). If the test is generated via Alex's method print "Um_nik" (without quotes).
standard output
PASSED
b9bc4f14ef7259d3d1443dd30dbae5ca
train_002.jsonl
1527608100
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $$$1$$$ to $$$n$$$ and then $$$3n$$$ times takes a random pair of different elements and swaps them. Alex ...
256 megabytes
import java.io.*; import java.util.*; // CODE JAM SHIT public class Q2 { static void swap(int a ,int b ,int []arr){ int t=arr[a]; arr[a]=arr[b]; arr[b]=t; } public static void main(String[] args) { InputReader in = new InputReader(true); PrintWriter out = new P...
Java
["5\n2 4 5 1 3"]
2 seconds
["Petr"]
NotePlease note that the sample is not a valid test (because of limitations for $$$n$$$) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.Due to randomness of input hacks in this problem are forbidden.
Java 11
standard input
[ "combinatorics", "math" ]
a9cc20ba7d6e31706ab1743bdde97669
In the first line of input there is one integer $$$n$$$ ($$$10^{3} \le n \le 10^{6}$$$). In the second line there are $$$n$$$ distinct integers between $$$1$$$ and $$$n$$$ — the permutation of size $$$n$$$ from the test. It is guaranteed that all tests except for sample are generated this way: First we choose $$$n$$$ —...
1,800
If the test is generated via Petr's method print "Petr" (without quotes). If the test is generated via Alex's method print "Um_nik" (without quotes).
standard output
PASSED
482a2f6a63cd27d4496d8154323f2b18
train_002.jsonl
1527608100
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $$$1$$$ to $$$n$$$ and then $$$3n$$$ times takes a random pair of different elements and swaps them. Alex ...
256 megabytes
import java.io.*; import java.util.*; public class PetrAndPermutations { private static int mergeAndCount(int[] arr, int l, int m, int r) { // Left subarray int[] left = Arrays.copyOfRange(arr, l, m + 1); // Right subarray int[] right = Arrays.copyOfRange(arr, m + 1, r + 1); ...
Java
["5\n2 4 5 1 3"]
2 seconds
["Petr"]
NotePlease note that the sample is not a valid test (because of limitations for $$$n$$$) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.Due to randomness of input hacks in this problem are forbidden.
Java 11
standard input
[ "combinatorics", "math" ]
a9cc20ba7d6e31706ab1743bdde97669
In the first line of input there is one integer $$$n$$$ ($$$10^{3} \le n \le 10^{6}$$$). In the second line there are $$$n$$$ distinct integers between $$$1$$$ and $$$n$$$ — the permutation of size $$$n$$$ from the test. It is guaranteed that all tests except for sample are generated this way: First we choose $$$n$$$ —...
1,800
If the test is generated via Petr's method print "Petr" (without quotes). If the test is generated via Alex's method print "Um_nik" (without quotes).
standard output
PASSED
39a0a9b95fce12498624e8349693f623
train_002.jsonl
1527608100
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $$$1$$$ to $$$n$$$ and then $$$3n$$$ times takes a random pair of different elements and swaps them. Alex ...
256 megabytes
import java.io.*; import java.util.*; public class PetrAndPermutations { public static void main(String[] args) throws Exception { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(buffer.readLine()...
Java
["5\n2 4 5 1 3"]
2 seconds
["Petr"]
NotePlease note that the sample is not a valid test (because of limitations for $$$n$$$) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.Due to randomness of input hacks in this problem are forbidden.
Java 11
standard input
[ "combinatorics", "math" ]
a9cc20ba7d6e31706ab1743bdde97669
In the first line of input there is one integer $$$n$$$ ($$$10^{3} \le n \le 10^{6}$$$). In the second line there are $$$n$$$ distinct integers between $$$1$$$ and $$$n$$$ — the permutation of size $$$n$$$ from the test. It is guaranteed that all tests except for sample are generated this way: First we choose $$$n$$$ —...
1,800
If the test is generated via Petr's method print "Petr" (without quotes). If the test is generated via Alex's method print "Um_nik" (without quotes).
standard output
PASSED
e92390773cd2c8119976ae5a6c9ce66b
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1351a { public static void main(String[] args) throws IOException { int t = ri(); while(t --> 0) { int a = rni(), b = ni(); prln(a + b); } ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
111c48c9b8c3dbfef67c9755098d1d15
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; // Give me a scanner and easy access to most everything else import static java.lang.System.*; //shorten printing public class AdditionalProblem { //global variables public static void main (String[] args) { //Code will begin here Scanner in = new Scanner(System.in); ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
b1732a2500dc99416e0bd33ce96872e1
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; import static java.lang.System.*; public class AddingProblem { public static void main(String[] args) { Scanner in = new Scanner(System.in); int numCases = in.nextInt(); for (int t=0; t<numCases; t++) { int a = in.nextInt(); int b = in.nextInt();...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
17293aecb8f638a6b5e7ff1c098c381b
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class trialproblem { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-->0) { int a = scn.nextInt(); int b = scn.nextInt(); int sum = a+b; System.out.println(sum); ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
f930442ba935dc74bf581891a027a93c
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; import java.util.regex.*; public class Tringle { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int t=Integer.parseInt(scan.nextLine()); while(t-->0) { long x=scan.nextInt(); long y=scan.nextInt(); System.out.println(x+y); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
5d84c804a1aed07e2517076f52f17acf
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t; t=sc.nextInt(); ArrayList<Long> a=new ArrayList<Long>(); ArrayList<Long> b=new ArrayList<Long>(); ArrayList<Long> c=new ArrayList<Long>(); ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
00ecf8a841d4b1bdd7b89aec8b7bd063
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); long t; t=sc.nextLong(); long x[][]=new long[(int)t][2]; for(int i=0;i<t;i++) { for(int j=0;j<2;j++) x[i][j]=sc.nextLong(); } for(int i=0;i<t;i++) { long c=0; ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
1924a76513e60d841242ec072ebb7eaa
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class MyClass { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int j=0; j<t; j++) { short a = sc.nextShort(); short b = sc.nextShort(); System.out.println(a+b); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
c048d6630663aa1c50824e55d9b7d99c
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; import static java.lang.Math.*; public class Demo{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-->0){ int a = in.nextInt(); int b = in.nextInt(); System.out.println(a+b); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
25fd04d0531563488ddc1dc2d7a0adf6
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class Solution{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int test=sc.nextInt(); for(int t=0;t<test;t++){ int a=sc.nextInt(); int b=sc.nextInt(); System.out.println(a+b); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
d25c1eafc0be8af29f2431bb5ef9dc51
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; import java.io.*; import java.math.*; public class Main{ public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out)); public static void main(String sp[])throws IOException{ //Scanner sc = new Scanner(System.in); FastReader sc = new FastReader(); int t = sc.nextInt...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
66c455e6fbfa4e324443f58ee7110cb9
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class trial { public static void main(String[] args) { { int a,b,sum; Scanner sc= new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { a=sc.nextInt(); b=sc.nextInt(); sum=a+b; System.out.println(sum); sum=0; } } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
3171c0b5e9dceb8f363a23e27e3ba88f
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class simplesum { public static void main(String[] args) { Scanner as=new Scanner(System.in); int n=as.nextInt(); for (int i=0;i<n;i++) { int a=as.nextInt(); int b=as.nextInt(); System.out.println(a+b); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
73d47f87631358f6d13b2cc9213c3c38
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader bf= new BufferedReader(new InputStreamReader(System.in)); int cases= Integer.parseInt(bf.readLine()); for(int i=0;i<cases;i++) { StringTokenizer st =...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
c0980c432226ed9f80833c738cf9b3e9
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
//package firsttest; import java.util.Date; import java.util.Scanner; /** * * @author Asad Bin Saber * @date 12 05 2020 */ public class Main{ /** * @param args the command line arguments */ static Scanner sc=new Scanner(System.in); public static void main(String[] args) { // ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
02d31ebe3ec22c4b12134413dcc13c31
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { //Scanner in=new Scanner(System.in); //int a = in.nextInt();// //System.out.println("enter an integer" +a);// //for(int i=0;i<a;i++) { // //int b=in.nextInt();// //System.out.println("enter an integer" +b);...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
8b5709f67c154ce1424bc6300d01b001
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { BufferedReader x=new BufferedReader(new InputStreamReader(System.in)); try{ String n1=x.readLine(); int n=Integer.parseI...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
3179c3b197719f866b13b60de380a481
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class Codeforces_1351A { public static void main(String args[]) { Scanner input = new Scanner(System.in); int num_cases = input.nextInt(); for (int i = 0; i < num_cases; i++) { int a = input.nextInt(); int b = input.nextInt(); ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
7794c060fb70e03a8f04a70ff5e59cd8
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.io.*; import java.util.*; // Author- Prashant Gupta public class A { public static void main(String[] args) throws IOException { // write your code here PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); // Scanner sc = new Scanner(System.in); Read...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
6dca0e54a51c771d5d6919d2c0ce9f67
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.io.*; import java.util.*; public class solution { static class sort implements Comparator<ArrayList<Integer>> { @Override public int compare(ArrayList<Integer> o1, ArrayList<Integer> o2) { int c = o2.get(1).compareTo(o1.get(1)); if (c == 0) { ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
07dfc2a2f964deb2185cfa9e1f6c54d6
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class practice{ static public void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while((t--)>0) { System.out.println(sc.nextInt()+sc.nextInt()); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
20373da0b1f34bdb1c88a522532986db
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class Main { public static void main(String args[]) { Scanner s=new Scanner(System.in); int t; t=s.nextInt(); for(int i=0;i<t;i++) { int a,b; a=s.nextInt(); b=s.nextInt(); System.out.println(a+b); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
8f0d0586b28ac0c079a4e64c99071b4c
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.io.PrintStream; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintStream pw = new PrintStream(System.out); long t = in.nextLong(); while (t-- > 0) { int s = in.nextInt(),r = in.nextInt()...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
d2343ca65c666a612ca522cd1dc8e9e8
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class Add { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { int a=sc.nextInt(); int b=sc.nextInt(); System.out.println(a+b); } } }
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
c9f05a37b8c8b9bc2f40fbc819d78879
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); int cases = scan.nextInt(); for (int i = 0; i < cases; i++) { int a = scan.nextInt(); int b = scan.nextInt(); System.out.println(...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
38687b3ba919f06e22d27c7035153e49
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.Scanner; public class Problem3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); int[] a = new int[t]; int[] b = new int[t]; int[] total = new int[t]; for(int i=0;i<t;i++) { a[i] = in.nextInt(); b[i] = in.nextInt(); to...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output
PASSED
218b9b2734c612a2b0168a30782b97fe
train_002.jsonl
1624368900
You are given two integers $$$a$$$ and $$$b$$$. Print $$$a+b$$$.
512 MB
import java.util.*; public class AB { public static void main(String[] args) { Scanner input = new Scanner(System.in); int i = input.nextInt(); for (int j = 0; j < i; j++) { int a = input.nextInt(); int b = input.nextInt(); System.out.println(a + b); ...
Java
["4\n\n1 5\n\n314 15\n\n-99 99\n\n123 987"]
2.0 s
["6\n329\n0\n1110"]
null
Java 11
standard input
[ "implementation" ]
27ddccc777ef9040284ab6314cbd70e7
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given as a line of two integers $$$a$$$ and $$$b$$$ ($$$-1000 \le a, b \le 1000$$$).
800
Print $$$t$$$ integers — the required numbers $$$a+b$$$.
standard output