akhauriyash/Code-Regression huggingface dataset:
# import numpy as np
from collections import deque

def solve(): #H, W, CH, CW, DH, DW, S):
	H,W=map(int,input().split())
	CH,CW=map(int,input().split())
	DH,DW=map(int,input().split())
	S=[input() for _ in range(H)]

	# 後の条件分岐を簡略化するためワープしても迷路外に出ないように壁で囲む
	S = ['##{}##'.format(row) for row in S]
	S.insert(0, '##{}##'.format('#' * W))
	S.insert(0, '##{}##'.format('#' * W))
	S.append('##{}##'.format('#' * W))
	S.append('##{}##'.format('#' * W))


	MAX_COST = 10 ** 9
	Cost=[ [ MAX_COST for _ in range(W+4)] for _ in range(H+4)]
	# Cost = np.full((H,W),MAX_COST)

	# print(S)

	ans = -1

	cost0 = deque()

	cost0.append((CH+1,CW+1,0))
	Cost[CH+1][CW+1] = 0;

	# used = set()
	walk=[(1,0),(0,1),(-1,0),(0,-1)]
	warp = [ (i,j) for i in range(-2,3) for j in range(-2,3) if (i, j) not in [(0, 0)] + walk ]
	# print(warp)

	cost1 = deque()

	while cost0:
		h,w,c=cost0.popleft()
		cost1.append((h,w,c))

		for i,j in walk:
			dh = h+i
			dw = w+j
			if S[dh][dw] == '.' and c < Cost[dh][dw]:
				Cost[dh][dw] = c
				# print("updl ", i,j,dh,dw,c)
				cost0.appendleft((dh,dw,Cost[dh][dw]))

		if len(cost0) == 0:

			while cost1:
				h,w,c=cost1.popleft()
				# print(h,w,c)
				for i,j in warp:
					dh = h+i
					dw = w+j
					# print(i,j)
					if S[dh][dw] == '.' and c + 1 < Cost[dh][dw]:
						Cost[dh][dw] = c + 1
						cost0.append((dh,dw,Cost[dh][dw]))


	if Cost[DH+1][DW+1] == MAX_COST:
		print(-1)
	else:
		print(Cost[DH+1][DW+1])


if __name__ == "__main__":

	# S=[input() for _ in range(H)]

	solve() #H, W, CH, CW, DH, DW, S)


Measured memory_bytes: 24404
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n;
  	int a[100];
    int alice=0,bob=0;
  	cin >> n;
  	for(int i=0;i<n;++i) cin >> a[i];
  	sort(a,a+n);
  	reverse(a,a+n);
  	for(int i=0;i<n;++i){
    	if(i%2==0)
          	alice+=a[i];
      	else
          	bob+=a[i];
    }
  	cout << alice-bob << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n,a[5000],m,p,q;
    bool b[5000],f;
    while(1){
        scanf("%d",&n);
        if(n==0)return 0;
        for(int i=0;i<5000;i++)a[i]=b[i]=0;
        f=false;
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&m,&p,&q);
        if(!b[m]){
            a[m]+=p*q;
            if(a[m]>=1000000){
                b[m]=true;
                f=true;
                printf("%d\n",m);
            }
        }
    }
        if(!f)printf("NA\n");
    }
}

Measured memory_bytes: 2740