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

Fixed submission:
import math
import itertools

n = int(input())
a = list(map(int, input().split()))
pf = [0]*(n+1)
pb = [0]*(n+1)
p = a[0]
for i in range(n):
  p = math.gcd(p, a[i])
  pf[i+1] = p
p = a[-1]
for i in range(-1, -n-1, -1):
  p = math.gcd(p, a[i])
  pb[i-1] = p
ans = [0]*n
for i in range(n):
  ans[i] = math.gcd(pf[i], pb[i+1])
print(max(ans))

Buggy submission (verdict: Runtime Error):
import math
import sys

n = input()
a = list(map(int, input().split()))
b = sorted(a)
c = set(b)
if len(c) == 1:
  print(c[0])
  sys.exit()
pl = []
ql = []
for i in b[1:]:
  pl.append(math.gcd(b[0], i))
for i in b[2:]:
  ql.append(math.gcd(b[1], i))
pls = sorted(pl)
qls = sorted(ql)
if len(qls) == 0:
  print(pls[min(1, len(pls) - 1)])
else:
  print(max(pls[min(1, len(pls) - 1)], qls[0]))

Buggy submission (verdict: Runtime Error):
import math
import sys

n = input()
a = list(map(int, input().split()))
b = sorted(set(a))
if len(b) == 1:
  print(b[0])
  sys.exit()
pl = []
ql = []
for i in b[1:]:
  pl.append(math.gcd(b[0], i))
for i in b[2:]:
  ql.append(math.gcd(b[1], i))
pls = sorted(pl)
qls = sorted(ql)
print(max(pls[1], qls[min(1, len(qls) - 1)]))
Problem p03112 (python)

Fixed submission:
import bisect

a,b,q=map(int,input().split())
s = []
t = []
for i in range(a):
  s.append(int(input()))
for i in range(b):
  t.append(int(input()))
for _ in range(q):
  x = int(input())
  
  ans = [0,0,0]
  
  i = bisect.bisect_left(s,x)
  if i == 0:
    sl = 100000000000
  else:
    sl = abs(s[i-1]-x)
  if i == a:
    sr = 100000000000
  else:
    sr = abs(s[i]-x)
  i = bisect.bisect_left(t,x)
  if i == 0:
    tl = 100000000000
  else:
    tl = abs(t[i-1]-x)
  if i == b:
    tr = 100000000000
  else:
    tr = abs(t[i]-x)
  ans[0] = max(tl,sl)
  ans[1] = max(tr,sr)
  ans[2] = min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl)
  print(min(ans))

Buggy submission (verdict: Runtime Error):
import bisect

a,b,q=map(int,input().split())
s = []
t = []
for i in range(a):
  s.append(int(input()))
for i in range(b):
  t.append(int(input()))
for _ in range(q):
  x = int(input())
  
  ans = [0,0,0,0]
  
  if x in s:
    sl = x
    sr = x
  else:
    i = bisect.bisect_left(s,x)
    sl = s[max(i-1,0)]
    sr = s[min(i,a-1)]
  if sl in t:
    tl = sl
    tr = sl
  else:
    j = bisect.bisect_left(t,sl)
    tl = t[max(j-1,0)]
    tr = t[min(j,b-1)]
  ans[0] = abs(sl-x) + min(abs(tl-sl), abs(tr-sl))
  if sr in t:
    tl = sr
    tr = sr
  else:
    j = bisect.bisect_left(t,sr)
    tl = t[j]
    tr = t[min(j+1,b-1)]
  ans[1] = abs(sr-x) + min(abs(tl-sr), abs(tr-sr))
  
  if x in t:
    tl = x
    tr = x
  else:
    i = bisect.bisect_left(t,x)
    tl = t[max(i-1,0)]
    tr = t[min(i,b-1)]
  if tl in s:
    sl = tl
    sr = tl
  else:
    j = bisect.bisect_left(s,tl)
    sl = s[max(j-1,0)]
    sr = s[min(j,a-1)]
  ans[2] = abs(tl-x) + min(abs(sl-tl), abs(sr-tl))
  if tr in s:
    sl = tr
    sr = tr
  else:
    j = bisect.bisect_left(s,tr)
    sl = s[max(j-1,0)]
    sr = s[min(j,a-1)]
  ans[3] = abs(tr-x) + min(abs(sl-tr), abs(sr-tr))
  print(min(ans))
Problem p02640 (python)

Fixed submission:
x,y = map(int,input().split())

for i in range(x+1):
  for j in range(x+1):
    if 2*i+4*j == y and i+j == x:
      print("Yes")
      exit()

print("No")

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())

for i in range(X):
  for j in range(X):
    if 2*i+4*j == Y:
      print("Yes")
      exit()

print("No")
Problem p02677 (python)

Fixed submission:
import math

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

c = 0
timeA = H + (M/60)
argA = (1/12)*timeA

argB = (1/60)*M


sitaA = 360*argA
sitaB = 360*argB



if abs(sitaA-sitaB) == 180:
  print(A+B)
  exit()



if sitaA == sitaB:
  print(abs(B-A))
  exit()
elif sitaA > sitaB:
  c = math.sqrt(A**2 + B**2 - (2*A*B*math.cos(math.radians(sitaA-sitaB))))
elif sitaA < sitaB:
  c = math.sqrt(A**2 + B**2 - (2*A*B*math.cos(math.radians(sitaB-sitaA))))

print(c)

Buggy submission (verdict: Runtime Error):
import math

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


timeA = H + (M/60)
argA = (1/12)*timeA

argB = (1/60)*M


sitaA = 360*argA
sitaB = 360*argB



if argA == argB:
  print(abs(B-A))
elif argA > argB:
  c = math.sqrt(A**2 + B**2 - abs((2*A*B*math.cos(math.radians(sitaA-sitaB)))))
elif argA < argB:
  c = math.sqrt(A**2 + B**2 - abs((2*A*B*math.cos(math.radians(sitaB-sitaA)))))

print(c)
Problem p02706 (python)

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

A =[]

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

gokei = int(sum(A))

if N - gokei < 0:
  print('-1')

else:
  print(N - gokei)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

A =[]

for i in range(M):
  A.append(int(input().split()))

gokei = int(sum(A))

if N - gokei < 0:
  print('-1')

else:
  print(N - gokei)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

A =[]

for i in range(M):
  A.append(input())

gokei = int(sum(A))

if N - gokei < 0:
  print('-1')

else:
  print(N - gokei)
Problem p02582 (python)

Fixed submission:
s = input()
count = 0
ans = 0

for i in range(len(s)):
  if(s[i] == "R"):
    count += 1
  else:
    ans = max(count, ans)
    count = 0
ans = max(count, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
max = 0
i = 0
m = 0
while(i != len(S)):
  if S[i] == "R":
    m += 1
  
  else:
    max = max(max,m)
    m = 0
    break
  i += 1

print(max)
Problem p02657 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]
print(a*b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a*b)

Buggy submission (verdict: Runtime Error):
a = input()
b = input() 
print(a*b)
Problem p02683 (python)

Fixed submission:
N, M, X = [int(i) for i in input().split()]
CA = []
for i in range(N):
    CA.append([int(j) for j in input().split()])
#print(CA)
mcost = 10**10


for i in range(2**N):
    learn = [0]*M
    cost = 0
    bn = str(bin(i))[2:].zfill(N)
    #print(bn)
    for j,b in enumerate(bn):
        if b == "1":
            cost += CA[j][0]
            for m in range(M):
                learn[m] += CA[j][m+1]
                
    learn.sort()
    #print(learn)
    if learn[0] >= X:
        mcost = min(mcost, cost)

if mcost == 10**10:
    mcost = -1

print(mcost)

Buggy submission (verdict: Runtime Error):
N, M, X = [int(i) for i in input().split()]
CA = []
for i in range(N):
    CA.append([int(j) for j in input().split()])
#print(CA)
mcost = 10**10


for i in range(2**N):
    learn = [0]*M
    cost = 0
    bn = str(bin(i))[2:].zfill(M)
    #print(bn)
    for j,b in enumerate(bn):
        if b == "1":
            cost += CA[j][0]
            for m in range(M):
                learn[m] += CA[j][m+1]
                
    learn.sort()
    if learn[0] >= X:
        mcost = min(mcost, cost)

if mcost == 10**10:
    mcost = -1

print(mcost)
Problem p02684 (python)

Fixed submission:
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
check = [0]*N
ima = 0

for i in range(K):
  if check[A[ima]-1] != 0:
    loopen = ima
    check[ima] = i+1
    looplen = check[ima] - check[A[ima]-1] + 1
    loopend = i
    break
  if i == K-1:
    print(A[ima])
    exit()
  check[ima] = i+1
  ima = A[ima]-1

offset = (K-(i-looplen)-1)%looplen
ima = 0
for i in range(loopend-looplen+offset+1):
  ima = A[ima]-1
print(ima+1)

Buggy submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
check = [0]*N
ima = 0
for i in range(K):
  if check[A[ima]-1] != 0:
    loopen = ima
    check[ima] = i+1
    looplen = check[ima] - check[A[ima]-1] + 1
    loopend = i
    break
  check[ima] = i+1
  ima = A[ima]-1
offset = (K-(i-looplen)-1)%looplen
ima = 0
for i in range(loopend-looplen+offset+1):
  ima = A[ima]-1
print(ima+1)
Problem p03101 (python)

Fixed submission:
HW = list(map(int, input().split()))
hw = list(map(int, input().split()))
 
print(HW[0]*HW[1] - hw[0]*HW[1] - HW[0]*hw[1] + hw[0]*hw[1])

Buggy submission (verdict: Runtime Error):
HW = list(map(int, input().split))
hw = list(map(int, input().split))

print(HW[0]*HW[1] - hw[0]*HW[1] - HW[0]*hw[1] + hw[0]*hw[1])
Problem p03106 (python)

Fixed submission:
abk = list(map(int,input().split()))

x=[]
for i in range(1,101):
    if(abk[0]%i==0 and abk[1]%i==0):
        x.append(i)
print(x[-abk[2]])

Buggy submission (verdict: Runtime Error):
abk = list(map(int,input().split()))

x=[]
for i in range(1,100):
    if(abk[0]%i==0 and abk[1]%i==0):
        x.append(i)

print(x[-2])
Problem p02536 (python)

Fixed submission:
def main():
    import sys
    from collections import deque

    N,M=list(map(int,sys.stdin.readline().split()))
    dic=[[] for _ in range(100001)]
    sys.setrecursionlimit(100001)
    mark=[0]*N
    for i in range(M):
        A,B=list(map(int,sys.stdin.readline().split()))
        dic[A-1].append(B-1)
        dic[B-1].append(A-1)


    i=0
    count=0
    while True:
        if not mark[i]:
            count+=1
            d=deque()
            d.appendleft(i)
            while d:
                a=d.popleft()
                mark[a]=1
                for j in dic[a]:
                    if mark[j]:
                        continue
                    
                    d.appendleft(j)
        i+=1
        if i==N:
            break
    
    print(count-1)
main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    N,M=list(map(int,sys.stdin.readline().split()))
    dic=[[] for _ in range(100001)]
    mark=[0]*N
    for i in range(M):
        A,B=list(map(int,sys.stdin.readline().split()))
        dic[A-1].append(B-1)
        dic[B-1].append(A-1)
    
    def dfs(idx):
        if mark[idx]:
            return
        mark[idx]=1
        for a in dic[idx]:
            dfs(a)

    i=0
    count=0
    while True:
        if not mark[i]:
            count+=1
            dfs(i)
        i+=1
        if i==N:
            break
    
    print(count-1)
main()
Problem p02537 (python)

Fixed submission:
def main():
    import sys
    from bisect import bisect_left
    N,K=list(map(int,sys.stdin.readline().split()))
    A=[0]*N
    for i in range(N):
        A[i]=int(sys.stdin.readline())

    dp=[0]*(N+1)
    dp[0]=1
    if abs(A[0]-A[1])<=K:
        dp[1]=2
    else:
        dp[1]=1
    
    for i in range(2,N):
        mx=1
        for j in range(1,105):
            if i-j<0:
                break
            if abs(A[i-j]-A[i])<=K:
                mx=max(mx,dp[i-j]+1)

        dp[i]=mx

    print(max(dp))


main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    from bisect import bisect_left
    N,K=list(map(int,sys.stdin.readline().split()))
    A=[0]*N
    for i in range(N):
        A[i]=int(sys.stdin.readline())

    dp=[0]*(N+1)
    dp[0]=1
    if abs(A[0]-A[1])<=K:
        dp[1]=2
    else:
        dp[1]=1
    
    for i in range(2,N):
        mx=-1
        for j in range(1,100):
            if abs(A[i-j]-A[i])<=K:
                mx=max(mx,dp[i-2]+1)

        dp[i]=mx        

    print(max(dp))


main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    from collections import deque

    N,M=list(map(int,sys.stdin.readline().split()))
    dic=[[] for _ in range(100001)]
    sys.setrecursionlimit(100001)
    mark=[0]*N
    for i in range(M):
        A,B=list(map(int,sys.stdin.readline().split()))
        dic[A-1].append(B-1)
        dic[B-1].append(A-1)


    i=0
    count=0
    while True:
        if not mark[i]:
            count+=1
            d=deque()
            d.appendleft(i)
            while d:
                a=d.popleft()
                mark[a]=1
                for j in dic[a]:
                    if mark[j]:
                        continue
                    
                    d.appendleft(j)
        i+=1
        if i==N:
            break
    
    print(count-1)
main()
Problem p02609 (python)

Fixed submission:
def main():
    import sys
    N=int(sys.stdin.readline())
    X=sys.stdin.readline()

    no=X.count('1')
    np=no+1
    nm=no-1
    nm_flag=bool(nm)

    np_mods=[-1]*N
    nm_mods=[-1]*N
    
    np_mods[0]=1
    nm_mods[0]=1
    
    for i in range(1,N):
        np_mods[i]=(np_mods[i-1]*2)%np
        if nm_flag:
            nm_mods[i]=(nm_mods[i-1]*2)%nm

    np_mods.reverse()
    nm_mods.reverse()
    
    np_mods_sum=0
    nm_mods_sum=0
    for i in range(N):
        if X[i]=='1':
            np_mods_sum+=np_mods[i]
            nm_mods_sum+=nm_mods[i]

    for i in range(N):
        if X[i]=='0':
            n=(np_mods_sum+np_mods[i])%np

        else:
            if nm_flag:
                n=(nm_mods_sum-nm_mods[i])%nm
            else:
                print(0)
                continue
        if n==0:
            print(1)
            continue
        count=1
        while True:
            bs=str(bin(n))[2:]
            k=bs.count('1')
            n=n%k
            count+=1
            if n==0:
                break
        print(count)

main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    N=int(sys.stdin.readline())
    X=sys.stdin.readline()

    no=X.count('1')
    np=no+1
    nm=no-1

    np_mods=[-1]*N
    nm_mods=[-1]*N
    
    np_mods[0]=1
    nm_mods[0]=1
    
    for i in range(1,N):
        np_mods[i]=(np_mods[i-1]*2)%np
        nm_mods[i]=(nm_mods[i-1]*2)%nm

    np_mods.reverse()
    nm_mods.reverse()

    np_mods_sum=0
    nm_mods_sum=0
    for i in range(N):
        if X[i]=='1':
            np_mods_sum+=np_mods[i]
            nm_mods_sum+=nm_mods[i]

    for i in range(N):
        if X[i]=='0':
            n=(np_mods_sum+np_mods[i])%np

        else:
            n=(nm_mods_sum-nm_mods[i])%nm

        if n==0:
            print(1)
            continue
        count=1
        while True:
            bs=str(bin(n))[2:]
            k=bs.count('1')
            n=n%k
            count+=1
            if n==0:
                break
        print(count)

main()
Problem p02678 (python)

Fixed submission:
def main():
    import sys
    from collections import defaultdict,deque
    sys.setrecursionlimit(10**5+2)

    N,M=list(map(int,sys.stdin.readline().split()))
    dic=defaultdict(list)
    for i in range(M):
        A,B=list(map(int,sys.stdin.readline().split()))
        dic[A].append(B)
        dic[B].append(A)
    
    L=[-1]*(N+1)
    R=[-1]*(N+1)


    d = deque()
    d.append((1,1))
    while len(d):
        now,count=d.popleft()
        for goto in dic[now]:
            if L[goto]==-1 or count<L[goto]:
                L[goto]=count
                R[goto]=now
                d.append((goto,count+1))

    if any(x+1 for x in R[2:]):
        print('Yes')
        for x in R[2:]:
            print(x)
    else:
        print('No')
    


main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    from collections import defaultdict
    sys.setrecursionlimit(10**5+2)
    
    N,M=list(map(int,sys.stdin.readline().split()))
    dic=defaultdict(list)
    for i in range(M):
        A,B=list(map(int,sys.stdin.readline().split()))
        dic[A].append(B)
        dic[B].append(A)

    L=[-1]*(N+1)
    R=[-1]*(N+1)

    def dfs(now,count):
        for goto in dic[now]:
            if L[goto]==-1 or count<L[goto]:
                L[goto]=count
                R[goto]=now
                dfs(goto,count+1)

    dfs(1,1)
    if any(x+1 for x in R[2:]):
        print('Yes')
        for x in R[2:]:
            print(x)
    else:
        print('No')
    


main()
Problem p02760 (python)

Fixed submission:
def main():
    import numpy as np
    A=[]
    for _ in range(3):
        A.append(list(map(int,input().split())))
    
    R=np.zeros((3,3))
    K=[]
    for a in A:
        K+=a

    N=int(input())
    for i in range(N):
        b=int(input())
        if b not in K:
            continue
        
        idx=K.index(b)
        R[idx//3,idx%3]=1

    if any( all(x) for x in R.tolist()) or any(all(x) for x in R.T.tolist()):
        print('Yes')
    elif R[0,0] and R[1,1] and R[2,2] or R[0,2] and R[1,1] and R[2,0]:
        print('Yes')
    else:
        print('No')
        
main()

Buggy submission (verdict: Runtime Error):
def main():
    import numpy as np
    A=[]
    for _ in range(3):
        A.append(list(map(int,input().split())))
    
    R=np.zeros((3,3))
    K=[]
    for a in A:
        K+=a

    N=int(input())
    for i in range(N):
        b=int(input())
        if b not in K:
            continue
        
        idx=K.index(b)
        R[idx//3,idx%3]=1

    if any( all(x) for x in R.tolist()) or any(all(x) for x in R.T.tolist()):
        print('Yes')
    elif R[0,0] and R[1,1] and R[2,2] or R[0,2] and R[1,1] and R[2,0]:
        print('Yes')
    else:
        print('No')
        
main()
Problem p02804 (python)

Fixed submission:
def cmb(n, r, mod,g1,g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod



def main():
    mod = 10**9+7 #出力の制限
    N = 10**5+1
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))
    A.sort()
    if K==1:
        print(0)
        return

    rcom=[0]*N
    rcom[0]=A[-1]
    for i in range(1,N):
        rcom[i]=rcom[i-1]+A[-i-1]

    lcom=[0]*N
    lcom[0]=A[0]
    for i in range(1,N):
        lcom[i]=lcom[i-1]+A[i]

    result=0
    for i in range(N-1):
        result+=(rcom[i]-lcom[i])*cmb(N-2-i,K-2,mod,g1,g2)
        result%=(10**9+7)

    print(result)

main()

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod,g1,g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod



def main():
    mod = 10**9+7 #出力の制限
    N = 10**4
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))
    A.sort()
    if K==1:
        print(0)
        return

    rcom=[0]*N
    rcom[0]=A[-1]
    for i in range(1,N):
        rcom[i]=rcom[i-1]+A[-i-1]

    lcom=[0]*N
    lcom[0]=A[0]
    for i in range(1,N):
        lcom[i]=lcom[i-1]+A[i]

    result=0
    for i in range(N-1):
        result+=(rcom[i]-lcom[i])*cmb(N-2-i,K-2,mod,g1,g2)
        result%=(10**9+7)

    print(result)

main()
Problem p03006 (python)

Fixed submission:
import collections
LX=[]
LY=[]
def Solve():
    N=int(input())
    for i in range(N):
        x,y=(int(t) for t in input().split())
        LX.append(x)
        LY.append(y)
        
    if N==1:
        return 1
    
    LLX=[]
    LLY=[]
    for i,x1 in enumerate(LX):
        for j,x2 in enumerate(LX):
            if i==j:
                continue
            LLX.append(x2-x1)

    for i,y1 in enumerate(LY):
        for j,y2 in enumerate(LY):
            if i==j:
                continue
            LLY.append(y2-y1)


    LLL=[str(dx)+'&'+str(dy) for dx,dy in zip(LLX,LLY)]

    return N-collections.Counter(LLL).most_common(1)[0][1]

print(Solve())

Buggy submission (verdict: Runtime Error):
import collections
LX=[]
LY=[]
N=int(input())
for i in range(N):
    x,y=(int(t) for t in input().split())
    LX.append(x)
    LY.append(y)

LLX=[]
LLY=[]
for i,x1 in enumerate(LX):
    for j,x2 in enumerate(LX):
        if i==j:
            continue
        LLX.append(x2-x1)

for i,y1 in enumerate(LY):
    for j,y2 in enumerate(LY):
        if i==j:
            continue
        LLY.append(y2-y1)


LLL=[str(dx)+'&'+str(dy) for dx,dy in zip(LLX,LLY)]

print(N-collections.Counter(LLL).most_common(1)[0][1])
Problem p03076 (python)

Fixed submission:
L=[]
L2=[]
for i in range(5):
    I=int(input())
    L.append(I)
    L2.append(I%10)

result=0
for i in L:
    result+=i
    if result%10==0:
        continue
    for j in range(10):
        result+=1
        if result%10==0:
            break

if max(L2)==0:
    print(sum(L))
else:
    if min(L2)==0:
        for t in sorted(L2):
            if t==0:
                pass
            else:
                mn=t
                break
    else:
        mn=min(L2)

    print(result-(10-mn))

Buggy submission (verdict: Runtime Error):
L=[]
L2=[]
for i in range(5):
    I=int(input())
    L.append(I)
    L2.append(I%10)

result=0
for i in L:
    result+=i
    if result%10==0:
        continue
    for j in range(10):
        result+=1
        if result%10==0:
            break

if min(L2)==0:
    for t in sorted(L2):
        if t==0:
            pass
        else:
            mn=t
            break
else:
    mn=min(L2)

print(result-(10-mn))
Problem p03095 (python)

Fixed submission:
N=int(input())
S=input()
R=""
L=[]
obj={}
for s in S:
    if s not in L:
        R+=s
        L.append(s)
        obj[s]=1
    else:
        obj[s]+=1

out=1
for a in obj.keys():
    out*=(obj[a]+1)
    if out>10**9+7:
        out=out%(10**9+7)
print(out-1)

Buggy submission (verdict: Runtime Error):
_=input()
S=input()

"""
S=""
import random
AL=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(10):
    t=int(random.random()*20)
    S+=AL[t]
    print(AL[t])
    print(S)
print(S)
"""
obj={}
L=[]
r=1
for i in S:
    if i in L:
        obj[S[i]]+=1
        r=r*(1+1/(2**obj[i]))
    else:
        r*=2
        obj[i]=0
        L.append(i)

    if r>(10**9+7):
        r-=(10**9+7)
        
print(r-1)

Buggy submission (verdict: Runtime Error):
_=input()
S=input()
L=[]
r=1
for i in range(len(S)):
    if S[i] in L:
        r=int(r*(3/2))
    else:
        r*=2
        L.append(S[i])

print((r-1)%(10**9+7))
Problem p03105 (python)

Fixed submission:
A,B,C=[int(x) for x in input().split()]
print(min(int(B/A),C))

Buggy submission (verdict: Runtime Error):
A,B,C=(int() for x in input().split())
print(min(C,A//B))
Problem p03139 (python)

Fixed submission:
N,A,B=input().split()
N=int(N)
A=int(A)
B=int(B)
if A+B-N<0:
    print(str(min(A,B))+" 0")
else:
    print(str(min(A,B))+" "+str(A+B-N))

Buggy submission (verdict: Runtime Error):
N=int(input())
LA=[0]*N
LD=[0]*N
for i in range(N):
    A,B=input().split()
    LA[i]=int(A)
    LD[i]=int(A)+int(B)

isRunned=True
while(isRunned):
    isRunned=False
    for i in range(N-1):
        if LD[i]<LD[i+1]:    
            LD[i],LD[i+1]=LD[i+1],LD[i]
            LA[i],LA[i+1]=LA[i+1],LA[i]
            isRunned=True
        

print(sum(LA[::2])-(sum(LD[1::2])-sum(LA[1::2])))

Buggy submission (verdict: Runtime Error):
N=int(input())
LA=[0]*N
LB=[0]*N
for i in range(N):
    A,B=[int(x) for x in input().split()]
    LA[i]=A
    LB[i]=B

PA=0
PB=0

LD=[0]*N
for i in range(N):
    LD[i]=LA[i]+LB[i]

isRunned=True
while(isRunned):
    isRunned=False
    for i in range(N-1):
        if LD[i]<LD[i+1]:
            LD[i],LD[i+1]=LD[i+1],LD[i]
            LA[i],LA[i+1]=LA[i+1],LA[i]
            LB[i],LB[i+1]=LB[i+1],LB[i]
            isRunned=True
        

print(sum(LA[::2])-sum(LB[1::2]))

Buggy submission (verdict: Runtime Error):
N=int(input())
LA=[0]*N
LB=[0]*N
for i in range(N):
    A,B=[int(x) for x in input().split()]
    LA[i]=A
    LB[i]=B

PA=0
PB=0

LD=[0]*N
for i in range(N):
    LD[i]=LA[i]+LB[i]


SLD=sorted(LD)
SLD.reverse()
if N%2==0:
    for i in range(0,N,2):
        PA+=LA[LD.index(SLD[i])]
        PB+=LB[LD.index(SLD[i+1])]
else:
    for i in range(0,N-1,2):
        PA+=LA[LD.index(SLD[i])]
        PB+=LB[LD.index(SLD[i+1])]

    PA+=LA[LD.index(SLD[N-1])]

print(PA-PB)