Harryxun/stf_run huggingface dataset:
N = int(input())

N_str = str(N)
N_keta = N_str[0] + N_str[1]
N_keta = int(N_keta)

if N_keta % N == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())

N_str = str(N)
N_keta = []
N_sum = 0

for i in range(len(N_str)):
    N_keta.append(int(N_str[i]))
N_sum = sum(N_keta)

if N % N_sum == 0:
    print('Yes')
else:
    print('No')
n = int(input())
l = list(map(int,input().split()))
sa = []
for i in range(n-1):
    sa.append(l[i+1]-l[i])

mod = 10**9+7
ans = 0
count = 0
kai = 1
for i in range(n-1):
    count += 1/(i+1)
    kai *= (i+1)
    
    ans += sa[i]*count
    ans %= mod

print(int(kai*ans%mod))


### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
sa = []
for i in range(n-1):
    sa.append(l[i+1]-l[i])

mod = 10**9+7
ans = 0
count = 0
kai = 1
for i in range(1,n):
    kai *= i
    kai %= mod
    
for i in range(n-1):
    count += pow((i+1),mod-2,mod)
    
    ans += sa[i]*count
    ans %= mod


print(int(kai*ans%mod))
a, b, k = map(int, input().split())
a, b = sorted([a, b])
lst = []

if b != 1:
    for i in range(1, b):
        if a%i==b%i==0:
            lst.append(i)

else:
    lst.append(1)

lst.reverse()
print(lst[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split())
a, b = sorted([a, b])
lst = []

if b != 1:
    for i in range(1, a+1):
        if a%i==b%i==0:
            lst.append(i)

else:
    lst.append(1)

lst.reverse()
print(lst[k-1])
a, b, c, d=map(int,input().split)
k1=abs(a,b)
k2=abs(a,c)
k3=abs(b,c)
if (k2<=d):
  print("Yes")
elif (k1<=d || k2<=d):
  print("Yes")
else print("No")

### FIXED CODE ###

a, b, c, d=map(int,input().split())
k1=abs(a-b)
k2=abs(a-c)
k3=abs(b-c)
if k2<=d:
  print("Yes")
elif k1<=d and k3<=d:
  print("Yes")
else:
  print("No")
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
node=[]
if n%2==0:
    for i in range(n):
        for j in range(i,n):
            if j==i or j==n-1-i:
                continue
            node.append((i+1,j+1))
else:
    for i in range(n):
        for j in range(i,n):
            if j==i or j==n-2-i:
                continue
            node.append((ix+1,j+1))
    
print(len(node))
for i in node:
    print(*i) 

### FIXED CODE ###

#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
node=[]
if n%2==0:
    for i in range(n):
        for j in range(i,n):
            if j==i or j==n-1-i:
                continue
            node.append((i+1,j+1))
else:
    for i in range(n):
        for j in range(i,n):
            if j==i or j==n-2-i:
                continue
            node.append((i+1,j+1))
    
print(len(node))
for i in node:
    print(*i)
import math

def main():
    s = str(input())
    first = s[0]
    cnt_l = []
    tmp_cnt = 1
    prev_s = first
    for curr_s in s[1:]:
        if prev_s != curr_s:
            cnt_l.append(tmp_cnt)
            tmp_cnt = 1
        else:
            tmp_cnt+=1
        prev_s = curr_s
    cnt_l.append(tmp_cnt)

    ans_l = []
    last_num = 0
    if first == '>':
        down_cnt = ans_l[0]
        for d in range(down_cnt):
            ans_l.append(down_cnt-1-d)
        ans_l = ans_l[1:]

    # if first == '<':
    # print(cnt_l)
    ans_l.append(0)
    last_num = 0
    for i in range(math.ceil(len(cnt_l)/2)):
        # print('i',i)
        up_cnt = cnt_l[i*2]
        if i*2+1 >= len(cnt_l):
            down_cnt = 0
        else:
            down_cnt = cnt_l[i*2+1]
        # print(up_cnt,down_cnt)
        # print()
        for u in range(up_cnt):
            if u != up_cnt-1:
                last_num+=1
                ans_l.append(last_num)
            else:
                last_num = max(last_num+1, down_cnt)
                ans_l.append(last_num)
        for d in range(down_cnt):
            if d==0:
                if last_num > down_cnt:
                    last_num = down_cnt-1
                else:
                    last_num-=1
                ans_l.append(last_num)
            else:
                last_num-=1
                ans_l.append(last_num)

    # print(ans_l)
    print(sum(ans_l))

if __name__ == "__main__":
    main()

### FIXED CODE ###


import math

def main():
    s = str(input())
    first = s[0]
    cnt_l = []
    tmp_cnt = 1
    prev_s = first
    for curr_s in s[1:]:
        if prev_s != curr_s:
            cnt_l.append(tmp_cnt)
            tmp_cnt = 1
        else:
            tmp_cnt+=1
        prev_s = curr_s
    cnt_l.append(tmp_cnt)

    ans_l = []
    last_num = 0
    if first == '>':
        down_cnt = cnt_l[0]
        for d in range(down_cnt):
            ans_l.append(down_cnt-d)
        cnt_l = cnt_l[1:]

    # if first == '<':
    # print(cnt_l)
    ans_l.append(0)
    last_num = 0
    for i in range(math.ceil(len(cnt_l)/2)):
        # print('i',i)
        up_cnt = cnt_l[i*2]
        if i*2+1 >= len(cnt_l):
            down_cnt = 0
        else:
            down_cnt = cnt_l[i*2+1]
        # print(up_cnt,down_cnt)
        # print()
        for u in range(up_cnt):
            if u != up_cnt-1:
                last_num+=1
                ans_l.append(last_num)
            else:
                last_num = max(last_num+1, down_cnt)
                ans_l.append(last_num)
        for d in range(down_cnt):
            if d==0:
                if last_num > down_cnt:
                    last_num = down_cnt-1
                else:
                    last_num-=1
                ans_l.append(last_num)
            else:
                last_num-=1
                ans_l.append(last_num)

    # print(ans_l)
    print(sum(ans_l))

if __name__ == "__main__":
    main()
r = input()
print(r**2)

### FIXED CODE ###

r = int(input())
print(r**2)
N,W=map(int,input().split())
dp=[[0]*(W+1) for _ in range(N+1)]
for i in range(N+1):
  w,v=map(int,input())
  for j in range(W+1):
    if j-w>=0:
      dp[i+1][j]=max(dp[i][j],dp[i][j-w]+v)
    else:
      dp[i+1][j]=dp[i][j]
print(max(dp[N]))

### FIXED CODE ###

N,W=map(int,input().split())
dp=[[0]*(W+1) for _ in range(N+1)]
for i in range(N):
  w,v=map(int,input().split())
  for j in range(W+1):
    if j-w>=0:
      dp[i+1][j]=max(dp[i][j],dp[i][j-w]+v)
    else:
      dp[i+1][j]=dp[i][j]
print(max(dp[N]))
def B(N,X,m):
    ret=0
    X-=sum(m)
    ret+=len(m)
    
    ret+=int(X/min(m))
    
    return ret

inp=input().split()
print(B(inp[0],inp[1],inp[2:]))


### FIXED CODE ###

def main(func):
    ret=func(input())
    print(ret)


def A(S):
    ret=700
    ret+=S.count("o")*100
    return ret

main(A)
a,b,c,k=map(int,input().split())
vis=[1]*a + [0]*b + [-1]*c
s = 0

sum(vis[0:k])
    
print(s)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
if a >= k:
    vis = k
elif a + b >= k:
    vis = a
else:
    vis= a + (-1*(k-a-b))
    
print(vis)
N = int(input())
A_list = list(map(int, input().split()))
bosses = [0] * N

for i in A_list:
    bosses[i-1] += 1
for boss in bosses:
    print(boss)

### FIXED CODE ###

print(6.283*int(input()))
N, A, B = map(int, input().split())
res = 0

for n in range(1+N):
  if A <= sum([int(s) for s in str(n)]) <= B:
    res += s
    
print(res)

### FIXED CODE ###

N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)
H,W=map(int, input().split())
L=[]
for h in range(H):
    l=list(input())
    L.append(l)

vac=[]
wall=[]
for h in range(H):
    for w in range(W):
        l=L[h][w]
        if l=="#":
            wall.append((h,w))
        else:
            vac.append((h,w))
ans=[]
for vt in vac:
    h1,w1=vt
    now=10**5
    for wt in wall:
        h2,w2=wt
        now=min(now, abs(h2-h1)+abs(w2-w1))
    ans.append(now)

print(max(ans))

### FIXED CODE ###

from collections import deque
H,W=map(int, input().split())

A=[]
que=[]
done=[[-1]*W for _ in range(H)]
for h in range(H):
    a=list(input())
    A.append(a)
    for w in range(W):
        if a[w]=="#":
            que.append((h,w))
            done[h][w]=0

d=[(1,0),(-1,0),(0,1),(0,-1)]
que=deque(que)
ans=0
while que:
    h,w=que.popleft()
    now=done[h][w]
    for t in d:
        dh,dw=t
        nh=h+dh
        nw=w+dw
        if 0<=nh<H and 0<=nw<W:
            if done[nh][nw]==-1:
                done[nh][nw]=now+1
                que.append((nh,nw))
                ans=max(ans, now+1)



print(ans)
int = int(input())
y = 1000
for i in range(10):
    z = y*i
    if int <= z:
        o = z - int
        break;
    else:
        pass

print(o)  

### FIXED CODE ###

int = int(input())
y = 1000
for i in range(1,11):
    z = y*i
    if int <= z:
        o = z - int
        break;
    else:
        pass

print(o)
if __name__ == "__main__":
  l = [0,2,5,5,4,5,6,3,7,6]
  n,m = list(map(int,input().split()))
  a = list(map(int,input().split()))
  res = ''
  INF = 10**4
  
  dp = [[0,0] for i in range(n+1)]
  for i in range(n):
    for j in range(m):
      if dp[i][1] + l[a[j]] != i + l[a[j]] or i + l[a[j]] > n:
        pass
      else:
        dp[i + l[a[j]]][0] = max(dp[i][0] + 1, dp[i + l[a[j]]][0])
        dp[i + l[a[j]]][1] = dp[i][1] + l[a[j]]
  for i in range(1,n): dp[i][0] = -INF if dp[i][0] == 0 else dp[i][0]
  
  a.sort(reverse = True)
  i = n
  for k in range(dp[n][0], 0, -1):
    for j in range(m):
      if dp[i - l[a[j]]][0] + 1 == dp[i][0]:
        res += str(a[j])
        i -= l[a[j]]
        break
      else:
        pass
  print(res)



### FIXED CODE ###

if __name__ == "__main__":
  l = [0,2,5,5,4,5,6,3,7,6]
  n,m = list(map(int,input().split()))
  a = list(map(int,input().split()))
  res = ''
  INF = 10**4
  
  dp = [[0,0] for i in range(n+1)]
  for i in range(n):
    for j in range(m):
      if dp[i][1] + l[a[j]] != i + l[a[j]] or i + l[a[j]] > n:
        pass
      else:
        dp[i + l[a[j]]][0] = max(dp[i][0] + 1, dp[i + l[a[j]]][0])
        dp[i + l[a[j]]][1] = dp[i][1] + l[a[j]]
  for i in range(1,n): dp[i][0] = -INF if dp[i][0] == 0 else dp[i][0]
  
  a.sort(reverse = True)
  i = n
  while i > 0:
    for j in range(m):
      if i >= l[a[j]] and dp[i - l[a[j]]][0] + 1 == dp[i][0]:
        res += str(a[j])
        i -= l[a[j]]
        break
      else:
        pass
  print(res)
n = int(input())
pos = []
diff = []
for _ in range(n):
  x,y = map(int,input().split())
  for px,py in pos:
    diff.append((x-px, y-py))
    diff.append((px-x, py-y))
  pos.append((x,y))
from collections import Counter
diff = Counter(diff).most_common()
x,y = diff[0][0]
count = diff[0][1]
if x== y == 0:
  x,y = diff[1][0]
  count = diff[1][1]
print(n-count)



### FIXED CODE ###

n = int(input())
if n== 1:
  print(1)
  exit()
pos = []
diff = []
for _ in range(n):
  x,y = map(int,input().split())
  for px,py in pos:
    diff.append((x-px, y-py))
    diff.append((px-x, py-y))
  pos.append((x,y))
from collections import Counter
diff = Counter(diff).most_common()
x,y = diff[0][0]
count = diff[0][1]
if x== y == 0:
  x,y = diff[1][0]
  count = diff[1][1]
print(n-count)
n,k=map(int,input().split())
ans=0
hlist=[int(input()) for i in range(n)]
for height in hlist:
  if height>=k:
    ans+=1
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
ans=0
hlist=list(map(int,input().split()))
for height in hlist:
  if height>=k:
    ans+=1
print(ans)
n, m, k = map(int, input().split())

candidates = [0] * n
friends = [set() for _ in range(n)]
blocks = [set() for _ in range(n)]
parent = [i for i in range(n)]
sizes = [1 for _ in range(n)]

def root(x):
    global parent
    if parent[x] == x:
        return x
    else:
        parent[x] = root(parent[x])
        return parent[x]

def unite(x, y):
    global parent
    global sizes
    x = root(x)
    y = root(y)
    if x == y:
        return
    parent[x] = y
    # sizes[x] = sizes[x] + sizes[y]
    # sizes[y] = sizes[x]

def same(x, y):
    return root(x) == root(y)

for _ in range(m):
    a, b = map(int, input().split())
    friends[a - 1].add(b - 1)
    friends[b - 1].add(a - 1)
    unite(a - 1, b - 1)

for _ in range(k):
    c, d = map(int, input().split())
    if same(c - 1, d - 1):
        blocks[c - 1].add(d - 1)
        blocks[d - 1].add(c - 1)

for i in range(n):
    x = root(i)
    s = sizes[x]
    candidates[i] = s - len(friends[i]) - len(blocks[i]) - 1

print(*candidates)


### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.parents = [i for i in range(n + 1)]
        self.sizes = [1] * (n + 1)

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if y < x:
            x, y = y, x
        self.parents[y] = x
        self.sizes[x] += self.sizes[y]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self.sizes[self.find(x)]


n, m, k = map(int, input().split())
uf = UnionFind(n)
friends = [0] * n
blocks = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    friends[a - 1] += 1
    friends[b - 1] += 1
    uf.unite(a - 1, b - 1)
for i in range(k):
    c, d = map(int, input().split())
    if uf.same(c - 1, d - 1):
        blocks[c - 1] += 1
        blocks[d - 1] += 1
ans = [0] * n
for i in range(n):
    ans[i] = uf.size(i) - friends[i] - blocks[i] - 1
print(*ans)
import sys
def decode(s):
    x=""
    for c in s:
        if c in " .":
            x+=c
        else:
            x+=chr(ord(c)+1)
    return x.replace(chr(ord("z")+1),"a")

for s in sys.stdin.readlines():
    for i in xrange(ord("z")-ord("a")+1):
        if "the" in s or "that" in s or "this" in s:
            print s[:-1]
            break
      s=decode(s)

### FIXED CODE ###

import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin:
    while not("the" in s or "that" in s or "this" in s):
        s=s.translate(tbl)
    print s[:-1]
from math import factorial

N=int(input())
x=list(map(int,input().split()))
MOD=10**9+7


x_dist=[x[i+1]-x[i] for i in range(N-1)]

def Cn(n,Cn_1):
    return Cn_1+1/n

ans=0
Cn_list=[1]

for n in range(2,N):
    temp=Cn(n,Cn_list[n-2])
    Cn_list.append(temp)

for i in range(N-1):
    ans+=Cn_list[i]*x_dist[i]

print(int((ans*factorial(N-1)))%MOD)

### FIXED CODE ###

MOD = 10 ** 9 + 7
N = int(input())
x = list(map(int, input().split()))
x.sort()
 
kaijo = [1]
for i in range(1, N):
    kaijo.append(kaijo[-1] * i % MOD)
 
ans = 0
for i in range(N - 1):
    ans = (ans * (i + 1) + (x[-1] - x[i]) * kaijo[i]) % MOD
 
print(ans)
N = int(input())

if N%4 == 0:
    print("Yes")

if N%7 == 0:
    print("Yes")

if N%4 == 1:
    if N < 29:
        print("No")
    else:
        print("Yes")

if N%4 == 2:
    if N < 11:
        print("No")
    elif N < 15:
        print("No")
    else:
        print("Yes")

    
if N%4 == 3:
    if N > 10:
        print("Yes")
    else:
        print("N

### FIXED CODE ###

N = int(input())

if N%4 == 0:
    print("Yes")

if N%4 == 1:
    if N < 21:
        print("No")
    else:
        print("Yes")

if N%4 == 2:
    if N < 14:
        print("No")
    else:
        print("Yes")


if N%4 == 3:
    if N < 7:
        print("No")
    else:
        print("Yes")
def yakusu(n):
    m=1
    re=[]
    while m**2<n:
        a,md=divmod(n,m)
        if md==0:
            re.append(m)
            re.append(a)
        m+=1
    if m**2==n:
        re.append(m)
    return re

n, k = map(int, input().split())
aa = list(map(int, input().split()))
yk = yakusu(sum(aa))
yk.sort(reverse=True)
for y in yk:
    rs=[a%y for a in aa if a%y]
    rs.sort()
    l=0
    sl=rs[0]
    r=len(rs)-1
    sr=y-rs[r]
    while 1:
        if l+1==r:
            if sl==sr and sl<=k:
                print(y)
                exit()
            else:
                break
        if sl>sr:
            r-=1
            sr+=y-rs[r]
            if sr>k:break
        else:
            l+=1
            sl+=rs[l]
            if sl>k:break
print(1)


### FIXED CODE ###

def yakusu(n):
    m = 1
    re = []
    while m ** 2 < n:
        a, md = divmod(n, m)
        if md == 0:
            re.append(m)
            re.append(a)
        m += 1
    if m ** 2 == n:
        re.append(m)
    return re

n, k = map(int, input().split())
aa = list(map(int, input().split()))
yk = yakusu(sum(aa))
yk.sort(reverse=True)
for y in yk:
    rs = [a % y for a in aa if a % y]
    if not rs:
        print(y)
        exit()
    if len(rs)==1:continue
    rs.sort()
    l = 0
    sl = rs[0]
    r = len(rs) - 1
    sr = y - rs[r]
    while 1:
        if l + 1 == r:
            if sl == sr and sl <= k:
                print(y)
                exit()
            else:
                break
        if sl > sr:
            r -= 1
            sr += y - rs[r]
            if sr > k: break
        else:
            l += 1
            sl += rs[l]
            if sl > k: break
print(1)
b=input()
print(b.translate(b.maketrans({'A':'x'},{'C':'y'},{'T':'A'},{'G':'C'},{'x':'C'},{'y':'G'})))

### FIXED CODE ###

b=str(input())
print(b.translate(b.maketrans({'A':'T','C':'G','T':'A','G':'C'})))
import itertools
N, K = map(int, input().split())
input_n = list(map(int, input().split()))
pair = itertools.combinations(input_n, 2)
res = [i[0] * i[1] for i in pair]
res.sort()
print(res[K-1])

### FIXED CODE ###

A, B, C = map(int, input().split())
if A == B and A == C:
    print("No")
elif A == B or A == C or B == C:
    print("Yes")
else:
    print("No")
def seek_dup(s):
    t_list = [t for (t, d) in s]
    #d_list = [d for (t, d) in s]

    for t, d in reversed(s):
        if t_list.count(t) > 1:
            return (t, d)
        else:
            continue
        
    return None

N, K = map(int, input().split())
menu = []

for i in range(N):
    t, d = map(int, input().split())
    menu.append((t, d))

sorted(menu, key = lambda x:x[1], reverse=True)
ans = sum([d for (t, d) in menu[:K]]) + len(set([t for (t, d) in menu[:K]]))**2

selected_menu = menu[:K]
#t_list = [t for (t, d) in selected_menu]
#d_list = [d for (t, d) in selected_menu]
p = ans
for m in menu[K:]:
    t_list = [t for (t, d) in selected_menu]
    d_list = [d for (t, d) in selected_menu]
    
    if m[0] not in t_list:
        d = seek_dup(selected_menu)
        if d == None:
            continue
        
        selected_menu.remove(d)
        selected_menu.append(m)
    
    p += (m[1] - d[1]) + 2 * len(set(t_list)) - 1 
    #print(ans, p)
    ans = max(ans, p)

print(ans) 

### FIXED CODE ###

N, K = map(int, input().split())
menu_ = []

for i in range(N):
    t, d = map(int, input().split())
    menu_.append((t, d))

menu = sorted(menu_, key = lambda x:x[1], reverse=True)
neta = set()
duplicates = []

for m in menu[:K]:
    if m[0] in neta:
        duplicates.append(m[1])
    else:
        neta.add(m[0])

p = sum([d for (t, d) in menu[:K]]) + len(neta)**2
ans = p

for m in menu[K:]:
    if m[0] not in neta and duplicates:
        neta.add(m[0])
        duplicate = duplicates.pop()
        
        p += (m[1] - duplicate) + 2 * len(neta) - 1 
        #print(ans, p)
        ans = max(ans, p)

print(ans)
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = (1 + (N - 1)) / 2 * (N - 1)

    a = np.arange(start=1, step=1, stop=N+1)
    bol = (N % a > a)
    if np.any(bol):
        ans += np.sum((N % a)[bol] - a)

    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = np.int64(input())
    #print(N)
    #ans = np.int64((1 + (N - 1)) / 2 * (N - 1))
    ans = (1 + (N - 1)) * (N - 1) // 2
    print(int(ans))
if __name__ == '__main__':
    main()
print((int(input())+int(input()))*2)


### FIXED CODE ###

s = input().split()
print(int(s[0])*int(s[1]),(int(s[0])+int(s[1]))*2)
(a, b, c, wanted_a, wanted_b) = (int(tok) for tok in input().split())

res = wanted_a * a + wanted_b * b
for both in range(max(wanted_a, wanted_b) * 2):
  left_a = wanted_a - both // 2
  left_b = wanteD_b - both // 2
  cost = both * c + max(0, left_a) * a + max(0, left_b) * b
  res = min(res, cost)

print(res)

### FIXED CODE ###

(a, b, c, wanted_a, wanted_b) = (int(tok) for tok in input().split())

res = wanted_a * a + wanted_b * b
for both in range(max(wanted_a, wanted_b) * 2 + 1):
  left_a = wanted_a - both // 2
  left_b = wanted_b - both // 2
  cost = both * c + max(0, left_a) * a + max(0, left_b) * b
  res = min(res, cost)

print(res)
a = list(map(int,input().split()))
print(aa.index(0))

### FIXED CODE ###

a = list(map(int,input().split()))
print(a.index(0) + 1)
# C - Vacation AC
import sys
sys.setrecursionlimit(10**6)
N = int(input())
A = []
for _ in range(N):
    a,b,c = map(int,input().split())
    A.append((a,b,c))

# 無限大の値
INF = 10**10

# DP テーブル
dp = [[0]*3 for _ in range(100010)]

# DP テーブル全体を初期化
for i in range(5):
    for j in range(3):
        dp[i][j] = 0# 最大化問題

def rec(v):
    # v-1 日目の活動 (本当は v)
    for w in range(100010):
        print(v,w)
        if dp[v][w] > 0:
       
            return dp[v]
        if v == 0:
            dp[v][w] = 0
         
            return dp[v]
        res = 0
        # v 日目の活動 (本当は v-1)
        for k in range(3):
            if w == k:
               
                continue
            res = max(res,rec(v-1)[k] + A[v-1][w]) # v-1日の活動のところに記録している？
            dp[v][w] = res # ここで kを記録しているのに w を呼び出していた
            print(v,w,k,dp[v])
    return dp[v]

rec(N)
ans = max(dp[N])
print(ans)
# w がずっと 0
# w と k の扱いが逆

### FIXED CODE ###

# C - Vacation
N = int(input())
A = []
for _ in range(N):
    a,b,c = map(int,input().split())
    A.append((a,b,c))
    
# 無限大の値
INF = 10**10

# DP テーブル (値と前に選んだ活動を保持)
# a (j = 0), b (j = 1), c (j = 2)に記録
dp = [[0]*3 for _ in range(100010)]

# DP テーブル全体を初期化
for i in range(100010):
    for j in range(3):
        dp[i][j] = -INF# 最大化問題
        
# 初期条件
dp[0][0],dp[0][1],dp[0][2] = 0,0,0
        
# v 日目以前に (v 日目以前の幸福度最大値を求める)
for v in range(1,N+1):
    # v-1 日目の活動
    for w in range(3):
        # v 日目の活動
        for k in range(3):
            # 前日と活動が同じならスルー
            if w == k:
                continue
            # v 日目の情報は A[v-1] であることに注意
            dp[v][k] = max(dp[v][k], dp[v-1][w] + A[v-1][k])

# N 日目以前の幸福度最大値を出力
ans = max(dp[N])            
print(ans)
S = input()

ans = list()
ans_tmp = list()

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
    ans_tmp.append(s)
  else:
    if len(ane_tmp) > len(ans):
      ans = ans_tmp
      ans_tmp = list()

print(len(ans))

### FIXED CODE ###

S = input()

ans = 0
ans_tmp = 0

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
      ans_tmp += 1
  else:
    ans = max(ans_tmp, ans)
    ans_tmp = 0
ans = max(ans_tmp, ans)

print(ans)
import math

a, b, c, d = map(int, input().split())
cxd = (c * d) // math.gcd(c, d)
sa = b - a

print(sa - ((sa//c + sa//d) - sa//cxd))

### FIXED CODE ###

import fractions

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

cxd = (c * d) // fractions.gcd(c, d)
sa = b - a
ans = (b - b//c - b//d + b//cxd) - ((a-1) - (a-1)//c - (a-1)//d + (a-1)//cxd)

print(ans)
[InternetShortcut]
URL=https://atcoder.jp/contests/abc043/custom_test
import collections

S = list(input())
n = collections.Counter(S).most_common()[0][1]
for i in range(2, min(2*n,len(S)+1)):
    for j in range(0,len(S)-(i-1)):
        s = S[j:j+i]
        s_com = collections.Counter(s).most_common()
        for com in s_com:
            if com[1] >= i//2+1:
                print(j,j+i);exit()
            elif com[1] <i//2+1:
                break

print("-1 -1")

### FIXED CODE ###

S = input()
if len(S)==2 and S[0]==S[1]:
    print(1,2);exit()
for i in range(len(S)-2):
    if S[i] == S[i+1] or S[i] == S[i+2] or S[i+1] == S[i+2]:
        print(i+1,i+3);exit()
print("-1 -1")