Problem:


Score: 100 points

Problem Statement

We held two competitions: Coding Contest and Robot Maneuver.

In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.

DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver.
Find the total amount of money he earned.

Constraints

1 \leq X \leq 205

1 \leq Y \leq 205

X and Y are integers.

Input

Input is given from Standard Input in the following format:

X Y

Output

Print the amount of money DISCO-Kun earned, as an integer.

Sample Input 1

1 1

Sample Output 1

1000000

In this case, he earned 300000 yen in Coding Contest and another 300000 yen in Robot Maneuver. Furthermore, as he won both competitions, he got an additional 400000 yen.
In total, he made 300000 + 300000 + 400000 = 1000000 yen.

Sample Input 2

3 101

Sample Output 2

100000

In this case, he earned 100000 yen in Coding Contest.

Sample Input 3

4 4

Sample Output 3

0

In this case, unfortunately, he was the highest-ranked contestant without prize money in both competitions.



Sample input:
1 1


Sample output:
1000000

Submission status: Accepted

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

X, Y = map(int, input().split())

def score(s):
    if s == 1:
        return 300000
    elif s == 2:
        return 200000
    elif s == 3:
        return 100000
    else:
        return 0

ans = score(X) + score(Y)
if X == Y == 1:
    ans += 400000
print(ans)

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
if x == 1 and y == 1:
    print(1000000)
else:
    print(max(0, 400000 - 100000 * x) + max(0, 400000 - 100000 * y))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    x,y=map(int,input().split())
    ans=0
    if(x==1):
        ans+=3
    elif(x==2):
        ans+=2
    elif(x==3):
        ans+=1
    if(y==1):
        ans+=3
    elif(y==2):
        ans+=2
    elif(y==3):
        ans+=1
    if(x==1 and y==1):
        ans+=4
    print(ans*100000)
resolve()

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
ans=0
if x==1:
    ans+=300000
elif x==2:
    ans+=200000
elif x==3:
    ans+=100000
if y==1:
    ans+=300000
elif y==2:
    ans+=200000
elif y==3:
    ans+=100000
if x==1 and y==1:
    ans+=400000
print(ans)

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

d = {
    3: 100000,
    2: 200000,
    1: 300000
}

bonus = 400000

print(d.get(x, 0) + d.get(y, 0) + (bonus if x == 1 and y == 1 else 0))

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
ans = 0
if X == 3:
    ans += 100000
elif X == 2:
    ans += 200000
elif X == 1:
    ans += 300000
if Y == 3:
    ans += 100000
elif Y == 2:
    ans += 200000
elif Y == 1:
    ans += 300000
if X == Y == 1:
    ans += 400000
print(ans)

Submission status: Accepted

Solution code:

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

X,Y  =inpl()

ans = 0
if X == 1:
    ans += 300000
elif X == 2:
    ans += 200000
elif X == 3:
    ans += 100000

if Y == 1:
    ans += 300000
elif Y == 2:
    ans += 200000
elif Y == 3:
    ans += 100000

if X == 1 and Y == 1:
    ans += 400000

print(ans)

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if x==1 and y==1:
    print(1000000)
    exit()
print(max(0,4-x)*100000+max(0,4-y)*100000)

Submission status: Accepted

Solution code:
x, y =map(int, input().split())

ans = 0
if x == 3:
    ans += 100000
if x == 2:
    ans += 200000
if x == 1:
    ans += 300000

if y == 3:
    ans += 100000
if y == 2:
    ans += 200000
if y == 1:
    ans += 300000

if x == 1 and y == 1:
    ans += 400000

print(ans)

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())

if X==1 and Y==1:
    print(1000000)
else:
    ANS=0

    if X==1:
        ANS+=300000
    elif X==2:
        ANS+=200000
    elif X==3:
        ANS+=100000

    if Y==1:
        ANS+=300000
    elif Y==2:
        ANS+=200000
    elif Y==3:
        ANS+=100000

    print(ANS)

Submission status: Accepted

Solution code:
X, Y = list(map(int, input().split()))

ans = 0

def nasu(x):
  if x == 1:
    return 300000
  if x == 2:
    return 200000
  if x == 3:
    return 100000
  return 0

ans += nasu(X)
ans += nasu(Y)

if X == 1 and Y == 1:
  ans += 400000

print(ans)

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

ans = 0
if x == 3:
    ans += 100000
elif x == 2:
    ans += 200000
elif x == 1:
    ans += 300000


if y == 3:
    ans += 100000
elif y == 2:
    ans += 200000
elif y == 1:
    ans += 300000


if x == 1 and y == 1:
    ans+= 400000

print(ans)

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

def h(x):
    if x == 3:
        return 100000
    elif x == 2:
        return 200000
    elif x == 1:
        return 300000
    return 0

print(h(x)+h(y)+(400000 if x == y == 1 else 0))

Submission status: Accepted

Solution code:
X, Y = map(int, raw_input().split())

ans = 0
if X==3: ans += 100000
if X==2: ans += 200000
if X==1: ans += 300000
if Y==3: ans += 100000
if Y==2: ans += 200000
if Y==1: ans += 300000
if X==1 and Y==1: ans += 400000
print ans

Submission status: Accepted

Solution code:
def main():
    x,y=map(int,input().split())
    cnt=0
    if x==1:
        cnt+=300000
    elif x==2:
        cnt+=200000
    elif x==3:
        cnt+=100000
    if y==1:
        cnt+=300000
    elif y==2:
        cnt+=200000
    elif y==3:
        cnt+=100000
    if x==y==1:
        cnt+=400000
    print(cnt)
main()

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 


x,y = [int(i) for i in readline().split()]
#n = int(input())

ans = 0
if x == 3:
    ans += 1
elif x == 2:
    ans += 2
elif x == 1:
    ans += 3

if y == 3:
    ans += 1
elif y == 2:
    ans += 2
elif y == 1:
    ans += 3

if x == y == 1:
    ans += 4
    
print(ans * 100000)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    X,Y=map(int,input().split())
    ans=0
    for i in [X,Y]:
        if i == 3:
            ans+=100000
        elif i==2:
            ans+=200000
        elif i==1:
            ans+=300000
    if X==Y==1:
        ans+=400000
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x,y=[int(i)for i in input().split()]
p=[300000,200000,100000]
s=0
if x<4:
    s+=p[x-1]
if y<4:
    s+=p[y-1]
if s==600000:
    s=1000000
print(s)

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
ans = 0
if x == 1:
    ans += 300000
elif x == 2:
    ans += 200000
elif x == 3:
    ans += 100000

if y == 1:
    ans += 300000
elif y == 2:
    ans += 200000
elif y == 3:
    ans += 100000

if x == 1 and y == 1:
    ans += 400000
print(ans)

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())

ans = 0

if X == 3:
    ans += 100000

if Y == 3:
    ans += 100000

if X == 2:
    ans += 200000

if Y == 2:
    ans += 200000

if X == 1:
    ans += 300000

if Y == 1:
    ans += 300000

if X == 1 and Y == 1:
    ans += 400000
print(ans)

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
res = 0
if x == 1 and y == 1:
    res += 400000
if x == 1:
    res += 300000
if x == 2:
    res += 200000
if x == 3:
    res += 100000
if y == 1:
    res += 300000
if y == 2:
    res += 200000
if y == 3:
    res += 100000
print(res)

Submission status: Accepted

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

if a == 1:
  n += 300000
elif a == 2:
  n += 200000
elif a == 3:
  n += 100000

if b == 1:
  n += 300000
elif b == 2:
  n += 200000
elif b == 3:
  n += 100000

if a == 1 and b == 1:
  n += 400000

print(n)

Submission status: Accepted

Solution code:

x, y = map(int,input().split())
ans = 0
if 1 <= x <= 3:
    ans += (4-x) * 10**5
if 1 <= y <= 3:
    ans += (4-y) * 10**5
if x==1 and y==1:
    ans += 4 * 10**5
print(ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    x,y = LI()
    ans = 0
    f = [300000,200000,100000,0]
    if x == 1 and y == 1:
        print(1000000)
    else:
        ans = f[min(3,x-1)]+f[min(3,y-1)]
        print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


X, Y = list(map(int, sys.stdin.buffer.readline().split()))

ans = 0
if X == Y == 1:
    ans += 400000
if X<= 3:
    ans += [0, 100000, 200000, 300000][-X]
if Y<= 3:
    ans += [0, 100000, 200000, 300000][-Y]
print(ans)

Submission status: Accepted

Solution code:
# Input X, Y
X, Y = map(int, input().split())

# Calculate prize for "Coding Contest"
prize_code = 0;
if X == 1:
	prize_code = 300000;
elif X == 2:
	prize_code = 200000;
elif X == 3:
	prize_code = 100000;

# Calculate prize for "Robot Maneuver"
prize_device = 0;
if Y == 1:
	prize_device = 300000;
elif Y == 2:
	prize_device = 200000;
elif Y == 3:
	prize_device = 100000;

# Calculate prize for "two victories"
prize_both = 0
if X == 1 and Y == 1:
	prize_both = 400000

# Calculate the sum and print the answer
prize_total = prize_code + prize_device + prize_both
print(prize_total)

Submission status: Runtime Error

Solution code:

x,y=map(int,input().split())
if x==1 and y==1:
    print('1000000')
    exit()
l={1:300000,2:200000,3:100000}
all += int(l.get(x)+l.get(y))
print(all)

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
if x==1 and y==1:
    print('1000000')
    exit()
l={1:300000,2:200000,3:100000}
print(l[x]+l[y])

Submission status: Runtime Error

Solution code:

x,y=map(int,input().split())
if x==1 and y==1:
    print('1000000')
l={1:300000,2:200000,3:100000}
print(l[x]+l[y])

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
if x==1 and y==1:
    print('1000000')
l={1:300000,2:200000,3:100000}
print(l.value(x)+l.value(y))

Submission status: Runtime Error

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

ans = [0, 0]
ans_abs = 10**200

A_sum = sum(A)
A_1 = 0
A_2 = A_sum

for i in range(N - 1):
    A_1 += A[i]
    A_2 -= A[i]
    ans_abs = min(ans_abs, abs(A_1 - A_2))

print(ans_abs)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = A
S = sum(A)
B.reverse()
cum1 = [0]*(N)
cum2 = [0]*(N)
now1 = 0
for i in range(N):
  now1 += A[i]
  cum1[i] = now1
  cum2[i] = S-now1
minimum = 10**9
for i in range(N):
  if abs(cum1[i]-cum2[i]) < minimum:
    minimum = abs(cum1[i]-cum2[i])
print(minimum)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
lst={0:0,1:300000,2:200000,3:100000}
if a>4:
    x=0
else:
    x=a
if b>4:
    y=0
else:
    y=b
if x==1 and y==1:
    ans=1000000
else :
    ans=lst[x]+lst[y]


print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
lst={0:0,1:300000,2:200000,3:1000000}
if a>4:
    x=0
else:
    x=a
if b>4:
    y=0
else:
    y=b
if x==1 and y==1:
    ans=1000000
else :
    ans=lst[x]+lst[y]


print(ans)

Submission status: Runtime Error

Solution code:
x,y=map(int, input())
coin=0
if x==1 and y==1:
  coin+=400000
if x==1:
  coin+=300000
if y==1:
  coin+=300000
if x==2:
  coin+=200000
if y==2:
  coin+=200000
if x==3:
  coin+=100000
if y==3:
  coin+=100000
print(coin)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
dic={3:1,2:2,1:3}
c=0
if a==1 and b==1:
	c+=dic[a]*10**5+dic[b]*10**5+4*10**5
    print(c)
    
else:
  if a in dic and b in dic:
    c+=dic[a]*10**5+dic[b]*10**5
    print(c)
   
  elif a in dic and b not in dic:
    c+=dic[a]*10**5
    print(c)
    
  elif a not in dic and b in dic:
    c+=dic[b]*10**5
    print(c)

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
A = l()
ruiseki = [0]+list(itertools.accumulate(A))
i = bisect.bisect_left(ruiseki,sum(A)/2)
print(min(abs(sum(A[:i])-sum(A[i:])),abs(sum(A[:i-1])-sum(A[i-1:]))))

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())

ans = max(0, (4 - X) * 100000)
ans+ = max(0, (4 - Y) * 100000)

if X == Y == 1:
    ans += 100000 * 4

print (ans)

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())
price = [0, 300000, 200000, 100000]
ans = price[X] + price[Y] + 400000*(X == Y == 1)

print(ans)

Submission status: Runtime Error

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

ans = float('inf') 
sum_A = sum(A)
CumSum = 0


for i in range(N-1):
  CumSum = CumSum + A[i]
  ans = min(ans,(abs((sum_A - CumSum)-(CumSum))))

print(ans)

Submission status: Runtime Error

Solution code:
X,Y=map(int,input().split())
if X==1 :
    x=300000
elif X==2 :
    x=200000
elif X==3 :
    x=100000
if Y==1 :
    y=300000
elif Y==2 :
    y=200000
elif Y==3 :
    y=100000
if X==1 and Y==1 :
    print(x+y+400000)
else :
    print(x+y)

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
a=[300000,200000,100000]
add=0
if x*y==1:
    add=400000
print(a[x-1]+a[y-1]+add)

Submission status: Runtime Error

Solution code:
x,y=int(input())
a=[300000,200000,100000]
add=0
if x*y==1:
    add=400000
print(a[x-1]+a[y-1]+add)

Submission status: Runtime Error

Solution code:
x, y = (max(4 - int(i), 0) or i in input().split())
print((x + y + 4*(x==y==3)) * 10**5)

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
l=[0,300000,200000,100000]
if x==y==1:
 print(l[x]+l[y]+400000)
elif y>3:
    print(l[x])
elif x>3:
    print(l[y])
else:
    print(l[x]+l[y])

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if a == b == 1:
  print(1000000)
elif a < 3:
  if b < 3:
    print(100000*(4-a)+100000*(4-b))
  else:
    print(1000000*(4-a))
else:
  if b < 3:
    print(1000000*(4-b)
  else:print(0)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]

mean = sum(a) / n

ans = [200, 200]

for i in range(n):
    if abs(mean - a[i]) < ans[1]:
        ans = [i, abs(mean - a[i])]

print(ans[0])

Submission status: Runtime Error

Solution code:
money = [300000, 200000, 100000]
X, Y = map(int, input().split())
X -= 1; Y -= 1
ans = money[X] + money[Y]
if X + Y:
    print(ans)
else:
    print(ans + 400000)

Submission status: Runtime Error

Solution code:
X=list(map(int, input()))
t=0
for i in range(len(X)):
  if X[i]==1:
    t+=300000
  elif X[i]==2:
    t+=200000
  elif X[i]==3:
    t+=100000
if X[0]==X[1] and X[0]==1:
  t+=400000
print(t)

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
if x <=3:
  code = 300000//x
if y <= 3:
  generater = 300000//y
ans = 0
if x == y == 1:
  ans = code + generater + 400000
else:
  ans = code + generater
print(ans)

Submission status: Runtime Error

Solution code:
X,Y=map(int,input().split())
awa=0

if X==3:
  awa += 100000
elif X==2:
  awa += 200000
else X==1:
  awa += 300000
  
if Y==3:
  awa += 100000
elif Y==2:
  awa += 200000
else Y==1:
  awa += 300000
  
if X==1 and Y==1:
  awa += 400000
  
print(awa)

Submission status: Runtime Error

Solution code:
# import math
import bisect
import numpy as np
mod = 10**9 + 7

# http://cav-inet.hateblo.jp/entry/2017/02/18/165141
def binary_search(list,target): 

	result = -1
	left = 0
	right = len(list) - 1

	while left <= right:
		center = (left + right)//2
		if list[center] == target:
			result = center
			break
		elif list[center] < target:
			left = center + 1
		elif list[center] > target:
			right = center - 1

	if result == -1:
		return False
	else:
		return True

n = int(input())
a = list(map(int,input().split()))
c = np.cumsum(a)
s = c[n-1]

if binary_search(c, c[n-1]/2):
    print(0)
    exit()

i = bisect.bisect_left(c, c[n-1]/2)
ans = min(2*c[i]-s, s - c[i-1]-1)
print(ans)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
X, Y = map(int, input().split())
d = defaultdict(int)
d[1] = 300000
d[2] = 200000
d[3] = 100000
ans = d[X]+d[Y]
if X==1 and Y==1:
  ans += 400000
print(ans

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())
d = {1:300000, 2:200000, 3:100000}
ans = d[X]+d[Y]
if X==1 and Y==1:
  ans += 400000
print(ans)

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())
d = {1:300000, 2:200000, 3:100000}
ans = d[X]+d[Y]
if X==1 and Y==1:
  ans += 400000
print(ans

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
a = list(map(int, input().split()))
postCenter=dif=0
tmp = sys.maxsize
for i in range(n):
    if tmp > abs(sum(a[:i])-sum(a[i:])):
        tmp = abs(sum(a[:i])-sum(a[i:]))
print(int(tmp))

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
d = 1000000
for i in range(n):
  s1 = sum(l[0:i])
  s2 = sum(l)-s1
  b = abs(s2-s1)
  d = min(d,b)
print(d)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
s=[0,]
d={
  1:30000,
  2:20000,
  3,10000,
}

if x in d:
  s.append(d[x])

if y in d:
  s.append(d[y])

if x==1 and y==1:
  s.append(40000)
  
print(sum(s))

Submission status: Runtime Error

Solution code:
x,y = map(str,input().split())
a = {'1':300000,'2':200000,'3':100000}
if x == y == '1':
    print(1000000)
else:
    print(a[x]+a[y])

Submission status: Runtime Error

Solution code:
x, y = map(int(input().split()))
ans = 0
if x == 1:
  ans += 300000
elif x == 2:
  ans += 200000
elif x == 3:
  ans += 100000

if y == 1:
  ans += 300000
elif y == 2:
  ans += 200000
elif y == 3:
  ans += 100000
if x == 1 and y == 1:
  ans += 400000
  
print(ans)

Submission status: Runtime Error

Solution code:
a = {1:300000,2:200000,3:100000}

x,y = map(int,input().split())

if x == 1 and y == 1:
	print(a[x] + a[y] + 400000)
else:
	if x > 3 and y <=  3:
		print(a[y])
	elif x <= 3 and y >  3:
		print(a[x])
	else:
		print(a[x] + a[y])

Submission status: Runtime Error

Solution code:
X,Y = map(int, input().split())

3rd = 100000
2rd = 200000
1rd = 300000

if X == 3 and 3 < Y:
    print(3rd)
elif X == 2 and 3 < Y:
    print(2rd)
elif X == 1 and 3 < Y:
    print(1rd)
elif Y == 3 and 3 < X:
    print(3rd)
elif Y == 2 and 3 < X:
    print(2rd)  
elif Y == 1 and 3 < X:
    print(1rd)
elif X == 3 and Y == 3:
    print((3rd)+(3rd))
elif X == 3 and Y == 2:
    print((3rd) +(2rd))
elif X == 3 and Y == 1:
    print((3rd)+(1rd))
elif X == 2 and Y == 3:
    print((2rd)+(3rd))
elif X == 2 and Y == 2:
    print((2rd)+(2rd))
elif X == 2 and Y == 1:
    print((2rd)+(1rd))
elif X == 1 and Y == 3:
    print((1rd)+(3rd))
elif X == 1 and Y == 2:
    print((1rd) + (2rd))
elif X == 1 and Y == 1:
    print((1rd)+(1rd) + 400000)
else:
    print(0)

Submission status: Runtime Error

Solution code:
from itertools import accumulate

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

sum_l = [0]+list(accumulate(a))
sum_r = [0]+list(accumulate(a[-1::-1]))

cost = sum_r[-1]
for i in range(n+1):
    cost = min(cost, abs(sum_l[i]-sum_r[n-i]))
print(cost)

Submission status: Runtime Error

Solution code:
import sys

args = sys.argv

priceDict = {
    "1":300000,
    "2":200000,
    "3":100000
}

totalPrice = priceDict[args[1]] if args[1] in priceDict.keys() else 0
totalPrice += priceDict[args[2]] if args[2] in priceDict.keys() else 0
totalPrice += 400000 if args[1] is "1" and args[2] is "1" else 0

print(totalPrice)

Submission status: Runtime Error

Solution code:
arr=list(map(int,input().split()))
s=0
for i in range(1,4):
  for j in range(2):
    if arr[j]==i:
      s+=(4-i)*100000
if arr[0]==arr[1] and arr[1]=1:
  s+=400000
print(s)

Submission status: Runtime Error

Solution code:
def main(x: int, y: int):
    award: int = 0

    if (x and y) == 1:
        award += 400000

    for i in [x, y]:
        if i == 1:
            award += 300000
        elif i == 2:
            award += 200000
        elif i == 3:
            award += 100000

    print(award)


if __name__ == "__main__":
    x, y = map(int, input().split())

    main(x, y)

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
ans=0
dic={1:300000,2:200000,3:100000}
ans+=dic[x]+dic[y]
if x==1 and y==1:
  ans+=400000
print(ans)

Submission status: Runtime Error

Solution code:
x,y=map(int,input())
if(x==y==1):
  print(1000000)
else:
  ans=max(4-x,0)*100000+max(4-y,0)*100000
  print(ans)

Submission status: Runtime Error

Solution code:
N = input().split()
A = input().split()
a = []

if int(N[0]) >= 2 and int(N[0]) <= 200000:
  n = int(N[0])
  for i in range(n):
    if int(A[i]) >= 1 and int(A[i]) <= 2020202020:
      a.append(int(A[i]))

right = 0
left = 0
cnt = 0
herf = 0

for i in range(n):
  cnt += a[i]
herf = int(cnt/2)
for i in range(n):
  left += a[i]
  if left > herf:
    left -= a[i]
    right = cnt - left
    break
print(abs(left-right))

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
if x + y == 2:
  print(100000)
elif x + y == 3:
  print(50000)
elif x + Y == 5:
  print(30000)
elif x + Y == 4:
  print(40000)
elif x + Y == 6:
  print(20000)
else:
  print(0)

Submission status: Runtime Error

Solution code:
c = 0
X, Y = map(int, input().split())
l = [300000, 200000, 100000]
if X < 4:
    c += l[X - 1]
if Y < 4:
    c += l[X - 1]
if X == 1 and Y == 1:
    c += 400000
print(c)

Submission status: Runtime Error

Solution code:
prize = {1:300000,2:200000,3:100000}

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

if a == b == 1:
    print(1000000)
elif a < 4 and b < 4:
    print(prize[a] + prize[b])
elif a >= 4:
    print(prize[b])
elif b >= 4:
    print(prize[a])
else:
    print(0)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
ans = 0

if x == 1 and y == 1:
    ans += 400000
    
li = [0,300000, 200000, 100000]

if x <= 3:
    ans += li[x]
if y <= 3
    ans += li[y]

print(ans)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
ans = 0

if x == 1 and y == 1:
    ans += 400000
    
li = [0,300000, 200000, 100000]

ans += li[x]
ans += li[y]

print(ans)

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())

points = [-1, 100000, 200000, 300000, 0]
print(400000*(X==Y==1) + points[max(4, X)] + points[max(4, Y)])

Submission status: Runtime Error

Solution code:
m=int(input())
a=[list(map(int, input().split())) for i in range(m)]
x=0
y=0
z=0
y1=float('inf')
ans=0
for i in range(m):
    x+=a[i][1]
    y+=a[i][0]*a[i][1]



print(x-1+(y-1)//9)

Submission status: Runtime Error

Solution code:
a, b = [int(x)-1 for x in input().split()]
won = 0
if a in range(3):
  won  += [300000,200000,200000][a]
if b in range(3):
  won  += [300000,200000,200000][a]
won += 400000 * (a == 0 and b == 0)
print(won)

Submission status: Runtime Error

Solution code:
X, Y = map(int,input().split())
prize_third = 100000
prize_second = 200000
prize_champ = 300000
prize_extra = 400000

ret = 0

def get_prize(rank):
    if rank == 1:
        return prize_first
    elif rank == 2:
        return prize_second
    elif rank == 3:
        return prize_third
    else:
        return 0

ret += get_prize(X)
ret += get_prize(Y)
ret += prize_extra if X == 1 and Y == 1 else 0

print(ret)

Submission status: Runtime Error

Solution code:
M = int(input())
CD = C = 0
for i in range(M):
  d, c = map(int, input().split())
  CD += c * d
  C += c
print(C - 1 + (CD - 1) // 9)

Submission status: Runtime Error

Solution code:
def main():
    #print = out.append
    ''' Cook your dish here! '''
    n = get_int()
    print("?", " ".join(map(str, range(1, 1 + n))), flush=True)
    start = input()
    ptr = 0
    res = ['' for _ in range(2*n)]
    for i in range(2, n+2):
        print("?", " ".join(map(str, range(i, i+n))), flush=True)
        cr = input()
        ptr += 1
        if cr!=start:
            res[ptr-1] = start[0]
            res[ptr + n - 1] = 'R' if res[ptr-1]!='R' else 'B'
            break
    outer = list(range(1, ptr)) + list(range(ptr+n+1, (2*n)+1))
    inner = list(range(ptr+1, ptr + n))
    for i in outer:
        print("?", i, " ".join(map(str, inner)), flush=True)
        res[i-1] = input()[0]
    for i in inner:
        print("?", i, " ".join(map(str, outer)), flush=True)
        res[i-1] = input()[0]
    print("!", "".join(res), flush=True)


''' Coded with love at India by Satyam Kumar '''
import sys
#from collections import defaultdict
import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
#print(*out, sep='\n')

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())

ans = 0

def f(n):
    if n == 3:
        tmp = 100000
    elif n == 2:
        tmp = 200000
    elif n == 1:
        tmp= 300000

ans = f(X) + f(Y)

if ans == 600000:
    ans += 400000

print(ans)

Submission status: Runtime Error

Solution code:
x=int(input())
y=int(input())
prize=0
if x==1:
  prize+=300000
if x==2:
  prize+=200000
if x==3:
  prize+=100000
if y==1:
  prize+=300000
if y==2:
  prize+=200000
if y==3:
  prize+=100000
if x==1 and y==1:
  prize+=400000
print(prize)

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())

ans = 0

if x < 4:
  ans += (4-x)＊ 100000
  
if y < 4:
  ans += (4-y)＊ 100000
  
if x + y == 2:
  ans += 400000
  
print(ans)

Submission status: Runtime Error

Solution code:
x = int(input())
y = int(input())

total = 0

rewards = {1: 300000, 2: 200000, 3: 100000}

x1 = rewards[x]
y2 = rewards[y]

if (x == 1 and y ==  1):
  	total += 400000
total += (x1 + y1)

print(total)

Submission status: Runtime Error

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

if(a == 1 & b == 1)
	pass

Submission status: Runtime Error

Solution code:
N = int(input())
A_list = [int(item) for item in input().split()]

all_sum = sum(A_list)

F_sum_list = []

for j in range(1,N):
    F = A_list[:j]
    F_sum = sum(F)
    F_sum_list.append(F_sum)
    if F_sum >= all_sum // 2:
        break

mini = min(all_sum - 2 * F_sum_list[-2], -1*(all_sum - 2 * F_sum_list[-1]))
print(mini)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int X, Y;
    cin >> X >> Y;

    int ans = 0;

    if (X == 1) ans += 300000;
    if (X == 2) ans += 200000;
    if (X == 3) ans += 100000;
    if (Y == 1) ans += 300000;
    if (Y == 2) ans += 200000;
    if (Y == 3) ans += 100000;
    if (X == 1 && Y == 1) ans += 400000;

    cout << ans << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
m=int(input())
count=0#求めるトーナメント数
#複数行2数値を受け取る
x = []
y = []
for i in range(m):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x,y)

#最初のエントリーする人を求める
n=str()#空の文字列を作成
for j in range(0, m):#標準入力の数字を連結させてnをつくる
  n += str(x[j])*y[j]#エントリーする人の数
print(n)

#再帰呼び出しする関数
def Selection(entry):  
  l=[]#空のリストを作成。ここに選出人数を入れていく
  for k in range(0, len(n)-1):
  
    int_sum=int(n[k],10)+int(n[k+1],10)#10進数で足し算
    n_replaced=n.replace(n[k:k+2:1],str(int_sum))
    l.append(int(n_replaced,10))#このままだとlの各要素がstr型なのでintに変換
  print(l)
  n=max(l)#選出人数は最大となるものを選ぶ
  
  if n<10:
    print(count)
    exit()
  else:
    count += 1

while True:
  Selection(n)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
x=sum(a)
i=ans1=0
while True:
    if ans1<x/2 and i<n:
        ans1+=a[i]
        i+=1
    else:
        break

i-=1
ans2=x-ans1
ans1-=a[i]
print(a[i]-abs(ans1-ans2))

Submission status: Runtime Error

Solution code:
M=int(input())
D,C=zip(*[map(int,input().split()) for i in range(M)])
X=[d*c for d,c in zip(D,C)]
print(sum(C)-1+(sum(X)-1)//9)

Submission status: Runtime Error

Solution code:
import sys
    
sys.setrecursionlimit(200000)

n = int(input())
s = [int(x) for x in input().split()]
sum_s = sum(s)
middle_s = sum_s / 2
w = 0
for i in range(len(s)):
    w += s[i]
    if w == middle_s:
        print(0)
        break
    elif w > middle_s:
        if i == 0:
            ans = s[0] - sum(s[1:])
            print(ans)
        elif s[i] == s[-1]:
            ans = s[-1] - sum(s[:-1])
            print(ans)
        else:
            left = sum(s[0:(i+1)]) - sum(s[(i+1):])
            right = sum(s[i:]) - sum(s[0:i])
            ans = min(abs(left),abs(right))
            print(ans)
            break

Submission status: Runtime Error

Solution code:
n = int(input())
array = list(map(int,input().split(' ')))

def getSum(s, e):
    sum = 0
    for i in range(s, e):
        sum = sum + array[i]
    return sum

prev = 0
for i in range(0,n-1):
    diff = abs(getSum(0, i+1) - getSum(i+1, n))
    if(i == 0):
        prev = diff
    else:
        if diff < prev:
            prev = diff
print(prev)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
whole_length = sum(A)
middle_length = whole_length / 2
sum_length_before = 0
sum_length = 0
sum = 0
cost_before = abs(sum_length_before - middle_length)
cost_after = abs(sum_length_after - middle_length)

for i in range(N):
    if A[i] < middle_length:
        sum_length_before = sum_length
        sum_length_after += A[i]
        sum = i
    else:
        break

if cost_before >= cost_after:
    print(cost_after)

else:
    print(cost_before)