Harryxun/stf_run huggingface dataset:
n=int(input())
a=[0]*10000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            if(i*i+j*j+k*k+i*j+i*k+j*k==n):
                  a[n-1]+=1
            else:
                continue
for i in range(1,n+1):
    print(a[i])
    

### FIXED CODE ###

N = int(input())

ans = [0]*N

for i in range(1,101,1):
  for j in range(1,101,1):
    for k in range(1,101,1):
      n = i**2+j**2+k**2+i*j+j*k+k*i
      if n > N:
        continue
      else:
        ans[n-1]+=1
      
for i in range(N):
  print(ans[i])
n,m=map(int,input().split())
X=sorted(list(map(int,input().split())))
init=[]
mario=n
tmp=0
i=1

if m<n:
  n=m

while i<len(X):
  init.append([X[i]-X[i-1],i])
  i+=1
init.sort(reverse=True,key=lambda x:x[0])
ans=0

for i in range(n-1):
  X.insert(init[i][1]+i,"あ")
i=0
start=0
while i<len(X):
  if i+1<len(X):
    if X[i+1]=="あ":
      ans+=X[i]-X[start]
      start=i+2
      i+=1
  else:
    ans+=X[i]-X[start]
  i+=1
print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
X=sorted(list(map(int,input().split())))
init=[]
tmp=0
i=1

if m<n:
  n=m

while i<len(X):
  init.append([X[i]-X[i-1],i])
  i+=1
init.sort(reverse=True,key=lambda x:x[0])
init=list(map(lambda x:x[1],init))
ans=0
init=sorted(init[:n-1])
if len(init)==0:
  print(X[-1]-X[0])
  exit()
tmp=0
for i in init:
  ans+=(X[i-1]-X[tmp])
  tmp=i
try:
  if i!=len(X)-1:
    ans+=X[-1]-X[i]
except IndexError:
  print(0)
  exit()
print(ans)
n,d = (int(x) for x in input().split())
print(n/2d)

### FIXED CODE ###

n,d = (int(x) for x in input().split())
if n % (2*d + 1) == 0:
  print(n//(2*d + 1))
else:
  print(n//(2*d + 1) + 1)
n, q = map(int, input().split())

stack = [[] for _ in range(n+1)]
stack[0].append(1)
for i in range(n-1):
  a,b = map(int, input().split())
  stack[a].append(b)

ans = [0] * n
pool = {}
def dfs(cur, num):
	ans[cur-1] += num
	if len(stack[cur]) <= 0:
		return
	for c in stack[cur]:
		dfs(c, num)

for i in range(q):
  p, x = map(int, input().split())
  pool[p] = pool.get(p, 0) + x
for k, v in pool.items():
  dfs(k, v)
print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n, q = map(int, input().split())
 
stack = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  stack[a].append(b)
  stack[b].append(a)
ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x
def dfs(cur, par):
    for c in stack[cur]:
      if c == par:
        continue
      ans[c] += ans[cur] 
      dfs(c, cur)
dfs(0, -1)
print(*ans)
s=input()
x,y=map(int,input().split())
t=s.split("T")
x-=len(t[0])
dx,dy=[],[]

for i,tt in enumerate(t[1:]):
  if i%2==1:
    dx.append(len(tt))
  else:
    dy.append(len(tt))

def is_ok(n,l):
  dp=[[0]*18001 for _ in range(len(l)+1)]
  n+=9000
  dp[0][9000]=1
  for i in range(1,len(l)+1):
    for j in range(18001):
      if j+l[i-1]<=18000:
        dp[i][j+l[i-1]]|=dp[i-1][j]
      if j-l[i-1]>=0:
        dp[i][j-l[i-1]]|=dp[i-1][j]
  if dp[len(l)][n]==1:
    return True
  else:
    return False

if is_ok(abs(x),dx) and is_ok(abs(y),dy):
  print("Yes")
else:
  print("No")



### FIXED CODE ###

s=input()
x,y=map(int,input().split())
t=s.split("T")
x-=len(t[0])
dx,dy=[],[]

for i,tt in enumerate(t[1:]):
  if i%2==1:
    dx.append(len(tt))
  else:
    dy.append(len(tt))

def is_ok(n,l):
  dp=set([0])
  for d in l:
    t=[]
    for v in dp:
      t.append(v+d)
      t.append(v-d)
    dp=set(t)
  return True if n in dp else False

if is_ok(x,dx) and is_ok(y,dy):
  print("Yes")
else:
  print("No")
List= sorted(int,input().split())
if len(List)==2:
    print('Yes')
else:
    print('No') 

### FIXED CODE ###

List= list(map(int,input().split()))
List=set(List)
if len(List)==2:
    print('Yes')
else:
    print('No')
import sys

def convert(num):
  out = ""
  if num == 0:
    out = "a"
  elif num == 1:
    out = "b"
  elif num == 2:
    out = "c"
  elif num == 3:
    out = "d"    
  elif num == 4:
    out = "e"    
  elif num == 5:
    out = "f"    
  elif num == 6:
    out = "g"
  elif num == 7:
    out = "h"
  elif num == 8:
    out = "i"    
  elif num == 9:
    out = "j"    
  elif num == 10:
    out = "k"    
  elif num == 11:
    out = "l"
  elif num == 12:
    out = "m"
  elif num == 13:
    out = "n"    
  elif num == 14:
    out = "o"    
  elif num == 15:
    out = "p"    
  elif num == 16:
    out = "q"
  elif num == 17:
    out = "r"
  elif num == 18:
    out = "s"    
  elif num == 19:
    out = "t"    
  elif num == 20:
    out = "u"    
  elif num == 21:
    out = "v"
  elif num == 22:
    out = "w"
  elif num == 23:
    out = "x"    
  elif num == 24:
    out = "y"    
  else:
    out = "z"
  return (out)
    
    
    

s = input()
L = []
L.append(s.count("a"))
L.append(s.count("b"))
L.append(s.count("c"))
L.append(s.count("d"))
L.append(s.count("e"))
L.append(s.count("f"))
L.append(s.count("g"))
L.append(s.count("h"))
L.append(s.count("i"))
L.append(s.count("j"))
L.append(s.count("k"))
L.append(s.count("l"))
L.append(s.count("m"))
L.append(s.count("n"))
L.append(s.count("o"))
L.append(s.count("p"))
L.append(s.count("q"))
L.append(s.count("r"))
L.append(s.count("s"))
L.append(s.count("t"))
L.append(s.count("u"))
L.append(s.count("v"))
L.append(s.count("w"))
L.append(s.count("x"))
L.append(s.count("y"))
L.append(s.count("z"))

flag = 0
for i in range(26):
  if L[i] == max(L):
    maxnum = i
    break
for i in range(len(s)):
  if s[i] == convert(maxnum):
    if s[i+1] == convert(maxnum):
      print("{0} {1}".format(i+1, i+2))
      flag = 1
      break
    if s[i+2] == convert(maxnum):
      print("{0} {1}".format(i+1, i+3))
      flag = 1
      break

if flag == 0:
  print("{0} {1}".format(-1,-1))

### FIXED CODE ###

s = input()

flag = 0
for i in range(len(s)-2):
  if s[i] == s[i+1]:
    print("{0} {1}".format(i+1, i+2))
    flag = 1
    break
  elif s[i] == s[i+2]:
    print("{0} {1}".format(i+1, i+3))
    flag = 1
    break
if s[-1] == s[-2] and flag == 0:
  print("{0} {1}".format(len(s)-1, len(s)))
  flag = 1
    
if flag == 0:
  print("{0} {1}".format(-1, -1))
n = int(input())
ls = make_divisors(n)
pairs = []
for i in ls:
    pair = (i, n//i)
    pairs.append(pair)
count = []
for pair in pairs:
    count.append(pair[0] + pair[1] - 2)
print(min(count))

### FIXED CODE ###

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)

    divisors.sort()
    return divisors

n = int(input())
ls = make_divisors(n)
pairs = []
for i in ls:
    pair = (i, n//i)
    pairs.append(pair)
count = []
for pair in pairs:
    count.append(pair[0] + pair[1] - 2)
print(min(count))
N,K = map(int,input().split())
A = [int(x) for x in input().split()]

nums = []
nums_2 = []
for i in range(N):
  num = int(A[i])
  s = 0
  k = 0
  for j in range(i,N):
    if A[j] < num:
      s += 1
  nums.append(s)
  for t in range(N):
    if A[t] < num:
      k += 1
  nums_2.append(k)

result = 0
for i in range(N):
  result += ((K*(K-1))/2)*(nums_2[i]) + K*nums[i]


print(int(result%(N,K = map(int,input().split())
A = [int(x) for x in input().split()]

nums = []
nums_2 = []
for i in range(N):
  num = int(A[i])
  s = 0
  k = 0
  for j in range(i,N):
    if A[j] < num:
      s += 1
  nums.append(s)
  for t in range(N):
    if A[t] < num:
      k += 1
  nums_2.append(k)

result = 0
for i in range(N):
  result += ((K*(K-1))/2)*(nums_2[i]) + K*nums[i]

print(int(result/(10**9+7)))


### FIXED CODE ###

month,day = map(int,input().split())

if day < 22:
  print(0)
else:
  s = 0
  for j in range(month+1):
    for i in range(22,day+1):
      num_1 = i%10
      num_2 = (i-num_1)/10
      if  num_1< 2:
        continue
      elif num_1 * num_2 == j:
        s += 1
  print(s)
n = int(input())
a,b = map(int,input().split())
def sp(n):
  	if n == 1:
    	return 2
  	if n%2 == 0:
    	return (sp(n//2)**2)%(10**9+7)
	if n%2 == 1:
  	  return (2*sp(n-1))%(10**9+7)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


print((sp(n)-cmb(n,a,10**9+7)-cmb(n,b,10**9+7))%(10**9+7))


  
  

### FIXED CODE ###

n,a,b = map(int,input().split())
def power(x,b):
  if x == 1:
    return b
  if x%2 == 0:
    return (power(x//2,b)**2)%(10**9+7)
  else:
    return (b*power(x-1,b))%(10**9+7)
ans = power(n,2)-1
x1 = 1
y1 = 1
x2 = 1
y2 = 1
for i in range(a):
  x1 = (x1*(n-i))%(10**9+7)
  y1 = (y1*(i+1))%(10**9+7)
for i in range(b):
  x2 = (x2*(n-i))%(10**9+7)
  y2 = (y2*(i+1))%(10**9+7)
ans -= x1*power(10**9+5,y1)
ans -= x2*power(10**9+5,y2)
print(ans%(10**9+7))
a=int(input())
b=input().split(' ')
m=0
s=1
j=0
while m<a:
	if b[m]==0:
        print(0)
        j=j+1

    m=m+1

m=0
while m<a and j==0:
    s=s*int(b[m])
    if s>10**18:
		print(-1)

    m=m+1


else:
    print(s)

### FIXED CODE ###

a=int(input())
b=input().split(' ')
m=0
s=1
i=0
o=0
while i<a:
    if int(b[i])==0:
        print(0)
        o=o+1
    i=i+1
while m<a and o==0:
    s=s*int(b[m])
    m=m+1
    if s>10**18 and o==0:
        print(-1)
        o=o+1
        break

if o==0:
    print(s)
import time

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(N == 0):
        print(2)
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import time
import sys

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(int(N) == 0):
        print(2)
        sys.exit()
    elif(int(N) == 1):
        print(1)
        sys.exit()
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()
import sys
from bisect import *
import math

input = sys.stdin.readline

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

cnum = A.count(0)
if cnum==0:
	res = 0
else:
	amax = max(A)
	numind = [[] for i in range(amax+1)]
	for i,ai in enumerate(A):
		numind[ai].append(i)

	res = 1
	for i in range(amax):
		for order, j in enumerate(numind[i+1]):
			res = (res * (bisect(numind[i],j)-order)) % mod

	res = (res*math.factorial(3)//math.factorial(3-cnum)) % mod

print(res)

### FIXED CODE ###

import sys
from bisect import *
import math

input = sys.stdin.readline

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

cnum = A.count(0)
amax = max(A)

numind = [[] for i in range(amax+1)]
for i,ai in enumerate(A):
	numind[ai].append(i)

if cnum==0 or cnum>3:
	res = 0
else:
	res = 1
	for i in range(amax):
		if len(numind[i+1])==0 or len(numind[i+1])>3:
			res = 0
			break
		for order, j in enumerate(numind[i+1]):
			res = (res * (bisect(numind[i],j)-order)) % mod

	res = (res*math.factorial(3)//math.factorial(3-cnum)) % mod

print(res)
import math

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

if __name__=="__main__":
    N,K=map(int,input().split())
    a=1000000007
    result=0

    for i in range(1,K+1):
        result=int(combination(N-K+1,i)*combination(K-1,i-1))
        print(result%a)

### FIXED CODE ###

import math

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

if __name__=="__main__":
    N,K=map(int,input().split())
    a=1000000007
    result=0

    if N==K:
        for i in range(K):
            if i==0:
                print(1)
            else:
                print(0)
    else:
        for i in range(1,K+1):
            if N-K+1-i<0:
                print(0)
            else:
                result=int(combination(N-K+1,i)*combination(K-1,i-1))
                print(result%a)
H, W = map(int, input().split())
S = [input() for _ in range(H)]

ans = max(H, W)

f = [1] * W
for i in range(1, H):
    f = [(f[j]+1) if (S[i-1][j:j+2] + S[i][j:j+2]).count('#') in [0,2,4] else 1 for j in range(W-1)] + [0]
    stk = []
    for j, v in enumerate(f):
        while len(stk) > 0 and f[stk[-1]] >= v:
            ans = max(ans, f[stk.pop()] * (j - (stk[-1] if len(stk) > 0 else -1)))
        stk.append(j)

print(ans)


### FIXED CODE ###

n=int(input())
freq={}
for x in list(map(int,input().split())):
    if x not in freq:
        freq[x] = 1
    else:
        freq[x] += 1

s = []
ans = [0]
for i, v in sorted(list(freq.items()),reverse=True):
    if v >= 4:
        ans.append(i * i)
    if v >= 2:
        s.append(i)
        if len(s) == 2:
            ans.append(s[0] * s[1])

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

m=100000
c=[0]*(m+1)

for i in a:c[i]+=1

for i in range(1,m+1):
	if c[i] == 0:continue
	for j in range(i*2,m+1,i):
		c[j]+=1
ans=0
for i in a:
 if c[i]==1:ans+=1
print(ans)

### FIXED CODE ###

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

m=1000000
c=[0]*(m+1)

for i in a:c[i]+=1

for i in range(1,m+1):
	if c[i] == 0:continue
	for j in range(i*2,m+1,i):
		c[j]+=1
ans=0
for i in a:
 if c[i]==1:ans+=1
print(ans)
import math

A, B = map(int, input().split())

def lcm(x, y):
    if x == 0 or y == 0:
        return 0
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

### FIXED CODE ###

import fractions

A, B = map(int, input().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))
array = []
for i in input():
  array.append(i)

size = len(array)

for i in range(size):
	if (array[size - i] - array[0] >= 18):
      print(':(')
    if (i < 3):
      if (array[size - i] - array[1] >= 18):
      	print(':(')
      else:
        print('Yay!')
    if (i < 2):
      if (array[size - i] - array[1] >= 18):
      	print(':(')
      else:
        print('Yay!')
	if (i < 1):
      if (array[size - i] - array[1] >= 18):
      	print(':(')
      else:
        print('Yay!')

### FIXED CODE ###

array1 = [int(input()) for i in range(6)]
array2 = array1[:5]
k = array1[5] 
 
for i in range(5):
  if (i < 4 and array2[4 - i] - array2[0] > k):
    print(':(')
    break
  if (i < 3 and array2[4 - i] - array2[1] > k):
    print(':(')
    break
  if (i < 2 and array2[4 - i] - array2[2] > k):
    print(':(')
    break
  if (i < 1 and array2[4 - i] - array2[3] > k):
    print(':(')
    break
  if (i == 4):
    print('Yay!')
n, l, t = list(map(int, input().split()))
ants = []
for i in range(n):
    ants.append(list(map(int, input().split())))
normal_ant = [i for i, direction in ants if direction==1]
counter_ant = [i for i, direction in ants if direction==2]
cnt = (t // l) * len(normal_ant) + sum([1 for i in normal_ant if i + t%l >= l])
counter_cnt = (t // l) * len(counter_ant) + sum([1 for i in counter_ant if i - t%l < 0])
final_pos = sorted([(i-t)%l for i in counter_ant] + [(i+t)%l for i in normal_ant])
print(*final_pos[(cnt-counter_cnt)%n:] + final_pos[:(cnt-counter_cnt)%n], sep='\n')

### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


d, g = LI()
g //= 100
p, c = list(zip(*LIR(d)))
c = [c[i] // 100 for i in range(d)]



ans = INF
for i in range(2 ** d):
    cnt = 0
    score = 0
    for j in range(d):
        if 1 << j & i:
            cnt += p[j]
            score += (j + 1) * p[j]
            score += c[j]


    max_score = -INF
    for k in range(d):
        if not (1 << k) & i:
            max_score = max(max_score, k + 1)
    if score < g:
        remain_num = (g - score) // max_score + bool((g - score) % max_score)
        if remain_num >= p[max_score - 1]:
            continue
        cnt += remain_num
    ans = min(ans, cnt)


print(ans)
def dfs(v, par):
    for nv in tree[v]:
        if nv == par:
            continue
        add[nv] += add[v]
        dfs(nv, v)


n, q = map(int, input().split())
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    tree[b].append(a)
    tree[a].append(b)
add = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    add[p] += x
dfs(0, -1)
print(*add)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline


def dfs(v, par):
    for nv in tree[v]:
        if nv == par:
            continue
        add[nv] += add[v]
        dfs(nv, v)


n, q = map(int, input().split())
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    tree[b].append(a)
    tree[a].append(b)
add = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    add[p] += x
dfs(0, -1)
print(*add)
s=int(input())
ans=0
wakeru=0
while s>0:
    s=s-3
    ans=ans+cmb(s+wakeru,wakeru,p)
    wakeru+=1
print(ans%(10**9+7))

### FIXED CODE ###

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


s=int(input())
ans=0
wakeru=0
while s>0:
    s=s-3
    ans=ans+cmb(s+wakeru,wakeru,p)
    wakeru+=1
print(ans%(10**9+7))
def dfs(g_idx, idx):
    if gps[idx] != 'o':
        return
    gps[idx] = g_idx
    mbs[g_idx] += 1
    for f in fs[idx]:
        dfs(g_idx, f)


n, m, k = map(int, input().split())

fs = {}
bs = {}
for _ in range(m):
    a, b = map(int, input().split())
    if a in fs:
        fs[a].append(b)
    else:
        fs[a] = [b]
    if b in fs:
        fs[b].append(a)
    else:
        fs[b] = [a]
for _ in range(k):
    c, d = map(int, input().split())
    if c in bs:
        bs[c].append(d)
    else:
        bs[c] = [d]
    if d in bs:
        bs[d].append(c)
    else:
        bs[d] = [c]

g_idx = 0
gps = ['o'] * (n + 1)
mbs = {}

for idx in range(1, n + 1):
    if gps[idx] != 'o':
        continue
    gps[idx] = g_idx
    mbs[g_idx] = 1
    for f in fs.get(idx, []):
        dfs(g_idx, f)
    g_idx += 1

out = ''
for idx in range(1, n + 1):
    ans = mbs[gps[idx]] - 1 - len(fs.get(idx, []))
    for b_idx in bs.get(idx, []):
        if gps[b_idx] == gps[idx]:
            ans -= 1
    out += str(ans) + ' '
print(out.rstrip())


### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.parent = [-1] * n

    def find(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    # xとyの属する集合の併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        # sizeの大きいほうがx
        if self.parent[x] > self.parent[y]:
            x, y = y, x
        self.parent[x] += self.parent[y]
        self.parent[y] = x

    # xとyが同じ集合に属するかの判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xが属する集合の個数
    def size(self, x):
        return -self.parent[self.find(x)]


n, m, k = map(int, input().split())
num_friends = [0 for _ in range(n + 1)]
blocks = [[] for _ in range(n + 1)]
uf = UnionFind(n + 1)

for i in range(m):
    a, b = map(int, input().split())
    num_friends[a] += 1
    num_friends[b] += 1
    uf.unite(a, b)

for i in range(k):
    c, d = map(int, input().split())
    blocks[c].append(d)
    blocks[d].append(c)

out = ''
for i in range(1, n + 1):
    ans = uf.size(i) - num_friends[i] - 1
    for block in blocks[i]:
        if uf.same(i, block):
            ans -= 1
    out += str(ans) + ' '
print(out.strip())
a,b,c = map(int,input().split())
print(a+b+c)

### FIXED CODE ###

s = input()
print(s.count('1'))
import sys
sys.setrecursionlimit(100000)
n,q=map(int,input().split())
G=[[]*n for i in range(n)]
P=[0]*n
V=[0]*n
R=[0]*n
for i in range(n-1):
	a,b=map(int,input().split())
	G[a-1].append(b-1)
	G[b-1].append(a-1)
for i in range(q):
	c,d=map(int,input().split())
	P[c-1]+=d

def dsf(i,p):
    V[i]=1
    R[i]+=p+P[i]
    p=0
    if G[i]!=[]:
        for j in G[i]:
            if V[j]!=1:
                dsf(j,R[i])
dsf(0,0)
print(' '.join(map(str,R)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
s=sys.stdin.readlines()
n,q=map(int,s[0].split())
G=[[]*n for i in range(n)]
P=[0]*n
V=[0]*n
R=[0]*n
for e in s[1:n]:
    a,b=map(int,e.split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
for e in s[n:]:
    c,d=map(int,e.split())
    P[c-1]+=d

def dsf(i,p):
    V[i]=1
    R[i]+=p+P[i]
    p=0
    for j in G[i]:
        if V[j]!=1:
            dsf(j,R[i])
dsf(0,0)
print(' '.join(map(str,R)))
N, X = map(int, input().split())
steps = list(input().split())

x = 0
count = 0

while x <= X:
    x += int(steps[int(count)])
    count +=1

print(count)

### FIXED CODE ###

N, X = map(int, input().split())
steps = list(map(int,input().split()))
 
x = 0
count = 1

for i in steps:
    x += i
    if x <= X:
        count += 1
 
print(count)
x = import()

if x == 0:
    print(1)

else:
    print(0)

### FIXED CODE ###

x = int(input())

if x == 0:
    print(1)

else:
    print(0)
ソースコード 拡げる

Copy
Copy
N = int(input())
A = list(int,input().split())
B = list(int,input().split())
C = list(int,input().split())
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in ramnge(len(A)):
  if A[x] + 1 == A[x+1]:
    y.append(x)
 

for k in range(len(y)):
  t = t + C[k]
print(t)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in range(len(A)-1):
  if A[x] + 1 == A[x+1]:
    y.append(A[x]-1)
  else:
    pass
for k in y:
  t = t + C[k]
print(t)
while True:
    a,b = map(int,input().split())
    if x == 0 and b == 0:
        break
    else:
        if a < b:
            print("{} {}".format(a,b))
        elif a > b:
            print("{} {}".format(b,a))


### FIXED CODE ###

while True:
    x,y = map(int,input().split(" "))
    if x == 0 and y==0:
        break
    elif y < x:
        print(y,x)
    else:
        print(x,y)