Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		l := strings.Split(stdin.Text(), " ")
		if l[0] == "0" {
			break
		}
		h, _ := strconv.Atoi(l[0])
		w, _ := strconv.Atoi(l[1])

		tile := make([][]rune, h)
		done := make([][]bool, h)
		for i := 0; i < h; i++ {
			stdin.Scan()
			s := stdin.Text()
			tile[i] = make([]rune, w)
			done[i] = make([]bool, w)
			for j, c := range s {
				tile[i][j] = c
			}
		}
		i, j := 0, 0
		for tile[i][j] != '.' {
			if done[i][j] {
				i = -1
				break
			}
			done[i][j] = true
			switch tile[i][j] {
			case '>':
				j++
			case '<':
				j--
			case '^':
				i--
			case 'v':
				i++
			}
		}
		if i < 0 {
			fmt.Println("LOOP")
		} else {
			fmt.Println(j, i)
		}
	}
}

C++: #include <iostream>
#include <string>
using namespace std;

int main()
{
  while(true)
  {
    int h,w;
    cin >> h >> w;
    if ( h == 0 && w == 0 ) break;
    char **room = new char*[h];
    for (int i=0; i<h; i++)
    {
      room[i] = new char[w];
    }

    for (int i=0; i<h; i++)
    {
      for (int j=0; j<w; j++)
      {
        cin >> room[i][j];
      }
    }

    int x = 0;
    int y = 0;
    bool flag = true;
    while(flag)
    {
      switch (room[y][x])
      {
      case '>':
        room[y][x] = 'x';
        x++;
        break;
      case '<':
        room[y][x] = 'x';
        x--;
        break;
      case '^':
        room[y][x] = 'x';
        y--;
        break;
      case 'v':
        room[y][x] = 'x';
        y++;
        break;
      case '.':
        cout << x << ' ' << y << endl;
        flag = false;
        break;
      case 'x':
        cout << "LOOP" << endl;
        flag = false;
        break;
      }
    } //おへや

    for (int i=0; i<h; i++)
    {
      delete[] room[i];
    }
    delete[] room;
  } //  データセット
}

C++: #include<iostream>
#include<cstdio>
#include<memory.h>
using namespace std;
int main()
{
	while (1){
		char map[101][101];
		bool flag[101][101];
		bool f = false;
		
		int h, w;
		cin >> h >> w;
		if (h == 0 && w == 0){
			return 0;
		}
		memset(flag, 0, sizeof(flag));
		for (int i = 0; i < h; i++){
			for (int i2 = 0; i2 < w; i2++){
				cin >> map[i][i2];
			}
		}
		int x, y;
		x = 0; y = 0;
		if (map[y][x] == '>'){
			x++;
		}
		if (map[y][x] == '<'){
			x--;
		}
		if (map[y][x] == '^'){
			y--;
		}
		if (map[y][x] == 'v'){
			y++;
		}

		while (map[y][x] != '.'){
			if (flag[y][x] == true){
				cout << "LOOP" << endl;
				f = true;
				break;
			}
			if (map[y][x] == '>'){
				flag[y][x] = true;
				x++;
			}
			else if (map[y][x] == '<'){
				flag[y][x] = true;
				x--;
			}
			else if (map[y][x] == '^'){
				flag[y][x] = true;
				y--;
			}
			else if (map[y][x] == 'v'){
				flag[y][x] = true;
				y++;
			}

		}
		if (!f){
			cout << x << " " << y << endl;
		}
	}
}

C++: #include <iostream>

enum struct Panel { none, up, down, right, left };

int main() {
    int h, w;
    while (std::cin >> h >> w && h != 0 && w != 0) {
        std::cin.ignore();

        auto room = new std::pair<Panel, bool>[h * w]();
        std::string s;
        for (int i = 0; i < h; i++) {
            std::getline(std::cin, s);
            for (int j = 0; j < w; j++) {
                switch (s[j]) {
                    case '.': room[i * w + j].first = Panel::none; break;
                    case '^': room[i * w + j].first = Panel::up; break;
                    case 'v': room[i * w + j].first = Panel::down; break;
                    case '>': room[i * w + j].first = Panel::right; break;
                    case '<': room[i * w + j].first = Panel::left; break;
                    default: return EXIT_FAILURE;
                }
            }
        }

        int x = 0, y = 0;
        [&]() {
            while (true) {
                if (room[y * w + x].second) {
                    std::cout << "LOOP";
                    break;
                }
                room[y * w + x].second = true;
                switch (room[y * w + x].first) {
                    case Panel::up: y--; break;
                    case Panel::down: y++; break;
                    case Panel::right: x++; break;
                    case Panel::left: x--; break;
                    case Panel::none: std::cout << x << ' ' << y; return;
                }
            }
        }();
        delete[] room;
        std::cout << std::endl;
    }
}

C++: #include <stdio.h>

int main(){
  while(1){
    int w,h;
    scanf("%d%d", &h, &w);

    if(w==0) break;

    char map[h][w];
    int done[h][w];

    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
       done[i][j] = 0;
       scanf(" %c", &map[i][j]);
       //printf("%c", map[i][j]);
      }
      //puts("");
    }

    int x,y;
    x = y = 0;
    
    while(map[x][y] != '.' && !done[x][y]){
      done[x][y] = 1;
      if(map[x][y] == '>') y++;
      else if(map[x][y] == 'v') x++;
      else if(map[x][y] == '^') x--;
      else if(map[x][y] == '<') y--;
    }

    if(done[x][y]) printf("LOOP\n");
    else printf("%d %d\n", y, x);
  }
  return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,i,j,f,g,c[500][500],v;
	char z[1000][1000],x;
	while(1){
		v=0;
		scanf("%d %d",&a,&s);
		if(a==0&&s==0)	break;
		for(i=0;i<a;i++){
			for(j=0;j<s;j++)
				z[i][j]=0;
		}
		for(i=0;i<a;i++){
			scanf("%s",z[i]);
		}
		for(i=0;i<a;i++){
			for(j=0;j<s;j++){
				c[i][j]=0;
			}
		}
		f=0;
		g=0;
		while(1){
			if(z[f][g]=='>'){
				g++;
				c[f][g]++;
			//	printf("%d %d\n",f,g);
			}
			else if(z[f][g]=='<'){
				g--;
				c[f][g]++;
			//	printf("%d %d\n",f,g);
			}
			else if(z[f][g]=='^'){
				f--;
				c[f][g]++;
			//	printf("%d %d\n",f,g);
			}
			else if(z[f][g]=='v'){
				f++;
				c[f][g]++;	
			//	printf("%d %d\n",f,g);
			}
			if(z[f][g]=='.')	break;
			if(c[f][g]==2){
				v=1;
				break;
			}
		}
		if(v==1)
			printf("LOOP\n");
		else
			printf("%d %d\n",g,f);
	}
		return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
char a[1000][1000]; int h, w, loop, cx, cy;
int main() {
	while (true) {
		cin >> h >> w;
		if (!h) { break; }
		memset(a, ' ', sizeof(a));
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> a[i][j];
			}
		}
		cx = 0; cy = 0; loop = 0;
		while (true) {
			if (loop > 10000000) { cout << "LOOP" << endl; break; }
			if (a[cy][cx] == '.') { cout << cx << ' ' << cy << endl; break; }
			if (a[cy][cx] == '<') { cx--; }
			if (a[cy][cx] == '>') { cx++; }
			if (a[cy][cx] == '^') { cy--; }
			if (a[cy][cx] == 'v') { cx++; }
			loop++;
		}
	}
}

C++: //51
#include<iostream>

using namespace std;

int main(){
  for(int W,H;cin>>H>>W,W|H;){
    char g[100][100];
    for(int y=0;y<H;y++){
      for(int x=0;x<W;x++){
	cin>>g[y][x];
      }
    }
    int y=0,x=0;
    while(g[y][x]!='.'&&g[y][x]!='\0'){
      int ny=y+(g[y][x]=='v')-(g[y][x]=='^');
      int nx=x+(g[y][x]=='>')-(g[y][x]=='<');
      g[y][x]='\0';
      y=ny;
      x=nx;
    }
    if(g[y][x]){
      cout<<x<<' '<<y<<endl;
    }else{
      cout<<"LOOP"<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int h, w;
	char map[101][101];
	
	while (cin >> h >> w, h * w){
		int x = 0, y = 0;
		bool check[101][101];
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				cin >> map[i][j];
				check[i][j] = false;
			}
		}
		
		while (map[y][x] != '.'){
			if (check[y][x])	break;
			check[y][x] = true;
			if (map[y][x] == '>')	x++;
			else if (map[y][x] == '<')	x--;
			else if (map[y][x] == '^')	y--;
			else if (map[y][x] == 'v')	y++;
		}
		if (check[y][x])	cout << "LOOP";
		else cout << x << ' ' << y;
		cout << endl;
	}
	return (0);
}