Problem:


Score : 100 points

Problem Statement

Snuke is giving cookies to his three goats.

He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).

Your task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.

Constraints

1 \leq A,B \leq 100

Both A and B are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

If it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.

Sample Input 1

4 5

Sample Output 1

Possible

If Snuke gives nine cookies, each of the three goats can have three cookies.

Sample Input 2

1 1

Sample Output 2

Impossible

Since there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.



Sample input:
4 5


Sample output:
Possible

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if (a + b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
   print("Possible")
else:
   print("Impossible")

Submission status: Accepted

Solution code:
A,B = [int(i) for i in input().split(" ")]
if (A+B) % 3 == 0 or A % 3 == 0 or B % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        A, B = map(lambda x: int(x), line.split(" ", 2))
        if (A % 3) == 0 or (B % 3) == 0 or ((A+B) % 3) == 0:
            print("Possible")
        else:
            print("Impossible")

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
l=[int(i) for i in input().split()]
if (l[0]%3)==0 or (l[1]%3)==0 or (l[0]+l[1])%3==0:
  print ("Possible")
else:
  print ("Impossible")

Submission status: Accepted

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

def check(a, b):
    if a % 3 == 0:
        return 1
    elif b % 3 == 0:
        return 1
    elif (a + b) % 3 == 0:
        return 1
    else:
        return 0

def main():
    if check(a, b) == 1:
        print("Possible")
    else:
        print("Impossible")

main()

Submission status: Accepted

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

A, B = map(int, input().split())

C = A + B

if A%3 == 0:
    print('Possible')
elif B%3 == 0:
    print('Possible')
elif C%3 == 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
ab = input().split(' ')
#print(ab)
if int(ab[0])  % 3 == 0 or int(ab[1]) % 3 ==0   or (int(ab[1])+ int(ab[0])) % 3 == 0:
    ans  = 'Possible'

else:
    ans ='Impossible'
    
if (int(ab[0]) + int(ab[1])) <= 3:
    ans= 'Impossible'
print (ans)

Submission status: Accepted

Solution code:
# coding=utf-8
a,b = map(int, raw_input().split())

if (a + b) %3 == 0:
    print("Possible")
elif a % 3 == 0:
    print("Possible")
elif b % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
if __name__=='__main__':
    in_src = input()
    in_str = in_src.split(' ')
    in_num = []
    for i in in_str:
        in_num.append(int(i))
    if in_num[0]%3==0:
        print('Possible')
    elif in_num[1]%3==0:
        print('Possible')
    elif (in_num[0]+in_num[1])%3==0:
        print('Possible')
    else:
        print('Impossible')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if (a + b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
A,B = [int(i) for i in input().split()]
if (A+B)%3 == 0 or A%3 == 0 or B%3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
 
x=input()
a=int(x.split(" ")[0])
b=int(x.split(" ")[1])
if (a%3==0 or b%3==0 or (a+b)%3==0):
    print ("Possible")
else:
    print ("Impossible")

Submission status: Accepted

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

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
if(__name__ == "__main__"):
    a, b =[int(i) for i in input().split()]
    #print(a,b)
    if(a > 0 and b > 0):
        if((a+b) % 3 == 0 or a % 3 == 0 or b % 3 == 0):
            print("Possible")
        else:
            print("Impossible")
    else:
        print("Impossible")

Submission status: Accepted

Solution code:
c, d = map(int, input().split())
ans = 0

if(c % 3 == 0) :
    ans = 1
elif(d % 3 == 0) :
    ans = 1
elif((c + d) % 3 == 0) :
    ans = 1

if (ans == 1) :
    print ('Possible')
else :
    print ('Impossible')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())
if a % 3 == 0:
    print 'Possible'
elif b % 3 == 0:
    print 'Possible'
elif (a + b) % 3 == 0:
    print 'Possible'
else:
    print 'Impossible'

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if A % 3 == 0 or B % 3 == 0 or (A+B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

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

    if not A % 3 or not B % 3 or not (A + B) % 3:
        print('Possible')
    else:
        print('Impossible')

main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if (a + b) % 3 == 0:
    print("Possible")
    exit()
elif a % 3 == 0 or b % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
# coding: utf-8

A, B = tuple(map(int, input().split()))

print("Possible" if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0 else "Impossible")

Submission status: Accepted

Solution code:
#!/usr/bin/env python

A,B=map(int,raw_input().split())
ans='Impossible'
if A%3==0:
    ans='Possible'
if B%3==0:
    ans='Possible'
if (A+B)%3==0:
    ans='Possible'

print ans

Submission status: Accepted

Solution code:
A, B = (int(i) for i in input().split())  

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
	print('Possible')
else:
	print('Impossible')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
msg = ""
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
 msg = 'Possible'
else :
 msg  = 'Impossible'
print(msg)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if(A%3==0):
    print("Possible")
elif(B%3==0):
    print("Possible")
elif((A+B)%3==0):
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
#Python

l = map(int, raw_input().split())

A=l[0]
B=l[1]
#print A
#print B

if A%3==0 or B%3==0 or (A+B)%3==0:
	print 'Possible'
else:
	print 'Impossible'

Submission status: Accepted

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

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

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

if(A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0 ):
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

A, B = map(int, input().split())

if A%3 is 0 or B%3 is 0 or (A+B)%3 is 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
num = input().split()
A = int(num[0])
B = int(num[1])
if A % 3 == 0:
    print('Possible')
elif B % 3 == 0:
    print('Possible')
elif (A+B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
# coding: utf-8

a, b = map(int, raw_input().split())

if a % 3 == 0:
    print "Possible"
elif b % 3 == 0:
    print  "Possible"
elif (a + b) % 3 == 0:
    print "Possible"
else:
    print "Impossible"

Submission status: Accepted

Solution code:
cookie = [int(x) for x in input().split()]
if cookie[0] % 3 == 0 or cookie[1] % 3 == 0 or (cookie[0] + cookie[1]) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

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

A,B = map(int,input().split())

if (A+B)%3 == 0 or A%3==0 or B%3==0:
    print ("Possible")
else:
    print ("Impossible")

Submission status: Accepted

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

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

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

A, B = [int(x) for x in input().split()]

if A % 3 == 0:
    print ("Possible")
elif B % 3 == 0:
    print("Possible")
elif (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

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

if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
a, b = (int(i) for i in input().split())
if ((a+b) % 3 == 0 or a % 3 == 0 or b % 3 == 0):
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
# encoding:utf-8
def main():
	A, B = list(map(int, input().split()))
	ptrs = [A, B, A + B]
	res = [x % 3 for x in ptrs]
	if 0 in res:
		print("Possible")
	else:
		print("Impossible")

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:


a, b = map(int, input().split())
c = a + b

if c == 0:
    print('Impossible')
elif (c % 3 == 0 or a % 3 == 0 or b % 3 == 0):
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

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

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if(A%3==0):
    print("Possible")
elif(B%3==0):
    print("Possible")
elif((A+B)%3==0):
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
# Sharing Cokkies

A,B = list(map(int, input().split()))

if ( A%3==0 or B%3==0 or (A+B)%3==0 ):
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
b, c = map(int, raw_input().split())

if b%3==0 or c%3==0 or (b+c)%3==0:
  print 'Possible'
else:
  print 'Impossible'

Submission status: Accepted

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

    if (A%3 == 0) or (B%3 == 0) or ((A+B)%3 == 0):
        print("Possible")
    else:
        print("Impossible")

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()

Submission status: Accepted

Solution code:
import sys

def main():
    line = sys.stdin.readline()
    lst = line.split()
    a = int(lst[0])
    b = int(lst[1])

    if (a % 3 == 0) or (b % 3 == 0) or ((a+ b) % 3 == 0 ):
        print("Possible")
    else:
        print("Impossible")

    return 0

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

Solution code:
nums = [int(x) for x in input().split()]
A,B = nums[0],nums[1]

if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a + b )%3 == 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
a,b =(int (i) for i in input().split())
if a%3==0:
    print('Possible')
elif b%3==0:
    print('Possible')
elif (a+b)%3==0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if (a%3 == 0) or (b%3 == 0) or ((a+b)%3 == 0):
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
  print('Possible')
else:
  print('Impossible')

Submission status: Accepted

Solution code:
A, B = [int(x) for x in input().split()]

if A % 3 == 0:
	print("Possible")
elif B % 3 == 0:
	print("Possible")
elif (A + B) % 3 == 0:
	print("Possible")
else:
	print("Impossible")

Submission status: Accepted

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

if A % 3 == 0 or B % 3 == 0 or C % 3 == 0:
	print('Possible')
else:
	print('Impossible')

Submission status: Accepted

Solution code:
s = input().split()
s = [int(i) for i in s]
a = s[0]
b = s[1]

if a % 3 == 0 : print("Possible")
elif b % 3 == 0 : print("Possible")
elif (a + b) % 3 == 0 : print("Possible")
else : print("Impossible")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if A % 3 ==0 or B %3 == 0 or(A + B)%3 ==0:
    print('Possible')
else:
    print('Impossible')

Submission status: Accepted

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


if (A+B)%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Submission status: Accepted

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

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print "Possible"
else:
    print "Impossible"

Submission status: Accepted

Solution code:
import sys
a, b = map(int, sys.stdin.readline().split())
print ["Impossible", "Possible"][a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0]

Submission status: Accepted

Solution code:
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def main():
    A, B = get_ln_int_inputs()
    C = A + B
    if A % 3 == 0 or B % 3 == 0 or C % 3 == 0:
        print("Possible")
    else:
        print("Impossible")


main()

Submission status: Runtime Error

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

if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  print('Possible')
else:
  pritn('Impossible')

Submission status: Runtime Error

Solution code:
A,B=map(int.input().split())
if A%3==0 or B%3==0 or (A+B)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

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

if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
x = a + b
if x % 3 == 0:
  print('Possible')
else('Impossidle')

Submission status: Runtime Error

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

if (b%3 or a[0]%3 or a[1]) !=0 :
  print('Impossible')
elif :
  print('Possible')

Submission status: Runtime Error

Solution code:
print("YNeos"[notA%3==0orB%3==0or(A+B)%3==0::2])

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if a%3==0 \or b%==0 \or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if a%3==0 or\ b%==0 or\ (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if a%3==0 or b%==0 or(a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
if ((a+b)%3)==0:
  print("Possible")
else:
  if (a%3)==0:
    print("Possible")
  else:
    if (b%3)==0:
      print("Possible")
      else:
        print("Impossible")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
# intは入力に対しての関数、出力ではない

if (a+b)%3 => 0:
    print("Possible")
elif a%3 => 0:
    print("Possible")
elif b%3 => 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Runtime Error

Solution code:

# 出力
# a, b = map(int, input().split())
a = int(input())
b = int(input())

# 処理&出力
if a / 3 >= 1 :
    print('Possible')
elif b / 3 >= 1:
    print('Possible')
elif (a + b) /3 >= 1:
    print('Possible')
else:
    print('Impossible')

Submission status: Runtime Error

Solution code:

# 出力
# a, b = map(int, input().split())
a = int(input())
b = int(input())

# 処理&出力
if (a + b) / 3 >= 1 :
    print('Possible')
else:
    print('Impossible')

Submission status: Runtime Error

Solution code:
a,b=(int(x) for x in input().split())
c = ( a + b ) % 3
if (str(a) % '3' == '0' or str(b) % '3' == '0' or (c) == '0'):
    print ( 'Possible' )
else:
    print ( 'Impossible' )

Submission status: Runtime Error

Solution code:
a,b=(int(x) for x in input().split())
c = ( a + b ) % 3
if (a % '3' == '0' or str(b) % '3' == '0' or (c) == '0'):
    print ( 'Possible' )
else:
    print ( 'Impossible' )

Submission status: Runtime Error

Solution code:
a,b=(int(x) for x in input().split())
c = ( a + b ) % 3
if (c == '0'):
    print (Possible)
else:
    print(Impossible)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a + b) % == 0 else "Impossible")

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
if 1<=A<=100 and 1<=B<=100:
    if (A+B)%3==0:
        print("Possible")
    else:
        print("Impossible")

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
if 1<=A<=100 and 1<=B<=100:
    C = (A+B)%3
    if C==0:
        print("Possible")
    else:
        print("Impossible")

Submission status: Runtime Error

Solution code:
a,b=map(int(input()).split())
print(["Possible","Impossible"][a%3==b%3 and (a%3==1 or a%3==2)]

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print(["Possible","Impossible"][a%3==b%3 and (a%3==1 or a%3==2)]

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print(["Possible","Impossible"][a%3==b%3 and a%3==1 or a%3==2]

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a%3==0 or b%3==0: or (a+b)%3==0:
    print ('Possible')
else:
    print('Impossible')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
for i in (a,b,a+b):
  i%3==0:
    print("Possible")
    exit()
    
print("Impossible")

Submission status: Runtime Error

Solution code:
a,b=map(int,input(),split())
for i in (a,b,a+b):
  i%3==0:
    print("Possible")
    exit()
    
print("Impossible")

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
l = [0]*n
l[0] = a[0]

for i in range(1,n):
    l[i] = l[i-1] + a[i]
sum = sum(a)
ans = 10**10+1
for i in range(len(l)-1):
    x = l[i]
    y = sum - l[i]
    tmp = abs(x-y)
    ans = min(ans,tmp)

print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[6]:


N = int(input())
a = list(map(int, input().split()))


# In[7]:


ans = (10**9)*N
for i in range(1,N):
    x = sum(a[:i])
    y = sum(a[i:])
    ans = min(ans,abs(x-y))
    if ans < 2:
        break
print(ans)


# In[ ]:

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if (a%3==0) || (b%3==0) || ((a+b)%3==0):
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=10**100
x=sum(a)
b=0
for i in a[:-1]:
   b+=i
   x-=i
   ans=min(ans,abs(x-b))
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if A%3 == 0:
  print("Possible")
elif B%3 == 0:
  print("Possible")
elif (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, c = rm()
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
  print('Possible')
else:
  print('Impossible')

Submission status: Runtime Error

Solution code:
A = list(map(int, input().split()))
A.append(sum(A))

ans = False
for i in A:
  if A%3 == 0:
    ans = True
if ans:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

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

if (a + b) % 3 == 0:
  print(Possible)
else:
  print(Impossible)

Submission status: Runtime Error

Solution code:
A,B=int(input())
if A%3*B%3*(A+B)%3==0:print('Possible')
else:print('Impossible')

Submission status: Runtime Error

Solution code:
li = list(map(int,input().split()))
li.append(a+b)
for i in range(3):
    if li[i] % 3 == 0:
        print("Possible")
        exit()
print("Impossible")

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int, input().split()))

ans = abs(sum(a[1:])-a[0])
X = sum(a)

for i in range(1,N):
    sa = abs(X - 2*sum(a[:i]))
    ans = min(ans,sa)

print(ans)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
if((A%3 == 0) or (B%3 == 0) or ((A+B)%3 == 0):
    print("Possible")
else:
    print("Impossible")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a%3 = 0 or b%3 == 0 or (a+b)%3 == 0:
    print('Possible')
else:
    print('Impossible')

Submission status: Runtime Error

Solution code:
a,b=mpa(int,input().split())
print('Possible' if (a%3==0 or b%3==0 or a+b%3==0) else 'Impossible')

Submission status: Runtime Error

Solution code:
print('Possible' if sum(map(int, input()))%3==0 else 'Impossible')

Submission status: Runtime Error

Solution code:
print('Possible' if sum(list(map(int, input())))%3==0 else 'Impossible')

Submission status: Runtime Error

Solution code:
A,B = map(str, input().split())
if (A + B)%3 == 0:
  print('Possible')
else:
  print('Impossible')

Submission status: Runtime Error

Solution code:
A = input()
B = input()
if A % 3 == 0 and B % 3 == 0:
  print('Possible')
elif A + B % 3 == 0:
  print('Possible')
else:
  print('Impossible')

Submission status: Runtime Error

Solution code:
A = imput()
B = imput()
if A % 3 == 0 and B % 3 == 0:
  print('Possible')
elif A + B % 3 == 0:
  print('Possible')
else:
  print('Impossible')

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

whole = a.sum()
div = np.abs(a.cumsum() - whole / 2).argmin()

if div == 0 or div == (n - 1):
    print(min(np.abs(a[0] - a[1:].sum()), np.abs(a[:-1].sum() - a[-1])))
else:
    print(np.abs(a[:div + 1].sum() - a[div + 1:].sum()))

Submission status: Runtime Error

Solution code:
print("Impossible" if int(input()[::2])%3 else "Possible")

Submission status: Runtime Error

Solution code:
    a,b=map(int,input().split())
    print('Possible' if ((a+b)%3==0) or (a%3==0) or(b%3==0) else 'Impossible')

Submission status: Runtime Error

Solution code:

    A,B = map(int, input().split())
    
    if A%3 == 0:
        print('Possible')
    elif B%3 == 0:
        print('Possible')
    elif (A+B)%3 == 0:
        print('Possible')
    else:
        print('Impossible')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
print("Impossible" if (a % 3) or (b % 3) or(sum(a, b) % 3) else "Possible")

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a%3==0 or b%3==0 or c%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int, input().split())
s=[a,b,a+b]
for si in s:
  if si%3==0:
  	print('Possible')
    sys.exit()    
print('Impossible')

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=sorted(a)
ans=0
for i in range(1,k+1):
  ans+=b[(-1)*i]
print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a*b*(a+b)%3==0:
  print(""Possible")
else:
        print("Impossible")

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int,input().split()))
S=sum(a)
SS=0
mi=abs(S-SS)
for i in range(N):
  S=S-a[i]
  SS=SS+a[i]
  if mi>=abs(S-SS):
    mi=abs(S-SS)
print(mi)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
a = list(map(int,input().split()))
print(min(abs(sum(a[0:i])-(sum(a)-sum(a[0:i]))) for i in range(1,N)))

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
l = input()
lrev = l[::-1]
print(sum(lrev[:K]))

Submission status: Runtime Error

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

a+b=k

a%3=m

b%3=n

k%3=r

if m==0 or n==0 or r==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

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

a+b=k

a//3=m

b//3=n

k//3=r

if m==0 or n==0 or r==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
total = sum(a)
ans = float('inf')
x = 0
for i in range(N-1):
    x += a[i]
    ans = min(abs(total-2*x),ans)
print (ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
l = map(int, input().split())

l = sorted(l)[::-1]

sum = 0

for i in range(K):
    sum += l[i]

print(sum)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
m=n*10**9
for i in range(n-1):


    k=abs(  sum(a[0:i+1]) - sum(a[i+1:n]) )
    m=min(m,k)
print(m)

Submission status: Runtime Error

Solution code:
a,b = [int(x) for x in split().input()]
if a%3==0 or b%3==0 or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
#ABC067A
a,b=map(int,input().split())
if ((a+b)%3==0)and(a%3!=0)and(b%3!=0):
    print("Possible")
elif(a%3==0)or(b%3==0)and((a+b)%3!=0):
     print("Possible")
else:
    print("Impossible") print("Possible")

Submission status: Runtime Error

Solution code:
a,b = map(int,input())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

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

if A + B % == 0 and A + B != 0:
	print("Possible")
else:
	print("Impossible")

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**7)

def cur(p):
    for x in neighbor[p]:
        if x==par[p]: continue
        else:
            par[x]=p
            descend[p]+=cur(x)
    neighbor[p].remove(par[p])
    return descend[p]

n=int(input())
neighbor=[[]  for _ in range(n+1)]
descend=[1]*(n+1)
par=[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].append(b)
    neighbor[b].append(a)
neighbor[1].append(0)
cur(1)


x=[descend[n]-1]
t=n
while t!=1:
    t,pret=par[t],t
    x.append(descend[t]-descend[pret]-1)

l=len(x)
p,q=sum(x[:l//2]),sum(x[l//2:])
if l%2==0: print("Fennec" if p<q else "Snuke")
else: print("Fennec" if p<=q else "Snuke")

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
ruiseki = [0]*(N+1)
total = 0
now = 10**9+7
sa = 0
now_2 = 0
for i in range(N):
  total += A[i]
  ruiseki[i+1] = total
for i in range(1,len(ruiseki)-1):
  snuke = ruiseki[i]-ruiseki[0]
  arai = ruiseki[N]-ruiseki[i]
  now_2 = abs(snuke-arai)
  now = min(now,now_2)
print(now)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a %3==0 or b%3== or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int, input().split()))
M = sum(a)
snk = 0
ans = float('inf')
for i in range(N-1):
    snk += a[i]
    ari = M - snk
    ans = min(ans,abs(snk-ari))
print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().stlip())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a,b = [int(x) for x in input().split()]
print('Possible' (a+b)%3 == 0 else 'Impossible')

Submission status: Runtime Error

Solution code:
A,B =map(int,input().split())
if A%3 == o or B%3 ==0 or (A+B)%3 ==0:
  print("Possible")
  
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a=input()
b=input()
if (a+b)%3==0:
  print "Possible"
else:
  print "Impossible"

Submission status: Runtime Error

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

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0
	print("Possible")
else:
  	print("Impossible")

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())

list = [int(i) for i in input().split()]

list.sort(reverse=True)

ans = 0
for i in range(K):
  ans += list[i]
  
  
print(ans)

Submission status: Runtime Error

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

if A%3==0 or B%3==0 or (A+B)%3==0:
  print("Possible")
else:
  print("Impossible")

Submission status: Runtime Error

Solution code:
a, b= map(int, input().split())
x = False
for i in [a, b, a+b]:
  if i%3 == 0:
    x = True
print("Possible" if x else "Impossible"

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
*l,=map(int,input().split())
l=sorted(l,reverse=True)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
print('Possible') if A%3==0or B%3==0or(A+B)%3==0 else print('Impossible')

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
b,i,c=10**9,1,True
while(i<n and c):
  p=sum(l[:i])
  q=sum(l[i:])
  if min(b,abs(p-q))!=abs(p-q):
    break
  else:
    b=min(b,abs(p-q))
    i+=1
print(b)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
b,i,c=10**9,1,True
while(i<n and c):
  p=sum(l[:i])
  q=sum(l[i:])
  c=min(b,abs(p-q))==abs(p-q)
  b=min(b,abs(p-q))
  i+=1
print(b)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print('Possible')
else:print('Impossible')

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = [0]
if (n == 2):
    printf(abs(a[0] - a[1]))
else:
    for i in range(n):
        s.append(a[i] + s[i])

    b = 1e+9

    for j in range(n+1):
        if (abs(s[j] - (s[n] - s[j])) < b):
            b = abs(s[j] - (s[n] - s[j]))
    print(b)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = [0]
for i in range(n):
    s.append(a[i] + s[i])

b = 1e+9

for j in range(n+1):
    if (abs(s[j] - (s[n] - s[j])) < b):
        b = abs(s[j] - (s[n] - s[j]))

print(b)

Submission status: Runtime Error

Solution code:
import sys
a, b = map(int, input().split())
if a != 0 and a%3 = 0:
	print("Possible")
    sys.exit()
if b != 0 and b%3 = 0:
	print("Possible")
    sys.exit()
if a != 0 and b != 0 and (a+b)%3:
	print("Possible")
    sys.exit()

print("Impossible")

Submission status: Runtime Error

Solution code:
n, k = map(int,input().split())
l = list(input())
a = sorted(l)[::1]
print(sum(a)[-k:])

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a%3==0 or b%3==0 or (a+b)%==0:
    print("Possible")
else:
    print("Impossible")

Submission status: Runtime Error

Solution code:
def cookies(A,B):
    if A%3==0 or B%3==0 or (A+B)%3==0:
        return 'Possible'
    else:
        return 'Impossible

Submission status: Runtime Error

Solution code:
a = int(input("The number of A cookies."))
b = int(input("The number of B cookies."))
if (a+b)%3 == 0:
    print("Possible")
else:
    print("Impossible")

Submission status: Runtime Error

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

if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0:
  print("Possible")
else:
  print("Impossible")