description stringlengths 35 9.39k | solution stringlengths 7 465k |
|---|---|
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | l=[0]*150
a,b,c=input().split()
l[ord(a[1])]+=1
l[ord(b[1])]+=1
l[ord(c[1])]+=1
var={}
var[1]=0
for i in range(120):
if i==115:
if var[1]<l[i]:
var[1]=l[i]
var[2]='s'
if i==112:
if var[1]<l[i]:
var[1]=l[i]
var[2]='p'
if... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a=input().split()
a.sort()
flag1=3
if(a[0]==a[1] and a[1]==a[2]):
flag1=0
elif(a[0]==a[1]):
flag1=1
elif(a[1]==a[2]):
flag1=1
else:
flag1=2
flag2=3
if(a[0][1]==a[1][1] and a[1][1]==a[2][1]):
if(int(a[1][0])-int(a[0][0])==1 and int(a[2][0])-int(a[1][0])==1):
flag2=0
elif(int(a[1][0])-int(... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from collections import defaultdict
sa = input().split()
groups = defaultdict(list)
for el in sa:
groups[el[-1]].append(int(el[0]))
test_arrays = []
for i in range(1, 8):
test_arrays.append([i, i+1, i+2])
min_card = 2
for elements in groups.values():
els = sorted(elements)
for i in range(1, 10):
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | A = input().split()
p = [0] * 10
s = [0] * 10
m = [0] * 10
#ๅปๅญใไฝใใฎใซไฝๆใใใ
for i in A:
if i[1] == 'p':
p[int(i[0])] += 1
elif i[1] == 's':
s[int(i[0])] += 1
elif i[1] == 'm':
m[int(i[0])] += 1
ans1 = max(max(s), max(m), max(p))
ans2 = 0
for x in p, s, m:
for i in range(1, 8):
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s = input().split()
b = []
b.append((s[0][1], int(s[0][0])))
b.append((s[1][1], int(s[1][0])))
b.append((s[2][1], int(s[2][0])))
b.sort()
if (b[0][0] == b[1][0] and b[1][0] == b[2][0]):
if (b[0] == b[1] and b[1] == b[2]):
print(0)
elif (b[0][1] + 1 == b[1][1] and b[1][1] + 1 == b[2][1]):
print(0... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a_, long long b_) {
if (b_ > a_) swap(b_, a_);
return (b_ == 0 ? a_ : gcd(b_, a_ % b_));
}
int n, arr[15][10];
char c;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(NULL);
for (long long i = 0; i < 3; i++) {
cin >> n... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import math
import sys
import collections
# imgur.com/Pkt7iIf.png
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
d = sorted(input().split())
n = sorted([int(x[0]) for x in d])
m = sorted([x[1] for x in d])
dic = {'s':[], 'p':[], 'm':[]}
for... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
string s[3];
bool isShun1(int i, int j) {
return (s[i][1] == s[j][1] && s[i][0] == s[j][0] - 1);
}
bool isShun2(int i, int j) {
return (s... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | n1, n2, n3 = input().split()
n1, n2, n3 = sorted([n1, n2, n3])
if ord(n1[1]) == ord(n2[1]) == ord(n3[1]):
if n1 == n2 == n3 or (int(n1[0]) + 2 == int(n2[0]) + 1 == int(n3[0])):
print(0)
else:
if n1[1] == n2[1] or n2[1] == n3[1] or n1[1] == n3[1]:
if n1 == n2 or n2 == n3 or int(n1[0])... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a=map(str,raw_input().split())
m=[0 for i in range(9)]
p=[0 for i in range(9)]
s=[0 for i in range(9)]
for i in a:
if i[1]=='m':
m[int(i[0])-1]+=1
elif i[1]=="p":
p[int(i[0])-1]+=1
else:
s[int(i[0])-1]+=1
ans=2
con=0
con1=0
k=0
for i in m:
k+=1
if i==3:
ans=0
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | while True:
try:
a,b,c=map(str,input().split())
lis = a+b+c
teli=[a,b,c]
teli.sort()
#print(teli)
d1=int(teli[1][0])-int(teli[0][0])
d2=int(teli[2][0])-int(teli[1][0])
d3=int(teli[2][0])-int(teli[0][0])
flag, end = False, False
if((d1==... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... |
a=[[],[],[]]
s=input().split(" ")
for i in range(len(s)):
if(s[i][1]=='m'):
a[0].append(int(s[i][0]))
elif(s[i][1]=='p'):
a[1].append(int(s[i][0]))
else:
a[2].append(int(s[i][0]))
ko=10
for i in range(len(a)):
a[i]=sorted(a[i])
c=0
for j in range(1,len(a[i])):
if(a[i][j]==a[i][j-1]):
c+=1
if(c=... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | t = input().split()
t.sort()
if t.count(t[0]) == 3:
print('0')
elif t.count(t[0]) == 2 or t.count(t[1]) == 2:
print('1')
else:
num = list(map(int, [t[0][0], t[1][0], t[2][0]]))
suit = [t[0][1], t[1][1], t[2][1]]
if len(set(suit)) == 3:
print('2')
elif len(set(suit)) == 1:
if num[1] == num[0] + 1 o... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | i = input().split()
sets = {"m": [],
"p": [],
"s": []}
def check(n):
m = sets[n]
m.sort()
mmin = 2
for n in range(1, len(m)):
if m.__contains__(m[n]-1) and m.__contains__(m[n]-2):
mmin = min(0, mmin)
elif m.__contains__(m[n]-1) or m.__contains__(m[n]-2):
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import sys
tiles = sys.stdin.read().split()
numbers = [int(tile[0]) for tile in tiles]
letters = [tile[1] for tile in tiles]
def two(i1, i2):
if numbers[i1] == numbers[i2]:
return 1
difference = abs(numbers[i1] - numbers[i2])
if difference == 1 or difference == 2:
return 1
return 2
d... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from collections import Counter
s=input().split()
c=Counter(s)
# print(c[])
mini=max(list(c.values()))
# print(list(c.values()))
if max(list(c.values()))>=3:
print(0)
else:
su,m,p=[],[],[]
for i in s:
if i[1]=='p':
p.append(int(i[0]))
elif i[1]=='s':
su.append(int(i[0]))
else:
m.append(int(i[0]))
su.... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
public class codeforces{
public static int batabc(int[][] XD){
int max=0;
for(int i=0;i<9;i++){
for(int j=0;j<3;j++)
max=Math.max(ma... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())
P = lambda x: stdout.write(str(x)+" ")
st = raw_input().split()
p,m,s = [],[],[]
for i in st:
if i[1] == 'm':
m.append(int(i[0]))
elif i[1] == 'p':
p.append(int(i[0]))
if i[1] == 's':
s.append(int(i[0]))
k,sh,sh2 = 0,0,0
p.sort()
m.... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #!/usr/bin/env python3
import sys
def rint():
return map(int, sys.stdin.readline().split())
#lines = stdin.readlines()
def is_koutsu():
if si[0] == si[1] and si[1] == si[2]:
if sc[0] == sc[1] and sc[1] == sc[2]:
return True
return False
def is_shuntsu():
tmp = sorted(si)
if s... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a, b, c = input().split()
n = [a[0], b[0], c[0]]
s = [a[1], b[1], c[1]]
if len(set(s)) == 1 and (len(set(n)) == 1 or "".join(sorted(n)) in "123456789"):
print(0)
else:
a = 0
for i in range(3):
# print((abs(int(n[i]) - int(n[(i+1)%2]))))
if s[i] == s[(i+1)%3] and (abs(int(n[i]) - int(n[(i+1... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a,b,c=input().split()
a,b,c=sorted([a,b,c])
A=[a,b,c]
A=set(A)
if len(A)==1:
print(0)
exit()
if len(A)==2:
print(1)
exit()
if a[1]==b[1]and b[1]==c[1]:
if a[0]==b[0] and b[0]==c[0]:
print(0)
elif int(b[0])==int(a[0])+1 and int(c[0])==int(b[0])+1:
print(0)
elif int(b[0])==int(... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | A=input().split(' ')
s=[0]*10
p=[0]*10
m=[0]*10
for item in A:
inte=int(item[0])
if(item[1]=='s'):
s[inte]+=1
elif(item[1]=='p'):
p[inte]+=1
elif(item[1]=='m'):
m[inte]+=1
req=3
ans=3
for i in range (1,10):
req=3-s[i]
if(req<ans):
ans=req
req=3-p[i]
if(req... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import sys
import math
from collections import defaultdict,deque
input = sys.stdin.readline
def inar():
return [int(el) for el in input().split()]
def main():
a,b,c=input().split()
if a[1]==b[1]==c[1]:
lol=[int(a[0]),int(b[0]),int(c[0])]
lol.sort()
if (lol[0]+1==lol[1] and lol[1]+1=... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a,b,c=input().split(" ")
anum=int(a[0])
achar=a[1]
bnum=int(b[0])
bchar=b[1]
cnum=int(c[0])
cchar=c[1]
arr=[]
arr.append(a)
arr.append(b)
arr.append(c)
acount=arr.count(a)
bcount=arr.count(b)
ccount=arr.count(c)
arval=[]
arval.append(anum)
arval.append(bnum)
arval.append(cnum)
archar=[]
archar.append(achar)
archar.appe... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | strings = list(map(str, input().split()))
s1, s2, s3 = strings[0], strings[1], strings[2]
check = {'m': [], 'p': [], 's': []}
check[s1[1]].append(int(s1[0]))
check[s2[1]].append(int(s2[0]))
check[s3[1]].append(int(s3[0]))
check['m'].sort()
check['p'].sort()
check['s'].sort()
cm, cp, cs = len(check['m']), len(check['... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | def ism(a, b, c):
return a==b and b==c
def isk(a, b, c):
x = [a, b, c]
x.sort()
if x[0][1] == x[1][1] and x[1][1] == x[2][1]:
if int(x[0][0])+1 == int(x[1][0]) and int(x[1][0])+1 == int(x[2][0]):
return 1
return 0
a, b, c = input().split()
x = [a,b,c]
typem = []
types = []
type... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparat... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | # your code goes here
tiles = input().split(' ')
tiles.sort()
ans = 2
sq = 0
if (tiles[0] == tiles[1] and tiles[1] == tiles[2]):
ans = 0
elif (tiles[0] != tiles[1] and tiles[1] != tiles[2]):
if(tiles[0][1] == tiles[1][1]):
if(int(tiles[0][0]) >= int(tiles[1][0]) - 2):
ans = 1
if(int(tiles[0][0]) == int(tiles... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | /*
* @author derrick20
*/
import java.io.*;
import java.util.*;
public class mahjong {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
StringTokenizer st = new StringTokenizer(sc.nextLine());
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a = input().split()
r = 2
for i in range(48,58):
for c in "mps":
r = min(r,max(0,3-a.count(chr(i)+c)))
r = min(r,3-(chr(i-1)+c in a)-(chr(i)+c in a)-(chr(i+1)+c in a))
print(r)
|
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
const long long mx = 1e6 + 9;
const long long inf = 1e18 + 9;
long long A[mx], B[mx], freq[mx], fr[mx];
vector<pair<long long, long long> > vp1, vp2;
vector<long long> v1;
vector<char> v2;
bool sign[mx];
map<char, bool> mp;
int32_t main() {
long long n = 0, m = 0, k = 0, ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import sys,math
def read_int():
return int(sys.stdin.readline().strip())
def read_int_list():
return list(map(int,sys.stdin.readline().strip().split()))
def read_string():
return sys.stdin.readline().strip()
def read_string_list(delim=" "):
return sys.stdin.readline().strip().split(delim)
def print... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s=list(map(str,input().split()))
arr=[]
for i in range(3):
arr.append([])
d={}
for i in s:
if i in d:
d[i]+=1
else:
d[i]=1
if i[1]=='m':
arr[0].append(int(i[0]))
elif i[1]=='p':
arr[1].append(int(i[0]))
else:
arr[2].append(int(i[0]))
ans=len(d)-1
# print(ans)
# print(arr)
for i in range(3):
b=set()
f... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
map<string, int> m;
int main() {
string s;
string b[4];
int ind = 0;
for (int i = 1; i <= 3; i++) {
string a;
cin >> a;
b[i] = a;
if (i > 1) {
if (a != s) ind = 1;
}
m[a]++;
s = a;
}
if (ind == 0) {
cout << 0;
return 0;
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
int inf = 100000000;
long long INF = 4000000000000000000;
long long MOD = 1000000007;
int main() {
vector<string> s(3);
vector<int> a(3);
for (int(i) = 0; (i) < (3); (i)++) cin >> s.at(i);
sort(s.begin(), s.end());
for (int(i) = 0; (i) < (3); (i)++) a.at(i) = s.at... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | # ========= /\ /| |====/|
# | / \ | | / |
# | /____\ | | / |
# | / \ | | / |
# ========= / \ ===== |/====|
# code
if __name__ == "__main__":
s = [[],[],[]]
st = list(input().split())
for i in st:
if i[1]... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | //package codeforces;
import java.util.Scanner;
public class ex5 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String S [] = new String[3];
int m=0,s=0,p=0;
int temp=0;
for (int i = 0; i < S.length; i++) {
S[i]=scan.next();
if(S[i].indexOf('m')!=-1) m++;
if(S[i].indexO... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a, b, c = map(str, input().split())
d = []
for i in range(3):
d.append([0] * 9)
def f(k):
if k[1] == 'm':
d[0][int(k[0]) - 1] += 1
elif k[1] == 'p':
d[1][int(k[0]) - 1] += 1
else:
d[2][int(k[0]) - 1] += 1
f(a)
f(b)
f(c)
min_m = 2
z = 0
for i in d:
z = max(z, max(i))
if z == ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s=list(input().split())
s=sorted(s)
if(len(set(s))==1):
print("0")
elif(s[0][1]==s[1][1] and s[1][1]==s[2][1] and int(s[1][0])-int(s[0][0])==1 and int(s[2][0])-int(s[1][0])==1):
print("0")
elif(len(set(s))==2):
print("1")
elif(s[0][1]==s[1][1] and (int(s[1][0])-int(s[0][0])==1 or int(s[1][0])-int(s[0][0])... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.*;
import java.util.*;
import java.lang.*;
public class c1 {
public static MyScanner scan;
public static PrintWriter out;
public static void main(String[] args) {
scan=new MyScanner();
out=new PrintWriter(new BufferedOutputStream(System.out));
int t=1;
// int ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long powmod(long long a, long long l, long long md) {
long long res = 1;
while (l) {
if (l & 1) res = res * a % md;
l /= 2;
a = a * a % md;
}
return res;
}
long long binpow(long long a, long long l) {
long long res = 1;
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.*;
import java.util.*;
public class Main {
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer(br.readL... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | # coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
readl= lambda: list(map(str, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.s... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | la = sorted(input().split())
res = 2
if int(la[0][0]) == int(la[1][0]) - 1 == int(la[2][0]) - 2:
if la[0][1] == la[1][1] == la[2][1]:
res = 0
elif la[0][1] == la[1][1] or la[1][1] == la[2][1] or la[0][1] == la[2][1]:
res = 1
elif la[0][0] == la[1][0] == la[2][0]:
if la[0][1] == la[1][1] == l... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s = list(map(str,input().split()))
ans = 10**18
for i in map(str,range(1,10)):
for p in ('m', 'p', 's'):
k = s.count(i+p)
if 3-k < ans:
ans = 3-k
for i in range(1,8):
for p in ('m', 'p', 's'):
k = 0
if str(i)+p in s:
k += 1
if str(i+1)+p in s:
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a = (input().split())
a.sort()
#print(a)
if(a[0] == a[1] == a[2]):
print(0)
exit()
elif(a[0] == a[1] or a[1] == a[2]):
print(1)
exit()
a1 = []
for i in range(3):
a1.append([int(a[i][0]), a[i][1]])
a1.sort()
#print(a1)
if(a1[1][1] == a1[2][1] == a1[0][1]):
if(a1[0][0] == a1[1][0] - 1 and a1[... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from collections import Counter, defaultdict
l=raw_input().split()
d=defaultdict(Counter)
mx=0
for i in l:
#print i[1],i[0]
d[i[1]][int(i[0])]+=1
mx=max(mx,d[i[1]][int(i[0])])
if d[i[1]][int(i[0])]==3:
print 0
exit()
ans=1000
for i in 'abcdefghijklmnopqrstuvwxyz':
for j in range(1,8)... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | data = input().split()
z, a = [], []
for i in range(3):
a.append(int(data[i][0]))
z.append(data[i][1])
if all(data[0] == data[i] for i in range(3)):
print(0)
elif data[0] == data[1] or data[1] == data[2] or data[0] == data[2]:
print(1)
else:
k = sorted(a)
if z[0] == z[1] == z[2] and k[0] == k[1]... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... |
b=list(input().split())
s,p,m,g=[],[],[],[]
for i in range(len(b)):
if b[i][1]=="s":
s.append(b[i][0])
if b[i][1]=="p":
p.append(b[i][0])
if b[i][1]=="m":
m.append(b[i][0])
s=list(map(int,s))
m=list(map(int,m))
p=list(map(int,p))
if len(s)==1:
g.append(2)
else:
l=1
s.sort()
for i in range(len(s)-1):
if ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
string s[2000];
int main() {
cin >> s[0] >> s[1] >> s[2];
sort(s, s + 3);
if (s[0] == s[1] && s[1] == s[2]) {
cout << 0 << endl;
return 0;
}
if (s[0][1] == s[1][1] && s[1][1] == s[2][1]) {
if (s[1][0] - s[0][0] == 1 && s[2][0] - s[1][0] == 1) {
c... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s = list(map(str,input().split()))
for i in range(0,len(s)):
s[i] = s[i][::-1]
s = sorted(s)
for i in range(0,len(s)):
s[i] = s[i][::-1]
for i in range(0,len(s)-2):
if s[i]==s[i+1]==s[i+2]:
print(0)
exit(0)
elif (ord(s[i][0])+2 == ord(s[i+1][0])+1 == ord(s[i+2][0])) and s[i][1]==s[i+1][1... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long i, l, j, m, n, k;
string a, b, c;
cin >> a >> b >> c;
if (a == b && b == c) {
cout << 0;
return 0;
}
if (a[1] == b[1] && b[1] == c[1]) {
long long s[3];
s[0] = a[0] - '0';
s[1] = b[0] - '0';
s[2] = c[0] - '0';
s... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... |
import java.util.*;
import java.lang.*;
import java.io.*;
public class GFG
{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
//int n = sc.nextInt();
String[] a =new String[3];
a[0] = sc.next();
a[1] = sc.next();
a[2] = sc.next();
int[] m = new int[10];
i... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | x,y,z = input().split()
v = list((x,y,z))
v.sort()
#print(v)
a = int(v[0][0])
b = int(v[1][0])
c = int(v[2][0])
l = v[0][1]
m = v[1][1]
n = v[2][1]
#print(a,b,c,l,m,n)
if x==y and y==z:
print(0)
elif x==y and y!=z or x==z and y!=z or y==z and x!=z:
print(1)
else:
if l==m and m==n:
if b==a+1 and... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] strs = br.readLine().split("\\... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int inf = 1e9 + 1;
const int prime_100000000 = 5761460;
const double eps = 1e-15;
const double EPS = 1e-9;
const double PI = acos(-1.0);
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long lcm(lo... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from collections import defaultdict
def is123(List):
List.sort()
if(List[1]-List[0]==1 and List[2]-List[1]==1):
return True
else:
return False
def is139(List):
List.sort()
if(List[1]-List[0]<=2 or List[2]-List[1]<=2):
return True
return False
def is1123(List):
List.so... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.*;
import java.util.*;
public class R573B {
public static void main(String[] args) {
JS scan = new JS();
int[][] type = new int[4][10];
//s = 1
//m = 2
//p = 3;
for(int i = 0;i<3;i++){
Arrays.fill(type[i],0);
}
for(int i = 0;i<3;i++){
String s = scan.next();
int num = s.charAt... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a = input().split()
r = 2
for x in a:
r = min(r,max(0,3-a.count(x)))
r = min(r,(not x.replace(x[0],chr(ord(x[0])+1),1) in a)+(not x.replace(x[0],chr(ord(x[0])+2),1) in a))
r = min(r,(not x.replace(x[0],chr(ord(x[0])-1),1) in a)+(not x.replace(x[0],chr(ord(x[0])+1),1) in a))
print(r)
|
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a = input().split()
b=[]
x = {'s':0,'m':0,'p':0}
for i in range (0,3):
b.append(int(a[i][0]))
x[a[i][1]] += 1
if int(a[0][0])> int(a[1][0]):
a[0],a[1]=a[1],a[0]
if int(a[1][0]) > int(a[2][0]) :
a[1],a[2]=a[2],a[1]
if int(a[0][0])> int(a[1][0]):
a[0],a[1]=a[1],a[0]
elif ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | st = input().split()
m = []
p = []
s = []
for i in range(len(st)):
if st[i][1] == 's':
s.append(int(st[i][0]))
elif st[i][1] == 'm':
m.append(int(st[i][0]))
else:
p.append(int(st[i][0]))
lst = [m, p, s]
a = m
for i in range(1, len(lst)):
if len(lst[i]) > len(a):
a = lst[i... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.*;
import java.util.*;
public class Alpha_Round {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
String[]... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
vector<string> v(3);
map<string, int> m;
for (int i = 0; i < 3; i++) cin >> v[i];
m[v[0]] = 1;
m[v[1]] = 1;
m[v[2]] = 1;
vector<int> ans;
for (int i = 0; i < 3; i++) {
int temp... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import sys
a,b,c=map(str,raw_input().split())
d={}
h={}
l=[a,b,c]
for i in xrange(len(l)):
key=l[i][1]
if key not in d:
d[key]=[int(l[i][0])]
else:
d[key].append(int(l[i][0]))
q=d.values()
ans=2
for i in xrange(len(q)):
u=q[i]
if len(u)==1:
ans=min(ans,2)
elif len... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | def issort(a,b,c):
l = [a,b,c]
l = sorted(l)
if l[1]-l[0] == 1 and l[2]-l[1]==1:
return 0
elif l[1]-l[0] == 1 or l[2]-l[1] == 1 or l[1]-l[0] == 2 or l[2]-l[1] == 2:
return 1
return 2
a,b,c = input().split()
rk = 2
if a==b==c:
rk =0
elif a == b or b==c or c==a:
rk=1
#print(rk)
a = str(a)
b = str(b)
c = str... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | cards = input().split(" ")
cards.sort()
cards = [(int(card[0]), card[1]) for card in cards]
if cards[0] == cards[1] and cards[0] == cards[2]:
koutsuCount = 0
elif cards[0] == cards[1] or cards[1] == cards[2]:
koutsuCount = 1
else:
koutsuCount = 2
if cards[0][1] == cards[1][1] and cards[0][1] == cards[2][... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | d = {}
for x, y in input().split():
d.setdefault(y,[]).append(int(x))
r = 2
for k in d:
a = sorted(d[k])
s = {y - x for x, y in zip(a, a[1:])}
if len(a) > 2 and s in ({0},{1}):
r = 0
if {0,1,2} & s:
r = min(r, 1)
print(r) |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | i = raw_input()
l = i.split(' ')
l.sort()
if(len(set(l))==1) :
print(0)
else :
num = [int(x[0],10) for x in l]
st = [x[1] for x in l]
if(len(set(st))==1) :
if(num[1]-num[0]==1 or num[2]-num[1]==1) :
if(num[1]-num[0]==1 and num[2]-num[1]==1) :
print(0)
else :
print(1)
else :
if(num[1]-num[0]==2... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | f= lambda c: 'mps'.index(c)
l= [[], [], []]
for c in input().split():
a, b= c
l[f(b)].append(int(a))
for i in range(3):
l[i].sort()
res= int(3)
for x in l:
if(len(x)==0):
continue
elif(len(x)==1):
res= min(res, 2)
elif(len(x)==3):
if(len(set(x))==1):
res= min(... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | '''input
3p, 6p, 7p
'''
def main():
a, b, c = input().split()
nums = sorted(list(map(int , [a[0], b[0], c[0]])))
chars = [a[1], b[1], c[1]]
tup = sorted(list(map(lambda x : (int(x[0]), x[1]), [a, b, c])), key = lambda x : x[0])
if(a == b and b == c):
return 0
if(nums[0] + 1 == nums[1] and nums[1] + 1 =... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from collections import defaultdict
def main():
# ****************************** Input *************************************
A=list(input().split())
# print(A)
# ****************************** Algorithm *********************************
B=sorted(A,key = lambda x : int(x[0]))
m=defaultdict(list)
fo... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s[3];
cin >> s[0] >> s[1] >> s[2];
if (s[0][0] > s[1][0]) swap(s[0], s[1]);
if (s[0][0] > s[2][0]) swap(s[0], s[2]);
if (s[1][0] > s[2][0]) swap(s[2], s[1]);
if (s[0] == s[1] and s[1] == s[2]) {
cout << 0;
return 0;
} else if (s[0] ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a = input().split()
p = []
m = []
s = []
for i in a:
n = int(i[0])
if i[1]=='p':
p.append(n)
elif i[1]=='m':
m.append(n)
else:
s.append(n)
for qq in (p,m,s):
if len(qq)>2:
sp = list(sorted(list(set(qq))))
if len(sp)==1:
print(0)
elif len(... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | input_ = input()
input_ =input_.split(" ")
arg1 = input_[0]
arg2 = input_[1]
arg3 = input_[2]
def calc(arg1, arg2, arg3):
if(arg1 == arg2):
if(arg1 == arg3):
return 0 # == all
# only 2 == 1
return 1
if(arg1==arg3):
return 1
if(arg2==arg3):
return 1... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class CF1191B {
public static void main(String[] args) {
FastReader input = new FastReader... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a,b,c=sorted(input().split())
v=2
if a==b==c:
v=0
elif a==b or a==c or b==c:
v=1
else:
x,y,z=int(a[0]),int(b[0]),int(c[0])
if a[1]==b[1]==c[1] and x+1==y and y+1==z:
v=0
elif (a[1]==b[1] and 0<y-x<3) or (a[1]==c[1] and 0<z-x<3) or (b[1]==c[1] and 0<z-y<3):
v=1
print(v)
|
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | from sys import stdin,stdout
from itertools import combinations
from collections import defaultdict,Counter
import math
import heapq
def listIn():
return list((map(int,stdin.readline().strip().split())))
def stringListIn():
return([x for x in stdin.readline().split()])
def intIn():
return (int(stdi... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s = input().split()
hand = {'m': [], 'p': [], 's':[]}
for item in s:
hand[item[1]].append(int(item[0]))
min_steps_needed = 10
for symb in ['m', 'p', 's']:
hand[symb] = sorted(hand[symb])
for start in range(1, 10):
a_needed = 10
b_needed = 10
a_needed = 3 - hand[symb].count(start)
b1, b2, b3 = 0, 0, 0
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #!/usr/bin/env python3
def main():
ans = 0
s = input().split()
s.sort()
# It contains koutsu
if s[0] == s[1] and s[1] == s[2]:
print(ans)
return
# It contains shuntsu
if s[0][1] == s[1][1] and s[1][1] == s[2][1]:
if int(s[2][0]) - int(s[1][0]) == 1 and int(s[1][0])... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())
def main():
cards = input().strip().split()
d = {c: [0] * 9 for c in 'smp'}
for card in cards:
num, suite = card[0], card[1]
num = int(num)
d[suite][num-1] += 1
mn = float('inf')
for l in d.values():
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | a,b,c=sorted(10*ord(y)+int(x)for x,y in input().split())
s={b-a,c-b}
print(2-bool(s&{0,1,2})-(s<{0,1})) |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | A=list(map(list,(list(input().split()))))
m=[]
p=[]
s=[]
for x,a in A:
if a=="m":
m.append(int(x))
elif a=="p":
p.append(int(x))
else:
s.append(int(x))
m.sort()
p.sort()
s.sort()
def check(x):
if len(x)==3:
if x[0]==x[1]==x[2]:
return 3
if ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Co... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 10000;
int a[3];
int main() {
string s;
for (int i = 0; i < 3; ++i) {
cin >> s;
a[i] = (s[0] - '0') + (s[1] - 'a') * 100;
}
sort(a, a + 3);
int t1 = a[1] - a[0], t2 = a[2] - a[1];
if (t1 == t2 && (t1 == 1 || t1 == 0))
puts("0");
el... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
char s1[20], s2[20], s3[20];
int ques(char a, char b, char c) {
if ((a - b == 1 && b - c == 1) || (a - c == 1 && c - b == 1) ||
(b - c == 1 && c - a == 1) || (b - a == 1 && a - c == 1) ||
(c - a == 1 && a - b == 1) || (c - b == 1 && b - a == 1))
return 1;
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b, c;
cin >> a >> b >> c;
char x = '1';
char y[3] = {'m', 'p', 's'};
map<string, int> ump;
for (int i = 0; i < 3; i++) {
string make = "";
make += y[i];
for (int j = 1; j <= 9; j++) {
make = (char)(j + '0') + make;
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | def for_k(l):
if not l:
return 3
d = []
for e in l:
d.append(l.count(e))
return max(3 - max(d), 0)
def for_s(l):
t = [0 for _ in range(9)]
if not l:
return 3
numbas = []
for e in l:
if e not in numbas:
numbas.append(int(e[0]))
if any(... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #Ashish Sagar
l=list(map(str,input().split()))
m=0
s=0
p=0
for i in range(3):
if l[i][1]=='s':
s+=1
elif l[i][1]=='m':
m+=1
else :
p+=1
if m==1 and p==1 and s==1:
print(2)
elif m==2:
a=[]
for i in range(3):
if l[i][1]=='m':
a.append(l[i][0])
a... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | n=input().split()
init=len(n)
m=set(n)
fg=0
final=len(m)
def checkConsecutive(l):
return sorted(l) == list(range(min(l), max(l)+1))
lst=[]
lst.append(int(n[0][0]))
lst.append(int(n[1][0]))
lst.append(int(n[2][0]))
if(n[0][1]==n[1][1] and n[1][1]==n[2][1] and checkConsecutive(lst)):
fg=0
elif(n[0][1]==n[1][1]... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import sys
raw = sys.stdin.readline()
# raw = open('input.txt', 'r').read().split('\n')[0]
tokens = raw.strip().split(' ')
by_type = {
'm': [t for t in tokens if t[1] == 'm'],
'p': [t for t in tokens if t[1] == 'p'],
's': [t for t in tokens if t[1] == 's'],
}
def answer_for_two(i1, i2):
if i1 > i2:
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | arr = list(map(lambda el: [int(el[0]), el[1]], input().split()))
sortt = sorted(arr, key=lambda el: el[0])
result = 2
for i in range(3):
cnt1 = 2
cnt2 = 2
base = sortt[i][0]
for y in range(i+1, 3):
if sortt[i][1] == sortt[y][1]:
if sortt[i][0] == sortt[y][0]:
cn... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
static char getSuit(String s) {
return s.charAt(1);
}
static int getNum(String s) {
return s.charAt(0) - '0';
}
static int equalSuits(String[] suit) {
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, d, e, f;
string a, b, c;
cin >> a >> b >> c;
d = a[0] - '0';
e = b[0] - '0';
f = c[0] - '0';
if (a == b && b == c && c == a) {
x = 0;
} else if ((a == b) || a == c || b == c) {
x = 1;
} else if ((a[1] == b[1] && abs(d - e) <= 2)... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | s = [x for x in input().split()]
n = len(s)
d = {}
for i in range(n):
if s[i][1] in d:
d[s[i][1]].append(s[i][0])
else:
d[s[i][1]] = [s[i][0]]
f = 1
for k in d.keys():
d[k].sort()
c = 0
if len(set(d[k])) == len(d[k])-2:
f = 0
print(0)
elif len(set(d[k])) == len(d[... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | m=[x for x in input().split()]
tiles=[[0 for i in range(9)] for j in range(3)]
for i in range(len(m)):
g=int(m[i][0])-1
h=(m[i][1])
if h=="m":
tiles[0][g]+=1
elif h=="p":
tiles[1][g]+=1
else:
tiles[2][g]+=1
if m[0]==m[1] and m[1]==m[2]:
print(0)
elif m[0]==m[1]:
p... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | x = []
x = input().split(" ")
x1, x2, x3 = [x[i] for i in range(len(x))]
newx = (sorted(x))
if x1 == x2 and x2 == x3:
print("0")
elif x1 == x2 or x1 == x3 or x2 == x3:
print("1")
else:
x1, x2, x3 = [newx[i] for i in range(len(newx))]
if x1[1] == x2[1] and x2[1] == x3[1] and abs(int(x1[0])-int(x2[0]))==1 and abs(in... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | t = input().split(" ")
b = []
for i in range(3):
b.append(t[i][1])
l2 = len(set(b))
b = list(set(b))
d = {}
for i in range(l2):
for j in range(3):
if b[i]==t[j][1]:
if b[i] not in d:
d[b[i]] = [int(t[j][0]),]
else:
d[b[i]].append(int(t[j][0]))
... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | tiles = input().split()
l = 0
s = 0
for i in tiles:
tmp = 0
for j in tiles:
if i == j:
tmp += 1
l = max(l, tmp)
for i in tiles:
for j in tiles:
for k in tiles:
ans = 1
if (i != j and j != k and i != k):
if (int(i[0]) == int(j[0]) + 2 and i[1] == j[1]):
ans += 1
if (int(i[0]) == int(k[0])... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.*;
import java.util.*;
public class B {
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static MyScanner sc = new MyScanner();
public static void main(String[] args) {
doTask();
out.flush();
}
static class Card {
Card(Integer ... |
Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from 1 to 9). In this problem, we use one digit and one lowercase letter, which is the first c... | import java.io.*;
import java.util.*;
public class TokitsukazeandMahjong {
public static boolean ascendingOrder(int one, int two, int three) {
if(one-two == 1 && two-three==1) {
return true;
}
else if (one - three==1 && three-two==1) {
return true;
}
else if(two-one==1 && one-three==1) {
return tru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.