Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int judge(vector<int> &a,int k)
{
	for (int i = 2; i < k; ++i) {
		if (a[i] % 2 == 1) {
			return 1;
			break;
		}
	}
	return 0;
}
void output(const char str[])
{
	cout << str << endl;
}
int main()
{
	int aa, bb,size=0;
	vector<int> a;
	while (cin >> aa >> bb&&aa != 0 && bb != 0) {
		if (aa > size || bb > size) {
			a.resize(max(aa, bb) - a.size());
			fill_n(&a + size, max(aa, bb) - size, 0);
			size = a.size();
		}
		a[aa - 1] += 1;
		a[bb - 1] += 1;
	}
	if (a[0] % 2 == 1 && a[1] % 2 == 1 && judge(a,a.size()) == 0) output("OK");
	else output("NG");
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = vector<int>*; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = vector<int>*; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1154:20:   required from '_OutputIterator std::__fill_n_a(_OutputIterator, _Size, const _Tp&, random_access_iterator_tag) [with _OutputIterator = vector<int>*; _Size = int; _Tp = int]'
 1154 |       std::__fill_a(__first, __first + __n, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1183:29:   required from '_OI std::fill_n(_OI, _Size, const _Tp&) [with _OI = vector<int>*; _Size = int; _Tp = int]'
 1183 |       return std::__fill_n_a(__first, std::__size_to_integer(__n), __value,
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1184 |                                std::__iterator_category(__first));
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:26:10:   required from here
   26 |                         fill_n(&a + size, max(aa, bb) - size, 0);
      |                         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'const int')
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/vector:72,
                 from a.cc:2:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'const int' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'const int' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'const int' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~