Problem:


Score : 100 points

Problem Statement

You are given integers A and B, each between 1 and 3 (inclusive).

Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.

Constraints

All values in input are integers.

1 \leq A, B \leq 3

Input

Input is given from Standard Input in the following format:

A B

Output

If there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.

Sample Input 1

3 1

Sample Output 1

Yes

Let C = 3. Then, A \times B \times C = 3 \times 1 \times 3 = 9, which is an odd number.

Sample Input 2

1 2

Sample Output 2

No

Sample Input 3

2 2

Sample Output 3

No



Sample input:
3 1


Sample output:
Yes

Submission status: Runtime Error

Solution code:
n=int(input())
a=[]
for i in range(n):
    a.append(input())
flag=0
for i in range(n):
    s=a[i]
    
   if i==0:
       continue
   else:
       if last!=a[i][len(a[i])-1]:
           flag=1
           
   last=a[i][len(a[i])-1]
if flag==1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
from itertools import product
 
H, W = map(int, input().split())
 
a = [ list(map(int, input().split())) for _ in range(H) ]
 
output = ''
direction = -1
idou = 0
last_i = 0
last_j = 0
count = 0
j = -1
for i in range(H):
    direction *= -1
    j += direction
    for _ in range(W):
        if idou == 1:
            count += 1
            output += '{} {} {} {}\n'.format(last_i+1, last_j+1, i+1, j+1)
        if (a[i][j] + idou) % 2 == 1:
            idou = 1
        else:
            idou = 0
        last_i = i
        last_j = j
        j += direction
 
output = str(count) + '\n' + output.strip()
print(output)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
flag=0
for i in range(1,4):
    if a*b*c%2==1:
        flag=1
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a=input()
a=a.split(" ")
 
a=[int(i) for i in a]
 
b=a[0]*a[1]
 
for i in range(1,4): 
    if (b*i)%2 != 0:
        print("Yes")
        break
else:
    print("No")

Submission status: Runtime Error

Solution code:
arg = raw_input().split()

num = int(arg[0]) * int(arg[1])

if (num % 2) == 0:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
arg = raw_input().split()

num = int(arg[0]) * int(arg[1])

if num % 2 == 0:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
N = raw_input().split()
print(N)

Submission status: Runtime Error

Solution code:
#!/bin/evn python
# -*- coding: utf-8 -*-

n = int(input())
words = [input() for _ in range(n)]

last = ''
success = True

if len(set(words)) != len(words):
    success = False

if success:
    for word in words:
        if last[-1] != word[0]:
            success = False 
            break

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

Submission status: Runtime Error

Solution code:
N = int(input())
w =  [input() for i in range(N)]

valid = False

for i in range(1, N-1):
    if w[i-1][-1] == w[i][0] and len(set(w)) == len(w):
        valid = True
    else:
        valid = False

    print("Yes" if valid else "No")

Submission status: Runtime Error

Solution code:
from functools import reduce

def gcd(a, b):

    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def gcd_list(numbers):
    return reduce(gcd, numbers)

N, X = map(int, input().split(" "))
Xi = [int(a) for a in input().split()]

def minusX(a):
    return abs(a-X)

Xi = map(minusX, Xi)

d = gcd_list(Xi)
print (d)

Submission status: Runtime Error

Solution code:
Print("Yes")

Submission status: Runtime Error

Solution code:
count, init = tuple(map(int, input().split(" ")))
Xs = [init] + list(map(int, input().split(" ")))
l = [abs(Xs[i]-Xs[i+1]) for i in range(count)]
for i in range(2, min(l)+1)[::-1]:
    if max(map(lambda x: x%i, l)) == 0:
        print(i)
        exit(0)
print(1)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())

if (a*b)%2 == 0:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())

if (a*b)%2 ==0:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
/* converted by scratch2cpp (https://github.com/yos1up/scratch2cpp)
   This script is compatible with the following compilers:
   - GCC (unless every name of variables contains non-ascii characters)
   - Clang 
*/
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#define debug cerr << "--" << __LINE__ << "--" << "\n"
using namespace std;

const double EPS = 1e-8;

static int roundToInt(double x){
    return (x < 0) ? -(int)(-x + 0.5) : (int)(x + 0.5);
}


class Var{
public:
    string sval;
    double dval;
    enum VarType {STRING = 0, NUMBER = 1};
    VarType type;
    enum NumericState {UNKNOWN = -1, STRINGY = 0, NUMERIC = 1};
    mutable NumericState numericState;

    Var(){sval = ""; type = STRING; numericState = STRINGY;} // represent null?
    Var(string s){
        sval = s; type = STRING; numericState = UNKNOWN;
    }
    Var(double d){dval = d; type = NUMBER; numericState = NUMERIC;}
    Var(const Var &v){
        sval = string(v.sval); dval = v.dval;
        type = v.type; numericState = v.numericState;
    }
    static bool isNumericString(const string &s) {
        char* ep;
        strtod(s.c_str(), &ep);
        return !ep || !*ep;
        // TODO: In Scratch '000' is regarded as non-numeric (but here regarded as numeric)
    }
    bool isNumeric() const{
        if (type == NUMBER) return true;
        if (numericState != UNKNOWN) return numericState == NUMERIC;
        bool numeric = isNumericString(sval);
        numericState = (numeric) ? NUMERIC : STRINGY;
        return numeric;
    }
    double asNumber() const{
        if (type == NUMBER) return dval;
        return (isNumeric()) ? atof(sval.c_str()) : 0.0;
    }
    static bool isNearInteger(const double &x){
        return fabs(round(x) - x) < EPS;
        // TODO: allow integer type in Var class
    }
    static bool isNearNumber(const double &x, const double &y){
        return fabs(x - y) < EPS;
    }
    string asString() const{
        if (type == STRING) return sval;
        if (isNearInteger(dval)) return to_string(roundToInt(dval));
        return to_string(dval);
    }
    Var operator+(const Var &y) const{
        return Var(this->asNumber() + y.asNumber());
    }
    Var operator+=(const Var &y){
        *this = *this + y;
        return *this;
    }
    Var operator-(const Var &y) const{
        return Var(this->asNumber() - y.asNumber());
    }
    Var operator*(const Var &y) const{
        return Var(this->asNumber() * y.asNumber());
    }
    Var operator/(const Var &y) const{
        return Var(this->asNumber() / y.asNumber());
    }
    Var operator%(const Var &y) const{
        return Var(fmod(this->asNumber(), y.asNumber()));
    }
    bool operator<(const Var &y) const{
        if (this->isNumeric() && y.isNumeric()){
            return this->asNumber() < y.asNumber();
        }// compare as number if both can be interpreted as numeric
        return this->asString() < y.asString();
    }
    bool operator>(const Var &y) const{
        return y < *this;
    }
    bool operator==(const Var &y) const{
        if (this->isNumeric() && y.isNumeric()){
            return this->asNumber() == y.asNumber();
        }// compare as numeric if both are numeric
        return this->asString() == y.asString();
    }
    friend ostream& operator << (ostream& os, const Var& p);
    friend istream& operator >> (istream& is, const Var& p);
};
ostream& operator << (ostream& os, const Var& p){
    os << p.asString();
    return os;
}
istream& operator >> (istream& is, Var& p){
    string s; is >> s; p = Var(s);
    return is;
}

Var letterOf(Var index, Var sourceString){
    /* index: 1-origined */
    string str = sourceString.asString();
    int idx = (int)(index.asNumber() - 1);
    // seem to be dirty but Scratch seems to do like this.
    // ex. letterOf(0.01, "world") == "w", letterOf(1.99, "world") == "w", letterOf(5.99, "world") == "d"
    if (0 <= idx && idx < str.size()) return Var(str.substr(idx, 1));
    return Var();
}

// TODO: should we make a new class for vector<Var>?
Var getLineOfList(const Var &index, const vector<Var> &list){
    /* index: 1-origined */
    int idx = (int)index.asNumber() - 1;
    // (unlike 'letterOf', index==0.9 does not work.)
    if (0 <= idx && idx < list.size()) return list[idx];
    return Var();
}
void setLineOfListTo(const Var &index, vector<Var> &list, const Var &v){
    /* index: 1-origined */
    int idx = (int)index.asNumber() - 1;
    if (0 <= idx && idx < list.size()) list[idx] = v;
}
void deleteLineOfList(const Var &index, vector<Var> &list){
    /* index: 1-origined */
    int idx = (int)index.asNumber() - 1;
    if (0 <= idx && idx < list.size()) list.erase(list.begin() + idx);
}
void insertAtIndexOfList(const Var &item, const Var &index, vector<Var> &list){
    /* index: 1-origined */
    int idx = (int)index.asNumber() - 1;
    if (0 <= idx && idx <= list.size()) list.insert(list.begin() + idx, item);   
}
void insertAtRandomOfList(const Var &item, vector<Var> &list){
    int idx = rand() % (list.size() + 1);
    list.insert(list.begin() + idx, item);
}
Var contentsOfList(const vector<Var> &list){
    /* concatenate elements of list with space */
    string ret;
    for(int i=0;i<list.size();i++){
        if (i > 0) ret += ' ';
        ret += list[i].asString();
    }
    return Var(ret);
}

double randUniform(double x, double y){
    if (x > y) return randUniform(y, x);
    if (Var::isNearInteger(x) && Var::isNearInteger(y)){
        int xi = roundToInt(x), yi = roundToInt(y);
        return xi + rand() % (yi - xi + 1);
    }else{
        return x + (y - x) * (0.0 + rand()) / RAND_MAX;
    }
}

Var buf_answer; // for "answer"

// ============================= Scripts =============================
Var var_a(0);
Var var_b(0);
Var var_c(0);
Var var_ans(0);

// prototype declaration

Submission status: Runtime Error

Solution code:
# math.gcd()を使う
import math
N, X = map(int, input().split())
# 一行の入力をリストxに入れる
x = list(map(int, input().split()))
# すべての(x[i]-X)の最大公約数が答え
# 最初の最大公約数
t = x[0] - X
for a in x:
    # 最大公約数を更新
    t = math.gcd(t, a - X)
print(t)

Submission status: Runtime Error

Solution code:
# math.gcd()を使う
import math
N, X = map(int, input().split())
# 一行の入力をリストxに入れる
x = list(map(int, input().split()))
# すべての(x[i]-X)の最大公約数が答え
# 最初の最大公約数
t = x[0] - X
for a in x:
    # 最大公約数を更新
    t = math.gcd(t, abs(a - X))
print(t)

Submission status: Runtime Error

Solution code:
# math.gcd()を使う
import math
N, X = map(int, input().split())
# 一行の入力をリストxに入れる
x = list(map(int, input().split()))
# すべての(x[i]-X)の最大公約数が答え
# 最初の最大公約数
t = abs(x[0] - X)
for a in x:
    # 最大公約数を更新
    t = math.gcd(t, a - X)
print(t)

Submission status: Runtime Error

Solution code:
input = input().split()

cntYes = 0
for C in range(1,4):
    ans = int(input[0])*int(input[1])*C
    if ans%2!=0:
       cntYes += 1
if cnt>0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
 
judge = False
for c in range(1,4):
  if (A*B*C) %2 == 1:
    judge = True
   
 
  
if judge == True:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys

# 引数の取得
argv = sys.argv
argc = len(argv)

A = int(argv[1])
B = int(argv[2])

AB = A * B
exists = False

# 1から３までループ
for C in range(1, 4):
    if (AB * C % 2 == 1):
        exists = True
        break


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

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

judge = False
for c in range(1,4):
  if A*B*C %2 == 1:
    judge = True
   

  
if judge == True:
  print("Yes")
else:
  print("False")

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

judge=0
for i in range(1,4):
	if (j+k+i)*2==1:
      judge=1
if judge==1:
  print ("Yes")
else:
  print ("No")

Submission status: Runtime Error

Solution code:
judge=0
j,k=A,B
for i in range(1,4):
	if (j+k+i)*2==1:
      judge=1
if judge==1:
  print ("Yes")
else:
  print ("No")

Submission status: Runtime Error

Solution code:
judge=0
for i in range(1,4):
	if (A+B+i)*2==1:
      judge=1
if judge==1:
  print ("Yes")
else:
  print ("No")

Submission status: Runtime Error

Solution code:
#include<iostream>
using namespace std;
int main(void){
  int a,b;
  cin>>a>>b;
  if(a*b%2==0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-

s = input().split()

if s[0] % 2 == 0 or s[1]%2 == 0:
  print("No")

else:
  print("Yes")

Submission status: Runtime Error

Solution code:
A,B = input(),input()
if A==2 or B==2: print("Yes")
else: print("No")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if (a * b) % == 1:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
d = a*c
if d%2 == 0:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
count = input()
inputed = []
last = ""
judge = "Yes"
for i in range(int(count)):
    new_inputed = input()
    if i != 0 && new_inputed[-1] != last:
        judge = "No"
    last = new_inputed[-1]
print(judge)

Submission status: Runtime Error

Solution code:
N=int(input())
a=[input() for i in range(N)]
if len(set(a))!=N:
	print("No")
else:
	for i in range(1,N):
		if a[i-1][-1]!=a[i][0]:
			print("No")
			break
		print("yes")

Submission status: Runtime Error

Solution code:
A,B = map(int,input())
print("Yes" if (A*B) % 2 == 1 else "No")

Submission status: Runtime Error

Solution code:
A,B = map(int,input())
print("Yes" if A*B % 2 == 1 else "No")

Submission status: Runtime Error

Solution code:
# Read the values of A and B from the screen, save them as integers
a = int(input())
b = int(input())

# Use a for-loop to check if there is integer C, A <= C <= B
# such that A*B*C is odd
got_an_odd = False
for c in range(a, b+1):
    if a*b*c % 2 == 1:
        got_an_odd = True

# Print the answer on the screen
if got_an_odd:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
from functools import reduce
import math
n,x=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(lambda c:abs(c-x),a))
print(reduce(math.gcd,b))

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())

for i in range(1,4):
    if A * B * i % 2 == 1:
        print('Yes')
        break

print('No')

Submission status: Runtime Error

Solution code:

input(x);
a, b = map(int, split(x));


if (a%2 == 1) && (b%2 == 1):
    print("Yes");
else:
    print("No");

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = [l]
if l < 999999999:
    for i in range(1, l):
        if l % i == 0:
            f.append(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % f[i-1] != 0:
            d = False
    if d:
        print(f[i-1])
        break

Submission status: Runtime Error

Solution code:
a,s,c=int(input());print(["No","Yes"][a*c%2])

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = set()
for i in range(1, l+1):
    if l % i == 0:
        f.add(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l, 0, -1):
    d = True
    for item in c:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


N, X = (int(i) for i in input().split())
A = [int(i) for i in input().split()]


def aho(x):
  return x - X


B = list(map(aho, A))

C = gcd_list(B)

print(C)

Submission status: Runtime Error

Solution code:
h, w = (int(i) for i in input().split(' '))


a=[]
for i in range(h):
    a.append([int(j) for j in input().split(' ')])

j = 0
p = []
tr = []
picked = False

for i in range(h):
                
    step = -1 if i%2 else 1
    j = w-1 if i%2 else 0
    while j >=0 and j < w:
        if a[i][j] % 2:
            if picked == False:
                picked = True
            else:
                tr.append([i,j])
                picked = False
                for t_index in range(len(tr)-1):
                    p.append((tr[t_index], tr[t_index+1]))
                tr = []

        if picked:
            tr.append([i,j])
        j = j + step

print(len(p))
for ans in p:
    print(ans[0][0]+1,ans[0][1]+1,ans[1][0]+1, ans[1][1]+1)

Submission status: Runtime Error

Solution code:
print(" YNeos"eval(input()).replace(" ","*")%2::2))

Submission status: Runtime Error

Solution code:
import fractions

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

b=[]
for i in a:
    b.append(abs(x-i))

if n==1:
    print(abs(x-a[0]))

else:
    ans=fractions.gcd(b[0],b[1])

    for i in range(2,n):
        ans = fractions.gcd(ans ,b[i])

    print(ans)

Submission status: Runtime Error

Solution code:
args = input().split(" ")
if args[0]*args[1]%2 == 0:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())

if a * b % 2 == 0:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
import sys
if __name__ == '__main__':
    N = int(input())
    W = [str(input()) for _ in range(N)]
    for i in range(1,N):
        if W[i-1][-1] != W[i][0]:
            print('No')
            sys.exit(0)
    print('Yes')

Submission status: Runtime Error

Solution code:
import sys
if __name__ == '__main__':
    N = int(input())
    W = [int(input()) for _ in range(N)]
    for i in range(1,N):
        if W[i-1][-1] != W[i][0]:
            print('No')
            sys.exit(0)
    print('Yes')

Submission status: Runtime Error

Solution code:
a, b = int(input().split())
if a*b%2 == 0:
   print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
a, b = int(input())
if a*b % 2 == 0
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
W = []
flag = "Yes"
last_chara = ''
for i in range(N):
  now_W = input()
  www = list(now_W)
  if i != 0:
    if www[0] != last_chara:
      flag = "No"
      break
  if now_W in W:
    flag = "No"
    break
  W.append(now_W)
  last_chara = www[-1]
print(flag)

Submission status: Runtime Error

Solution code:
print('No'*'2'in input()or'Yes')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from fractions import gcd

# スペース区切りの整数の入力
N, X = map(int, input().split())
pos = [int(x.strip()) for x in input().split()]

# 一番近い場所を検索
tikai = [i - X for i in pos]
kyori = list(map(abs,tikai))

a = kyori[0]
for xi in kyori[1:]:
    a = gcd(a, xi)
print(a)

Submission status: Runtime Error

Solution code:
a,b=raw_input().spilt()
a=int(a)
b=int(b)
if b-a==1:
  print "No"
else:
  print "Yes"

Submission status: Runtime Error

Solution code:
nums = map(int, input().split())
if nums[0] * nums[1] % 2:
  return "Yes"
return "No"

Submission status: Runtime Error

Solution code:
a = input()
b = input()
if a * b % 2:
  return "Yes"
return "No"

Submission status: Runtime Error

Solution code:
return input() * input() % 2

Submission status: Runtime Error

Solution code:
a,b = int(input().split())

if a*b%2 == 0:
	print("No")
  
else:
	print("Yes")

Submission status: Runtime Error

Solution code:
a,b = int(input().split())


if a*b%2 == 0:
  print("No")
  
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
if a % 2 == 0 or b % 2 == 0:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
if a%2 == 0 or b%2 == 0:
    print('no')
else:
    print('yes')

Submission status: Runtime Error

Solution code:
from fractions import gcd
def fun():
    nx = input()
    N, X = nx.split(' ')
    N = int(N)
    X = int(X)
    cities = [int(c) for c in input().split(' ')]
    cities.append(X)
    x = sorted(cities)
    nx = x[1:]
    dist = [nn - x[i] for i, nn in enumerate(nx)]
    if N==1:
        print(dist[0])
        return
    min_gcd = 10000000000
    for i, d in enumerate(dist[:-1]):
        dp = dist[i+1]
        gc = gcd(d, dp)
        if gc < min_gcd:
            min_gcd = gc
    print(min_gcd)

fun()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import fractions
 
N,X = map(int, input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
y=[]
 
i=0
while i < n:
    y.append(x[i+1]-x[i])
    i +=1
y.sort()
 
y=list(set(y))
m=len(y)
z=y[0]
i=0
while i < m:
    z=fractions.gcd(z,y[i])
    i+=1
 
print(z)

Submission status: Runtime Error

Solution code:
a, b = map(int, input())

if a * b % 2 == 0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
(H, W) = map(int, input().split())
a = []
for i in range(H):
    a.append(list(map(int, input().split())))
#print("a: ")
#print(a)

odd_flag = []
for i in range(len(a)):
    odd_flag.append(list())
    for j in range(len(a[i])):
        if a[i][j]%2 != 0:
            odd_flag[i].append(True)
        else:
            odd_flag[i].append(False)
#print("odd_flag: ")
#print(odd_flag)

odd_sum = 0
for i in range(len(odd_flag)):
    odd_sum += odd_flag[i].count(True)
#print(odd_sum)

s_h = 0
s_w = 0
move_flag = False

def move(h, w):
    if h%2 == 0:
        if w == W-1:
            return (h+1, w)
        else:
            return (h, w+1)
    else:
        if w == 0:
            return (h+1, w)
        else:
            return (h, w-1)

N = 0
ans = ""
while odd_sum >= 2:
    # 移動先到着
    if move_flag is True and odd_flag[s_h][s_w] is True:
        move_flag = False
        (s_h, s_w) = move(s_h, s_w)
        odd_sum -= 2
        N += 1
    # 移動中
    elif move_flag is True and odd_flag[s_h][s_w] is False:
        ans += str(s_h+1) + " " + str(s_w+1) + " "
        (s_h, s_w) = move(s_h, s_w)
        ans += str(s_h+1) + " " + str(s_w+1) + "\n"
    # 移動すべきものなし
    elif move_flag is False and odd_flag[s_h][s_w] is False:
        (s_h, s_w) = move(s_h, s_w)
    # 移動元到着
    elif move_flag is False and odd_flag[s_h][s_w] is True:
        move_flag = True
        ans += str(s_h+1) + " " + str(s_w+1) + " "
        (s_h, s_w) = move(s_h, s_w)
        ans += str(s_h+1) + " " + str(s_w+1) + "\n"

print(N)
#print(ans[0:-1])

Submission status: Runtime Error

Solution code:
print('YNeos'[1-'2'in input()::2])

Submission status: Runtime Error

Solution code:
list1 = list(map(int,input().split()))
h = list1[0]
w = list1[1]
a = list()
i = 0
n = 0
ans = list()
while i <= h-1:
    a.append(list(map(int,input().split())))
    i += 1
for i in range(h):
    for j in range(w-1):
        if a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i][j+1] += 1
            n+=1
            ans.append([i+1,j+1,i+1,j+2])
for i in range(h-1):
    if a[i][w-1] % 2 != 0:
        a[i][w-1] -= 1
        a[i+1][w-1] += 1
        ans.append([i+1, w, i+2, w])
        n+=1
print(n)
for i in range(n):
    print(ans[i][0],ans[i][1],ans[i][2],ans[i][3])

Submission status: Runtime Error

Solution code:
import fractions
l = map(int, raw_input().split())
toshisuu= l[0]
starttoshi= l[1]
mathlist=[0]
toshilist = map(int, raw_input().split())
ans=100000000000000000000
das=0
for i in toshilist:
    counts=abs(i-starttoshi)
    if das==0:
        mathlist[0]=counts
        das=1
    else:
        mathlist.append(counts)
mathlist.sort(reverse = True)
# print mathlist
print fractions.gcd(mathlist[0], mathlist[1])

Submission status: Runtime Error

Solution code:
from fractions import Fraction
l = map(int, raw_input().split())
toshisuu= l[0]
starttoshi= l[1]
mathlist=[0]
toshilist = map(int, raw_input().split())
ans=100000000000000000000
das=0
for i in toshilist:
    counts=abs(i-starttoshi)
    if das==0:
        mathlist[0]=counts
        das=1
    else:
        mathlist.append(counts)
mathlist.sort(reverse = True)
# print mathlist
print gcd(mathlist[0], mathlist[1])

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())
 
arr = [int(_) for _ in input().split(' ')]
arr.sort()
 
a = arr[-1]**5
 
 
for i in range(N-1):
    if abs(arr[i+1]-arr[i]) < a:
        a = abs(arr[i+1]-arr[i])
 
for j in range(N):
    if abs(arr[j] - X) < a:
        a = abs(arr[j] - X)
 
print(a)

Submission status: Runtime Error

Solution code:
a,b=input(int,input().split())
if(a*b%2==0):
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

c.append(X)
c.sort()

D = float('inf')

for i in range(1,N+1):
    if c[i] - c[i-1] < D:
        D = abs(c[i] - c[i-1])

print(int(D))

Submission status: Runtime Error

Solution code:
A=input("num1")
B=input("num2")
C=input("num3")

num1=1
num2=1
num3=1


total=int(A)*int(B)*int(C)

if total%2==1:
  print("Yes")
  
else:
  print("No")

Submission status: Runtime Error

Solution code:
N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

c.append(X)
c.sort()

D = float('inf')

for i in range(1,N+1):
    if c[i] - c[i-1] < D:
        D = abs(c[i] - c[i-1])

print(int(D))

Submission status: Runtime Error

Solution code:
(n, x) = list(map(int, input().split()))
x_list = list(map(int, input().split()))

x_list.append(x)
x_list.sort()

min_diff = 99999999999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()

Submission status: Runtime Error

Solution code:
N=int(input())
r=0
W=[]
for i in range(N):
    W.append(input())

for i in range(N-1):
    if W[i+1][0]!=W[i][-1]:
        r = r+1
for i in range(N):
    for p in range(N):
        if W[i]==W[p]:
            r = r+1
if r == N:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = [input() for i in range(N)]
 
for num in range(N):
  if a[num] in a[:num-1]:
    print('No')
    break
  if num < N-1:
    if a[num][-1] != a[num+1][0]:
    	print('No')
    	break
  if num == N-1:
    print('Yes')

Submission status: Runtime Error

Solution code:
N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=list(set([abs(inputcities[i]-X) for i in range(N)]))
N=len(cities)
count=0
flag=0
minimum=min(cities)
for j in range(minimum+1)[::-1]:
  for i in range(N):
    if cities[i]%j==0:
      count+=1
    else:
      count=0
      break
    if count==N:
      print(j)
      flag=1
      break
  if flag==1:
    break

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split())

if a % 2 == 0 && b % 2 == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
list1 = list(map(int, input().split()))
n = list1[0]
x = list1[1]
list2 = list(map(int, input().split()))
list2.append(x)
list2.sort()

list3 = []
length = len(list2)
index =1
while index < length:
    list3.append(list2[index]-list2[index-1])
    index+=1

list3.sort()
mimN = list3[0]
ans =0
index2 =mimN
if len(list3) ==1:
    print(mimN)
else:
    flag2 =0
    for number in list3:
       if number%mimN !=0:
           flag2 =1
    if flag2 ==0:
        print(mimN)
    else:
        while index2>=1:
            flag=1
            for number in list3:
                if number%index2 ==0:
                    flag =1
            if flag ==1:
                ans = index2
                break
            index2-=1
            
        print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
a = [input() for i in range(N)]
 
for num in range(N):
  if a[num] in a[:num-1]:
    print('No')
    break
  if num < N-1:
    if a[num][-1] != a[num+1][0]:
    	print('No')
    	break
  print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
a = [input() for i in range(N)]
 
for num in range(N):
  if a[num] in a[:num]:
    print('No')
    break
  if num < N-1:
    if a[num][-1] != a[num+1][0]:
    	print('No')
    	break
  print('Yes')

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split())  
if a%2 and b%2:
  	print("Yes")
  else:
    print("No")

Submission status: Runtime Error

Solution code:

def gcd(a, b):
    if a < 0:
        a = -a
    if b < 0:
        b = -b
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 

def reduce(function, iterable, initializer=None):
    it = iter(iterable)
    if initializer is None:
        value = next(it)
    else:
        value = initializer
    for element in it:
        value = function(value, element)
    return value

def gcd_list(ls):
    return reduce(gcd, ls)

N, X = list(map(int, input().split()))
xs = list(map(int, input().split()))
ys = [x - X for x in xs]

print(gcd_list(ys))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
if a%2==0 or b%2==0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
  
	num = input()

	if int(num[0]) * int(num[1]) % 2 ==0:
		print("No")
	else:
  		print("Yes")