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

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 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()

Buggy 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()
Problem p03288 (python)

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 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()
Problem p03316 (python)

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 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()

Buggy 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()
Problem p03328 (python)

Fixed submission:
def main2():
    strbuf = input("");
    strbufs = strbuf.split();
    buf = [];
    for i in range(2):
        buf.append(int(strbufs[i]));
    sa = buf[1] - buf[0];
    takasa = sa * (sa + 1) / 2;
    result = takasa - buf[1];
    print(int(result));


if __name__ == '__main__':
    main2()

Buggy submission (verdict: Runtime Error):
def main2():
    strbuf = input("");
    strbufs = strbuf.split();
    buf = [];
    for i in range(2):
        buf.append(int(strbufs[i]));
    sa = strbufs[1] - strbufs[0];
    takasa = sa * (sa + 1) / 2;
    result = takasa - strbufs[1];
    print(result);


if __name__ == '__main__':
    main2()
Problem p03698 (python)

Fixed submission:
def main11():
    str = input("");
    flag = True;
    for i in range((len(str)-1)):
        for j in range(i+1,len(str)):
            if(str[i]==str[j]):
                flag = False;
    if flag:
        print("yes");
    else:
        print("no");



if __name__ == '__main__':
    main11()

Buggy submission (verdict: Runtime Error):
def main11():
    str = input("");
    flag = True;
    for i in range((len(str)-1)):
        for j in range(i+1,len(str)):
            if(str[i]==str[j]):
                flag = False;
    if flag:
        print(yes);
    else:
        print(no);



if __name__ == '__main__':
    main11()
Problem p03807 (python)

Fixed submission:
def main10():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    if len(buf2) == 1:
        return("YES");
    else:
        ki = 0;
        for i in range(buf):
            if buf2[i] % 2 == 1:
                ki += 1;
        if ki % 2 == 0:
            print("YES");
        else:
            print("NO");



if __name__ == '__main__':
    main10()

Buggy submission (verdict: Runtime Error):
def main10():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    if len(buf2) == 1:
        return("YES");
    else:
        ki = 0;
        for i in range(buf):
            if buf2 % 2 == 1:
                ki += 1;
        if ki % 2 == 0:
            print("YES");
        else:
            print("NO");



if __name__ == '__main__':
    main10()
Problem p02812 (python)

Fixed submission:
import re

input()
print(len(re.findall('ABC', input())))

Buggy submission (verdict: Runtime Error):
import re

input()
print(len(re.findall('ABC', input()))

Buggy submission (verdict: Runtime Error):
import re

input()
print(len(re.findall(input(), 'ABC'))
Problem p02818 (python)

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

n = min(a,k)
a -= n
k -= n
print(a, max(b - k, 0))

Buggy submission (verdict: Runtime Error):
a, b, k = list(map(int, input().split()))
if k > a:
  m = k - a
  if m < 0:
    b = 0
  else:
	b -= m
  a = 0
else:
  a = a - k
print(a, b)
Problem p02981 (python)

Fixed submission:
n, a, b = map(int, input().split())
print(min(n*a, b))

Buggy submission (verdict: Runtime Error):
n, a, b = map(input().split())
print(min(n*a, b))
Problem p03302 (python)

Fixed submission:
a, b = map(int, input().split())
print('+' if a + b ==15 else '*' if a * b == 15 else 'x')

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools
n,m,d = map(int, input().split())

n = [x for x in range(1, n+1)]
x = np.array(list(itertools.product(n, repeat=m)))
print(np.sum((x[:,1:] - x[:,:-1]) == d) / x.shape[0])

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools
n,m,d = map(int, input().split())

n = np.arange(1, n+1)
x = np.array(list(itertools.product(n, repeat=m)))
print(np.sum((x[:,1:] - x[:,:-1]) == d) / x.shape[0])
Problem p03308 (python)

Fixed submission:
input()
x = list(map(int, input().split()))
print(max(x) - min(x))

Buggy submission (verdict: Runtime Error):
import math
input()
x = list(map(int, input().split()))
print(math.max(x) - math.min(x))
Problem p03351 (python)

Fixed submission:
import math


a,b,c,d = map(int, input().split(' '))
if math.fabs(a - c) <= d:
  print('Yes')
elif math.fabs(a-b) <= d and math.fabs(b-c) <= d:
  print('Yes')
else:
  print('No')

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

x = int(input())
x_sqrt = math.sqrt(x)
maxlist = []

def hoge(x, x_sqrt):
    for b in range(2, x_sqrt+1):
        i = 1
        while b ** i <= x:
            i += 1
        maxlist.append(b **(i-1))
    return np.max(np.array(maxlist))

if x - x_sqrt == 0:
    print(x)
else:
    print(hoge(x, int(x_sqrt)))
Problem p03359 (python)

Fixed submission:
import datetime
a, b = map(int, input().split(' '))
start = datetime.date(2018, 1, 1).toordinal()
end = datetime.date(2018, a, b).toordinal()

def checker(num):
    check_day = datetime.date(2018, num, num).toordinal()
    if start <= check_day <= end:
        return True
    else:
        return False

print(list(map(checker, [i for i in range (1, 13)])).count(True))

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


def check1(b: list):
    """
    FalseならOK
    Args:
        b:

    Returns:

    """
    for idx, num in enumerate(b[:-1]):
        return num in b[idx + 1:]


def check2(b: list):
    """
    FalseならOK
    Args:
        b:

    Returns:

    """
    return True in [is_prime(int(np.sum(np.array(i)))) for i in itertools.combinations(b, 5)]



def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False
    return pow(2, q - 1, q) == 1


if __name__ == '__main__':

    num_list = []
    size = int(input())
    while len(num_list) != size:
        x = np.random.randint(1000)
        if is_prime(x):
            num_list.append(x)
            if len(num_list) >= 2:
                if not check1(num_list):
                    if len(num_list) >= 5:
                        if not check2(num_list):
                            continue
                        else:
                            del num_list[len(num_list) - 1]
                else:
                    del num_list[len(num_list) - 1]

    print(' '.join(map(str, num_list)))
Problem p03360 (python)

Fixed submission:
import numpy as np

x, y, z = map(int, input().split(' '))
row = np.array([x, y, z])

for times in range(int(input())):
    row[row.argmax()] = row.max() * 2
    
print(np.sum(row))

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

x, y, z = map(int, input().split(' '))
row = np.array([x,y,z])

for times in range(int(input()):
    row[row.argmax()] = row.max() * 2
print(np.sum(row))
Problem p03195 (python)

Fixed submission:
N = int(raw_input())
a = []
for i in range(N):
   a.append(int(raw_input()))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')

Buggy submission (verdict: Runtime Error):
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')
Problem p03085 (python)

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
b = int(input())
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")
Problem p03086 (python)

Fixed submission:
L = ["A","T","C","G"]
S = input()
S += "B"
count = 0
maxcount = 0
for i in S:
  if i in L:
    count += 1
  else:
    maxcount = max(count,maxcount)
    count = 0
print(maxcount)

Buggy submission (verdict: Runtime Error):
S = input()
agct = ['A','G','C','T']
count = 0
max_count = 0
for i in len(S):
  if S[i] in agct:
    count += 1
  else:
    max_count = max(count,max_count)
print(max_count)
Problem p03101 (python)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input.split())
h, w = map(int, input.split())
print((H-h)*(W-w))
Problem p03323 (python)

Fixed submission:
A, B = map(int, input().split())
max = 8
if A <= max and B <= max:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
max = 8
if A <= max && B <= max:
  print("Yay!")
else:
  print(":(")
Problem p03415 (python)

Fixed submission:
a = input()
b = input()
c = input()

print(a[0]+b[1]+c[2])

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
count = 0
for i in range(a, b+1):
    s = str(i)
    if(s[0]==s[-1] and s[1]==s[-2]):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
count = 0
for i in range(A, B+1):
  s = str(i)
  if s[0] == s[-1] and s[1] == i[-2]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
count = 0
for i in range(A, B+1):
  s = str(i)
  if s[0] == s[4] and s[1] == i[3]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
count = 0
for i in range(A, B+1):
  i = str(i)
  if i[0] == i[4] and i[1] == i[3]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
count = 0
for i in range(A, B+1):
  i = str(i)
  if i == i[::-1]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a,b,c = map(str, input().split())
d,e,f = map(str, input().split())
g,h,q = map(str, input().split())

print(a+e+q)
Problem p03447 (python)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())

print((X-A) % B)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
counter = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if(500*a + 100*b + 50*c == X):
                counter += 1
print(counter)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
count = 0
for a in range(A+1):
	for b in range(B+1):
        for c in range(C+1):
            if(500*a + 100*b + 50*c == X):
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input()) #¥500
B = int(input()) #¥100
C = int(input()) #¥50
X = int(input())
count = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if a*500 + b*100 + c*50 == X:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input()) #¥500
B = int(input()) #¥100
C = int(input()) #¥50
X = int(input())

count = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if X == (a*500 + b*100 + c*50):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input()) #¥500
B = int(input()) #¥100
C = int(input()) #¥50
X = int(input())
count = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if (X == a*500 + b*100 + c*50):
        count += 1
print(count)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split(" "))
c=a*b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c=a*b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
c=a*b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
c=a*b
if c % 2 == 0:
  print("Odd")
else:
  print("Even")
Problem p02801 (python)

Fixed submission:
moji = input()
moji = ord(moji)+1
print(chr(moji))

Buggy submission (verdict: Runtime Error):
alphabet = input()
alphabet = ord(alphabet)+1
print(chr(alphabet)
Problem p02848 (python)

Fixed submission:
n = int(input())
s = input()
alphaList  =   ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
moji = ""
for str in s:
    index = alphaList.index(str)
    addNum = index + n
    if addNum >25:
        addNum = addNum - 26 
    moji = moji + alphaList[addNum]
print(moji)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
alphaList  =   ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
moji = ""
for str in s:
    index = alphaList.index(str)
    addNum = 0
    if index == 24:
        addNum = 0
    elif index ==  25:
        addNum = 1
    else:
        addNum = index + n 
    moji = moji + alphaList[addNum]
print(moji)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
alphaList  =   ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
moji = ""
for str in s:
    index = alphaList.index(str)
    addNum = 0
    if index == 24:
        addNum = 0
    elif index ==  25:
        addNum = 1
    else:
        addNum = index + n 
        print(addNum)
    moji = moji + str.replace(str, alphaList[addNum])
print(moji)
Problem p03071 (python)

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

sum=0
for i in range(2):
    if A >= B:
        sum+=A
        A-=1
    else:
        sum+=B
        B-=1
print(sum)

Buggy submission (verdict: Runtime Error):
def calc(x):
    global mount
    global list
    count=0
    for y in range(1,x+1):
        if mount[x] >= mount[x-y]:
            count+=1
    if x == count:
        list.append(x)

N=int(input())

mount=input().split()

list=[]

for z in range(1,len(mount)):
    calc(z)

print(1+len(list))
Problem p03086 (python)

Fixed submission:
def check(s,i):
   global count
   count+=1
   if i+1 < len(s):
       if s[i+1] == 'A' or s[i+1] == 'C' or s[i+1] =='G' or s[i+1] =='T':
           check(s,i+1) 

s=input()
count=0
list=[]
for i in range(len(s)):
    count=0
    if s[i] == 'A' or s[i] == 'C' or s[i] =='G' or s[i] =='T':
        check(s,i)
    list.append(count)

print(max(list))

Buggy submission (verdict: Runtime Error):
S = input()
2 N = len(S)
3 ans = 0
4 for i in range(N):
5 for j in range(i, N):
6 if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
7 ans = max(ans, j - i + 1)
8 print(ans)
Problem p02801 (python)

Fixed submission:
c = input()
ans = ord(c)+1
print(chr(ans))

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

c = input()
ans = ord(c)+1
print(chr(ans))

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

c = input()
print(chr(ord(c)+1))

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

c = input()
print(chr(ord(c)+1))

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

c = input()
print(chr(ord(c)+1))

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

c = input()
print(chr(ord(c)+1))
Problem p03759 (python)

Fixed submission:

a,b,c=input().split()
if (int(b)-int(a))==(int(c)-int(b)):
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input(),split()
if (int(b)-int(a))==(int(c)-int(b)):
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if (int(b)-int(a)==(int(c)-int(b):
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=split(input())
if (int(b)-int(a)==(int(c)-int(b):
	print("YES")
else:
	print("NO")
Problem p02811 (python)

Fixed submission:
k, x = map(int, input().split()) # 500円玉の枚数

if (k*500 >= x):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
k = int(input()) # 500円玉の枚数
x = int(input()) # 総額

if (k*500 >= x):
    print('Yes')
else:
    print('No')
Problem p02909 (python)

Fixed submission:
s = input()

if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

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

if s = "Sunny":
  print("Cloudy")
elif s = "Cloudy":
  print("Rainy")
else:
  print("Sunny")
Problem p03035 (python)

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

if A >= 13:
  print(B)
elif 12 >= A >= 6:
  print(int(B/2))
elif 5 >= A >= 0:
  print(0)

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

if A => 13:
  print(B)
elif A => 6:
  print(B/2)
else:
  print(0)
Problem p03503 (python)

Fixed submission:
N = int(input())
F = []
P = []
Pre = []
for i in range(N):
  F.append(list(map(int, input().split())))
for i in range(N):
  P.append(list(map(int, input().split())))

for loop in range(1,1024):
  rieki = 0
  f = str(format(loop,"b")).rjust(10,"0") #自店の開店時間帯
  for i in range(N): # 全店舗に対し利益計算
    Fnum = 0
    for j in range(10): # 店舗iと同時に営業する時間帯の数
      Fnum = Fnum + F[i][j] * int(f[j])
    #print("loop:{},i:{},j:{}".format(loop,i,j))
    rieki = rieki + P[i][Fnum] # P行列参照
  Pre.append(rieki) 
print(max(Pre))

Buggy submission (verdict: Runtime Error):
N = int(input())
F = []
P = []
Pre = []
for i in range(N):
  F.append(list(map(int, input().split())))
for i in range(N):
  P.append(list(map(int, input().split())))

for loop in range(1,1024):
  rieki = 0
  Fnum = 0
  f = str(format(loop,"b")).rjust(10,"0") #自店の開店時間帯
  for i in range(N): # 全店舗に対し利益計算
    for j in range(10): # 店舗iと同時に営業する時間帯の数
      Fnum = Fnum + F[i][j] * int(f[j])
    #print("時間帯:{}".format(Fnum))
    rieki = rieki + P[i][Fnum] # P行列参照
  #print("rieki is {}".format(rieki))
  Pre.append(rieki) 
print(max(Pre))
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
a = sorted(A.copy())
a1 = a[len(A)-1]
a2 = a[len(A)-2]

for i in A:
    if i == a1:
        print(a2)
    else:
        print(a1)

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

N = int(input())
A = [int(input()) for _ in range(N)]

for i in range(N):
    a = A.copy()
    del a[i]
    print(max(a))
Problem p02982 (python)

Fixed submission:
import math

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
tmp = []

for i in range(N):
    r1 = X[i]
    for j in range(N):
        t = str(i)+str(j)
        if i == j or t in tmp or str(j)+str(i) in tmp:
            continue

        r2 = X[j]
        ls = [(r1[j] - r2[j])**2 for j in range(D)]
        res = math.sqrt(sum(ls))

        if res % 1 == 0:
            count += 1
        tmp.append(t)

print(count)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
tmp = []

for i in range(N):
    r1 = X[i]
    for j in range(N):
        t = str(i)+str(j)
        if i == j or t in tmp or str(j)+str(i) in tmp:
            continue

        r2 = X[j]
        ls = [(r1[j] - r2[j])**2 for j in range(D)]
        res = math.sqrt(sum(ls))

        if res % 1 == 0:
            count += 1
        tmp.append(t)

print(count)
Problem p02995 (python)

Fixed submission:
import fractions

def f(x, c, d):
    lcm_num = c*d // fractions.gcd(c, d)
    return x - x//c - x//d + x//lcm_num

a, b, c, d = map(int, input().split())
print(int(f(b, c, d) - f(a-1, c, d)))

Buggy submission (verdict: Runtime Error):
import fractions

def f(x, c, d):
    lcm_num = c*d / fractions.gcd(c, d)
    return x - x//c - x//d + x//lcm_num

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

print(f(b) - f(a-1))

Buggy submission (verdict: Runtime Error):
import math

def f(x, c, d):
    lcm_num = c*d / math.gcd(c, d)
    return x - x//c - x//d + x//lcm_num

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

print(f(b) - f(a-1))

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
lcm_num = c*d / math.gcd(c, d)

def f(x):
    return x - x//c - x//d + x//lcm_num

print(f(b) - f(a-1))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
lcm_num = c*d / math.gcd(c, d)

def f(x):
    return x - x//c - x//d + x//lcm_num

print(f(b) - f(a-1))
Problem p03085 (python)

Fixed submission:
b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'C':
    print('G')
else:
    print('C')

Buggy submission (verdict: Runtime Error):
b = input()
if b == 'A':
    print(T)
elif b == 'T':
    print(A)
elif b == 'C':
    print(G)
else:
    print(C)