Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import numpy as np

N = int(input())
Nloop = N + 1
A = np.zeros((Nloop, Nloop), dtype="int")
Acount = np.zeros(Nloop, dtype="int")

for i in range(1, Nloop):
    Acount[i] = int(input())
    for _ in range(Acount[i]):
        x, y = map(int, input().split())
        A[i, x] = 1 if y == 1 else -1

honest_loop = 2 ** N
honest_num = np.zeros(Nloop, dtype="int")

ans = 0

for i in range(1, honest_loop):
    for l in range(1, Nloop):
        honest_num[l] = 1 if i >> (l - 1) & 1 == 1 else -1

    check = np.dot(A, honest_num)

    honest_check = True
    for l in range(1, Nloop):
        # lの人が正直者のとき
        if honest_num[l] == 1 and Acount[l] != check[l]:
            honest_check = False

    if honest_check:
        ans = max(sum(honest_num == 1), ans)

print(ans)

### FIXED CODE ###

N = int(input())
Nloop = N + 1
A = [[0] * Nloop for _ in range(Nloop)]

for i in range(1, Nloop):
    Acount = int(input())
    for _ in range(Acount):
        x, y = map(int, input().split())
        if y == 1:
            A[i][x] = 1
        else:
            A[i][x] = -1

honest_loop = 2 ** N
is_honest = [False] * Nloop

ans = 0

for i in range(1, honest_loop):
    for l in range(1, Nloop):
        is_honest[l] = (i >> (l - 1) & 1 == 1)

    honest_check = True
    for l in range(1, Nloop):
        # lの人が正直者のとき
        if is_honest[l]:
            # lの人から見てjの人は正直者か？
            for j in range(1, Nloop):
                if A[l][j] == 1:
                    if not is_honest[j]:
                        honest_check = False
                elif A[l][j] == -1:
                    if is_honest[j]:
                        honest_check = False
                if not honest_check:
                    break
        if not honest_check:
            break

    if honest_check:
        ans = max(sum(is_honest), ans)

print(ans)
### BUGGY CODE ###

K,S = map(int,input().split())
ans = 0
for i in range(K+1):
    if i > S:
        break
    for j in range(K+1):
        if i + j > S:
            break
        for k in range(K+1):
            s = i + j + k
            if s == S:
                ans += 1
                break
print(ans)

### FIXED CODE ###

K,S = map(int,input().split())
ans = 0
for i in range(K+1):
    if i > S:
        break
    for j in range(K+1):
        if i + j > S:
            break
        elif 0 <= S - (i + j) <= K:
            ans += 1
print(ans)
### BUGGY CODE ###

from sys import stdin
import sys
import copy
sys.setrecursionlimit(200000)
N,M,K=list(map(int,input().split()))
counter=[None]*(N+1)
friend_list=[set() for _ in range(N+1)]
block_list=[set() for _ in range(N+1)]
def friend_tansaku(i,j):
    color.add(j)
    for friend in friend_list[j]:
        if friend not in color :
            friend_tansaku(i,friend)





for _ in range(M):
   a,b= list(map(int, input().split()))
   friend_list[a].add(b)
   friend_list[b].add(a)
for _ in range(K):
    a, b = list(map(int, input().split()))
    block_list[a].add(b)
    block_list[b].add(a)
for i in range(1,N+1):

    color =set()
    if counter[i] is None:
        friend_tansaku(i,i)
        for aa in color:
            counter[i]=tuple(color)
    color =set(counter[i])
    for k in block_list[i]:
        color.add(k)
    count=len(color)-(len(friend_list[i])+len(block_list[i]))-1
    if i==N:print(count)
    else:print(count,end=" ")

### FIXED CODE ###

from sys import stdin
import sys
import copy
sys.setrecursionlimit(200000)
N,M,K=list(map(int,input().split()))
counter=[[None,None] for i in range(N+1)]
friend_list=[set() for _ in range(N+1)]
block_list=[set() for _ in range(N+1)]
def friend_tansaku(i,j):
    color.add(j)
    cnt[0]+=1
    for friend in friend_list[j]:
        if friend not in color :
            friend_tansaku(i,friend)





for _ in range(M):
   a,b= list(map(int, input().split()))
   friend_list[a].add(b)
   friend_list[b].add(a)
for _ in range(K):
    a, b = list(map(int, input().split()))
    block_list[a].add(b)
    block_list[b].add(a)
for i in range(1,N+1):
    cnt=[0]
    color =set()
    if counter[i][0] is None:
        friend_tansaku(i,i)
        cnt=cnt[0]
        for aa in color:
            counter[aa]=[color,cnt]
    color,cnt =counter[i][0],counter[i][1]
    for k in block_list[i]:
        if k not in color:
            cnt+=1

    count=cnt-(len(friend_list[i])+len(block_list[i]))-1
    if i==N:print(count)
    else:print(count,end=" ")
### BUGGY CODE ###

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

for i in range(M):
    maxindex = A.index(max(A))
    A[maxindex] = A[maxindex]//2
print(sum(A))

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
A = list(map(lambda x: x*(-1),A))
import heapq
heapq.heapify(A)

for i in range(M):
    maxA = (((heapq.heappop(A))*(-1))//2)*(-1)
    heapq.heappush(A,maxA)
   
    
print(sum(A)*-1)
### BUGGY CODE ###

x, y, z, k = map(int, input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

ab=[]
if(k>len(a)):
    indA=len(a)
else:
    indA=k
if(k>len(b)):
    indB=len(b)
else:
    indB=k
if(k>len(c)):
    indC=len(c)
else:
    indC=k

for i in a[:indA]:
    for j in b[:indB]:
        ab.append(i+j)
ab.sort(reverse=True)

abc=[]
for i in ab[:k]:
    for j in c[:indC]:
        abc.append(i+j)
abc.sort(reverse=True)

for i in abc[:k]:
    print(i)

### FIXED CODE ###

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab = sorted(x+y for x in a for y in b)[:-k-1:-1]
abc = sorted(x+y for x in ab[:k] for y in c)[:-k-1:-1]
print(*abc, sep='\n')
### BUGGY CODE ###

import math

def eratosthenes(limit):
    A = [i for i in range(2, limit + 1)]
    B = []
    while True:
        a = min(A)
        if a > math.sqrt(limit):
            break
        B.append(a)
        i = 0
        while len(A) > i:
            if A[i] % a == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        B.append(a)
    return B

def main():
    Q = int(input())
    ans = []
    for _ in range(Q):
        l, r = map(int, input().split())
        A = eratosthenes(r + 1)
        c = 0
        for i in range(l, r + 1):
            if i in A and (i + 1) // 2 in A:
                c += 1
        ans.append(c)
    for c in ans:
        print(c)


main()


### FIXED CODE ###

import math

def eratosthenes():
    limit = 100001
    A = [i for i in range(2, limit)]
    B = [False for _ in range(limit + 1)]
    C = [0 for i in range(limit + 1)]
    while True:
        a = min(A)
        if a > math.sqrt(limit):
            break
        B[a] = True
        i = 0
        while len(A) > i:
            if A[i] % a == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        B[a] = True
    for i in range(3, limit + 1, 2):
        if B[i] and B[(i + 1) // 2]:
            C[i] += 1
    for i in range(3, limit + 1):
        C[i] += C[i - 1]
    return C


def main():
    Q = int(input())
    C = eratosthenes()
    ans = []
    for _ in range(Q):
        l, r = map(int, input().split())
        ans.append(C[r] - C[l - 1])
    for c in ans:
        print(c)


main()
### BUGGY CODE ###

import sys
from heapq import heappop, heappush

n, m, ss, *uvabcd = map(int, sys.stdin.buffer.read().split())
uuu = uvabcd[0:4 * m:4]
vvv = uvabcd[1:4 * m:4]
aaa = uvabcd[2:4 * m:4]
bbb = uvabcd[3:4 * m:4]
ccc = uvabcd[4 * m + 0::2]
ddd = uvabcd[4 * m + 1::2]
links = [set() for _ in range(n)]

for u, v, a, b in zip(uuu, vvv, aaa, bbb):
    u -= 1
    v -= 1
    links[u].add((v, a, b))
    links[v].add((u, a, b))

req = sum(sorted(aaa, reverse=True)[:n])
INF = 10 ** 18
ans = [INF] * n

q = [(0, ss, 0, 0)]  # (time, silver, city, type)
visited = set()
fixed = 0
while q:
    t, s, v, z = heappop(q)
    if (s, v) in visited:
        continue
    visited.add((s, v))
    if ans[v] == INF:
        ans[v] = t
        fixed += 1
        if fixed == n:
            break

    for u, a, b in links[v]:
        if s < a:
            continue
        ns = s - a
        if (ns, u) in visited:
            continue
        heappush(q, (t + b, ns, u, 0))

    if z == 1:
        continue

    ts = s
    tt = t
    c = ccc[v]
    d = ddd[v]
    while ts <= req:
        ts += c
        tt += d
        if (ts, v) in visited:
            break
        heappush(q, (tt, ts, v, 1))

print('\n'.join(map(str, ans[1:])))


### FIXED CODE ###

import sys
from heapq import heappop, heappush

n, m, ss = map(int, input().split())
lines = sys.stdin.readlines()
links = [set() for _ in range(n)]
aaa = []
for line in lines[:m]:
    u, v, a, b = map(int, line.split())
    u -= 1
    v -= 1
    links[u].add((v, a, b))
    links[v].add((u, a, b))
    aaa.append(a)

exchanges = []
for line in lines[m:]:
    c, d = map(int, line.split())
    exchanges.append((c, d))

req = sum(sorted(aaa, reverse=True)[:n - 1])
INF = 10 ** 18
ans = [INF] * n
ans_silver = [-1] * n

q = [(0, ss, 0)]  # (time, silver, city)
visited = set()
fixed = 0
while q:
    t, s, v = heappop(q)
    if (s, v) in visited or ans_silver[v] >= s:
        continue
    visited.add((s, v))
    if ans[v] == INF:
        ans[v] = t
        ans_silver[v] = s
        fixed += 1
        if fixed == n:
            break

    for u, a, b in links[v]:
        if s < a:
            continue
        ns = s - a
        nt = t + b
        if (ns, u) in visited or ans_silver[u] >= ns:
            continue
        heappush(q, (nt, ns, u))

    c, d = exchanges[v]
    ns = s + c
    if ns <= req and (ns, v) not in visited:
        heappush(q, (t + d, ns, v))

print('\n'.join(map(str, ans[1:])))
### BUGGY CODE ###

N, M = map(int,input().split())
all_city = [list(map(int,input().split())) for i in range(M)]

city = {}
for i in all_city:
    if i[0] in city:
        city[i[0]].append(i[1])
    else:
        city[i[0]] = [i[1]]


for i,k in city.items():
    city[i] = sorted(k)

def change_Prefecture_code(prefecture):
    return str(prefecture).zfill(6)

def change_birth_code(birth_num):
    return str(birth_num).zfill(6)

for i in all_city:
    print(change_Prefecture_code(i[0]) + change_birth_code(city[i[0]].index(i[1]) + 1))

### FIXED CODE ###

N, M = map(int,input().split())
all_city = [list(map(int,input().split())) for i in range(M)]
 
city = {}
for i in all_city:
    if i[0] in city:
        city[i[0]].append(i[1])
    else:
        city[i[0]] = [i[1]]
 
under6 = {}
for i,k in city.items():
    city[i] = sorted(k)
    for j in range(len(city[i])):
        under6[city[i][j]] = j + 1

def change_Prefecture_code(prefecture):
    return str(prefecture).zfill(6)
 
def change_birth_code(birth_num):
    return str(birth_num).zfill(6)
 
for i in all_city:
    print(change_Prefecture_code(i[0]) + change_birth_code(under6[i[1]]))
### BUGGY CODE ###

n=int(input())
prize_list=[]
for i in range(n):
    x = input()
    if x not in prize_list:
        prize_list.append(x)

print(len(prize_list))

### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]
print(len(set(s)))
### BUGGY CODE ###

#coding: utf-8

n, q = map(int, raw_input().split())
s = raw_input()
def f(a, b):
    return s[a-1:b].count("AC")
for i in range(q):
    a, b = map(int, raw_input().split())
    print(f(a, b))


### FIXED CODE ###

#coding: utf-8
import bisect

n, q = map(int, raw_input().split())
s = raw_input()
i_list = []
i = -1
while True:
    i = s.find("AC", i+1)
    if(i == -1): break
    i_list.append(i)
for i in range(q):
    a, b = map(int, raw_input().split())
    a = bisect.bisect_left(i_list, a-1)
    b = bisect.bisect_left(i_list, b-1)
    print(b-a)
### BUGGY CODE ###

N = int(input())
A = 0
B = 0
num = 0
ans = 10**10

for i in range(1, N+1):
  if N%i == 0:
    A = len(str(i))
    B = len(str(N//i))
    num = max(A, B)
    ans = min(ans, num)
print(ans)

### FIXED CODE ###

N = int(input())
A = 0
B = 0
num = 0
ans = 10**10

for i in range(1, int((N)**(1/2)+1)):
  if N%i == 0:
    A = len(str(i))
    B = len(str(N//i))
    num = max(A, B)
    ans = min(ans, num)
print(ans)
### BUGGY CODE ###

A = input()
B = input()
C = input()

def match(v,w):
    if(v != '?' and w != '?' and v != w):
        return 0
    else:
        return 1


def milen(a,b,c):
    aa = len(a)
    bb = len(b)
    cc = len(c)

    minlen = aa + bb + cc
    s = '?'*(bb+cc) + a + '?'*(bb+cc)
    for i in range(-bb,aa+1):
        start = min(0,i)
        end = max(aa,i+bb)
        t = '?'*(bb+cc+i) + b + '?'*(aa+cc-i)
        for j in range(start-cc,end+1):
            sta = min(start,j)
            en = max(end,j+cc)
            u = '?'*(bb+cc+j) + c + '?'*(aa+bb-j)
            flag = 1
            for k in range(sta+bb+cc,en+bb+cc):
                if(match(s[k],u[k]) == 0):
                    flag = 0
                    break
                if(match(t[k],u[k]) == 0):
                    flag = 0
                    break
                if(match(s[k],t[k]) == 0):
                    flag = 0
                    break
            if(flag == 1):
                minlen = min(minlen,en-sta)
    return minlen

print(min(milen(A,B,C),milen(A,C,B)))

### FIXED CODE ###

a = input()
b = input()
c = input()

aa = len(a)
bb = len(b)
cc = len(c)

lensum = aa + bb + cc # 文字列の長さの最大値
ab = [0]*(lensum+cc+1) # 相対的位置に対して合わさるかどうかを記録
ac = [0]*(lensum+bb+1)
bc = [0]*(lensum+aa+1)

def match(v,w): # 2つの文字を合わせられるかどうかを調べる
    if(v != '?' and w != '?' and v != w):
        return 0
    else:
        return 1

def match2(A,B,k): # 2つの文字列とその相対的位置に対して合わさるかチェック
    AA = len(A)
    BB = len(B)
    if(k>=AA):
        return 1
    elif(k<-BB):
        return 1
    else:
        flg = 1
        st = max(0,k)
        la = min(AA,BB+k)
        for i in range(st,la):
            if(match(A[i],B[i-k])==0):
                flg = 0
                break
        return flg

#ab,ac,bcに対して計算する
for i in range(lensum+cc+1):
    ab[i] = match2(a,b,i-bb-cc)
for i in range(lensum+bb+1):
    ac[i] = match2(a,c,i-bb-cc)
for i in range(lensum+aa+1):
    bc[i] = match2(b,c,i-aa-cc)

def milen(a,b,c):
    minlen = lensum # 文字列の長さの最大値
    for i in range(-bb-cc,aa+cc+1): # iが文字列Bの開始位置
        for j in range(-bb-cc,aa+bb+1): # jが文字列Cの開始位置
            if(ab[i+bb+cc] == 0): 
                continue
            elif(ac[j+bb+cc] == 0):
                continue
            elif(j-i+aa+cc < 0 or j-i+aa+cc >= lensum+aa+1): #BとCが離れすぎている場合を除く
                continue  
            elif(bc[j-i+aa+cc] == 0):
                continue   
            else:
                sta = min(0,i,j) #文字列の中で一番左にある開始位置
                en = max(aa,i+bb,j+cc) #文字列の中で一番右にある終了位置
                minlen = min(minlen,en-sta) #更新
    return minlen

print(milen(a,b,c))
### BUGGY CODE ###

N = int(input())
S = []
n = 0
eq = True

for i in range(N):
    s = input()
    n += 1
    for i in range(len(S)):
        if s == S[i]:
            eq = False
    if not eq:
        n -= 1
    S.append(s)
print(n)

### FIXED CODE ###

N = int(input())

S = [input() for i in range(N)]
print(len(list(set(S))))
### BUGGY CODE ###

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

half=sum(a)//2

ans=""
for i in range(n):
    tmp=half
    for j in range(i+1, n, 2):
        tmp-=a[j]
    if i%2==0:
        for j in range(0, i, 2):
            tmp-=a[j]
    else:
        for j in range(1, i, 2):
            tmp-=a[j]
    ans+=str(tmp*2)
    if i!= n-1:
        ans+=" "
print(ans)

### FIXED CODE ###

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

half=sum(a)//2

ans=""
# for i in range(n):
#     tmp=half
#     for j in range(i+1, n, 2):
#         tmp-=a[j]
#     if i%2==0:
#         for j in range(0, i, 2):
#             tmp-=a[j]
#     else:
#         for j in range(1, i, 2):
#             tmp-=a[j]
#     ans+=str(tmp*2)
#     if i!= n-1:
#         ans+=" "
gu=[]
syaku=0
for i in range(1,n,2):
    syaku+=a[i]
for i in range(0,n,2):
    gu.append((half-syaku)*2)
    syaku+=a[i]
    if i+1==n:
        syaku-=a[0]
    else:
        syaku-=a[i+1]
# print(gu)
ki=[]
syaku=0
for i in range(2,n,2):
    syaku+=a[i]
for i in range(1,n,2):
    ki.append((half-syaku)*2)
    syaku+=a[i]
    if i+1==n:
        syaku-=a[0]
    else:
        syaku-=a[i+1]
# print(ki)
ans=[]
for i in range(n//2):
    ans.append(gu[i])
    ans.append(ki[i])
ans.append(gu[n//2])

print(" ".join(map(str, ans)))
### BUGGY CODE ###

import sys,math,collections,itertools,bisect
input = sys.stdin.readline

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

B = []
for i,a in enumerate(A):
    if a <= N-1:
        B.append([a,i])
if len(B)==0:
    print(0)
    exit()
B.sort()
cnt = 0
for i in range(len(B)):
    for j in range(i+1,len(B)):
        if B[i][0]+B[j][0]==abs(B[i][1]-B[j][1]):
            cnt +=1
        if B[i][0]+B[j][0]>=N:
            break
print(cnt)



### FIXED CODE ###

import sys,collections
input = sys.stdin.readline
N=int(input())
A=list(map(int,input().split()))
B = []
C = []
for i,a in enumerate(A):
    B.append(i+a)
    C.append(i-a)
cnt = 0
Bc = collections.Counter(B)
Cc = collections.Counter(C)

for key,val in Bc.items():
    cnt += val*Cc[key]
print(cnt)
### BUGGY CODE ###

from collections import defaultdict
from collections import deque

n, x, y = map(int, input().split())

edges = [[] for _ in range(n)]
for i in range(n-1):
    edges[i].append(i+1)

for i in range(1, n):
    edges[i].append(i-1)

edges[x-1].append(y-1)
edges[y-1].append(x-1)

count = defaultdict(int)


def bfs(start):
    dist = [10**4] * n
    dist[start] = 0
    todo = deque([])
    for to in edges[start]:
        todo.append([1, to])

    while todo:
        d, node = todo.popleft()
        if d >= dist[node]:
            continue

        dist[node] = d
        for to in edges[node]:
            todo.append([d+1, to])
    return dist


for start in range(n):
    dist = bfs(start)
    for d in dist:
        count[d] += 1

for k in range(1, n):
    res = count[k] // 2
    print(res)


### FIXED CODE ###

from collections import defaultdict
from collections import deque

n, x, y = map(int, input().split())

edges = [[] for _ in range(n)]
for i in range(n-1):
    edges[i].append(i+1)

for i in range(1, n):
    edges[i].append(i-1)

edges[x-1].append(y-1)
edges[y-1].append(x-1)

count = defaultdict(int)


def bfs(start):
    dist = [10**4] * n
    dist[start] = 0
    todo = deque([])
    for to in edges[start]:
        todo.append([1, to])

    while todo:
        d, node = todo.popleft()
        if d >= dist[node]:
            continue

        dist[node] = d
        for to in edges[node]:
            todo.append([d+1, to])
    return dist


for start in range(n):
    dist = bfs(start)
    for d in dist:
        count[d] += 1

for k in range(1, n):
    res = count[k] // 2
    print(res)
### BUGGY CODE ###

S = str(input())
li = []
dic = {}
ans = 0

for i in range(len(S)):
  s = int(S[i:]) % 2019
  if s == 0:
    ans += 1
  elif s not in li:
    li.append(s)
  elif s not in dic:
    dic[s] = 2
  else:
    dic[s] += 1
  
li = list(dic.values())
for l in li:
  ans += l * (l-1) // 2

print(ans)

### FIXED CODE ###

S = str(input())
li = [0] * 2019
ans = 0
li[0] = 1

d = 1
s = 0
for i in S[::-1]:
  s += int(i) * d
  s = s % 2019
  li[s] += 1
  d *= 10
  d = d % 2019
  
for l in li:
  ans += l * (l-1) // 2

print(ans)
### BUGGY CODE ###

import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output


def chkprint(*args):
    names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))

# Binary converter


def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]

# --------------------------------------------


dp = None


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


def main():
    N = int(input())
    A = li_input()

    A.sort(reverse=True)
    ans_c = -1

    for i in range(10):
        n = A[i]

        if n == min(A):
            break

        half = n / 2
        diff = 10 ** 100

        A_ = A[:]
        A_.remove(n)

        for a in A_:
            if abs(a - half) < diff:
                r = a
                diff = abs(a - half)

        tmp_c = combinations_count(n, r)
        if tmp_c > ans_c:
            ans_c = tmp_c
            ans_n = n
            ans_r = r

    print(ans_n, ans_r)


main()


### FIXED CODE ###

import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output


def chkprint(*args):
    names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))

# Binary converter


def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]

# --------------------------------------------


dp = None


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


def main():
    N = int(input())
    A = li_input()

    A.sort(reverse=True)
    ans_c = -1

    n = A[0]

    half = n / 2
    diff = 10 ** 100

    A.remove(n)

    for a in A:
        if abs(a - half) < diff:
            r = a
            diff = abs(a - half)

    print(n, r)


main()