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... | #include <bits/stdc++.h>
using namespace std;
int arr[5], vis[10];
int main() {
int a, b, c;
char d, e, f;
cin >> a >> d >> b >> e >> c >> f;
vis[a]++, vis[b]++, vis[c]++;
arr[2] = max(a, max(b, c));
arr[0] = min(a, min(b, c));
vis[arr[2]]++;
vis[arr[0]]++;
for (int i = 0; i <= 9; i++) {
if (vis[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... | t = input().split(sep=' ')
t.sort(key=lambda i: i[0])
n = list(map(lambda i: int(i[0]), t))
b = list(map(lambda i: i[1], t))
if t[0] == t[1] and t[1] == t[2]:
print(0)
elif n[0] + 1 == n[1] and n[1] + 1 == n[2] and b[0] == b[1] and b[1] == b[2]:
print(0)
elif (
(b[0] == b[1] and n[0] == n[1])
or (b[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... | def fl(a, b):
if (a==b):
return 1
else:
return 0
a, b, c = input().split()
l1 = [i for i in range(1, 10)]
su = 0
su += fl(a, b)
su += fl(c, b)
su += fl(a, c)
dic = {}
dic['s'] = 0
dic['m'] = 0
dic['p'] = 0
if (su == 1):
print(1)
elif (su == 3):
print(0)
else:
dic[a[1]] += 1
dic[... |
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.math.*;
import java.text.*;
import java.util.regex.*;
import java.awt.Point;
public final class Main{
long mod = 1000000007;
public static void main(String[] args)throws Exception{
new Main().run();
}
{
st = null;
br = new B... |
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 main():
buf = input()
buflist = buf.split()
hand = buflist;
t = []
for i in range(3):
t.append([])
for j in range(9):
t[i].append(0)
for x in hand:
idx = 0
if x[1] == 'm':
idx = 0
elif x[1] == 'p':
idx = 1
e... |
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()
tiles = set()
for i in a, b, c:
tiles.add(i)
if len(tiles) == 1:
print(0)
elif len(tiles) == 2:
print(1)
else:
pairs = []
for i in a, b, c:
num = i[:-1]
let = i[-1]
pairs.append((int(num), let))
pairs = sorted(pairs)
if pairs[0][1] == pairs[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... | # int(input())
# [int(s) for s in input().split()]
# input()
def solve():
m = [s for s in input().split()]
d = {"m": [], "p": [], "s": []}
ans = float("inf")
for s in m:
d[s[1]].append(int(s[0]))
for s in d:
if len(d[s]) == 1:
ans = min(ans, 2)
elif len(d[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... | def checkConsecutive(l):
return sorted(l) == list(range(min(l), max(l)+1))
a,b,c=map(str,input().split())
x,y,z=int(a[0]),int(b[0]),int(c[0])
p,q,r=a[1],b[1],c[1]
l=[]
l.append(x)
l.append(y)
l.append(z)
if (a==b==c) or (checkConsecutive(l) and p==q==r):
ans=0
elif ((x==y+1 or x==y+2) and p==q) or ((y==z+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... | l = input().split()
p = [0]*10
s = [0]*10
m = [0]*10
for i in l:
if i[1] == "p":
p[int(i[0])] += 1
if i[1] == "s":
s[int(i[0])] += 1
if 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):
t = sum([1 for j in x[i: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... | #include <bits/stdc++.h>
using namespace std;
void ans(int64_t a) {
cout << a;
exit(0);
}
int32_t main() {
ios_base::sync_with_stdio(false);
vector<pair<int64_t, int64_t> > v;
for (int64_t i = 0; i < 3; ++i) {
int64_t a, b = 0;
cin >> a;
char c;
cin >> c;
if (c == 'm') b = 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... | # import math
def check(a,b):
val1 = int(a[0])
val2 = int(b[0])
if(a==b):
return 1
if((val1+1==val2 or val1+2==val2) and a[1]==b[1]):
return 1
return 2
ct = 2
l = list(input().split())
l.sort()
val1 = int(l[0][0])
val2 = int(l[1][0])
val3 = int(l[2][0])
if(l[0]==l[1] and l[1]==l[2]):
print(0)
exit()
elif(val... |
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... | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF1191B extends PrintWriter {
CF1191B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1191B o = new CF1191B(); o.main(); o.flush();
}
boolean close(byte a, byte b) {
return ... |
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 : co_devil Chirag Garg
Institute : JIIT
"""
from __future__ import division, print_function
from sys import stdin,stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil,floor,log,sqrt,factorial,pow,pi,gcd
# from bis... |
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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
imp... |
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()
p1=s[0:2]
p2=s[3:5]
p3=s[6:8]
dict1={}
dict1[p1[1]]=0
dict1[p2[1]]=0
dict1[p3[1]]=0
dict1[p1[1]]+=1
dict1[p2[1]]+=1
dict1[p3[1]]+=1
a1=int(p1[0])
a2=int(p2[0])
a3=int(p3[0])
l=[]
l.append(a1)
l.append(a2)
l.append(a3)
l.sort()
if len(dict1)==1 :
if (p1[0]==p2[0] and p2[0]==p3[0]) or (abs(l[0]-l[1])==1 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... | import math
from collections import deque, defaultdict
from sys import stdin, stdout
#input = stdin.readline
# print = stdout.write
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
s = list(input().split())
z = set(s)
if len(z) == 1:
print(0)
elif len(z) == 2:
print(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(input().split())
p=[]
m=[]
s=[]
for i in a:
if i[1]=='p':
p.append(int(i[0]))
if i[1]=='m':
m.append(int(i[0]))
if i[1]=='s':
s.append(int(i[0]))
ans=2
p.sort()
m.sort()
s.sort()
if len(p)==2 and p[1]-p[0]<3:
ans=1
if len(m)==2 and m[1]-m[0]<3:
ans=1
if len(s)==2 and 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... | hand = raw_input().split()
hand.sort()
same = 1
pordered = 1
sordered = 1
mordered = 1
ps = []
ms = []
ss = []
if hand[0] == hand[1] or hand[0] == hand[2] or hand[1] == hand[2]: #if any two are the same
same+=1
if hand[0] == hand[1] == hand[2]: #if all the same
same+=1
for i in hand:
if i[1] == 'p':
ps.ap... |
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 = raw_input().split()
koutsu = shuntsu = 2
for tile in tiles:
if tiles.count(tile) == 3:
koutsu = 0
break
if tiles.count(tile) == 2:
koutsu = 1
if koutsu > 0:
for tile in tiles:
neighb = 0
num, mast = int(tile[0]), tile[1]
if num == 9:
con... |
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;
int i, j, aae = 0, co = 0;
int ar[4];
char ss;
cin >> a >> b >> c;
if (a[1] != b[1]) co++;
if (b[1] != c[1]) co++;
if (c[1] != a[1]) co++;
ar[0] = a[0] - '0';
ar[1] = b[0] - '0';
ar[2] = c[0] - '0';
if (co == 0) {
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... | tiles = {
'm': [],
'p': [],
's': []
}
for tile in input().split():
tiles[tile[1]].append(int(tile[0]))
max_ava = 0
for suit in tiles:
# max for seq
for x in range(1, 10):
seq = 0
if x in tiles[suit]:
seq += 1
if x+1 in tiles[suit]:
seq += 1
if x+2 in tiles[suit]:
seq += 1
max_ava = max(max_ava,... |
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 a, b, c;
int ans = 2;
char x, y, z;
cin >> a;
x = getchar();
cin >> b;
y = getchar();
cin >> c;
z = getchar();
vector<int> v;
v.push_back(a);
v.push_back(b);
v.push_back(c);
if (x == y && y == z) {
sort(v.begin(), v.end());
... |
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 = 2e5 + 7;
const int mod = 1e9 + 7;
const double eps = 1e-15;
const double pi = acos(-1);
const int INF = 0x3f3f3f;
long long read() {
long long c = getchar(), Nig = 1, x = 0;
while (!isdigit(c) && c != '-') c = getchar();
if (c == '-') Nig = -1, c = ge... |
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 = [str(i) for i in input().split()]
a.sort()
first = a[0]
second = a[1]
third = a[2]
firstnum = int(first[0])
secondnum = int(second[0])
thirdnum = int(third[0])
if(first == second):
if(second == third):
print(0)
else:
print(1)
elif(second == third):
print(1)
elif(first[1] == second[1] and second[1] == third[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... | //make sure to make new file!
import java.io.*;
import java.util.*;
public class B573{
public static void main(String[] args)throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
String s = f.readLine(... |
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 = sorted(int(n)+9*ord(s) for n,s in input().split())
D = {y-x, z-y}
print(2 - bool(D&{0,1,2}) - (D<{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... | #include <bits/stdc++.h>
using namespace std;
int main() {
char a[5], b[5], aa[5][5];
for (int i = 1; i <= 3; i++) {
scanf("%s", aa[i]);
a[i] = aa[i][0];
b[i] = aa[i][1];
}
if ((a[1] == a[2]) && (a[2] == a[3]) && (b[1] == b[2]) && (b[2] == b[3])) {
printf("0\n");
return 0;
}
if (!(strcmp... |
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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception{
FastReader sc=new FastReader();
Outp... |
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()
count=[0,0,0]
alp=['m','p','s']
for i in range(3):
if a[i][1]=='m': count[0]+=1
elif a[i][1]=='p': count[1]+=1
else: count[2]+=1
if max(count)==3:
d=[0,0,0]
d[0]=abs(int(a[0][0])-int(a[1][0]))
d[1]=abs(int(a[0][0])-int(a[2][0]))
d[2]=abs(int(a[1][0])-int(a[2][0]))
d.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.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;
import java.util.regex.Pattern;
public class ROUGH {
public static class FastReader {
BufferedReader br;
StringTokenizer st;
//it reads the data about the specified point and divide the data about it ,it is quite ... |
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.io.*;
import java.math.*;
public class Solution{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
String s1 = st.nextTok... |
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 math import *
import sys
input = lambda: sys.stdin.readline().strip()
d = {'m': [], 's': [], 'p': []}
ls = list(input().split())
for i in ls:
d[i[1]].append(int(i[0]))
for k, v in d.items():
v.sort()
if len(v)==3 and len(set(v))==1: print(0); break
if len(v)==3 and v[0]+1==v[1] and v[1]+1==v[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 java.util.*;import java.io.*;import java.math.*;
public class Main
{
public static void process()throws IOException
{
String arr[]={sc.next(),sc.next(),sc.next()};
int m[]=new int[20],k[]=new int[20],p[]=new int[20];
for(String x : arr){
char ch=x.char... |
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=sys.stdin.readline().strip().split()
if a==b and b==c:
print(0)
elif a==b or b==c or a==c:
print(1)
else:
na = int(a[0])
nb = int(b[0])
nc = int(c[0])
if (a[1]==b[1] and a[1]==c[1]):
cp=[na,nb,nc]
cp.sort()
cp[0]+=2
cp[1]+=1
if (cp[0]==cp[... |
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 letter(i):
return(i[1],i[0])
arr=[(i) for i in filter(None, input().split(" "))]
a = sorted(arr, key=letter)
min = 2
t = len(a)
num=int(a[0][0])
letter = a[0][1]
if a[0]==a[1]:
min=1
if a[1]==a[2]:
min=0
if int(a[0][0])+1==int(a[1][0])and (a[1][1]==letter):
if min>0:
min=1
if 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... | import sys
import math
from collections import defaultdict
#sys.stdin=open('input.txt','r')
#sys.stdout=open('output.txt','w')
a=list(input().split())
d={}
b=[]
c=0
for x in a:
if x[1] in d:
d[x[1]].append(int(x[0]))
else:
d[x[1]]=[int(x[0])]
b.append(x[1])
c+=1
if c==1:
t=b[0]
d[b[0]].sort()
if ((d[t][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():
l=map(str,raw_input().split())
alp=[]
if l.count(l[0])==3:
print 0
exit()
if (l.count(l[0])== 2 or l.count(l[1])== 2):
print 1
exit()
for i in l:
n,a=map(str," ".join(i).split())
alp.append(n)
alp... |
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(str,input().split()))
num1=int(arr[0][0])
num2=int(arr[1][0])
num3=int(arr[2][0])
str1=arr[0][1]
str2=arr[1][1]
str3=arr[2][1]
if str1==str2 and str2==str3:
if num1==num2 and num2==num3:
print(0)
else:
arr2=[num1,num2,num3]
arr2=sorted(arr2)
if arr2[0]==arr2[1]-1 and arr2[1]==arr2[2]-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 arr[3];
int main() {
string s1, s2, s3;
cin >> s1 >> s2 >> s3;
if ((s1[1] == s2[1] && s2[1] == s3[1]) &&
(s1[0] == s2[0] && s2[0] == s3[0])) {
cout << 0 << endl;
} else if (s1[1] == s2[1] && s2[1] == s3[1]) {
arr[0] = (int)s1[0];
arr[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... | from collections import Counter
X, Temp = input()[::-1].split(), 1
MyDict = Counter(X)
if 3 in MyDict.values():
print(0)
exit()
Key = sorted(MyDict.keys())
Max = max(MyDict.values())
for i in range(1, len(Key)):
Diff = int(Key[i][1]) - int(Key[i - 1][1])
if Key[i][0] == Key[i - 1][0] and Diff <=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... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
string s[3];
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[1][0] - s[0][0] == 1 && s[1][1] == s[0][1]) &&
(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... | t = [[],[],[]]
l = 3 * [0]
a = raw_input().split()
for x in a:
if x[1] == "m":
t[0].append(int(x[0]))
l[0] += 1
elif x[1] == "p":
t[1].append(int(x[0]))
l[1] += 1
elif x[1] == "s":
t[2].append(int(x[0]))
l[2] += 1
if max(l) == 1:
print 2
elif max(l) == 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 = input().split()
s = sorted(s)
s1, s2, s3 = s[0], s[1], s[2]
if s1 == s2 == s3:
print(0)
elif (int(s1[0]) + 2 == int(s2[0]) + 1 == int(s3[0])) and (s1[1] == s2[1] == s3[1]):
print(0)
else:
if s1 == s2 or s1 == s3 or s2 == s3:
print(1)
elif (((int(s1[0]) + 1 == int(s2[0])) or (int(s1[0]) + 2 == 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... | #include <bits/stdc++.h>
using namespace std;
void print(vector<pair<int, int> > &v) {
for (long long int i = 0; i < v.size(); ++i)
cout << v[i].first << " " << v[i].second << endl;
}
int max(int a, int b) { return a > b ? a : b; }
int min(int a, int b) { return a < b ? a : b; }
int main() {
string a, b, c;
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... | def find():
s = input()
s = s.split()
d = {'m':[0 for i in range(10)],
'p':[0 for i in range(10)],
's':[0 for i in range(10)]} #m,p,s
for e in s:
d[e[1]][int(e[0])] += 1
res = 2
for e in d:
# m = 3
e = d[e]
for i in range(10):
if e... |
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 a[5];
char c[4];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for (int i = 0; i < 3; i++) {
cin >> c;
a[i] = c[0] - '0' + (c[1] - 'a') * 10;
}
sort(a, a + 3);
int t1 = a[1] - a[0], t2 = a[2] - a[1], t3 = a[2] - a[0];
if (t1 == 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()
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,(not chr(i-1)+c in a)+(not chr(i)+c in a)+(not 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... | a,b,c = map(str, input().split())
a = a[1]+a[0]
b = b[1]+b[0]
c = c[1]+c[0]
n = [a,b,c]
m = [0]*9
p = [0]*9
s = [0]*9
for i in range(3):
if(n[i][0]=="m"):
m[int(n[i][1])-1]+=1
if(n[i][0]=="p"):
p[int(n[i][1])-1]+=1
if(n[i][0]=="s"):
s[int(n[i][1])-1]+=1
ans = 2
#print(m,p,s)
for i 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... | a,b,c=input().split()
d=[]
d.append(int(a[0]))
d.append(int(b[0]))
d.append(int(c[0]))
d.sort()
if(a==b and b==c):
print(0)
elif(a[1]==b[1] and b[1]==c[1] and d[1]-d[0]==1 and d[2]-d[1]==1):
print(0)
elif(a==b or b==c or a==c):
print(1)
elif((a[1]==b[1] and abs(int(a[0])-int(b[0]))<=2) or (c[1]==b[1] and ab... |
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())
s=[0]*10
m=[0]*10
p=[0]*10
if list(a)[1]=="s":
s[int(list(a)[0])]+=1
elif list(a)[1]=="m":
m[int(list(a)[0])]+=1
elif list(a)[1]=="p":
p[int(list(a)[0])]+=1
if list(b)[1]=="s":
s[int(list(b)[0])]+=1
elif list(b)[1]=="m":
m[int(list(b)[0])]+=1
elif list(b)[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... | a = input().split()
r = 2
for x in a:
r = min(r,max(0,3-a.count(x)))
if(x[0] < '8'):
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))
if('1' < x[0] < '9'):
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))
... |
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.Scanner;
public class B1191 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[][] stats = new int[26][9];
for (int i=0; i<3; i++) {
String tile = in.next();
stats[tile.charAt(1)-'a'][tile.charAt(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... | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
long long int ret = 1;
for (; e > 0; e >>= 1) {
if (e & 1) ret = (ret * p) % M;
p = (p * p) % M;
}
return (T)ret;
}
template <class T>
inline T modinverse(T a, T M) {
return bigmod(a, M - 2, M);
}
templat... |
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
if __name__ == '__main__':
res = 3
pai = input().split()
M = [0,0,0,0,0,0,0,0,0]
S = [0,0,0,0,0,0,0,0,0]
P = [0,0,0,0,0,0,0,0,0]
for s in pai:
if s[1]=='m':
M[int(s[0])-1] += 1
elif s[1]=='s':
S[int(s[0])-1] += 1
else:
... |
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
st=input()
st2=st.replace(" ","")
g=defaultdict(list)
for x in range(0,7):
if(x%2==1):
g[st2[x]].append(int(st2[x-1]))
for x in g:
g[x].sort()
if(len(g)==3):
print (2)
elif(len(g)==2):
for x in g:
if(len(g[x])==2):
if((g[x][0]==g[x][1]) or ... |
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.math.BigInteger;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
/**
*
* @author Saju
*
*/
public class Main {
static int[] dx = { 0, 1, 0, -1 };
static int[] dy = {... |
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.InputStreamReader;
import java.util.Scanner;
public class CodeForces
{
public static void main(String[] args)
{
Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
String s1 = input.next();
String s2 = input.next();
String s3 = inpu... |
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=input().split()
flag=0
t1=arr[0]
t2=arr[1]
t3=arr[2]
if t1[1]==t2[1] and t1[1]==t3[1]:
arr_num=[int(t1[0]),int(t2[0]),int(t3[0])]
arr_num.sort()
if arr_num[0]==arr_num[1]-1 and arr_num[1]==arr_num[2]-1:
print(0)
flag=1
if t1==t2 and t1==t3 and flag==0:
print(0)
flag=1
if t1[... |
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... | suit=list(map(str,input().split()))
suit=sorted(suit)
number=[]
alpha=[]
counts=0
countm=0
countp=0
if suit[0]==suit[1] and suit[1]==suit[2]:
print('0')
exit()
for i in range(len(suit)):
number.append(int(suit[i][0]))
alpha.append(suit[i][1])
if suit[i][1]=='s':
counts+=1
if suit[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... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
string s1, s2, s3;
cin >> s1 >> s2 >> s3;
map<char, vector<long long int> > ma;
ma[s1[1]].push_back(s1[0] - '0');
ma[s2[1]].push_back(s2[0] - '0');
ma[s3[1]].push_back(s3[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... | a,b,c=[x for x in input().split(' ')]
n=0
if a==b and b==c:
n=0
elif a==b or b==c or c==a:
n=1
elif a[1]==b[1] and a[1]==c[1]:
z=[int(a[0]),int(b[0]),int(c[0])]
z.sort()
if a[0]==b[0] or b[0]==c[0] or a[0]==c[0]:
n=1
elif z[2]-z[1]==1 and z[1]-z[0]==1:
n=0
elif abs(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 math
#n, m = input().split()
#n = int (n)
#m = int (m)
#k = int (k)
s1, s2, s3 = input().split()
#x = int(input())
#h = list(map(int, input().split()))
#b = list(map(int, input().split()))
#c = list(map(int, input().split()))
#x1, y1, x2, y2 =map(int,input().split())
#n = int(input())
#f = []
#f = [0]*n
#t = ... |
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 possibleKoutsu(string str1, string str2) {
if (str1[0] == str2[0] && str1[1] == str2[1]) return 1;
return 0;
}
int possibleShuntsu(string str1, string str2) {
int diff = (int)str1[0] - (int)str2[0];
if (str1[1] == str2[1] && (abs(diff) == 1 || abs(diff) == 2)) 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... | from collections import Counter
import sys
readline = sys.stdin.readline
def calc(t):
ct = Counter(t)
if not t:
return 3
shun = max(sum(ct[c+i] > 0 for i in range(-1, 2)) for c in range(2, 9))
ko = max(min(3, ct[i]) for i in range(1, 10))
res = max(ko, shun)
if res == 3:
return ... |
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;
bitset<65000000> f;
long long m[200995];
vector<long long> z;
map<long long, long long> u;
map<long long, long long> u1;
map<string, int> v;
string w[200008];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
long long t, c, d, e, 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... |
# -*- coding: utf-8 -*-
# @Date : 2019-08-01 07:30:35
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
import sys
sys.setrecursionlimit(10**5+1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambd... |
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.*;
public class substring {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.next(),s2=sc.next(),s3=sc.next();
char c=s.charAt(1),c2=s2.charAt(1),c3=s3.charAt(1);
int a=Integer.parseInt(s.charAt(0)+""),a2=Integer.parseInt(s2.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... |
import java.io.*;
import java.util.*;
public class Main implements Runnable {
String[] arr=new String[27];
int pos(String cad){
for (int i = 0; i < arr.length; i++) {
if(cad.equals(arr[i]))
return i;
}
return -1;
}
boolean consecutivo(int Pa,... |
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=raw_input()
a=int(s[0])
b=int(s[3])
c=int(s[6])
a1=s[1]
b1=s[4]
c1=s[7]
a2=b2=c2=0
if ((a1=='m' and b1=='m' and c1=='m') or (a1=='s' and b1=='s' and c1=='s') or (a1=='p' and b1=='p' and c1=='p')) and ((a+1==b and b+1==c) or (a==b and b==c) or (c+1==b and b+1==a) or (c+1==a and a+1==b) or (b+1==c and c+1==a) or (b+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() {
ios::sync_with_stdio(0);
cin.tie(0);
string tiles[4];
cin >> tiles[0] >> tiles[1] >> tiles[2];
sort(tiles, tiles + 3);
map<string, int> k;
map<char, vector<int> > s;
for (int i = 0; i < 3; ++i)
k[tiles[i]]++, s[tiles[i][1]].push_back(tiles[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... | a,b,c=raw_input().split()
if a==b and b==c:
print 0 # all equal
elif a==b or b==c or a==c:
print 1 # any two equal
elif a[1]==b[1]:
if b[1]==c[1]: # all same cat
if abs(int(a[0])-int(b[0]))<3 and abs(int(c[0])-int(b[0]))<3 and abs(int(a[0])-int(c[0]))<3:
# if 2*int(b[0])==int(a[0])+int(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... | z=sorted([int(i[0])+ord(i[1])*9 for i in map(str,input().split())])
if len(set(z))==1 or (z[0]==z[1]-1 and z[1]==z[2]-1):print(0)
elif (z[0]==z[1] or z[1]==z[2]) or (z[1]-z[0] in [1,2] or z[2]-z[1] in [1,2]):print(1)
else:print(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... | tt = input().split()
tt = sorted(tt)
def koutsu():
one_and_two_equal = tt[0] == tt[1]
two_and_three_equal = tt[1] == tt[2]
one_and_three_equal = tt[0] == tt[2]
all_equal = one_and_two_equal and two_and_three_equal
two_equal = one_and_two_equal or two_and_three_equal or one_and_three_equal
if all_equal:
retur... |
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 = [i for i in input().split()]
mem = sorted([[int(i[0]),i[1]] for i in arr])
if len(set(arr)) == 1 or (arr[0][1] == arr[1][1] == arr[2][1] and mem[0][0] == mem[1][0] - 1 == mem[2][0] - 2):
print(0)
else:
if 1 <= mem[1][0] - mem[0][0] <= 2 and mem[1][1] == mem[0][1] or 1 <= mem[2][0] - mem[1][0] <= 2 and me... |
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=list(map(str,input().split()))
s=[0]*9;m=[0]*9;p=[0]*9
def kut(l):
t=max(l)
if t>=3:
return 0
return (3-t)
def sut(l):
for i in range(len(l)):
if l[i]>1:
l[i]=1
s=''.join([str(i) for i in l])
if '111' in s:
return 0
elif '11' in s or '101'in s:
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;
int main() {
string s[3];
for (int i = 0; i < 3; i++) {
cin >> s[i];
}
if (s[0][0] > s[1][0]) swap(s[0], s[1]);
if (s[1][0] > s[2][0]) swap(s[1], s[2]);
if (s[0][0] > s[1][0]) swap(s[0], s[1]);
int c1 = 1, c2 = 1;
for (int i = 0; i < 2; i++) {
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... | #include <bits/stdc++.h>
using namespace std;
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89};
string alpha = "abcdefghijklmnopqrstuvwxyz";
signed main() {
string s[3];
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
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... | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class ... |
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 = tuple([x for x in input().split()])
m,p,s=[],[],[]
if a[1]=='m':
m.append(int(a[0]))
elif a[1]=='p':
p.append(int(a[0]))
elif a[1]=='s':
s.append(int(a[0]))
if b[1]=='m':
m.append(int(b[0]))
elif b[1]=='p':
p.append(int(b[0]))
elif b[1]=='s':
s.append(int(b[0]))
if c[1]=='m':
m.appen... |
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 mod = 1e9 + 7, siz = 1e6 + 5;
long long t, n, m, k, a[siz];
vector<long long> v[4];
string s1, s2, s3;
void chk(string s) {
if (s[1] == 'm')
v[1].push_back(s[0] - '0');
else if (s[1] == 'p')
v[2].push_back(s[0] - '0');
else
v[3].push_back(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... | #include <bits/stdc++.h>
using namespace std;
char s[100];
pair<int, int> arr[10];
int ttt(char a) {
if (a == 's') return 1;
if (a == 'p') return 2;
return 3;
}
int main() {
gets(s);
int pos = 0;
for (int i = 1; i <= 3; i++) {
int x = s[pos] - '0';
pos++;
int y = ttt(s[pos]);
pos += 2;
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... | def similar_number(arr):
m = 1
for i in range(1, 10):
i_cnt = arr.count(i)
m = max(i_cnt, m)
return m
def subseq_num(arr):
if len(arr) == 0 or len(arr) == 1:
return len(arr)
arr.sort()
if len(arr) == 2:
if arr[1] == arr[0] + 1 or arr[1] == arr[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... | a,b,c=map(str,input().split())
l=[int(a[0]),int(b[0]),int(c[0])]
l.sort()
if(a==b and b==c):
print(0)
elif(a==b or a==c or b==c):
print(1)
else:
if(a[1]==b[1] and b[1]==c[1]):
if (l[2]==l[1]+1 and l[1]==l[0]+1 ):
print(0)
else:
if(l[1]==l[0]+1 or l[2]==l[1]+1 or l[2]==l[0]+2 or l[1]==l[0]+2 or l[2]==l[1]+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... | #include <bits/stdc++.h>
using namespace std;
vector<string> v(3);
bool f0() {
if (v[0] == v[1] && v[0] == v[2]) return true;
if (v[0][1] == v[1][1] && v[0][1] == v[2][1] && v[1][0] == v[0][0] + 1 &&
v[2][0] == v[1][0] + 1)
return true;
return false;
}
bool f1() {
for (int i = 0; i < 3; ++i)
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;
int main() {
int i;
vector<int> v;
string s1, s2, s3;
cin >> s1 >> s2 >> s3;
if (s1[1] == s2[1] && s1[1] == s3[1]) {
v.push_back(s1[0]);
v.push_back(s2[0]);
v.push_back(s3[0]);
sort(v.begin(), v.end());
if ((v[0] + 1) == v[1] && (v[1] + 1 == 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... | import sys
import math
import bisect
import atexit
import io
import heapq
from collections import defaultdict, Counter
MOD = int(1e9+7)
# n = map(int, raw_input().split())
# input = map(int, raw_input().split())
def main():
a, b, c = raw_input().split()
d = defaultdict(list)
num = []
ans = 2
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... | s=input()
a=s[0:2]
b=s[3:5]
c=s[6]+s[7]
l=[int(a[0]),int(b[0]),int(c[0])]
l.sort()
if(a==b and a==c):
print(0)
elif(l[1]==l[0]+1 and l[2]==l[0]+2 and a[1]==b[1] and a[1]==c[1]):
print(0)
elif((a==b and a!=c) or (a==c and a!=b) or (b==c and b!=a)):
print(1)
elif(l[1]==l[0]+1 or l[2]==l[1]+1):
if(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... | from collections import Counter
cards = input().split()
suits = ['m', 'p', 's']
def hasKoutsu(cards):
return max([y for x, y in Counter(cards).items()]) >= 3
def hasShuntsu(cards):
cnt = Counter(cards)
for suit in suits:
for i in range(3, 10):
a = [str(j) + suit for j in range(i-2,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... | x, y, z = map(str, input().split())
s = set()
s.add(x)
s.add(y)
s.add(z)
f = 3
if len(s)==1:
print(0)
else:
if len(s)==2:
print(1)
else:
z = 0
for t in s:
d = s.copy()
if int(t[0])<=7:
d.add(f"{int(t[0])+1}{t[1]}")
d.add(f"{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... | cards = input().split()
ans = 2
if cards[0] == cards[1] and cards[2] == cards[1]:
ans = 0
elif cards[0] == cards[1] or cards[0] == cards[2] or cards[2] == cards[1]:
ans = 1
else:
if cards[0][1] == cards[1][1] and cards[0][1] == cards[2][1]:
if abs(int(cards[0][0]) - int(cards[1][0])) <= 2 and abs(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... | a, b, c = map(str, input().split())
a0, b0, c0 = int(a[0]), int(b[0]), int(c[0])
l = [a0, b0, c0]
l.sort()
mx, mn = max(a0, b0, c0), min(a0, b0, c0)
if a == b == c or (l[2] - l[1] == 1 and l[1] - l[0] == 1 and a[1] == b[1] == c[1]):
print(0)
else:
if (abs(a0 - b0) <= 2 and a[1] == b[1]) or (abs(c0 - b0) <= 2 an... |
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 t1, t2, t3;
char m1, m2, m3;
cin >> t1 >> t2 >> t3;
int n1, n2, n3;
vector<int> a(3);
n1 = t1[0] - '0';
n2 = t2[0] - '0';
n3 = t3[0] - '0';
m1 = t1[1];
m2 = t2[1];
m3 = t3[1];
a[0] = n1;
a[1] = n2;
a[2] = n3;
sort(a.begin(),... |
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=[x for x in input().split()]
m=[0]*10
p=[0]*10
s=[0]*10
for i in range(len(l)):
if l[i][1]=="m":
m[int(l[i][0])]+=1
elif l[i][1]=="p":
p[int(l[i][0])]+=1
else:
s[int(l[i][0])]+=1
flag1=1
flag2=1
flag3=1
flag4=1
flag5=1
for i in range(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... | mast={
'm':0,
'p':1,
's':2
}
cd = input().split()
ms = {}
pd = {}
for c in cd:
x=int(c[0])
y=mast[c[1]]
ms[x] = ms.get(x,[])
ms[x].append(y)
pd[y] = pd.get(y, [])
pd[y].append(x)
#print(ms)
rm = 2
for k,v in ms.items():
if len(v)==2:
if v[0]==v[1]:
rm = min(rm... |
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;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
string s[3];
cin >> s[0] >> s[1] >> s[2];
if (s[0] == s[1] and s[1] == s[2]) {
cout << "0\n";
return 0;
}
sort(s, s + 3);
char a = s[0][0] + 1;
char c = s[2][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.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class P28 {
public static void main(String args[])
{
try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String a[]=br.readLine().split(" ");
int countm=0,countp=0,counts=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.*;
public class Codechef
{
public static void main(String args[]) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int arr[][]=new int[10][27];
int count=0;
String []line=br.readLine().split(" ");
String str1=lin... |
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 smallest(long long x, long long y, long long z) {
long long c = 0;
while (x && y && z) {
x--;
y--;
z--;
c++;
}
return c;
}
long long smallest(long long x, long long y) { return (x < y) ? x : y; }
void solve() {
string input[3];
long lon... |
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()
if len(set(a)) == 1:
print(0)
elif len(set(a)) == 2:
print(1)
else:
d = {}
for i in a:
n = int(i[0])
c = i[1]
if c in d:
d[c].append(n)
else:
d[c] = [n]
v = list(d.values())
cond0 = False
cond1 = False... |
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=raw_input().split()
t.sort()
k = {}
def get_draws():
for x in t:
if not x[-1] in k:
k[x[-1]]=[]
k[x[-1]].append(int(x[:-1]))
for i in k.keys():
length=len(k[i])
all_same = k[i].count(k[i][0])==length
if all_same:
if (length==3):
print '0'
return
elif length==2:
print '1'
return
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.