Problem:


Score: 300 points

Problem Statement

We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.

According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.

Determine if he is correct.  

Constraints

c_{i, j} \ (1 \leq i \leq 3, 1 \leq j \leq 3) is an integer between 0 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

c_{1,1} c_{1,2} c_{1,3}
c_{2,1} c_{2,2} c_{2,3}
c_{3,1} c_{3,2} c_{3,3}

Output

If Takahashi's statement is correct, print Yes; otherwise, print No.

Sample Input 1

1 0 1
2 1 2
1 0 1

Sample Output 1

Yes

Takahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.

Sample Input 2

2 2 2
2 1 2
2 2 2

Sample Output 2

No

Takahashi is incorrect in this case.

Sample Input 3

0 8 8
0 8 8
0 8 8

Sample Output 3

Yes

Sample Input 4

1 8 6
2 9 7
0 7 7

Sample Output 4

No



Sample input:
1 0 1
2 1 2
1 0 1


Sample output:
Yes

Submission status: Runtime Error

Solution code:
#pragma GCC optimize("O3")
#pragma GCC target("avx")

#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

// Types
using ll = long long int;
using str = string;
template <class T> using u_set = unordered_set<T>;
template <class K, class V> using u_map = unordered_map<K, V>;
template <class V> using graph = u_map<V, u_set<V>>;
template <class F,
          typename enable_if<is_function<F>::value, nullptr_t>::type = nullptr>
using fun = function<F>;

namespace io {
// Input
using IS = istream;
IS &in(IS &i);
IS &in(IS &i) { return i; }
template <class T, class... Ts> IS &in(IS &i, T &a, Ts &... as) {
  return in(i >> a, as...);
}
template <class V> IS &operator>>(IS &i, vector<V> &a) {
  for_each(a.begin(), a.end(), [&i](auto &e) { i >> e; });
  return i;
}
template <class F, class S> IS &operator>>(IS &i, pair<F, S> &p) {
  return in(i, p.first, p.second);
}
template <class... Ts, size_t... I>
IS &tuple_in(IS &i, tuple<Ts...> &t, index_sequence<I...>) {
  return in(i, get<I>(t)...);
}
template <class... Ts> IS &operator>>(IS &i, tuple<Ts...> &t) {
  return tuple_in(i, t, make_index_sequence<sizeof...(Ts)>());
}
// Output
using OS = ostream;
OS &out(OS &o) { return o << endl; }
template <class T> OS &out(OS &o, T const &a) { return o << a << endl; }
template <class T, class... Ts> OS &out(OS &o, T const &a, Ts const &... as) {
  return out(o << a << " ", as...);
}
template <class F, class S> OS &operator<<(OS &o, pair<F, S> const &p) {
  return o << p.first << ":" << p.second;
}
template <class... Ts> OS &args_out(OS &o, Ts const &... ts);
OS &args_out(OS &o) { return o; }
template <class T> OS &args_out(OS &o, T const &t) { return o << t; }
template <class T0, class T1, class... Ts>
OS &args_out(OS &o, T0 const &t0, T1 const &t1, Ts const &... ts) {
  return args_out(o << t0 << ",", t1, ts...);
}
template <class... Ts, size_t... I>
OS &tuple_out(OS &o, tuple<Ts...> const &t, index_sequence<I...>) {
  return args_out(o, get<I>(t)...);
}
template <class... Ts> OS &operator<<(OS &o, tuple<Ts...> const &t) {
  return tuple_out(o << "(", t, make_index_sequence<sizeof...(Ts)>()) << ")";
}
template <
    class C,
    class T = typename iterator_traits<typename C::iterator>::value_type,
    typename enable_if<!is_same<C, str>::value, nullptr_t>::type = nullptr>
OS &operator<<(OS &o, C const &a) {
  return a.empty() ? (o << "[]") : ([&o, &a]() -> OS & {
    o << "[" << *a.begin();
    for_each(next(a.begin()), a.end(), [&o](auto const &e) { o << "," << e; });
    return o << "]";
  }());
}
} // namespace io
auto input = [](auto &... a) { io::in(cin, a...); };
auto print = [](auto const &... a) { io::out(cout, a...); };
#ifdef JUMPAKU_DEBUG
auto dump = [](auto const &... a) { io::out(cout, a...); };
#else
auto dump = [](auto const &... a) {};
#endif

// Hash
namespace hashcode {
template <class... Ts> size_t hash_args(size_t h, Ts const &... ts);
size_t hash_args(size_t h) { return h; }
template <class T, class... Ts>
size_t hash_args(size_t h, T const &t, Ts const &... ts) {
  return hash_args(((h << 10) - h + hash<T>{}(t)), ts...);
}
template <class... Ts, size_t... I>
size_t hash_tuple(tuple<Ts...> const &t, index_sequence<I...>) {
  return hash_args(1089283, get<I>(t)...);
}
} // namespace hashcode
namespace std {
template <class... Ts> struct hash<tuple<Ts...>> {
  size_t operator()(tuple<Ts...> const &t) const {
    return hashcode::hash_tuple(t, index_sequence_for<Ts...>());
  }
};
} // namespace std

// Range
vector<ll> range(ll const &begin, ll const &end) {
  vector<ll> ret(max(0LL, end - begin));
  iota(ret.begin(), ret.end(), begin);
  return ret;
}
vector<ll> range(ll const &end) { return range(0, end); }
template <class T = ll> vector<T> vec(size_t n, T &&init = T()) {
  return vector<T>(n, init);
}
template <class Itr, class T = typename iterator_traits<Itr>::value_type>
vector<T> vec(Itr begin, Itr end) {
  return vector<T>(begin, end);
}

ll bisect(ll ng, ll ok, fun<bool(ll)> const &is_ok) {
  while (ok - ng > 1) {
    dump(ng, ok);
    ll m = ng + (ok - ng) / 2;
    (is_ok(m) ? ok : ng) = m;
  }
  return ok;
}
ll gcd(ll p, ll q) { return (q == 0) ? p : gcd(q, p % q); }
ll lcm(ll p, ll q) { return p * q / gcd(q, p); }

// MOD
ll pow(ll a, ll n, ll m) {
  if (n == 0)
    return 1;
  if (n & 1)
    return ((a % m) * pow(a, n - 1, m)) % m;
  auto b = pow(a, n / 2, m);
  return (b * b) % m;
}
ll inv(ll a, ll p) { return pow(a, p - 2, p); }
constexpr ll MOD = 1e9 + 7;

int main() {
  auto c = vec(3, vec(3));
  input(c);
  dump(c);
  for (auto &&b0 : range(101)) {
    for (auto &&b1 : range(101)) {
      for (auto &&b2 : range(101)) {
        auto b = vector<ll>{b0, b1, b2};
        auto a = vec(3, -1LL);
        for (auto &&i : range(3)) {
          ll a3 = 0;
          for (auto &&j : range(3)) {
            a3 += c[i][j] - b[j];
          }
          if (!(a3 % 3 == 0 && 0 <= a3 / 3 && a3 / 3 <= 100))
            goto NEXT;
        }
        return print("Yes"), 0;
      NEXT:;
      }
    }
  }
  print("No");
}

Submission status: Runtime Error

Solution code:
mat = []
 
for i in range(3):
  a = list(map(int, input().split()))
 
ans = False
if mat[1][0] - mat[0][0] == mat[1][1] - mat[0][1] and mat[1][1] - mat[0][1] == mat[1][2] - mat[0][2]:
  if mat[2][0] - mat[0][0] == mat[2][1] - mat[0][1] and mat[2][1] - mat[0][1] == mat[2][2] - mat[0][2]:
    ans = True
 
if ans:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
mat = []

for i in range(3):
  a = list(map(int, input().split()))

ans = False
if mat[1][0] - mat[0][0] == mat[1][1] - mat[0][1] == mat[1][2] - mat[0][2]:
  if mat[2][0] - mat[0][0] == mat[2][1] - mat[0][1] == mat[2][2] - mat[0][2]:
    ans = True

if ans:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
array = np.zeros((3, 3), dtype="int8")
for i in range(3):
    inputs = map(int, input().split())
    for j in range(3):
        array[i, j] = inputs[j]
    
b_1 = array[0, 0]
b_2 = array[0, 1]
b_3 = array[0, 2]
a_2 = array[1, 0] - b_1
a_3 = array[2, 0] - b_1
if (array[1, 1] == (a_2 + b_2)) & (array[2, 2] == (a_3 + b_3)):
    flag = 1
else:
    flag = 0

if flag:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c=[list(map(int,input().split())) for i in range(3)]



for i in range(101):
　info=True
　a1=i
  b1=c[0][0]-a1
  b2=c[0][1]-a1
  b3=c[0][2]-a1
  a2=c[1][0]-b1
  a3=c[2][0]-b1
  if min(a1,a2,a3,b1,b2,b3)<0:
    info=False
  if c[1][1]!=a2+b2:
    info=False
  if c[2][1]!=a3+b2:
    info=False
  if info:
    print("Yes")
    break
else:
  print("No")

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for _ in range(3)]
try:
    assert (sum(c[2]) - sum(c[1])) % 3 == 0
    assert (sum(c[1]) - sum(c[0])) % 3 == 0
    assert (sum([c[2] for line in c]) - sum([c[1] for line in c])) % 3 == 0
    assert (sum([c[1] for line in c]) - sum([c[0] for line in c])) % 3 == 0
    print("Yes")
except AssertionError:
    print("No")

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for _ in range(3)]

a = [0] * 3
b = [0] * 3
ans = "Yes"
a[0] = 0
b[0] = c[0][0] - a1
b[1] = c[0][1] - a1
b[2] = c[0][2] - a1
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]
for i in range(3):
    for j in range(3):
        if a[i] + b[j] != c[i][j]:
            ans = "No"

print(ans)

Submission status: Runtime Error

Solution code:
x

Submission status: Runtime Error

Solution code:
import sys

m = [map(int, input().split()) for _ in range(3)]

for a in range(-1000, 1001):
    b_1 = m[0][0] - a
    b_2 = m[0][1] - a
    b_3 = m[0][2] - a
    if (m[1][0] - b_1 ==
        m[1][1] - b_2 ==
        m[1][2] - b_3) and \
        (m[2][0] - b_1 ==
         m[2][1] - b_2 ==
         m[2][2] - b_3):
        print('Yes')
        sys.exit()
print('No')

Submission status: Runtime Error

Solution code:
c = [[]]*3

for i in range(3):
    c[i] = map(int, input().split())
ans = 0
for i in range(3):
    ans += sum(c[i])

if ans % 3 == 0:
    arr = [0]* 3
    for i in range(3):
        arr = c[i][0] - c[i][1] - c[i][2]
    
    if arr[0] == arr[1] and arr[0] == arr[2]:
        print("Yes")
        exit(0)

print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
A= np.array([list(map(int,input()split())) for I in range (3)])

for I in range (2):
    j,k,l = A[1]-A[0]
    if not (j==k and k==l):
        print ( "No")
        quit()
    j,k,l = A[2]-A[0]
    if not (j==k and k==l):
        print ( "No")
        quit()
print("Yes")

Submission status: Runtime Error

Solution code:
mat = []
for i in range(3):
  mat.append(list(map(int,input().split())))
for a in range(101):
  for b in range(101):
    for c in range(101):
      for d in range(101):
        for e in range(101):
          for f in range(101):
            if a+d == mat[0][0] and a+e == mat[0][1] and a+f ==[0][2] and b+d == mat[1][0] and b+e == mat[0][1] and b+f ==[1][2] and c+d == mat[2][0] and c+e == mat[2][1] and c+f ==[2][2]:
              print("Yes")
            elif:
              print("No")

Submission status: Runtime Error

Solution code:
c = list
for i in range(3):
  a=list(map(int,input().split()))
  c.append(a)
br = 0
for i in range(2):
  for j in range(2):
    if(c[i][j]+c[i+1][j+1]==c[i][j+1]+c[i+1][j]):
      None
    else:
      br+=1
      break
if(br==0):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    r1max = max([c11, c12, c13])
    r2max = max([c21, c22, c23])
    r3max = max([c31, c32, c33])
    c1max = max([c11, c21, c31])
    c2max = max([c12, c22, c32])
    c3max = max([c13, c23, c33])
    for a1, a2, a3 in [[a1, a2, a3] for a1 in range(0, r1max + 1) for a2 in range(0, r2max + 1) for a3 in range(0, r3max + 1)]:
        m = max([a1, a2, a3])
        for b1 in range(0, c1max - m + 1):
            if a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31:
                for b2 in range(0, c2max - m + 1):
                    if a1 + b2 == c12 and a2 + b2 == c22 and a3 + b2 == c32:
                        for b3 in range(0, c3max - m + 1):
                            if a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33:
                                print('Yes')
                                return

    print('No')
    return


if __name__ == '__main__':
    main()
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    r1m = max([c11, c12, c13])
    r2m = max([c21, c22, c23])
    r3m = max([c31, c32, c33])
    c1m = max([c11, c21, c31])
    c2m = max([c12, c22, c32])
    c3m = max([c13, c23, c33])
    a = [(a1, a2, a3) for a1 in range(0, r1m + 1) for a2 in range(0, r2m + 1) for a3 in range(0, r3m + 1)]
    m = max(a)
    b = [(b1, b2, b3) for b1 in range(0, c1m - m + 1) for b2 in range(0, c2m - m + 1) for b3 in range(0, c3m - m + 1)]

    for a1, a2, a3, b1, b2, b3 in a, b:
        if (a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33
            and a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31
                and a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33):
            print('Yes')
            return

    #                                if a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33:
    #                                    print('Yes')
    #                                    return

    #            m = max([a1, a2, a3])
    #            for b1 in range(0, c1m - m + 1):
    #                if a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31:
    #                    for b2 in range(0, c2m - m + 1):
    #                        if a1 + b2 == c12 and a2 + b2 == c22 and a3 + b2 == c32:
    #                            for b3 in range(0, c3m - m + 1):
    #                                if a1 + b3 == c13 and a2 + b3 == c23 and a3 + b3 == c33:
    #                                    print('Yes')
    #                                    return

    print('No')
    return


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

li = [list(map(int, input().split())) for _ in range(3)]
sum1 = li[0][0] + li[1][1] + li[2][2]
sum2 = li[1][0] + li[2][1] + li[0][2]
sum3 = li[2][0] + li[3][1] + li[1][2]
if sum1 ==sum2 and sum2 == sum3:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c = []
ans = "No"

for i in range(3):

    nc = input()
    c.append([int(nc[0]),int(nc[2]),int(nc[4])])


if c[0][1]-c[0][0] == c[1][1]-c[1][0] and c[1][1]-c[1][0] == c[2][1]-c[2][0] and c[0][2]-c[0][1] == c[1][2]-c[1][1] and c[1][2]-c[1][1] == c[2][2]-c[2][1]:

    if c[1][0]-c[0][0] == c[1][1] - c[0][1] and c[1][1]-c[0][1] == c[1][2] - c[0][2] and c[2][0]-c[1][0] == c[2][1]-c[1][1] and c[2][1]-c[1][1] == c[2][2]-c[1][2]:

        ans = "Yes"

print (ans)

Submission status: Runtime Error

Solution code:
c = [list(map(int,input().split())) for _ in range(3)]

def check(c):
  for a1 in range(c[0][0]):
    b = [c[0][i] - a1 for i in range(3)]
    a = [a1] + [c[i][0] - b[0] for i in range(1,3)]

    for ai in a:
      for bi in b:
        if c[ai][bi] != a[ai]+b[bi]:
          print('No')
          return
  print('Yes')

check(c)

Submission status: Runtime Error

Solution code:
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2];:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
L=[]
for i in range(3):
  L.append(list(map(int,input().split())))
if all(S[i][0]-S[i+1][0]==S[i][1]-S[i+1][1]==S[i][2]-S[i+1][2] for i in range(2)) and all(S[0][i]-S[0][i+1]==S[1][i]-S[1][i+1]==S[2][i]-S[2][i+1] for i in range(2)):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
num=[]
for i in range(3):
  nums.append(list(map(int,input().split())))
subd=[]
for i in range(3):
  subd.append([nums[i][0]-nums[i][1],nums[i][1]-nums[i][2]])
for i in range(3):
  subd.append([nums[0][i]-nums[1][i],nums[1][i]-nums[2][i]])
if subd[0]==subd[1] and subd[1]==subd[2] and subd[3]==subd[4] and subd[4]==subd[5]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
C = [list(map(int, input().split()))  for _ in range(3)]

for i in range(2):
  for j in range(2):
    if C[i][j] - C[i][j+1] != C[i+1][j] - C[i+1][j+1] :
    break
    if C[j][i] - C[j+1][i] != C[j][i+1] - C[j+1][i+1] :
      break
else:
  print("Yes")
  out = True
if not out:
  print("No")

Submission status: Runtime Error

Solution code:
sum=0
for i in range(3):
  sum+=sum([map(int,input().split())])
print("Yes" if sum%3==0 else "No")

Submission status: Runtime Error

Solution code:

c = [list(map(int,input().split())) for _ in range(3)]
maxim = max(max(c))
for i in range(maxim):
    for j in range(maxim):
        for k in range(maxim):            
            flag = True
            a = [i,j,k]
            b = [c[0][l]-a[0] for l in range(3)]
            for l in range(1,3):
                for m in range(3):
                    if c[l][m] - a[l] != b[m]:
                        flag = False
                        break
                else:continue
                break  
            else:
                if flag:
                    break
        else:continue
        break
    else:continue
    break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
c = [list(map(int,input().split())) for _ in range(3)]
maxim = max(max(c))
for i in range(maxim):
    for j in range(maxim):
        for k in range(maxim):            
            flag = True
            a = [i,j,k]
            b = [c[0][l]-a[0] for l in range(3)]
            for l in range(1,3):
                for m in range(3):
                    btmp = c[l][m] - a[l]
                    if btmp != b[m]:
                        flag = False
                        break
                else:continue
                break                    
            
            if flag:
                break
        else:continue
        break
    else:continue
    break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:

c = [list(map(int,input().split())) for _ in range(3)]
maxim = max(max(c))
for i in range(maxim):
    for j in range(maxim):
        for k in range(maxim):            
            flag = True
            a = [i,j,k]
            b = [c[0][l]-a[0] for l in range(3)]
            for l in range(1,3):
                for m in range(3):
                    btmp = c[l][m] - a[l]
                    if btmp != b[m]:
                        flag = False
                        break
                else:continue
                break                    
            
            if flag:
                break
        else:continue
        break
    else:continue
    break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a=[]
for i in range(3):
   stri=input()
   a.append(stri.split())

y= len(a)
x =len(a[0])


for Y in range(y):
  for X in range(x):
       if(a[Y][X]!=Y+X+2)
          print("No")

print("Yes")

Submission status: Runtime Error

Solution code:
lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
    lis1.append(int(num))
for num in input().split():
    lis2.append(int(num))
for num in input().split():
    lis3.append(int(num))
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            count = 0
            if lis1[0] - a1 == lis2[0] – a1 == lis3[0] - a1:
                count += 1
            if lis1[1] - a2 == lis2[1] - a2 == lis3[1] - a2:
                count += 1
            if lis1[2] - a3 == lis2[2] - a3 == lis3[2] - a3:
                count += 1
            if count == 3:
                print("Yes")
                break
print("No")

Submission status: Runtime Error

Solution code:
ar = [[int(i) for i in input().split()] for j in range(3)]

if ar[0][0] + ar[1][1] + ar[2][2] == ar[0][1] + ar[1][2] + ar[2][0] == ar[0][3] + ar[1][0] + ar[2][1]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
b=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
for i in range(max(0,b[0]-100,b[1]-100,b[2]-100),min(100,b[0],b[1],b[2])+1):
  t1=set()
  t2=set()
  for j in range(3):
    t1.add(a2[j]-(b[j]-i))
    t2.add(a3[j]-(b[j]-i))
  if len(t1)==1 and len(t2)==1 and t1[0]>=0 and t2[0]>=0:
    print('Yes')
    break
else:
  print('No')

Submission status: Runtime Error

Solution code:
x1, y1, x2, y2 = map(int, input().split())

def vector(x1, y1, x2, y2):
    return x2 - (y2 - y1), y2 + (x2 - x1)

x3, y3 = vector(x1, y1, x2, y2)
x4, y4 = vector(x2, y2, x3, y3)

print(x3, y3, x4, y4)

Submission status: Runtime Error

Solution code:
m=[list(map(int,input().split()))for i in range(3)]
ans=1
if m[0][0]-m[1][0]!=m[0][1]-m[1][1]:
  ans=0
if m[0][0]-m[1][0]!=m[0][2]-m[1][2]:
  ans=0
if m[0][0]-m[2][0]!=m[0][1]-m[2][1]:
  ans=0
if m[0][0]-m[2][0]!=m[0][2]-m[2][2]:
  ans=0
if m[0][0]-m[0][1]!=m[1][0]-m[1][1]:
  ans=0
if m[0][0]-m[0][1]!=m[2][0]-m[2][1]:
  ans=0
if m[0][0]-m[0][2]!=m[1][0]-m[1][2]:
  ans=0
if m[0][0]-m[0][2]!=m[2][0]-m[2][2]:
  ans=0
print("YNeos"[and::2])

Submission status: Runtime Error

Solution code:
import numpy as np
import numpy.linalg as LA
a=[int(i) for i input().split()]
a=[a,[int(i) for i input().split()]]
a.appedn([int(i) for i input().split()])
a = np.array(a)
if LA.det(a)==0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
  c.append(list(map(int, input()split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][0] -= diff

diff = c[0][2] - c[2][2]
c[0][1] -= diff
c[0][0] -= diff

if c[1][1] == c[2][1] and c[0][1] == c[2][1] and c[1][0] == c[2][0] and c[1][0] == c[0][0]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
  c.append(list(map(int, input()split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][3] -= diff

diff = c[3][2] - c[2][2]
c[3][1] -= diff
c[3][3] -= diff

if c[1][1] == c[2][1] and c[3][1] == c[2][1] and c[1][3] == c[2][3] and c[1][3] == c[3][3]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
C1 = list(map(int, input().split()))
C2 = list(map(int, input().split()))
C3 = list(map(int, input().split()))

C = [C1, C2, C3]
A = [0] * 3
B = [0] * 3

B = C1
A[1] = C2[0] - B[0]
A[2] = C3[0] - B[0]

flg = True
for a in range(A[1], A[2]):
    for b in range(B[1], B[2]):
        if C[a][b] != a + b:
            flg = False

if flg is True:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
C = [0]*3
C1 = [[0]*2]*3
C2 = [[0]*3]*2
for i in range(3):
  C[i] = list(map(int, input().split()))
for i in range(3):
  for j in range(2):
    C1[i][j] = C[i][j] - C[i][j+1]
for i in range(2):
  for j in range(3):
    C2[i][j] = C[i][j] - C[i+1][j]
if(C1[0][0] == C1[1][0] == C1[2][0]):
  if(C1[0][1] == C1[1][1] == C1[2][1]):
    if(C2[0][0] == C2[0][1] == C2[0][2]):
      if(C2[1][0] == C2[1][1] == C2[1][2]):
  print("No")
  exit()
print("No")

Submission status: Runtime Error

Solution code:
C = []*3, C1 = [[]*2]*3, C2 = [[]*3]*2
for i in range(3):
  C[i] = list(map(int, input().splite()))
for i in range(3):
  for j in range(2):
    C1[i][j] = C[i][j] - C[i][j+1]
for i in range(2):
  for j in range(3):
    C2[i][j] = C[i][j] - C[i+1][j]
if(C1[0][0] == C1[1][0] and C1[1][0] == C1[2][0]):
  if(C1[0][1] == C1[1][1] and C1[1][1] == C1[2][1]):
    if(C2[0][0] == C2[0][1] and C1[0][1] == C1[0][2]):
      if(C2[1][0] == C1[1][1] and C1[1][1] == C1[1][2]):
        print("Yes")
        exit()
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
c=[[int(i) for i in l.stlip()] for l in sys.stdin]
for i in range(2):
  stack=c[i][0]-c[i+1][0]
  for j in range(3):
    if stack!=c[i][j]-c[i+1][j]:
      print('No')
      exit()
for i in range(2):
  stack=c[0][i]-c[0][i+1]
  for j in range(3):
    if stack!=c[j][i]-c[j][i+1]:
      print('No')
      exit()
print('Yes')

Submission status: Runtime Error

Solution code:
#escape_ck_ans
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
a=[0]*3
b=[0]*3
a[0]=0#一つ固定する
a[1]=c[1][1]-c[0][1]
a[2]=c[2][2]-c[0][2]
b[0]=c[0][0]
b[1]=c[0][1]
b[2]=c[0][2]
flag=True
for i in range(3):
    for j in range(3):
        if c[i][j]!=a[i]+b[i]:
            flag=False
if flag=True:
    print("Yes")
else:
    print("No")
""" 
print("Yes") if flag(is true) else print("No")
"""

Submission status: Runtime Error

Solution code:
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

bs = []
for a1 in range(0, 100):
    for b1 in range(0, 100):
        if a1 + b1 == c11:
            f1 = True
            break
    for b2 in range(0, 100):
        if a1 + b2 == c12:
            f2 = True
            break
    for b3 in range(0, 100):
        if a1 + b3 == c13:
            f3 = True
            break
    if f1 and f2 and f3:
        bs.append((b1, b2, b3))

bss = []
for a2 in range(0, 100):
    for b1, b2, b3 in bs:
        if a2 + b1 == c21 and a2 + b2 == c22 and a2 + b3 == c23:
            bss.append((b1, b2, b3))

for a3 in range(0, 100):
    for b1, b2, b3 in bss:
        if a3 + b1 == c31 and a3 + b2 == c32 and a3 + b3 == c33:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")

Submission status: Runtime Error

Solution code:
def solve(string):
    c11, c12, c13, c21, c22, c23, c31, c32, c33 = map(int, string.split())
    check = c11 - c12 == c21 - c22 == c31 - c32 and c12 - c13 == c22 - c23 == c32 - c33 and c13 - c11 == c23 - c21 == c33 - c31 and c11 - c21 == c12 - c22 == c13 - c23 and c21 - c31 == c22 - c32 == c23 - c33 and c31 - c11 == c32 - c12 == c33 - c13
    return "Yes" if check else "No"


if __name__ == '__main__':
    n = 3
    print(solve('\n'.join([input() for _ in range(n)])))
    print(solve(input()))

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for i in range(3) ]

ans = False

for i in range(max(101)) :
    a1 = 0
    b1 = c[0][0]
    b2 = c[0][1]
    b3 = c[0][2]
    a2 = c[1][0] - b1
    a3 = c[2][0] - b1
    a = []
    a.append(a1)
    a.append(a2)
    a.append(a3)
    if a2 + b2 != c[1][1] :
        continue
    elif a3 + b2 != c[2][1] :
        continue
    elif a2 + b3 != c[1][2] :
        continue
    elif a3 + b3 != c[2][2] :
        continue
    ans = True
    break

if ans :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for i in range(3) ]

ans = False

for i in range(max(c)) :
    a1 = 0
    b1 = c[0][0]
    b2 = c[0][1]
    b3 = c[0][2]
    a2 = c[1][0] - b1
    a3 = c[2][0] - b1
    a = []
    a.append(a1)
    a.append(a2)
    a.append(a3)
    if a2 + b2 != c[1][1] :
        continue
    elif a3 + b2 != c[2][1] :
        continue
    elif a2 + b3 != c[1][2] :
        continue
    elif a3 + b3 != c[2][2] :
        continue
    ans = True
    break

if ans :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
red = [list(map(int, input().split())) for i in range (N)]
blue = [list(map(int, input().split())) for i in range (N)]
blue.sort(key=lambda x:x[0])
red.sort(key=lambda x:x[1], reverse=True)
pairs = 0
flag = [True for i in range(N)]
for i in range(N):
    for j in range(N):
        if blue[i][0] > red[j][0] and blue[i][1] > red[j][1] and flag[j]:
            pairs += 1
            flag[j] = False
            break
print(pairs)

Submission status: Runtime Error

Solution code:
n, y = map(int, input().split())
flag = 0
for i in range(n + 1):
   for j in range(n + 1 - i):
      k = n - i - j
      if (i * 10000 + j * 5000 + k * 1000) == y:
         flag = 1
         print('{} {} {}'.format(i, j, k))
         break
   else:
      continue
   break
if flag == 0:
   print('-1 -1 -1')

Submission status: Runtime Error

Solution code:
C = [[int(c) for c in input.split()] for _ in range(3)]

if((C[0][0]-C[1][0]==C[0][1]-C[1][1]==C[0][2]-C[1][2])                    
        and(C[0][0]-C[2][0]==C[0][1]-C[2][1]==C[0][2]-C[2][2])):                  
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
C = []
for _ in range(3):
    c = list(map(int,input().split()))
    C.append(c)

if((C[0][0]-C[1][0]==C[0][1]-C[1][1]==C[0][2]-C[1][2])                    
        and(C[0][0]-C[2][0]==C[0][1]-C[2][1]==C[0][2]-C[2][2]):                   
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
C = []
for _ in range(3):
    c = list(map(int,input().split()))
    C.append(c)

if((C[1][1]-C[2][1]==C[1][2]-C[2][2])and(C[1][1]-C[2][1]==C[1][3]-C[2][3])
        and(C[1][1]-C[3][1]==C[1][2]-C[3][2])and(C[1][1]-C[3][1]==C[1][3]-C[3][3])
        and(C[1][1]-C[1][2]==C[2][1]-C[2][2])and(C[1][1]-C[1][2]==C[3][1]-C[3][2])
        and(C[1][1]-C[1][3]==C[2][1]-C[2][3])and(C[1][1]-C[1][3]==C[3][1]-C[3][3])):
    print("Yes")
else:  
    print("No")

Submission status: Runtime Error

Solution code:
a, b, c, d, e, f, g, h, i = 3.times.flat_map{ gets.split.map(&:to_i) }
puts a - b == d - e && d - e == g - h && b - c == e - f && e - f == h - i ? 'Yes' : 'No'

Submission status: Runtime Error

Solution code:
grid = []
for _ in range(3):
    grid.append((list)(map(int, input().split())))

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[i][0] - grid[j][0]
    diff2 = grid[i][1] - grid[j][1]

    if diff1 != diff2 or diff2 != diff3:
        print("No")
        exit()

print("Yes")

Submission status: Runtime Error

Solution code:
c = [[map(int,input().split())] for i in range(3)]
a1,a2,a3,b1,b2,b3 = 0,c[1][0]-c[0][1],\
c[2][0]-c[0][2],c[0][0],c[0][1],c[0][2]

if c[1][1]==a2+b2 and c[1][2]==a2+b3 and\
c[2][1]==a3+b2 and c[2][2]==a3+b3:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
c = [map(int,input().split()) for i in range(3)]
a1,a2,a3,b1,b2,b3 = 0,c[1][0]-c[0][1],\
c[2][0]-c[0][2],c[0][0],c[0][1],c[0][2]

if c[1][1]==a2+b2 and c[1][2]==a2+b3 and\
c[2][1]==a3+b2 and c[2][2]==a3+b3:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
    c.append(list(int(x) for x in input().split()))
c[1][0] -= c[0][0]
c[2][0] -= c[0][0]
if c[1][1] == c[0][1] + c[1][0] and c[1][2] == c[0][2] + c[1][0] and c[2][1] == c[0][1] + c[2][0] and c[2][2] == c[0][2] + c[2][0]:
    print(‘Yes’)
else:
    print(‘No’)

Submission status: Runtime Error

Solution code:
s1,s2,s3 = map(int, input().split())
s4,s5,s6 = map(int, input().split())
s7,s8,s9 = map(int, input().split())

if s1-s4=s2-s5=s3-s6 and s4-s7=s5-s8=s6-s9:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
c = []
for _ in [0]*3:
  c += [list(map(int, input().split()))]

flag = True
for i in [0,1]:
  for j in [0,1]:
    if c[i][j] + c[i+1][j+1] != c[i+1][j] + c[i][j+1]:
      flag = False
print("Yes" if Flag else "No")

Submission status: Runtime Error

Solution 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()]
print("Yes" if a[0]-b[0]==a[1]-b[1]==a[2]-b[2] and a[0]-c[0]==a[1]-c[1]==a[2]-c[2] else "No")

Submission status: Runtime Error

Solution code:
cij =[]
for i in range(3):
    cij.append(list(map(int, input().split(" "))))

bi_list = []
for b1 in range(-500000, 500000):
    b2 = b1 - (cij[0][0] - cij[0][1])
    b3 = b1 - (cij[0][0] - cij[0][2])

    a1 = cij[0][0]+cij[0][1]+cij[0][2] -b1-bi2-b3
    a2 = cij[1][0]+cij[1][1]+cij[1][2] -b1-b2-b3
    a3 = cij[2][0]+cij[2][1]+cij[2][2] -b1-b2-b3
    if (a1) % 3 == 0 and (a2) % 3 == 0 and (a3) % 3 == 0:
        print("Yes")
        exit()

print("No")