id stringlengths 2 6 | java stringlengths 48 5.92k | python stringlengths 33 11.1k |
|---|---|---|
T0 | import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i... | def main ( ) : NEW_LINE INDENT R = 10 ** 9 + 7 NEW_LINE N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( " β " ) ) ) NEW_LINE if a [ 0 ] != 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT amax = max ( a ) NEW_LINE h = [ 0 ] * ( amax + 1 ) NEW_LINE for i in a : NEW_LINE INDENT h [ i ] += 1 NEW_LINE... |
T1 | import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i... | def powmod ( a , b , P ) : NEW_LINE INDENT if b == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT stk = [ ] NEW_LINE while b > 1 : NEW_LINE INDENT stk . append ( b % 2 ) NEW_LINE b //= 2 NEW_LINE DEDENT c = a % P NEW_LINE while len ( stk ) > 0 : NEW_LINE INDENT t = stk . pop ( ) NEW_LINE c = ( c * c ) % P NEW_LINE if t =... |
T2 | import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i... | from collections import defaultdict NEW_LINE def mod_pow ( x , n , mod ) : NEW_LINE INDENT if n == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT res = mod_pow ( x * x % mod , n // 2 , mod ) NEW_LINE if n & 1 : NEW_LINE INDENT res = res * x % mod NEW_LINE DEDENT return res NEW_LINE DEDENT MOD = 10 ** 9 + 7 NEW_LINE N = i... |
T3 | import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i... | import collections NEW_LINE MAX_N = 10 ** 5 + 1 NEW_LINE MOD = 1000000007 NEW_LINE same_dist = [ 0 ] * ( MAX_N + 1 ) NEW_LINE same_dist [ 1 ] = 1 NEW_LINE for i in range ( 2 , MAX_N + 1 ) : NEW_LINE INDENT same_dist [ i ] = same_dist [ i - 1 ] * pow ( 2 , i - 1 , MOD ) NEW_LINE same_dist [ i ] %= MOD NEW_LINE DEDENT n ... |
T4 | import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i... | from collections import Counter NEW_LINE n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE def power ( n , k ) : NEW_LINE INDENT if k == 0 : return 1 NEW_LINE elif k == 1 : return n NEW_LINE elif k % 2 == 0 : return power ( ( n ** 2 ) % mod , k // 2 ) NEW_LINE else : return ( n * ... |
T5 | import java . util . * ; public class Main { static final int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc .... | def main ( ) : NEW_LINE INDENT R = 10 ** 9 + 7 NEW_LINE N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( " β " ) ) ) NEW_LINE if a [ 0 ] != 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT amax = max ( a ) NEW_LINE h = [ 0 ] * ( amax + 1 ) NEW_LINE for i in a : NEW_LINE INDENT h [ i ] += 1 NEW_LINE... |
T6 | import java . util . * ; public class Main { static final int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc .... | def powmod ( a , b , P ) : NEW_LINE INDENT if b == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT stk = [ ] NEW_LINE while b > 1 : NEW_LINE INDENT stk . append ( b % 2 ) NEW_LINE b //= 2 NEW_LINE DEDENT c = a % P NEW_LINE while len ( stk ) > 0 : NEW_LINE INDENT t = stk . pop ( ) NEW_LINE c = ( c * c ) % P NEW_LINE if t =... |
T7 | import java . util . * ; public class Main { static final int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc .... | from collections import defaultdict NEW_LINE def mod_pow ( x , n , mod ) : NEW_LINE INDENT if n == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT res = mod_pow ( x * x % mod , n // 2 , mod ) NEW_LINE if n & 1 : NEW_LINE INDENT res = res * x % mod NEW_LINE DEDENT return res NEW_LINE DEDENT MOD = 10 ** 9 + 7 NEW_LINE N = i... |
T8 | import java . util . * ; public class Main { static final int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc .... | import collections NEW_LINE MAX_N = 10 ** 5 + 1 NEW_LINE MOD = 1000000007 NEW_LINE same_dist = [ 0 ] * ( MAX_N + 1 ) NEW_LINE same_dist [ 1 ] = 1 NEW_LINE for i in range ( 2 , MAX_N + 1 ) : NEW_LINE INDENT same_dist [ i ] = same_dist [ i - 1 ] * pow ( 2 , i - 1 , MOD ) NEW_LINE same_dist [ i ] %= MOD NEW_LINE DEDENT n ... |
T9 | import java . util . * ; public class Main { static final int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc .... | from collections import Counter NEW_LINE n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE def power ( n , k ) : NEW_LINE INDENT if k == 0 : return 1 NEW_LINE elif k == 1 : return n NEW_LINE elif k % 2 == 0 : return power ( ( n ** 2 ) % mod , k // 2 ) NEW_LINE else : return ( n * ... |
T10 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ... | import sys NEW_LINE input = sys . stdin . readline NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE par = [ ] NEW_LINE rank = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT par . append ( i ) NEW_LINE rank . append ( 0 ) NEW_LINE DEDENT def find ( x , par ) : NEW_LINE INDENT if par [ x ] == x : NEW_LI... |
T11 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ... | class UnionFind ( ) : NEW_LINE INDENT def __init__ ( self , size ) : NEW_LINE INDENT self . table = [ - 1 ] * size NEW_LINE DEDENT def root ( self , x ) : NEW_LINE INDENT while self . table [ x ] >= 0 : NEW_LINE INDENT x = self . table [ x ] NEW_LINE DEDENT return x NEW_LINE DEDENT def unite ( self , x , y ) : NEW_LINE... |
T12 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ... | from collections import defaultdict NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( sys . getrecursionlimit ( ) * 10000 ) NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE g = defaultdict ( list ) NEW_LINE for i in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE g [... |
T13 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ... | def b_construction ( N , M , Road ) : NEW_LINE INDENT class UnionFind ( object ) : NEW_LINE INDENT def __init__ ( self , N ) : NEW_LINE INDENT self . p = list ( range ( N ) ) NEW_LINE self . rank = [ 0 ] * N NEW_LINE self . size = [ 1 ] * N NEW_LINE DEDENT def union ( self , x , y ) : NEW_LINE INDENT u = self . find ( ... |
T14 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ... | class DisjointSet : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . rank = { } NEW_LINE self . p = { } NEW_LINE DEDENT def makeSet ( self , x ) : NEW_LINE INDENT self . p [ x ] = x NEW_LINE self . rank [ x ] = 0 NEW_LINE DEDENT def same ( self , x , y ) : NEW_LINE INDENT return self . findSet ( x ) == se... |
T15 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static int M = sc . nextInt ( ) ; static Node [ ] nod... | import sys NEW_LINE input = sys . stdin . readline NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE par = [ ] NEW_LINE rank = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT par . append ( i ) NEW_LINE rank . append ( 0 ) NEW_LINE DEDENT def find ( x , par ) : NEW_LINE INDENT if par [ x ] == x : NEW_LI... |
T16 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static int M = sc . nextInt ( ) ; static Node [ ] nod... | class UnionFind ( ) : NEW_LINE INDENT def __init__ ( self , size ) : NEW_LINE INDENT self . table = [ - 1 ] * size NEW_LINE DEDENT def root ( self , x ) : NEW_LINE INDENT while self . table [ x ] >= 0 : NEW_LINE INDENT x = self . table [ x ] NEW_LINE DEDENT return x NEW_LINE DEDENT def unite ( self , x , y ) : NEW_LINE... |
T17 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static int M = sc . nextInt ( ) ; static Node [ ] nod... | from collections import defaultdict NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( sys . getrecursionlimit ( ) * 10000 ) NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE g = defaultdict ( list ) NEW_LINE for i in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE g [... |
T18 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static int M = sc . nextInt ( ) ; static Node [ ] nod... | def b_construction ( N , M , Road ) : NEW_LINE INDENT class UnionFind ( object ) : NEW_LINE INDENT def __init__ ( self , N ) : NEW_LINE INDENT self . p = list ( range ( N ) ) NEW_LINE self . rank = [ 0 ] * N NEW_LINE self . size = [ 1 ] * N NEW_LINE DEDENT def union ( self , x , y ) : NEW_LINE INDENT u = self . find ( ... |
T19 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static int M = sc . nextInt ( ) ; static Node [ ] nod... | class DisjointSet : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . rank = { } NEW_LINE self . p = { } NEW_LINE DEDENT def makeSet ( self , x ) : NEW_LINE INDENT self . p [ x ] = x NEW_LINE self . rank [ x ] = 0 NEW_LINE DEDENT def same ( self , x , y ) : NEW_LINE INDENT return self . findSet ( x ) == se... |
T20 | import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ... | import sys NEW_LINE input = sys . stdin . readline NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE par = [ ] NEW_LINE rank = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT par . append ( i ) NEW_LINE rank . append ( 0 ) NEW_LINE DEDENT def find ( x , par ) : NEW_LINE INDENT if par [ x ] == x : NEW_LI... |
T21 | import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ... | class UnionFind ( ) : NEW_LINE INDENT def __init__ ( self , size ) : NEW_LINE INDENT self . table = [ - 1 ] * size NEW_LINE DEDENT def root ( self , x ) : NEW_LINE INDENT while self . table [ x ] >= 0 : NEW_LINE INDENT x = self . table [ x ] NEW_LINE DEDENT return x NEW_LINE DEDENT def unite ( self , x , y ) : NEW_LINE... |
T22 | import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ... | from collections import defaultdict NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( sys . getrecursionlimit ( ) * 10000 ) NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE g = defaultdict ( list ) NEW_LINE for i in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE g [... |
T23 | import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ... | def b_construction ( N , M , Road ) : NEW_LINE INDENT class UnionFind ( object ) : NEW_LINE INDENT def __init__ ( self , N ) : NEW_LINE INDENT self . p = list ( range ( N ) ) NEW_LINE self . rank = [ 0 ] * N NEW_LINE self . size = [ 1 ] * N NEW_LINE DEDENT def union ( self , x , y ) : NEW_LINE INDENT u = self . find ( ... |
T24 | import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ... | class DisjointSet : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . rank = { } NEW_LINE self . p = { } NEW_LINE DEDENT def makeSet ( self , x ) : NEW_LINE INDENT self . p [ x ] = x NEW_LINE self . rank [ x ] = 0 NEW_LINE DEDENT def same ( self , x , y ) : NEW_LINE INDENT return self . findSet ( x ) == se... |
T25 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Node [ ] node = new Node [ 100000 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int... | import sys NEW_LINE input = sys . stdin . readline NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE par = [ ] NEW_LINE rank = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT par . append ( i ) NEW_LINE rank . append ( 0 ) NEW_LINE DEDENT def find ( x , par ) : NEW_LINE INDENT if par [ x ] == x : NEW_LI... |
T26 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Node [ ] node = new Node [ 100000 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int... | class UnionFind ( ) : NEW_LINE INDENT def __init__ ( self , size ) : NEW_LINE INDENT self . table = [ - 1 ] * size NEW_LINE DEDENT def root ( self , x ) : NEW_LINE INDENT while self . table [ x ] >= 0 : NEW_LINE INDENT x = self . table [ x ] NEW_LINE DEDENT return x NEW_LINE DEDENT def unite ( self , x , y ) : NEW_LINE... |
T27 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Node [ ] node = new Node [ 100000 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int... | from collections import defaultdict NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( sys . getrecursionlimit ( ) * 10000 ) NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE g = defaultdict ( list ) NEW_LINE for i in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE g [... |
T28 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Node [ ] node = new Node [ 100000 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int... | def b_construction ( N , M , Road ) : NEW_LINE INDENT class UnionFind ( object ) : NEW_LINE INDENT def __init__ ( self , N ) : NEW_LINE INDENT self . p = list ( range ( N ) ) NEW_LINE self . rank = [ 0 ] * N NEW_LINE self . size = [ 1 ] * N NEW_LINE DEDENT def union ( self , x , y ) : NEW_LINE INDENT u = self . find ( ... |
T29 | import java . util . * ; public class Main { public static class Node { ArrayList < Integer > to ; boolean visit ; Node ( ) { to = new ArrayList < Integer > ( ) ; visit = false ; } } static Node [ ] node = new Node [ 100000 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int... | class DisjointSet : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . rank = { } NEW_LINE self . p = { } NEW_LINE DEDENT def makeSet ( self , x ) : NEW_LINE INDENT self . p [ x ] = x NEW_LINE self . rank [ x ] = 0 NEW_LINE DEDENT def same ( self , x , y ) : NEW_LINE INDENT return self . findSet ( x ) == se... |
T30 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( )... | import sys NEW_LINE input = sys . stdin . readline NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE par = [ ] NEW_LINE rank = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT par . append ( i ) NEW_LINE rank . append ( 0 ) NEW_LINE DEDENT def find ( x , par ) : NEW_LINE INDENT if par [ x ] == x : NEW_LI... |
T31 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( )... | class UnionFind ( ) : NEW_LINE INDENT def __init__ ( self , size ) : NEW_LINE INDENT self . table = [ - 1 ] * size NEW_LINE DEDENT def root ( self , x ) : NEW_LINE INDENT while self . table [ x ] >= 0 : NEW_LINE INDENT x = self . table [ x ] NEW_LINE DEDENT return x NEW_LINE DEDENT def unite ( self , x , y ) : NEW_LINE... |
T32 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( )... | from collections import defaultdict NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( sys . getrecursionlimit ( ) * 10000 ) NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE g = defaultdict ( list ) NEW_LINE for i in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE g [... |
T33 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( )... | def b_construction ( N , M , Road ) : NEW_LINE INDENT class UnionFind ( object ) : NEW_LINE INDENT def __init__ ( self , N ) : NEW_LINE INDENT self . p = list ( range ( N ) ) NEW_LINE self . rank = [ 0 ] * N NEW_LINE self . size = [ 1 ] * N NEW_LINE DEDENT def union ( self , x , y ) : NEW_LINE INDENT u = self . find ( ... |
T34 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( )... | class DisjointSet : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . rank = { } NEW_LINE self . p = { } NEW_LINE DEDENT def makeSet ( self , x ) : NEW_LINE INDENT self . p [ x ] = x NEW_LINE self . rank [ x ] = 0 NEW_LINE DEDENT def same ( self , x , y ) : NEW_LINE INDENT return self . findSet ( x ) == se... |
T35 | import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; } }
| s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE if len ( s1 ) > len ( s2 ) : NEW_LINE INDENT print ( s1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s2 ) NEW_LINE DEDENT
|
T36 | import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; } }
| print ( max ( open ( 0 ) , key = len ) ) NEW_LINE
|
T37 | import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; } }
| a = input ( ) NEW_LINE b = input ( ) NEW_LINE print ( a if len ( a ) >= len ( b ) else b ) NEW_LINE
|
T38 | import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; } }
| A = input ( ) NEW_LINE B = input ( ) NEW_LINE if A . islower ( ) and B . islower ( ) : NEW_LINE INDENT C = len ( A ) NEW_LINE D = len ( B ) NEW_LINE if C > D : NEW_LINE INDENT print ( A ) NEW_LINE DEDENT elif D > C : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT DEDENT
|
T39 | import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; } }
| print ( max ( input ( ) , input ( ) , key = len ) ) NEW_LINE
|
T40 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE if len ( s1 ) > len ( s2 ) : NEW_LINE INDENT print ( s1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s2 ) NEW_LINE DEDENT
|
T41 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | print ( max ( open ( 0 ) , key = len ) ) NEW_LINE
|
T42 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | a = input ( ) NEW_LINE b = input ( ) NEW_LINE print ( a if len ( a ) >= len ( b ) else b ) NEW_LINE
|
T43 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | A = input ( ) NEW_LINE B = input ( ) NEW_LINE if A . islower ( ) and B . islower ( ) : NEW_LINE INDENT C = len ( A ) NEW_LINE D = len ( B ) NEW_LINE if C > D : NEW_LINE INDENT print ( A ) NEW_LINE DEDENT elif D > C : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT DEDENT
|
T44 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | print ( max ( input ( ) , input ( ) , key = len ) ) NEW_LINE
|
T45 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; } static int l_min ( ... | s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE if len ( s1 ) > len ( s2 ) : NEW_LINE INDENT print ( s1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s2 ) NEW_LINE DEDENT
|
T46 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; } static int l_min ( ... | print ( max ( open ( 0 ) , key = len ) ) NEW_LINE
|
T47 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; } static int l_min ( ... | a = input ( ) NEW_LINE b = input ( ) NEW_LINE print ( a if len ( a ) >= len ( b ) else b ) NEW_LINE
|
T48 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; } static int l_min ( ... | A = input ( ) NEW_LINE B = input ( ) NEW_LINE if A . islower ( ) and B . islower ( ) : NEW_LINE INDENT C = len ( A ) NEW_LINE D = len ( B ) NEW_LINE if C > D : NEW_LINE INDENT print ( A ) NEW_LINE DEDENT elif D > C : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT DEDENT
|
T49 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; } static int l_min ( ... | print ( max ( input ( ) , input ( ) , key = len ) ) NEW_LINE
|
T50 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE if len ( s1 ) > len ( s2 ) : NEW_LINE INDENT print ( s1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s2 ) NEW_LINE DEDENT
|
T51 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | print ( max ( open ( 0 ) , key = len ) ) NEW_LINE
|
T52 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | a = input ( ) NEW_LINE b = input ( ) NEW_LINE print ( a if len ( a ) >= len ( b ) else b ) NEW_LINE
|
T53 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | A = input ( ) NEW_LINE B = input ( ) NEW_LINE if A . islower ( ) and B . islower ( ) : NEW_LINE INDENT C = len ( A ) NEW_LINE D = len ( B ) NEW_LINE if C > D : NEW_LINE INDENT print ( A ) NEW_LINE DEDENT elif D > C : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT DEDENT
|
T54 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | print ( max ( input ( ) , input ( ) , key = len ) ) NEW_LINE
|
T55 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE if len ( s1 ) > len ( s2 ) : NEW_LINE INDENT print ( s1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s2 ) NEW_LINE DEDENT
|
T56 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | print ( max ( open ( 0 ) , key = len ) ) NEW_LINE
|
T57 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | a = input ( ) NEW_LINE b = input ( ) NEW_LINE print ( a if len ( a ) >= len ( b ) else b ) NEW_LINE
|
T58 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | A = input ( ) NEW_LINE B = input ( ) NEW_LINE if A . islower ( ) and B . islower ( ) : NEW_LINE INDENT C = len ( A ) NEW_LINE D = len ( B ) NEW_LINE if C > D : NEW_LINE INDENT print ( A ) NEW_LINE DEDENT elif D > C : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT DEDENT
|
T59 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | print ( max ( input ( ) , input ( ) , key = len ) ) NEW_LINE
|
T60 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int... | N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE sorted_a = sorted ( a ) NEW_LINE sorted_b = sorted ( b ) NEW_LINE sorted_c = sorted ( c ) NEW_LIN... |
T61 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int... | def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import bisect NEW_LINE N = int ( input ( ) ) NEW_LINE A = sorted ( inpl ( ) ) NEW_LINE B = inpl ( ) NEW_LINE C = sorted ( inpl ( ) ) NEW_LINE ans = 0 NEW_LINE for b in B : NEW_LINE INDENT ans += bisect . bisect_left ( A , b ) * ( N - bisect . b... |
T62 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int... | II = lambda : int ( input ( ) ) NEW_LINE MI = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE def main ( ) : NEW_LINE INDENT N = II ( ) NEW_LINE A , B , C = sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) NEW_LINE s = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE ia = N - 1 NEW_... |
T63 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE C = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_... |
T64 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int... | N = int ( input ( ) ) NEW_LINE A = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE B = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE C = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_LINE ans = 0 NEW_LINE midnum = [ ] NEW_LIN... |
T65 | import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i =... | N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE sorted_a = sorted ( a ) NEW_LINE sorted_b = sorted ( b ) NEW_LINE sorted_c = sorted ( c ) NEW_LIN... |
T66 | import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i =... | def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import bisect NEW_LINE N = int ( input ( ) ) NEW_LINE A = sorted ( inpl ( ) ) NEW_LINE B = inpl ( ) NEW_LINE C = sorted ( inpl ( ) ) NEW_LINE ans = 0 NEW_LINE for b in B : NEW_LINE INDENT ans += bisect . bisect_left ( A , b ) * ( N - bisect . b... |
T67 | import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i =... | II = lambda : int ( input ( ) ) NEW_LINE MI = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE def main ( ) : NEW_LINE INDENT N = II ( ) NEW_LINE A , B , C = sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) NEW_LINE s = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE ia = N - 1 NEW_... |
T68 | import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i =... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE C = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_... |
T69 | import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i =... | N = int ( input ( ) ) NEW_LINE A = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE B = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE C = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_LINE ans = 0 NEW_LINE midnum = [ ] NEW_LIN... |
T70 | import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b... | N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE sorted_a = sorted ( a ) NEW_LINE sorted_b = sorted ( b ) NEW_LINE sorted_c = sorted ( c ) NEW_LIN... |
T71 | import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b... | def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import bisect NEW_LINE N = int ( input ( ) ) NEW_LINE A = sorted ( inpl ( ) ) NEW_LINE B = inpl ( ) NEW_LINE C = sorted ( inpl ( ) ) NEW_LINE ans = 0 NEW_LINE for b in B : NEW_LINE INDENT ans += bisect . bisect_left ( A , b ) * ( N - bisect . b... |
T72 | import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b... | II = lambda : int ( input ( ) ) NEW_LINE MI = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE def main ( ) : NEW_LINE INDENT N = II ( ) NEW_LINE A , B , C = sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) NEW_LINE s = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE ia = N - 1 NEW_... |
T73 | import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE C = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_... |
T74 | import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b... | N = int ( input ( ) ) NEW_LINE A = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE B = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE C = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_LINE ans = 0 NEW_LINE midnum = [ ] NEW_LIN... |
T75 | import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parse... | N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE sorted_a = sorted ( a ) NEW_LINE sorted_b = sorted ( b ) NEW_LINE sorted_c = sorted ( c ) NEW_LIN... |
T76 | import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parse... | def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import bisect NEW_LINE N = int ( input ( ) ) NEW_LINE A = sorted ( inpl ( ) ) NEW_LINE B = inpl ( ) NEW_LINE C = sorted ( inpl ( ) ) NEW_LINE ans = 0 NEW_LINE for b in B : NEW_LINE INDENT ans += bisect . bisect_left ( A , b ) * ( N - bisect . b... |
T77 | import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parse... | II = lambda : int ( input ( ) ) NEW_LINE MI = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE def main ( ) : NEW_LINE INDENT N = II ( ) NEW_LINE A , B , C = sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) NEW_LINE s = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE ia = N - 1 NEW_... |
T78 | import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parse... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE C = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_... |
T79 | import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parse... | N = int ( input ( ) ) NEW_LINE A = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE B = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE C = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_LINE ans = 0 NEW_LINE midnum = [ ] NEW_LIN... |
T80 | import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Integer [ ] as = new Integer [ n ] ; for ( int i = ... | N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ' β ' ) ) ) NEW_LINE sorted_a = sorted ( a ) NEW_LINE sorted_b = sorted ( b ) NEW_LINE sorted_c = sorted ( c ) NEW_LIN... |
T81 | import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Integer [ ] as = new Integer [ n ] ; for ( int i = ... | def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import bisect NEW_LINE N = int ( input ( ) ) NEW_LINE A = sorted ( inpl ( ) ) NEW_LINE B = inpl ( ) NEW_LINE C = sorted ( inpl ( ) ) NEW_LINE ans = 0 NEW_LINE for b in B : NEW_LINE INDENT ans += bisect . bisect_left ( A , b ) * ( N - bisect . b... |
T82 | import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Integer [ ] as = new Integer [ n ] ; for ( int i = ... | II = lambda : int ( input ( ) ) NEW_LINE MI = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE def main ( ) : NEW_LINE INDENT N = II ( ) NEW_LINE A , B , C = sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) , sorted ( list ( MI ( ) ) ) NEW_LINE s = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE ia = N - 1 NEW_... |
T83 | import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Integer [ ] as = new Integer [ n ] ; for ( int i = ... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE C = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_... |
T84 | import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Integer [ ] as = new Integer [ n ] ; for ( int i = ... | N = int ( input ( ) ) NEW_LINE A = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE B = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE C = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE A = sorted ( A ) NEW_LINE B = sorted ( B ) NEW_LINE C = sorted ( C ) NEW_LINE ans = 0 NEW_LINE midnum = [ ] NEW_LIN... |
T85 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , " " ) ) ; } }
| X = input ( ) NEW_LINE s = input ( ) NEW_LINE result = " " . join ( [ c for c in s if c not in X ] ) NEW_LINE print ( result ) NEW_LINE
|
T86 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , " " ) ) ; } }
| x , c = input ( ) , input ( ) NEW_LINE ans = " " NEW_LINE for i in range ( len ( c ) ) : NEW_LINE INDENT if c [ i ] != x : ans += c [ i ] NEW_LINE DEDENT print ( ans ) NEW_LINE
|
T87 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , " " ) ) ; } }
| s = input ( ) ; print ( input ( ) . replace ( s , " " ) ) NEW_LINE
|
T88 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , " " ) ) ; } }
| X = input ( ) NEW_LINE s = [ str ( _ ) for _ in input ( ) ] NEW_LINE Res = [ ] NEW_LINE for i in s : NEW_LINE INDENT if X == i : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT Res . append ( i ) NEW_LINE DEDENT DEDENT print ( " " . join ( Res ) ) NEW_LINE
|
T89 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , " " ) ) ; } }
| import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE c = input ( ) . rstrip ( ) NEW_LINE s = input ( ) . rstrip ( ) NEW_LINE print ( s . replace ( c , " " ) ) NEW_LINE
|
T90 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | X = input ( ) NEW_LINE s = input ( ) NEW_LINE result = " " . join ( [ c for c in s if c not in X ] ) NEW_LINE print ( result ) NEW_LINE
|
T91 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | x , c = input ( ) , input ( ) NEW_LINE ans = " " NEW_LINE for i in range ( len ( c ) ) : NEW_LINE INDENT if c [ i ] != x : ans += c [ i ] NEW_LINE DEDENT print ( ans ) NEW_LINE
|
T92 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | s = input ( ) ; print ( input ( ) . replace ( s , " " ) ) NEW_LINE
|
T93 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | X = input ( ) NEW_LINE s = [ str ( _ ) for _ in input ( ) ] NEW_LINE Res = [ ] NEW_LINE for i in s : NEW_LINE INDENT if X == i : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT Res . append ( i ) NEW_LINE DEDENT DEDENT print ( " " . join ( Res ) ) NEW_LINE
|
T94 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStre... | import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE c = input ( ) . rstrip ( ) NEW_LINE s = input ( ) . rstrip ( ) NEW_LINE print ( s . replace ( c , " " ) ) NEW_LINE
|
T95 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | X = input ( ) NEW_LINE s = input ( ) NEW_LINE result = " " . join ( [ c for c in s if c not in X ] ) NEW_LINE print ( result ) NEW_LINE
|
T96 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | x , c = input ( ) , input ( ) NEW_LINE ans = " " NEW_LINE for i in range ( len ( c ) ) : NEW_LINE INDENT if c [ i ] != x : ans += c [ i ] NEW_LINE DEDENT print ( ans ) NEW_LINE
|
T97 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | s = input ( ) ; print ( input ( ) . replace ( s , " " ) ) NEW_LINE
|
T98 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | X = input ( ) NEW_LINE s = [ str ( _ ) for _ in input ( ) ] NEW_LINE Res = [ ] NEW_LINE for i in s : NEW_LINE INDENT if X == i : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT Res . append ( i ) NEW_LINE DEDENT DEDENT print ( " " . join ( Res ) ) NEW_LINE
|
T99 | 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 . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE c = input ( ) . rstrip ( ) NEW_LINE s = input ( ) . rstrip ( ) NEW_LINE print ( s . replace ( c , " " ) ) NEW_LINE
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.