Harryxun/stf_run huggingface dataset:
a = input().split()
N = int(a[0])
M = int(a[1])
Q = int(a[2])
current = []
for i in range(Q):
    e = input().split()
    f = [int(i) for i in e]
    current.append(f)
import itertools

c = list(itertools.combinations_with_replacement(range(1, M + 1), N))
value_list = []
for item in c:
    value = 0
    for k in current :
        if item[k[1]]-item[k[0]]==k[2]:
            value+=k[3]
    value_list.append(value)
    
print(max(value_list))

### FIXED CODE ###

a = input().split()
N = int(a[0])
M = int(a[1])
Q = int(a[2])
current = []
for i in range(Q):
    e = input().split()
    f = [int(i) for i in e]
    current.append(f)
import itertools

c = list(itertools.combinations_with_replacement(range(1, M + 1), N))
value_list = []
for item in c:
    value = 0
    for k in current :
        if item[k[1]-1]-item[k[0]-1]==k[2]:
            value+=k[3]
    value_list.append(value)

print(max(value_list))
for i in range(1,10):
??for j in range(1,10):
????print  "%dx%d=%d" %(i,j,i*j)

### FIXED CODE ###

for i in range(1,10):
    for j in range(1,10):
       print("{0}x{1}={2}".format(i,j,i*j))
a,b,c=map(int,input().split())
if 2*b==a+c:print("YES")
else:print("NO")

### FIXED CODE ###

a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())
import math
A = ord('a')
N = int(input())
L = 2**int(math.ceil(math.log(N, 2)))
S = [x for x in input()]
Q = int(input())

Seg = [0]*(L*2-1)

def order(c):
    return 1 << (ord(c) - A)

def count(n):
    return bin(n).count("1")

def merge(x, y):
    return x | y

def update(k, x):
    k += L - 1
    Seg[k] = x
    while k > 0:
        k = (k - 1) // 2
        Seg[k] = merge(Seg[2*k+1], Seg[2*k+2])
    Seg[0] = merge(Seg[1], Seg[2])

def find(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return Seg[k]
    vl = find(a, b, 2*k+1, l, (l+r)//2)
    vr = find(a, b, 2*k+2, (l+r)//2, r)

    return merge(vl, vr)


# read S, and update tree
for i in range(N):
    c = order(S[i])
    update(i, c)
    #print("Seg", *[count(x) for x in Seg])

for _ in range(Q):
    q, i, c = input().split()
    if q == '1':
        i = int(i)-1
        if S[i] == c:
            continue
        S[i] = c
        update(i, order(S[i]))
    else:
        l, r = int(i)-1, int(c)
        print(count(find(l, r, 0, 0, L)))



### FIXED CODE ###

import numpy as np

def count(n):
    return bin(n).count("1")

def merge(x, y):
    return x | y

def update(Seg, k, x):
    k += len(Seg)//2
    Seg[k] = x
    while k > 0:
        k = (k - 1) // 2
        Seg[k] = Seg[k*2+1]|Seg[k*2+2]

d = {c:(1 << (ord(c)-97)) for c in 'abcdefghijklmnopqrstuvwxyz'}

class SegmentTree:
    def __init__(self, A):
        N = len(A)
        n = (N-1).bit_length()
        self.N = 1 << n
        self.Seg = [0 for i in range(2*self.N)]
        #for i in range(N): self.update(i, A[i])
        if True:
            for i in range(N):
                self.Seg[self.N+i-1] = d[A[i]]
            for i in range(0,self.N-2)[::-1]:
                self.Seg[i] = self.Seg[i*2+1] | self.Seg[i*2+2]

    def update(self, k, x):
        i = self.N+k-1
        self.Seg[i] = d[x]
        while i > 0:
            i = (i-1)//2
            self.Seg[i] = self.Seg[i*2+1]|self.Seg[i*2+2]
    def merge(self, x, y):
        return x | y

    def query(self, a, b):
        return self.query_(a, b, 0, 0, self.N)

    def query_(self, a, b, k, l, r):
        if r <= a or b <= l:
            return 0
        if a <= l and r <= b:
            return self.Seg[k]
        vl = self.query_(a, b, 2*k+1, l, (l+r)//2)
        vr = self.query_(a, b, 2*k+2, (l+r)//2, r)
        return merge(vl, vr)

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    S = input()[:-1]
    Q = int(input())
    Seg = SegmentTree(S)

    for _ in range(Q):
        q, i, c = input().split()
        if q == '1':
            i = int(i)-1
            Seg.update(i, c)
        else:
            l, r = int(i), int(c)
            print(count(Seg.query(l-1, r)))
main()
a,b,c=map(int,input().split())
div=2
ac=1
bc=1
cc=1
for i in range(2,10**4):
    if a%(i**2)==0:
        a=a//(i**2)
    ac*=i

for i in range(2,10**4):
    if b%(i**2)==0:
        b=b//(i**2)
    bc*=i

for i in range(2,10**4):
    if c%(i**2)==0:
        c=c//(i**2)
    cc*=i

if ac*(a**0.5)+bc*(b**0.5)<cc*(c**0.5):
    print("Yes")
else:
    print("No")

### FIXED CODE ###


a,b,c=map(int,input().split())

if c-a-b<0:
    print("No")
elif 4*a*b<(c-a-b)**2:#式変形桁落ちはわかっていたが式変形のかんがえかたがなかった
    print("Yes")
else:
    print("No")
x=[i for i in input()]
y=[i for i in range(len(x))]
y=x.copy()
n=int(input())
for i in range(n):
    c=[j for j in input().split()]
    if len(c)==4:
        for j in range(len(c[3])):
            y[j+int(c[1])]=list(c[3])[j]
        x=y.copy()
    elif c[0]=="print":
        for j in range(int(c[1]),int(c[2])+1):
            print(x[j],end="")
        print()
    else:
        for j in range(int(c[1]),int(c[2])):
            y[int(c[2])-j]=x[int(c[1])+j]
        x=y.copy()

### FIXED CODE ###

x=[i for i in input()]
y=[i for i in range(len(x))]
y=x.copy()
n=int(input())
for i in range(n):
    c=[j for j in input().split()]
    if len(c)==4:
        for j in range(len(c[3])):
            y[j+int(c[1])]=list(c[3])[j]
        x=y.copy()
    elif c[0]=="print":
        for j in range(int(c[1]),int(c[2])+1):
            print(x[j],end="")
        print()
    else:
        for j in range(int(c[2])+1-int(c[1])):
            z=[i for i in range(len(x))]
            z=x.copy()
            y[int(c[2])-j]=z[int(c[1])+j]
        x=y.copy()
def lcs():
???x = raw_input()
  y = raw_input()
???x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

  for i in range(x_len):
    z1 = z2 + []
    ele = x[i]
    for k in range(y_len):
      if ele == y[k]:
         z2[k+1] = z1[k] + 1
      elif z2[k+1] < z2[k]:???
?????????   z2[k+1] = z2[k]

  return z2[-1]

num = input()
for j in range(num):
  print lcs()

### FIXED CODE ###

def lcs():
  x = raw_input()
  y = raw_input()
  x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

  for i in range(x_len):
    z1 = z2 + []
    ele = x[i]
    for k in range(y_len):
      if ele == y[k]:
        z2[k+1] = z1[k] + 1
      elif z2[k+1] < z2[k]:
        z2[k+1] = z2[k]

  return z2[-1]

num = input()
for j in range(num):
  print lcs()
import collections

n = map(int, input().split())
A = list(map(int, input().split()))
q = map(int, input().split())

cnt = collections.Counter(A)
ANS = []
base = sum(A)

for i in range(q):
    b, c = map(int, input().split())
    t = CNT[b]
    ans = base + (c - b) * t
    ANS.append(ans)
    CNT[c] += t
    CNT[b] = 0
    base = ans

for i in ANS:
    print(i)

### FIXED CODE ###

import collections

n = int(input())
A = list(map(int, input().split()))
q = int(input())

CNT = collections.Counter(A)
ANS = []
ans = sum(A)

for i in range(q):
    b, c = map(int, input().split())
    t = CNT[b]
    ans +=(c - b) * t
    ANS.append(ans)
    CNT[c] += t
    CNT[b] = 0

for i in ANS:
    print(i)
n,a=map(int, input().split());print(n**2-a)

### FIXED CODE ###

n,a=[int(input()) for _ in range(2)];print(n**2-a)
N = int(input())

L = []
S = set()
for i in ragne(N):
  s = input()
  L.appened(s)
  S.insert(s)
L.sorted()

for i in S:
  M = max(M, L.count(i))
  
for i in S:
  if L.count(i) == M:
    print(i)

### FIXED CODE ###

N = int(input())

dict = {}
L = []

for i in range(N):
  s = input()
  if s in dict:
    dict[s] = dict[s] + 1
  else:
    dict[s]=1
    L.append(s)

L.sort()

M = 0
for i in dict:
  M = max(M, dict[i])

for i in L:
  if dict[i] == M:
    print(i)
list = map(int,raw_input().split())
W = list[0] 
H = list[1] 
x = list[2]
y = list[3]
r = list[4]

if x-r < 0:
    print "No"
elif x + r > W:
    print "No"
elif y-r < 0:
    print "No"
elif y+r > H:
    print "No"
else:
    print "Yes"

### FIXED CODE ###

S=int(input())
print(S//3600,(S%3600)//60,S%60,sep=":")
data = [
    [[0 for r in range(10)] for f in range(3) ] for b in range(4)
] 


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) i in input().split()]
    data[b-1] [f-1] [r-1] += v

for bi, b in enumerate(data):
  for f in b:
     for r in f:
       print(' {0}'.format(r), end='')
     print()
  if bi < 3:
     print('#' * 20)

### FIXED CODE ###

data = [
    [[0 for r in range(10)] for f in range(3) ] for b in range(4)
] 


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1] [f-1] [r-1] += v

for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        print()
    
    if bi < 3:
        print('#' * 20)
n=int(input())
p=list(map(int,input().split())

min=10000000000
ans=0
       
for i in p:
  if i <= min:
    ans+=1
    min=i
print(ans)


### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))

min=10000000000
ans=0
       
for i in p:
  if i <= min:
    ans+=1
    min=i
print(ans)
n, w = map(int, input().split())
nums = [list(map(int, input().split())) for _ in range(n)]

total_v = sum(nums[i][1] for i in range(n))
dp = [[float('inf') for _ in range(total_v+1)] for _ in range(n)]
dp[0][0] = 0

for i in range(1, n+1):
  for j in range(total_v+1):
    if j < nums[i-1][1]:
      dp[i][j] = dp[i-1][j]
    else:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-nums[i-1][1]] + nums[i-1][0])
for i in range(total_v, -1, -1):
  if dp[n][i] != float('inf') and dp[n][i] <= w:
    print(i)
    break


### FIXED CODE ###

n, w = map(int, input().split())
nums = []
for _ in range(n):
  nums.append(list(map(int, input().split())))
  
total_v = sum(nums[i][1] for i in range(n))

dp = [[float('inf') for _ in range(total_v+1)] for _ in range(n+1)]
dp[0][0] = 0

for i in range(1, n+1):
  for j in range(total_v+1):
    if j < nums[i-1][1]:
      dp[i][j] = dp[i-1][j]
    else:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-nums[i-1][1]] + nums[i-1][0])
for i in range(total_v, -1, -1):
  if dp[n][i] != float('inf') and dp[n][i] <= w:
    print(i)
    break
k = int(input())
a = [None]*1000001
a[1]=7%k
n=0

for i in range(2:k+1):
    a[i]=(a[i-1]*10+7)%k
    if a[i]==0 and n==0:
        print("{}".format(i))
        n=1
if n==0:
    print("-1")


### FIXED CODE ###

k = int(input())
a = [None]*1000001
a[1]=7%k
n=0

if a[1]==0:
    print("1")
    n=1

for i in range(2,k+1):
    a[i]=(a[i-1]*10+7)%k
    if a[i]==0 and n==0:
        print("{}".format(i))
        n=1
if n==0:
    print("-1")
= int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

### FIXED CODE ###

N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0
n = int(input())
d = list(map(int, input().split()))

import itertools
import numpy

a = []
for pair in itertools.combinations(d, 2):
    a.append(numpy.prod(pair))

print(sum(a))

### FIXED CODE ###

n = int(input())
d = list(map(int, input().split()))

import itertools
import numpy

a = []
for pair in itertools.combinations(d, 2):
    a.append(numpy.prod(pair))

print(sum(a))
def c_id():
    from collections import defaultdict
    N, M = [int(i) for i in input().split()]
    Cities = [[int(i) for i in input().split()] for j in range(M)]

    dic = defaultdict(list)
    # 県毎に市をまとめる
    for p, y in Cities:
        dic[p].append(y)
    # 市の認識番号を (座標) 圧縮
    for p, lst in dic.items():
        dic[p] = {v: k for k, v in enumerate(sorted(lst), 1)}
    return '\n'.join([f'{p:06d}{dic[p][y]:06d}' for p, y in Cities])

print(c_id())

### FIXED CODE ###

def c_id(N, M, City):
    City = sorted(City, key=lambda x: (x[0], x[1]))
    # print(City)
    a, b = City[0][0], 0
    for j, (p, y, k) in enumerate(City):
        if p == a:
            # print('a', j, p, y, k)
            b += 1
            City[j] = [p, b, k]
        else:
            # print('b', j, p, y, k)
            a = p
            b = 1
            City[j] = [p, b, k]
    city = sorted(City, key=lambda x: x[2])
    # print(city)

    ans_tmp = []
    for p, q, k in city:
        ans_tmp.append('{0:06d}{1:06d}'.format(p, q))
    ans = '\n'.join(ans_tmp)
    return ans

N, M = [int(i) for i in input().split()]
City = [[int(i) for i in input().split()] + [k] for j, k in enumerate(range(M), 1)]
print(c_id(N, M, City))
s = input()

while len(s)>4:
    if s[-5:] == 'dream':
        s = s[:-5]
    elif s[-7:] == 'dreamer':
        s = s[:-7]
    elif s[-5:] == 'erase':
        s = s[:-5]
    elif s[-6:] == 'eraser':
        s = s[:-6]
    else:
        beak
if s =='' :
    print('YES')
else:
    print('NO')
    

### FIXED CODE ###

s = input()

while len(s)>4:
    if s[-5:] == 'dream':
        s = s[:-5]
        continue
    elif s[-7:] == 'dreamer':
        s = s[:-7]
        continue
    elif s[-5:] == 'erase':
        s = s[:-5]
        continue
    elif s[-6:] == 'eraser':
        s = s[:-6]
        continue
    else:
        break
if len(s)>0 :
    print('NO')
else:
    print('YES')
n = int(input())

while True:
  for i in range(len(str(n))-1):
    if str(n)[i] == str(n)[i+1]:
      flag = True
    else:
      break
  if flag:
    print(n)
    break
  n +=1
    

### FIXED CODE ###

n = input()
s = n[0]*len(n)
if int(n) <= int(s):
    print(s)
else:
    print(str(int(n[0])+1)*len(n))
N,W = list(map(int, input().split()))
w = []
v = []
for _ in range(N):
    a,b = list(map(int, input().split()))
    w.append(a)
    v.append(b)

dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(N):
    for j in range(W+1):
        if j - w[i] < 0:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]] + v[i])

k = max(dp)
print(max(k))

### FIXED CODE ###

N,W = list(map(int, input().split()))
w_0 = []
w_1 = []
w_2 = []
w_3 = []
v = []
w = 0
w_count = [0]*4
for _ in range(N):
    a,b = list(map(int, input().split()))
    if w == 0:
        w = a
        w_0.append(b)
    else:
        if a == w:
            w_0.append(b)
        elif a == w+1:
            w_1.append(b)
        elif a == w+2:
            w_2.append(b)
        elif a == w+3:
            w_3.append(b)
    w_count[a-w] += 1

w_0.sort(reverse=True)
w_1.sort(reverse=True)
w_2.sort(reverse=True)
w_3.sort(reverse=True)
ans = 0

for i in range(w_count[0]+1):
    for j in range(w_count[1]+1):
        for k in range(w_count[2]+1):
            for l in range(w_count[3]+1):
                if W >= w * i + (w+1) * j + (w+2) * k + (w+3) * l:
                  
                    S = sum(w_0[:i])+sum(w_1[:j])+sum(w_2[:k])+sum(w_3[:l])
                    ans = max(ans,S)

print(ans)




# dp = [[0]*(W+1) for _ in range(N+1)]

# for i in range(N):
#     for j in range(W+1):
#         if j - w[i] < 0:
#             dp[i+1][j] = dp[i][j]
#         else:
#             dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]] + v[i])

# k = max(dp)
# print(max(k))
ABC, ARC = input().split()

if (s=ABC):
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

S = input()
if(S=='ABC'):
    print('ARC')
else:
    print('ABC')
from fractions import gcd
def lcm(a,b):return int(a*b/gcd(a,b))
N,x=int(input()),1
for _ in range(N):x=lcm(x,int(input()))
print(x)

### FIXED CODE ###

from fractions import gcd
def lcm(a,b):return (a//gcd(a,b))*b
N,x=int(input()),1
for _ in range(N):x=lcm(x,int(input()))
print(x)
print(["Yes","No"][input()=="BBB"or"AAA"])

### FIXED CODE ###

s=input()
if s=="AAA" or s=="BBB":
  print("No")
else:
  print("Yes")
import sys

charas = 'abcdefghijklmnopqrstuvwxyz'

data = []
for line in sys.stdin:
    data.append(line)
for chara in chara:
    for row in data:
        cnt = row.count(chara)
        cnt += row.count(chara.upper())
    print('{} : {}'.format(chara, cnt))

### FIXED CODE ###

# coding: utf-8
alphabet = 'abcdefghijklmnopqrstuvwxyz'
S = ''
while True:
    try:
        n = input()
        S += n
    except EOFError:
        break
ans_dict = {}
for char in alphabet:
    ans_dict[char] = S.count(char)
    ans_dict[char] += S.count(char.upper())
for k, v in sorted(ans_dict.items(), key=lambda x: x[0]):
    print('{} : {}'.format(k, v))
l = [int(input()) for i range(4)]
if l[0] <= l[1]:
    sum = l[0] * l[2]
else:
    sum = l[1] * l[2] + (l[0]-l[1]) * l[3]
print(sum)

### FIXED CODE ###

l = [int(input()) for i in range(4)]
if l[0] <= l[1]:
    sum = l[0] * l[2]
else:
    sum = l[1] * l[2] + (l[0]-l[1]) * l[3]
print(sum)
import sys

MOD = 10 ** 9 + 7

def make_table(size=10**6+2, p=MOD):
    fac = [None] * (size + 1)
    fac[0] = 1
    for i in range(size):
        fac[i+1] = fac[i] * (i + 1) % p
    ifac = [None] * (size + 1)
    ifac[size] = pow(fac[size], p-2, p)
    for i in range(size, 0, -1):
        ifac[i-1] = ifac[i] * i % p
    return fac, ifac

fac, ifac = make_table()

def comb(n, r, mod=MOD):
    if r > n or r < 0:
        return 0
    return fac[n] * ifac[r] % mod * ifac[n-r] % mod

def g(y, x):
    return comb(y+x+2, y+1) - 1

r1, c1, r2, c2 = map(int, sys.stdin.readline().split())

def main():
    ans = (g(r2, c2) - (g(r1-1, c2) + g(r2, c1-1) - g(r1-1, c1-1))) % MOD
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

### FIXED CODE ###

import sys

MOD = 10 ** 9 + 7

def make_table(size=2*10**6+2, p=MOD):
    fac = [None] * (size + 1)
    fac[0] = 1
    for i in range(size):
        fac[i+1] = fac[i] * (i + 1) % p
    ifac = [None] * (size + 1)
    ifac[size] = pow(fac[size], p-2, p)
    for i in range(size, 0, -1):
        ifac[i-1] = ifac[i] * i % p
    return fac, ifac

fac, ifac = make_table()

def comb(n, r, mod=MOD):
    if r > n or r < 0:
        return 0
    return fac[n] * ifac[r] % mod * ifac[n-r] % mod

def g(y, x):
    return comb(y+x+2, y+1) - 1

r1, c1, r2, c2 = map(int, sys.stdin.readline().split())

def main():
    ans = (g(r2, c2) - (g(r1-1, c2) + g(r2, c1-1) - g(r1-1, c1-1))) % MOD
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)
#!/usr/bin/env python3
import sys

sys.setrecursionlimit()

def gdp(n, dp, G):
    if dp[n]!=-1:
        return dp[n]

    if G[n]==[]:
        dp[n]=0
        return 0

    for i in G[n]:
        ll=gdp(i, dp, G)
        if dp[n]<ll+1:
            dp[n]=ll+1

    return dp[n]

def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
    G=[[] for _ in range(N)]
    for i in range(M):
        G[x[i]-1].append(y[i]-1)

    dp=[-1]*N

    print(max(gdp(i, dp, G) for i in range(N)))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    x = [int()] * (M)  # type: "List[int]"
    y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, x, y)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(150000)

def gdp(n, dp, G):
    if dp[n]!=-1:
        return dp[n]

    if G[n]==[]:
        dp[n]=0
        return 0

    for i in G[n]:
        ll=gdp(i, dp, G)
        if dp[n]<ll+1:
            dp[n]=ll+1

    return dp[n]

def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
    G=[[] for _ in range(N)]
    for i in range(M):
        G[x[i]-1].append(y[i]-1)

    dp=[-1]*N

    print(max(gdp(i, dp, G) for i in range(N)))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    x = [int()] * (M)  # type: "List[int]"
    y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, x, y)

if __name__ == '__main__':
    main()
import sys

n=int(sys.stdin.readline())
for _ in range(n):
    a=sys.stdin.readline()
    b=sys.stdin.readline()
    c=sys.stdin.readline()


cnt = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        continue
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        cnt = cnt + 1
    else:
        cnt = cnt + 2
print(cnt)

### FIXED CODE ###

import sys

n=int(sys.stdin.readline())
a=sys.stdin.readline()
b=sys.stdin.readline()
c=sys.stdin.readline()


cnt = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        continue
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        cnt = cnt + 1
    else:
        cnt = cnt + 2
print(cnt)
def main():
  N = int(input())
  S = [input() for _ in range(N)]

  tmp = []
  d={}
  for s in S:
    x = Counter(s)
    if x in tmp:
      d[tmp.index(x)] += 1
    else:
      tmp.append(x)
      d[tmp.index(x)] = 1 
      
  cnt = 0
  for v in d.values():
    if v == 1:
      continue
    if v == 2:
      cnt += 1
    elif v == 3:
      cnt += v
    else:
      cnt += sum(list(range(1,v)))

  print(cnt)
if __name__ == "__main__":
  main()

### FIXED CODE ###

def main():
  N = int(input())
  S = [input() for _ in range(N)]

  d = {}
  for i, s in enumerate(S):
    x = "".join(sorted(s))
    if x in d:
      d[x] += 1
    else:
      d[x] = 1
  
  cnt = 0
  for v in d.values():
    if v == 1:
      continue
    if v == 2:
      cnt += 1
    elif v == 3:
      cnt += v
    else:
      cnt += sum(list(range(1,v)))

  print(cnt)
if __name__ == "__main__":
  main()
#D
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0
for i in range(1, n - n // 2 + 1):
    ans += a[i] * 2
ans-=a[n - n // 2 + 1]
print(ans)

### FIXED CODE ###

#D
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = [a[0]]
for i in range(1, n - n // 2 + 1):
    ans.append(a[i])
    ans.append(a[i])
print(sum(ans[:n - 1]))
N, K = map(int, input().split())
L = list(map(int, input().split()))

if N == K:
    print(1)
elif N / K == 1:
    print(2)
else:
    print(int(N / (K-1)))


### FIXED CODE ###

N = input()
S = 0

for i in N:
    S += int(i)

if int(N) % S == 0:
    print('Yes')
else:
    print('No')
N = int(input())
sum = 0
for i in range(N):
    x,u = map(int,input().split())
    if u == 'BTC':
        x *= 380000.0
    sum += x
print(sum)

### FIXED CODE ###

N = int(input())
sum = 0.0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u == 'BTC':
        x *= 380000.0
    sum += x
print(sum)
N = int(input())
A,B = input().split()
ans = []
for i in range(N+1):
  ans.append(A[i] + B[i])
print("".join(ans))

### FIXED CODE ###

N = int(input())
A,B = input().split()
ans = []
for i in range(0,N):
  ans.append(A[i] + B[i])

print("".join(ans))
n = input()

ls = []
isnAGCT = False
cnt = 0
for i in range(len(n)):
  if n[i] == 'A' or n[i] == 'G' or n[i] == 'C' or n[i] == 'T':
    cnt += 1
    ls.append(cnt)
  else:
    cnt = 0
    
print(max(ls))

### FIXED CODE ###

n = input()

ls = []
cnt = 0
for i in range(len(n)):
  if n[i] == 'A' or n[i] == 'G' or n[i] == 'C' or n[i] == 'T':
    cnt += 1
    ls.append(cnt)
  else:
    cnt = 0
    ls.append(cnt)
    
print(max(ls))