using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace GreenBin
{
class Program
{
static void Main ( string [ ] args )
{
int n = int . Parse ( Console. ReadLine ( ) ) ;
List < string > strList = new List < string > ( ) ;
bool OkCount = false ;
string nst = string . Empty;
byte [ ] arr = null ;
int ans = 0 ;
List < string > list = new List < string > ( ) ;
StringComparer com = StringComparer. OrdinalIgnoreCase;
for ( int i = 0 ; i < n ; i ++ )
{
strList. Add ( Console. ReadLine ( ) ) ;
}
strList. Sort ( ) ;
foreach ( var s in strList)
{
int a = strList. Where ( m => m. Equals ( s) ) . Count ( ) ;
ans += a ;
}
Console. Write ( ans) ;
Console. ReadKey ( true ) ;
// 解法:2
//foreach (var str in strList)
//{
// string[] clist = new string[10];
// for (int i = 0; i < str.Length; i++)
// {
// clist[i] = str[i].ToString();
// }
// StringBuilder cc = new StringBuilder();
// Array.Sort(clist, com);
// foreach (var c in clist)
// {
// cc.Append(c);
// }
// int a = list.Where(m => m.Equals(cc.ToString())).Count();
// ans += a;
// list.Add(cc.ToString());
//}
//Console.Write(ans);
//Console.ReadKey(true);
// 解法:1
//for (int i = 0; i < strList.Count; i++)
//{
// for (int j = i + 1; j < strList.Count; j++)
// {
// foreach (var cr in strList[i])
// {
// if (!strList[j].Contains(cr))
// {
// OkCount = false;
// break;
// }
// else
// {
// OkCount = true;
// }
// }
// if (OkCount)
// {
// ans++;
// }
// OkCount = false;
// }
//}
//Console.Write(ans);
//Console.ReadKey(true);
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace TakahashiCalender
{
class Program
{
static void Main ( string [ ] args )
{
int d1 = 0 ;
int d10 = 0 ;
int month = 0 ;
int day = 0 ;
string [ ] dataList = Console. ReadLine ( ) . Split ( ' ' ) ;
month = int . Parse ( dataList[ 0 ] ) ;
day = int . Parse ( dataList[ 1 ] ) ;
int count = 0 ;
string dd = null ;
for ( int i = 22 ; i <= day ; i ++ )
{
dd = i. ToString ( ) ;
d1 = int . Parse ( dd[ 1 ] . ToString ( ) ) ;
d10 = int . Parse ( dd[ 0 ] . ToString ( ) ) ;
if ( d1 >= 2 && d10 >= 2 )
{
for ( int j = 4 ; j <= month ; j ++ )
{
if ( j == d1 * d10 )
{
count ++ ;
}
}
}
}
Console. WriteLine ( count) ;
Console. ReadKey ( ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace HonestOrUnkind
{
class Program
{
static void Main ( string [ ] args )
{
// 変数宣言
int allHumanNo = 0 ;
int humanNo = 0 ;
string [ ] testimony ;
int testimony1 = 0 ;
int testimony2 = 0 ;
allHumanNo = int . Parse ( Console. ReadLine ( ) ) ;
for ( int i = 0 ; i < allHumanNo ; i ++ )
{
humanNo = int . Parse ( Console. ReadLine ( ) ) ;
for ( int j = 0 ; j < humanNo ; j ++ )
{
Human a = new Human( ) ;
testimony = Console. ReadLine ( ) . Split ( ' ' ) ;
testimony1 = int . Parse ( testimony[ 0 ] ) ;
testimony2 = int . Parse ( testimony[ 1 ] ) ;
a. HumanNo = testimony1 ;
a. IsHonest = testimony2 ;
}
}
}
}
class Human
{
public Human ( )
{
}
public int HumanNo { get ; set ; }
public int IsHonest { get ; set ; }
public int testimony1 { get ; set ; }
public int testimony2 { get ; set ; }
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace DoubleFactorial
{
class Program
{
static void Main ( string [ ] args )
{
long n = long . Parse ( Console. ReadLine ( ) ) ;
long ans = n;
long c = n;
long count = 0 ;
while ( c > 0 )
{
c = c - 2 ;
if ( c < 1 )
{
break ;
}
ans = ans * c ;
}
for ( int i = ans. ToString ( ) . Length - 1 ; i >= 0 ; i -- )
{
if ( ans. ToString ( ) [ i] == '0' )
{
count ++ ;
}
else
{
break ;
}
}
Console. Write ( count) ;
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace November30
{
class Program
{
static void Main ( string [ ] args )
{
string [ ] preDate = Console. ReadLine ( ) . Split ( ' ' ) ;
string [ ] nextDate = Console. ReadLine ( ) . Split ( ' ' ) ;
var a = new DateTime( 2019 , int . Parse ( preDate[ 0 ] ) , int . Parse ( preDate[ 1 ] ) ) ;
var b = new DateTime( 2019 , int . Parse ( nextDate[ 0 ] ) , int . Parse ( nextDate[ 1 ] ) ) ;
if ( a. CompareTo ( b) == - 1 )
{
if ( nextDate[ 1 ] == " 1" )
{
Console. WriteLine ( " 1" ) ;
}
else
{
Console. WriteLine ( " 0" ) ;
}
}
else
{
Console. WriteLine ( " 0" ) ;
}
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace MonstersBattleRoyale
{
class Program
{
static void Main ( string [ ] args )
{
int N = int . Parse ( Console. ReadLine ( ) . ToString ( ) ) ;
string [ ] a = Console. ReadLine ( ) . Split ( ' ' ) ;
int shortLife = 0 ;
int longLife = 0 ;
List < int > monsters = new List < int > ( ) ;
foreach ( var str in a)
{
monsters. Add ( int . Parse ( str) ) ;
}
for ( int i = 0 ; i < monsters. Count; i ++ )
{
for ( int j = 0 ; j < i ; j ++ )
{
if ( monsters[ i] > monsters[ j] )
{
longLife = monsters[ i] ;
shortLife = monsters[ j] ;
}
else if ( monsters[ j] > monsters[ i] )
{
longLife = monsters[ j] ;
shortLife = monsters[ i] ;
}
else
{
break ;
}
int d = 0 ;
while ( longLife > shortLife )
{
longLife -= shortLife ;
}
}
}
Console. Write ( " " ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace AddSurplus
{
class Program
{
static void Main ( string [ ] args )
{
int a = int . Parse ( Console. ReadLine ( ) ) ;
int b = int . Parse ( Console. ReadLine ( ) ) ;
int sum = 0 ;
for ( int i = a; i < b ; i ++ )
{
if ( i % 5 == 2 || i % 5 == 4 )
{
sum += i ;
}
}
Console. Write ( sum) ;
Console. ReadKey ( true ) ;
}
}
}
using System;
namespace _99
{
class Program
{
static void Main ( string [ ] args )
{
int a = 0 ;
int b = 0 ;
try
{
string [ ] splitStrings = Console. ReadLine ( ) . ToString ( ) . Split ( ' ' ) ;
a = int . Parse ( splitStrings[ 0 ] ) ;
b = int . Parse ( splitStrings[ 1 ] ) ;
}
catch ( Exception e )
{
string errorMessage = e. Message;
Console. WriteLine ( errorMessage) ;
}
int ans = 0 ;
if ( a > 9 || a < 1 || b < 1 || b > 9 )
{
ans = - 1 ;
}
else
{
ans = a * b ;
}
Console. Write ( ans) ;
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace BrickBreak
{
class Program
{
static void Main ( string [ ] args )
{
int n = int . Parse ( Console. ReadLine ( ) ) ;
string [ ] strBricks = Console. ReadLine ( ) . Split ( ' ' ) ;
int brick = 0 ;
int nextBrick = 1 ;
int countBreak = 0 ;
for ( int i = 0 ; i < n ; i ++ )
{
brick = int . Parse ( strBricks[ i] ) ;
if ( brick == nextBrick )
{
nextBrick ++ ;
}
else
{
countBreak ++ ;
}
}
if ( nextBrick == 1 )
{
Console. Write ( - 1 ) ;
}
else
{
Console. Write ( countBreak) ;
}
Console. ReadKey ( true ) ;
}
}
}
WalkOnMultiplicationTable
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace WalkOnMultiplicationTable
{
class Program
{
static void Main ( string [ ] args )
{
long n = long . Parse ( Console. ReadLine ( ) ) ;
long tmp = 0 ;
long ans = n;
for ( long i = 1 ; i <= Math. Sqrt ( n) ; i ++ )
{
if ( n % i == 0 )
{
long j = n / i ;
tmp = ( i - 1 ) + ( j - 1 ) ;
if ( ans > tmp )
{
ans = tmp ;
}
}
}
Console. WriteLine ( ans) ;
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace _81
{
class Program
{
static void Main ( string [ ] args )
{
int n = int . Parse ( Console. ReadLine ( ) ) ;
string ans = " No" ;
for ( int i = 0 ; i < 10 ; i ++ )
{
for ( int j = 0 ; j < 10 ; j ++ )
{
if ( n == i * j )
{
ans = " Yes" ;
break ;
}
}
}
Console. WriteLine ( ans) ;
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace CantWaitForHoliday
{
class Program
{
static void Main ( string [ ] args )
{
string day = Console. ReadLine ( ) ;
string [ ] s = { " SUN" , " MON" , " TUE" , " WED" , " THU" , " FRI" , " SAT" } ;
int i = 0 ;
int count = 0 ;
bool flg = false ;
while ( true )
{
if ( i > 6 )
{
i = 0 ;
}
if ( flg)
{
count ++ ;
if ( i == 0 )
{
break ;
}
}
if ( s[ i] == day )
{
flg = true ;
}
i ++ ;
}
Console. WriteLine ( count) ;
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace GrandGarden
{
class Program
{
static void Main ( string [ ] args )
{
int N = int . Parse ( Console. ReadLine ( ) ) ;
string [ ] strList = Console. ReadLine ( ) . Split ( ' ' ) ;
List < int > flower = new List < int > ( ) ;
foreach ( var str in strList)
{
flower. Add ( int . Parse ( str) ) ;
}
int roundCount = 0 ;
int dividedCount = 0 ;
bool wateringFlg = false ;
int flowerMaxValue = flower. Max ( ) ;
while ( flowerMaxValue > 0 )
{
wateringFlg = false ;
for ( int i = 0 ; i < flower. Count; i ++ )
{
if ( flower[ i] - roundCount > 0 )
{
if ( i > 0 && flower[ i - 1 ] - roundCount <= 0 && wateringFlg )
{
dividedCount ++ ;
}
else
{
wateringFlg = true ;
}
}
}
roundCount ++ ;
flowerMaxValue -- ;
}
Console. Write ( roundCount + dividedCount ) ;
Console. ReadKey ( ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace CardGameEasy
{
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
class Program
{
static void Main ( string [ ] args )
{
string sa = Console. ReadLine ( ) ;
string sb = Console. ReadLine ( ) ;
string sc = Console. ReadLine ( ) ;
int countA = 0 ;
int countB = 0 ;
int countC = 0 ;
char answer = 'a' ;
bool endFlg = false ;
string endAns = " A" ;
while ( ! endFlg )
{
if ( answer == 'a' )
{
if ( countA >= sa. Count ( ) )
{
endFlg = true ;
endAns = " A" ;
break ;
}
answer = sa[ countA] ;
countA ++ ;
}
else if ( answer == 'b' )
{
if ( countB >= sb. Count ( ) )
{
endFlg = true ;
endAns = " B" ;
break ;
}
answer = sb[ countB] ;
countB ++ ;
}
else if ( answer == 'c' )
{
if ( countC >= sc. Count ( ) )
{
endFlg = true ;
endAns = " C" ;
break ;
}
answer = sc[ countC] ;
countC ++ ;
}
}
Console. Write ( endAns) ;
Console. ReadKey ( ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace EqualWeight
{
class Program
{
static void Main ( string [ ] args )
{
string [ ] quantityOfdataNM = Console. ReadLine ( ) . Split ( ' ' ) ;
string [ ] dataAList = Console. ReadLine ( ) . Split ( ' ' ) ;
string [ ] dataBList = Console. ReadLine ( ) . Split ( ' ' ) ;
int quantityN = int . Parse ( quantityOfdataNM[ 0 ] ) ;
int quantityM = int . Parse ( quantityOfdataNM[ 1 ] ) ;
int dataA1 = 0 ;
int dataB1 = 0 ;
int dataA2 = 0 ;
int dataB2 = 0 ;
int notEqual = - 1 ;
bool endLoop = false ;
for ( int i = 0 ; i < quantityN ; i ++ )
{
if ( endLoop)
{
break ;
}
dataA1 = int . Parse ( dataAList[ i] ) ;
for ( int i2 = quantityN - 1 ; i2 != i ; i2 -- )
{
if ( endLoop)
{
break ;
}
if ( i == i2 )
{
continue ;
}
dataA2 = int . Parse ( dataAList[ i2] ) ;
for ( int j = 0 ; j < quantityM ; j ++ )
{
if ( endLoop)
{
break ;
}
dataB1 = int . Parse ( dataBList[ j] ) ;
for ( int j2 = 0 ; j2 < quantityM ; j2 ++ )
{
if ( j == j2 )
{
continue ;
}
dataB2 = int . Parse ( dataBList[ j2] ) ;
if ( dataA1 + dataB1 == dataA2 + dataB2 )
{
dataA1 = i ;
dataA2 = i2 ;
dataB1 = j ;
dataB2 = j2 ;
endLoop = true ;
break ;
}
}
}
}
}
if ( endLoop)
{
Console. Write ( string . Format ( " {0} {1} {2} {3}" , dataA1, dataB1, dataA2, dataB2) ) ;
}
else
{
Console. Write ( notEqual) ;
}
Console. ReadKey ( true ) ;
}
}
}
using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
using System. Threading. Tasks;
namespace SuperFizzBuzz
{
class Program
{
static void Main ( string [ ] args )
{
int n = int . Parse ( Console. ReadLine ( ) ) ;
Dictionary < int , string > a = new Dictionary < int , string > ( ) ;
int [ ] alfabet = { 2 , 3 , 4 , 5 , 6 } ;
string [ ] strAlfabet = { " a" , " b" , " c" , " d" , " e" } ;
bool flg = false ;
for ( int i = 1 ; i <= n ; i ++ )
{
for ( int j = 0 ; j < alfabet. Length; j ++ )
{
if ( i % alfabet[ j] == 0 )
{
Console. Write ( strAlfabet[ j] ) ;
flg = true ;
}
}
if ( ! flg )
{
Console. Write ( i) ;
}
Console. Write ( " \n " ) ;
flg = false ;
}
Console. ReadKey ( true ) ;
}
}
}