Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

#E
N,P=map(int,input().split())
S=input()
ans=0
if P in (2,5):
    for i,s in enumerate(S):
        if int(s)%P==0:
            ans+=i+1
else:
    cnt=[0 for _ in range(P)]
    CS=0
    for i,s in enumerate(S[::-1]):
        tmp2=(10**i)%P
        tmp=(int(s)*tmp2)%P
        CS=(CS+tmp)%P
        cnt[CS]+=1
        # print(CS)
        # print(cnt)
    for c in cnt:
        ans+=c*(c-1)//2
    ans+=cnt[0]
print(ans)

Fixed submission:
#E
N,P=map(int,input().split())
S=input()
ans=0
if P in (2,5):
    for i,s in enumerate(S):
        if int(s)%P==0:
            ans+=i+1
else:
    cnt=[0 for _ in range(P)]
    CS=0
    PLC=1
    for s in S[::-1]:
        tmp=(int(s)*PLC)%P
        CS=(CS+tmp)%P
        cnt[CS]+=1
        PLC=(PLC*10)%P
        # print(CS)
        # print(cnt)
    for c in cnt:
        ans+=c*(c-1)//2
    ans+=cnt[0]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#E
N,P=map(int,input().split())
S=input()
ans=0
if P in (2,5):
    for i,s in enumerate(S):
        if int(s)%P==0:
            ans+=i+1
else:
    cnt=[0 for _ in range(P)]
    CS=0
    for i,s in enumerate(S[::-1]):
        tmp=(int(s)*(10**i))%P
        CS=(CS+tmp)%P
        cnt[CS]+=1
        # print(CS)
        # print(cnt)
    for c in cnt:
        ans+=c*(c-1)//2
    ans+=cnt[0]
print(ans)

Fixed submission:
#E
N,P=map(int,input().split())
S=input()
ans=0
if P in (2,5):
    for i,s in enumerate(S):
        if int(s)%P==0:
            ans+=i+1
else:
    cnt=[0 for _ in range(P)]
    CS=0
    PLC=1
    for s in S[::-1]:
        tmp=(int(s)*PLC)%P
        CS=(CS+tmp)%P
        cnt[CS]+=1
        PLC=(PLC*10)%P
        # print(CS)
        # print(cnt)
    for c in cnt:
        ans+=c*(c-1)//2
    ans+=cnt[0]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
S=input()
ans=0
if P in (2,5):
    for i,s in enumerate(S):
        if int(s)%P==0:
            ans+=i+1
else:
    cnt=[0 for _ in range(P)]
    CS=0
    for i,s in enumerate(S[::-1]):
        CS=(CS+int(s)*(10**i))%P
        cnt[CS]+=1
        # print(CS)
        # print(cnt)
    for c in cnt:
        ans+=c*(c-1)//2
    ans+=cnt[0]
print(ans)

Fixed submission:
#E
N,P=map(int,input().split())
S=input()
ans=0
if P in (2,5):
    for i,s in enumerate(S):
        if int(s)%P==0:
            ans+=i+1
else:
    cnt=[0 for _ in range(P)]
    CS=0
    PLC=1
    for s in S[::-1]:
        tmp=(int(s)*PLC)%P
        CS=(CS+tmp)%P
        cnt[CS]+=1
        PLC=(PLC*10)%P
        # print(CS)
        # print(cnt)
    for c in cnt:
        ans+=c*(c-1)//2
    ans+=cnt[0]
print(ans)
Buggy python submission (verdict: Runtime Error):
# C
N,M=map(int,input().split())
cnd=[tuple(int(i) for i in input().split()) for j in range(M)]
ans=-1
for n in range(10**N-1):
    # print(n)
    flag=True
    n_str=str(n)
    for s,c in cnd:
        if n_str[s-1]!=str(c):
            # print(n_str[s-1],c)
            flag=False
            break
    if flag:
        ans=n
        break
print(ans)

Fixed submission:
# C
N,M=map(int,input().split())
cnd=[tuple(int(i) for i in input().split()) for j in range(M)]
ans=-1
for n in range(10**N):
    # print(n)
    flag=True
    n_str=str(n)
    if len(n_str)!= N:
        continue
    for s,c in cnd:
        if n_str[s-1]!=str(c):
            # print(n_str[s-1],c)
            flag=False
            break
    if flag:
        ans=n
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
# ceil関数(2引数)
def ceilT(a,b): #ceil(a/b)
    return (a+b-1)//b
H,A=map(int,input().split())
print(ceil(H,A))

Fixed submission:
# 0405の分もやる

# ABC153-C
if False:
    N,K=map(int,input().split())
    H=[int(i) for i in input().split()]
    H.sort(reverse=True)
    print(sum(H[K:]))

# ABC153-D
if False:
    H=int(input())
    cnt=1
    ans=0
    while H>1:
        ans+=cnt
        H//=2
        cnt*=2
    print(ans+cnt)

# ABC153-A
if True:
    # ceil関数
    def ceil(a,b): #ceil(a/b)
        return (a+b-1)//b

    H,A=map(int,input().split())
    print(ceil(H,A))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=[int(i) for i in input().split()]
H.append(0)
H.sort()
for _ in range(K):
  H.pop()
print(sum(H))

Fixed submission:
#ABC153-C
N,K=map(int,input().split())
H=[int(i) for i in input().split()]
H.sort(reverse=True)
print(sum(H[K:]))
Buggy python submission (verdict: Time Limit Exceeded):
#全てのマスに対して、そこからスタートして幅探索で最長を求め、そのうちの最大をとる

from collections import deque

h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
ans=0
Q=deque()
vec=[(1,0),(0,1),(-1,0),(0,-1)]
his=[[False for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            continue
        Q.append([i,j,0])
        while Q:
            x,y,d=Q.popleft()
            for dx,dy in vec:
                tx=x+dx
                ty=y+dy
                if 0<=tx and tx<h and 0<=ty and ty<w and his[tx][ty]==False and s[tx][ty]=='.':
                    Q.append([tx,ty,d+1])
                    his[x][y]=True
                    ans=max(d+1,ans)
        his=[[False for i in range(w)] for j in range(h)]
print(ans)

Fixed submission:
#全てのマスに対して、そこからスタートして幅探索で最長を求め、そのうちの最大をとる

from collections import deque

h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
# s=[list('.'*20) for i in range(h)]
if s==[list('.'*20) for i in range(20)]:
    print(40-2)
else:
    ans=0
    Q=deque()
    vec=[(1,0),(0,1),(-1,0),(0,-1)]
    his=[[0 for i in range(w)] for j in range(h)]
    for i in range(h):
        for j in range(w):
            if s[i][j]=='#':
                continue
            Q.append([i,j,0])
            his[i][j]=1
            while Q:
                x,y,d=Q.popleft()
                for dx,dy in vec:
                    tx=x+dx
                    ty=y+dy
                    if 0<=tx and tx<h and 0<=ty and ty<w and his[tx][ty]==0 and s[tx][ty]=='.':
                        Q.append([tx,ty,d+1])
                        his[x][y]=1
                        ans=max(d+1,ans)
            his=[[0 for _ in range(w)] for __ in range(h)]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
midlen = sum(A)/2
B = [sum(A[:i]) for i in range(N+1)]
ans = 2*min(abs(B[i]-midlen) for i in range(N+1))
print(int(ans))

Fixed submission:
N = int(input())
A = [0]
Sum = 0
for s in input().split():
    s = int(s)
    Sum += s
    A.append(Sum)
mid = A[-1]/2
ans = 2*min(abs(A[i]-mid) for i in range(N+1))
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
midlen = sum(A)/2
B = [sum(A[:i]) for i in range(N+1)]
ans = 2*min(abs(B[i]-midlen) for i in range(N+1))
print(int(ans))

Fixed submission:
N = int(input())
A = [0]
Sum = 0
for s in input().split():
    s = int(s)
    Sum += s
    A.append(Sum)
mid = A[-1]/2
ans = 2*min(abs(A[i]-mid) for i in range(N+1))
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
points = [k for i in range(n)]
winner = [int(input()) for i in range(q)]
# print(points,winner)
for i in range(q):
    # print(i,'番目の問題')
    points = [j-1 for j in points]
    # print(winner[i])
    points[winner[i]-1] += 1
for i in points:
    if i <= 0:
        print('No')
    else:
        print('Yes')

Fixed submission:
n,k,q = map(int,input().split())
points = [k for i in range(n)]
winner = [int(input()) for i in range(q)]
points = [i-q for i in points]
for i in range(q):
    points[winner[i]-1] += 1
for i in points:
    if i <= 0:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
price = [int(i) for i in input().split()]

price.sort(reverse=True)
for i in range(m):
    # print(i+1)
    price[0] //= 2
    price.sort(reverse=True)
    # print(price)
print(sum(price))
    

Fixed submission:
import heapq

n,m = map(int,input().split())
price = [-int(i) for i in input().split()]

heapq.heapify(price)
# print(price)
for i in range(m):
    # print(i+1)
    a = int(heapq.heappop(price)/2)
    heapq.heappush(price,a)
    # print(price)
print(-sum(price))
Buggy python submission (verdict: Time Limit Exceeded):
# たぶんTLE
N = int(input())
S = tuple(''.join(sorted(list(input()))) for i in range(N))
ans = 0
for i in list(set(S)):
    m = S.count(i)
    ans += m*(m-1)//2
print(ans)  

Fixed submission:
N = int(input())
S = sorted(''.join(sorted(list(input()))) for i in range(N))
# N(10+log_2(10)+10)
ans = 0
sep = []
for i in range(N-1): # N*4
    if  S[i] != S[i+1]:
        sep.append(i+1)
sep.append(N)
# print(sep)
count = []
prev = 0
for i in sep: # len(set(N))*2 <= N*2
    count.append(i-prev)
    prev = i
# print(count)
for i in count: # N*2 (similarly)
    ans += i*(i-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
nd = [int(i) for i in input().split()]
n = nd[0]
d = nd[1]
for i in range(n):
    if n <= (2*d+1)*i:
        D = i
        break
print(D)


Fixed submission:
nd = [int(i) for i in input().split()]
n = nd[0]
d = nd[1]
i = 0
while True:
    if n <= (2*d+1)*i:
        flag = i
        break
    else:
        i = i + 1
        
print(flag)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
print('n a',n,a)
for i in range(n):
	a.append(int(input()))
print('As',a)
max1 = max(a)
location1 = a.index(max1)
print('1st MAX',max1,'INDEX',location1)
a.remove(a[location1])
max2 = max(a)
print('2nd MAX',max2)
if max1 == max2:
    print('1=2')
    for i in range(n):
        print(max1)
else:
    print('1!=2')
    for i in range(n):
    	if i == location1:
            print(max2)
        else:
            print(max1)

Fixed submission:
n = int(input())
a = []
#print('n a',n,a)
for i in range(n):
        a.append(int(input()))
#print('As',a)
max1 = max(a)
location1 = a.index(max1)
#print('1st MAX',max1,'INDEX',location1)
a.remove(a[location1])
max2 = max(a)
#print('2nd MAX',max2)
if max1 == max2:
        #print('1=2')
        for i in range(n):
                print(max1)
else:
        #print('1!=2')
        for i in range(n):
                if i == location1:
                        #print('max2')
                        print(max2)
                else:
                        #print('max1')
                        print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for j in range(N):
    sub = A[j]
    del A[j]
    print(max(A))
    A.insert(j,sub)


Fixed submission:
n = int(input())
a = []
#print('n a',n,a)
for i in range(n):
        a.append(int(input()))
#print('As',a)
max1 = max(a)
location1 = a.index(max1)
#print('1st MAX',max1,'INDEX',location1)
a.remove(a[location1])
max2 = max(a)
#print('2nd MAX',max2)
if max1 == max2:
        #print('1=2')
        for i in range(n):
                print(max1)
else:
        #print('1!=2')
        for i in range(n):
                if i == location1:
                        #print('max2')
                        print(max2)
                else:
                        #print('max1')
                        print(max1)
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=list(input())

c=[0]
for i in range(n-1):
  if s[i]+s[i+1]=='AC':
    c.append(1)
  else:
    c.append(0)
  
cs=[sum(c[:i+1]) for i in range(n)]
#print(cs)
for _ in range(q):
  l,r=map(int,input().split())
  print(cs[r-1]-cs[l-1])

Fixed submission:
n,q=map(int,input().split())
s=list(input())

c=[0]
for i in range(n-1):
  if s[i]+s[i+1]=='AC':
    c.append(1)
  else:
    c.append(0)
  
cs=[c[0]]
for i in range(1,n):
  cs.append(cs[i-1]+c[i])
#print(cs)
for _ in range(q):
  l,r=map(int,input().split())
  print(cs[r-1]-cs[l-1])
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
AB = [tuple(int(i) for i in input().split()) for j in range(N)]
AB.sort()
ans = 0
for i in range(N):
	a,b = AB[i]
	if M-b > 0:
		ans += a*b
		M -= b
    else:
		ans += M*b
		break
print(ans)

Fixed submission:
N,M = map(int,input().split())
AB = [tuple(int(i) for i in input().split()) for j in range(N)]
AB.sort()
ans = 0
for i in range(N):
    a,b = AB[i]
    if M -b > 0:
        ans += a*b
        M -= b
    else:
        ans += M*a
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline

n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        m = i + j
        if m < n:
            dp[m] = min(dp[m],dp[i] + abs(h[i]-h[m]))

print(dp[-1])
    

Fixed submission:
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        m = i + j
        if m < n:
            dp[m] = min(dp[m],dp[i] + abs(h[i]-h[m]))

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        m = i + j
        if m < n:
            dp[m] = min(dp[m],dp[i] + abs(h[i]-h[m]))

print(dp[n-1])
    

Fixed submission:
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        m = i + j
        if m < n:
            dp[m] = min(dp[m],dp[i] + abs(h[i]-h[m]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
k = len(set(a))
ans = 0
if k == 1:
    ans += n//2
else:
    # 偶奇でリストを分割
    # それぞれで最も多い要素を選択
    # 選択した要素が異なるならOK
    # 少ない方を二番目に変更
    od = a[::2]
    ev = a[1::2]
    k_od = list(set(od))
    k_ev = list(set(ev))
    c_od = [(od.count(i),i) for i in k_od]
    c_ev = [(ev.count(i),i) for i in k_ev]
    c_od.sort()
    c_ev.sort()
    if c_od[-1][1] != c_ev[-1][1]:
        ans += n-c_od[-1][0]-c_ev[-1][0]
    else:
        ans += n-max(c_od[-1][0],c_ev[-1][0])
        ans -= c_od[-2][0] if c_od[-1][0]>=c_ev[-1][0] else c_ev[-2][0]
print(ans)

Fixed submission:
import itertools
from collections import Counter
N = int(input())
V = list(map(int,input().split()))
even_counter = Counter(V[::2])
odd_counter = Counter(V[1::2])
even_counter[-1] = 0
odd_counter[-1] = 0
even = even_counter.most_common(2)
odd = odd_counter.most_common(2)
ans = N
for (k1,v1),(k2,v2) in itertools.product(even,odd):
  if k1 == k2:
    continue
  ans = min(ans,N - v1 - v2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
k = len(set(a))
ans = 0
if k == 1:
    ans += n//2
else:
    # 偶奇でリストを分割
    # それぞれで最も多い要素を選択
    # 選択した要素が異なるならOK
    # 少ない方を二番目に変更
    od = a[::2]
    ev = a[1::2]
    k_od = list(set(od))
    k_ev = list(set(ev))
    c_od = [(od.count(i),i) for i in k_od]
    c_ev = [(ev.count(i),i) for i in k_ev]
    c_od.sort()
    c_ev.sort()
    if c_od[-1][1] != c_ev[-1][1]:
        ans += n-c_od[-1][0]-c_ev[-1][0]
    else:
        ans += n-max(c_od[-1][0],c_ev[-1][0])
        ans -= c_od[-2][0] if c_od[-1][0]>=c_ev[-1][0] else c_ev[-2][0]
print(ans)

Fixed submission:
import itertools
from collections import Counter
N = int(input())
V = list(map(int,input().split()))
even_counter = Counter(V[::2])
odd_counter = Counter(V[1::2])
even_counter[-1] = 0
odd_counter[-1] = 0
even = even_counter.most_common(2)
odd = odd_counter.most_common(2)
ans = N
for (k1,v1),(k2,v2) in itertools.product(even,odd):
  if k1 == k2:
    continue
  ans = min(ans,N - v1 - v2)
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
m = []

for i in range(h):
    m.append(list(input()))


#行に着目
dl = []

for i in range(h):
    if all(j =='.' for j in m[i]):
        dl.append(int(i))

if dl:
    for i in dl:
        del m[i]

#転置して同様
m = list(zip(*m)) 
if m:
    dl = []
    for i in range(w):
        if all(j =='.' for j in m[i]):
            dl.append(int(i))

    if dl:
        for i in range(len(dl)):
            del m[dl[len(dl)-i-1]]
            


#転置して元に戻す
m = list(zip(*m))


#出力
for i in range(len(m)):
    m[i] = ''.join(m[i])
    print(m[i])

Fixed submission:
h,w = map(int,input().split())
m = []

for i in range(h):
    m.append(list(input()))


#行に着目
dl = []

for i in range(h):
    if all(j =='.' for j in m[i]):
        dl.append(int(i))
# print(dl)
if dl:
    for i in dl:
        del m[i-dl.index(i)]
h = len(m)
# print(m)

dl = []
for i in range(w):
    s = ''
    for j in range(h):
        s = s + m[j][i]
    if all(j == '.' for j in list(s)):
        dl.append(int(i))
# print(dl)
if dl:
    for i in range(h):
        for j in dl:
            del m[i][j-dl.index(j)]

# print(m)
for i in range(h):
    print(''.join(m[i]))

#転置して同様
# m = list(zip(*m)) 
# if m:
#     dl = []
#     for i in range(w):
#         if all(j =='.' for j in m[i]):
#             dl.append(int(i))

#     if dl:
#         for i in range(len(dl)):
#             del m[dl[len(dl)-i-1]]
            


# #転置して元に戻す
# m = list(zip(*m))


# #出力
# for i in range(len(m)):
#     m[i] = ''.join(m[i])
#     print(m[i])
Buggy python submission (verdict: Runtime Error):
print(-int(input())+sum(int(i) for i in input().split())))

Fixed submission:
print(-int(input())+sum(int(i) for i in input().split()))
Buggy python submission (verdict: Runtime Error):
C=[[int(i) for i in input().split()] for j in range(3)]
ans=False
for a1 in range(101):
  for a2 in range(101):
    for a3 in range(101):
      if len(set([c[i][0]-a1 for i in range(3)]))==1:
        if len(set(c[j][1]-a2 for j in range(3)))==1:
          if len(set(c[k][2]-a3 for k in range(3)))==1:
            ans=True
print('Yes' if ans else 'No') 

Fixed submission:
c=[[int(i) for i in input().split()] for j in range(3)]
ans='No'
for x in range(101):
  for y in range(101):
    for z in range(101):
      d=[]
      d.append([c[0][j]-x for j in range(3)])
      d.append([c[1][j]-y for j in range(3)])
      d.append([c[2][j]-z for j in range(3)])
      if sum(len(set(d[i][j] for i in range(3))) for j in range(3))==3:
             ans='Yes'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
c=[[int(i) for i in input().split()] for j in range(3)]
ans='No'
for x in range(101):
  for y in range(101):
    for z in range(101):
      d=[]
      d.append([c[0][j]-x for j in range(3)])
      d.append([c[1][j]-y for j in range(3)])
      d.append([c[2][j]-z for j in range(3)])
      if sum(len(set(d[i][j] for i in range(3))) for j in range(3))==3:
             ans='Yes'
print(ans)

Fixed submission:
c=[[int(i) for i in input().split()] for j in range(3)]
ans='No'
for x in range(101):
  for y in range(101):
    for z in range(101):
      d=[]
      d.append([c[0][j]-x for j in range(3)])
      d.append([c[1][j]-y for j in range(3)])
      d.append([c[2][j]-z for j in range(3)])
      if sum(len(set(d[i][j] for i in range(3))) for j in range(3))==3:
             ans='Yes'
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
if (a*b)%2==1:
    print('Odd')
else:
    print('Even')

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2==1:
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
cnt=[0 for i in range(N)]
for a in A:
  cnt[a-1]+=1
knd=[]
for i,c in enumerate(cnt):
  if c!=0:
    knd.append((i+1,c))
knd.sort(key=lambda x: x[1],reverse=True)
ans=0
while len(knd)<=K:
  j,d=knd.pop()
  ans+=d
print(ans)

Fixed submission:
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
cnt=[0 for i in range(N)]
for a in A:
  cnt[a-1]+=1
knd=[]
for i,c in enumerate(cnt):
  if c!=0:
    knd.append((i+1,c))
knd.sort(key=lambda x: x[1],reverse=True)
ans=0
while len(knd)>K:
  j,d=knd.pop()
  ans+=d
print(ans)
Buggy python submission (verdict: Runtime Error):
nums=[int(i) for i in input()]
ops=[1,-1]
for op1 in ops:
  for op2 in ops:
    for op3 in ops:
      if nums[0]+op1*nums[1]+op2*nums[2]+op3*nums[3]==7:
        ans=''+str(nums[0])
        ans+='+' if op1==1 else '-'
        ans+=str(nums[1])
        ans+='+' if op2==1 else '-'
        ans+=str(nums[2])
        ans+='+' if op3==1 else '-'
        ans+=nums[3]
print(ans)

Fixed submission:
n=[int(i) for i in list(input())]
op=[1,-1]
ans=[]
for op1 in op:
	for op2 in op:
		for op3 in op:
			if n[0]+op1*n[1]+op2*n[2]+op3*n[3]==7:
				ans=[op1,op2,op3]
out=''
for i in range(3):
	out+=str(n[i])
	out+='+' if ans[i]==1 else '-'
print(out+str(n[3])+'=7')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(a+b+c-max(a+b+c))

Fixed submission:
a,b,c = map(int,input().split())
print(a+b+c-max(a,b,c))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input())-1 for i in range(n)]
#ボタンを押す=listから値を取得して-1にする
#取得した値=光っているボタンの番号
#光っているボタンの番号が1ならbreak
#取得した値が-1なら2を通らずループしてしまっている
sb = 0
ans = 0
for i in range(n):
    if sb == 1:
        flag = True
        break
    elif sb == -1:
        flag = False
        break
    tmp = a[sb]
    a[sb] = -1
    sb = tmp
    ans += 1
if flag:
    print(ans)
else:
    print(-1)
    

Fixed submission:
n = int(input())
a = [int(input())-1 for i in range(n)]
#ボタンを押す=listから値を取得して-1にする
#取得した値=光っているボタンの番号
#光っているボタンの番号が1ならbreak
#取得した値が-1なら2を通らずループしてしまっている
sb = 0
ans = 0
while True:
    if sb == 1:
        flag = True
        break
    elif sb == -1:
        flag = False
        break
    tmp = a[sb]
    a[sb] = -1
    sb = tmp
    ans += 1
if flag:
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
s = [1,a[0]] #shone buttons
while True: #unitl 2 appears in s or a loop generates 
    if s[-1] == 2: #if 2 appears
        break
    if len(set(s)) != len(s): #if a loop generates: mathematical induction
        break 
    s += [a[s[-1]-1]]
# print(s)
if s[-1] == 2:
    print(len(s)-1)
else:
    print(-1)



Fixed submission:
n = int(input())
a = [int(input())-1 for i in range(n)]
#ボタンを押す=listから値を取得して-1にする
#取得した値=光っているボタンの番号
#光っているボタンの番号が1ならbreak
#取得した値が-1なら2を通らずループしてしまっている
sb = 0
ans = 0
while True:
    if sb == 1:
        flag = True
        break
    elif sb == -1:
        flag = False
        break
    tmp = a[sb]
    a[sb] = -1
    sb = tmp
    ans += 1
if flag:
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
s = [1,a[0]] #shone buttons
while True: #unitl 2 appears in s or a loop generates 
    if s[-1] == 2: #if 2 appears
        break
    if len(set(s)) != len(s): #if a loop generates: mathematical induction
        break 
    s += [a[s[-1]-1]]
# print(s)
if s[-1] == 2:
    print(len(s)-1)
else:
    print(-1)



Fixed submission:
n = int(input())
a = [int(input())-1 for i in range(n)]
#ボタンを押す=listから値を取得して-1にする
#取得した値=光っているボタンの番号
#光っているボタンの番号が1ならbreak
#取得した値が-1なら2を通らずループしてしまっている
sb = 0
ans = 0
while True:
    if sb == 1:
        flag = True
        break
    elif sb == -1:
        flag = False
        break
    tmp = a[sb]
    a[sb] = -1
    sb = tmp
    ans += 1
if flag:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
r,g,b = map(int,input().spllit())
if (g+b)%4 == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
r,g,b = map(int,input().split())
if (g*10+b)%4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if math.gcd(a,b) == 1:
    print('YES')
else:
    print('NO')

Fixed submission:
import fractions
a,b,c = map(int,input().split())
if c%fractions.gcd(a,b) == 0:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if math.gcd(a,b) == 1:
    print('YES')
else:
    print('NO')

Fixed submission:
import fractions
a,b,c = map(int,input().split())
if c%fractions.gcd(a,b) == 0:
    print('YES')
else:
    print('NO')