Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
s = deque(s)
q = INT()


L = [S_LIST() for i in range(q)]
for i in range(q):
    if L[i][0] == "1":
        s.reverse()
    else:
        query, sent = int(L[i][1]), str(L[i][2])
        if query == 1:
            s.appendleft(sent)
        else:
            s.append(sent)
print("".join(list(s)))

    




Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
s = deque(s)
q = INT()

r_count = 0
L = [S_LIST() for i in range(q)]
for i in range(q):
    if L[i][0] == "1":
        r_count ^= 1
        # s.reverse()
    else:
        query, sent = int(L[i][1]), str(L[i][2])
        if r_count == 0:
            if query == 1:
                s.appendleft(sent)
            else:
                s.append(sent)
        else:
            if query == 2:
                s.appendleft(sent)
            else:
                s.append(sent)

if r_count != 0:
    s.reverse()
print("".join(list(s)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
a = LIST()

for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]:
            print("NO")
            exit()
print("YES")




Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
a = LIST()

# for i in range(n-1):
#     for j in range(i+1, n):
#         if a[i] == a[j]:
#             print("NO")
#             exit()
# print("YES")
if len(set(a)) != len(a):
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
# No DP No LIFE
# 配るDP, 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    H, N = MAP()
    L = [LIST() for i in range(N)]
    A = []
    B = []
    for i in range(N):
        A.append(L[i][0])
        B.append(L[i][1])

    dp = [INF] * 20010
    dp[0] = 0
    for i in range(10010):
        for j in range(N):
            dp[i+A[j]] = min(dp[i+A[j]], dp[i]+B[j])
    ans = INF
    for i in range(H, 20010):
        ans = min(ans, dp[i])
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    h, a = MAP()
    count = 0
    while h > 0:
        h = h - a
        count += 1
    print(count)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# No DP No LIFE
# 配るDP, 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    H, N = MAP()
    L = [LIST() for i in range(N)]
    A = []
    B = []
    for i in range(N):
        A.append(L[i][0])
        B.append(L[i][1])

    dp = [INF] * 20010
    dp[0] = 0
    for i in range(10010):
        for j in range(N):
            dp[i+A[j]] = min(dp[i+A[j]], dp[i]+B[j])
    ans = INF
    for i in range(H, 20010):
        ans = min(ans, dp[i])
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
# No DP No LIFE
# 配るDP, 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    H, N = MAP()
    L = [LIST() for i in range(N)]
    A = []
    B = []
    for i in range(N):
        A.append(L[i][0])
        B.append(L[i][1])

    dp = [INF] * 20010
    dp[0] = 0
    for i in range(10010):
        for j in range(N):
            dp[i+A[j]] = min(dp[i+A[j]], dp[i]+B[j])
    ans = INF
    for i in range(H, 20010):
        ans = min(ans, dp[i])
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

ans = 0
for i in range(n):
    pi = p[i]
    flag = True
    for j in range(i, -1, -1):
        if pi > p[j]:
            flag = False
    if flag ==True:
        ans += 1
print(ans)

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

ans = 0
ma = 0
# for i in range(n):
#     flag = True
#     pi = p[i]
#     if ma > pi:
#         flag = False
#         ma = pi
#     # ma = pi
#     # for j in range(i, -1, -1):
#     #     if pi > p[j]:
#     #         flag = False
#     if flag ==True:
#         ans += 1
# print(ans)
ans = 1
m = p[0]
for i in range(1, n):
    if m > min(m, p[i-1]):
        m = min(m, p[i-1])
        # print(m)
    if m >=  p[i]:
        ans += 1
    # m = p[0:i]
    # print(m)

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 最大公約数 
def gcd(a, b):
  if a < b:
      a, b = b, a
  while a % b != 0:
      a, b = b, a % b
  return b

# 最小公倍数
def lcm(a, b):
  y = a*b / gcd(a, b)
  return int(y)

n, m = MAP()


L = []
for i in range(m):
  l = S_LIST()
  L.append(l)

# wa

wa = [0] * n
ac = [0] * n


for i in range(m):
  p = int(L[i][0])-1
  ans = L[i][1]
  if ans == "WA":
    # まだacない
    if ac[p] == 0:
      wa[p] = wa[p] + 1
  # acあった
  if ans == "AC":
    ac[p] = 1

for i in range(m):
  if ac[i] == 1:
    wa[i] = 0


print(sum(ac), sum(wa))


# for p in range(1, n+1):
#   if L[i][0] == str(p):
#     for i in range(m):
#       if L[i][1] == "WA":
#         wa += 1

#     for i in range(m):
#       if L[i][1] == "AC":
#         ac += 1
#   print(wa)
#   print(ac)

  

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 最大公約数 
def gcd(a, b):
  if a < b:
      a, b = b, a
  while a % b != 0:
      a, b = b, a % b
  return b

# 最小公倍数
def lcm(a, b):
  y = a*b / gcd(a, b)
  return int(y)

n, m = MAP()


L = []
for i in range(m):
  l = S_LIST()
  L.append(l)

# wa

wa = [0] * n
ac = [0] * n


for i in range(m):
  p = int(L[i][0])-1
  ans = L[i][1]
  if ans == "WA":
    # まだacない
    if ac[p] == 0:
      wa[p] = wa[p] + 1
  # acあった
  if ans == "AC":
    ac[p] = 1

for i in range(n):
  if ac[i] == 0:
    if wa[i] > 0:
      wa[i] = 0


print(sum(ac), sum(wa))


# for p in range(1, n+1):
#   if L[i][0] == str(p):
#     for i in range(m):
#       if L[i][1] == "WA":
#         wa += 1

#     for i in range(m):
#       if L[i][1] == "AC":
#         ac += 1
#   print(wa)
#   print(ac)
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
dp = [INF] * (1<<N)
dp[0] = 0

for i in range(M):
    a, b = MAP()
    c = LIST()
    d = 0
    # 1を立てる
    for x in c:
        # 1が存在するなら，dの一番最後，右から0番目，0シフト目に必要
        d += 1<<(x-1)
    for j in range(1<<N): # 2 ** N 列見る
#         # テーブルは一列ずつ見て更新しよう
        tmp = j|d
        dp[tmp] = min(dp[tmp], dp[j] + a)
if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])



Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
def main():
    N, M = MAP()
    dp = [INF] * (1<<N)
    dp[0] = 0

    for i in range(M):
        a, b = MAP()
        c = LIST()
        d = 0
        # 1を立てる
        for x in c:
            # 1が存在するなら，dの一番最後，右から0番目，0シフト目に必要
            d += 1<<(x-1)
        for j in range(1<<N): # 2 ** N 列見る
    #         # テーブルは一列ずつ見て更新しよう
            tmp = j|d
            dp[tmp] = min(dp[tmp], dp[j] + a)
    if dp[-1] == INF:
        print(-1)
    else:
        print(dp[-1])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    N, K, Q = MAP()
    A = [INT() for i in range(Q)]
    point = [K for i in range(N)]
    for q in range(Q):
        for j in range(N):
            if j != A[q] - 1:
                point[j] -= 1
    # print(point)
    ans = []
    for i in range(N):
        if point[i] > 0:
            ans.append("Yes")
        else:
            ans.append("No")
    print(*ans)



if __name__ == "__main__":
    main()




Fixed submission:
# 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    N, K, Q = MAP()
    A = [INT() for i in range(Q)]
    point = [K - Q for i in range(N)]
    for a in A:
        point[a-1] += 1
    ans = []
    for i in range(N):
        if point[i] > 0:
            ans.append("Yes")
        else:
            ans.append("No")
    print(*ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()
ans = 0
if b == 1:
    print(ans)
    exit()

while(1):

    if ans == 0:
        b -= a
        ans += 1
    else:
        if b <= 0:
            print(ans)
            exit()
        else:
            b -= (a-1)
            ans += 1

    

# n = INT()
# a, b, c = MAP()
# ans = 1
# # count = 0
# count = a
# flag = False
# # for i in range(30):
# while flag == False:
#     if count >= b:
#         flag = True    
#     else:
#         count += a-1
#         ans += 1
# print(ans)





# k = 1
# count = 0
# ans = 0
# A = []


# count += a
# ans += 1


# while(1):
#     if count >= b:
#         print(ans)
#         exit()
#     else:
#         count += a-1
#         ans += 1
#         # print()




# count += a
# ans += 1

# for i in range(100):
#     if b <= count:
#         print(ans)
#         exit()

#     else:
#         count += a-1
#         ans += 1 
#         # print(ans)

# for i in range(30):
# while(1):
#     count += a
#     ans += 1
#     print(count)

#     if b <= count:
#         print(ans)
#         exit()
#     else:   
#         count = count-1
#     # print(ans)
    
    # # A.append(a)
    # # if sum(A)
    # if count == 0:
    #     count += a
    #     ans += 1
    # else:
    #     count += a-1
    #     ans += 1
    # print(count)
    # print(ans)
    # if b<=count:
    #     # print(count)
    #     print(ans)
    #     exit()



Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())
T = list(input())

count = 0
for i in range(len(S)):
    if S[i] == T[i]:
        count += 1
# a, b = MAP()
# n = INT()
# a, b, c = MAP()

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# a, b = MAP()
# n = INT()
# a, b, c = MAP()
count = 0
N = INT()
for i in range(1,N):
    # print(i)
    count += i
print(count)

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# a, b = MAP()
# n = INT()
# a, b, c = MAP()
count = 0
N = INT()
# for i in range(1,N):
    # print(i)
    # count += i
# print(count)
a = N-1
ans = a * (a+1)//2
print(ans)