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

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ans = True
a[0] -= 1
for i in range(1,n):
  if a[i]>a[i-1]:
    a[i] -= 1
  elif a[i]==a[i-1]:
    pass
  else:
    ans = False
    break
if ans==True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in list(input())]
ans = True
a[0] -= 1
for i in range(1,n):
  if a[i]>a[i-1]:
    a[i] -= 1
  elif a[i]==a[i-1]:
    pass
  else:
    ans = False
    break
if ans==True:
  print("Yes")
else:
  print("No")
Problem p03095 (python)

Fixed submission:
hoge=input()
str=input()

dic={}
for alp in str:
    if alp in dic:
        dic[alp] += 1
    else:
        dic[alp] = 1

ans=1

for alp,num in dic.items():
    ans *= (num+1)

ans -= 1
print(ans%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
hoge=input()
str=input()

dic={}
for alp in str:
    if alp in dic:
        dic[alp] += 1
    else:
        dic[alp] = 1

ans=1

for alp,num in dic.items():
    ans *= num+1)

ans -= 1
print(ans%(10**9 + 7))
Problem p03097 (python)

Fixed submission:
n,a,b = [int(i) for i in input().split()]

#n is the point in which to check wheter the mark is different
def f(n,a,b):
    if n==1:
        return [a,b]

    mask = 1<<(n-1)

    #if biggest bit of a == that of b
    if a & mask == b & mask:
        v1 = f(n-1, a, b)
        v2 = f(n-1, a^mask, v1[1]^mask)
        ret = [a]
        ret.extend(v2)
        ret.extend(v1[1:])
        return ret        
    else:
        # biggest bit of a and b is different
        v1 = f(n-1, a, a^1)
        v2 = f(n-1, a^1^mask, b)
        v1.extend(v2)
        return v1



#exclusive or
if bin(a^b).count("1") %2==0:
    print("NO")
else:
    print("YES")
    res = f(n,a,b)
    for p in res:
        print(p, end=" ")

Buggy submission (verdict: Runtime Error):
n,a,b = [int(i) for i in input().split()]

#n is the point in which to check wheter the mark is different
def f(n,a,b):
    if n==1:
        return [a,b]

    mask = 1<<(n-1)

    #if biggest bit of a == that of b
    if a & mask == b & mask:
        v1 = f(n-1, a, b)
        v2 = f(n-1, a^mask, v1[1]^mask)
        ret = a
        ret.extend(v2)
        ret.extend(v1[1:])
        return ret        
    else:
        # biggest bit of a and b is different
        v1 = f(n-1, a, a^1)
        v2 = f(n-1, a^1^mask, b)
        v1.extend(v2)
        return v1



#exclusive or
if bin(a^b).count("1") %2==0:
    print("NO")
else:
    print("YES")
    res = f(n,a,b)
    for p in res:
        print(p, end=" ")
Problem p03111 (python)

Fixed submission:
N,A,B,C=[int(i) for i in input().split()]
l=[int(input()) for _ in range(N)]
INF=10**18

def dfs(cur, a, b, c):
    if cur==N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF
    ret0 = dfs(cur+1,a,b,c)
    ret1 = dfs(cur+1,a+l[cur],b,c)+10
    ret2 = dfs(cur+1,a,b+l[cur],c)+10
    ret3 = dfs(cur+1,a,b,c+l[cur])+10
    return min(ret0,ret1,ret2,ret3)

print(dfs(0,0,0,0))

Buggy submission (verdict: Runtime Error):
N,A,B,C=[int(i) for i in input().split()]
l=[int(input()) for _ in range(n)]
INF=10**18

def dfs(cur, a, b, c):
    if cur==N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 
    ret0 = dfs(cur+1,a,b,c)
    ret1 = dfs(cur+1,a+l[cur],b,c)+10
    ret2 = dfs(cur+1,a,b+l[cur],c)+10    
    ret3 = dfs(cur+1,a,b,c+l[cur])+10    
    return min(ret0,ret1,ret2,ret3)

print(dfs(0,0,0,0))
Problem p03810 (python)

Fixed submission:
#d
#the niumbers of evens is important
#the point is, there is no influence to odd/even if you divide them by odd numbers.
#You should do simulation only in the case where there is one odd over 3 and even numbers of even numbers

from fractions import gcd

def count(a):
    odd, even = 0,0
    for x in a:
        if x % 2 == 1: odd = odd + 1
        else: even = even + 1
    return odd,even

def deal(n,a):
    odd,even = count(a)
    if even == 0:
        return False
    if even % 2 == 1:
        return True
    if odd > 1:
        return False
    
    #the case where there is one odd (over 3) and even numbers of even numbers
    #calculate gcd by step by step
    #if you write g = 1, it is a lie.
    if a[0] % 2 == 0:
        g = a[0]
    else:
        g = a[1]
        
    for i in range(0,n):
        if a[i] % 2 == 1:
            if a[i] == 1: 
                return False
            a[i]  -= 1
        g = gcd(a[i], g)
    return not deal(n,list(map(lambda x: x//g,a)))

n = int(input())
a = [int(i) for i in input().split()]
if deal(n,a):
    print('First')
else:
    print('Second')

Buggy submission (verdict: Runtime Error):
#d
#the niumbers of evens is important
#the point is, there is no influence to odd/even if you divide them by odd numbers.
#You should do simulation only in the case where there is one odd over 3 and even numbers of even numbers

from math import gcd

def count(a):
    odd, even = 0,0
    for x in a:
        if x % 2 == 1: odd = odd + 1
        else: even = even + 1
    return odd,even

def deal(n,a):
    odd,even = count(a)
    if even == 0:
        return False
    if even % 2 == 1:
        return True
    if odd > 1:
        return False
    
    #the case where there is one odd (over 3) and even numbers of even numbers
    #calculate gcd by step by step
    g = 1
    for i in range(0,n):
        if a[i] % 2 == 1:
            if a[i] == 1: 
                return False
            a[i]  -= 1
        g = gcd(a[i], g)
    return not deal(n,list(map(lambda x: x//g,a)))

n = int(input())
a = [int(i) for i in input().split()]
if deal(n,a):
    print('First')
else:
    print('Second')
Problem p03938 (python)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]

a = [30000*i for i in range(n)]
b = [30000*(n-i) for i in range(n)]

for i,v in enumerate(p):
    a[v-1] += i+1

print(*a)
print(*b)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]

a = [30000*i for i in range(n)]
b = [30000*(n-i) for i in range(n)]

for i,v in enumerate(p):
    a[v] += i

print(*a)
print(*b)
Problem p03952 (python)

Fixed submission:
n,x = [int(i) for i in input().split()]
a = [i for i in range(1,2*n)]

def swap(a,i,j):
    b = a[i]
    a[i] = a[j]
    a[j] = b

if x==1 or x==2*n -1:
    print("No")
else:
    print("Yes")
    if x==n:
        pass
    elif x>n:
        swap(a,n-1,x-1)
        swap(a,n,2*n-2)
        swap(a,n+1,0)
    else:
        swap(a,n-1,x-1)
        swap(a,n-2,0)
        swap(a,n-3,2*n-2)
    for i in a:
        print(i)

Buggy submission (verdict: Runtime Error):
n,x = [int(i) for i in input().split()]
a = [i for i in range(1,2*n)]

def swap(a,i,j):
    b = a[i]
    a[i] = a[j]
    a[j] = b

if x==1 or x==2*n -1:
    print("No")
else:
    print("Yes")
    if x==n:
        pass
    elif x>n:
        swap(a,n-1,x-1)
        swap(a,x,2*n-2)
        swap(a,x+1,0)
    else:
        swap(a,n-1,x-1)
        swap(a,x-2,0)
        swap(a,x-3,2*n-2)
    for i in a:
        print(i)
Problem p04048 (python)

Fixed submission:
n, x = [int(i) for i in input().split()]

cnt=0

short = min(x,n-x)
long  = max(x, n-x)
cnt += n
#cnt += x*(2*(n//x)-1) + (n-x)

while(1):
    c = long % short
    a = long //short
    if c==0:
        break
    else:
        cnt += short * 2 * a
        long = short
        short = c

cnt += short * (2 * a -1)
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = [int(i) for i in input().split()]

cnt=0

short = n%x
long  = x

cnt += x*(2*(n//x)-1) + (n-x)

while(1):
    c = long % short
    a = long //short
    if c==0:
        break
    else:
        cnt += short * 2 * a
        long = short
        short = c

cnt += short * 2 * a -1
print(cnt)
Problem p02579 (python)

Fixed submission:
from collections import deque
INF = float("inf")

h, w = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
ch, cw = ch-1, cw-1
dh, dw = dh-1, dw-1
S = [input() for _ in range(h)]

dist = [[INF] * w for _ in range(h)]
dist[ch][cw] = 0
q = deque([(cw, ch)])

while q:
    x, y = q.popleft()
    for _x in range(-2, 3):
        for _y in range(-2, 3):
            if _x == _y == 0:
                continue
            next_x, next_y = x + _x, y + _y
            if not 0 <= next_x < w:
                continue
            if not 0 <= next_y < h:
                continue
            if S[next_y][next_x] == "#":
                continue
            if abs(_x) + abs(_y) <= 1:
                if dist[next_y][next_x] <= dist[y][x]:
                    continue
                q.appendleft((next_x, next_y))
                dist[next_y][next_x] = dist[y][x]
            else:
                if dist[next_y][next_x] <= dist[y][x] + 1:
                    continue
                q.append((next_x, next_y))
                dist[next_y][next_x] = dist[y][x] + 1

if dist[dh][dw] != INF:
    print(dist[dh][dw])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
    from collections import deque
    INF = float("inf")
     
    h, w = map(int, input().split())
    ch, cw = map(int, input().split())
    dh, dw = map(int, input().split())
    ch, cw = ch-1, cw-1
    dh, dw = dh-1, dw-1
    S = [input() for _ in range(h)]
     
    dist = [[INF] * w for _ in range(h)]
    dist[ch][cw] = 0
    q = deque([(cw, ch)])
     
    while q:
        x, y = q.popleft()
        for _x in range(-2, 3):
            for _y in range(-2, 3):
                if _x == _y == 0:
                    continue
                next_x, next_y = x + _x, y + _y
                if not 0 <= next_x < w:
                    continue
                if not 0 <= next_y < h:
                    continue
                if S[next_y][next_x] == "#":
                    continue
                if abs(_x) + abs(_y) <= 1:
                    if dist[next_y][next_x] <= dist[y][x]:
                        continue
                    q.appendleft((next_x, next_y))
                    dist[next_y][next_x] = dist[y][x]
                else:
                    if dist[next_y][next_x] <= dist[y][x] + 1:
                        continue
                    q.append((next_x, next_y))
                    dist[next_y][next_x] = dist[y][x] + 1
     
    if dist[dh][dw] != INF:
        print(dist[dh][dw])
    else:
        print(-1)
Problem p02713 (python)

Fixed submission:
import math

n = int(input())
ans = [math.gcd(i+1, math.gcd(j+1, k+1)) for i in range(n) for j in range(n) for k in range(n)]
print(sum(ans))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
ans = [gcd(i+1, gcd(j+1, k+1)) for i in range(n) for j in range(n) for k in range(n)]
print(sum(ans))
Problem p02830 (python)

Fixed submission:
n = input()
s, t = map(str, input().split())
out = [si+ti for si, ti in zip(s, t)]
print("".join(out))

Buggy submission (verdict: Runtime Error):
s, t = map(str, input().split())
out = [si+ti for si, ti in zip(s, t)]
print("".join(out))
Problem p03292 (python)

Fixed submission:
x = [int(i) for i in input().split()]
x = sorted(x)
cost = 0
for i in range(1, 3):
    cost += abs(x[i] - x[i-1])
print(cost)

Buggy submission (verdict: Runtime Error):
x = [int(i) for i in input().split()]
x = sorted(x)
cost = 0
for i in range(1, 3):
    cost += abs(x[i] - x[i-1])
print(costs)
Problem p02606 (python)

Fixed submission:
#template
def inputlist(): return [int(j) for j in input().split()]
#template
L,R,d = inputlist()
count = 0
for i in range(L,R+1):
    if i % d == 0:
        count +=1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = [0]*(N+1)
for x in range(1,80):
    for y in range(1,80):
        for z in range(1,80):
            tmp = x**2 + y**2 + z**2 +x*y + y*z + z*x
            if tmp > N:
                continue
            ans[tmp]+=1
for i in range(1,N+1):
    print(ans[i])
Problem p02639 (python)

Fixed submission:
#template
def inputlist(): return [int(j) for j in input().split()]
#template
li = inputlist()
for i in range(5):
    if li[i] == 0:
        print(i+1)

Buggy submission (verdict: Runtime Error):
li = [int(i) for i in input().split()]
for i in range(5):
	if li[i] == 0:
    		print(i+1)
            exit()
Problem p02801 (python)

Fixed submission:
s = input()
print(chr(ord(s) + 1))

Buggy submission (verdict: Runtime Error):
s = input() #alphabet hitotsu sakino moji
print(chr(ord(s) + 1)
Problem p02900 (python)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
A,B = [int(i) for i in input().split()]
if A == 1 and B==1:
    print(1)
else:
    ans = 1
    lia = factorization(A)
    lib = factorization(B)
    na = len(lia)
    nb = len(lib)
    a = [0] * na
    b = [0] * nb
    for i in range(na):
        a[i] = lia[i][0]
    for i in range(nb):
        b[i] = lib[i][0]
    a_ = set(a)
    b_ = set(b)
    if na >= nb:
        for i in range(nb):
            if b[i] in a_:
                ans+=1
        print(ans)
        exit()
    else:
        for i in range(na):
            if a[i] in b_:
                ans+=1
        print(ans)
        exit()

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
A,B = [int(i) for i in input().split()]
ans = 1
lia = factorization(A)
lib = factorization(B)
na = len(lia)
nb = len(lib)
a = [0] * na
b = [0] * nb
for i in range(na):
    a[i] = lia[i][0]
for i in range(nb):
    b[i] = lib[i][0]
M = max(a[-1],b[-1])
li = [0] * (M+10)
for i in range(na):
    li[a[i]] +=1
for i in range(nb):
    li[b[i]] +=1
for i in range(2,M+1):
    if li[i] == 2:
        ans+=1
print(ans)
Problem p03241 (python)

Fixed submission:
def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

n,m=map(int,input().split())
l=divisore(m)
for i in l:
 if m//n>=i:
  print(i)
  exit()

Buggy submission (verdict: Runtime Error):
def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

n,m=map(int,input().split())
l=divisore(m)
for i in l:
  if m/n>=i:
  print(i)
  exit()
Problem p03261 (python)

Fixed submission:
N = int(input())
li = []
w = input()
li.append(w)
k = 0
ans = "Yes"
for i in range(N-1) :
    word = input()
    for j in range(len(li)) :
        if li[j] == word :
            k = 1
            break
    last_word = li[-1]
    if last_word[-1] != word[0] :
        k = 1
    if k == 1 :
        ans = "No"
        break
    li.append(word)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
li = []
w = input()
li.append(w)
k = 0
ans = "Yes"
for i in range(N) :
    word = input()
    for j in range(len(li)) :
        if li[j] == word :
            k = 1
            break
    last_word = li[-1]
    if last_word[-1] != word[0] :
        k = 1
    if k == 1 :
        ans = "No"
        break
    li.append(word)
print(ans)
Problem p03262 (python)

Fixed submission:
import fractions
N,X = map(int,input().split())
x = list(map(int,input().split()))
distance = []
for i in range(N) :
    d = abs(x[i] - X)
    distance.append(d)
s = 1000000001
if N == 1 :
    s = distance[0]
else :
    for i in range(0,N-1) :
        s = min(fractions.gcd(distance[i],distance[i+1]),s)
print(s)

Buggy submission (verdict: Runtime Error):
N,X = [int(i) for i in input().split()]
xa = [int(i) for i in input().split()]
from math import gcd
lia = [0]*N
for i in range(N):
    lia[i] = abs(X-xa[i])
ans = lia[0]
for i in range(1,N):
    ans = gcd(ans,lia[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N,X = [int(i) for i in input().split()]
xa = [int(i) for i in input().split()]
from math import gcd
lia = [0]*N
for i in range(N):
    lia[i] = abs(X-xa[i])
ans = lia[0]
for i in range(1,N):
    ans = gcd(ans,lia[i])
print(ans)
Problem p03282 (python)

Fixed submission:
s, k = input(), int(input())
ans = "1"
for i in range(k):
    if s[i]!="1":
        ans = s[i]
        break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] == '1':
    print(S[1])
else :
    print(S[0])
Problem p03294 (python)

Fixed submission:
import sys
import itertools
import numpy
input = sys.stdin.readline
N = int(input())
li = [int(i) for i in input().split()]
sum = 0
for i in range(N) :
    sum += li[i]- 1
print(sum)

Buggy submission (verdict: Runtime Error):
import sys
import itertools
import numpy
input = sys.stdin.readline
N = int(input())
li = [int(i) for i in input().split()]
sum = 0
for i in range(N) :
    sum += li[i]- 1
print(sum)
Problem p03361 (python)

Fixed submission:
h, w = list(map(int, input().split()))
graph = []
def check(s,t):
    if (0 <=  s <= w - 1) and (0 <= t <= h - 1):
        return True
    else:
        return False
def check_around(x,y):
    if check(x+1,y) and graph[y][x+1] == '#':
        return True
    if check(x,y+1) and graph[y+1][x] == '#':
        return True
    if check(x-1,y) and graph[y][x-1] == '#':
        return True
    if check(x,y-1) and graph[y-1][x] == '#':
        return True
    return False
for i in range(h):
    graph.append(list(input()))
for i in range(h):
    for j in range(w):
        if graph[i][j] == '#':
            if  not check_around(j,i):
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
H,W = [int(i) for i in input().split()]
pic = [list(input()) for _ in range(H)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
def dfs(x,y):
    pic[x][y] = "."
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or ny < 0 or nx >= W or ny >= H:
            continue
        if pic[nx][ny] == ".":
            continue
        dfs(nx,ny)
a = 1
ans = "Yes"
for i in range(H):
    for j in range(W):
        if pic[i][j] == "#":
            count = 0
            for k in range(4):
                nx = i + dx[k]
                ny = j + dy[k]
                if nx < 0 or ny < 0 or nx >= W or ny >= H:
                    continue
                if pic[nx][ny] == "#":
                    count+=1
            if count == 0:
                ans = "No"
                a = 0
                break
    if a == 0:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = [int(i) for i in input().split()]
li = ['0'] * H
for i in range(H) :
    li[i] = list(input())
dx = [1,0,-1,0]
dy = [0,1,0,-1]
counta = 0
count = 0
for i in range(H) :
    for j in range(W) :
        if li[i][j] == "#" :
            counta+=1
for i in range(H) :
    for j in range(W) :
        if li[i][j] == "#" :
            for k in range(4) :
                nx = i + dx[k]
                ny = j + dy[k]
                if nx < 0 or nx > W-1 or ny < 0 or ny > H-1 :
                    continue
                if li[nx][ny] == "#" :
                    count+=1
                    break
if count == counta:
    print("Yes")
else:
    print("No")
Problem p03386 (python)

Fixed submission:
A,B,K = map(int,input().split())
if (2*K)<(B-A+2):
  for i in range(A,A+K):
    print(i)
  for i in range(B-K+1,B+1):
    print(i)
else:
  for i in range(A,B+1):
    print(i)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A,B,K = [int(i) for i in input().split()]
d = B - A + 1
li = [0] * d
count = 0
for i in range(d) :
    li[i] = A + count
    count+=1
if d > 2 * K + 1 :
    lia = [0] * 2 * K
    for i in range(K) :
        lia[i] = li[i]
    counta = 0
    for i in range(K,2 * K) :
        lia[i] = li[-K+counta]
        counta += 1
    for i in range(2 * K) :
        print(lia[i])
else :
    for i in range(d) :
        print(li[i])
Problem p03575 (python)

Fixed submission:
N,M=[int(i) for i in input().split()]
graph = [[] for _ in range(N+1)]
from collections import deque
aa = [0] * M
bb = [0] * M
ans = 0
for i in range(M):
    a,b = [int(j) for j in input().split()]
    graph[a].append(b)
    graph[b].append(a)
    aa[i] = a
    bb[i] = b
import copy
grapha = copy.deepcopy(graph)
for k in range(M):
    graph[aa[k]].remove(bb[k])
    graph[bb[k]].remove(aa[k])
    seen = [False] * (N+1)
    from collections import deque
    que = deque()
    que.append(1)
    while len(que) != 0:
        x = que.popleft()
        seen[x] = True
        for i in graph[x]:
            if seen[i]:
                continue
            que.append(i)
            seen[i] = True
    for l in range(1,N+1):
        if seen[l]:
            continue
        ans +=1
        break
    graph = copy.deepcopy(grapha)
print(ans)

Buggy submission (verdict: Runtime Error):
#template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
N,M = inputlist()
ans = 0
ab = [0]*M
for i in range(M):
    ab[i] = inputlist()
for i in range(M):
    uf = UnionFind(N+1)
    for j in range(M):
        if j == i:
            continue
        uf.union(ab[j][0],ab[j][1])
    if uf.size(j) != N:
        ans +=1
print(ans)
Problem p03607 (python)

Fixed submission:
n=int(input())
s=set()
for i in range(n):
    a=int(input())
    if a in s:
        s.remove(a)
    else:
        s.add(a)
print(len(s))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
sum = 0
li = np.ones(100000010)
for i in range(N) :
    A = int(input())
    if li[A] == 1 :
        sum +=1
        li[A] = 0
    else :
        li[A] = 1
        sum -=1
print(sum)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
sum = 0
li = [1] * 1000000100
for i in range(N) :
    A = int(input())
    if li[A] == 1 :
        sum +=1
        li[A] = 0
    else :
        li[A] = 1
        sum -=1
print(sum)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
sum = 0
li = [1] * 100010
for i in range(N) :
    A = int(input())
    if li[A] == 1 :
        sum +=1
        li[A] = 0
    else :
        li[A] = 1
        sum -=1
print(sum)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
sum = 0
li = [1] * 100010
for i in range(N) :
    A = int(input())
    if li[A] == 1 :
        sum +=1
        li[A] = 0
    else :
        li[A] = 1
        sum -=1
print(sum)