Harryxun/stf_run huggingface dataset:
N,Q=map(int,input().split())
l=[[1,0,0]]
for i in range(1,N):
    a,b=map(int,input().split())
    l.append([b,a,0])
l.sort()
for i in range(Q):
    p,x=map(int,input().split())
    l[p-1][2]+=x
t=[l[0][2]]
for i in range(1,N):
    t.append(t[l[i][1]-1]+l[i][2])
print(*t)

### FIXED CODE ###

N,Q=map(int,input().split())
l=[[1,0,0]]
for i in range(1,N):
    a,b=map(int,input().split())
    l.append([b,a,0])
l.sort()
for i in range(Q):
    p,x=map(int,input().split())
    l[p-1][2]+=x
t=[l[0][2]]
for i in range(1,N):
    t.append(t[l[i][1]-1]+l[i][2])
print(*t)
N = raw_input()
keys = ['+','-']
x = 0
check = True
for key1 in keys:
    if key1 == '+' and check:
        x = int(N[0]) + int(N[1])
    elif(key1 == '-' and check):
        x = int(N[0]) - int(N[1])
    for key2 in keys:
        if key2 == '+' and check:
            x = x  + int(N[2])
        elif(key2 == '-' and check):
            x = x  - int(N[2])
            
        for key3 in keys:
            if key3 == '+' and check:
                x = x  + int(N[3])
                if (x == 7):
                    ans = N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    #print N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False

                else:
                    x = 0
            elif(key3 == '-' and check):
                x = x  - int(N[3])

                if (x == 7):
                    ans =  N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False

                else:
                    x = 0
print ans

### FIXED CODE ###

N = str(raw_input())
if(N.find(N[0]*3) != -1):
    print 'Yes'
elif(N.find(N[1]*3) != -1):
    print 'Yes'
else:
    print 'No'
n = int(raw_input())
arr = map(int,raw_input().split())
dp = [float("inf")]*(n)

for i in range(n):
  for j in range(i,i+2):
    if j < n:
      dp[j] = min(dp[j], dp[i]+abs(arr[i]-arr[h]))
print dp[n-1]

### FIXED CODE ###

n = int(raw_input())
arr = map(int,raw_input().split())
dp = [float("inf")]*(n)
dp[0]=0
for i in range(n):
    for j in [i+1,i+2]:
        if j < n: 
            dp[j] = min(dp[j], dp[i]+abs(arr[i]-arr[j]))
print dp[n-1]
# -*- coding: utf-8 -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
# template


def resolve():
    ofs = 6400
    h, w = map(int, readline().split())
    A = [list(map(int, readline().split())) for i in range(h)]
    B = [list(map(int, readline().split())) for i in range(h)]
    dp = [[0]*w for _ in range(h)]
    x = abs(A[0][0]-B[0][0])
    dp[0][0] |= ((1 << (ofs+x)) | (1 << (ofs-x)))

    for i in range(h):
        for j in range(w):
            x = abs(A[i][j]-B[i][j])
            t = 0
            if(i-1 >= 0):
                t |= dp[i-1][j]
            if(j-1 >= 0):
                t |= dp[i][j-1]
            dp[i][j] |= ((t << x) | (t >> x))

    for i, s in enumerate(bin(dp[-1][-1])[-ofs-1:]):
        if(s == '1'):
            write("%d\n" % i+1)
            return


if __name__ == "__main__":
    INF = float("inf")
    MOD = 10**9+7
    resolve()


### FIXED CODE ###

H, W = [int(x) for x in input().split()]

A = [[0]*W for i in range(H)]
for c in [1, -1]:
    for i in range(H):
        arr = [int(x) for x in input().split()]
        for j in range(W):
            A[i][j] += arr[j] * c

M = 160*80
dp = [[0]*W for i in range(H)]
dp[0][0] = 1 << M
for i in range(H):
    for j in range(W):
        if i > 0:
            dp[i][j] |= dp[i-1][j]
        if j > 0:
            dp[i][j] |= dp[i][j-1]
        a = abs(A[i][j])
        dp[i][j] = (dp[i][j] << a) | (dp[i][j] >> a)

ans = M
for i in range(2*M):
    if dp[H-1][W-1] & (1 << i) > 0:
        ans = min(ans, abs(M-i))
print(ans)
N = int(raw_input())
D1 = 20*5 + 19*5
D2 = 20*10

for i in xrange(N):
    y, m, d = map(int, raw_input().split())
    ans = 0
    if d != 1:
        if y % 3 == 0 or m % 2 == 1:
            last = 20
        else:
            last = 19
        ans += last - d + 1
        d = 1
        if m < 10:
            m += 1
        else:
            y += 1
            m = 1
    if m != 1:
        while m < 11:
            if y % 3 == 0 or m % 2 == 1:
                ans += 20javascript:void(0);
            else:
                ans += 19
            m += 1
        m = 1
        y += 1
    while y < 1000:
        if y % 3 == 0:
            ans += D2
        else:
            ans += D1
        y += 1
    print ans

### FIXED CODE ###

N = int(raw_input())
D1 = 20*5 + 19*5
D2 = 20*10

for i in xrange(N):
    y, m, d = map(int, raw_input().split())
    ans = 0
    if d != 1:
        if y % 3 == 0 or m % 2 == 1:
            last = 20
        else:
            last = 19
        ans += last - d + 1
        d = 1
        if m < 10:
            m += 1
        else:
            y += 1
            m = 1
    if m != 1:
        while m < 11:
            if y % 3 == 0 or m % 2 == 1:
                ans += 20
            else:
                ans += 19
            m += 1
        m = 1
        y += 1
    while y < 1000:
        if y % 3 == 0:
            ans += D2
        else:
            ans += D1
        y += 1
    print ans
for i in range(1,10):
    for j in range(1,10):
        print str(i) + "x" + str(j) + "=" str(i*j)

### FIXED CODE ###

for i in range(1,10):
    for j in range(1,10):
        print str(i) + "x" + str(j) + "=" +  str(i*j)
import math
def create_cricle(r):
  return r**2*math.pi
if __name__ == '__main__':
  print(int(create_cricle(input())/create_cricle(1)))

### FIXED CODE ###

print(int(int(input())**2))
S=input()
s=len(S)
if S[s] == "s":
  print(S+"es")
else:
  print(S+"s")
    

### FIXED CODE ###

S=input()
s=len(S)
if S[s-1] == "s":
  print(S+"es")
else:
  print(S+"s")
n = int(input())
#k(2~n)について、2~kの素数までで割り切れる回数をカウント

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(n)
prime_cnt = dict([(k,0) for k in prime_list])
from decimal import Decimal

for k in range(2,n+1):
    k = Decimal(k)
    for j in prime_list:
        j=Decimal(j)
        while k%j==0:
            prime_cnt[j]+=1
            k = k/j
        if k==1:
            break

import functools
import operator

print(functools.reduce(operator.mul, [v+1 for v in prime_cnt.values()])%(10**9+7))


### FIXED CODE ###

n = int(input())
#k(2~n)について、2~kの素数までで割り切れる回数をカウント

if n==1:
    print(1)
    import sys
    sys.exit()

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(n)
prime_cnt = dict([(k,0) for k in prime_list])
from decimal import Decimal

for k in range(2,n+1):
    k = Decimal(k)
    for j in prime_list:
        j=Decimal(j)
        while k%j==0:
            prime_cnt[j]+=1
            k = k/j
        if k==1:
            break

import functools
import operator


print(functools.reduce(operator.mul, [v+1 for v in prime_cnt.values()])%(10**9+7))
n,q=map(int,input().split())
s=list(input())
l=[]
for _ in range(q):
    [a,b]=map(int,input().split())
    l.append([a,b])

for i,j in l:
    ans=0
    tmp=0
    for k in range(i-1,j):
        if s[k]=="A" and s[k+1]=="C" and k!=j-1:
            ans+=1
    print(ans)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
# coding:utf-8
import readline
import datetime

H1 = int(input())
M1 = int(input())
H2 = int(input())
M2 = int(input())
K = int(input())

while H1 < 23 or M1 < 60 or H2 < 23 or M2 < 60:
  	H1 = int(input())
	M1 = int(input())
	H2 = int(input())
	M2 = int(input())
	K = int(input())
else:
    if M2 > M1:
        a = (H2 - H1) * 60 + M2 - M1
        print(a - K)
    else:
        M2 < M1
        b = (H2 - H1) * 60 + M1 - M2
        print(b - K)

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline

h1, m1, h2, m2, k = map(int, readline().split())
print(60 * (h2 - h1) + m2 - m1 - k)
A = int(input())
B = input()

if A >= 3200:
  print(red)
else:print(B)

### FIXED CODE ###

A = int(input())
B = input()

if A < 3200:
  print("red")
else:print(B)
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

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

m = a +b -c-d

if m>0:
    print("Left")
elif m =0:
    print("Balanced")
else:
    print("Right")

### FIXED CODE ###

#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

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

m = a +b -c-d

if m>0:
    print("Left")
elif m ==0:
    print("Balanced")
else:
    print("Right")
n = input()
h = input().split()

for i in range(1,N):
    if h[N-i] < h[N-i+1]:
        ans = i
        break
print(ans)

### FIXED CODE ###

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

ans = 0
mx = h[0]
for i in range(n):
    if h[i] >= mx:
        ans = ans + 1
        mx = h[i]
print(ans)
def input_from_console():
    n, x = map(int, input().split())
    l_list = list(map(int, input().split()))
    return n, x, l_list


def solve(n, x, l_list):
    result = 0
    position = 0
    for i in range(n+1):
        if position > x:
            return result
        result +=1
        position += l_list[i]



def main():
    n, x, l_list = input_from_console()
    print(solve(n, x, l_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


### FIXED CODE ###

def input_from_console():
    n, x = map(int, input().split())
    l_list = list(map(int, input().split()))
    return n, x, l_list


def solve(n, x, l_list):
    result = 0
    position = 0
    for i in range(n):
        if position > x:
            return result
        result +=1
        position += l_list[i]
    if position > x:
        return result 
    else:
        return result + 1



def main():
    n, x, l_list = input_from_console()
    print(solve(n, x, l_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()
import sys

N, K = map(int,input().split())
D = list(input().split())
flg = 1
for i in range(N, 10001):
    flg = 1
    cost = str(i)
    digit = len(cost)
    for j in range(digit):
        if cost[j] in D:
            flg = 0
            break
    if flg == 1:
        print(cost)
        sys.exit()
print("error")
sys.exit(1)

### FIXED CODE ###

import sys

N, K = map(int,input().split())
D = list(input().split())
for i in range(N, 100001):
    flg = 1
    cost = str(i)
    digit = len(cost)
    for j in range(digit):
        if cost[j] in D:
            flg = 0
            break
    if flg == 1:
        print(cost)
        sys.exit()
print("error")
N = int(input())
import math
def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num
s = [0,1]
for i in range(2,N):
    if i % 2 = 0:
        s.append(s[i//2]*2)
    else:
        s.append(num_divisors_trial_division(i))
print(sum(s))

    


### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1,N):
    x = (N-1)//i
    ans += x
print(ans)
from functools import reduce
n=int(input())
print(3**n-reduce(lambda x, y: x * y, 2-int(s)%2 for s in input().split()))

### FIXED CODE ###

from functools import reduce
n=int(input())
print(3**n-reduce(lambda x, y: x * y, (2-int(s)%2 for s in input().split())))
x = raw_input()

print x^3

### FIXED CODE ###

x = input()
print x**3
from itertools import product

N = int(input())
num_list = ["3", "5", "7"]
count = 0

for i in range(2,10):
    for t in product(num_list, repeat=i):
        check = t.count("3")*t.count("5").t.count("7")
        if int("".join(t)): <= N and check:
            count += 1

print(count)

### FIXED CODE ###

from itertools import product

N = int(input())
num_list = ["3", "5", "7"]
count = 0

for i in range(3, 10):
    for t in (product(num_list, repeat=i)):
        check = t.count("3")*t.count("5")*t.count("7")
        if int("".join(t)) <= N and check:
            count += 1


print(count)
# coding: utf-8
# Your code here!
n=int(input())
li = list(map(int,input().split()))
count=1
li2=[]
if(len(li)!=1):
    for i in range(1,n):
        if(i==1):
            if(li[0]>=li[1]):
                count+=1
            continue
        li2=li[0,i-1]
        if(max(li2)>=li[i]):
            count+=1
print(count)


### FIXED CODE ###

n=int(input())
li = list(map(int,input().split()))
count=1
m=n
for i in range(1,n):
    m=min(m,li[i-1])
    if(m==1):
        break
    if(m>=li[i]):
        count+=1
print(count)
H, W, D = map(int, input().split())

coord_dict_x = [0 for i in range(90001)]
coord_dict_y = [0 for i in range(90001)]

for i in range(H):
    gyo = [int(i) for i in input().split()]
    for j in range(W):
        coord_dict_x[gyo[j]] = i
        coord_dict_y[gyo[j]] = j

Q = int(input())
exam = [[int(i) for i in input().split()] for i in range(Q)]

for i in range(Q):
    reduce_MP = 0
    num = exam[i][0]
    coord1_x = coord_dict_x[num]
    coord1_y = coord_dict_y[num]
    while num < exam[i][1]:
        num += D
        coord2_x = coord_dict_x[num]
        coord2_y = coord_dict_y[num]
        reduce_MP += abs(coord1_x - coord2_x) + abs(coord1_y - coord2_y)
        coord1 = coord2
    print(reduce_MP)



### FIXED CODE ###

H, W, D = list(map(int, input().split()))

Amap = []
for i in range(H):
    Amap.append(list(map(int, input().split())))

xx = [0 for i in range(90002)]
yy = [0 for i in range(90002)]
for y in range(H):
    for x in range(W):
        xx[Amap[y][x]] = x
        yy[Amap[y][x]] = y
Q = int(input())

coord = []
for i in range(Q):
    coord.append(list(map(int, input().split())))

# magic point calculation
mp = [0 for i in range(90002)]

for i in range(D+1, 90002):
    mp[i] = mp[i-D] + abs(xx[i] -xx[i-D]) + abs(yy[i] - yy[i-D])

for i in coord:
    print(mp[i[1]] - mp[i[0]])
import sys
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())

H,W,D = Is()
d = dict()
for i in range(H):
    s = Is()
    for j,e in enumerate(s):
        d[e] = (i,j)
Q = I()

m = [[0]*H*W for i in range(H*W)] 
def calc(l,r):
    if m[l][r] != 0:
        return m[l][r]
    else:
        maho = abs(d[l+D][0] - d[l][0]) + abs(d[l+D][1] - d[l][1])
        m[l][l+D] = maho
        return maho
    
for q in range(Q):
    l,r = Is()
    maho = 0
    for k in range(l,r,D):
        maho += calc(k,r)
#        print(k,r,maho)
    print(maho)


### FIXED CODE ###

import sys
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())

H,W,D = Is()
d = dict()
for i in range(H):
    s = Is()
    for j,e in enumerate(s):
        d[e] = (i,j)
m = [0]*(H*W+1)
for i in range(D+1,H*W+1):
    m[i] = m[i-D] + abs(d[i-D][0] - d[i][0]) + abs(d[i-D][1] - d[i][1])

Q = I()
for q in range(Q):
    l,r = Is()
    print(m[r]-m[l])
n=int(input())
ans=10*100
for i in range(n)
  ans=min(ans,sum(map(int,input().split())))
print(ans)

### FIXED CODE ###

n=int(input())
ans=10**100
for i in range(n):
  t=sum(list(map(int,input().split())))
  ans=min(ans,t)
print(ans)
n,k=map(int,input().split())
n=n-(n//k)*k
print(min(n,k-n))

### FIXED CODE ###

a,b,c=map(int,input().split())
t=a
a=b
b=t
t=a
a=c
c=t
print(a,end=" ")
print(b,end=" ")
print(c)
N,K,M=map(int,input().split())
a=list(map(int,input().split()))

min = N*M - sum(a)

ans = -1

if 0 <= min <= K:
  ans = min
elif min < 0:
  ans = 0
  
print(ans)

### FIXED CODE ###

C = input()
print(chr(ord(C)+1))
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10−N)

print(ans)


### FIXED CODE ###

N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10 - N)

print(ans)
from collections import defaultdict
N=int(input())
A=[int(i) for i in input().split()][:N]
B=[int(i) for i in input().split()][:N]
arr=[0]*N
d=defaultdict(int)
for i in range(N):
  if A[i]==B[i]:
    d[B[i]]+=1
l=list(d.keys())
x=l.pop()
i=0
while i<N:
  if A[i]!=B[i]:
    #d[B[i]]-=1
    arr[i]=B[i]
    i+=1
  else:
    if d[x]!=0:
      if x!=A[i]:
        arr[i]=x
        d[x]-=1
        i+=1
      else:
        if len(l)>0:
          temp=x
          x=l.pop()
          l.append(temp)
        else:
          print("No")
          break
    else:
      if len(l)>0:
        x=l.pop()
      else:
        print("No")
        break
else:
  print("Yes")
  print(*arr)
#print(arr)

### FIXED CODE ###

from collections import defaultdict
def solve(N,A,B):
    d1=defaultdict(int)
    d2=defaultdict(int)
    for i in range(N):
        d1[A[i]]+=1
        d2[B[i]]+=1
    for i in d1:
        if d1[i]+d2[i]>N:
            return "No",[]
    else:
        return "Yes",B[::-1]
    
if __name__ == "__main__":
    N=int(input())
    A=[int(i) for i in input().split()][:N]
    B=[int(i) for i in input().split()][:N]
    a,b=solve(N,A,B)
    print(a)
    if b!=[]:
        #print(a)
        k,z=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=b[k]:
                b[i],b[k]=b[k],b[i]
                k+=1
            elif A[i]==b[i] and b[i]==b[k]:
                b[i],b[z]=b[z],b[i]
                z-=1
        z,k=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=b[k]:
                b[i],b[k]=b[k],b[i]
                k-=1
            elif A[i]==b[i] and b[i]==b[k]:
                b[i],b[z]=b[z],b[i]
                z+=1
        print(*b)
n = int(input())
l = list(map(int, input().split()))

cnt = 0
while all(a % 2 == 0 for a in A):
	A = [a / 2 for a in A]
    cnt += 1
print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
    A = [a / 2 for a in A]
    count += 1
print(count)
# -*- cording: utf-8 -*-

A,B = map(int, raw_input().split())
if A*B%2 == 0:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

a,b = map(int, raw_input().split())
if a*b%2 == 0:
    print('No')
else:
    print('Yes')
an=[int(x) for x in input().split()]
k=an[-1]
max=max(an[:-2])
min=min(an[:-2])
if max -min < k:
    print("Yay!")
else:
    print(":()")

### FIXED CODE ###

x=[int(input()) for _ in range(5)]
k=int(input())
max=max(x)
min=min(x)
if max-min <= k:
    print("Yay!")
else:
    print(":(")
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3] or S[3]==S[4]:
    print("Bad")
else:
    print("Good")

### FIXED CODE ###

S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print("Bad")
else:
    print("Good")
A = int(input())
B = int(input())
C = int(input())

if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)

### FIXED CODE ###

A = input().split()

if A[0] == A[1]:
    print(A[2])
elif A[0] == A[2]:
    print(A[1])
else:
    print(A[0])
n = int(input())

name_len = [0]
while True:
  name_len.append(name_len[-1]+26**(len(name_len)))
  if name_len[-1] > 1000000000000001:
    break

#print(name_len) 

number = 0
for i in range(len(name_len)):
  if name_len[i] < n and n <= name_len[i+1]:
    number = i+1
    break

#print(number)
#print(n)
n -= name_len[number-1]
#print(n)

ans = ""
li = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for i in range(number,0,-1):
  if i == 1:
    ans += li[int(n / 26**(i-1))-1]
  else:
    ans += li[int(n / 26**(i-1))]
  n = n% 26**(i-1)

print(ans)

  

### FIXED CODE ###

n = int(input())

name_len = [0]
while True:
  name_len.append(name_len[-1]+26**(len(name_len)))
  if name_len[-1] > 1000000000000001:
    break

#print(name_len) 

number = 0
for i in range(len(name_len)):
  if name_len[i] < n and n <= name_len[i+1]:
    number = i+1
    break

#print(number)
#print(n)
n -= name_len[number-1]
#print(n)

ans = ""
li = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
#print(len(li))

for i in range(number,0,-1):
  #print(i,n)
  #print(int(n/26**(i-1)))
  #print(li[25])
  if i == 1:
    ans += li[int(n / 26**(i-1))-1]
  else:
    if n%26**(i-1) == 0:
      ans += li[int(n / 26**(i-1))-1]
    else:
      ans += li[int(n / 26**(i-1))]
  n = n% 26**(i-1)

print(ans)
import numpy as np
N,K=map(int,input().split())
a=[[int(i) for i in input().split()] for _ in range(N)]
a=np.array(a,dtype=np.int64)
MOD=10**9+7

def matmul(A,B,MOD):
    N=len(A)
    C=np.zeros(N,dtype=np.int64)
    for i in range(N):
        for j in range(N):
            for k in range(N):
                C[i][j] += A[i][k]*B[k][j]%MOD
    return C

def mat_power(A,k,MOD):
    N=len(A)
    D=np.identity(N,dtype=np.int64)
    while k:
        if k & 1:
            D=matmul(D,A,MOD)
        A = matmul(A,A,MOD)
        k >>= 1

    return D

A=mat_power(a,K,MOD)
ans=0
for i in range(N):
    for j in range(N):
        ans=(ans+A[i][j])%MOD

print(ans)


### FIXED CODE ###

import numpy as np
N,K=map(int,input().split())
a=[[int(i) for i in input().split()] for _ in range(N)]
a=np.array(a,dtype=np.int64)
MOD=10**9+7

def matmul(A,B,MOD):
    N=len(A)
    C=np.zeros((N,N),dtype=np.int64)

    for n in range(N):
        C[n] = (A[n,:][:,None] * B % MOD).sum(axis=0) % MOD
    return C

def mat_power(A,k,MOD):
    N=len(A)
    D=np.identity(N,dtype=np.int64)
    while k:
        if k & 1:
            D=matmul(D,A,MOD)
        A = matmul(A,A,MOD)
        k >>= 1

    return D

A=mat_power(a,K,MOD)
ans=0
for i in range(N):
    for j in range(N):
        ans=(ans+A[i][j])%MOD

print(ans)
import sys
import math

a,b,h,m = (float(x) for x in input().split())

zi = 0.5 * 60 * h + 0.5 * m
hun = 6 * h * 60 + 6 * m

if hun >= 360:
    for i in range(12):

        if hun >= 360:
            hun = hun - 360 
        elif hun < 360:
            break

#print(zi)

if hun > zi:
    if hun - zi > 180:
        degree = 360 - hun + zi
    elif hun - zi < 180:
        degree = hun - zi
    elif hun - zi == 180:
        print(a + b)
        sys.exit()

elif zi > hun: 
    if zi - hun > 180:
        degree = 360 - zi + hun
    elif zi - hun < 180:
        degree = zi - hun
    elif hun - zi == 180:
        print(a + b)
        sys.exit()
elif hun == zi:
    if b >= a:
        print(b - a)
        sys.exit()
    else:
        print(a-b)
        sys.exit()

cosain = math.cos(math.radians(degree))

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cosain))


    

### FIXED CODE ###

import sys
import math

a,b,h,m = (float(x) for x in input().split())

zi = 0.5 * 60 * h + 0.5 * m
hun = 6 * h * 60 + 6 * m

if hun >= 360:
    for i in range(11):

        if hun >= 360:
            hun = hun - 360 
        elif hun < 360:
            break



if hun > zi:
    if hun - zi > 180:
        degree = 360 - hun + zi
    elif hun - zi < 180:
        degree = hun - zi
    elif hun - zi == 180:
        print(a + b)
        sys.exit(0)

elif zi > hun: 
    if zi - hun > 180:
        degree = 360 - zi + hun
    elif zi - hun < 180:
        degree = zi - hun
    elif zi - hun == 180:
        print(a + b)
        sys.exit(0)
elif hun == zi:
    if b >= a:
        print(b - a)
        sys.exit(0)
    else:
        print(a-b)
        sys.exit(0)

cosain = math.cos(math.radians(degree))

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cosain))
a = input()
num=0
b=[]
for i in a:
  if a[i] in 'ATGC':
    num+=1
  else:
    b.append(num)
    num=0
print(max(b))
    

### FIXED CODE ###

a = input()+"a"
num=0
b=[]
for i in a:
  if i in 'ATGC':
    num+=1
  else:
    b.append(num)
    num=0
print(max(b))