Harryxun/stf_run huggingface dataset:
N, C = map(int, input().split())
table = [[0]*(10**5 + 1) for i in range(C)]

st = [[] for i in range(C)]
for i in range(N):
  s, t, c = map(int, input().split())
  st[c-1].append([s, t])

st_new = [[] for i in range(C)]
for c in range(C):
  if st[c]:
    st[c].sort()
    st_new[c].append(st[c][0])
    n = len(st[c])
    for i in range(1, n):
      si, ti = st[c][i]
      sii, tii = st_new[c][i-1]
      if si == tii:
        st_new[c][i-1][1] = ti
      else:
        st_new[c].append([si, ti])

for c in range(C):
  for s, t in st_new[c]:
    table[c][s-1] += 1
    table[c][t] -= 1
  
for c in range(C):
  for i in range(1, 10**5+1):
    table[c][i] += table[c][i-1]

ans = 0
for i in range(10**5 + 1):
  num = 0
  for c in range(C):
    num += table[c][i]
  ans = max(ans, num)

print(ans)

### FIXED CODE ###

N, C = map(int, input().split())
table = [[0]*(10**5 + 1) for i in range(C)]

st = [[] for i in range(C)]
for i in range(N):
  s, t, c = map(int, input().split())
  st[c-1].append([s, t])

st_new = [[] for i in range(C)]
for c in range(C):
  if st[c]:
    st[c].sort()
    st_new[c].append(st[c][0])
    n = len(st[c])
    for i in range(1, n):
      si, ti = st[c][i]
      sii, tii = st_new[c][-1]
      if si == tii:
        st_new[c][-1][1] = ti
      else:
        st_new[c].append([si, ti])

for c in range(C):
  for s, t in st_new[c]:
    table[c][s-1] += 1
    table[c][t] -= 1
  
for c in range(C):
  for i in range(1, 10**5+1):
    table[c][i] += table[c][i-1]

ans = 0
for i in range(10**5 + 1):
  num = 0
  for c in range(C):
    num += table[c][i]
  ans = max(ans, num)

print(ans)
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(dif, axis=-1)


idx = np.unravel_index(np.argmax(dis),dis.shape)
#print(dis)
#print(idx)
print(dis[idx])

### FIXED CODE ###

# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))
l = input().split

a = l[0]
b = l[1]
c = l[2]

if (a == b and a != c )or (c == b and a != c )or (a == c and b != c ):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

l = str(input()).split()
 
a = l[0]
b = l[1]
c = l[2]
 
if (a == b and a != c )or (c == b and a != c )or (a == c and b != c ):
    print("Yes")
else:
    print("No")
import numpy as np
a,b = map(int, input().split())
grid1 = np.full((50,100), '.')
grid2 = np.full((50,100), '#')
a = a-1
b = b-1
x = y = 1
for i in range(a):
    grid2[x, y] = '.'
    y += 2
    if y != y % 100:
        x += 2
    y = y % 100
    if x >= 50 or y >= 100:break

x = y = 1
for i in range(b):
    grid1[x, y] = '#'
    y += 2
    if y != y % 100:
        x += 2
    y = y % 100
    if x >= 50 or y >= 100:break

print(100, 100)
grid = np.concatenate((grid1, grid2), axis=0)
for row in grid:
    print(''.join(row))

### FIXED CODE ###

import numpy as np
a,b = map(int, input().split())
grid1 = [['.' for j in range(100)] for i in range(50)]
grid2 = [['#' for j in range(100)] for i in range(50)]
a -= 1
b -= 1
x = y = 1

for i in range(a):
    grid2[x][y] = '.'
    y += 2
    if y != y % 100:
        x += 2
    y = y % 100
    if x >= 50 or y >= 100:break

x = y = 1
for i in range(b):
    grid1[x][y] = '#'
    y += 2
    if y != y % 100:
        x += 2
    y = y % 100
    if x >= 50 or y >= 100:break

print(100, 100)
grid = np.concatenate((grid1, grid2), axis=0)
for row in grid:
    print(''.join(row))
import math
n=int(input())
print(math.factorial(n)/(10**9+7))




### FIXED CODE ###

import math
n=int(input())
print(math.factorial(n)%(10**9+7))
def sum_dict(d):
    num = 0
    for k, v in d.items():
        num += k * v
    return num


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    BC = []
    for i in range(Q):
        BC.append(tuple(map(int, input().split())))

    d = {i: 0 for i in range(10**5)}
    for a in A:
        d[a] += 1

    for b, c in BC:
        d[c] += d[b]
        d[b] = 0
        print(sum_dict(d))


### FIXED CODE ###


def sum_dict(d):
    num = 0
    for k, v in d.items():
        num += k * v
    return num


def create_dict(A):
    d = {}
    for a in A:
        if d.get(a) is None:
            d[a] = 1
        else:
            d[a] += 1
    return d


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    BC = []
    for i in range(Q):
        BC.append(tuple(map(int, input().split())))

    d = create_dict(A)

    ans = sum_dict(d)
    for b, c in BC:
        db = d.get(b)
        if db is None:
            db = 0
        if d.get(c) is None:
            d[c] = 0
        d[c] += db
        d[b] = 0

        ans += (c - b) * db
        print(ans)
X, A, B = list(map(int,input().split()))
if A - B <= 0:
  print("delicious")
elif A - B <= X:
  print("safe")
else:
  print("dangerous)
  

### FIXED CODE ###

X, A, B = list(map(int,input().split()))
if B - A <= 0:
  print("delicious")
elif B - A <= X:
  print("safe")
else:
  print("dangerous")
cards = ([False in i in range(13)] for j in range(4))
pattern = ['S','H','C','D']

n = int(input())

for i in range(n):
  x, y = input().split()
  y = int(y)
  cards[pattern.index(x)][y-1] = True
  
for i in range(4):
  for j in range(13):
    if cards[i][j] == False:
      print(pattern[i][j-1])


### FIXED CODE ###

n = int(input())
card =[i+" "+str(j) for i in ["S","H","C","D"] for j in range(1,14)]
for i in range(n):
    card.remove(input())
for i in card:
    print(i)
,y = map(str,input().split())
z = x+y
Z=int(z)
ans = ""
for i in range(100):
  if i**2 = Z:
    ans = "Yes"
    break
  else:
    ans = "No"
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
c=int(str(a)+str(b))
for i in range(int(c**(1/2))+1) :
  if i**2==c :
    print("Yes")
    exit()
print("No")
S = input()
WEEK = {'SUN':7,'MON':6,'TUE':5,'WEN':4,'THU':3,'FRI':2,'SAT':1}
print(WEEK[S])

### FIXED CODE ###

S = input()
WEEK = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
print(WEEK[S])
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return math.gcd(a, b)

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

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)

def calc(n, a, b):
    return int(n/a) + int(n/b) - int(n/lcm(a,b))

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)


### FIXED CODE ###

# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return fractions.gcd(a, b)

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

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    num1 = b - calc(b,c,d)
    num2 = (a-1) - calc(a-1, c,d)
    # ans = calc(b, c, d) - calc(a - 1, c, d)
    # print(b - a + 1 - ans)
    print(num1-num2)
n = int(input())
result = [0]*n**3
for a in range(n):
    for b in range(n):
        for c in range(n):
            if a > b:
                result[n*n*a +n*b + c]= result[n*n*b +n*a + c]
            elif b > c:
                result[n*n*a +n*b + c]= result[n*n*a +n*c + b]
            else:
                result[n*n*a +n*b + c] = gcd(a+1, gcd(b+1,c+1))
print(sum(result))

### FIXED CODE ###

n = int(input())
answer = 0

def gcd(i, j):
    while j:
        i, j = j, i % j
    return i

for a in range(1,n+1):
    for b in range(1,n+1):
        d = gcd(a,b)
        for c in range(1, n+1):
            answer += gcd(c, d)
print(answer)
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = bin(i).rfind("1") - 1
print(round(ans))

### FIXED CODE ###

print(input().count("1"))
import sys
sys.setrecursionlimit(200000)

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

li2 = []
for i in range(1, len(li1)):
    li2.append(li1[i-1] - li1[i])
    
cnt1 = 0
cnt2 = 0
li3 = []

for i in li2:
    cnt2 += 1
    if i < 0:
        li3.append(cnt1)
        cnt1 = 0
    else:
        cnt1 += 1
    if cnt2 == len(li2):
        li3.append(cnt1)

print(max(li3))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

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

li2 = []
for i in range(1, len(li1)):
    li2.append(li1[i-1] - li1[i])
    
cnt1 = 0
cnt2 = 0
li3 = []

for i in li2:
    cnt2 += 1
    if i < 0:
        li3.append(cnt1)
        cnt1 = 0
    else:
        cnt1 += 1

li3.append(cnt1)

print(max(li3))
from collections import deque

n=int(input())
command=[0 for i in range(n)]
k=[0 for i in range(n)]
k_queue= deque([])

for i in range(n):
    s=input()
    if s=="deleteFirst" or s=="deleteLast":
        command[i],k[i]=s,0
    else:
        command[i],k[i]=s.split()
    
    if command[i]=="insert":
        k_queue.appendleft(k[i])
    elif command[i]=="deleteFirst":
        k_queue.popleft()
    elif command[i]=="deleteLast":
        k_queue.pop()
    else:
        k_queue.remove(k[i])

print( " ".join(map(str, k_queue)))


### FIXED CODE ###

from collections import deque
 
n=int(input())
command=[0 for i in range(n)]
k=[0 for i in range(n)]
k_queue= deque([])
 
for i in range(n):
    s=input()
    if s=="deleteFirst" or s=="deleteLast":
        command[i],k[i]=s,0
    else:
        command[i],k[i]=s.split()
     
for i in range(n):
    if command[i]=="insert":
        k_queue.appendleft(k[i])
    elif command[i]=="deleteFirst":
        k_queue.popleft()
    elif command[i]=="deleteLast":
        k_queue.pop()
    else:
        try: k_queue.remove(k[i])
        except ValueError: y=0
print( " ".join(map(str, k_queue)))
import fractions


def prime_number(n):
    # n >= 2
    N = n + 1
    table = [0] * N
    prime_list = []

    for i in range(2, N):
        if table[i] == 0:
            prime_list.append(i)

            for j in range(i + i, N, i):
                table[j] = 1

    return prime_list

def prime_factor(n):
    prime_list = prime_number(n)
    
    ret = 1
    for i in prime_list:
        if n % i == 0:
            ret +=1
            while n % i == 0:
                n = n // i
            
    return ret

A, B = map(int, input().split())
n = fractions.gcd(A, B)
print(prime_factor(n))

### FIXED CODE ###

import math, fractions


def num_prime_factor(n):
    
    ret = 0

    for i in range(1, int(math.sqrt(n)) + 2):

        composite = False

        if n % i == 0:
            ret += 1
            n = n / i

            if i != 1:
                while n % i == 0:
                    n = n / i

            if n == 1:
                break

            for j in range(2, int(math.sqrt(n)) + 2):
                if n % j == 0:
                    composite = True
                    break

            if not composite:
                ret += 1
                break

    return ret

if __name__ == "__main__":
    A, B = map(int, input().split())
    n = fractions.gcd(A, B)
    print(num_prime_factor(n))
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
flag=True
if h==1 and w==1:
  flag=False
for i in range(h):
  if flag==False:
    break
  for j in range(w):
    if s[i][j]=="#":
      if i!=0 and s[i-1][j]!="#":
        flag=False
      elif i!=0 and s[i-1][j]=="#":
        flag=True
        break
      if i!=(h-1) and s[i+1][j]!="#":
        flag=False
      elif i!=(h-1) and s[i+1][j]=="#":
        flag=True
        break
      if j!=0 and s[i][j-1]!="#":
        flag=False
      elif j!=0 and s[i+1][j]=="#":
        flag=True
        break
      if j!=(w-1) and s[i][j+1]!="#":
        flag=False
      elif j!=(w-1) and s[i+1][j]=="#":
        flag=True
        break
if h==1 and w==1:
  flag=False
  
if flag:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
flag=True
count=0
for i in range(h):
  if flag==False:
    break
  for j in range(w):
    if flag==False:
      break
    flag2=False
    if s[i][j]=="#":
      if i>0 and s[i-1][j]!="#":
        flag=False
      elif i>0 and s[i-1][j]=="#":
        flag2=True
        
      if i<(h-1) and s[i+1][j]!="#":
        flag=False
      elif i<(h-1) and s[i+1][j]=="#":
        flag2=True
        
      if j>0 and s[i][j-1]!="#":
        flag=False
      elif j>0 and s[i][j-1]=="#":
        flag2=True
      
      if j<(w-1) and s[i][j+1]!="#":
        flag=False
      elif j<(w-1) and s[i][j+1]=="#":
        flag2=True
      if flag2:
        flag=True
    else:
      count+=1
        
if h==1 and w==1:
  if s[0][0]=="#":
    flag=False
    
if count==(h*w):
  flag=True
  
if flag:
  print("Yes")
else:
  print("No")
import sys
int N = input()
float a
if N === 1:
	a = N/1
elif:
	if N%2 == 0:
    	a = N/2
    elif:
      	a = (N-2)/N
        
print(a)
  		


### FIXED CODE ###

N = int(input())
print(((N + 1)//2)/N)
  		
#int(input()) で入力された数値をint型で受け取る
#(N+1)//:N+1を2で割ったものが
#切り捨て除算
#(8+1)//2=4,(9+1)//2=5:これが正整数Nに含まれる奇数の数になる
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i ==0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def make_factorial(n):
    if n <= 1:
        return 1
    else:
        return n*make_factorial(n-1)
num = int(input())
print(len(make_divisors(make_factorial(num))))

### FIXED CODE ###

def make_prime(n):
    prime = []
    temp = n
    for i in range(2, n):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime


from collections import defaultdict
d=defaultdict(lambda :1)
num = int(input())
w=10**9+7
for i in range(2,num+1):
    prime_num_list = make_prime(i)
    for j in range(len(prime_num_list)):
        key = prime_num_list[j][0]
        d[key] += prime_num_list[j][1]
cnt=1
for val in d.values():
    cnt*=val%w
print(cnt%w)
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
	
def main():
	N, Q = map(int, input().split())
	S = input()
	
	TD = []
	for _ in range(Q):
		tmp = input().split(" ")
		t = tmp[0]
		d = tmp[1]
		TD.append((t, d))
		
	TD.reverse()
	gake_L = 0
	gake_R = N - 1
	
	for i, val in enumerate(TD):
		t, d = val
		
		if d == "R":
			if t == S[gake_R]:
				gake_R -= 1
		
		if d == "L":
			if t == S[gake_L]:
				gake_L += 1
	
	print(max(0, gake_R - gake_L+1))
	
	
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
	
def main():
	N, Q = map(int, input().split())
	S = "_" + input() + "_"
	
	TD = []
	for _ in range(Q):
		tmp = input().split(" ")
		t = tmp[0]
		d = tmp[1]
		TD.append((t, d))
		
	TD.reverse()
	gake_L = 0
	gake_R = N - 1 + 2
	
	for i, val in enumerate(TD):
		t, d = val
		
		if d == "R":
			if t == S[gake_R-1]:
				gake_R -= 1
			if t == S[gake_L]:
				gake_L -= 1
		
		if d == "L":
			if t == S[gake_R]:
				gake_R += 1
			if t == S[gake_L+1]:
				gake_L += 1
	
	print(max(0, gake_R-gake_L-1))
	
	
if __name__ == "__main__":
	main()
a = int(input())
total = a + a**2 + a**3
ptint(total)

### FIXED CODE ###

a = int(input())
total = a + a**2 + a**3
print(total)
a,b=map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A, B = map(int , input().split())
print(lcm(A, B))
import math
n, m = [int(i) for i in input().split()]
p = [int(input()) for i in range(m)]

a = []
a.append(1)
if 1 in p:
    a.append(0)
else:
    a.append(1)
for i in range(2, n + 1):
    if i in p:
        a.append(0)
    else:
        a.append((a[i - 2] + a[i - 1]) % 1000000007)
    
print(a[n])

### FIXED CODE ###

p = (int(i) for i in input().split())
p = sorted(p)
print(p[0] + p[1])
S = input()
k = int.input()
if S.len()<=k:
  print(S)
else:
  print(S[:k]+"...")
 


### FIXED CODE ###

k = int(input())
S = input()

if len(S)<=k:
  print(S)
else:
  print(S[:k]+"...")
k=int(input())
m=k//2
if (k%2==0):
    print(2)
    print"{} {}".format(m,m+1)
else:
    print(2)
    print"{} {}".format(m,m+2)


### FIXED CODE ###

import math

def f(l):
    mx=max(l)
    flg=True
    for i in range(len(l)):
        if (mx==l[i] and flg==True):
            flg=False
            l[i]-=50
            l[i]=max(0,l[i])
        else:
            l[i]+=1
    return l


def solve(k):
    #k=int(input())
    N=50
    a=k//N+1
    if (k%N==0) :
        a-=1
    l=[a+i for i in range(50)]
    mod=(N-(k%N))%N
    for i in range(mod):
        l=f(l)
    l=sorted(l,reverse=True)
    print(50)
    for i in range(50):
        print(str(l[i])+" ",end="")
    print("")
    ret=0
solve(int(input()))
N = int(input())
a = ceil(N/2)/N
print(a)

### FIXED CODE ###

import math
N = int(input())
a = math.ceil(N/2)/N
print(a)
a=input()
b=input()
c=input()
print(“a[:1]b[1:2]c[2:3]”)

### FIXED CODE ###

a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))
import sys
 
n = 0

S = input()

for i in range(1,5):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)

### FIXED CODE ###

import sys
 
n = 0
 
S = input()

for i in range(0,4):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)
def make_divisors(n):
  kuku = False
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      x = i
      if i != n // i:
        y = n//i
    if x<=9 and y<=9:
      kuku = True
      break
  return kuku
  
n = int(input())
kuku = make_divisors(n)
print(kuku)

### FIXED CODE ###

def make_divisors(n):
  kuku = 'No'
  for i in range(1, int(n**0.5)+1):
    x = 100
    y = 100
    if n % i == 0:
      x = i
      y = n//i
    if x<=9 and y<=9:
      kuku = 'Yes'
      break
  return kuku
  
n = int(input())
kuku = make_divisors(n)
print(kuku)
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int (input())
 
print(l[k+1])

### FIXED CODE ###

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int (input())
 
print(l[k-1])
X, Y = map(int, input().split)
for a in range(1, X+1):
  if 2*a + 4*(x-a) == Y:
    print("Yes")
    exit()
print("No")

### FIXED CODE ###

X, Y = map(int, input().split())
for a in range(X+1):
  if 2*a + 4*(X-a) == Y:
    print("Yes")
    exit()
print("No")
n,k,q = map(int,input().split())
a = [0 for i in range(n)]
for i in range(q):
    aa = int(input())
    a[aa] = a[aa] + 1
for i in a:
    if k - q + i > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n,k,q = map(int,input().split())
a = [0 for i in range(n)]
for i in range(q):
    aa = int(input()) - 1
    a[aa] = a[aa] + 1
for i in a:
    if k - q + i > 0:
        print("Yes")
    else:
        print("No")
import math
N,K = map(int, input().split())
if K > math.factorial(N-1) // (math.factorial(N - 1 - 2) * math.factorial(2)):
    print(-1)
    exit()

for i in range(2,N+1):
    print(1,i)

for i in range(3,K+3):
    print(2,i)

### FIXED CODE ###

import math
N,K = map(int, input().split())
M = (N-1)*(N-2)//2
if K > M:
    print(-1)
    exit()

print(N-1+M-K)
for i in range(2,N+1):
    print(1,i)
s = 2
d = 3
for i in range(M-K):
    print(s,d)
    d+=1
    if d > N:
        s+=1
        d = s+1
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])<=0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

    

### FIXED CODE ###

n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh.sort(key=lambda x:x[2], reverse=True)

ansh=-1
ans=[[]]
flag=True
for cx in range(0,101):
  if flag==False:
    break
    
  for cy in range(0,101):
    ansh = 0
    for pira in xyh:
      if ansh==0:
        ansh=pira[2]+(abs(cx-pira[0])+abs(cy-pira[1]))
        ans[0]=[cx,cy,ansh]
        
      elif len(ans[0])>0 and max(ansh -(abs(cx-pira[0])+abs(cy-pira[1])), 0) != pira[2]:
        ans[0]=[]
    if len(ans[0])>0:
      flag=False
      break
print(*ans[0])
class UnionFind:
    MAX_N = 0
    PAR  = [] 
    RANK = []

    def __init__(self,n):
        self.MAX_N = n
        self.PAR = [ i for i in range(n)]
        self.RANK= [ 0 ] * n

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

    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.RANK[x] < self.RANK[y]:
            self.PAR[x] = y
        else:
            self.PAR[y] = x
            if self.RANK[x] == self.RANK[y]:
                self.RANK[x] += 1

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

N,K,L = map(int,input().split())
path = UnionFind(N+1)
for _ in range(K):
    p,q = map(int,input().split())
    path.union(p,q)
rail = UnionFind(N+1)
for _ in range(L):
    p,q = map(int,input().split())
    rail.union(p,q)

Data = {}
for i in range(1,N+1):
    p = path.find(i)
    r = rail.find(i)
    k = str(p)+"-"+str(r)
    if k in Data.keys():
        Data[k] += 1
    else:
        Data[k] = 1

for i in range(1,N+1):
    p = path.find(i)
    r = rail.find(i)
    k = str(p)+"-"+str(r)
    print( Data[k], end= ' ')



### FIXED CODE ###

c = input()
boin = 'aeiou'
if c in boin:
    print('vowel')
else:
    print('consonant')
n, k = input().split()
print(sum(sorted([int(i) for i in input().split()])[:k]))

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
print(sum(sorted([int(i) for i in input().split()])[:k]))
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())

a=list(map(int,input().split()))

ruisekia=[]
keta=[0]*30
for i in range(N):
  temp=0
  for j in range(i,N):
    temp+=a[j]
    ruisekia.append(temp)
ruisekia.sort(reverse=True)

print(ruisekia)
for i in range(combinations_count(N,K)):
  for j in range(K):
    if ruisekia[i]==1:
      x=5

'''
for i in range(len(ruisekia)):
  tempo=ruisekia[i]
  while(tempo!=0):
    x=1
    count=0
    while(tempo>=x*2):
      x*=2
      count+=1
    keta[count]+=1
    tempo-=x
print(keta)
'''

### FIXED CODE ###

N,K=map(int,input().split())
 
a=list(map(int,input().split()))
 
ruisekia=[]
keta=[0]*30
for i in range(N):
  temp=0
  for j in range(i,N):
    temp+=a[j]
    ruisekia.append(temp)
ruisekia.sort(reverse=True)
 
#print(ruisekia)
answer=0
for i in range(40,-1,-1):
  count=0
  ruiseki=[]
  for j in ruisekia:
    if j&(1<<i)==1<<i:
      count+=1
      ruiseki.append(j)
  if count>=K:
    answer+=2**i
    ruisekia=ruiseki

print(answer)
'''
for i in range(len(ruisekia)):
  tempo=ruisekia[i]
  while(tempo!=0):
    x=1
    count=0
    while(tempo>=x*2):
      x*=2
      count+=1
    keta[count]+=1
    tempo-=x
print(keta)
'''