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

Fixed submission:
x = int(input())
n = 1
while (x*n)%360!=0:
    n+=1
print(n)

Buggy submission (verdict: Runtime Error):
import numpy as np

A,B,C,D = map(int, input().split())
P = 998244353

DP = np.zeros([C+1,D+1],dtype=np.int32)
DP[A,B] = 1
for a in range(A+1,C+1):
    DP[a,B] = DP[a-1, B] * B % P
for b in range(B+1,D+1):
    DP[A,b] = DP[A, b-1] * A % P
for a in range(A+1,C+1):
    for b in range(B+1,D+1):
        DP[a,b] = (b*DP[a-1,b] + a*DP[a,b-1] - (a-1)*(b-1)*DP[a-1,b-1]) % P

print(DP[C,D])

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())
P = 998244353

DP = {}
DP[A,B] = 1
for a in range(A+1,C+1):
    DP[a,B] = DP[a-1, B] * B % P
for b in range(B+1,D+1):
    DP[A,b] = DP[A, b-1] * A % P
for a in range(A+1,C+1):
    for b in range(B+1,D+1):
        DP[a,b] = (b*DP[a-1,b] + a*DP[a,b-1] - (a-1)*(b-1)*DP[a-1,b-1]) % P

print(DP[C,D])
Problem p02661 (python)

Fixed submission:
N = int(input())
A = []
B = []
for i in range(N):
  a,b = map(int, input().split())
  A.append(a)
  B.append(b)

A = sorted(A)
B = sorted(B)
 
if N%2==1:
  print(B[N//2] - A[N//2] + 1)
else:
  print( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
B = []
for i in range(N):
  a,b = map(input().split())
  A.append(a)
  B.append(b)

A = sorted(A)
B = sorted(B)
 
if N%2==1:
  print(B[N//2] - A[N//2] + 1)
else:
  print( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )

Buggy submission (verdict: Runtime Error):
args = map(int, input().split())
N = args[0]
A = [a for (i,a) in enumerate(args[1:]) if i%2==1]
B = [b for (i,b) in enumerate(args[1:]) if i%2==0]

A = sorted(A)
B = sorted(B)

if N%2==1:
	print(B[N//2] - A[N//2] + 1)
else:
	print( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )
Problem p02627 (python)

Fixed submission:
a=input()
if a.isupper():
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
n=int(input())
def num2alpha(num):
  if num<=26:
    return chr(64+num)
  elif num%26==0:
    return num2alpha(num//26-1)+chr(90)
  else:
    return num2alpha(num//26)+chr(64+num%26)
print(num2alpha(n).lower())

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
print(sum(sorted(p)[:k]))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
print(sum(sorted(p)[:K]))
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
pre = -1
for i in A:
  ans += B[i-1]
  if i == pre+1:
  	ans += C[pre-1]
  pre = i
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
pre = -1
for i in A:
  ans += B[i-1]
  if i == pre+1:
  	ans += C[i-1]
  pre = i
print(ans)
Problem p02951 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
a, b, c = map(int, input().split())
rest = a - b
if c - rest < 0:
  print(0)
else:
  print (c - a + b)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())
return c - a + b
Problem p02860 (python)

Fixed submission:
def main():
    N = int(input())
    S = str(input())

    if N % 2 == 1:
        print('No')
        return 0

    s_start = S[:N//2]
    s_end = S[N//2:]

    if s_start == s_end:
        print('Yes')
    else:
        print('No')
    return 0


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = str(input())

    if N % 2 == 1:
        print('No')
        return 0

    s_start = S[:N//2]
    s_end = S[N//2:]

    is s_start == s_end:
        print('Yes')
    else:
        print('No')
    return 0


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 0:
  print('No')
S = str(input())

s_start = S[:N//2]
s_end = S[N//2:]
is s_start == s_end:
  print('Yes')
else:
  print('No')
Problem p02989 (python)

Fixed submission:
n = int(input())                   
d = list(map(int,input().split()))

sorted_d = sorted(d)
half = n//2

a = sorted_d[half-1]
b = sorted_d[half]

print(b-a)

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

sorted_d = sorted(d)
half = n/2

a = sorted_d[half]
b = sorted_d[half+1]

print(b-a)

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

sorted_d = sorted(d)
half = n/2 

sorted_d[half] = a 
sorted_d[half+1] = b 

print(b-a)
Problem p03041 (python)

Fixed submission:
# coding: utf-8

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

low = s[k-1].lower()
print(s[:k-1]+low+s[k:])

Buggy submission (verdict: Runtime Error):
# coding: utf-8

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

low = s[k].lower()
print(s[:k]+low+s[k+1:])
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

if n>=m or m == 1:
    S =0
else:
    d = sorted([l[i] - l[i+1]  for i in range(m-1)], reverse=True)
    S = max(l) - min(l)
    for i in range(n-1):
        S -= d[i]

print(S)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

if m == 1:
    S =0
else:
    d = sorted([l[i] - l[i+1]  for i in range(m-1)], reverse=True)
    S = max(l) - min(l)

    if n > 1:
        for i in range(n-1):
            S -= d[i]
    else:
        S = l[0]

print(S)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

if m == 1 and n == 1:
    S =0
else:
    d = sorted([l[i] - l[i+1]  for i in range(m-1)], reverse=True)
    S = max(l) - min(l)

    for i in range(n-1):
        S -= d[i]

print(S)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 1 and n == 1:
    S =0
else:
    l = sorted(list(map(int, input().split())), reverse=True)
    d = sorted([l[i] - l[i+1]  for i in range(m-1)], reverse=True)
    S = max(l) - min(l)

    for i in range(n-1):
        S -= d[i]

print(S)
Problem p03209 (python)

Fixed submission:
# coding: utf-8

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

l,p = [1],[1]
for i in range(n):
    l.append(l[i]*2+3)
    p.append(p[i]*2+1)

def f(n,x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + l[n-1]:
        return f(n-1,x-1)
    else:
        return p[n-1]+1+f(n-1,x-2-l[n-1])

print(f(n,x))

Buggy submission (verdict: Runtime Error):
# coding: utf-8

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

l,p = [1],[1]
for i in range(n):
    l.append(a[i]*2+3)
    p.append(a[i]*2+1)

def f(n,x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + l[n-1]:
        return f(n-1,x-1)
    else:
        return p[n-1]+1+f(n-1,x-2-l[n-1])

print(f(n,x))

Buggy submission (verdict: Runtime Error):
# coding: utf-8

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

l,p = [1],[1]
for i in range(n):
    l.append(a[i]*2+3)
    p.append(a[i]*2+1)

def f(n,x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + a[n-1]:
        return f(n-1,x-1)
    else:
        return p[n-1]+1+f(n-1,x-2-a[n-1])

print(f(n,x))
Problem p02622 (python)

Fixed submission:
S=input()
T=input()

ans = 0
for i in range(len(S)):
    if S[i] != T[i]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
=input()
T=input()

ans = 0
for i in range(len(S)):
    if S[i] != T[i]:
        ans += 1
print(ans)
Problem p02659 (python)

Fixed submission:
A,B =map(str,input().split())
B_100=int(B.replace('.',''))
print(int(A)*(B_100)//100)

Buggy submission (verdict: Runtime Error):
A,B =input().split()
print(int(A*(B*100)/100))
Problem p02729 (python)

Fixed submission:
str1 =str(input())
s1 = str1.split(' ')
m = int(s1[0])
n = int(s1[1])
x = (m*(m-1))/2
y = (n*(n-1))/2
print(int(x+y))

Buggy submission (verdict: Runtime Error):
str1 =str(input())
s1 = str1.split(' ')
m = int(s1[0])
n = int(s1[1])
x = (m*(m-1))/2
y = (n*(n-1))/2
print(int((x+y))
Problem p02753 (python)

Fixed submission:
S = input()
if(S[0] == S[1] and S[1] == S[2]):
  print("No")
 
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string S[3];
int N;

for(i=0; i<N; i++) cin >> S[i];
if(S[0] == S[1] == S[2]);
  print("Yes")
else;
  print("No)
Problem p02661 (python)

Fixed submission:
import itertools
N = int(input())
AB = [list(map(int, input().split())) for n in range(N)]
sortA = sorted(AB, key= lambda x:x[0])
sortB = sorted(AB, key= lambda x:x[1])
if N % 2 == 0:
  k1 = int(N/2-1)
  k2 = int(N/2)
  minM = sortA[k1][0] + sortA[k2][0]
  maxM = sortB[k1][1] + sortB[k2][1]
  print(maxM-minM+1)
else:
  k = int((N+1)/2)-1
  A = sortA[k][0]
  B = sortB[k][1]
  print(B-A+1)

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
AB = [list(map(int, input().split())) for n in range(N)]

if N % 2 == 0:
  k1 = int(N/2-1)
  k2 = int(N/2)
  arr1 = list(range(AB[k1][0], AB[k1][1] + 1))
  arr2 = list(range(AB[k2][0], AB[k2][1] + 1))
  pattern = list(itertools.product(arr1, arr2))
  ans = set()
  for p in pattern:
    ans.add(sum(p))
  print(len(ans))
else:
  k = int((N+1)/2)-1
  A = AB[k][0]
  B = AB[k][1]
  print(B-A+1)

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
AB = [list(map(int, input().split())) for n in range(N)]

if N % 2 == 0:
  k1 = int(N/2-1)
  k2 = int(N/2)
  arr1 = list(range(AB[k1][0], AB[k1][1] + 1))
  arr2 = list(range(AB[k2][0], AB[k2][1] + 1))
  pattern = list(itertools.product(arr1, arr2))
  ans = set()
  for p in pattern:
    ans.add(sum(p))
  print(len(ans))
  

else:
  k = int((N+1)/2)-1
  A = AB[k][0]
  B = AB[k][1]
  print(B-A+1)
Problem p03805 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import itertools

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for n in range(M)]
branch = [[False]* N for n in range(N)]

for m in range(M):
  a = ab[m][0] - 1
  b = ab[m][1] -1 
  branch[a][b] = True
  branch[b][a] = True

ans = 0
pattern = itertools.permutations(range(1, N+1),N)
for l in pattern:
  if l[0] != 1:
    continue
  for n in range(N):
    if n == N - 1:
      ans += 1
      break
    p = l[n] -1
    np = l[n+1] -1
    if not(branch[p][np]):
      break

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import itertools

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for n in range(N)]
branch = [[False]* N for n in range(N)]

for m in range(M):
  a = ab[m][0] - 1
  b = ab[m][1] -1 
  branch[a][b] = True
  branch[b][a] = True

ans = 0
pattern = list(itertools.permutations(range(1, N+1),N))
for l in pattern:
  if l[0] != 1:
    continue
  for n in range(N):
    if n == N - 1:
      ans += 1
      break
    p = l[n] -1
    np = l[n+1] -1
    if not(branch[p][np]):
      break

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import itertools

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for m in range(M)]
branch = [[False]* N for n in range(N)]

for m in range(M):
  a = ab[m][0] - 1
  b = ab[m][1] -1 
  branch[a][b] = True
  branch[b][a] = True

ans = 0
pattern = list(itertools.permutations(range(1, M+1),M))
for l in pattern:
  if l[0]  != 1:
    continue
  for m in range(M):
    if m == M - 1:
      ans += 1
      break
    p = l[m] -1
    np = l[m+1] -1
    if not(branch[p][np]):
      break

print(ans)
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()

BC = []
for _ in range(m):
    b, c = map(int, input().split())
    BC.append([b, c])

BC.sort(key=lambda x : x[1], reverse=True)
D = []
i = 0
count = 0
while (len(D) < n) and (len(BC) > i) :
    D.append(BC[i][1])
    count += 1
    if count == BC[i][0]:
        count = 0
        i += 1
        
j = 0
while (len(D) > j) and (A[j] <= D[j]) :
    A[j] = D[j]
    j += 1
    
print(sum(A))

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

BC = []
for _ in range(m):
    b, c = map(int, input().split())
    BC.append([b, c])

BC.sort(key=lambda x : x[1], reverse=True)
D = []
i = 0
count = 0
while (len(D) < n) or (len(BC) > i) :
    D.append(BC[i][1])
    count += 1
    if count == BC[i][0]:
        count = 0
        i += 1
        
j = 0
while A[j] <= D[j]:
    A[j] = D[j]
    j += 1
    
print(sum(A))

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

BC = []
for _ in range(m):
    b, c = map(int, input().split())
    BC.append([b, c])

BC.sort(key=lambda x : x[1], reverse=True)
D = []
i = 0
count = 0
while (len(D) < n) and (len(BC) > i) :
    D.append(BC[i][1])
    count += 1
    if count == BC[i][0]:
        count = 0
        i += 1
        
j = 0
while A[j] <= D[j]:
    A[j] = D[j]
    j += 1
    
print(sum(A))
Problem p02753 (python)

Fixed submission:
a=input()
if a[0]==a[1] and a[0]==a[2]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if a==b and a==c:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if a==b and a==c:
  print(No)
else:
  print(Yes)
Problem p02754 (python)

Fixed submission:
n,a,b=(int(x) for x in input().split())
cycle=int(n/(a+b))
res=n-cycle*(a+b)
if res>a:
  ans=cycle*a+a
else:
  ans=cycle*a+res
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b=input().split()
cicle=int(n/(a+b))
res=n-cicle*(a+b)
if res>a:
  ans=cicle*a+a
else:
  ans=cicle*a+res
print(ans)
Problem p02711 (python)

Fixed submission:
N = input()
if '7' in N:
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
if '7' in N:
    pritn('Yes')
else :
    print('No')
Problem p02712 (python)

Fixed submission:
N = int(input())
res = 0
for i in range(1,N+1):
    if i%15==0:
        dp = 0
    elif i%5==0:
        dp = 0
    elif i%3==0:
        dp = 0
    else :
        dp = i
    res = res+dp
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
res = 0
for i in range(1,N+1):
    if i%15==0:
        dp = 0
    elif i%5==0:
        dp = 0
    elif i%3==0:
        dp = 0
    else :å
        dp = i
    res = res+dp
print(res)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
if N >= (A+B):
    ans = A * (N//(A+B)) + min((N - ((A + B) * (N//(A+B)))), A)
elif N > A:
    ans = A
elif A >= N:
    ans = N
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

tmp_init = [1]*A + [0]*B
#len_add = len(tmp)
sum_tmp_init = sum(tmp_init)
len_tmp = len(tmp_init)
sum_b = 0
len0 = 0
tmp = []
while len(tmp) < N:
    sum_b += sum_tmp_init
    len0 += len_tmp
    tmp += [1]*A + [0]*B

ans = sum_b -sum_tmp_init  + sum(tmp_init[:N-len0+len_tmp])

print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

tmp = [1]*A + [0]*B
while len(tmp) < N:
    tmp += tmp
ans = sum(tmp[:N])

print(ans)
Problem p02779 (python)

Fixed submission:
N = int(input())
lisA = [int(i) for i in input().split()]
if len(set(lisA)) == len(lisA):
    print('YES')
else :
    print('NO')

Buggy submission (verdict: Runtime Error):
def calc_exp(x):
    return (int(x) + 1)/2

NK = input().split()
N, K = int(NK[0]), int(NK[1])
#lis_p = list(map(lambda x: int(x), input().split()))
lis_exp = list(map(calc_exp, input().split()))
dp=0
for i in range(N):
    dp = max(sum(lis_exp[i:i+K]), dp)
print(dp)

Buggy submission (verdict: Runtime Error):
def calc_exp(x:str)->float:
    return (int(x) + 1)/2

NK = input().split()
N, K = int(NK[0]), int(NK[1])
#lis_p = list(map(lambda x: int(x), input().split()))
lis_exp = list(map(calc_exp, input().split()))
dp=0
for i in range(N):
    dp = max(sum(lis_exp[i:i+K]), dp)
print(dp)
Problem p02771 (python)

Fixed submission:
A, B, C=map(int,input().split())
if((A==B) & (B!=C)):
    ans='Yes'
elif((A==C) & (B!=C)):
    ans='Yes'
elif((B==C) & (B!=A)):
    ans='Yes'
else:
    ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from operator import itemgetter

N=int(input())
List=[str(input()) for i in range(N)]
SetList=list(set(List))
nc=[List.count(SetList[i]) for i in range(len(SetList))]

indexmax=np.where(np.array(nc) == np.array(nc).max())[0]
if(len(indexmax)==1):
    print(itemgetter(*indexmax)(SetList))
else:
    for i in sorted(itemgetter(*indexmax)(SetList)):
        print(i)
Problem p02754 (python)

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

x = n // (a + b)
num += (x * a)

y = n % (a + b)

if y <= a:
    num += y
else:
    num += a

print(num)

Buggy submission (verdict: Runtime Error):
# 158 B

n, a , b = map(int, input().split())
s = ""

while len(s) < n:
    s += a * "b"
    if len(s) >= n:
        break
    s += b * "r"
    if len(s) >= n:
        break

s = s[:n]
print(s.count("b"))

Buggy submission (verdict: Runtime Error):
# 159 B

n, a, b = map(int, input().split())
s = ""

while len(s) < n:
    s += a * "b"
    if len(s) >= n:
        break
    s += b * "r"

s = s[:n]
print(s.count("b"))

Buggy submission (verdict: Runtime Error):
# 159 B

n, a, b = map(int, input().split())
s = ""

while len(s) <= n:
    s += a * "b"
    s += b * "r"

s = s[:n]
print(s.count("b"))
Problem p03617 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
n = int(input())
 
b = min(a + a, b)
c = min(b + b, c)
d = min(c + c, d)
 
q, r = divmod(n, 2)
x = q * d + r * c
print(x)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
n = int(input())
 
b = min(a + a, b)
c = min(b + b, c)
d = min(c + c, d)
 
q, r = divmod(N, 2)
x = q * d + r * c
print(x)
Problem p03785 (python)

Fixed submission:
n, c, k = map(int, input().split())
T = [0] * n
for i in range(n):
    T[i] = int(input())
 
T.sort()
ans, s, m = 0, 0, 0

for t in T:
    if m == 0:
        s = t
        m = 1
        ans += 1
    else:
        if t <= s + k:
            m += 1
        else:
            s = t
            m = 1
            ans += 1
    if m == c:
        m = 0
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
 
ans = -1
for i in range(n-1):
    if a[i]*2 < a[i+1]:
        ans = i
    a[i+1] += a[i]
print(n-ans-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 1
num = sum(l)
for i in range(0,n-1):
    num -= l[i]
    if num*2<l[i]:
        break
    ans += 1
print(ans)
Problem p03821 (python)

Fixed submission:
n = int(input())
a = []
b = []
for j in range(n):
    l = list(map(int, input().split()))
    a.append(l[0])
    b.append(l[1])
c = 0
for i in range(n-1, -1, -1):
    if (a[i]+c) % b[i] != 0:
        c += (b[i] - (a[i]+c) % b[i])
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
b = []
for j in range(n):
    l = list(map(int, input().split()))
    a.append(l[0])
    b.append(l[1])
 c = 0
for i in range(n-1, -1, -1):
    if (a[i]+c) % b[i] != 0:
        c += (b[i] - (a[i]+c) % b[i])
print(c)
Problem p02627 (python)

Fixed submission:
chr  = input();
ans = 'A' if ord(chr) >=65 and ord(chr) <= 90 else 'a'
print(ans)

Buggy submission (verdict: Runtime Error):
chr = input()

print ord(chr)
Problem p02859 (python)

Fixed submission:
import sys

r = input()
print(int(r) * int(r))

Buggy submission (verdict: Runtime Error):
import sys

r = input()
print(r * r)

Buggy submission (verdict: Runtime Error):
import sys

r = input()
print (r * r)

Buggy submission (verdict: Runtime Error):
import sys

radius = input()
print (radius * radius)

Buggy submission (verdict: Runtime Error):
import sys

radius = sys.argv[0]
print (radius * radius)
Problem p02689 (python)

Fixed submission:
N, M = map( int, input().split() )
H = list(map(int, input().split()) )
flg = [1] * N
for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] > H[B]:
        flg[B] = 0
    elif H[A] < H[B]:
        flg[A] = 0
    elif H[A] == H[B]:
        flg[A] = 0
        flg[B] = 0
print(sum(flg))

Buggy submission (verdict: Runtime Error):
## C
N, M = map( int, input().split() )
H = [0] + list(map(int, input().split()) )
X = [[] for x in range(N+1)]
for i in range(M):
    A, B = map(int, input().split())
    X[A].append(H[B])
    X[B].append(H[A])
rt = 0
for i in range(1, N+1):
    if H[i] > max(X[i]):
        rt += 1
print(rt)

Buggy submission (verdict: Runtime Error):
## C
N, M = map( int, input().split() )
H = list(map(int, input().split()) )
AB = [list( map( int,input().split() ) ) for x in range(M)]
comp = [[0 for j in range(1)] for i in range(N)]
for i in range(M):
    comp[AB[i][0]-1].append(AB[i][1])
val = 0
for i in range(M):
    if len(set(comp[i])) > 1:
        val += 1
print(val + N - len(set(sum(AB, []) ) ) )
Problem p02689 (python)

Fixed submission:
N,M=map(int,input().split())
listH=list(map(int,input().split()))
listN=[0]*N
for i in range(M):
  A,B=map(int,input().split())
  if listH[A-1]>listH[B-1]:
    listN[B-1]=-1
  if listH[A-1]<listH[B-1]:
    listN[A-1]=-1
  if listH[A-1]==listH[B-1]:
    listN[A-1]=-1
    listN[B-1]=-1   
ans=0    
for i in listN:
  if i>=0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
listH=list(map(int,input().split()))
listN=np.zeros((N,N))
for i in range(M):
  A,B=map(int,input().split())
  if listH[A-1]>listH[B-1]:
    listN[A-1][B-1]=A
    listN[B-1][A-1]=A
  if listH[A-1]<listH[B-1]:
    listN[A-1][B-1]=B
    listN[B-1][A-1]=B
  else:
    listN[A-1][B-1]=-1
    listN[B-1][A-1]=-1
ans=0
for i in range(N):
  if len(set(listN[i]))==2 and (i+1 in set(listN[i])):
    ans+=1
  if len(set(listN[i]))==1:
    ans+=1
print(ans)
Problem p02695 (python)

Fixed submission:
import itertools
N,M,Q=map(int,input().split())
listA=itertools.combinations_with_replacement(range(1,M+1),N)
ans=0
listQ=[]
for q in range(Q):
  listQ+=[list(map(int,input().split()))]
for i in listA:
  anssub=0
  for a,b,c,d in listQ:
    if i[b-1]-i[a-1]==c:
      anssub+=d
  ans=max(ans,anssub)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
N,M,Q=map(int,input().split())
ABC=[]
ans=0
take=set([])
for i in range(Q):
  ABC+=[list(map(int,input().split()))]
ABC.sort(key=lambda x: x[3],reverse=True)
for i in range(N):
  if len(take)==N:
    print(ans)
    sys.exit
  ans+=ABC[i][3]
  take.add(ABC[i][0])
  take.add(ABC[i][1])
  take=set(take)
Problem p02773 (python)

Fixed submission:
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    counter+=[count]
    count=1
    
counter+=[count]    
MAX=max(counter)
count=1

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    count=1
  if count==MAX:
    print(listS[i])
    
if MAX==1:
  print(listS[-1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS=Counter(listS).most_common()
ans=[]
MAX=listS[0][1]
for i in range(N):
  if listS[i][1]==MAX:
    ans+=[listS[i][0]]
  else:
    break   
ans.sort()
for i in ans:
  print(i)

Buggy submission (verdict: Runtime Error):
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    counter+=[count]
    count=1
    
MAX=max(counter)

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
    if count==MAX:
      print(listS[i+1])
  else:
    counter+=[count]
    count=1