Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
buffer = list(input())
S = list(map(int, buffer))
N = len(S)
i = 0
count = 0
while(1):
    if(S == [] or N == 1):
        break
    elif((S[i] + S[i + 1]) == 1):
        S.pop(i)
        S.pop(i)
        i = i - 1
        count += 2
        N = len(S)
    else:
        i += 1
        if(i == (N - 1)):
            break
print(count)

Fixed submission:
S = list(input())
count_bule = S.count('0')
count_red = S.count('1')
count_min = min(count_bule, count_red)
print(2 * count_min)

Buggy python submission (verdict: Time Limit Exceeded):
buffer = list(input())
S = list(map(int, buffer))
N = len(S)
i = 0
count = 0
while(1):
    if(S == [] or N == 1):
        break
    elif((S[i] + S[i + 1]) == 1):
        S.pop(i)
        S.pop(i)
        i = 0
        count += 2
        N = len(S)
    else:
        i += 1
        if(i == (N - 1)):
            break
print(count)

Fixed submission:
S = list(input())
count_bule = S.count('0')
count_red = S.count('1')
count_min = min(count_bule, count_red)
print(2 * count_min)

Buggy python submission (verdict: Time Limit Exceeded):
buffer = list(input())
S = list(map(int, buffer))
N = len(S)
i = 0
count = 0
while(1):
    if(S == [] or N == 1):
        break
    elif((S[i] + S[i + 1]) == 1):
        S.pop(i)
        S.pop(i)
        i = 0
        count += 2
        N = len(S)
    else:
        i += 1
        if(i == (N - 1)):
            break
print(count)

Fixed submission:
S = list(input())
count_bule = S.count('0')
count_red = S.count('1')
count_min = min(count_bule, count_red)
print(2 * count_min)

Buggy python submission (verdict: Time Limit Exceeded):
buffer = list(input())
S = [int(n) for n in buffer]
N = len(S)
i = 0
count = 0
while(1):
    if(S == [] or N == 1):
        break
    elif((S[i] + S[i + 1]) == 1):
        S.pop(i)
        S.pop(i)
        i = 0
        count += 2
        N = len(S)
    else:
        i += 1
        if(i == (N - 1)):
            break
print(count)

Fixed submission:
S = list(input())
count_bule = S.count('0')
count_red = S.count('1')
count_min = min(count_bule, count_red)
print(2 * count_min)

Buggy python submission (verdict: Time Limit Exceeded):
buffer = list(input())
S = [int(n) for n in buffer]
N = len(S)
i = 0
count = 0
while(1):
    
    if(S == [] or N == 1):
        break
    elif(S[i] != S[i + 1]):
        S.pop(i)
        S.pop(i)
        i = 0
        count += 2
        N = len(S)
    else:
        i += 1
        if(i == (N - 1)):
            break
print(count)

Fixed submission:
S = list(input())
count_bule = S.count('0')
count_red = S.count('1')
count_min = min(count_bule, count_red)
print(2 * count_min)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))
 
INF = 10**9
dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
 
for i in range(2, N):
  for j in range(1, min(i, K) + 1):
    dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print(dp[N - 1])


Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * N
for i, hi in enumerate(h):
  if i > 0:
    x = max(0, i - K)
    dp[i] = min([dpj + abs(hi - hj) for hj, dpj in zip(h[x:i], dp[x:i])])
print(dp[N - 1])

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  N, K = map(int, input().split())
  h = list(map(int, input().split()))
  
  INF = 10**9
  dp = [INF] * N
  dp[0] = 0
  dp[1] = abs(h[1] - h[0])
  
  for i in range(2, N):
    for j in range(1, K + 1):
      if i - j >= 0:
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
  print(dp[N - 1])

if __name__ == "__main__":
  solve()

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * N
for i, hi in enumerate(h):
  if i > 0:
    x = max(0, i - K)
    dp[i] = min([dpj + abs(hi - hj) for hj, dpj in zip(h[x:i], dp[x:i])])
print(dp[N - 1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * N
for i in range(N):
  if i > 0:
    dp[i] = min([dp[i - j] + abs(h[i] - h[i - j]) if i - j >= 0 else 10**9 for j in range(1, K + 1)])
print(dp[N - 1])


Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * N
for i, hi in enumerate(h):
  if i > 0:
    x = max(0, i - K)
    dp[i] = min([dpj + abs(hi - hj) for hj, dpj in zip(h[x:i], dp[x:i])])
print(dp[N - 1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))

INF = 10**9
dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, N):
  for j in range(1, K + 1):
    if i - j >= 0:
      dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print(dp[N - 1])


Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * N
for i, hi in enumerate(h):
  if i > 0:
    x = max(0, i - K)
    dp[i] = min([dpj + abs(hi - hj) for hj, dpj in zip(h[x:i], dp[x:i])])
print(dp[N - 1])
Buggy python submission (verdict: Runtime Error):
from collections import  defaultdict
from collections import deque
import math
N = int(input())

AB = [list(map(int,input().split())) for _ in range(N-1)]


d = defaultdict(list)

for a,b in AB:
    d[a-1].append(b-1)
    d[b-1].append(a-1)


def get_distance(start):
    visited = set([start,])
    distance = [999999999999999999 for _ in range(N)]
    distance[start ] =0
    to_visit = deque([ (1,a) for a in d[start]])

    while to_visit:
        dist,now = to_visit.popleft()
        visited.add(now)
        distance[now]=dist
        for a in d[now]:
            if a not in visited:
                to_visit.append((dist+1,a))

    return distance



a =(get_distance(0))
b= (get_distance(N-1))


for i in range(N):
    if a[i]==b[i] or a[i]==b[i]+1:
        middle_a = i
        #middle_b
        for j in d[i]:
            if b[j]==b[i]-1:
                middle_b = j

"""
print(a)
print(b)
print(middle_a)
print(middle_b)
"""
x = get_distance(0)
max_ = math.ceil(x[N-1]/2)





d[middle_a].remove(middle_b)
d[middle_b].remove(middle_a)

a_new = (get_distance(0))
b_new = (get_distance(N-1))
if sum( q<99999999999999999 for q in a_new ) >sum( q<99999999999999999 for q in b_new ):
    print("Fennec")
else:
    print("Snuke")
#route to -1
#0
#N-1





Fixed submission:
from collections import  defaultdict
from collections import deque
import math
N = int(input())

AB = [list(map(int,input().split())) for _ in range(N-1)]


d = defaultdict(list)

for a,b in AB:
    d[a-1].append(b-1)
    d[b-1].append(a-1)


def get_distance(start):
    visited = set([start,])
    distance = [999999999999999999 for _ in range(N)]
    distance[start ] =0
    to_visit = deque([ (1,a) for a in d[start]])

    while to_visit:
        dist,now = to_visit.popleft()
        visited.add(now)
        distance[now]=dist
        for a in d[now]:
            if a not in visited:
                to_visit.append((dist+1,a))

    return distance



a =(get_distance(0))
b= (get_distance(N-1))

distance_ = a[N-1]

def get_close(a,i):
    l = list(sorted([(a[x],x) for x in d[i]]))
    return l[0][1]

tmp = N-1
for i in range((distance_+1)//2-1):
   tmp = get_close(a,tmp)

middle_a = get_close(a,tmp)
middle_b = tmp



x = get_distance(0)
max_ = math.ceil(x[N-1]/2)





d[middle_a].remove(middle_b)
d[middle_b].remove(middle_a)


a_new = (get_distance(0))
b_new = (get_distance(N-1))
"""
print(a)
print(b)
print(middle_a)
print(middle_b)
print(a_new,b_new)
"""
if sum( q<99999999999999999 for q in a_new ) >sum( q<99999999999999999 for q in b_new ):
    print("Fennec")
else:
    print("Snuke")
Buggy python submission (verdict: Runtime Error):
D=input()
if D==25:
  print("Christmas")
  elif D==24:
    print("Christmas Eve")
    elif D==23:
      print("Christmas Eve Eve")
      elif D==22:
        print("Christmas Eve Eve Eve")
        

Fixed submission:
D=int(input())
if D==25:
  print("Christmas")
elif D==24:
  print("Christmas Eve")
elif D==23:
  print("Christmas Eve Eve")
elif D==22:
  print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
N=int(input())
cnt=0
ans=0
max=0
while cnt<N:
  cnt++
  p=int(input())
  ans += p
  if p>max:
    max=p
ans-=(max/2)
print(ans)

Fixed submission:
N=int(input())
cnt=0
ans=0
max=0
while cnt<N:
  cnt+=1
  p=int(input())
  ans += p
  if p>max:
    max=p
ans-=int(max/2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
MAX = 26

def has_same_chr(s):
    for i in range(0, len(s)):
        for j in range(i+1, len(s)):
            if s[i] == s[j]:
                #print("{}, {}:{}".format(i,j,s[i]))
                return False
    return True

# 長さlengthの部分文字列をsから取得してs_retに付与してs_listに追加して返す
def get_partial_strings(length, s_ret, s_list, s):
    if length == 0:
        #print("s_ret:{}".format(s_ret))
        return s_ret
    
    for i in range(0, len(s)):
        new_ret = s_ret + s[i]
        #print("new:{}, s:{}".format(new_ret, s[i+1:]))
        s_list.append(get_partial_strings(length-1, new_ret, s_list, s[i+1:]))
    
    return s_list
    

l=int(input())
s=input()

ret = 0
max = MAX
if l < MAX:
    max = l
for i in range(1,l+1):
    strs = []
    for string in get_partial_strings(i, "", strs, s):
        if has_same_chr(string):
            #print(string)
            ret += 1

print(ret)


Fixed submission:
KIND = 26
l=int(input())
s=input()

alpha_list = []
for i in range(0, KIND):
    alpha_list.append(0)

for i in s:
    alpha_list[ord(i)-ord('a')] += 1

ret = 1
for num in alpha_list:
    ret *= (num + 1)
print((ret-1)%(1000000000+7))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

import sys

lines = sys.stdin.readlines()

n,a,b,c = lines
n = int(n.strip('\n'))
a = str(a.strip('\n'))
b = str(b.strip('\n'))
c = str(c.strip('\n'))

num = 0
if not(n == a == b == c):
  for i in range(n):
    if not(a[i] == b[i] == c[i]):
      if a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        num = num+1
      else:
        num = num+2

print(num)       

sys.exit(0)


Fixed submission:
# coding: utf-8

import sys
import math

args = input().split()

n = int(args[0])
a = int(args[1])
b = int(args[2])

reta = a
retb = (n - a) - b

if retb > 0:
  retb = 0
else:
  retb = abs(retb)

print('{reta} {retb}'.format(reta=min(a,b),retb=retb))

sys.exit(0)
Buggy python submission (verdict: Runtime Error):
s=input()
answer-0
counter=0
for i in range(len(s)-1,-1,-1):
    if s[i]=="B":
        answer += len(s)-i-1-counter
        counter += 1
print(answer)
  
    

Fixed submission:
S = input()
ans = 0
count = 0
for i in range(len(S)-1, -1, -1):
    if S[i] == "B":
        ans += len(S)-i-1-count
        count += 1
 
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
answer-0
counter=0
for i in range(len(s)-1,-1,-1):
  if s[i]=="B":
    answer += len(s)-i-1-counter
    counter += 1
print(answer)
  
    
    

Fixed submission:
S = input()
ans = 0
count = 0
for i in range(len(S)-1, -1, -1):
    if S[i] == "B":
        ans += len(S)-i-1-count
        count += 1
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
counter=0
while "BW" in s:
    s.replace("BW","WB")
    counter+=1
print(counter)
  

Fixed submission:
S = input()
ans = 0
count = 0
for i in range(len(S)-1, -1, -1):
    if S[i] == "B":
        ans += len(S)-i-1-count
        count += 1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
l =[]
#deal with error
for i in range(N):
    l.append(int(input()))
    if i == 0 and l[i]!=0:
        print(-1)
        break
    if i>=1:
        if l[i]-l[i-1]>1 :
            print(-1)
            break

counter=0#answerになる。
counter_n=l[0]#listの中の重複を数える。
l = l[::-1]
for i in range(N-1):
    if l[i]<l[i+1]:
        counter+=counter_n
        counter_n=0#初期化
    elif l[i]==l[i+1]:
        if counter_n == 0:
            counter_n = 2*l[i]
        else:
            counter_n += l[i]
        counter_n += l[i]
    elif l[i] == l[i+1]+1:
        counter += 1
counter += counter_n
print(counter)
        
        


Fixed submission:
import sys
N = int(input()) 
A = [int(sys.stdin.readline()) for _ in range(N)]
b = 0
for i, a in enumerate(A):
    if i + b < a:
        print(-1)
        sys.exit()
    else:
        b = a - i
ans = 0
pre = -1
for a in A[::-1]:
    if pre - 1 != a:
        ans += a
    pre = a
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))

tmp = [int(1e9)] * (N+10)
for i in range(K):
    if i < len(h):
        tmp[i] = abs(h[i] - h[0])

for i in range(K, N):
    m = int(1e9)
    for j in range(K):
        if i - K >= 0:
            m = min(m, tmp[i-j-1]+abs(h[i]-h[i-j-1]))
            tmp[i] = m


print(tmp[N-1])

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))

tmp = [int(1e9)] * (N+10)
for i in range(K):
    if i < len(h):
        tmp[i] = abs(h[i] - h[0])

for i in range(K, N):
    m = int(1e9)
    for j in range(K):
        if i - K >= 0:
            m = min(m, tmp[i-j-1]+abs(h[i]-h[i-j-1]))
            tmp[i] = m


print(tmp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1, N+1):
    w, v = map(int, input().split())
    for j in range(0, W+1):
        if j >= w:
            dp[i][j] = max(dp[i][j], dp[i-1][j-w] + v)
        dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1, N+1):
    w, v = map(int, input().split())
    for j in range(0, W+1):
        if j >= w:
            dp[i][j] = max(dp[i][j], dp[i-1][j-w] + v)
        dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[N][W])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1, N+1):
    for j in range(0, W+1):
        if j >= w[i-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]] + v[i-1])
        dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1, N+1):
    w, v = map(int, input().split())
    for j in range(0, W+1):
        if j >= w:
            dp[i][j] = max(dp[i][j], dp[i-1][j-w] + v)
        dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
S = len(s)
T = len(t)
dp = [[0 for i in range(T+1)] for j in range(S+1)]

for i in range(S):
    for j in range(T):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

ans = ""
while S > 0 and T > 0:
    if dp[S][T] == dp[S-1][T]:
        S -= 1
    elif dp[S][T] == dp[S][T-1]:
        T -= 1
    else:
        ans = s[S-1] + ans
        S -= 1
        T -= 1

print(ans)

Fixed submission:
s = input()
t = input()
S = len(s)
T = len(t)
dp = [[0 for i in range(T+1)] for j in range(S+1)]

for i in range(S):
    for j in range(T):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

ans = ""
while S > 0 and T > 0:
    if dp[S][T] == dp[S-1][T]:
        S -= 1
    elif dp[S][T] == dp[S][T-1]:
        T -= 1
    else:
        ans = s[S-1] + ans
        S -= 1
        T -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
def dfs(start, used, n):
    count = 0
    used = used.copy()
    for i in range(start, len(S)):
        if len(used)+len(S)-i < n:
            break
        if S[i] in used:
            continue
        else:
            used.add(S[i])
            if len(used) == n:
                count += 1
            else:
                count += dfs(i+1, used, n)
            used.remove(S[i])
    return count
ans = 0
for i in range(N):
    ans += dfs(0, set(), i+1)
print(ans)

Fixed submission:
N = int(input())
S = input()
count = [0]*26
for ch in S:
    count[ord(ch)-ord('a')] += 1
ans = 1
for i in count:
    if i != 0:
        ans *= i+1
print((ans-1)%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s = list(s)
i = 0
j = 0
flg =0

if len(s) >1:
    while(1):
        for i in range(0,len(s)):
            if i == len(s)-1:
                flg = 1
                break
            elif s[i] != s[i+1]:
                s.pop(i+1)
                s.pop(i)
                j+=2
                break
            elif len(s) == 2:
                flg = 1
                break
            
        if len(s) ==0 or flg==1:
            break
        
print(j)

Fixed submission:
s = input()
a = s.count('1')
b = s.count('0')
print(min(a,b)*2)

Buggy python submission (verdict: Runtime Error):
s = input()
s = list(s)
i = 0
j = 0
flg =0

if len(s) >1:
    while(1):
        for i in range(len(s)+1):
            if s[i] != s[i+1]:
                s.pop(i+1)
                s.pop(i)
                j+=2
                break
            elif len(s) == 2:
                flg = 1
                break
        
        if len(s) ==0 or flg==1:
            break
        
print(j)

Fixed submission:
s = input()
a = s.count('1')
b = s.count('0')
print(min(a,b)*2)
Buggy python submission (verdict: Runtime Error):
from math import gcd
T = int(input())
for _ in range(T):
    A,B,C,D = map(int,input().split())
    if A < B or D < B:
        print('No')
    else:
        g = gcd(B,D)
        k = B//g
        r = (A-C)%B
        if r == 0:
            sm = C
        else:
            sm = C+r-B
        if sm < 0:
            print('No')
        else:
            s = sm%g
            if s + (k-1)*g <= C:
                print('Yes')
            else:
                print('No')

Fixed submission:
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b:
        a, b = b, a % b
    return a
T = int(input())
for _ in range(T):
    A,B,C,D = map(int,input().split())
    if A < B or D < B:
        print('No')
    else:
        g = gcd(B,D)
        k = B//g
        r = (A-C)%B
        if r == 0:
            sm = C
        else:
            sm = C+r-B
        if sm < 0:
            print('No')
        else:
            s = sm%g
            if s + (k-1)*g <= C:
                print('Yes')
            else:
                print('No')
Buggy python submission (verdict: Runtime Error):
s = int(input())
w = input()
S = ''
for i in range(0,len(w),s):
  S = S+w[i]
print(S)

Fixed submission:
w = input()
s = int(input())
S = ''
for i in range(0,len(w),s):
  S = S+w[i]
print(S)

Buggy python submission (verdict: Runtime Error):
s = int(input())
w = input()
S = ''
for i in range(0,len(w),s):
  S = S+w[i]

Fixed submission:
w = input()
s = int(input())
S = ''
for i in range(0,len(w),s):
  S = S+w[i]
print(S)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = list(map(int,input().split()))
n = A.index(min(A))
n2 = N-1-n
a,b = divmod(n,K-1)
c,d = divmod(n2,K-1)
if b == d == 0:
    print(a+c)
elif b+d < K
    print(a+c+1)
else:
    print(a+c+2)

Fixed submission:
N, K = map(int,input().split())
A = list(map(int,input().split()))
n = A.index(min(A))
n2 = N-1-n
a,b = divmod(n,K-1)
c,d = divmod(n2,K-1)
if b == d == 0:
    print(a+c)
elif b+d < K:
    print(a+c+1)
else:
    print(a+c+2)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = []
for _ in range(N):
    S.append(list(input()))
def taikaku(A):
    n = len(A)
    b = True
    for i in range(n):
        for j in range(n):
            if A[j][i] != A[i][j]:
                b = False
                break
        if not b:
            break
    return(b)
ans = 0
for i in range(N):
    if taikaku(S[i:]+S[:i]):
        ans += N
print(ans)

Fixed submission:
import collections
N = int(input())
S = []
for _ in range(N):
    S.append(list(input()))
def taikaku(A):
    n = len(A)
    b = True
    for i in range(n):
        for j in range(i+1):
            if A[j][i] != A[i][j]:
                b = False
                break
        if not b:
            break
    return(b)
ans = 0
for i in range(N):
    if taikaku(S[i:]+S[:i]):
        ans += N
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = []
for _ in range(N):
    S.append(list(input()))
def taikaku(A):
    n = len(A)
    A2 = []
    for i in range(n):
        p = []
        for j in range(n):
            p.append(A[j][i])
        A2.append(p)
    return(A == A2)
ans = 0
for i in range(N):
    if taikaku(S[i:]+S[:i]):
        ans += N
print(ans)

Fixed submission:
import collections
N = int(input())
S = []
for _ in range(N):
    S.append(list(input()))
def taikaku(A):
    n = len(A)
    b = True
    for i in range(n):
        for j in range(i+1):
            if A[j][i] != A[i][j]:
                b = False
                break
        if not b:
            break
    return(b)
ans = 0
for i in range(N):
    if taikaku(S[i:]+S[:i]):
        ans += N
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
c = False
s = 0
for i in range(N):
    ai,bi = map(int,input().split())
    s += ai
    if ai > bi:
        if not C:
            c = bi
        if bi < c:
            c = bi
if not c:
    print(0)
else:
    print(s-c)

Fixed submission:
N = int(input())
c = -1
s = 0
for i in range(N):
    ai,bi = map(int,input().split())
    s += ai
    if ai > bi:
        if c == -1:
            c = bi
        if bi < c:
            c = bi
if c == -1:
    print(0)
else:
    print(s-c)
Buggy python submission (verdict: Runtime Error):
a = input().split()
ans = []
for i in range(3):
    ans.append(a[i][i])
re = "".join(ans)
print(re)

Fixed submission:
ans = []
for i in range(3):
    a = input()
    ans.append(a[i])
re = "".join(ans)
print(re)

Buggy python submission (verdict: Runtime Error):
a = input().strip().split()
ans = []
for i in range(3):
    ans.append(a[i][i])
re = "".join(ans)
print(re)

Fixed submission:
ans = []
for i in range(3):
    a = input()
    ans.append(a[i])
re = "".join(ans)
print(re)

Buggy python submission (verdict: Runtime Error):
a = input().strip().split()
ans = []
for i in range(3):
    ans.append(a[i][i])
re = "".join(ans)
print(re)

Fixed submission:
ans = []
for i in range(3):
    a = input()
    ans.append(a[i])
re = "".join(ans)
print(re)
Buggy python submission (verdict: Runtime Error):
x,y=map(input().split())
print(x+y//2)

Fixed submission:
x,y=map(int,input().split())
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
p=[list(map(int,input().split()) for i in range(2))]

(p[0][0]-p[1][0])*(p[0][1]-p[1][1])

Fixed submission:
p=[list(map(int,input().split())) for i in range(2)]

print((p[0][0]-p[1][0])*(p[0][1]-p[1][1]))

Buggy python submission (verdict: Runtime Error):
p=[input().split() for i in range(2)]

(p[0][0]-p[1][0])*(p[0][1]-p[1][1])

Fixed submission:
p=[list(map(int,input().split())) for i in range(2)]

print((p[0][0]-p[1][0])*(p[0][1]-p[1][1]))

Buggy python submission (verdict: Runtime Error):
H,W=map(int, input().split())
h,w=map(int, input().split())

return H*W-h*W-w*H+h*w

Fixed submission:
p=[list(map(int,input().split())) for i in range(2)]

print((p[0][0]-p[1][0])*(p[0][1]-p[1][1]))

Buggy python submission (verdict: Runtime Error):
H,W=map(int.input().split())
h,w=map(int.input().split())

return H*W-h*W-w*H+h*w

Fixed submission:
p=[list(map(int,input().split())) for i in range(2)]

print((p[0][0]-p[1][0])*(p[0][1]-p[1][1]))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

c=a*b

if c%2==0:
  return 'Even'
else:
  return 'Odd'

Fixed submission:
a,b=map(int,input().split())

c=a*b

if c%2==0:
  print('Even')
else:
  print('Odd')