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

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, q = na()
s = input()
ct = [0] * n
for i in range(n-1):
    if s[i:i+2] == 'AC':
        ct[i+1] = 1
for i in range(n-1):
    ct[i+1] += ct[i]
for i in range(q):
    l, r = na()
    l -= 1
    r -= 1
    print(ct[r] - ct[l])

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


li = []
n = int(input())
for i in range(5):
    li.append(int(input()))
if n <= min(li):
    print(5)
else:
    if n % min(li) == 0:
        print(5 + n // min(li) -1)
    else:
        print(5 + n // min(li))

Buggy submission (verdict: Runtime Error):
li = []
n = int(input())
for i in range(5):
    li.append(int(input()))
print(5 + n // min(li))

Buggy submission (verdict: Runtime Error):
mport sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, q = na()
s = input()
index = [i for i in range(len(s)) if s[i:i+2]=="AC"]
for i in range(q):
    l, r = na()
    print(len([i for i in index if l - 1 <= i <= r - 1 and l - 1 <= i + 1 <= r - 1]))

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, q = na()
s = input()
index = []
for i in range(len(s)):
    if s[i:i+2] == "AC":
        index.append(i)
for i in range(q):
    l, r = na()
    print(len([i for i in index if l-1<= i <= r-1))
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map((int, input().split()))
print(a + b if b % a == 0 else b-a)
Problem p03240 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
x_li = []
y_li = []
h_li = []
for i in range(n):
    x, y, h = na()
    x_li.append(x)
    y_li.append(y)
    h_li.append(h)
H = -1
ansX = -1
ansY = -1
flag = False
if h_li.count(0) == len(h_li) - 1:
    idx = h_li.index(1)
    print(x_li[idx], y_li[idx], h_li[idx])
else:
    for x in range(101):
        for y in range(101):
            for i in range(n):
                tmp = h_li[i] + abs(x_li[i] - x) + abs(y_li[i] - y)
                if H == -1 and h_li[i] != 0:
                    H = tmp
                    ansX = x
                    ansY = y
                elif H == tmp or h_li[i] == 0:
                    if i == n - 1:
                        flag = True
                        break
                else:
                    H = -1
                    break
            if flag:
                break
        if flag:
            break

    print(ansX, ansY, H)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
x_li = []
y_li = []
h_li = []
for i in range(n):
    x, y, h = na()
    x_li.append(x)
    y_li.append(y)
    h_li.append(h)
ans = []
flag = False
for x in range(101):
    for y in range(101):
        H = h_li[0] + abs(x_li[0] - x) + abs(y_li[0] - y)
        for i in range(n):
            if h_li[i] == max(H - abs(x_li[i] - x) - abs(y_li[i] - y), 0):
                if i == n - 1:
                    flag = True
                    ans.append([x, y, H])
                    break
            else:
                break
        if flag:
            break
    if flag:
        break
print(*ans[0])
Problem p03261 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
word = input()
li = [word]
end = word[-1]
ans = 'Yes'
for i in range(n-1):
    word = input()
    if word[0] != end or word in li:
        ans = 'No'
        break
    end = word[-1]
    li.append(word)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
word = input()
li = [word]
end = word[-1]
ans = 'Yes'
for i in range(n):
    word = input()
    if word[0] != end or word in li:
        ans = 'No'
        break
    end = word[-1]
    li.append(word)
print(ans)
Problem p03262 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, x = na()
x_li = na()
li = []
for i in range(n):
    li.append(abs(x - x_li[i]))
import fractions

ans = li[0]
for i in range(n):
    ans = fractions.gcd(ans, li[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, x = na()
x_li = na()
li = []
for i in range(n):
    li.append(abs(x - x_li[i]))
import functools
import math

gcd = functools.reduce(math.gcd, li)
print(gcd)
Problem p03282 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
k = ni()
keta = 0
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        keta = i
        break
if k < keta + 1:
    print("1")
else:
    print(s[keta])

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
k = ni()
keta = 0
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        keta = i + 1
        break
if k < keta:
    print("1")
else:
    print(s[keta])

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
k = ni()
ans_idx = len(s)
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        ans_idx = i
        break
if ans_idx - 1 >= k:
    print("1")
else:
    print(s[ans_idx])
Problem p03309 (python)

Fixed submission:
import sys
from collections import deque
from collections import  Counter
import statistics
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a_li = na()
for i in range(n):
    a_li[i] = a_li[i] - (i + 1)
m1 = statistics.median_low(a_li)
m2 = statistics.median_high(a_li)
ans1 = 0
ans2 = 0
for i in range(n):
    ans1 += abs(a_li[i] - m1)
    ans2 += abs(a_li[i] - m2)
print(min(ans1, ans2))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
from collections import  Counter
import statistics
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a_li = na()
for i in range(n):
    a_li[i] = a_li[i] - (i + 1)
m1 = statistics.median_low(a_li)
#m2 = statistics.median_high(a_li)
ans1 = 0
#ans2 = 0
for i in range(n):
    ans1 += abs(a_li[i] - m1)
    #ans2 += abs(a_li[i] - m2)
print(min(ans1))
Problem p03330 (python)

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
from heapq import heappush, heappop
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, C = na()
D = [na() for _ in range(C)]
c = [na() for _ in range(N)]

z = {}
o = {}
t = {}
for i in range(1, N+1):
    for j in range(1, N+1):
        q = (i + j) % 3
        now = c[i - 1][j - 1] - 1
        if q == 0:
            if now not in z.keys():
                z[now] = 1
            else:
                z[now] += 1
        if q == 1:
            if now not in o.keys():
                o[now] = 1
            else:
                o[now] += 1
        if q == 2:
            if now not in t.keys():
                t[now] = 1
            else:
                t[now] += 1

ans = inf
for i, j, l in itertools.permutations(range(C), 3):
    tmp = 0
    for k, v in z.items():
        tmp += v * D[k][i]
    for k, v in o.items():
        tmp += v * D[k][j]
    for k, v in t.items():
        tmp += v * D[k][l]
    ans = min(tmp, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
from heapq import heappush, heappop
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, C = na()
D = [na() for _ in range(C)]
c = [na() for _ in range(N)]

z = []
o = []
t = []
for i in range(1, N+1):
    for j in range(1, N+1):
        q = (i + j) % 3
        if q == 0:
            z.append(c[i-1][j-1] - 1)
        if q == 1:
            o.append(c[i-1][j-1] - 1)
        if q == 2:
            t.append(c[i-1][j-1] - 1)

ans = inf
for i, j, k in itertools.permutations(range(3), 3):
    tmp = 0
    for num in z:
        tmp += D[num][i]
    for num in o:
        tmp += D[num][j]
    for num in t:
        tmp += D[num][k]
    ans = min(tmp, ans)
print(ans)
Problem p03353 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
k = ni()
li = []
for i in range(len(s)):
    for j in range(i, i+k+1):
        li.append(s[i:j+1])
li = list(set(li))
li.sort()
print(li[k-1])

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
from collections import  Counter
import statistics
import math

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
k = ni()
li = []
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[i:j+1] not in li:
            li.append(s[i:j+1])
li.sort()
print(li[k-1])
Problem p03469 (python)

Fixed submission:
import sys
from statistics import *
from collections import *
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
print("2018"+ s[4:])

Buggy submission (verdict: Runtime Error):
n = int(input())
li = []
for i in range(n):
    num = int(input())
    if num not in li:
        li.append(num)
print(len(li))
Problem p03479 (python)

Fixed submission:
import sys
from statistics import *
from collections import *
from operator import itemgetter
from fractions import gcd
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
def lcm(x, y):
    return (x * y) // gcd(x, y)


x, y = na()
if x * 2 > y:
    print(1)
else:
    ct = 2
    num1 = x
    num2 = x*2
    while True:
        g = lcm(num1, num2)
        if g * 2 <= y:
            ct += 1
            num1 = num2
            num2 = g * 2
        else:
            break
    print(ct)

Buggy submission (verdict: Runtime Error):
import sys
from statistics import *
from collections import *
from operator import itemgetter
from fractions import gcd
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
def lcm(x, y):
    return (x * y) // gcd(x, y)


x, y = na()
if x * 2 > y:
    print(1)
else:
    ct = 2
    num1 = x
    num2 = x*2
while True:
    g = lcm(num1, num2)
    if g * 2 <= y:
        ct += 1
        num1 = num2
        num2 = g * 2
    else:
        break
print(ct)

Buggy submission (verdict: Runtime Error):
import sys
from statistics import *
from collections import *
from operator import itemgetter
from fractions import gcd
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
def lcm(x, y):
    return (x * y) // gcd(x, y)


x, y = na()
if x * 2 > y:
    print(1)
else:
    ct = 2
    num1 = x
    num2 = x*2
while True:
    g = lcm(num1, num2)
    if g * 2 <= y:
        ct += 1
        num1 = num2
        num2 = g * 2
    else:
        break
print(ct)
Problem p03504 (python)

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, C = na()
ans = [0] * ((10 ** 5) * 2 + 10)
for i in range(N):
    s, t, c = na()
    ans[s] += 1
    ans[t+1] -= 1

for i in range(len(ans)-1):
    ans[i+1] += ans[i]
print(min(max(ans), C))

Buggy submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, C = na()
ans = [0] * ((10 ** 5) * 2 + 10)
for i in range(N):
    s, t, c = na()
    ans[s] += 1
    ans[t+1] -= 1

for i in range(len(ans)-1):
    ans[i+1] += ans[i]
print(min(max(ans)), C)
Problem p03557 (python)

Fixed submission:
import sys
import  math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
aaa = na()
bbb = na()
ccc = na()
aaa.sort()
ccc.sort()
l = 0
r = 0
ct = 0
ct = 0
for i in range(n):
    l = bisect.bisect_left(aaa, bbb[i])
    r = bisect.bisect_right(ccc, bbb[i])
    ct += l * (n - r)

print(ct)

Buggy submission (verdict: Runtime Error):
import sys
import  math
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
aaa = na()
bbb = na()
ccc = na()
aaa.sort()
bbb.sort()
ccc.sort()
l = 0
r = 0
ct = 0
for i in range(n):
    r = 0
    for j in range(l, n):
        if aaa[i] < bbb[j]:
            for k in range(r, n):
                if bbb[j] < ccc[k]:
                    ct += (n - k)
                    r = k
                    break
print(ct)
Problem p03697 (python)

Fixed submission:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b = na()
print(a + b if a + b < 10 else 'error')

Buggy submission (verdict: Runtime Error):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b = na()
print(a + b if a + b  10 else 'error')
Problem p03836 (python)

Fixed submission:
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

sx, sy, tx, ty = na()
ans = ""
dx = tx - sx
dy = ty - sy

ans += dy * "U"
ans += dx * "R"

ans += dy * 'D'
ans += dx * "L"

ans += "L"
ans += "U" * (dy + 1)
ans += 'R' * (dx + 1)
ans += "D"

ans += "R"
ans += 'D' * (dy + 1)
ans += "L" * (dx + 1)
ans += "U"

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

sx, sy, tx, ty = na()
ans = ""
dx = tx - sx
dy = ty - sy

ans += dy * "U"
ans += dx * "R"

ans += dy * 'D'
ans += dx * "L"

ans += "L"
ans += "U" * (dy + 1)
ans += 'R' * (dx + 1)
ans += "D"

ans += "R"
ans += 'D' * (dy + 1)
ans += "L" * (dx + 1)
ans += "U"

print(ans)
Problem p02909 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 天気の入力
s = (input())
# 出力
lis = ['Sunny', 'Cloudy', 'Rainy']
index = lis.index(s)
index = (index+1)%len(lis)
print(lis[index])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 天気の入力
s = int(input())
# 出力
lis = ['Sunny', 'Cloudy', 'Rainy']
index = lis.index(s)
index = (index+1)%len(lis)
print(lis[index])
Problem p02918 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N, K = zz()
S = S()
change_points = [0]
if (N == 1):
    print(0)
    exit()
if (S[0] == S[1] == 'R'):
    ans = 1
else:
    ans = 0
for i in range(1, N):
    if S[i] == 'L':
        if (S[i - 1] == 'L'):
            ans += 1
    else:
        if (i == N - 1):
            pass
        elif (S[i + 1] == 'R'):
            ans += 1

    if (S[i] != S[i - 1]):
        change_points.append(i)
# print(change_points)
# print(ans)
ans += (2*K)

print(min(ans, N-1))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N, K = zz()
S = S()
change_points = [0]
if (S[0] == S[1] == 'R'):
    ans = 1
else:
    ans = 0
for i in range(1, N):
    if S[i] == 'L':
        if (S[i - 1] == 'L'):
            ans += 1
    else:
        if (i == N - 1):
            pass
        elif (S[i + 1] == 'R'):
            ans += 1

    if (S[i] != S[i - 1]):
        change_points.append(i)
# print(change_points)
# print(ans)
ans += (2*K)

print(min(ans, N-1))
Problem p02845 (python)

Fixed submission:
n,*a=map(int,open(0).read().split())
mod=10**9+7
l=[0]*(n+1)
l[0]=3
ans=1
for ai in a:
  ans*=l[ai]
  ans%=mod
  l[ai]-=1
  l[ai+1]+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
mod=10**9+7
l=[0]*n
l[0]=3
ans=1
for ai in a:
  ans*=l[ai]
  ans%=mod
  l[ai]-=1
  l[ai+1]+=1
print(ans)
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
m=[l+i for i in range(n)]
s=sum(m)
t=101
d=0
for i in range(n):
  if t>abs(m[i]):
    t=abs(m[i])
    d=m[i]
print(s-d)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
print(((l+n-1)*(l+n)-l*(l+1))//2-l if l>=0 else (((l+n-1)*(l+n)-l*(l+1))//2 if l<0 and l+n>0 ((l+n-1)*(l+n)-l*(l+1))//2-(l+n-1)))
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
i=1
while i<=n:
  d+=l[i-1]
  if x<d:
    break
  i+=1
print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
i=0
while(True):
  d+=l[i]
  i+=1
  if(!(d<x or i<=n)):
    break
print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
i=0
while(True):
  d+=l[i-1]
  i+=1
  if(!(d<x or i<=n)):
    break
print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
i=0
while(d<=x and i<=n):
  d+=l[i]
  i+=1;
print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
i=0
while(d<=x):
  d+=l[i]
  i+=1;
print(i)
Problem p03006 (python)

Fixed submission:
from collections import Counter
n=int(input())
if n==1:
  print(1)
  exit()
xy=[tuple(map(int,input().split())) for _ in range(n)]
xy.sort()
l=[]
for i in range(n-1):
  for j in range(i+1,n):
    l.append((xy[j][0]-xy[i][0],xy[j][1]-xy[i][1]))
print(n-Counter(l).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
xy=[tuple(map(int,input().split())) for _ in range(n)]
xy.sort()
l=[]
for i in range(n-1):
  for j in range(i+1,n):
    l.append((xy[j][0]-xy[i][0],xy[j][1]-xy[i][1]))
print(n-Counter(l).most_common()[0][1])
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(iunt,input().split())
print(a+b if b%a==0 else b-a)
Problem p03136 (python)

Fixed submission:
n=int(input())
l=sorted(list(map(int,input().split())))
m=l.pop(-1)
print("Yes" if m<sum(l) else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
m=l.pop(max(l))
print("Yes" if m>sum(l) else "No")