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

Fixed submission:
N = int(input())
cnt = int()
A=[]
for i in range(5):
    A.append(int(input()))
A.sort()
print(-(-N//min(A))+4)

Buggy submission (verdict: Runtime Error):
n=input();a=input();b=input();c=input();d=input();e=input()
turn=1
turn+=n//a+1
if n%a==0 and n!=a:
  A=n/a
elif n==a:
  A=n
else:
  A=n%a
turn+=A//b+1
if A%b==0 and A!=b:
  B=A/b
elif A==b:
  B=A
else:
  B=A%b
turn+=B//c+1
if B%c==0 and B!=c:
  C=B/c
elif B==c:
  C=B
else:
  C=B%c
turn+=C//d+1
if C%d==0 and C!=d:
  D=C/d
elif C==d:
  D=C
else:
  D=C%d
turn+=D//e+1
print(turn)

Buggy submission (verdict: Runtime Error):
n=input();a=input();b=input();c=input();d=input();e=input()
turn=1
turn+=n//a+1
if n%a==0 and n!=a:
  A=n/a
elif n==a:
  A=n
else:
  A=n%a
turn+=A//b+1
if A%b==0 and n!=b:
  B=A/b
elif A==b:
  B=A
else:
  B=A%b
turn+=B//c+1
if B%c==0 and n!=c:
  C=B/c
elif B==c:
  C=B
else:
  C=B%c
turn+=C//d+1
if C%d==0 and n!=d:
  D=C/d
elif C==d:
  D=C
else:
  D=C%d
turn+=D//e+1
print(turn)

Buggy submission (verdict: Runtime Error):
n=input();a=input();b=input();c=input();d=input();e=input()
turn=1
turn+=n//a+1
turn+=n%a//b+1
turn+=n%a%b//c+1
turn+=n%a%b%c//d+1
turn+=n%a%b%c%d//e+1
print(turn)

Buggy submission (verdict: Runtime Error):
N,A,B,C,D,E=input().split()
Problem p03242 (python)

Fixed submission:
N=str(input())

A=''
for i in range(3):
  if N[i]=='9':
    A=A+'1'
  else:
    A=A+'9'

print(int(A))

Buggy submission (verdict: Runtime Error):
N=int(input())

A=''
for i in range(3):
  if N[i]==1:
    A=A+'9'
  else:
    A=A+'1'

print(int(A))
Problem p03272 (python)

Fixed submission:
N,i=map(int, input().split())
print(N-i+1)

Buggy submission (verdict: Runtime Error):
N,i=map(int, input().split())
print(L-i+1)
Problem p03803 (python)

Fixed submission:
A,B=map(int,input().split())
if A==1 or B==1:
  if A==B:
    print('Draw')
  elif A==1:
    print('Alice')
  else:
    print('Bob')
elif A>B:
  print('Alice')
elif A<B:
  print('Bob')
else:
  print('Draw')

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A==1 or B==1:
  if A==B:
    print('Draw')
  elif A=1:
    print('Alice')
  else:
    print('Bob')
elif A>B:
  print('Alice')
elif A<B:
  print('Bob')
else:
  print('Draw')
Problem p02595 (python)

Fixed submission:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,d = ma()
cnt=0
for i in range(n):
    p,q = ma()
    if p**2 + q**2 <=d**2:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,d = ma()
cnt=0
for i in range(n):
    p,q = ma()
    if p**2 + q**2 <=D**2:
        cnt+=1
print(cnt)
Problem p02659 (python)

Fixed submission:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
a,b = input().split()
a = int(a)
b100 = 100*int(b[0]) + 10*int(b[2]) +int(b[3])

print(a*b100//100)

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
a,b = input().split()
a = int(a)
b100 = 100*int(b[0]) + 10*int(b[1]) +int(b[2])

print(a*b100//100)
Problem p02679 (python)

Fixed submission:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
import sys
gcd = math.gcd
co = collections.Counter()
n = ni()
mod=10**9+7
for i in range(n):
    a,b = ma()
    d = gcd(a,b)
    if d!=0:
        a//=d
        b//=d
    elif abs(a)>0 or abs(b)>0:
        l = max(abs(a), abs(b))
        a//=l
        b//=l
    co[(a,b)]+=1
d = collections.defaultdict(lambda:False)
ans=1
for t,cnt in co.items():
    a,b = t
    if t==(0,0) or d[t]:
        continue
    d[(a,b)]=True;d[(-a,-b)]=True;d[(b,-a)]=True;d[(-b,a)]=True
    l1 = co[(a,b)]+co[(-a,-b)]
    l2 = co[(b,-a)]+co[(-b,a)]
    ans=ans*(pow(2,l1,mod)+pow(2,l2,mod) -1)%mod
    ans%=mod
print((ans-1 +co[(0,0)])%mod)

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
import sys
gcd = math.gcd
co = collections.Counter()
n = ni()
mod=10**9+7
for i in range(n):
    a,b = ma()
    d = gcd(a,b)
    a//=d
    b//=d
    co[(a,b)]+=1
d = collections.defaultdict(lambda:False)
ans=1
for t,cnt in co.items():
    a,b = t
    if t==(0,0) or d[t]:
        continue
    d[(a,b)]=True;d[(-a,-b)]=True;d[(b,-a)]=True;d[(-b,a)]=True
    l1 = co[(a,b)]+co[(-a,-b)]
    l2 = co[(b,-a)]+co[(-b,a)]
    ans=ans*(pow(2,l1,mod)+pow(2,l2,mod) -1)%mod
    ans%=mod
print((ans-1)%mod)
Problem p02785 (python)

Fixed submission:
n,k = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
if k>=n:
    print(0)
else:
    print(sum(H[0:n-k]))

Buggy submission (verdict: Runtime Error):
3 1
4 1 5
Problem p02831 (python)

Fixed submission:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
import fractions
gcd = fractions.gcd
a,b = ma()
print(a*b//gcd(a,b))

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
a,b = ma()
print(a*b//gcd(a,b))
Problem p03108 (python)

Fixed submission:
ma = lambda : map(int,input().split())
import sys
sys.setrecursionlimit(10**6)
class unionfind():
    def __init__(self,n):
        self.par = list(range(n))
        self.size = [1]*n
        self.rank = [0]*n

    def root(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def same(self,x,y):
        return self.root(x) == self.root(y)

    def unite(self,x,y):
        x = self.root(x)
        y = self.root(y)
        if x!=y:
            if self.rank[x] < self.rank[y]:
                 x,y = y,x
            if self.rank[x] < self.rank[y]:
                self.rank[x]+=1
            self.par[y] = x
            self.size[x] +=self.size[y]
    def get_size(self,x):
        x = self.root(x)
        return self.size[x]

n,m = ma()
ans = [0]*m
ab = []
for i in range(m):
    a,b = ma()
    ab.append((a-1,b-1))

uf = unionfind(n)
ans[m-1] = n*(n-1)//2
for i in range(m-1,0,-1):
    a,b = ab[i]
    if uf.same(a,b):
        ans[i-1] = ans[i]
    else:
        ans[i-1] = ans[i] - uf.get_size(a)*uf.get_size(b)
        uf.unite(a,b)
for a in ans:print(a)

Buggy submission (verdict: Runtime Error):
ma = lambda : map(int,input().split())
class unionfind():
    def __init__(self,n):
        self.par = list(range(n))
        self.size = [1]*n
        self.rank = [0]*n

    def root(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def same(self,x,y):
        return self.root(x) == self.root(y)

    def unite(self,x,y):
        x = self.root(x)
        y = self.root(y)
        if x!=y:
            if self.rank[x] < self.rank[y]:
                 x,y = y,x
            if self.rank[x] < self.rank[y]:
                self.rank[x]+=1
            self.par[y] = x
            self.size[x] +=self.size[y]
    def get_size(self,x):
        x = self.root(x)
        return self.size[x]

n,m = ma()
ans = [0]*m
ab = []
for i in range(m):
    a,b = ma()
    ab.append((a-1,b-1))

uf = unionfind(n)
ans[m-1] = n*(n-1)//2
for i in range(m-1,0,-1):
    a,b = ab[i]
    if uf.same(a,b):
        ans[i-1] = ans[i]
    else:
        ans[i-1] = ans[i] - uf.get_size(a)*uf.get_size(b)
        uf.unite(a,b)
for a in ans:print(a)
Problem p03745 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
cnt = 0
id = 1
while a != []:
    if len(a)==1:
        cnt += 1
        break
    if a[0] == a[1]:
        while a[id-1] == a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
        if id == n:
            cnt = 1
            break
        del(a[:id-1])
        id = 1
    if a[0] > a[1]:
        while  a[id-1] >= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    elif a[0] < a[1]:
        while a[id-1] <= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    cnt += 1
    del(a[:id])
    id = 1


print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
id = 1
while a != []:
    if a[0] == a[1]:
        while a[id-1] == a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
        del(a[:id-1])
        if id == n:
          cnt = 1
          break
        id = 1
    if a[0] > a[1]:
        while  a[id-1] >= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    elif a[0] < a[1]:
        while a[id-1] <= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    cnt += 1
    del(a[:id])
    id = 1

    if len(a)==1:
        cnt += 1
        break

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
id = 1
while a != []:
    if a[0] == a[1]:
        while a[id-1] == a[id] and id < len(a)-1:
            id += 1
        del(a[:id-1])
        id = 1
    if a[0] > a[1]:
        while  a[id-1] >= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    elif a[0] < a[1]:
        while a[id-1] <= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    cnt += 1
    del(a[:id])
    id = 1

    if len(a)==1:
        cnt += 1
        break

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
while a != []:
    id = 1
    if a[0] == a[1]:
        while a[id-1] == a[id]:
            id += 1
        del(a[:id-1])
        id = 1

    if a[0] > a[1]:
        while a[id-1] >= a[id] and id < len(a)-1:
            id += 1
    elif a[0] < a[1]:
        while a[id-1] <= a[id] and id < len(a)-1:
            id += 1
    cnt += 1
    if id ==len(a)-1:break 
    del(a[:id])

    if len(a)==1:
        cnt += 1
        break
print(cnt)
Problem p03774 (python)

Fixed submission:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,m = ma()
ckp = []
st = []

for i in range(n):
    st.append(lma())
for i in range(m):
    ckp.append(lma())
for a,b in st:
    tmp=10**15
    ans=0
    for i  in range(m):
        c,d=ckp[i]
        if tmp>abs(a-c)+abs(b-d):
            tmp=abs(a-c)+abs(b-d)
            ans=i+1
    print(ans)

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,m = ma()
ckp = []
st = []

for i in range(n):
    st.append(lma())
for i in range(m):
    ckp.append(lma())
for a,b in st:
    tmp=10**15
    ans=0
    for i  in range(m):
        if tmp<abs(a-c)+abs(b-d):
            tmp=abs(a-c)+abs(b-d)
            ans=i+1
    print(ans)
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())
Xm = k
Ym = k
Zm = k #使わない
count = 0
for i in range(Xm+1):
  for j in range(Ym+1):
    if 0<= s - (i+j) <= k:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())
Xm = k
Ym = k
Zm = k
count = 0
for i in range(Xm+1):
  for j in range(Ym+1):
    for m in range(Zm+1):
      if i+j+m = s:
        count += 1
print(count)
Problem p02881 (python)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
divisors = []
def make_divisors(n):
    for i in range(1, int(math.sqrt(n)) + 1):
        a, b = 0, 0
        if n % i == 0:
            a = i
            b = n // i
            divisors.append([a, b])

make_divisors(N)

ans = float('inf')
for i in divisors:
    a, b = i
    ans = min(ans, a + b - 2)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
split = math.floor(n ** (1/2))
ans = 0
for i in range(1, split):
    m = n / (split - i)
    if m.is_integer():
        ans = m
        break
print((int(m) - 1) + (int(n / m) - 1))
Problem p03104 (python)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 61
flags2 = [0] * 61
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)
for i in range(61):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(61):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans)

Buggy submission (verdict: Runtime Error):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 40
flags2 = [0] * 40
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 40):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)

for i in range()
for i in range(40):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(40):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans)
Problem p03127 (python)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = getList()

ans = A[0]
for i in range(1, N):
    ans = fractions.gcd(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = getList()

ans = A[0]
for i in range(1, N):
    ans = math.gcd(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = getList()

ans = A[0]
for i in range(1, N - 1):
    ans = math.gcd(ans, A[i])
print(ans)
Problem p03618 (python)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

A = input()
Ac = Counter(A)
cnt = 0
for val in Ac.values():
    cnt += val * (val - 1) // 2
print(len(A) * (len(A)-1) // 2 - cnt + 1)

Buggy submission (verdict: Runtime Error):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

A = input()
Ac = collections.Counter(A)
cnt = 0
for val in Ac.values():
    cnt += val * (val - 1) // 2
print(len(A) * (len(A)-1) // 2 - cnt + 1)
Problem p03804 (python)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N, M = map(int, input().split())
A = [0]*N
B = [0]*M

for i in range(N):
	A[i] = input()
for i in range(M):
	B[i] = input()

ans = False
for sy in range(N-M+1):
	for sx in range(N-M+1):
		flag = True
		for iy in range(M):
			if B[iy] != A[sy+iy][sx:sx+M]:
				flag = False
				break
		if flag:
			ans = True
			break

if ans:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

def dfs(idx, end, value, cost, g):
    if idx == end:
        if cost == 0:
            return

        if value not in g:
            g[value] = cost
        else:
            g[value] = min(g[value], cost)

        return

    a, b, c = table[idx]
    dfs(idx + 1, end, value + b * Ma - a * Mb, cost + c, g)
    dfs(idx + 1, end, value, cost, g)

N, Ma, Mb = map(int, input().split())
table = [tuple(map(int, input().split())) for i in range(N)]

g1, g2 = dict(), dict()
dfs(0, N // 2, 0, 0, g1)
dfs(N // 2, N, 0, 0, g2)

inf = 100*40 + 1
ans = inf

if 0 in g1:
    ans = min(ans, g1[0])
if 0 in g2:
    ans = min(ans, g2[0])

for v1, c1 in g1.items():
    if -v1 in g2:
        tmp = c1 + g2[-v1]
        ans = min(ans, tmp)

if ans < inf:
    print(ans)
else:
    print(-1)
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())
if S*T >=D:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
a = len(s)
b = len(t)
l = []
for i in range(a-b+1):
    cnt = 0
    c = s[i,i+t]
    for x, y in zip(c, t):
        if x != y:
            cnt +=1
    l.append(cnt)
print(min(l))