Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02999 (python)

Fixed submission:
x,a = list(map(int,input().split()))
if x < a:
    print(0)
elif x >= a:
    print(10)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
W = a[0]
H = a[1]
x = a[2]
y = a[3]
#W,H,x,y = list(map(int,input().split(" ").rstrip("")))
#print(W,H,x,y)
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
        
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
        
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
        
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
        
    elif float(x) == float(W)/2.0:
        tatemax = float(H) * float(x)
if W!=H:
    if yokomax == tatemax:
    #    print(max(yokomax,tatemax),'1')   
        print('{:.12e}'.format(max(yokomax,tatemax)),'1')
    else:
    #    print(max(yokomax,tatemax),'0')
        print('{:.12e}'.format(max(yokomax,tatemax)),'0')
elif W ==H:
    if x !=0 and x != W and y!= 0 and y != H:
        print('{:.12e}'.format(max(yokomax,tatemax)),'1')

Buggy submission (verdict: Runtime Error):
W,H,x,y = list(map(int,input().split(" ")))
#print(W,H,x,y)
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
    elif float(x) == float(W)/2:
        tatemax = float(H) * float(x)
if yokomax == tatemax: 
    print(max(yokomax,tatemax),'1')   
#    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print(max(yokomax,tatemax),'0')
#    print('{:.12e}'.format(max(yokomax,tatemax)),'0')

Buggy submission (verdict: Runtime Error):
W,H,x,y = list(map(int,input().split(" ")))
print(W,H,x,y)
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
    elif float(x) == float(W)/2:
        tatemax = float(H) * float(x)
if yokomax == tatemax: 
    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print('{:.12e}'.format(max(yokomax,tatemax)),'0')
Problem p03005 (python)

Fixed submission:
N,K=list(map(int,input().split()))
dis =N-K+1
if K >=2:
    print(dis-1)
elif K ==1:
    print(0)

Buggy submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
dis =N-K+1
if K >=2:
    print(dism-1)
elif K ==1:
    print(0)

Buggy submission (verdict: Runtime Error):
N,K=list(map(int,input().split())
dismax = N-K+1
print(dismax-1)
Problem p03047 (python)

Fixed submission:
N,K = list(map(int,input().strip().split(" ")))
out = N - K + 1
print(out)

Buggy submission (verdict: Runtime Error):
N,K = map(int(input(),split()))
out = N - K + 1
print(out)

Buggy submission (verdict: Runtime Error):
N,K = int(input())
out = N - K + 1
print(out)
Problem p03067 (python)

Fixed submission:
A,B,C= list(map(int,input().strip().split(" ")))
if A < C< B:
 print('Yes')
elif B < C < A:
 print('Yes')
else:
 print('No')

Buggy submission (verdict: Runtime Error):
N= int(input())
Sl = input()
K= int(input())
S=list(Sl)

for i in range(N):
 if S[i] != S[K-1]:
   S[i] = '*'
Snew = "".join(S)
print(Snew)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
K=int(input())

for i in range(N):
 if S[i]  != S[K-1]:
  ass = '*'
  S[i] = ass
print(S)
Problem p03455 (python)

Fixed submission:
a,b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")

Buggy submission (verdict: Runtime Error):
int a, b
int c = a*b

if c%2 == 0:
	print('even')

if c%2 != 0:
	print('odd')
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[0]+str(len(s-2))+s[-1])
Problem p02946 (python)

Fixed submission:
re,x=map(int,input().split())
print(*list(range(x-re+1,x+re)))

Buggy submission (verdict: Runtime Error):
re,x=map(int,input().split())
print(' '.join(map(str,(list(range(x-re+1,x+re)))))

Buggy submission (verdict: Runtime Error):
re,x=map(int,input().split())
print(' '.join(list(range(x-re+1,x+re))))

Buggy submission (verdict: Runtime Error):
re,x=int(input().split())
print(' '.join(list(range(x-re+1,x+re))))
Problem p03636 (python)

Fixed submission:
s=input()
length=len(s)-2
print(s[0]+str(length)+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
length=len(s)-2
print(s[0]+length+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
length=len(s)-2
print(f'{s[0]}{length}{s[-1]}')

Buggy submission (verdict: Runtime Error):
length=len(s)-2
return s[0]+length+s[-1]
Problem p04044 (python)

Fixed submission:
number,length=map(int,input().split())
input_list=[]
out=''
for i in range(number):
    input_list.append(input())
input_list.sort()
for i in input_list:
    out+=i
print(out)

Buggy submission (verdict: Runtime Error):
number,length=input().split()
input_list=[]
out=''
for i in range(number):
    input_list.append(input())
input_list.sort()
for i in input_list:
    out+=i
print(out)
Problem p03210 (python)

Fixed submission:
X = input()

try:
  X = int(X)
except:
  X = -1
  
if X in (3, 5, 7):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
X = input()

result = False
try:
  X = int(X)
except:
  X = -1
  
  
if X in (3, 5, 7):
  return "YES"
return "NO"
Problem p03610 (python)

Fixed submission:
print(str(input())[::2])

Buggy submission (verdict: Runtime Error):
print(str(input(N))[::2])
Problem p02958 (python)

Fixed submission:
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
if len(rev_index) == 2:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
if len(rev_index) > 0:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
elif len(rev_index) > 0:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")
Problem p02947 (python)

Fixed submission:
amap = {}
cnt = 0
n = int(input())
for i in range(n):
  s = "".join(sorted(input()))
  if s in amap:
    cnt += amap[s]
    amap[s] += 1
  else:
    amap[s] = 1

print(cnt)

Buggy submission (verdict: Runtime Error):
amap = {}
cnt = 0
n = int(input())
for i in range(n):
  s = "".join(sorted(input()))
  if s in amap:
    cnt += amap[s]
  amap[s] += 1

print(cnt)
Problem p02971 (python)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=sorted(l)
a.reverse()
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=l.sorted(reverse=True)
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=l.sorted(reverse=True)
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])
Problem p02988 (python)

Fixed submission:
n=int(input())
li =list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    if li[i-1]<li[i]<li[i+1]:
        cnt+=1
    elif li[i-1]>li[i]>li[i+1]:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
list = list(map(int,input().slice()))
cnt=0
for i in range(1,n-1):
    if list[i-1]<list[i]<list[i+1]:
        cnt+=1
    elif list[i-1]>list[i]>list[i+1]:
        cnt+=1
print(cnt)
Problem p02993 (python)

Fixed submission:
s = input()
if s[0] != s[1] and s[1] != s[2] and s[2]!=s[3]:
    print("Good")
else:
    print("Bad")

Buggy submission (verdict: Runtime Error):
var input=GET(require("fs").readFileSync("/dev/stdin","utf8"));
var str = input();
if(str[0] == str[1] || str[1]==str[2] || str[2]==str[3])console.log("Bad");
else console.log("Good")
Problem p03035 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=5:
    print(0)
elif a>=6 and a<=12:
    print(b//2)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
    a,b=map(int,input().split())
    if a<=5:
        print(0)
    elif a>=6 and 12<=a:
        print(b/2)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input.split())
if a<=5:
    print(0)
elif a>=6 and 12<=a:
    print(b/2)
else:
    print(b)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a+a-1,b+b-1))

Buggy submission (verdict: Runtime Error):
a,b=int(input()
print(max(a+b,a+a-1,b+b-1))
Problem p03211 (python)

Fixed submission:
s=input()
ss=753
for i in range(0,len(s)-1):
    v=abs(753 - int(s[i:i+3]))
    ss=min([ss,v])
print(ss)

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(0,len(s)-3):
    v=abs(753 - int(s[i:i+3]))
    ss=min([ss,v])
print(ss)
Problem p03238 (python)

Fixed submission:
n=input()
if n=="1":
    print("Hello World")
else:
    print(int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=input()
if n=="1":
  print("Hello World")
elif:
  print(int(input())+int(input()))
Problem p03239 (python)

Fixed submission:
N,T = map(int,input().split())
ans = 1001
for i in range(N):
    c,t = map(int,input().split())
    if T >= t:
        ans = min(ans,c)
if ans == 1001:
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
ans = 1000
for i in N:
  c,t = map(int,input().split())
  if T >= t:
      ans = min(ans,c)
print(ans)
Problem p03244 (python)

Fixed submission:
n=int(input())
l=input().split()
a={"-1":0}
for i in range(0,len(l),2):
    if l[i] in a:
        a[l[i]]+=1
    else:
        a[l[i]]=1
b={"-1":0}  
for i in range(1,len(l),2):
    if l[i] in b:
        b[l[i]]+=1
    else:
        b[l[i]]=1
a = sorted(a.items(), key=lambda x:-x[1])
b = sorted(b.items(), key=lambda x:-x[1])
if a[0][0]==b[0][0]:
    m=max(a[0][1]+b[1][1],a[1][1]+b[0][1])
else:
    m=a[0][1]+b[0][1]
print(n-m)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=input().split()
a={}
for i in range(0,len(l),2):
    if l[i] in a:
        a[l[i]]+=1
    else:
        a[l[i]]=1
b={}  
for i in range(1,len(l),2):
    if l[i] in b:
        b[l[i]]+=1
    else:
        b[l[i]]=1
a = sorted(a.items(), key=lambda x:-x[1])
b = sorted(b.items(), key=lambda x:-x[1])
if a[0][0]==b[0][0]:
    m=max(a[0][1]+b[1][1],a[1][1]+b[0][1])
else:
    m=a[0][1]+b[0][1]
print(n-m)
Problem p03425 (python)

Fixed submission:
n=int(input())
s={"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(n):
    v=input()
    if v[0] in s:
        s[v[0]]+=1
l=list(s.values())
ans=0
for a in range(5):
    for b in range(a+1,5):
        for c in range(b+1,5):
            ans+=l[a]*l[b]*l[c]         
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s={"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(n):
    v=input()
    if v[0] in s:
        s[v[0]]+=1
l=s.values()
sum=0
for a in range(5):
    for b in range(a+1,5):
        for c in range(b+1,5):
            sum+=l[a]*l[b]*l[c]         
print(sum)
Problem p03434 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
x,y=[0,0]
for i in range(n):
    if(i%2==0):
        x+=a[i]
    else:
        y+=a[i]
print(x-y)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
x,y=[0,0]
for i in range(n):
    if(i%2==0):
        x+=a[i]
    else:
        y+=a[i]
print(sum(x)-sum(y))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
x,y=[0,0]
for i in n:
    if(i%2==0):
        x+=a[i]
    else:
        y+=a[i]
print(sum(x)-sum(y))
Problem p03456 (python)

Fixed submission:
import math
a,b=input().split()
n=int(a+b)
print("Yes" if math.sqrt(n).is_integer() else "No")

Buggy submission (verdict: Runtime Error):
a,b=input().split()
n=int(a+b)
print("Yes" if math.sqrt(n).is_integer() else "No")

Buggy submission (verdict: Runtime Error):
a=int(input())
print("Yes" if math.sqrt(a).is_integer() else "No")

Buggy submission (verdict: Runtime Error):
import math
a,b=input().split()
n=int(a+b)
pritn("Yes" if math.sqrt(n)%1==0 else "No")
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
      print("A")
else:
      print("B")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if min(abs(x-a)>abs(x-b)):
  print("A")
else:
  print("B")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print(min(abs(x-a),abs(x-b))
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a>b:
   print("GREATER")
elif a<b:
    print("LESS")
elif a==b:
    print("EQUAL")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
   print("GREATER")
else if a<b:
    print("LESS")
else if a==b:
    print("EQUAL")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if a>b:
   print("GREATER")
else if a<b:
    print("LESS")
else if a==b:
    print("EQUAL")
Problem p04043 (python)

Fixed submission:

s=list(map(int,input().split()))
s.sort()
if s[0]==5 and s[1]==5 and s[2]==7 :
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
    s=list(map(int,input().split()))
    s.sort()
    if s[0]==5 and s[1]==5 and s[2]==7 :
        print("YES")
    else :
        print("NO")

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().split())
s.sort()
if s[0]==5 and s[1]==5 and s[2]==7 :
    print("YES")
else :
    print("NO")
Problem p02985 (python)

Fixed submission:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,K = map(int,input().split())
graph = list([] for _ in range(N))
for i in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
def f(x,y):
    r = 1
    for i in range(y):
        r = (r*(x-i))%mod
    return r
q = graph[0]
V = {0}
ans = f(K-1,len(q))
while q:
    v = q.pop()
    if v in  V:
        continue
    V.add(v)
    q += graph[v]
    ans = (f(K-2,len(graph[v])-1)*ans)%mod
print((K*ans)%mod)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
graph = list([] for _ in range(N))
for i in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
def f(x,y):
    r = 1
    for i in range(y):
        r = (r*(x-i))%mod
    return r
q = graph[0]
V = {0}
ans = f(K-1,len(q))
while q:
    v = q.pop()
    if v in  V:
        continue
    V.add(v)
    q += graph[v]
    ans = (f(K-2,len(graph[v])-1)*ans)%mod
print((K*ans)%mod)
Problem p03006 (python)

Fixed submission:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)


N = int(input())
pair=defaultdict(int)
xy = []
for i in range(N):
    x,y = map(int,input().split())
    xy.append((x,y))
for i in range(N):
    for j in range(N):
        if i != j:
            pair[(xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])] += 1

m = 0
for v in pair.values():
    m = max(m,v)
print(N-m)

Buggy submission (verdict: Runtime Error):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)


N = int(input())
pair=defaultdict(int)
xy = []
for i in range(N):
    x,y = map(int,input().split())
    xy.append((x,y))
for i in range(N):
    for j in range(N):
        if i != j
        pair[(xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])] += 1

m = 0
for v in pair.values():
    m = max(m,v)
print(N-m)
Problem p03008 (python)

Fixed submission:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)


def f(N,A,B):
    dp = [0]*(N+1)
    for i in range(N+1):
        x = i
        for j in range(3):
            if i >= A[j]:
                y = dp[i-A[j]]+B[j]
                if x < y:
                    x = y
        dp[i] = x
    return dp[N]
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
print(f(f(N,A,B),B,A))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
AB = [(A[i]/B[i],i) for i in range(3)]
AB.sort()
AB1 = deepcopy(AB)
ans = 0
M = N
for i in range(3):
    ab,j = AB1.pop(0)
    if ab >= 1:
        break
    else:
        ans += (M//A[j])*(B[j])
        M = M % A[j]
        ans += M
M = ans
ans = 0
for i in range(3):
    ab,j = AB.pop()
    if ab < 1:
        break
    else:
        ans += (M//B[j])*(A[j])
        M = M % B[j]
        ans += M
print(ans)
Problem p03026 (python)

Fixed submission:
from itertools import*
import math
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N = int(input())
D =[[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    D[a].append(b)
    D[b].append(a)

c = sorted(list(map(int,input().split())))
vcost = [-1]*(N+1)
vcost[1]=c.pop()
ans = 0
def dfs(i):
    global ans
    for j in D[i]:
        if vcost[j]==-1:
            vcost[j]=c.pop()
            ans += vcost[j]
            dfs(j)
dfs(1)
print(ans)
print(*vcost[1:])

Buggy submission (verdict: Runtime Error):
N = int(input())
D =[[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    D[a].append(b)
    D[b].append(a)

c = sorted(list(map(int,input().split())))
vcost = [-1]*(N+1)
vcost[1]=c.pop()
ans = 0
def dfs(i):
    global ans
    for j in D[i]:
        if vcost[j]==-1:
            vcost[j]=c.pop()
            ans += vcost[j]
            dfs(j)
dfs(1)
print(ans)
print(*vcost[1:])
Problem p03039 (python)

Fixed submission:
from itertools import*
import math
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

n,m,k = map(int,input().split())
Max = n*m
#二項係数とその逆元テーブルを作る前処理
fac = [0]*(Max)
finv = [0]*(Max)
inv = [0]*(Max)
fac[0]=fac[1]=1
finv[0]=finv[1]=1
inv[1]=1
for i in range(2,Max):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i]*(mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
#O(1)でmod計算した組合せ数を計算
def C(n,r):
    if n < r:
        return 0
    if n < 0 or r < 0 :
        return 0
    return fac[n]*(finv[r]*finv[n-r]%mod)%mod
#mod計算した順列の計算
def P(n,r):
    if n < r:
        return 0
    if n<0 or r<0:
        return 0
    return (fac[n]*finv[n-r])%mod


c = C(n*m-2,k-2)
res = 0

for i in range(1,n):
    res += i * (n-i) *(m**2)*c
    res %= mod

for i in range(1,m):
    res += i*(m-i)*(n**2)*c
    res %= mod
print(res)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
Max = n*m
#二項係数とその逆元テーブルを作る前処理
fac = [0]*(Max)
finv = [0]*(Max)
inv = [0]*(Max)
fac[0]=fac[1]=1
finv[0]=finv[1]=1
inv[1]=1
for i in range(2,Max):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i]*(mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
#O(1)でmod計算した組合せ数を計算
def C(n,r):
    if n < r:
        return 0
    if n < 0 or r < 0 :
        return 0
    return fac[n]*(finv[r]*finv[n-r]%mod)%mod
#mod計算した順列の計算
def P(n,r):
    if n < r:
        return 0
    if n<0 or r<0:
        return 0
    return (fac[n]*finv[n-r])%mod


c = C(n*m-2,k-2)
res = 0

for i in range(1,n):
    res += i * (n-i) *(m**2)*c
    res %= mod

for i in range(1,m):
    res += i*(m-i)*(n**2)*c
    res %= mod
print(res)