Harryxun/stf_run huggingface dataset:
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, M = map(int, input().split())
e = dd(list)

for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

base = 10 ** 6
def clean():
  global res
  for i in range(1, N + 1):
    if len(res[i]) == 0: continue
    p = max(res[i])
    z = p % base
    d = p // base
    newrs = set()
    newrs.add(p)
    for x in res[i]:
      if qd[x % base] > d: newrs.add(x)
    res[i] = newrs

res = [set() for _ in range(N + 1)]
Q = int(input())
qd = [0] * Q
qc = [0] * Q
for i in range(Q):
  v, d, c = map(int, input().split())
  qd[i] = d
  qc[i] = c
  res[v].add(d * base + i)
#print(qc)
clean()
for t in range(10):
  tres = [set() | s for s in res]
  for x in range(1, N + 1):
    for y in e[x]:
      for z in res[x]:
        if qd[z % base] > t: tres[y].add(z)
  res = tres
  clean()
#print(res)

for r in res[1: ]:
  if len(r): print(qc[max(r)])
  else: print(0)

### FIXED CODE ###

import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, M = map(int, input().split())
e = dd(list)

for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
mxd = 0
res = [[-1] * 11 for _ in range(N + 1)]
Q = int(input())
qd = [0] * Q
qc = [0] * Q
for i in range(Q):
  v, d, c = map(int, input().split())
  qd[i] = d
  qc[i] = c
  res[v][d] = i
  mxd = max(mxd, d)
#print(qc)

#print(mxd)
for t in range(mxd):
  tres = [x[: ] for x in res]
  for x in range(1, N + 1):
    for y in e[x]:
      for i in range(t + 1, 11):
        res[y][i] = max(res[y][i], tres[x][i])

#print(res)
for r in res[1: ]:
  x = -1
  for i in range(11):
    if r[i] != -1: x = max(x, r[i])
  if x == -1: print(0)
  else: print(qc[x])
<?php

$s = trim(fgets(STDIN));
$count = [0];

$replace = preg_replace('/[^ACGT]/',',',$s);
$matchs = array_filter(explode(',',$replace));

foreach ($matchs as $m) {
    $count[] = strlen($m);
}

print(max($count) . "\n");

### FIXED CODE ###

S = input()
T = set(list('AGCT'))

ans = 0
for l in range(len(S)):
    for r in range(l + 1, len(S) + 1):
        if set(S[l: r]) <= T:
            ans = max(ans, r - l)

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

    if a==5:
        if b==5:
            if c==7:
                return print("YES")
            else:
                return print("NO")
        elif b==7:
            if c==5:
                return print("YES")
            else:
                return print("NO")

    elif a==7:
        if b==5:
            if c==7:
                return print("YES")
            else:
                return print("NO")
        elif :
            return print("NO")


    else:
        return print("NO")

judge()


### FIXED CODE ###

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

def judge():
    if a==5:
        if b==5:
            if c==7:
                return print("YES")
            else:
                return print("NO")
        elif b==7:
            if c==5:
                return print("YES")
            else:
                return print("NO")

    elif a==7:
        if b==5:
            if c==5:
                return print("YES")
            else:
                return print("NO")
        else:
            return print("NO")


    else:
        return print("NO")

judge()
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,a = f()
    print(n*n - a)

solve()


### FIXED CODE ###

import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()[0]
    print(n*n - a)

solve()
N = int(input())
arr = list(map(int, input().split()))
result = 0
for i in range(N):
    if result == 0:
        result += arr[i]
    else:
        result *= arr[i]
if result > 10**18:
    print(-1)
else:
    print(result)

### FIXED CODE ###

A, B = map(int, input().split())
print(A * B)
from bisect import *

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    try:
        if i:
            return a[i-1]
    except:
        return -1

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    try:
        if i:
            return a[i-1]
    except:
        return -1

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    try:
        if i != len(a):
            return a[i]
    except:
        return -1

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    try:
        if i != len(a):
            return a[i]
    except:
        return -1

def fun(a,b):
    if b==-1:
        return -1
    elif b==0:
        return 0
    return (b+1)*(2*a-b)/2 - b*(b+1)/2

N=int(raw_input())
X=map(int, raw_input().split())
Y=sorted(X)
ans=[-1,0,0]
if len(Y)==2:
    print Y[1],Y[0]

else:
    for y in Y[::-1]:
        qry=y/2
        tmp1=find_ge(Y, qry)
        tmp2=find_le(Y, qry)
        if ans[0]<fun(y,tmp1):
            ans=[fun(y,tmp1),y,tmp1]
        if ans[0]<fun(y,tmp2):
            ans=[fun(y,tmp2),y,tmp2]
    print ans[1], ans[2]


### FIXED CODE ###

from bisect import *

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    try:
        if i:
            return a[i-1]
    except:
        return -1

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    try:
        if i:
            return a[i-1]
        else:
            return -1
    except:
        return -1

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    try:
        if i != len(a):
            return a[i]
    except:
        return -1

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    try:
        if i != len(a):
            return a[i]
        else:
            return -1
    except:
        return -1

def fun(a,b):
    if b==-1:
        return -1
    elif b==0:
        return 0
    return (b+1)*(2*a-b)/2 - b*(b+1)/2

N=int(raw_input())
X=map(int, raw_input().split())
Y=sorted(X)
ans=[-1,0,0]
if len(Y)==2:
    print Y[1],Y[0]

else:
    for y in Y[::-1]:
        qry=y/2
        tmp1=find_ge(Y, qry)
        tmp2=find_le(Y, qry)
        if ans[0]<fun(y,tmp1):
            ans=[fun(y,tmp1),y,tmp1]
        if ans[0]<fun(y,tmp2):
            ans=[fun(y,tmp2),y,tmp2]
    print ans[1], ans[2]
N=int(input())
if N>=2 and N<=10**5:
    array = list(map(int, input().strip().split()))
    if N==len(array):
        if array[0]>=0 and array[-1]<=10**18:
            mul=1
            for i in array:
                mul*=array[i-1]
            if mul>=10**18:
               print(-1)
            else:
                print(mul)

### FIXED CODE ###

n = int(input())
m = list(map(int, input().split()))
ans = 1
if min(m) == 0:
    print(0)
else:
    m.sort(reverse=True)
    for i in m:
        ans *= i
        if ans > 1000000000000000000:
            ans = -1
            break
    print(ans)
import math

A,B,C,D = map(int,input().split())
lcm = int(C * D/ math.gcd(C,D))
A = A-1
A_n = A - (A//C + A//D - A//lcm)
B_n = B - (B//C + B//D - B//lcm)
print(int(B_n-A_n))

### FIXED CODE ###

def gcd(a,b):
    while b != 0:
        temp = b
        b = a%b
        a = temp
    return a
A,B,C,D = map(int,input().split())
if C >=D:
    lc = int(C*D/gcd(C,D))
else: lc = int(C*D/gcd(D,C))
A = A-1
A_n = A - (A//C + A//D - A//lc)
B_n = B - (B//C + B//D - B//lc)
print(int(B_n-A_n))
import fractions
from collections import Counter
N = int(input())
A_B = []
mod = 1000000007
for _ in range(N):
    A, B = map(int, input().split())
    if A < 0:
        A = -A
        B = -B
    C = fractions.gcd(abs(A), abs(B))
    A_B.append((A//C, B//C))
A_B_C = Counter(A_B)


hate_couple = 0
ans = 1
Done = set([])
for key, value in A_B_C.items():
    if key in Done:
        continue
    keya, keyb = key
    a = 0
    if keyb < 0:
        keya = -keya
        keyb = -keyb
    if (keyb, -keya) not in A_B_C:
        a = pow(2, value, mod)
    else:
        a = (pow(2, value, mod) - 1) + (pow(2, A_B_C[(keyb, -keya)], mod) - 1) + 1
        Done.add((keyb, -keya))
    ans *= a
    Done.add(key)

print(ans - 1)

### FIXED CODE ###

import math
from collections import Counter

N = int(input())
A_B = []
mod = 1000000007
for _ in range(N):
    A, B = map(int, input().split())
    if (A == 0) and (B == 0):
        A_B.append((A, B))
    elif A == 0:
        A_B.append((0, -1))
    elif B == 0:
        A_B.append((1, 0))
    else:
        if A < 0:
            A = -A
            B = -B
        C = math.gcd(abs(A), abs(B))
        A_B.append((A // C, B // C))

A_B_C = Counter(A_B)


ans = 1
Done = set([])
Done.add((0, 0))
for key, value in A_B_C.items():
    if key in Done:
        continue
    keya, keyb = key
    a = 0
    if keya == 0 and keyb == 0:
        a = value + 1
        Done.add((0, 0))
    else:
        if keyb < 0:
            keya = -keya
            keyb = -keyb
        if (keyb, -keya) not in A_B_C:
            a = pow(2, value, mod)
        else:
            a = (pow(2, value, mod) - 1) + (pow(2, A_B_C[(keyb, -keya)], mod) - 1) + 1
            Done.add((keyb, -keya))
    ans *= a
    ans %= mod
    Done.add(key)
ans -= 1
ans += A_B_C[(0, 0)]

print(ans % mod)
import math

a,b=int(input()),float(input())
print((math.floor(float(a*b))))

                                           

### FIXED CODE ###

A, B = input().split(' ')
print(int(A) * int(B.replace('.', '')) // 100)
def main():
	N,M=map(int,input().split())
	like=[0]*M
	for _ in range(N):
    	K,*A=map(int,input().split())
    	for num in A:
        	like[num-1]+=1
print(like.count(N))

if __name__=='__main__':
    main()




     


### FIXED CODE ###

N,M=map(int,input().split())
set_list=[]
sets=set()
for i in range(N):
    s=input().split()
    s.pop(0)
    set_list.append(set(s))
for set in set_list:
    if len(sets)==0:
        sets=set
    else:
        sets=sets.intersection(set)
print(len(sets))
N = int(input())

if N = 1:
  print("Hello World")
else:
  A = int(input())
  
  B = int(input())
  
  print( A + B )


### FIXED CODE ###

N = int(input())
 
if N == 1:
  print("Hello World")
else:
  A = int(input())
  
  B = int(input())
  
  print( A + B )
N = int(input())
A=list(map(int, input().split()))

def sol(i,want):
    num=int(N/(i+1))
    wa=-A[0]
    for j in range(num):
        wa+=A[i+j*i]
    wa=wa%2
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
for i in range(half):
    j=half-1-i

    B[j]=sol(j,A[j])
    
print(sum(B))
for b in B:
    print(b)

### FIXED CODE ###

N = int(input())
A=list(map(int, input().split()))




def sol(i,want):
    num=N//(i+1)
    wa=B[i]

    for j in range(num):
        k=i+j*(i+1)
        wa+=B[k]
#         print(i,wa,B[i])
#         print((i+1)+j*(i+1)-1)
#     print(i,wa,B[i])
    wa=wa%2
#     print(i,wa,A[i])
    
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
half=N//2
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
    
C=[i+1 for i, x in enumerate(B) if x ==1]

m=sum(B)
print(m)
print(*C)
n = int(input())
ans = 0
for i in range(n+1):
  if i%3 = 0 or i%5 != 0:
    ans +=  i
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
  if i%3 != 0 and i%5 != 0:
    ans +=  i
print(ans)
import sys
input = sys.stdin.readline
from collections import deque

h, w = map(int, input().split())
ch, cw = map(int, input().split())
gh, gw = map(int, input().split())

s = []
for i in range(h):
   s.append(input().rstrip('\n'))

INF = 10 ** 10
d = [INF] * (h*w)

stack = deque([[ch-1, cw-1, 0]])
stack_append = stack.append
stack_popleft = stack.popleft

nex = []
for i in range(-2, 3):
    for j in range(-2, 3):
        if (i, j) in [(-1,0),(1,0),(0,-1),(0,1),(0,0)]:
            continue
        else:
            nex.append((i,j))

while stack:
    curh, curw, cnt = stack_popleft()
    f = 0
    if d[curh * w + curw] <= cnt:
        continue
    else:
        d[curh * w + curw] = cnt
    for dh, dw in ((-1,0), (1,0), (0,1), (0,-1)):
        nh = curh + dh
        nw = curw + dw
        if nh >= 0 and nh < h and nw >= 0 and nw < w and s[nh][nw] == '.' and d[nh * w + nw] > cnt:
            stack_append([nh, nw, cnt])
        if s[nh][nw] == '#':
            f = 1
    if f:
        for dh, dw in nex:
            nh = curh + dh
            nw = curw + dw
            if nh >= 0 and nh < h and nw >= 0 and nw < w and s[nh][nw] == '.' and  d[nh * w + nw] > cnt:
                stack_append([nh, nw, cnt+1])

# for item in d:
#     print(item)
gh -= 1
gw -= 1

if d[gh*w + gw] == INF:
    print(-1)
else:
    print(d[gh*w + gw])


### FIXED CODE ###

import sys
input = sys.stdin.readline

import heapq

INF = 10 ** 10

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for end, cost in G[v]:
            if dist[end] > dist[v] + cost:
                dist[end] = dist[v] + cost
                heapq.heappush(h, (dist[end], end))
    return dist


H, W = map(int, input().split())
N = H * W
ch, cw = map(lambda x:int(x)-1, input().split())
gh, gw = map(lambda x:int(x)-1, input().split())

s = []
es = tuple([] for i in range(N))

for h in range(H):
   s.append(input().rstrip('\n'))

for h in range(H):
    for w in range(W):
        if s[h][w] != '.':
            continue
        a = h*W+w
        esappend = es[a].append
        for dh in (-2, -1, 0, 1, 2):
            for dw in (-2, -1, 0, 1, 2):
                if dh == 0 and dw == 0:
                    continue
                nh = h + dh
                nw = w + dw
                if 0 <= nh and nh < H and 0 <= nw and nw < W and s[nh][nw] == '.':
                    b = nh*W+nw
                    if (dh, dw) in [(-1,0),(1,0),(0,-1),(0,1)]:
                        esappend((b, 0))
                    else:
                        esappend((b, 1))

dist = dijkstra(N, es, ch*W+cw)
if dist[gh*W+gw] == INF:
    print(-1)
else:
    print(dist[gh*W+gw])
import re
n=int(input())
s=[]
s=input().split()
q=int(input())

for i in range(q):
 x,y=map(str, input().split())
 s=re.sub(str(x),str(y),str(s))
 
for j in range(q):
 ans+=int(s[j])
 
print(ans)

### FIXED CODE ###

n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
  
q=int(input())
ans=0
 
for j in range(q):
 x,y=map(int,input().split())
 sum+=(y-x)*cnt[x]
 cnt[y]+=cnt[x]
 cnt[x]=0
 print(sum)
def main():
	mod=10**9+7
	n=int(input())
	a=input()+'z'
	if a[0]=='W':
		print(0)
		return 0
	x=[]
	cnt=1
	for i in range(2*n):
		if a[i]==a[i+1]:
			cnt+=1
		else:
			x.append(cnt)
			cnt=1
	lx=len(x)
	if lx%2==0:
		print(0)
		return 0
	ans=1
	for i in range(lx//2):
		if x[i]%2==0:
			ans=0
		else:
			ans=ans*pow(i+1,x[i]//2,mod)%mod
	if x[lx//2]%2==1:
		ans=0
	else:
		ans=ans*pow(lx//2+1,x[lx//2]//2,mod)%mod
	for i in range(lx//2+1,lx):
		if x[i]%2==0:
			ans=0
		else:
			ans=ans*pow(lx-i,x[i]//2+1,mod)%mod
	for i in range(2,n+1):
		ans=ans*i%mod
	if ans==0:
		print(ans/0)
main()

### FIXED CODE ###

def main():
    mod=10**9+7
    n=int(input())
    a=input()+'z'
    if a[0]=='W':
        print(0)
        return 0
    x=[]
    cnt=1
    for i in range(2*n):
        if a[i]==a[i+1]:
            cnt+=1
        else:
            x.append(cnt)
            cnt=1
    lx=len(x)
    if lx==1:
        ans=1
        for i in range(2,n+1):
            ans=ans*i%mod
        print(ans)
        return 0
    if x[0]%2==0 or x[-1]%2==0:
        print(0)
        return 0
    y=[1]
    now=1
    cnt=1
    for i in range(lx-1):
        if x[i]%2!=0:
            cnt+=now
            y.append(cnt)
        else:
            now*=-1
            cnt+=now
            y.append(cnt)
    if y[-1]>1 or 0 in y:
        print(0)
        return 0
    z=[1]+[y[i+1]-y[i] for i in range(lx-1)]
    ans=1
    for i in range(lx):
        if x[i]%2==0:
            ans=ans*pow(y[i],x[i]//2,mod)%mod
        else:
            ans=ans*pow(y[i],(x[i]-1)//2+(z[i]==-1),mod)%mod
    for i in range(2,n+1):
        ans=ans*i%mod
    print(ans)
main()
n, k, s = map(int, input().split())
print(*[s]*k, *[s+1]*(n-k))

### FIXED CODE ###

n, k, s = map(int, input().split())
if s == 10**9:
    ans = [s]*k + [s-1]*(n-k)
else:
    ans = [s]*k + [s+1]*(n-k)
print(*ans)
def gcd(a,b):
	t = b
	b = a % b
	
	if b == 0:
		return t
	else:
		return gcd(t,b)
        
def lcm(a, b):
    return a * b / gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))

print(int(ans))

### FIXED CODE ###

import fractions
        
def lcm(a, b):
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))

print(ans)
arr = []
n = int(input())
while n > 0:
  arr.append(input())
  n -= 1
print('AC x '+arr.count('AC'))
print('WA x '+arr.count('WA'))
print('TLE x '+arr.count('TLE'))
print('RE x '+arr.count('RE'))
      

### FIXED CODE ###

arr = []
n = int(input())
while n > 0:
  arr.append(input())
  n -= 1
print('AC x', arr.count('AC'))
print('WA x', arr.count('WA'))
print('TLE x', arr.count('TLE'))
print('RE x', arr.count('RE'))
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
if len(C)==1:
    C = C
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(0,n[0]+n[1]):
    if a==n[0] and m<n[1]:
        saidai = max([ B[m],C[s] ])

        if C[s] >= B[m]:
            s +=1
        else:
            m +=1
    elif a<n[0] and m == n[1]:
        saidai = max([ A[a],C[s] ])

        if C[s] >= A[a]:
            s +=1
        else:
            a +=1

    else:
        saidai=max([ A[a],B[m],C[s] ])

        if A[a] >= B[m] and A[a] > C[s]:
            a +=1
        elif A[a] < B[m] and B[m] > C[s]:
            m +=1
        elif C[s] >= B[m] and A[a] <= C[s]:
            s +=1
    
    ans = ans + saidai

print(ans)

### FIXED CODE ###

import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)
n=int(input())
k=int(input())
a=0
for i in range(n):
  x=int(input())
  a+=min(x,abs(k-x))
print(a*2)

### FIXED CODE ###

n=int(input())
k=int(input())
a=0
for x in [int(i) for i in input().split()]:
    a+=min(x,abs(k-x))
print(a*2)
X = int(input())

cnt = 1

a = X - 400 / 200
for i in range(.7):
    if  7 <= a < 8:
        print(cnt)
    else:
        cnt += 1

### FIXED CODE ###

X = int(input())
b = 400
cnt = 8
 
a = (X - b) // 200
for i in range(1,9):
    a = (X - b) // 200
    if  0 <= a < 1:
        print(cnt)
        break
    else:
        cnt -= 1
        b += 200
from collections import Counter
from copy import deepcopy
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    a_c= Counter(A)
    values = a_c.values()
    val_cnt = Counter(values
    for a in A:
        val_cnt_c = deepcopy(val_cnt)
        val_cnt_c[a_c[a]] -= 1
        val_cnt_c[a_c[a]-1] += 1
        cnt = {int(k*(k-1)/2*v) if k > 1 else 0 for k, v in val_cnt_c.items()}
        print(sum(cnt))
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import Counter
 
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    a_c = Counter(A)
    res = [int(v*(v-1)/2) for v in a_c.values()]
    cnt = sum(res)
    for a in A:
        ans = (cnt - (a_c[a]-1))
        print(ans)
 
if __name__ == '__main__':
    main()
a = int(input()) 

if a == 'A' or a =='T':
  if a == 'A':
    print('T')
  else:
    print('A')
else:
  if a == 'G':
    print('C')
  else:
    print('G')

### FIXED CODE ###

a = input()

if a == 'A' or a =='T':
  if a == 'A':
    print('T')
  else:
    print('A')
else:
  if a == 'G':
    print('C')
  else:
    print('G')
s = input()
s[3] = "8"
print(s)

### FIXED CODE ###

s = input()
print("2018"+s[4:])
N=int(input())
a=[int(x) for x in input().split()]

for i in range(N):
    b+=1/a[i]
    
print(1/b)

### FIXED CODE ###

N=int(input())
A = sorted(map(int, input().split( )))
b=0
for i in range(N):
    b+=1/A[i]
print(1/b)
H = int(input())
A = int(input())
 
if H%A == 0:
    ans = int(H/A)
    print(ans)
else:
    ans = int(H/A) + 1
    print(ans)

### FIXED CODE ###

H, A = map(int, input().split())
if H%A == 0:
    ans = int(H/A)
    print(ans)
else:
    ans = int(H/A) + 1
    print(ans)
import numpy as np
N=int(raw_input())
a=map(int,raw_input().split(' '))

ans=[]


def check(l):
  for i in range(len(l)-1):
    if l[i]>l[i+1]:
      return 0
  return 1

u=N-1
while not check(a):
  p=np.argmax(a[0:u+1])
  m=max(a[0:u+1])
  if p==u:
    u-=1
  else:
    if m>0:
      for i in range(p+1,u+1):
        ans+=[(p+1, i+1)]
        a[i]+=a[p]
    else:
      p=np.argmin(a)
      m=min(a)
      for i in range(p):
        ans+=[(p+1, i+1)]
        a[i]+=a[p]

print len(ans)
for an in ans:
  x,y=an
  print x,y

### FIXED CODE ###

N=int(raw_input())
a=map(int,raw_input().split(' '))

flg=0
if abs(max(a))>=abs(min(a)):
  m=max(a)
  flg=1
else:
  m=min(a)

for i in range(len(a)):
  if a[i]==m:
    p=i
    break

print 2*N-1
for i in range(N):
  print p+1, i+1
  a[i]+=a[p]

if flg:
  for i in range(N-1):
    print i+1, i+2
    a[i+1]+=a[i]
else:
  for i in range(N-1)[::-1]:
    print i+2, i+1
    a[i]+=a[i+1]
#print a
def f(N,S):
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ret_s = ""
    for s in S:
        num = (alpha.index(str(s)) + int(N))
        if num <= 25:
            pass
        else:
            num = num-(num//26)*26
        ret_s += alpha[num]
    return print(ret_s)

a = input()
b = input()

f(a,b)

### FIXED CODE ###

def f(S):
    d = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
    return print(d[str(S)])
f(input())
N = map(int,input().split())

f = sum(list(map(int,str(N))))

if N % f == 0:
	print("Yes")
else:
	print("No")


### FIXED CODE ###

N = int(input())
f = sum(map(int,list(str(N))))

if N % f == 0:
        print("Yes")
else:
        print("No")