Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = list(str(input()))
s[3] = 8

ss = ''
 
for i in s:
  ss = ss + i
  
print(ss)

Fixed submission:
s = list(str(input()))
 
s[3] = '8'
 
t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)

Buggy python submission (verdict: Runtime Error):
s = list(str(input()))

s[3] = 8

t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)


Fixed submission:
s = list(str(input()))
 
s[3] = '8'
 
t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)
Buggy python submission (verdict: Runtime Error):
n, y = map(int,input().split())
s = []
for i in range(n):
    for j in range(n-i):
        if i * 10000 + j * 5000 + (n-i-j) * 1000 == y:
            s.append(i)
            s.append(j)
            s.append(k)
            break
            
if s ==[]:
    print('-1 -1 -1')
else:
    print(str(s[0]) + ' ' + str(s[1]) + ' ' + str(s[2]))
            


Fixed submission:
n, y = map(int,input().split())
s = []
for i in range(n+1):
    for j in range(n+1):
        if i * 10000 + j * 5000 + (n-i-j) * 1000 == y and n-i-j > -1:
            s.append(i)
            s.append(j)
            s.append(n-i-j)
            break
            
if s ==[]:
    print('-1 -1 -1')
else:
    print(str(s[0]) + ' ' + str(s[1]) + ' ' + str(s[2]))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())

if a+ b < c + d:
  print('Left')
elif a + b = c + d:
  print('Balanced')
else:
  print('Right')

Fixed submission:
a,b,c,d = map(int,input().split())
 
if a+ b > c + d:
  print('Left')
elif a + b == c + d:
  print('Balanced')
else:
  print('Right')
Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 = 1:
    s = s+ 1
else:
    None
print(s // 2)

Fixed submission:
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 == 1:
    s = s+ 1
else:
    None
print(s // 2)

Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 = 1:
  s = s+ 1
else:
  None
  
print(s // 2)

Fixed submission:
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 == 1:
    s = s+ 1
else:
    None
print(s // 2)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
 
s = a + b
if s % 2 = 1:
  s = s+ 1
  
print(s // 2)

Fixed submission:
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 == 1:
    s = s+ 1
else:
    None
print(s // 2)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

s = a + b
if s % 2 = 1:
  s =s+ 1
  
print(s // 2)

Fixed submission:
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 == 1:
    s = s+ 1
else:
    None
print(s // 2)

Buggy python submission (verdict: Runtime Error):
import math as m
a,b = map(int,input().split())

print(m.round(a + b))

Fixed submission:
l = list(map(int,input().split()))
 
s = l[0] + l[1]
if s % 2 == 1:
    s = s+ 1
else:
    None
print(s // 2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
an = list(map(int,input().split()))

anset = list(set(an))

andict = {}

for i in range(len(an)):
    if an[i] in andict:
        andict[an[i]] = andict[an[i]] + 1
    else:
        andict.update({an[i]:1})

counter = 0

for i ,j in andict.keys(), andict.values():
    if i == j :
        None
    elif i > j:
        counter = counter + j
    elif i < j:
        counter = counter + j - i
    
        
print(counter)

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

anset = list(set(an))

andict = {}

for i in range(len(an)):
    if an[i] in andict:
        andict[an[i]] = andict[an[i]] + 1
    else:
        andict.update({an[i]:1})

counter = 0

for i ,j in andict.items():
    if i == j :
        None
    elif i > j:
        counter = counter + j
    elif i < j:
        counter = counter + j - i
    
        
print(counter)
Buggy python submission (verdict: Runtime Error):
m = int(input())
k = []
for i in range(9):
    k.append((i + 1)*111)
print(k)

if ((m % 1000) in k) or (m % 1110 =>0 and m % 1110 <= 9):
    print('Yes')
else:
    print('No')

Fixed submission:
m = int(input())
k = []
for i in range(10):
    k.append((i )*111)

if ((m % 1000) in k) or (m % 1110 >=0 and m % 1110 < 10):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
p = int(input())

q =list(str(p))
r = []
for i in range(len(q)):
    r.append(int(q[i]))
    
a = r[0]
b = [-r[1],r[1]]
c = [-r[2],r[2]]
d = [-r[3],r[3]]

e = []
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a + b[i] + c[j] + d[k] == 7:
                e.append(a)
                e.append(b[i])
                e.append(c[j])
                e.append(d[k])
                
for i in range(len(e)):
    if e[i] < 0 or i == 0:
        e[i] = str(e[i])
    else:
        e[i] = '+' + str(e[i])
        
print(e[0] + e[1] + e[2] + e[3])

Fixed submission:
p = str(input())

q =list(str(p))
r = []

for i in range(len(q)):
    r.append(int(q[i]))

a = r[0]
b = [-r[1],r[1]]
c = [-r[2],r[2]]
d = [-r[3],r[3]]

e = []
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a + b[i] + c[j] + d[k] == 7:
                e.append(a)
                e.append(b[i])
                e.append(c[j])
                e.append(d[k])

for i in range(len(e)):
    if e[i] < 0 or i == 0:
        e[i] = str(e[i])
    else:
        e[i] = '+' + str(e[i])
        
print(e[0] + e[1] + e[2] + e[3] + '=7')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = n
while x * x > n :
    x = x - 1
    
print(x*x)

Fixed submission:
n = int(input())
import math as m
x = round(m.sqrt(n)) + 1
while x > m.sqrt(n) :
    x = x - 1
    
print(x*x)
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
G = [[0] * N for i in range(N)]

edgeset  = []
for i in range(M):
    a,b = map(int,input().split())
    G[a-1][b-1] = 1
    G[b-1][a-1] = 1
    edgeset.append([a,b])
    
visited = None
def dfs(v):
    visited[v] = 1
    for u, e in enumerate(G[v]):
        if e == 0 or visited[u] == 1:
            continue
        dfs(u)
ans = 0

for j in edgeset:
    G[j[0] - 1][j[1] - 1]= 0
    G[j[1] - 1][j[0] - 1]= 0
    visited = [[0] * N]
    dfs(0)   
    G[j[0] - 1][j[1] - 1]= 1
    G[j[1] - 1][j[0] - 1]= 1
    if 0 in visited:
        ans+= 1
print(ans)

Fixed submission:
n,m = map(int,input().split())

H = [[0 for _ in range(n)] for _ in range(n) ]
edge_list = []

for _ in range(m):
    a, b = map(int,input().split())
    edge_list.append([a,b])
    H[a-1][b-1] = 1
    H[b-1][a-1] = 1
    
visited = [0 for _ in range(n)]

def dfs(node):
    visited[node] = 1
    for node_,edge_ in enumerate(H[node]):
        if edge_ == 1:
            if visited[node_] == 1:
                continue
            dfs(node_)
ans = 0
for _ in edge_list:
    H[_[0] -1][_[1] - 1] = 0
    H[_[1] -1][_[0] - 1] = 0
    
    dfs(1)
    if 0 in visited:
        ans += 1
    H[_[0] -1][_[1] - 1] = 1
    H[_[1] -1][_[0] - 1] = 1
    visited = [0 for _ in range(n)]
print(ans)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

B = []
for i in range(n+1):
    onel = []
    for j in range(n+1):
        onel.append(0)
    B.append(onel)
    
visited_checklist = []

input_node = []

for i in range(n+1):
    visited_checklist.append(i)
    
for k in range(m):
    ai,bi = map(int,input().split())
    B[ai][bi] = 1
    B[bi][ai] = 1
    input_node.append([ai,bi])
    
def DFS(node):
    l[node] = 0
    for j in range(n+1):
        if X[node][j] == 1 or X[j][node] == 1 and l[j] != 0:
            l[j] = 0 
            X[node][j] == 0
            X[j][node] == 0
            DFS(j)
        if X[node][j] == 0 or X[j][node] == 0:
            continue
        if max(l) == 0:
            break
        if l[j] == 0:
            continue

    
count = 0

for i in input_node:
    X = B
    X[i[0]][i[1]] = 0
    X[i[1]][i[0]] = 0
    l = visited_checklist
    DFS(1)
    if max(l) != 0:
        count += 1
print(count)

Fixed submission:
n,m = map(int,input().split())

H = [[0 for _ in range(n)] for _ in range(n) ]
edge_list = []

for _ in range(m):
    a, b = map(int,input().split())
    edge_list.append([a,b])
    H[a-1][b-1] = 1
    H[b-1][a-1] = 1
    
visited = [0 for _ in range(n)]

def dfs(node):
    visited[node] = 1
    for node_,edge_ in enumerate(H[node]):
        if edge_ == 1:
            if visited[node_] == 1:
                continue
            dfs(node_)
ans = 0
for _ in edge_list:
    H[_[0] -1][_[1] - 1] = 0
    H[_[1] -1][_[0] - 1] = 0
    
    dfs(1)
    if 0 in visited:
        ans += 1
    H[_[0] -1][_[1] - 1] = 1
    H[_[1] -1][_[0] - 1] = 1
    visited = [0 for _ in range(n)]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if nlll in aaa:
        del aaa
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)

Fixed submission:
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        del nlll[aaa]
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

nlll = {}
s = []
for i in range(1000000000):
    s.append(0)
    
for i in range(n):
    aaa = int(input())
    if s[aaa] == 0:
        s[aaa] = 1
    elif s[aaa] == 1:
        s[aaa] = 0
    else:
        None

sums = 0
for i in s:
    sums = sums + i
print(sums)

Fixed submission:
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        del nlll[aaa]
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

nlll = []
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        nlll.remove(aaa)
    else:
        nlll.append(aaa)
        
print(len(nlll))

Fixed submission:
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        del nlll[aaa]
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
    

b = list(set(a))

for i in b:
    if a.count(i) % 2 == 0:
        b.remove(i)
    else:
        None
        
print(len(list(b))

Fixed submission:
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        del nlll[aaa]
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)

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

b = list(set(a))

for i in b:
    if a.count(i) % 2 == 0:
        while i in a:
            a.remove(i)
    else:
        None
        
print(len(list(set(a))))

Fixed submission:
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        del nlll[aaa]
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)

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

for i in range(len(a)):
    if a[i] in b:
        b.remove(a[i])
    else:
        b.append(a[i])
        
print(len(b))

Fixed submission:
n = int(input())

nlll = {}
    
for i in range(n):
    aaa = int(input())
    if aaa in nlll:
        del nlll[aaa]
    else:
        nlll.update({aaa:1})

sums = 0
for i in nlll.values():
    sums = sums + i
print(sums)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
 
int main(void)
{
  int x,t;
  std::cin >> x >> t;
  x = std::max<int>(0,x-t);
  std::cout << x << std::endl;
  return 0;
}

Fixed submission:
X, t = map(int,input().split())
if X >= t:
  print(X-t)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
#include <iostream>

int main()
{
  int x,t;
  std::cin >> x >> t;
  x = std::max<int>(0,x-t);
  std::cout << x << std::endl;
  return 0;
}

Fixed submission:
X, t = map(int,input().split())
if X >= t:
  print(X-t)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Adict = []
for i in A:
    if i in Adict:
        Adict[i]=Adict[i]+1
    else:
        Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Adict = {}
for i in A:
    if i in Adict:
        Adict[i]=Adict[i]+1
    else:
        Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])

Buggy python submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split()))
Adict = []
for i in A:
  if i in Adict:
    Adict[i]=Adict[i]+1
  else:
    Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Adict = {}
for i in A:
    if i in Adict:
        Adict[i]=Adict[i]+1
    else:
        Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])

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

a_sort = list(reversed(list(sorted(a))))
amax = max(a_sort)

if a_sort.count(amax) >3:
    print(amax ** 2)
    
else:
    one = 0
    two = 0
    for i in a_sort:
        if a_sort.count(i) > 1 and one = 0 and two = 0:
            one = i
        elif a_sort.count(i) > 1 and one > 0 and two = 0:
            two = i
        else:
            break
    print(one*two)
    


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Adict = {}
for i in A:
    if i in Adict:
        Adict[i]=Adict[i]+1
    else:
        Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])

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

a_sort = list(sorted(a))
ad = {}
for i in range(len(a_sort)):
    if ad in a_sort[i]:
        ad[a_sort[i]] = ad[a_sort[i]] + 1
    else:
        ad.update(a_sort[i]:1)
ad2 = ad
for key in ad.keys():
    if ad[key] < 2:
        del ad2[key]

amax = max(ad2.keys())
b = ad2
while amax in b:
    b.remove(amax)
bmax = max(b)

if ad2[amax] > 3:
    print(amax*amax)
else:
    print(amax*bmax)

         

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Adict = {}
for i in A:
    if i in Adict:
        Adict[i]=Adict[i]+1
    else:
        Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two =n = int(input())
a = list(map(int,input().split()))

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two = 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')= 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two == 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two = 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two == 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):

n = int(input())
a = list(map(int,input().split()))
sss = 0
for i in range(n):
    sss=sss + a[i]
ppp = 0
qqq = abs(sss - 2 * a[0])
for i in range(n):
    ppp=ppp + a[i]
    qo = abs(sss-2ppp)
    if qqq > qo:
        qqq=qo
        
print(qqq)

Fixed submission:

n = int(input())
a = list(map(int,input().split()))
sss = 0
for i in range(n):
    sss=sss + a[i]
ppp = 0
qqq = abs(sss - 2 * a[0])
for i in range(n-1):
    ppp=ppp + a[i]
    qo = abs(sss-2*ppp)
    if qqq > qo:
        qqq=qo
        
print(qqq)
Buggy python submission (verdict: Runtime Error):
l = [0,0,0,0,0,0,0,0,0]
n = int(input())
a = list(map(int,input().split()))

for i in range(len(a)):
    if 1 <=  a[i] <= 399:
        l[0] = l[0] + 1
    elif 400 <=  a[i] <= 799:
        l[1] = l[1] + 1
    elif 800 <=  a[i] <= 1199:
        l[2] = l[2] + 1
    elif 1200 <=  a[i] <= 1599:
        l[3] = l[3] + 1
    elif 1600 <=  a[i] <= 1999:
        l[4] = l[4] + 1
    elif 2000 <=  a[i] <= 2399:
        l[5] = l[5] + 1
    elif 2400 <=  a[i] <= 2799:
        l[6] = l[6] + 1
    elif 2800 <=  a[i] <= 3199:
        l[7] = l[7] + 1
    else:
        l[8] = l[8] + 1
        
tokurei = 0        
for i in range(7):
    tokurei = tokurei + l[i]

if tokurei = 0:
    print('1 ' + str(l[8]) )
else:
    flag = 0
    for i in range(7):
        if l[i] > 0:
            flag = flag + 1
    print(str(flag) + ' ' + str(flag + l[8]))

Fixed submission:
l = [0,0,0,0,0,0,0,0,0]
n = int(input())
a = list(map(int,input().split()))

for i in range(len(a)):
    if 1 <=  a[i] <= 399:
        l[0] = l[0] + 1
    elif 400 <=  a[i] <= 799:
        l[1] = l[1] + 1
    elif 800 <=  a[i] <= 1199:
        l[2] = l[2] + 1
    elif 1200 <=  a[i] <= 1599:
        l[3] = l[3] + 1
    elif 1600 <=  a[i] <= 1999:
        l[4] = l[4] + 1
    elif 2000 <=  a[i] <= 2399:
        l[5] = l[5] + 1
    elif 2400 <=  a[i] <= 2799:
        l[6] = l[6] + 1
    elif 2800 <=  a[i] <= 3199:
        l[7] = l[7] + 1
    else:
        l[8] = l[8] + 1
        
tokurei = 0        
for i in range(8):
    tokurei = tokurei + l[i]

if tokurei == 0:
    print('1 ' + str(l[8]) )
else:
    flag = 0
    for i in range(8):
        if l[i] > 0:
            flag = flag + 1
    print(str(flag) + ' ' + str(flag + l[8]))
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
dcic = {}
aa = ()
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic + b
    else:
        dcic.update({a:b})

bb = list(sorted(list(aa)))
cc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > -1:
        k = k - dcic[bb[i]]
    else:
        cc = dcic[bb[i]]
        
print(cc)

    

Fixed submission:
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
s = 0
for i in range(len(bb)):
    if s < k:
        s = s + dcic[bb[i]]
        cc = bb[i]
    else:
        ccc = bb[i]
print(cc)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = a
#1 = plus
cp = 0
cm = 0
sumscp = 0
sumscm = 0

for i in range(len(a)):
    
    if i % 2 == 0:
        while sumscp + a[i] < 1:
            a[i] = a[i] + 1
            cp = cp + 1
        sumscp = sumscp + a[i]
    else:
        while sums + a[i] > -1:
            a[i] = a[i] - 1
            cp = cp + 1
        sumscp = sumscp + a[i]
        
for i in range(len(b)):
    
    if i % 2 == 0:
        while sumscm + b[i] > -1:
            b[i] = b[i] - 1
            cm = cm + 1
        sumscm = sumscm + b[i]
    else:
        while sumscm + a[i] < 1:
            b[i] = b[i] + 1
            cm = cm + 1
        sumscm = sumscm + b[i]
    
print(min(cp,cm))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
sums = 0
count = 0
for i in range(n):
    sums = sums + a[i]
    if i % 2 ==0 :
        if sums > 0:
            None
        else:
            count = count + 1 -sums
            sums = 1
    else:
        if sums < 0:
            None
        else:
            count = count + 1 + sums
            sums = -1
            
count2 = 0
sums2 = 0
for i in range(n):
    sums2 = sums2 + a[i]
    if i % 2 ==1 :
        if sums2 > 0:
            None
        else:
            count2 = count2 + 1 -sums2
            sums2 = 1
    else:
        if sums2 < 0:
            None
        else:
            count2 = count2 + 1 + sums2
            sums2 = -1
            
print(min(count,count2))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = a
#1 = plus
cp = 0
cm = 0
sumscp = 0
sumscm = 0

for i in range(len(a)):
    
    if i % 2 == 0:
        while sumscp + a[i] < 1:
            a[i] = a[i] + 1
            cp = cp + 1
        sumscp = sumscp + a[i]
    else:
        while sums + a[i] > -1:
            a[i] = a[i] - 1
            cp = cp + 1
        sumscp = sumscp + a[i]
        
for i in range(len(b)):
    
    if i % 2 == 0:
        while sumscp + b[i] > -1:
            b[i] = b[i] - 1
            cm = cm + 1
        sumscm = sumscm + b[i]
    else:
        while sums + a[i] < 1:
            b[i] = b[i] + 1
            cm = cm + 1
        sumscm = sumscm + b[i]
    
print(min(cp,cm))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
sums = 0
count = 0
for i in range(n):
    sums = sums + a[i]
    if i % 2 ==0 :
        if sums > 0:
            None
        else:
            count = count + 1 -sums
            sums = 1
    else:
        if sums < 0:
            None
        else:
            count = count + 1 + sums
            sums = -1
            
count2 = 0
sums2 = 0
for i in range(n):
    sums2 = sums2 + a[i]
    if i % 2 ==1 :
        if sums2 > 0:
            None
        else:
            count2 = count2 + 1 -sums2
            sums2 = 1
    else:
        if sums2 < 0:
            None
        else:
            count2 = count2 + 1 + sums2
            sums2 = -1
            
print(min(count,count2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
import math as ms
dic = []
for i in range(1,ms.floor(n / 2) + 1):
    if n % i == 0:
        dic.append([i,n // i])
    
f = []
for i in range(len(dic)):
    a = ms.floor(ms.log10(dic[i][0])) + 1
    b = ms.floor(ms.log10(dic[i][1])) + 1
    f.append(max(a,b))
    
print(min(f))
    

Fixed submission:
n = int(input())
import math as ms
dic = []
for i in range(1,ms.floor(ms.sqrt(n)) + 1):
    if n % i == 0:
        dic.append([i,n // i]) 
f = []
for i in range(len(dic)):
    a = ms.floor(ms.log10(dic[i][0])) + 1
    b = ms.floor(ms.log10(dic[i][1])) + 1
    f.append(max(a,b))
    
print(min(f))