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

Fixed submission:
K=int(input())
A,B=map(int,input().split())
if (A-1)//K == B//K:
  print('NG')
else:
  print('OK')

Buggy submission (verdict: Runtime Error):
K=int(input())
A,B=map(int,input())
if (A-1)/K == B/K:
  print('NG')
else:
  print('OK')
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split())
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
S,W=map(int,intput().split())
if S<=W:
  print("unsafe")
else:
  print("safe")
Problem p02790 (python)

Fixed submission:
A,B=map(int,input().split())
if B < A:
  A,B=B,A
for i in range(B):
 print(A, end="")
print()

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if B < A:
  A,B=B,A
for i in range B;
 print(A, end="")
print()
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
for i in range(3):
  if i+1 !=A and i+1 != B:
    print(i+1)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
for i in raneg(3):
  if i+1 !=A && i+1 != B:
    print(i+1)
Problem p02688 (python)

Fixed submission:
N,K=map(int,input().split())
cnt=[0]*N
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for a in A:
        cnt[a-1]=cnt[a-1]+1
ans=0
for i in range(N):
    if cnt[i]==0:
        ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
cnt=[0]*N
for i in range(K):
    d=int(input())
    A=list(map(int(),input().split()))
    for a in A:
        cnt[a-1]=cnt[a-1]+1
ans=0
for i in range(N):
    if cnt[i]==0:
        ans=ans+1
print(ans)
Problem p02676 (python)

Fixed submission:
N = int(input())
M = str(input())

if len(M)>N:
    print(M[0:N]+'...')
else:
    print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
M = str(input())

if len(N)>7:
    print(M[0:7]+'...')
else:
    print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
M = str(input())

if len(N)>7:
    print(M[0:7]+'...')
Problem p02689 (python)

Fixed submission:
#c 
N, M = map(int, input().split())
H = list(map(int, input().split()))
A = [0] * M
B = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())
a=[1]*N
for x in range(M):
    if H[A[x]-1]>H[B[x]-1]:
        a[A[x]-1]*=1
        a[B[x]-1]*=0
    elif H[A[x]-1]==H[B[x]-1]:
        a[A[x]-1]*=0
        a[B[x]-1]*=0
    else:
        a[A[x]-1]*=0
        a[B[x]-1]*=1
sum=0
for y in a:
    sum+=y
print(sum)

Buggy submission (verdict: Runtime Error):
#c 
N, M = map(int, input().split())
H = list(map(int, input().split()))
A = [0] * M
B = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())
a=[1]*N
for x in range(M):
    if H[A[x]-1]>H[B[x]-1]:
        a[A[x]-1]*=1
        a[B[x]-1]*=0
    elifH[A[x]-1]==H[B[x]-1]:
        a[A[x]-1]*=0
        a[B[x]-1]*=0
    else:
        a[A[x]-1]*=0
        a[B[x]-1]*=1
sum=0
for y in a:
    sum+=y
print(sum)
Problem p02729 (python)

Fixed submission:
N,M=map(int,input().split())
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

a = cmb(N+M,2)-N*M
print(a)

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

from scipy.special import comb
# a = comb(n, r)
a = comb(N+M, 2, exact=True)-N*M
print(a)

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

from scipy.special import comb
# a = comb(n, r)
a = comb(N+M, 2, exact=True)
print(a-N*M)
Problem p02759 (python)

Fixed submission:
import math
N = input()
n = int(N)
print(math.ceil(n/2))

Buggy submission (verdict: Runtime Error):
A1_1,A1_2,A1_3 = map(int, input().split())
A2_1,A2_2,A2_3 = map(int, input().split())
A3_1,A3_2,A3_3 = map(int, input().split())
N =int(input())
B = []
for _ in range(N+3):
    B.append(input())

a=str('yes')
b=str('no')
if A1_1 in B and A1_2 in B and A1_3 in B:
     print(a)
elif A2_1 in B and A2_2 in B and A2_3 in B:
    print(a)
elif A3_1 in B and A3_2 in B and A3_3 in B:
     print(a)
elif A1_1 in B and A2_1 in B and A3_1 in B:
    print(a)
elif A1_2 in B and A2_2 in B and A3_2 in B:
    print(a)
elif A1_3 in B and A2_3 in B and A3_3 in B:
    print(a)
elif A1_1 in B and A2_2 in B and A3_3 in B:
     print(a)
elif A1_3 in B and A2_2 in B and A3_1 in B:
    print(a)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
import math
def myfunc(N):
    math.floor(N/2)
    
myfunc(N)
Problem p02793 (python)

Fixed submission:
P=1000000007
def power(x,p):
  if(p==0):
    return 1;
  if(p%2):
    return power(x,p-1)*x%P;
  a=power(x,p//2);
  return a*a%P;
def inv(x):
  return power(x,P-2);
N=int(input());A=list(map(int,input().split()));
#N=10000;A=[1000000 for i in range(N)];
L=[0 for i in range(max(A)+1)]
for a in A:
  t=a;i=2;
  while(i**2<=a):
    c=0;
    while(t%i==0):
      t//=i;c+=1;
    L[i]=max(L[i],c)
    i+=1;
  if(t!=1):
    L[t]=max(L[t],1)
    
l=1;
for i in range(2,len(L)):
  l=l*power(i,L[i])%P;
b=0;
for a in A:
  b=(b+inv(a))%P
print(l*b%P)

Buggy submission (verdict: Runtime Error):
P=1000000007
def power(x,p):
  if(p==0):
    return 1;
  if(p%2):
    return power(x,p-1)*x%P;
  a=power(x,p//2);
  return a*a%P;
def inv(x):
  return power(x,P-2);
N=int(input());A=list(map(int,input().split()));
#N=10000;A=[1000000 for i in range(N)];
L=[0 for i in range(max(A)+1)]
for a in A:
  t=a;i=2;
  while(i**2<=a):
    c=0;
    while(t%i==0):
      t/=i;c+=1;
    L[i]=max(L[i],c)
    i+=1;
  if(t!=1):
    L[t]=max(L[t],1)
    
l=1;
for i in range(2,len(L)):
  l=l*power(i,L[i])%P;
b=0;
for a in A:
  b=(b+inv(a))%P
print(l*b%P)
Problem p02897 (python)

Fixed submission:
N=int(input())
print(((N+1)//2)/N)

Buggy submission (verdict: Runtime Error):
=int(input())
print(((N+1)//2)/N)
Problem p03104 (python)

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



if(A%2==1):
	A_=A+1
else:
	A_=A
if(B%2==0):
	B_=B-1
else:
	B_=B

out=((B_-A_+1)//2)%2
#import numpy as np
if(A%2==1):
	out^=A
if(B%2==0):
	out^=B
print(out)

Buggy submission (verdict: Runtime Error):



import numpy as np
def XOR(X):
	X=np.array(X)
	out=0
	i=0
	while(max(X)>0):
		out+=(np.sum(X%2)%2)*(2**i)
		X=X//2
		i+=1

	return out



A,B=input().split(" ")
A=int(A)
B=int(B)


X=[for i in range(A,B+1)]
print(XOR(X))

Buggy submission (verdict: Runtime Error):




import numpy as np
def XOR(X):
	X=np.array(X)
	out=0
	i=0
	while(max(X)>0):
		out+=(np.sum(X%2)%2)*(2**i)
		X=X//2
		i+=1

	return out



A,B=input().split(" ")
A=int(A)
B=int(B)


X=range(A,B+1)
print(XOR(X))
Problem p03107 (python)

Fixed submission:
S=input();print(min(S.count("1"),S.count("0"))*2)

Buggy submission (verdict: Runtime Error):
S=input();print(min(S.count("1"),S.count(0))*2)
Problem p03127 (python)

Fixed submission:
def gcd(x,y):
  return y if x%y==0 else gcd(y,x%y)
N=input();A=list(map(int,input().split()));
g=A[0];
for a in A:
  g=gcd(g,a)
print(g)

Buggy submission (verdict: Runtime Error):

N=int(input())
A=input().split()
A=[int(a) for a in A]

import math
a=math.gcd(A[0],A[1])
for i in range(2,len(A)):
	a=math.gcd(a,A[i])
print(a)
Problem p02578 (python)

Fixed submission:
# input here
_INPUT = """\
5
3 3 3 3 3
"""

def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    Springboard = []
    max = A[0]
    for i in range(1,len(A)):
    # 自分より前に自分より身長が高い人がいないとき
        if max < A[i]:
            max = A[i]
            Springboard.append(0)
     # 自分より前に自分より身長が高い人がいるとき
        else:
            Springboard.append(max - A[i])

    print(sum(Springboard))

if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools

    # sys.stdin = io.StringIO(_INPUT)
    main()

Buggy submission (verdict: Runtime Error):
import io
import sys
import math
import itertools
N = int(input())
A = list(map(int, input().split()))

Springboard = []
for i in range(1,len(A)):
  # 自分より前に自分より身長が高い人がいないとき
  if max(A[:i+1]) == A[i]:
    Springboard.append(0)
    # 自分より前に自分より身長が高い人がいるとき
    else:
      Springboard.append(max(A[:i]) - A[i])

print(sum(Springboard))
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])

Buggy submission (verdict: Runtime Error):
    N, M = map(int, input().split())
    a = [int(input()) for i in range(M)]
    inf = 10**9+7

    #動的計画法問題
    dp = [0] * (N+1)
    dp[0] = 1
    if 1 not in a:
        dp[1] = 1
    else:
        dp[1] = 0

    for i in range(2,N+1):
        if i in a:
            continue
        dp[i] = dp[i-1] + dp[i-2]
        
        dp[i] %= inf

    print(dp[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
inf = 10**9+7

#動的計画法問題
dp = [0] * (N+1)
dp[0] = 1
if 1 not in a:
  dp[1] = 1
else:
  dp[1] = 0

    for i in range(2,N+1):
      if i in a:
        continue
      dp[i] = dp[i-1] + dp[i-2]
      dp[i] %= inf

print(dp[N])

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

#動的計画法問題
dp = [0] * (N+1)
dp[0] = 1
if 1 not in a:
  dp[1] = 1
  else:
    dp[1] = 0

    for i in range(2,N+1):
      if i in a:
        continue
        dp[i] = dp[i-1] + dp[i-2]

        dp[i] %= (10**9+7)

print(dp[N])
Problem p02679 (python)

Fixed submission:
from collections import defaultdict

mod=1000000007
def mpow2(n):
    ret=1
    while n>0:
        ret*=2
        ret%=mod
        n-=1
    return ret

def gcd(a,b):
    if a<0:
        a*=-1
    if b<0:
        b*=-1
    if a<b:
        a,b=b,a
    if a%b:
        return gcd(b,a%b)
    return b

shift=2**64
d=defaultdict(int)
n=int(input())
l=[]
cnt0=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b==0:
        cnt0+=1
        continue
    elif a==0:
        b=1
    elif b==0:
        a=1
    else:
        g=gcd(a,b)
        a//=g
        b//=g
    l.append((a,b))
    d[a*shift+b]+=1
res=1
for p in l:
    a=p[0]
    b=p[1]
    c=d[a*shift+b]+d[-a*shift-b]
    if c==0:
        continue
    d[a*shift+b]=0
    d[-a*shift-b]=0
    a=-p[1]
    b=p[0]
    cc=d[a*shift+b]+d[-a*shift-b]
    d[a*shift+b]=0
    d[-a*shift-b]=0
    if cc==0:
        res*=mpow2(c)
        res%=mod
    else:
        res*=mpow2(c)+mpow2(cc)-1
        res%=mod
print((res+cnt0+mod-1)%mod)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

mod=1000000007
def mpow2(n):
    ret=1
    while n>0:
        ret*=2
        ret%=mod
        n-=1
    return ret

def gcd(a,b):
    if a<0:
        a*=-1
    if b<0:
        b*=-1
    if a<b:
        a,b=b,a
    if a%b:
        return gcd(b,a%b)
    return b

shift=2**64
d=defaultdict(int)
n=int(input())
l=[]
cnt0=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b==0:
        cnt0+=1
        continue
    g=gcd(a,b)
    a//=g
    b//=g
    l.append((a,b))
    d[a*shift+b]+=1
res=1
for p in l:
    a=p[0]
    b=p[1]
    c=d[a*shift+b]+d[-a*shift-b]
    if c==0:
        continue
    d[a*shift+b]=0
    d[-a*shift-b]=0
    a=-p[1]
    b=p[0]
    cc=d[a*shift+b]+d[-a*shift-b]
    d[a*shift+b]=0
    d[-a*shift-b]=0
    if cc==0:
        res*=mpow2(c)
        res%=mod
    else:
        res*=mpow2(c)+mpow2(cc)-1
        res%=mod
print((res+cnt0+mod-1)%mod)
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c>=22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b+c=>22:
  print("bust")
else:
  print("win")
Problem p02847 (python)

Fixed submission:
l={"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(l[input()])

Buggy submission (verdict: Runtime Error):
l={"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(s[input()])
Problem p03127 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(input())
l=[int(i) for i in input().split()]
l.sort()
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(i,j-i)

n=int(input())
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Buggy submission (verdict: Runtime Error):
def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(i,j-i)

n=int(input())
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)
Problem p03209 (python)

Fixed submission:
def do(level,x):
    if x<=0:
        return 0
    if level==0:
        return 1
    res=0
    x-=1
    if x>j[level-1]:
        x-=j[level-1]+1
        res+=k[level-1]+1
    return res+do(level-1,x)

n,x=map(int,input().split())
j=[1]+[0]*50
k=[1]+[0]*50
for i in range(1,n+1):
    j[i]=j[i-1]*2+3
    k[i]=k[i-1]*2+1
res=0
print(do(n,x))

Buggy submission (verdict: Runtime Error):
def do(level,x):
    if x<=0: #1層も手を付けないとき
        return 0
    elif x>=whole[level]: #完食できるとき
        return patty[level]
    #それ以外、途中まで食べるときはlevel>=1の場合のみあり得る
    x-=1 #このとき1層目は必ずバンズ
    res=0 ＃食べたパティの総数を記録する
    if x>=whole[level-1]+1: #真ん中のパティまで到達できるとき
        x-=whole[level-1]+1
        res+=patty[level-1]+1
    return res+do(level-1,x)

n,x=map(int,input().split())
whole=[1]+[0]*50
patty=[1]+[0]*50
for i in range(1,n+1):
    whole[i]=whole[i-1]*2+3
    patty[i]=patty[i-1]*2+1
res=0
print(do(n,x))
Problem p03221 (python)

Fixed submission:
s=input().split()
n=int(s[0])
m=int(s[1])
l=[[] for i in range(100000)]
d=[{} for i in range(100000)]
inp=[]
for i in range(m):
    s=input().split()
    p=int(s[0])
    y=int(s[1])
    inp.append((p,y))
    l[p-1].append(y)
for i in range(100000):
    l[i].sort()
for i in range(100000):
    cnt=1
    for j in l[i]:
        d[i][j]=cnt
        cnt+=1
for pa in inp:
    L=pa[0]
    R=d[L-1][pa[1]]
    L=str(L)
    R=str(R)
    for i in range(6-len(L)):
        print("0",end="")
    print(L,end="")
    for i in range(6-len(R)):
        print("0",end="")
    print(R)

Buggy submission (verdict: Runtime Error):
import bisect
n,m = map(int,input().split())

l1 = [[] for i in range(n)]
l2 = []

for i in range(m):
    p,y = map(int,input().split())
    l1[p-1].append(y)
    l2.append((p,y))

for p in range(n):
    l1[p].sort()

for i in range(m):
    p = l2[i][0]
    k = bisect.right(l1[p-1],l2[i][1])
    p = str(p)
    k = str(k)
    ans = "0"*(6-len(p))+p+"0"*(6-len(k))+k
    print(ans)

Buggy submission (verdict: Runtime Error):
s=input().split()
n,m=int(s[0]),int(s[1])
l=[[] for i in range(100001)]
d=[{} for i in range(100001)]
inp=[]
for i in range(m):
    s=input().split()
    p,y=int(s[0]),int(s[1])
    inp.append((p,y))
    l[p].append(y)
for i in range(100001):
    l[i].sort()
for i in range(100001):
    cnt=1
    for j in l[i]:
        d[i][j]=cnt
        cnt+=1
for pa in inp:
    print(str(pa[0]).zfill(6)+str(d[pa[0]-1][pa[1]]).zfill(6))
Problem p03265 (python)

Fixed submission:
import numpy as np
s=input().split()
l=[int(s[i]) for i in range(4)]
v1=np.array([l[0],l[1]])
v2=np.array([l[2],l[3]])
v=v2-v1
A=np.array([[0,-1],[1,0]])
v3=v2+np.dot(A,v)
v=v3-v2
v4=v3+np.dot(A,v)
print(v3[0],v3[1],v4[0],v4[1])

Buggy submission (verdict: Runtime Error):
import numpy as np
s=input().split()
l=[int(s[i]) for i in range(4)]
v1=np.array([l[0],l[1]])
v2=np.array([l[2],l[3]])
v=v2-v1
A=np.array([[0,-1],[1,0]])
v3=v2+np.dot(A,v)
v=v3-v2
v4=v3+np.dot(A,v)
print(v3[0],v3[1],v4[0],v4[1])
Problem p03286 (python)

Fixed submission:
def f(n):
    s=""
    while n>0:
        s=str(n%2)+s
        n//=2
        if n==0:
            break
        if n%2==1:
            n+=2
            s="1"+s
        else:
            s="0"+s
        n//=2
    return s

n=int(input())
if n==0:
    print(0)
elif n<0:
    print(f(n*(-2))[:-1])
else:
    print(f(n))

Buggy submission (verdict: Runtime Error):
import bisect
def put(a,b):
    l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+b
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break

Buggy submission (verdict: Runtime Error):
import bisect
def put(a,b):
    l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+a
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break

Buggy submission (verdict: Runtime Error):
import bisect
def put(a,b):
 	l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+a
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break
Problem p03345 (python)

Fixed submission:
s=input().split()
print((int(s[0])-int(s[1]))*(-1)**int(s[3]))

Buggy submission (verdict: Runtime Error):
s=input().split()
print((int(s[0])-int(s[1]))*(-1)**s[3])
Problem p04021 (python)

Fixed submission:
import bisect
n=int(input())
l=[]
e=[]
for i in range(n//2):
    j=int(input())
    e.append(j)
    l.append(j)
    j=int(input())
    l.append(j)
if n%2==1:
    j=int(input())
    e.append(j)
    l.append(j)
l.sort()
e.sort()
res=0
for i in range(0,n,2):
    if e[min(len(e)-1,bisect.bisect_left(e,l[i]))]!=l[i]:
        res+=1
print(res)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
l=[]
e=[]
for i in range(n//2):
    j=int(input())
    e.append(j)
    l.append(j)
    j=int(input())
    l.append(j)
if n%2==1:
    j=int(input())
    e.append(j)
    l.append(j)
l.sort()
e.sort()
res=0
for i in range(0,n,2):
    if e[bisect.bisect_left(e,l[i])]!=l[i]:
        res+=1
print(res)
Problem p03835 (python)

Fixed submission:
def f(K, S):
    #ここに処理を書いてください
    res = 0
    for i in range(K+1):
      for j in range(K+1):
        if i + j <= S and S-i-j <= K:
          res += 1
    return res

inx = list(map(int, input().split()))
print(f(inx[0], inx[1]))

Buggy submission (verdict: Runtime Error):
def f(K, S):
    #ここに処理を書いてください
    res = 0
    for i in range(K+1):
      for j in range(K+1):
        if i + j <= S and S-i-j <= K:
          res += 1
    return res

in = list(map(int, input().split()))
print(f(in[0], in[1]))
Problem p03073 (python)

Fixed submission:
a=raw_input()
x=sum([a[i]=="01"[i%2] for i in range(len(a))])
ans=min([x,len(a)-x])
print ans

Buggy submission (verdict: Runtime Error):

a=raw_input()
x=sum([a[i]=="01"[i%2] for i in range(len(a))])
ans=min([x,n-x])
print ans

Buggy submission (verdict: Runtime Error):
n=int(raw_input())
a=raw_input()
x=sum([a[i]=="01"[i%2] for i in range(n)])
ans=min([x,n-x])
print ans
Problem p03835 (python)

Fixed submission:
k,s=map(int,raw_input().split())
ans=0
for i in range(k+1):
 for j in range(k+1):
  if 0 <= s-i-j<=k:ans+=1
print ans

Buggy submission (verdict: Runtime Error):
k,s=map(int,raw_input())
ans=0
for i in range(k+1):
  for j in range(k+1):
    if 0 <= s-i-j<=k:ans+=1
print ans

Buggy submission (verdict: Runtime Error):
k,s=map(int,raw_input())
ans=0
for i in range(k+1):
 for j in range(k+1):
  if 0 <= s-i-j<=k:ans+=1
print ans
Problem p02546 (python)

Fixed submission:
S = input()
if S[-1] == "s":
	print(S + "es")
else:
  	print(S + "s")

Buggy submission (verdict: Runtime Error):
S = input()
if S[-1] == "s":
  print(S + "es")
  else:
    print(S + "s")

Buggy submission (verdict: Runtime Error):
s = input()
if s[-1] != "s":
  print(s+'s')
elif s[-1] == 's'
  print(s[:-1]+'es')

Buggy submission (verdict: Runtime Error):
s = input()
if s[-1] != "s":
  print(s+'s')
elif s[-1] == 's' and s[-2] != 'e':
  print(s[:-1]+'es')
else:
    print(s)
Problem p02711 (python)

Fixed submission:
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    a = list(input())
    print("Yes" if "7" in a else "No")


main()

Buggy submission (verdict: Runtime Error):
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)

def main():
    A = LI()
    print(A.index(0)+1)

main()

Buggy submission (verdict: Runtime Error):
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    a = list(input())
    print("No" if a.index("7") == -1 else "Yes")


main()
Problem p02578 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=[0 for _ in range(10001)]
C=A
for i in range(1,N):
    M=max(C[:i])
    if M>A[i]:
        B[i]=M-A[i]
        C[i]=M
print(sum(B))