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

Fixed submission:
import numpy as np
import math as m

def main(**kwargs):
    r = -1

    if n > 1:
        for i in range(10 ** n - 1, 10 ** (n - 1) - 1, -1):
            stri = str(i)
            flg = True

            for s, c in zip(S, C):
                if stri[s-1] != str(c):
                    flg = False
        
            if flg:
                r = i

    else:
        for i in range(9, -1, -1):
            stri = str(i)
            flg = True

            for s, c in zip(S, C):
                if stri[s-1] != str(c):
                    flg = False
        
            if flg:
                r = i
    
    return r

if __name__ == "__main__":
    cin = np.array(input().split(" ")).astype("int")
    n, m, *_ = cin

    S = np.zeros(m, dtype="int")
    C = np.zeros(m, dtype="int")

    for i in range(m):
        cin = np.array(input().split(" ")).astype("int")
        S[i], C[i] = np.array(cin)
    
    cout = main(n=n, m=m, S=S, C=C)
    print(cout)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math as m

def main(**kwargs):
    r = -1

    for i in range(10 ** n - 1, 10 ** (n - 1) - 1, -1):
        stri = str(i)
        flg = True

        for s, c in zip(S, C):
            if stri[s-1] != str(c):
                flg = False
    
        if flg:
            r = i

    if n == 1 and S == np.array([1]) and C == np.array([0]):
        r = 0

    return r

if __name__ == "__main__":
    cin = np.array(input().split(" ")).astype("int")
    n, m, *_ = cin

    S = np.zeros(m, dtype="int")
    C = np.zeros(m, dtype="int")

    for i in range(m):
        cin = np.array(input().split(" ")).astype("int")
        S[i], C[i] = np.array(cin)
    
    cout = main(n=n, m=m, S=S, C=C)
    print(cout)
Problem p02767 (python)

Fixed submission:
import numpy as np

def main(n, xs):
    minx = min(xs)
    maxx = max(xs)
    ress = []

    for x in range(minx, maxx+1):
        res = sum((xs - x) ** 2)
        ress.append(res)

    res = min(ress)
    return res

if __name__ == "__main__":
    cin = input()
    n = int(cin.split(" ")[0])
    cin = input()
    xs = np.array([], dtype="int")

    for i in range(n):
        xs = np.append(xs, int(cin.split(" ")[i]))
    cout = main(n, xs)
    print(cout)

Buggy submission (verdict: Runtime Error):
import numpy as np

def main(n, xs):
    minx = min(xs)
    maxx = max(xs)
    ress = []

    for x in range(minx, maxx+1):
        res = sum((xs - x) ** 2)
        ress.append(res)

    res = min(ress)
    return res

if __name__ == "__main__":
    cin = iter(input, "")
    n = int(cin[0].split(" ")[0])
    xs = np.array(cin[1].split(" ")).astype("int")
    cout = main(n, xs)
    print(cout)

Buggy submission (verdict: Runtime Error):
import numpy as np

def main(n, xs):
    minx = min(xs)
    maxx = max(xs)
    ress = []

    for x in range(minx, maxx+1):
        res = sum((xs - x) ** 2)
        ress.append(res)

    res = min(ress)
    return res

if __name__ == "__main__":
    cin = list(iter(input, ""))
    n = int(cin[0].split(" ")[0])
    xs = np.array(cin[1].split(" "))
    xs = xs.astype("int")
    cout = main(n, xs)
    print(cout)
Problem p02719 (python)

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

if n >= k:
  n %= k
  
print(min(n, -(n-k)))

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
if n >= k:
  n = n % k

print(min(n, -(n-k)))

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())

if n >= k:
  n %= k
  
print(n)
Problem p02576 (python)

Fixed submission:
import math
N, X, T = map(int, input().split())
 
if N % X == 0:
  print(int(N / X * T))
else:
  print((math.floor(N/X) + 1) * T)

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

print(floor(N/X) * T + 1)
Problem p02612 (python)

Fixed submission:
a = int(input())

if a % 1000 == 0:
  out = 0
else:
  out = 1000 - a % 1000

print(out)

Buggy submission (verdict: Runtime Error):
using namespace std;
#include <iostream>
int main(){
  int N;
  cin >> N;

  if (N % 1000 == 0) cout << 0;
  else cout << 1000 - N % 1000;

  return 0;
}

Buggy submission (verdict: Runtime Error):
n = int(input())
 
nodes = []
nodes_append = nodes.append
components = 0
for i in range(n - 1):
  edge = tuple(map(int, input().split()))
  node_max = max(edge)
  node_min = min(edge)
  if node_min not in nodes:
      nodes_append(node_min)
      components += node_min * (n - node_min + 1)
  if node_max not in nodes:
      nodes_append(node_max)
      components += node_max * (n - node_max + 1)
  num_edge = node_min * (n - node_max + 1)
  components -= num_edge
  
print(components)

Buggy submission (verdict: Runtime Error):
import numpy as np

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

grid = np.zeros([n, n])

for i in range(n - 1):
  edge = sorted(edges[i])
  grid[edge[0] - 1][edge[1] - 1] = 1

components = 0
for i in range(n):
  for j in range(i, n):
    loss = grid[i:j + 1, i:j + 1].sum()
    components += j - i + 1 - loss
  
print(int(components))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

types = ['AC', 'WA', 'TLE', 'RE']
num = int(input())
categories = defaultdict(int)

for i in range(num):
    categories[input()] += 1

for i in types:
    print("{} x {}".format(i, categories[i]))

Buggy submission (verdict: Runtime Error):
a = input()
print(a % 1000)
Problem p02630 (python)

Fixed submission:
N = int(input())
As = list(map(int, input().split()))
Q = int(input())
 
sumAs = 0
dictAs = [0] * 100000
for i in range(len(As)):
  sumAs += As[i]
  dictAs[As[i] - 1] += 1


for _ in range(Q):
  b, c = map(int, input().split())
  sumAs += dictAs[b - 1] * (c - b)
  dictAs[c - 1] += dictAs[b - 1]
  dictAs[b - 1] = 0
  print(sumAs)

Buggy submission (verdict: Runtime Error):
N = int(input())
As = list(map(int, input().split()))
Q = int(input())
 
sumAs = 0
dictAs = [0] * 1E5
for i in range(len(As)):
  sumAs += As[i]
  dictAs[As[i] - 1] = 1


for _ in range(Q):
  b, c = map(int, input().split())
  sumAs += dictAs[b - 1] * (c - b)
  dictAs[c - 1] += dictAs[b - 1]
  dictAs[b - 1] = 0
  print(sumAs)
Problem p02642 (python)

Fixed submission:
N = int(input())
As = sorted(list(map(int, input().split())))

sieve = [True] * 1000001

prev = 0

for i in range(N):
    if As[i] == prev:
        sieve[As[i]] = False
        continue
    else:
        prev = As[i]
        try:
            for j in range(2, 1000000 // prev + 1):
                sieve[prev * j] = False
        except:
            continue

count = 0
As = list(set(As))
for i in range(len(As)):
    if sieve[As[i]] is True:
        count += 1
        
print(count)

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

sieve = [True] * 1000001

prev = 0

for i in range(N):
    if As[i] == prev:
        sieve[As[i]] = False
        continue
    else:
        prev = As[i]
        try:
            for j in range(2, 1000000 // prev + 1):
                sieve[prev * j] = False
        except:
            continue

count = 0
As = list(set(As))
for i in range(N):
    if sieve[As[i]] is True:
        count += 1
        
print(count)

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

sieve = [True] * 1000001

prev = 0

for i in range(N):
    if As[i] == prev:
        sieve[As[i]] = False
        continue
    else:
        prev = As[i]
        for j in range(2, 1000000 // prev + 1):
            sieve[prev * j] = False

count = 0
As = list(set(As))
for i in range(N):
    if sieve[As[i]] is True:
        count += 1
        
print(count)

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

sieve = [True] * 1000000

count = 1
prev = As[0]
for j in range(1000000 // prev + 1):
    sieve[prev * j - 1] = False


for i in range(N):
    if As[i] == prev:
        continue
    else:
        prev = As[i]
        if sieve[prev] is True:
            count += 1
        for j in range(1000000 // prev + 1):
            sieve[prev * j - 1] = False

print(count)

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

if As[0] == As[1]:
  count = 0
else:
  count = 1
  
for i in range(1, N):
  count_sub = 0
  for j in range(i):
    if As[i] % As[j] == 0:
      count_sub += 1
  if count_sub == 0:
    count += 1
    
print(count)
Problem p02720 (python)

Fixed submission:
def update_queue(n, queue):
    out = queue[n]
    mod10 = out % 10
    if mod10 != 0:
        queue.append(10 * out + mod10 - 1)
    queue.append(10 * out + mod10)
    if mod10 != 9:
        queue.append(10 * out + mod10 + 1)

    return out, queue

N = int(input())
Q = [1,2,3,4,5,6,7,8,9]

for i in range(N):
    out, Q = update_queue(i, Q)

print(out)

Buggy submission (verdict: Runtime Error):
def update_queue(queue):
    out = queue.pop(0)
    mod10 = out % 10
    if mod10 != 0:
        queue.append(10 * out + mod10 - 1)
    queue.append(10 * queue + mod10)
    if mod10 != 9:
        queue.append(10 * out + mod10 + 1)

    return out, queue

N = int(input())
Q = [1,2,3,4,5,6,7,8,9]

for _ in range(N):
    out, Q = update_queue(Q)

print(out)
Problem p02756 (python)

Fixed submission:
S = input()
Q = int(input())
rev = 1

head = []
tail = []

for i in range(Q):
  line = input()
  if line == '1':
    rev *= -1
  else:
    line = line.split()
    F = int(line[1])
    C = line[2]
    if rev * F in [1, -2]:
      head.append(C)
    else:
      tail.append(C)

head = head[::-1]
S = ''.join(head + [S] + tail)

if rev == -1:
  S = S[::-1]
  
print(S)

Buggy submission (verdict: Runtime Error):
S = int(input())
Q = int(input())
rev = 1

for i in range(Q):
  line = input()
  if line == '1':
    rev *= -1
  else:
    a, F, C = input().split()
    if rev * int(F) in [1, -2]:
      S = C + S
    else:
      S = S + C

if rev == -1:
  S = S[::-1]
  
print(S)
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return a // gcd(a, b) * b
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return a / gcd(a, b) * b
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
    ans = int(ans)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return (a * b) / gcd(a, b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))
Problem p02755 (python)

Fixed submission:
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
a = list(map(int, input().split(" ")))
min8 = a[0]/0.08
max8 = (a[0]+1)/0.08
min10 = a[1]/0.1
max10 =(a[1]+1)/0.1
b = max(min8, min10)
if ((min8>=max10) or (max8<=min10)):
    print(-1)
else:
    print(Decimal(b).quantize(Decimal('0'), rounding = ROUND_HALF_UP))

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
a = list(map(int, input().split(" ")))
min8 = a[0]/0.08
max8 = (a[0]+1)/0.08
min10 = a[1]/0.1
max10 =(a[1]+1)/0.1
a = max(min8, min10)
if ((min8>=max10) or (max8<=min10)):
    print(-1)
else:
    print(Decimal(b).quantize(Decimal('0'), rounding = ROUND_HALF_UP))
Problem p02534 (python)

Fixed submission:
str = input()
K = int(str)

output = 'ACL' * K
print(output)

Buggy submission (verdict: Runtime Error):
str = input()
a, b, c, d = str.split(' ')
B = int(b)
C = int(c)

if B >= C:
    print('Yes')
else:
    print('No')
Problem p02612 (python)

Fixed submission:
N=int(input())
if N<=1000:
    print(1000-N)
if 2000>=N>1000:
    print(2000-N)
if 3000>=N>2000:
    print(3000-N)
if 4000>=N>3000:
    print(4000-N)
if 5000>=N>4000:
    print(5000-N)
if 6000>=N>5000:
    print(6000-N)
if 7000>=N>6000:
    print(7000-N)
if 8000>=N>7000:
    print(8000-N)
if 9000>=N>8000:
    print(9000-N)
if 10000>=N>=9000:
    print(10000-N)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(N%10000
Problem p02706 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
if s>n:
  print(-1)
else:
  print(n-s)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
if sum>n:
  print(-1)
else:
  print(n-s)
Problem p02731 (python)

Fixed submission:
n=float(input())
v=[0]
print(n/3*n/3*n/3)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=[]
for i in range(1,n):
    for j in range(1,n):
        k=n-i-j 
        if k>0:
            v.append(i*j*k)
print(max(v))
Problem p03168 (python)

Fixed submission:

    

n=int(input())
p=list(map(float,input().split()))

 
dp = [[0 for i in range(n+1)] for j in range(n+1)]
   
dp[0][0] = 1.0

for i in range(1,n+1):
    for j in range(0,n+1):
        if j==0:
            dp[i][j] = dp[i - 1][j] * (1.0 - p[i-1]) 
        else : 
            dp[i][j] = (dp[i - 1][j] * (1.0 - p[i-1]) +
                        dp[i - 1][j - 1] * p[i-1])  
ans=0.0
for i in range((n+1)//2,n+1):
    ans+=dp[n][i]
print( ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

def Probability(p,n):
    dp = [[0 for i in range(n+1)] for j in range(n+1)]
   
    dp[0][0] = 1.0
    
    for i in range(1,n+1):
        for j in range(0,n+1):
            if j==0:
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i-1]) 
            else : 
                dp[i][j] = (dp[i - 1][j] * (1.0 - p[i-1]) +
                            dp[i - 1][j - 1] * p[i-1])  
    ans=0.0
    for i in range((n+1)//2,n+1):
        ans+=dp[n][i]
    return ans 

n=int(input())
a=list(map(float,input().split()))

 

print(Probability(a,n))

Buggy submission (verdict: Runtime Error):
import numpy as np

def Probability(p,n):
    dp = [[0 for i in range(n+1)] for j in range(n+1)]
   
    dp[0][0] = 1.0
    
    for i in range(1,n+1):
        for j in range(i+1):
            if j==0:
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i-1]) 
            else : 
                dp[i][j] = (dp[i - 1][j] * (1.0 - p[i-1]) +
                            dp[i - 1][j - 1] * p[i-1])  
    ans=0.0
    for i in range((n+1)//2,n+1):
        ans+=dp[n][i]
    return ans 

n=int(input())
a=list(map(float,input().split()))

 

print(Probability(a,n))

Buggy submission (verdict: Runtime Error):
import numpy as np

def Probability(p,n):
    dp = np.zeros((n+1 ,n+1)) 
    for i in range(n+1):
        for j in range(n+1):
            dp[i][j] = 0.0 
    dp[0][0] = 1.0
    
    for i in range(1,n+1):
        for j in range(i+1):
            if j==0:
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i-1]) 
            else : 
                dp[i][j] = (dp[i - 1][j] * (1.0 - p[i-1]) +
                            dp[i - 1][j - 1] * p[i-1])  
    ans=0.0
    for i in range((n+1)//2,n+1):
        ans+=dp[n][i]
    return ans 

n=int(input())
a=list(map(float,input().split()))

 

print(Probability(a,n))

Buggy submission (verdict: Runtime Error):
import numpy as np

def Probability(p,n):
    dp = np.zeros((n+1 ,n+1)) 
    for i in range(n+1):
        for j in range(n+1):
            dp[i][j] = 0.0 
    dp[0][0] = 1.0
    
    for i in range(1,n+1):
        for j in range(i+1):
            if j==0:
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i]) 
            else : 
                dp[i][j] = (dp[i - 1][j] * (1.0 - p[i]) +
                            dp[i - 1][j - 1] * p[i])  
    ans=0.0
    for i in range((n+1)//2,n+1):
        ans+=dp[n][i]
    return ans 

n=int(input())
a=list(map(float,input().split()))

a=[0]+a 

print(Probability(a,n))
Problem p02641 (python)

Fixed submission:
def dev(y,x):
    if y<x:
        return 2*(x-y)-1
    else:
        return 2*(y-x)


x,n=map(int,input().split())
p=[int(y) for y in input().split()]
q=[dev(y,x) for y in p]
q.sort()
r=0
while r<len(q):
    if q[r]!=r:
        break
    r+=1
if r%2==0:
    print(x+r//2)
else:
    print(x-(r+1)//2)

Buggy submission (verdict: Runtime Error):
def dev(y,x):
    if y<x:
        return 2*(x-y)-1
    else:
        return 2*(y-x)


x,n=map(int,input().split())
if n==0:
    print(x)
else:
    p=[int(y) for y in input().split()]
    q=[dev(y,x) for y in p]
    q.sort()
    r=0
    while True:
        if q[r]!=r:
            break
        r+=1
    if r%2==0:
        print(x+r//2)
    else:
        print(x-(r+1)//2)
Problem p02658 (python)

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
if 0 in a:
    print(0)
else:
    s=1
    for c in range(n):
        s=s*a[c]
        if s>10**18:
            s=-1
            break
    print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(x) for x in input().split()]
if 0 in s:
    print(0)
else:
    s=1
    for c in range(n):
        s=s*a[c]
        if s>10**18:
            s=-1
            break
    print(s)
Problem p02678 (python)

Fixed submission:
n,m=map(int,input().split())
g=[[] for x in range(n)]
for c in range(m):
    a,b= map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

ans_list=[-1]*n

queue=[0]

while queue:
    qi=queue.pop(0)
    for gi in g[qi]:
        if ans_list[gi]==-1:
            queue.append(gi)
            ans_list[gi]=qi

print("Yes")
for ans in ans_list[1:]:
    print(ans+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
r=[[] for x in range(n)]
for c in range(m):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
s=[-1]*n
u=[0]
k=1
for c in range(10**5):
  v=[]
    for d in u:
        for e in r[d]:
            if s[e]==-1:
                s[e]=d
                k+=1
                v.append(e)
    if k>n-1:
        break
    u=v
print('Yes')
for c in range(n-1):
    print(s[c+1]+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
r=[[] for x in range(n)]
for c in range(m):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
s=[-1]*n
u=[0]
k=1
for c in range(10**5):
  	v=[]
    for d in u:
        for e in r[d]:
            if s[e]==-1:
                s[e]=d
                k+=1
                v.append(e)
    if k>n-1:
        break
    u=v
print('Yes')
for c in range(n-1):
    print(s[c+1]+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
g=[[] for x in range(n)]
for c in range(M):
    a,b= map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

ans_list=[-1]*n

queue=[0]

while queue:
    qi=queue.pop(0)
    for gi in g[qi]:
        if ans_list[gi]==-1:
            queue.append(gi)
            ans_list[gi]=qi

print("Yes")
for ans in ans_list[1:]:
    print(ans+1)
Problem p02742 (python)

Fixed submission:
h,w=map(int,input().split())
if (h-1)*(w-1)==0:
  print(1)
else:
  print(-(-h*w//2))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
if (h*w)%2==1:
    print((h*w+1)//2)
else:
    print((h*w)//a2)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
if (h*w)%2=1:
    print((h*w+1)//2)
else:
    print((h*w)//a2)
Problem p02888 (python)

Fixed submission:
def bis_right(lis,dev):
    a=0
    b=len(lis)-1
    while a<b:
        c=(a+b)//2
        if lis[c]>dev:
            b=c
        else:
            a=c+1
    if lis[a]<=dev:
        return a
    return a-1



n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(n-2):
    for b in range(a+1,n-1):
        c=bis_right(l[b+1:],l[a]+l[b]-1)
        s+=c+1
print(s)

Buggy submission (verdict: Runtime Error):
def bis_right(lis,dev):
    a=0
    b=len(lis)
    while a<b:
        c=(a+b)//2
        if lis[c]>dev:
            b=c
        else:
            a=c+1
    if lis[a]<=dev:
        return a
    return a-1



n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(n-2):
    for b in range(a+1,n-1):
        c=bis_right(l[b+1:],l[a]+l[b]-1)
        s+=c+1
print(s)

Buggy submission (verdict: Runtime Error):
def comp(ext,list0,dev):
    if list0[int((ext[0]+ext[1])/2)]>dev:
        return ext[0],int((ext[0]+ext[1])/2)
    else:
        return int((ext[0]+ext[1])/2),ext[1]


def bis(a,b,list0,dev):
    ls=[a,b]
    while ls[0]+1<ls[1]:
        ls=comp(ls,list0,dev)
    if list0[ls[0]]==dev:
        return ls[0]-1
    elif list0[ls[1]]==dev:
        return ls[1]-1
    else:
        return ls[0]


n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(0,n-2):
    for b in range(a+1,n-1):
        if l[a]+l[b]>l[n-1]:
            c=n-1
        elif l[a]+l[b]<l[b+1]:
            c=b
        else:
            c=bis(b+1,n-1,l,l[a]+l[b])
        s=s+c-b
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(0,n-2):
    for b in range(a+1,n-1):
        c=b+1
        while l[c]<l[a]+l[b]:
            s=s+1
            c=c+1
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(0,n-2):
    for b in range(a+1,n-1):
        c=b+1
        while l[c]<l[a]+l[b]:
            s=s+1
            b=b+1
print(s)
Problem p02922 (python)

Fixed submission:
a,b=map(int,input().split())
if (b-1)%(a-1)==0:
    c=int((b-1)/(a-1))
else:
    c=int((b-1)/(a-1))+1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (b-1)¥(a-1)==0:
    c=int((b-1)/(a-1))
else:
    c=int((b-1)/(a-1))+1
print(c)
Problem p02677 (python)

Fixed submission:
import math

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

H_angle = 30*H + 0.5*M # (360/(12*60)) * ((60*H)+M)
M_angle = 6*M          # 360/60 * H
HM_angle = abs(H_angle - M_angle)

if HM_angle == 0:
    print(abs(A-B))
elif HM_angle == 180:
    print(A+B)
else:
    print((A**2 + B**2 - 2*A*B*math.cos(math.radians(HM_angle)))**0.5)

Buggy submission (verdict: Runtime Error):
import math

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

H_angle = 30*H + 0.5*M # (360/(12*60)) * ((60*H)+M)
M_angle = 6*M          # 360/60 * H
HM_angle = abs(H_angle - M_angle)

if HM_angle == 0:
    print(abc(A-B))
elif HM_angle == 180:
    print(A+B)
else:
    if HM_angle > 180 :
        HM_angle -= 180
    print((A**2 + B**2 - 2*A*B*math.cos(math.radians(HM_angle)))**0.5)
Problem p03246 (python)

Fixed submission:
import collections

n = int(input())
v = list(map(int,input().split()))

v1 = v[::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)

if (v1 == v2 and len(c1.most_common()) == 1):
    print(len(v1))
elif c1.most_common()[0][0] != c2.most_common()[0][0]:
    print(len(v1) - c1.most_common()[0][1] + len(v2) - c2.most_common()[0][1])
else:
    if c1.most_common()[1][1] < c2.most_common()[1][1]:
        print(len(v1) - c1.most_common()[0][1] + len(v2) - c2.most_common()[1][1])
    else:
        print(len(v1) - c1.most_common()[1][1] + len(v2) - c2.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
v = list(map(int,input().split()))

v1 = v[::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)

if v1 == v2 and len(c1.most_common()) == 1
    print(len(v1))
elif c1.most_common()[0][0] != c2.most_common()[0][0]:
    print(len(v1) - c1.most_common()[0][1] + len(v2) - c2.most_common()[0][1])
else:
    if c1.most_common()[1][1] < c2.most_common()[1][1]:
        print(len(v1) - c1.most_common()[0][1] + len(v2) - c2.most_common()[1][1])
    else:
        print(len(v1) - c1.most_common()[1][1] + len(v2) - c2.most_common()[0][1])
Problem p02555 (python)

Fixed submission:
S=int(input())
a = [0]*(2000+1)
a[3]=1
for i in range(4, S+1):
  a[i] = a[i-3] + a[i-1]
mod=10**9+7
print(a[S]%mod)

Buggy submission (verdict: Runtime Error):
S=int(input())
a = [0]*(S+1)
a[3]=1
for i in range(4, S+1):
  a[i] = a[i-3] + a[i-1]
mod=10**9+7
print(a[S]%mod)