Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def t(n, k, q, a):
    for i in range(n):
        print("Yes" if (-q + k + a.count(i + 1)) > 0 else "No")

if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    r = t(n, k, q, a)


Fixed submission:
def t(n, k, q, a):
    p = [-q + k] * n
    for i in range(q):
        p[a[i-1]-1] += 1
    return ["Yes" if i > 0 else "No" for i in p]
   

if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    r = t(n, k, q, a)
    for i in r:
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
def t(n, k, q, a):
    p = [-q + k] * n
    for i in range(n):
        p[i] += a.count(i + 1)
    return ["Yes" if i > 0 else "No" for i in p]


if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    r = t(n, k, q, a)
    for i in r:
        print(i)


Fixed submission:
def t(n, k, q, a):
    p = [-q + k] * n
    for i in range(q):
        p[a[i-1]-1] += 1
    return ["Yes" if i > 0 else "No" for i in p]
   

if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    r = t(n, k, q, a)
    for i in r:
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
def t(n, k, q, a):
    p = [k] * n
    for i in range(q):
        for j in range(n):
            if a[i]-1 != j:
                p[j] -= 1
    return ['Yes' if i > 0 else 'No' for i in p]


if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    r = t(n, k, q, a)
    for i in r:
        print(i)


Fixed submission:
def t(n, k, q, a):
    p = [-q + k] * n
    for i in range(q):
        p[a[i-1]-1] += 1
    return ["Yes" if i > 0 else "No" for i in p]
   

if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    r = t(n, k, q, a)
    for i in r:
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
def t(s):
    a = [''.join(sorted(list(i))) for i in s]
    b = set(a)
    r = 0
    for i in b:
        n = a.count(i)
        r += n * (n - 1) / 2
    return int(r)


if __name__ == '__main__':
    n = int(input())
    print(t([input() for i in range(n)]))


Fixed submission:
def t(s):
    a = [''.join(sorted(i)) for i in s]
    b = {}
    r = 0
    for i in a:
        if i in b.keys():
            r += b[i]
            b[i] += 1
        else:
            b[i] = 1
    return int(r)


if __name__ == '__main__':
    n = int(input())
    print(t([input() for i in range(n)]))
Buggy python submission (verdict: Runtime Error):
import math
INF = math.inf
h,w = map(int,input().split())
n = h*w

field = []
for i in range(h):
    field.append(input())

dist = [[INF] * n for _ in range(n)]

for i in range(h):
    for j in range(w):
        if field[i][j] == "#":continue
        if j + 1 < w and field[i][j+1] != "#":
            dist[i * w + j][i * w + j + 1] = 1
            dist[i * w + j + 1][i * w + j] = 1
        if i + 1 < h and field[i+1][j] != "#":
            dist[i * w + j][(i+1) * w + j] = 1
            dist[(i+1) * w + j][i * w + j] = 1

for i in range(n):
    for j in range(n):
        for k in range(n):
            dist[j][k] = min(dist[j][k],dist[j][i]+dist[i][k])

ans = 0
for i in range(n):
    for j in range(n):
        if(i==j):continue
        if(dist[i][j]==INF):continue
        ans = max(ans,dist[i][j])

print(ans)

Fixed submission:
C = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
alp_list = list(alp)
num = alp_list.index(C)
print(alp_list[num+1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

gates = list(range(1, N + 1))
for m in range(M):
  L, R = map(int, input().split())
  gates = [g for g in gates if L <= g and g <= R]
  if len(gates) < 1:
    break

print(len(gates))


Fixed submission:
N, M = map(int, input().split())

gates = [[1, N]]

for m in range(M):
  L, R = map(int, input().split())
  updated = []
  for gate in gates:
    if L <= gate[0]:
      if gate[0] <= R:
        updated.append([gate[0], min(gate[1], R)])
    else:
      if L <= gate[1]:
        updated.append([L, min(gate[1], R)])
  gates = updated


print(sum([g[1] - g[0] + 1 for g in gates]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, M = map(int, input().split())

a = np.zeros(N, dtype=int)
for m in range(M):
  L, R = map(int, input().split())
  a[L-1:R] += 1

print(np.sum(a == M))


Fixed submission:
N, M = map(int, input().split())

gates = [[1, N]]

for m in range(M):
  L, R = map(int, input().split())
  updated = []
  for gate in gates:
    if L <= gate[0]:
      if gate[0] <= R:
        updated.append([gate[0], min(gate[1], R)])
    else:
      if L <= gate[1]:
        updated.append([L, min(gate[1], R)])
  gates = updated


print(sum([g[1] - g[0] + 1 for g in gates]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, M = map(int, input().split())

a = np.ones(N, dtype=int)
for m in range(M):
  L, R = map(int, input().split())
  b = np.zeros(N, dtype=int)
  b[L-1:R] = 1
  a = a * b

print(np.sum(a))


Fixed submission:
N, M = map(int, input().split())

gates = [[1, N]]

for m in range(M):
  L, R = map(int, input().split())
  updated = []
  for gate in gates:
    if L <= gate[0]:
      if gate[0] <= R:
        updated.append([gate[0], min(gate[1], R)])
    else:
      if L <= gate[1]:
        updated.append([L, min(gate[1], R)])
  gates = updated


print(sum([g[1] - g[0] + 1 for g in gates]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
numbers = list(map(int, input().split()))

numbers_abs = [abs(n) for n in numbers if n != 0]
sum_abs = sum(numbers_abs)
min_abs = min(numbers_abs)

count_negative = 0
count_zero = 0
for n in numbers:
  if (n < 0):
    count_negative += 1
  elif (n == 0):
    count_zero += 1

answer = sum_abs
if (count_negative % 2 == 1 and count_zero < 1):
  answer = sum_abs - 2 * min_abs

print(answer)


Fixed submission:
N = int(input())
numbers = list(map(int, input().split()))

numbers_abs = [abs(n) for n in numbers]
sum_abs = sum(numbers_abs)
min_abs = min(numbers_abs)

count_negative = sum([1 for n in numbers if n < 0])

answer = sum_abs
if (count_negative % 2 == 1):
  answer = sum_abs - 2 * min_abs

print(answer)
Buggy python submission (verdict: Runtime Error):
N, K, M = map(int,input().split())
A = list(map(int,input().split(' ')))

goal = N*M

if K < M or (sum(A)+K) < goal:
    print("-1")
elif 0 <= goal - sum(A) <= K:
    print(goal - sum(A))
elif goal - sum(A) < 0:
    print("0")


Fixed submission:
D = list('abcdefghijklmnopqrstuvwxyz')
C = input()
print(D[D.index(C)+1])
Buggy python submission (verdict: Runtime Error):
def read_int(): return int(input())
N = read_int()
def read_str(): return input().strip()
S = list(read_str())

__DEBUG__ = False

def solution():
    count = 0    
    for i in range(N-2):
        if __DEBUG__: print(f"checking {S[i]} at index: {i}")
        if S[i] == 'A':
            if S[i+1] == 'B' and S[i+2] == 'C':
                count += 1
                continue
    return count

    
if __name__ == '__main__':
    print(solution())
    

Fixed submission:
# https://atcoder.jp/contests/abc150/tasks/abc150_a

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

K, X = read_int_n()

if K*500 >= X:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc150/tasks/abc150_a

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

K, X = read_int_n()

print(f"Nubmer coins K = {K}; Total X = {X}")
if K*500 >= X:
    print("Yes")
else:
    print("No")

Fixed submission:
# https://atcoder.jp/contests/abc150/tasks/abc150_a

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

K, X = read_int_n()

if K*500 >= X:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def read_int(): return int(input())

def prime(num):
    for n in range(2,int(sqrt(num))):
        if num % n == 0:
            return False
            break
    return True
  
def solution(K):
    while not prime(K):
        K += 1
    print(K)
    
K = read_int()
print(solution(K))

Fixed submission:
from math import floor,ceil,sqrt,factorial,hypot,log
def read_int(): return int(input())
 
def prime(num):
    for n in range(2,int(sqrt(num))):
        if num % n == 0:
            return False
            break
    return True
  
def solution(K):
    while not prime(K):
        K += 1
    return K
    
K = read_int()
print(solution(K))
Buggy python submission (verdict: Runtime Error):

N = int(input())
S, T = map(list, input().split())

out = []
for i in range(N):
    #print(f"i = {i} {type(out)} S[i] = {S[i]}")
    #print(f"Output => {out}")
    out.append(S[i])
    out.append(T[i])

out = "".join(out)

print(f"{out}")

Fixed submission:
N = int(input())
S, T = input().split()
 
ans = "".join([S[i] + T[i] for i in range(N)])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = map(int, input().split())
def solution(s):
    cost = 0
    mean = round(sum(s)/len(s))
    for i in s:
        cost += abs(i-mean) ** 2
        #print(f"DEBUG >> {mean} {i} {cost}")
    return cost
  
print(solution(s))

Fixed submission:
n = int(input())
s = [int(c) for c in input().split()]
def solution(s):
    cost = 0
    mean = round(sum(s)/len(s))
    for i in s:
        cost += abs(i-mean) ** 2
        #print(f"DEBUG >> {mean} {i} {cost}")
    return cost
  
print(solution(s))
Buggy python submission (verdict: Time Limit Exceeded):
input()
s = input()

def f(i):
  return s[0:i].count('W') + s[i:].count('E')

x = len(s)

for i in range(len(s)):
  x = min(x, f(i))

print(x)

Fixed submission:
input()
s = input()

l = 0
r = s[1:].count('E')
x = l + r

for i in range(1, len(s)):
  if s[i - 1] == 'W':
    l += 1

  if s[i] == 'E':
    r -= 1
  x = min(x, l + r)

print(x)

Buggy python submission (verdict: Runtime Error):
input()
s = input()

def f(i):
  return s[0:i].count('W') + s[i:].count('E')

x = len(s)

for i in range(len(s)):
  x = min(x, f(i))

print(min(arr))

Fixed submission:
input()
s = input()

l = 0
r = s[1:].count('E')
x = l + r

for i in range(1, len(s)):
  if s[i - 1] == 'W':
    l += 1

  if s[i] == 'E':
    r -= 1
  x = min(x, l + r)

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
input()
s = input()

def f(i):
  return s[0:i].count('W') + s[i:].count('E')

arr = []

for i in range(len(s)):
  arr.append(f(i))

print(min(arr))

Fixed submission:
input()
s = input()

l = 0
r = s[1:].count('E')
x = l + r

for i in range(1, len(s)):
  if s[i - 1] == 'W':
    l += 1

  if s[i] == 'E':
    r -= 1
  x = min(x, l + r)

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
input()
s = input()

def f(i):
  return s[0:i].count('W') + s[i:].count('E')

arr = map(f, range(len(s)))

print(min(arr))

Fixed submission:
input()
s = input()

l = 0
r = s[1:].count('E')
x = l + r

for i in range(1, len(s)):
  if s[i - 1] == 'W':
    l += 1

  if s[i] == 'E':
    r -= 1
  x = min(x, l + r)

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
input()
s = input()

def f(i):
  x = 0

  for n in range(len(s)):
    if n < i and s[n] == 'W':
      x += 1
    elif n > i and s[n] == 'E':
      x += 1
  
  return x

arr = map(f, range(len(s)))

print(min(arr))


Fixed submission:
input()
s = input()

l = 0
r = s[1:].count('E')
x = l + r

for i in range(1, len(s)):
  if s[i - 1] == 'W':
    l += 1

  if s[i] == 'E':
    r -= 1
  x = min(x, l + r)

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
input()
s = input()

def f(i):
  w = s[0:i]
  e = s[i:]

  wl = filter(lambda c: c == 'W', w)
  el = filter(lambda e: e == 'E', e)

  return len(list(wl) + list(el))

l = map(f, range(len(s)))

print(min(list(l)))

Fixed submission:
input()
s = input()

l = 0
r = s[1:].count('E')
x = l + r

for i in range(1, len(s)):
  if s[i - 1] == 'W':
    l += 1

  if s[i] == 'E':
    r -= 1
  x = min(x, l + r)

print(x)
Buggy python submission (verdict: Runtime Error):
def main37():
    num = int(input())
    data = input().split()
    retu = []
    for i in range(num):
        retu.append(int(data[i]))
    kari = list(retu)
    kari.sort()
    kosu = 0
    for i in range(num):
        if retu[i] != kosu[i]:
            kosu = kosu + 1
    if kosu == 2 or kosu == 0:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main37()

Fixed submission:
def main37():
    num = int(input())
    data = input().split()
    retu = []
    for i in range(num):
        retu.append(int(data[i]))
    kari = list(retu)
    kari.sort()
    kosu = 0
    for i in range(num):
        if retu[i] != kari[i]:
            kosu = kosu + 1
    if kosu == 2 or kosu == 0:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main37()
Buggy python submission (verdict: Runtime Error):
def main01():
    data = input().split()
    nums = []

    for i in range(3):
        nums.append(int(data))
    densya = num[0] * num[1]
    if densya > num[2]:
        print(num[2])
    else:
        print(densya)


if __name__ == "__main__":
    main01()

Fixed submission:
def main01():
    data = input().split()
    num = []

    for i in range(3):
        num.append(int(data[i]))
    densya = num[0] * num[1]
    if densya > num[2]:
        print(num[2])
    else:
        print(densya)


if __name__ == "__main__":
    main01()
Buggy python submission (verdict: Runtime Error):
def main08():
    data = input().split()
    nl = []
    for i in range(2):
        nl.append(int(data[i]))
    hantei = nl[0] + nl[1]
    result = 0
    if hantei <= nl[0] and 1 <= hantei:
        for i in range(nl[0]):
            result = result + nl[1] + i
    elif nl[1] > 0:
        for i in range(nl[0]-1):
            result = result + nl[1] + i + 1
    else:
        for i in range(nl[0]-1):
            result = result + nl[i] + i
    print(result)

if __name__ == "__main__":
    main08()

Fixed submission:
def main08():
    data = input().split()
    nl = []
    for i in range(2):
        nl.append(int(data[i]))
    hantei = nl[0] + nl[1]
    result = 0
    if hantei <= nl[0] and 1 <= hantei:
        for i in range(nl[0]):
            result = result + nl[1] + i
    elif nl[1] > 0:
        for i in range(nl[0]-1):
            result = result + nl[1] + i + 1
    else:
        for i in range(nl[0]-1):
            result = result + nl[1] + i
    print(result)

if __name__ == "__main__":
    main08()
Buggy python submission (verdict: Runtime Error):
def main15():
    data = input().split()
    num = []
    for i in range(2):
        num.append(int(data[i]))
    data2 = input().split()
    num2 = []
    for i in range(num[0]):
        num2.append(int(data2[i]))
    length = 0
    result = 1
    for i in range(num[0]):
        length = length + num[2]
        if length > num[1]:
            break
        else:
            result = result + 1
    print(result)

if __name__ == "__main__":
    main15()

Fixed submission:
def main15():
    data = input().split()
    num = []
    for i in range(2):
        num.append(int(data[i]))
    data2 = input().split()
    num2 = []
    for i in range(num[0]):
        num2.append(int(data2[i]))
    length = 0
    result = 1
    for i in range(num[0]):
        length = length + num2[i]
        if length > num[1]:
            break
        else:
            result = result + 1
    print(result)

if __name__ == "__main__":
    main15()
Buggy python submission (verdict: Runtime Error):
def main42():
    data = input()
    nagasa = len(data)
    result = 10000
    for i in range(0,nagasa-2,1):
        kari = data[i:i+3]
        num = int(kari)
        if result > abs(num - 753)

if __name__ == "__main__":
    main42()

Fixed submission:
def main42():
    data = input()
    nagasa = len(data)
    result = 10000
    for i in range(0,nagasa-2,1):
        kari = data[i:i+3]
        num = int(kari)
        if result > abs(num - 753):
            result = abs(num - 753)
    print(result)

if __name__ == "__main__":
    main42()
Buggy python submission (verdict: Runtime Error):

def main04():
    buf = input("");
    bufs = buf.split(" ");
    val1 = [];
    for i in range(len(bufs)):
        val1.append(int(bufs[i]));
    val2 = [];
    for i in range(val1[0]):
        buf = input("");
        bufs = buf.split(" ");
        kari = [];
        kari.append(int(bufs[0]));
        kari.append(int(bufs[1]));
        val2.append(kari);
    min1 = 10000;
    for i in range(val1[0]):
        if val2[1][i] < val1[1] and val2[0][i] < min1:
            min1 = val2[0][i];
    if min1 == 10000:
        print("TLE");
    else:
        print(min1);

if __name__ == '__main__':
    main04()

Fixed submission:
def main04():
    buf = input("");
    bufs = buf.split(" ");
    val1 = [];
    for i in range(len(bufs)):
        val1.append(int(bufs[i]));
    val2 = [];
    for i in range(val1[0]):
        buf = input("");
        bufs = buf.split(" ");
        kari = [];
        kari.append(int(bufs[0]));
        kari.append(int(bufs[1]));
        val2.append(kari);
    min1 = 10000;
    for i in range(val1[0]):
        if val2[i][1] < val1[1] + 1 and val2[i][0] < min1:
            min1 = val2[i][0];
    if min1 == 10000:
        print("TLE");
    else:
        print(min1);

if __name__ == '__main__':
    main04()

Buggy python submission (verdict: Runtime Error):
def main04():
    buf = input("");
    bufs = buf.split(" ");
    val1 = [];
    for i in range(len(bufs)):
        val1.append(int(bufs[i]));
    val2 = [];
    for i in range(val1[0]):
        buf = input("");
        bufs = buf.split(" ");
        kari = [];
        kari.append(int(bufs[0]));
        kari.append(int(bufs[1]));
        val2.append(kari);
    min1 = 10000;
    for i in range(val1[0]):
        if val2[1][i] < val1[1] and val2[0][i] < min1:
            min1 = val2[0][i];
    if min1 == 10000:
        print("TLE");
    else:
        print(min1);

if __name__ == '__main__':
    main03()

Fixed submission:
def main04():
    buf = input("");
    bufs = buf.split(" ");
    val1 = [];
    for i in range(len(bufs)):
        val1.append(int(bufs[i]));
    val2 = [];
    for i in range(val1[0]):
        buf = input("");
        bufs = buf.split(" ");
        kari = [];
        kari.append(int(bufs[0]));
        kari.append(int(bufs[1]));
        val2.append(kari);
    min1 = 10000;
    for i in range(val1[0]):
        if val2[i][1] < val1[1] + 1 and val2[i][0] < min1:
            min1 = val2[i][0];
    if min1 == 10000:
        print("TLE");
    else:
        print(min1);

if __name__ == '__main__':
    main04()
Buggy python submission (verdict: Runtime Error):
def main18():
    strbuf = input('');
    num = int(strbuf);
    if(num<1200):
        printf("ABC");
    elif(num<2800):
        printf("ARC");
    else:
        printf("AGC");


if __name__ == '__main__':
    main18()

Fixed submission:

def main17():
    strbuf = "U"
    strbuf2 = "N"
    strbuf3 = "K"
    print(strbuf + strbuf2 + strbuf3)

def main18():
    strbuf = input('');
    num = int(strbuf);
    if(num<1200):
        print("ABC");
    elif(num<2800):
        print("ARC");
    else:
        print("AGC");


if __name__ == '__main__':
    main18()
Buggy python submission (verdict: Runtime Error):
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = iti;
        if(iti<10):
            break;
        kari = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

def main15():
    strbuf1 = input('');
    strbuf2 = input('');
    buf1 = [];
    buf2 = []
    for i in range(2):


if __name__ == '__main__':
    main14()

Fixed submission:
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = peku + iti;
        if(kari<10):
            break;
        kari = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

def main15():
    strbuf1 = input('');
    strbuf2 = input('');
    buf1 = [];
    buf2 = [];
    for i in range(2):
        buf1.append(int(strbuf1[i]));
    for i in range(buf1[0]):
        buf2.append(int(strbuf2[i]));


if __name__ == '__main__':
    main14()

Buggy python submission (verdict: Runtime Error):
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = iti;
        if(iti<10):
            break;
        iti = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

if __name__ == '__main__':
    main14()

Fixed submission:
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = peku + iti;
        if(kari<10):
            break;
        kari = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

def main15():
    strbuf1 = input('');
    strbuf2 = input('');
    buf1 = [];
    buf2 = [];
    for i in range(2):
        buf1.append(int(strbuf1[i]));
    for i in range(buf1[0]):
        buf2.append(int(strbuf2[i]));


if __name__ == '__main__':
    main14()