Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
aa=map(int,input().split())
aa=list(aa)
memo=[]
count=0
for a in aa:
    if a<400:memo.append(1)
    elif a<800:memo.append(2)
    elif a<1200:memo.append(3)
    elif a<1600:memo.append(4)
    elif a<2000:memo.append(5)
    elif a<2400:memo.append(6)
    elif a<2800:memo.append(7)
    elif a<3200:memo.append(8)
    else:count+=1

memo=set(memo)
min=len(memo)
if min=0:min=1
max=len(memo)+count
if max>8: max=8
print(min,max)

Fixed submission:
n=int(input())
aa=map(int,input().split())
aa=list(aa)
memo=[]
count=0
for a in aa:
    if a<400:memo.append(1)
    elif a<800:memo.append(2)
    elif a<1200:memo.append(3)
    elif a<1600:memo.append(4)
    elif a<2000:memo.append(5)
    elif a<2400:memo.append(6)
    elif a<2800:memo.append(7)
    elif a<3200:memo.append(8)
    else:count+=1

memo=set(memo)
min=len(memo)
if min==0:min=1
max=len(memo)+count
#if max>8: max=8
print(min,max)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
list=[]
for i in range(n):
    a,b=map(int,input().split())
    for j in range(b): list.append(a)

list.sort()
ans=list[k-1]
print(ans)

Fixed submission:
n,k=map(int,input().split())
list=[]
for i in range(n):
    a,b=map(int,input().split())
    list.append((a,b))
list.sort()

count=0
for i in range(n):
    count+=list[i][1]
    if count>=k: ans=list[i][0]; break


print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(input().split())

a=a[0].upper()
b=b[0].upper()
c=c[0].upper()

print(a+b+c)



Fixed submission:
a,b,c=input().split()

a=a[0].upper()
b=b[0].upper()
c=c[0].upper()

print(a+b+c)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
a = list(map(int,input().split()))
arr = np.array(a)

# 奇数がプラス、偶数がマイナス
cost1 = 0
cum = arr.cumsum()
for i in range(n):
    tmp = abs(cum[i]) + 1
    if i%2==1 and cum[i]<=0: cost1 += tmp ; cum[i:] += tmp
    if i%2==0 and cum[i]>=0: cost1 += tmp ; cum[i:] -= tmp

# 奇数がマイナス、偶数がプラス
cost2 = 0
cum = arr.cumsum()
for i in range(n):
    tmp = abs(cum[i]) + 1
    if i%2==1 and cum[i]>=0: cost2 += tmp ; cum[i:] -= tmp
    if i%2==0 and cum[i]<=0: cost2 += tmp ; cum[i:] += tmp

ans = min(cost1, cost2)
print(ans)



Fixed submission:
import numpy as np

n = int(input())
a = list(map(int,input().split()))
arr = np.array(a)

# 奇数がプラス、偶数がマイナス
cost1 = 0
cum = 0
for i in range(n):
    cum += arr[i]
    tmp = abs(cum) + 1
    if i%2==1 and cum<=0: cost1 += tmp ; cum += tmp
    if i%2==0 and cum>=0: cost1 += tmp ; cum -= tmp

# 奇数がマイナス、偶数がプラス
cost2 = 0
cum = 0
for i in range(n):
    cum += arr[i]
    tmp = abs(cum) + 1
    if i%2==1 and cum>=0: cost2 += tmp ; cum -= tmp
    if i%2==0 and cum<=0: cost2 += tmp ; cum += tmp


ans = min(cost1, cost2)
print(ans)
Buggy python submission (verdict: Runtime Error):

# アリ１からNまでの前後関係は不変。つまり、アリ１からNまでの順番は保たれる。
# アリの最終座標の昇順リストを用意して、アリ１からNに対応させればよい。

n,l,t=map(int,input().split())
x=[0 for i in range(n+1)]
w=[0 for i in range(n+1)]
ans=[]　# アリの最終座標リスト
w1=[]　# w=1のアリの初期座標リスト
w2=[]　# w=2のアリの初期座標リスト

for i in range(1,n+1):
    x[i],w[i]=map(int,input().split())
    if w[i]==1: a=(x[i]+t)%l; w1.append(x[i])
    if w[i]==2: a=(x[i]-t+l)%l; w2.append(x[i])
    ans.append(a)

# kはアリ同士がすれ違った数
k=0
for i in range(n):
    if w[i]==1:　# もしw=1のアリがいないならk=0のままで問題なし。
        if (x[i]+2*t)>=l:
            for j in range(x[i],x[i]+2*t+1): k+=w2.count(j)
            for j in range((x[i]+2*t+1)%l,x[i]): k+=w2.count(j)
        else:
            for j in range(x[i],x[i]+2*t+1): k+=w2.count(j)
        break　# １つw=1のアリ見つけたらそこで終了。

# ansをソートしてkだけ円順列的にずらして出力
ans.sort()
for i in range(n): print(ans[(i+k)%n])



Fixed submission:

# アリ１からNまでの前後関係は不変。つまり、アリ１からNまでの順番は保たれる。
# アリの最終座標の昇順リストを用意して、アリ１からNに対応させればよい。

n,l,t=map(int,input().split())
x=[]
w=[]
ans=[]

crash=0
for i in range(n):
    xx,ww=map(int,input().split())
    x.append(xx); w.append(ww)
    if w[i]==1: anss=(x[i]+t)%l
    else: anss=(x[i]-t+l)%l
    ans.append(anss)
    if i!=0 and w[i] != w[0]:
        if w[0] == 1: crash += (t-((x[i]-x[0])/2)) // (l/2) + 1
        else: crash += (t-(l-(x[i]-x[0]))/2) // (l/2) + 1

# あり１の現在のゼッケン番号num0
if w[0]==1: num0 =int(crash)%n
else: num0 =int(-crash)%n
# あり１の現在地点に対応する昇順リストの番号num
nowplace = ans[0]
ans.sort()
num = ans.index(nowplace)
if w[0]==1 and ans.count(nowplace)==2: num += 1 # ２つ該当する場合の処理
# numがnum0の位置であるように調整したい
gap = num0-num
for i in range(n):
    i = (i-gap)%n
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n/nn))
print(ans)

Fixed submission:
a,b=map(int,input().split())

ans = (a+b)%24

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn+=1
ans = len(str(nn))
print(ans)

Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
nn = int(math.sqrt(n))
while n%i != 0: i-=1
print(len(str(n//i)))


Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())

a=int(math.sqrt(n))

if n%2 != a%2: a+=1
while n%a != 0:a+=2

b=int(n/a)

a_dig = len(str(a))
b_dig = len(str(b))

ans=max(a_dig,b_dig)

print(ans)


Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())

a=int(math.sqrt(n))

if n%2 != 0:
    if a%2==0: a+=1
    while n%a != 0:a+=2
else:
    while n%a != 0:a+=1

b=int(n/a)

a_dig = len(str(a))
b_dig = len(str(b))

ans=max(a_dig,b_dig)

print(ans)

Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())

a=int(math.sqrt(n))

while True:
    if n%a==0:break
    else: a+=1

b=int(n/a)

a_dig = len(str(a))
b_dig = len(str(b))

ans=max(a_dig,b_dig)

print(ans)

Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())

a=int(math.sqrt(n))

while True:
    if n%a==0:break
    else: a+=1

b=(n/a)

a_dig = int(math.log10(a))+1
b_dig = int(math.log10(b))+1

ans=max(a_dig,b_dig)

print(ans)

Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

s = sinput()[::-1]
n = len(s)

a = "dream"[::-1]
b = "dreamer"[::-1]
c = "erase"[::-1]
d = "eraser"[::-1]

ss = ""
for i in range(n+1):
    for j in range(i+1,n+1):
        if s[i:j] in [a,b,c,d]: ss += s[i:j]; s = s[:i] + s[j:]

flag = len(ss) == n
ans = "YES" if flag else "NO"
print(ans)


Fixed submission:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

s = sinput()[::-1]

a = "dream"[::-1]
b = "dreamer"[::-1]
c = "erase"[::-1]
d = "eraser"[::-1]

s = "".join(s.split(d))
s = "".join(s.split(c))
s = "".join(s.split(b))
s = "".join(s.split(a))

ans = "YES" if s=="" else "NO"
print(ans)
Buggy python submission (verdict: Runtime Error):

wo=0
ho=0
w,h,n=map(int, input().split())

for i in range(n):
    x,y,a=map(int, input().split())
    if a==1: wo=x
    if a==2: w=x
    if a==3: ho=y
    if a==4: h=y

ans=(w-wo)*(h-ho)

if wo>=w or h0>=h: print(0)
else: print(ans)

Fixed submission:

wo=0
ho=0
w,h,n=map(int, input().split())

for i in range(n):
    x,y,a=map(int, input().split())
    if a==1:
        if x>wo: wo=x
    if a==2:
        if x<w: w=x
    if a==3:
        if y>ho: ho=y
    if a==4:
        if y<h: h=y

ans=(w-wo)*(h-ho)

if wo>=w or ho>=h: print(0)
else: print(ans)
Buggy python submission (verdict: Runtime Error):

s=input()

count=0
for i in range(len(s)):
    if s[i]!=s[i+1]: count+=1

print(count)

Fixed submission:

s=input()

count=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]: count+=1

print(count)

Buggy python submission (verdict: Runtime Error):

s=input()

count=0
for i in range(len(s)):
    if s[i]!=s[i+1]: count+=1

print(count)

Fixed submission:

s=input()

count=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]: count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
s=str(input())
p=list('ABDEGHIJKLMNOPQRSTUVWXYZ')
p.remove("C")
p.remove("F")
for i in p:
    s=s.replace(i,'')
 
if 'CF' in s:
    print('Yes')
else:
    print('No')

Fixed submission:
s=str(input())
p=[chr(i) for i in range(65, 65+26)]
p.remove("C")
p.remove("F")
for i in p:
    s=s.replace(i,'')
 
if 'CF' in s:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s=input()
l=["a:z"]
l.remove(c)
l.remove(f)

for i in l:
  s.replace(i, "")

if "CF" in l:
   print("yes")
else:
   print("NO")

Fixed submission:
s=str(input())
p=[chr(i) for i in range(65, 65+26)]
p.remove("C")
p.remove("F")
for i in p:
    s=s.replace(i,'')
 
if 'CF' in s:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, k=map(int, input().split())

ans=k*(k-1)**(n-1)

print(ans)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):
n, k=map(int, input().split())

ans=(k-1)**(n-1)

print(ans*k)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):
n, k=map(int, input().split())

ans=k*(k-1)**(n-1)

print(ans)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):

n, k=mat(int, input().split())

ans=(k-1)**(n-1)

print(ans*k)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):

n,k=mat(int, input().split())

ans=k*(k-1)**(n-1)

print(ans)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):

n, k=map(int, input().split())

ans=k*((k-1)**(n-1))

print(ans)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):

n, k=mat(int, input().split())

ans=k*((k-1)**(n-1))

print(ans)

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):
def penki(n, k):
    return k*(k-1)**(n-1)

n, k=mat(int, input().split())

print(penki(n, k))

Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))

Buggy python submission (verdict: Runtime Error):
シカのAtCoDeerくんはペンキをこれまでに3つ買いました。おととい買ったペンキの色は a , 昨日買ったペンキの色は b , 今日買ったペンキの色は c です。各ペンキの色は1以上100以下の整数で表されます。 AtCoDeerくんはわすれんぼうなため、同じ色のペンキを買ってしまっていることがあります。AtCoDeerくんが買ったペンキの色の種類の個数を教えてあげてください。

a,b,c=map(int, input().split())


Fixed submission:

def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))
Buggy python submission (verdict: Runtime Error):
/* *>>>>>Anshit_Bhardwaj<<<<<* */
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << ' ' << y << endl
#define dbg3(x, y, z) cout << x << ' ' << y << ' ' << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a, b;
    double d;
    cin >> a >> d;
    b = d * 100;
    a *= b;
    cout << a / 100 << endl;
}

Fixed submission:
line = input()
line = line.split()
a = int(line[0])
b = float(line[1]) + 0.001
c = int(b * 100)
print((a * c) // 100)
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
value = []
sum = 0

for i in range(N):
    value.append(int(input())) 
newValue = sorted(value)

for j in range(K):
    sum = sum + newValue[j]

print(sum)

Fixed submission:
N = list(map(int,input().split()))
value = list(map(int,input().split()))
sum = 0
newValue = sorted(value)
for i in range(N[1]):
    sum = sum + newValue[i]
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
A = list(map(int,input().split()))
result = 1
for i in range(N):
    result = result * A[i]
if result > 10**18:
    print(-1)
else:
    print(result)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
A = list(map(int,input().split()))
A.sort()
result = 1
for i in range(N):
    result = result * A[i]
    if result > 1e18:
        result = -1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10*10)

N = int(input())
A = list(map(int,input().split()))
result = 1
for i in range(N):
    result = result * A[i]
if result > 10**18:
    print(-1)
else:
    print(result)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
A = list(map(int,input().split()))
A.sort()
result = 1
for i in range(N):
    result = result * A[i]
    if result > 1e18:
        result = -1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
result = 1
for i in range(N):
    result = result * A[i]
if result > 10**18:
    print(-1)
else:
    print(result)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
A = list(map(int,input().split()))
A.sort()
result = 1
for i in range(N):
    result = result * A[i]
    if result > 1e18:
        result = -1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
result = 1
for i in range(N):
    result = result * A[i]
if result > 10**18:
    print(-1)
else:
    print(result)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
A = list(map(int,input().split()))
A.sort()
result = 1
for i in range(N):
    result = result * A[i]
    if result > 1e18:
        result = -1
        break
print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
N_list = list(N)
if N_list[0] = 2 or N_list[0] = 4 or N_list[0] = 5 or N_list[0] = 7 or N_list[0] = 9:
    print(hon)
elif N_list[0] = 0 or N_list[0] = 1 or N_list[0] = 6 or N_list[0] = 8:
    print(pon)
else:
    print(bon)
    

Fixed submission:
N = input()
N_list = list(N)
if N_list[-1] == "2" or N_list[-1] == "4" or N_list[-1] == "5" or N_list[-1] == "7" or N_list[-1] == "9":
    print("hon")
elif N_list[-1] == "0" or N_list[-1] == "1" or N_list[-1] == "6" or N_list[-1] == "8":
    print("pon")
else:
    print("bon")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N, M = map(int,input().split())
D = [[] for i in range(N)]

for i in range(M):
  a,b = map(int,input().split())
  D[a-1].append(b)
  D[b-1].append(a)

if [] in D:
  print("No")
  sys.exit()
else:
  print("Yes")

ans = [0 for i in range(N)]

near_next = [1]

while 0 in ans[1:]:
  near = near_next
  near_next = []
  for i in near:
    for j in D[i-1]:
      if ans[j-1]==0:
        ans[j-1] = i
        if j not in near_next:
          near_next.append(j)
  
for i in ans[1:]:
  print(i)

Fixed submission:
import queue
N, M = map(int,input().split())
D = [[] for i in range(N)]

for i in range(M):
  a,b = map(int,input().split())
  D[a-1].append(b)
  D[b-1].append(a)

print("Yes")

dist = [0 for i in range(N)]
prev = [0 for i in range(N)]
prev[0] == 1

q = queue.Queue()
q.put(1)

while not q.empty():
  t = q.get()
  for i in D[t-1]:
    if prev[i-1] == 0:
      prev[i-1] = t
      q.put(i)

for i in prev[1:]:
  print(i)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

t = 0
now = 1
footprint = [1]

while t < K:
  if A[now-1] not in footprint:
    footprint.append(A[now-1])
    now = A[now-1]
    t += 1
  else:
    s = footprint.index(A[now-1])
    l = t - s + 1
    e = (K-s) % l
    now = footprint[i+e]
    break

print(now)

Fixed submission:
S = input()
T = input()
if S == T[:-1]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
S = input()
T = input()
if S == T[:-1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
c = [list(map(int, input().split())) for i in range(n)]
ans = float('inf')
money = []

for i in range(2**n):
  temp_money = 0
  temp_skill = [0]*m
  for j in range(n):
    if (i >> j) & 1:
      temp_money += c[j][0]
      temp_skill = [a + b for a, b in zip(temp_skill, c[j][1:m+1])]
    if all([i >= x for i in temp_skill])==True:
      money.append(temp_money)

ans = min(ans,min(money))
if ans == float("inf"):
  ans = -1

print(ans)

Fixed submission:
n, m, x = map(int,input().split())
c = [list(map(int, input().split())) for i in range(n)]
ans = float('inf')
money = [float('inf')]

for i in range(2**n):
  temp_money = 0
  temp_skill = [0]*m
  for j in range(n):
    if (i >> j) & 1:
      temp_money += c[j][0]
      temp_skill = [a + b for a, b in zip(temp_skill, c[j][1:m+1])]
    if all([i >= x for i in temp_skill])==True:
      money.append(temp_money)

ans = min(ans,min(money))
if ans == float("inf"):
  ans = -1

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
list0 = [list(map(int, input().split())) for i in range(2*K-1)]
listd = list0[1::2]
listf = listd[0]
count = 0
for i in range(1, K-1):
  listf = listf + listd[i]

for i in range(1, N):
  if i not in listf:
    count = count + 1

print(count)

Fixed submission:
N, K = map(int, input().split())
ans = [0]*N
for i in range(K):
  d = int(input())
  for j in list(map(int, input().split())):
    ans[j-1] = 1
print(ans.count(0))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0]*N
H = list(map(int, input().split()))
Roads = [list(map(int, input().split())) for i in range(M)]
FP = [0]*N

for i in range(1,N+1):
  Opp = []
  t = 0
  if FP[i-1] == 0:
    for j in range(M):
      if i in Roads[j]:
        if i == Roads[j][0]:
          Opp.append(Roads[j][1])
        else:
          Opp.append(Roads[j][0])
    
    if len(Opp) == 0:
      FP[i-1] = 1
      continue
    
    for j in Opp:
      if H[j-1] < H[i-1]:
        FP[j-1] = -1
        t += (-FP[j-1])
    
    if t == len(Opp):
      FP[i-1] = 1

print(FP.count(1))

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
near_max = [0]*N
for i in range(M):
  a, b = map(int, input().split())
  near_max[a-1] = max(near_max[a-1], H[b-1])
  near_max[b-1] = max(near_max[b-1], H[a-1])

ans = 0
for i in range(N):
  if near_max[i] < H[i]:
    ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(N-1):
  wa = i + A[i]
  for j in range(i+1,N):
    sa = j - A[j]
    if wa == sa:
      ans += 1

print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
D = {}

for j in range(N):
  if j-A[j] in D:
    ans += D[j-A[j]]
  if j+A[j] in D:
    D[j+A[j]] += 1
  else:
    D[j+A[j]] = 1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
List_S = [""]
for i in range(N):
  S = input()
  if S not in List_S:
    List_S.append(S)
    
print(len(List_S)-1)

Fixed submission:
N = int(input())
List_S = [input() for i in range(N)]
print(len(set(List_S)))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
List_S = [""]
for i in range(N):
  S = input()
  if S not in List_S:
    List_S.append(S)
    
print(len(List_S)-1)

Fixed submission:
N = int(input())
List_S = [input() for i in range(N)]
print(len(set(List_S)))
Buggy python submission (verdict: Runtime Error):
import math
R = int(input())
print(2*R*math.Pi)

Fixed submission:
import math
R = int(input())
print(2*R*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
[A, B] = map(lambda x: int(x), input().split(" "))

def absolute_sub(x, y):
    if x > y:
        return x - y
    else:
        return -1*(x - y)

able = False

for i in range(max(A, B)):
    if absolute_sub(A, i) == absolute_sub(B, i):
        print(i)
        able = True

if not able:
    print("IMPOSSIBLE")

Fixed submission:
[A, B] = map(lambda x: int(x), input().split(" "))
K = (A + B) / 2

if K.is_integer():
    print(int(K))
else:
    print("IMPOSSIBLE")