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

Fixed submission:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, k = MI()
if ((n - 1) * (n - 2)) // 2 < k:
    print(-1)
else:
    m = (n * (n - 1)) // 2 - k
    print(m)
    graph = []
    for i in range(1, n + 1):
        for j in range(i, n + 1):
            if i != j:
                graph.append([i, j])
    for i in range(m):
        print(*graph[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, k = MI()
if ((n - 1) * (n - 2)) // 2 < k:
    print(-1)
else:
    graph = []
    for i in range(1, n + 1):
        for j in range(i, n + 1):
            if i != j:
                graph.append([i, j])
    for i in range(n - 1):
        print(*graph[i])
    for k in range((((n - 1) * (n - 2)) // 2) - k):
        print(*graph[n + k])
Problem p02999 (python)

Fixed submission:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


x, a = MI()
print(0 if x < a else 10)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


x, a =MI()
print(0 if x < a else 10)
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


x, a =MI()
print(0 if x < a else 10)
Problem p03000 (python)

Fixed submission:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, x = MI()
l = LI()
cnt = 0
ans = []
ans.append(0)
z = 0
for i in range(n):
    z += l[i]
    ans.append(z)
for num in ans:
    if num <= x:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, x = MI()
l = LI()
z = 0
cnt = 0
if n == 1:
    if l[0] <= x:
        print(2)
    else:
        print(1)
else:
    while z <= x and cnt < n+1:
        z = z + l[cnt]
        cnt += 1
    print(cnt)
Problem p03007 (python)

Fixed submission:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
a = sorted(LI(), reverse=True)
ans = []
s = 0
if all([i < 0 for i in a]):
    tmp = a[0]
    for i in range(1, n):
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1])
else:
    tmp = a[-1]
    for i in range(1, n - 1):
        if a[i] < 0:
            break
        ans.append((tmp, a[i]))
        tmp -= a[i]

    ans.append((max(a), tmp))
    tmp = max(a) - tmp

    for i in range(1, n - 1):
        if a[i] >= 0:
            continue
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
a = sorted(LI(), key=abs)
for i in range(n - 1):
    if abs(a[i]) == abs(a[i+1]) and a[i] > a[i+1]:
        hoge = a[i+1]
        a[i+1] = a[i]
        a[i] = hoge
# print(a)
newa = []
zerocnt = 0
for i in a:
    if i != 0:
        newa.append(i)
    else:
        zerocnt += 1
s = 0
ans = []
tmp = newa[0]
for i in range(n - 1 - zerocnt):
    if i == n - 2 - zerocnt:
        if tmp < newa[i+1]:
            ans.append((newa[i+1], tmp))
            tmp = newa[i+1] - tmp
            print(tmp)
        else:
            ans.append((tmp, newa[i+1]))
            tmp = tmp - newa[i+1]
            print(tmp)
    elif i == 0:
        tmp = newa[i] - newa[i+1]
        ans.append((newa[i], newa[i+1]))
    else:
        tmp = tmp - newa[i+1]
        ans.append((tmp, newa[i+1]))
for i in ans:
    print(str(i[0])+' '+str(i[1]))
for i in range(zerocnt):
    print(str(tmp)+' '+str(0))
Problem p03061 (python)

Fixed submission:
from collections import Counter
from functools import reduce
import bisect
import copy
import fractions
import math
# import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


n, a = II(), LI()
left = [0] * (n+1)
right = [0] * (n+1)

for i in range(1, n+1):
    left[i] = fractions.gcd(left[i-1], a[i-1])

for i in range(n-1, -1, -1):
    right[i] = fractions.gcd(right[i+1], a[i]) 

# print(left)
# print(right)

maxi = -INF

for i in range(n):
    maxi = max(maxi, fractions.gcd(left[i],right[i+1]))

print(maxi)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
import copy
import bisect
import fractions
import math
import statistics
import sys
import time
from sympy import isprime
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # Greatest Common Divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # Least Common Multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


n = II()
# a = LI()
a = sorted(LI())
maxi = -INF
ans = 1

for i in range(n):
    if isprime(a[i]) == True:
        del a[i]
        print(GCD_LIST(a))
        exit()

while True:
    div = GCD_LIST(a)
    a = list(map(lambda x: x // div , a))
    if div == 1:
        for j in range(n):
            if isprime(a[j]) == True or 1 in a:
                    del a[j]
                    print(ans * GCD_LIST(a))
                    exit()
        del a[0]
        print(ans * GCD_LIST(a))
        exit()
        
    ans *= div

# test = [i for i in range(100000)]
# start = time.time()
# print(GCD_LIST(test))
# for i in range(n):
#     tmp = copy.copy(a) 
#     del tmp[i]
#     maxi = max(maxi,GCD_LIST(tmp))
# print(maxi)


#for i in range(len(test)):
#    tmp = copy.copy(test) 
#    del tmp[i]
#    maxi = max(maxi,GCD_LIST(tmp))
#    print(i)
#print(maxi)
Problem p03161 (python)

Fixed submission:
from collections import Counter
from functools import reduce
import fractions
import math
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


n, k = MI()
dp = [INF] * n
h = LI()
dp[0] = 0
for i in range(0, n-1):
    for j in range(1, k+1):
        if n <= i+j:
            continue
        dp[i+j] = min(dp[i] + abs(h[i]-h[i+j]), dp[i+j])
P(dp[n-1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


n, k = MI()
dp = [INF] * n
h = LI()
dp[0] = 0
for i in range(0, n-1):
    for j in range(1, k+1):
        if n <= i+j:
            continue
        dp[i+j] = min(dp[i] + abs(h[i]-h[i+j]), dp[i+j])
P(dp[n-1])
Problem p03163 (python)

Fixed submission:
N, W = map(int,input().split())
dp = [[0 for i in range(100001)] for i in range(N+1)]

for i in range(N):
    w, v = map(int, input().split())
    for sum_w in range(W+1):
        if sum_w - w >= 0:
            dp[i+1][sum_w] = max(dp[i][sum_w - w] + v, dp[i+1][sum_w])

        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
import fractions
import pprint
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


N, W = MI()
dp = [[0 for i in range(20)] for i in range(N+1)]

for i in range(N):
    w, v = MI()
    for sum_w in range(W+1):
        if sum_w - w >= 0:
            dp[i+1][sum_w] = max(dp[i][sum_w - w] + v, dp[i+1][sum_w])
        
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

P(max(dp[-1]))
Problem p03611 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
collection = Counter(a)
# print(collection)
ans = [0] * 100010
for i in collection:
    ans[i] = collection[i-1]+collection[i]+collection[i+1]
print(max(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans = [1] * len(set(a))
index=0
for i in range(n):
    ans[index] = a.count(a[i]-1)+a.count(a[i])+a.count(a[i]+1)
    index+=1
print(max(ans))
Problem p03640 (python)

Fixed submission:
from collections import deque
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())


H, W = MI()
N = II()
a = LI()
color = deque()
ans = [[0] * W for _ in range(H)]
# visited = [[0] * W for _ in range(H)]
# x_diff = [-1, 0, 1, 0]
# y_diff = [0, 1, 0, -1]

for i, num in enumerate(a):
    for j in range(num):
        color.append(i + 1)

# coordinate_q = deque()
# coordinate_q.append([0, 0])
# visited[0][0] = 1
# ans[0][0] = color.popleft()

"""
while len(coordinate_q) != 0:
    y_tmp, x_tmp = coordinate_q.popleft()
    for i in range(4):
        y, x = y_tmp + y_diff[i], x_tmp + x_diff[i]
        if 0 <= y <= H-1 and 0 <= x <= W-1 and visited[y][x] == 0:
            ans[y][x] = color.popleft()
            visited[y][x] = 1
            coordinate_q.append([y, x])
"""

for i in range(H):
    for j in range(W):
        if i % 2 == 0:
            ans[i][j] = color.popleft()
        else:
            ans[i][-(j+1)] = color.popleft()

for i in range(H):
    for j in range(W):
        print(ans[i][j], end=' ')
    print('')

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())


H, W = MI()
N = II()
a = LI()
color = deque()
ans = [[0] * W for _ in range(H)]
# visited = [[0] * W for _ in range(H)]
x_diff = [-1, 0, 1, 0]
y_diff = [0, 1, 0, -1]

for i, num in enumerate(a):
    for j in range(num):
        color.append(i + 1)

# coordinate_q = deque()
# coordinate_q.append([0, 0])
# visited[0][0] = 1
# ans[0][0] = color.popleft()

"""
while len(coordinate_q) != 0:
    y_tmp, x_tmp = coordinate_q.popleft()
    for i in range(4):
        y, x = y_tmp + y_diff[i], x_tmp + x_diff[i]
        if 0 <= y <= H-1 and 0 <= x <= W-1 and visited[y][x] == 0:
            ans[y][x] = color.popleft()
            visited[y][x] = 1
            coordinate_q.append([y, x])
"""

"""
for i in range(H):
    for j in range(W):
        if i % 2 == 0:
            ans[i][j] = color.popleft()
        else:
            ans[i][-(j+1)] = color.popleft()
"""

def tansaku(y, x):
    if visited[y][x] == 1:
        return
    visited[y][x] = 1
    ans[y][x] = color.popleft()
    for i in range(4):
        ny = y + y_diff[i]
        nx = x + x_diff[i]
        if 0 <= ny <= H-1 and 0 <= nx <= W-1:
            tansaku(ny, nx)

visited = [[0] * W for _ in range(H)]
tansaku(0, 0)

for i in range(H):
    for j in range(W):
        print(ans[i][j], end=' ')
    print('')
Problem p03830 (python)

Fixed submission:
import time
import math
def sieve(n):
    prime = []
    limit = math.sqrt(n)
    data = [i for i in range(2, n+1)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


n = int(input())
if n == 1:
    print(1)
    exit()
prime = sieve(n)
ans = 1
for sosu in prime:
    cnt = 0
    for i in range(2, n+1):
        num = i
        while num % sosu == 0:
            num //= sosu 
            cnt += 1
    ans *= (cnt + 1)
print(ans % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import time
import math
def sieve(n):
    prime = []
    limit = math.sqrt(n)
    data = [i for i in range(2, n+1)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


n = int(input())
prime = sieve(n)
ans = 1
for sosu in prime:
    cnt = 0
    for i in range(2, n+1):
        num = i
        while num % sosu == 0:
            num //= sosu 
            cnt += 1
    ans *= (cnt + 1)
print(ans % (10**9 + 7))
Problem p03854 (python)

Fixed submission:
import sys
s = list(input())
check =['dream','dreamer','erase','eraser']
while len(s) >= 8:
    if ''.join(s[-5:]) == check[0]:
        for _ in range(5): s.pop()
        continue
    if ''.join(s[-7:]) == check[1]:
        for _ in range(7): s.pop()
        continue
    if ''.join(s[-5:]) == check[2]:
        for _ in range(5): s.pop()
        continue
    if ''.join(s[-6:]) == check[3]:
        for _ in range(6): s.pop()
        continue
    print('NO')
    sys.exit()
if ''.join(s) == check[0] or ''.join(s) == check[1] or ''.join(s) == check[2] or ''.join(s) == check[3]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import sys
s = list(input())
check =['dream','dreamer','erase','eraser']
while len(s) >= 8:
    if ''.join(s[-5:]) == check[0]:
        print(s)
        for _ in range(5): s.pop()
        continue
    if ''.join(s[-7:]) == check[1]:
        print(s)
        for _ in range(7): s.pop()
        continue
    if ''.join(s[-5:]) == check[2]:
        print(s)
        for _ in range(5): s.pop()
        continue
    if ''.join(s[-6:]) == check[3]:
        print(s)
        for _ in range(6): s.pop()
        continue
    print('No')
    sys.exit()
if ''.join(s) == check[0] or ''.join(s) == check[1] or ''.join(s) == check[2] or ''.join(s) == check[3]:
    print('Yes')
else:
    print('No')
Problem p02947 (python)

Fixed submission:
import collections
from scipy.misc import comb

N = int(input())

diclist = []

i=0
while i < N:
  temp = list(input())
  temp.sort()
  tmp_el = ''.join(temp)
  diclist.append(tmp_el)
  i += 1
  
c = collections.Counter(diclist)
clist = list(c.values()) 
ccomb = [comb(clist[i], 2, exact = True) for i in range(0,len(clist))]

print(sum(ccomb))

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

ans = 0

diclist = []

for i in range(0,N+1):
  temp = list(input())
  temp.sort()
  if temp in diclist:
    ans = ans +1
  else:
    diclist.append(temp)

print(ans)

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

ans = 0

diclist = []

for i in range(0,N+1):
  temp = list(input()).sort()
  if temp in diclist:
    ans = ans +1
  else:
    diclist.append(temp_str)

print("{}".format(ans))

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

ans = 0

diclist = []

for i in range(0,N+1):
  temp = list(input()).sort()
  if temp in diclist:
    ans = ans +1
  else:
    diclist.append(temp_str)

print(ans)

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

ans = 0

diclist = []

for i in range(0,N+1):
  temp = list(input()).sort()
  temp_str = ''.join(temp)
  if temp_str in diclist:
    ans = ans +1
  else:
    diclist.append(temp_str)

print(ans)