Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
def problem(firstline, thereafter):
    N, M = firstline.strip().split()
    N = int(N)
    M = int(M)
    points = []
    for i in thereafter:
        a, b = i.strip().split()
        points.append((int(b),int(a)))
    points.sort(reverse=True)
    days = {}
    for i in range(M, -1 , -1):
        days[i] = 0
    for i in points:
        if i[1] <= M:
            for j in range(M - i[1], -1, -1):
                if not days[j]:
                    days[j] = i[0]
                    break
    out = 0
    for i, values in days.items():
        out += values
    return out





def main():
    print(problem(stdin.readline(), stdin.readlines()))

main()


Fixed submission:
import heapq

def main():
    n, m = map(int, input().split())
    data = {}
    priorityQ = []
    for _ in range(n):
        a, b = map(int, input().split())
        if m + 1 - a >= 0:
            if m+1-a in data:
                data[m+1-a].append(b)
            else:
                data[m+1-a] = [b]
    ans = 0
    for i in range(m, 0, -1):
        if i in data.keys():
            for k in data[i]:
                heapq.heappush(priorityQ, -k)
        if priorityQ:
            ans -= heapq.heappop(priorityQ)
    print(ans)
    return

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a,b = map(int,input().split())
    if a-b+1>=673:
        print(0)
    else:
        mini = 2020
        for i in range(a,b+1):
            for j in range(a,i):
                joke = i*j%2019
                if joke<mini:
                    mini = joke
        print(mini)
main()

Fixed submission:
a,b=map(int,input().split())
x=0;md=0;min=4000
if a+2022<b:
    b=a+2022

for i in range(a,b,1):
    for j in range(a+1,b+1,1):
        x = i * j
        md = x % 2019
        if md < min:
            min = md


print(min)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=((a)*(a+1))%2019
print(c

Fixed submission:
a,b=map(int,input().split())
x=0;md=0;min=4000
if a+2022<b:
    b=a+2022

for i in range(a,b,1):
    for j in range(a+1,b+1,1):
        x = i * j
        md = x % 2019
        if md < min:
            min = md


print(min)
Buggy python submission (verdict: Runtime Error):
s = input()
if s[0] == s[1] and s[2] == s[3] or s[1] == s[2] and s[0] == s[3] or s[0] == s[2] and s[1] == s[3] and (a[0] != a[1] and a[1] != a[2] and a[2] != a[3]):
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
a = set()
for i in s: a.add(i)
if len(a) == 2 and s.count(s[0]) == 2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
numeros=[int (x) for x in input().split()]
qtd=[]
K=1
cont2=0
while True:
    cont=0
    cont1=0
    for num in numeros:
        if num<K:
            cont+=1
        else:
            cont1+=1
    if cont==cont1:
        cont2+=1
    K+=1
    if K>max(numeros):
        break
print(cont2)

Fixed submission:
k = int(input())
seqS=input().split(" ")
num=[]
for q in seqS:
    num.append(int(q))
contador,abc,arc=0,0,0
num.sort() #ORGANIZA
#num do meio
print(num[int(len(num)/2)]- num[int(len(num)/2)-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
numeros=[int (x) for x in input().split()]
qtd=[]
K=1
while True:
    cont=0
    cont1=0
    for num in numeros:
        if num<K:
            cont+=1
        else:
            cont1+=1
    if cont==cont1:
        qtd.append(K)
    K+=1
    if K>max(numeros):
        break

print(len(qtd))

Fixed submission:
k = int(input())
seqS=input().split(" ")
num=[]
for q in seqS:
    num.append(int(q))
contador,abc,arc=0,0,0
num.sort() #ORGANIZA
#num do meio
print(num[int(len(num)/2)]- num[int(len(num)/2)-1])
Buggy python submission (verdict: Runtime Error):
i = input().split()

n,x = list(map(int, i))

l = input().split()

l = list(map(int, l))

step = [0]

c = 0

aux = 0

while step[-1] < x:
    c += 1
    step.append(step[c - 1] + l[c - 1])

for i in step:
    if i <= x:
        aux += 1


print(aux)

Fixed submission:
n,x=input().split()
L = list(input().split())
d = 0
i = 0
while d <= int(x) and i<int(n):
    d+=int(L[i])
    i+=1
if d > int(x):
    print(i)
else:
    print(i+1)
Buggy python submission (verdict: Runtime Error):
d12=int(input())
d13=int(input())
d23=int(input())
dt1=d12+d23
dt2=d23+d13
dt3=d13+d12
if (dt1<dt2 and dt1<dt3):
    print(dt1)
elif (dt2<dt1 and dt2<dt3):
    print(dt2)
else:
    print(dt3)

Fixed submission:
# your code goes here
p,q,r = map(int,input().split())
print(min(p+q,q+r,r+p))
Buggy python submission (verdict: Runtime Error):
N,m=map(int,input().split())
s = set()
for i in range(m):
    s.add(int(input()))
memo={0:1}
mod=1000000007
def climb_stairs(n):
    if memo.__contains__(n):
        return memo[n]
    else:
        if s.__contains__(n):
            return 0
        elif n==1:
            return 1
        else:
            memo[n]=((climb_stairs(n-1)%mod + (climb_stairs(n-2) %mod)%mod
            return memo[n]
print(climb_stairs(N))

Fixed submission:
I=lambda : list(map(int,input().split()))

n,m = I();md=10**9+7;p=0;a=1
dp=[0,1];l=[0]*(10**5+2)
for _ in range(m):
    x=int(input())
    l[x]=1
for i in range(1,n+1):
    if l[i]:
        dp.append(0)
    else:
        dp.append((dp[-1]+dp[-2])%md)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if 0 <= a and  a <= 5:
    print(0)
if 6 <= a  and a <= 12:
    print(b//2)
if 13 <= a and a <= 100:
    print(b)

Fixed submission:
line = input()
numbers = [int(n) for n in line.split()]
if numbers[0] <= 5:
    predicted_value = 0
elif numbers[0] <= 12:
    predicted_value = numbers[1]//2
else:
    predicted_value = numbers[1]
print(predicted_value)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[]
te=set(range(1,n+1))
for i in range(m):
    x,y=map(int,input().split())
    tes=set(range(x,y+1))
    te=te&tes
print(len(te))

Fixed submission:
n,m=map(int,input().split())
l=1;ma=n
te=set(range(1,n+1))
for i in range(m):
    x,y=map(int,input().split())
    l=max(x,l)
    ma=min(ma,y)
print(abs(l-ma)+1 if l<=ma else 0)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect as bi

I=lambda : list(map(int,input().split()))
"""
n,m = I();md=10**9+7;p=0;a=1
dp=[0,1];l=[0]*(10**5+2)
for _ in range(m):
    x=int(input())
    l[x]=1
for i in range(1,n+1):
    if l[i]:
        dp.append(0)
    else:
        dp.append((dp[-1]+dp[-2])%md)
print(dp[-1])
"""
n,m = I()
l=I();s=sum(l);l.sort();d=[]
for _ in range(m):
    b,c=I()
    d.append([c,b])
p=s=0    
for i in sorted(d,reverse=True):
    if l[p]>=i[0]:
        break
    k = bi.bisect(l[p:],i[0])
    p+=min(k,i[1]);s+=i[0]*min(k,i[1])
    if p>=n:
        break
s+=sum(l[p:])
print(s)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

n, m = I()
a = sorted(I())
q = []
for i in range(m):
    q.append(I())
q.sort(key = lambda x: (x[1], x[0]), reverse = True)
cur = 0
for b, c in q:
    while cur < n and a[cur] >= c:
        cur += 1
    while cur < n and b and a[cur] < c:
        b -= 1
        a[cur] = c
        cur += 1
print(sum(a))
Buggy python submission (verdict: Runtime Error):
s = 0
for i in range(2):
    if A > B:
        s += A
        A -= 1
    else:
        s += B
        B -= 1
print(s)

Fixed submission:
x= [ int(x) for x in input().split()]

a,b=x[0],x[1]

y = (max(a,b))

resultado1 = (y*2)-1
resultado2 = a+b

print(max(resultado1,resultado2))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if 0 < a <= 123:
    if 0 < b <= 123:
        if 0 < c <= 123:
            if 0 < d <= 123:
                if 0 < e <= 123:
                    if 0 < k <= 123:
                        if a < b:
                            if b < c:
                                if c < d:
                                    if d < e:
                                        ab = b - a
                                        ac = c - a
                                        ad = d - a
                                        ae = e - a
                                        bc = c - b
                                        bd = d - b
                                        be = e - b
                                        cd = d - c
                                        ce = e - c
                                        de = e - d

                                        lista = [ab, ac, ad, ae, bc, bd, be, cd, ce, de]
                                        x = max(lista)
if x <= 15:
     print("Yay!")
else:
    print(":(")

Fixed submission:
arr = [int(input()) for _ in range(6)]
arr, k = sorted(arr[:-1]), arr[-1]
print('Yay!' if arr[-1]-arr[0] <= k else ':(')
Buggy python submission (verdict: Runtime Error):
n=input().split()
a=int(n[0])
b=int(n[1])
c=int(n[2])
k=b//n
if k>c:
  print(c)
else:
  print(k)

Fixed submission:
import math
x = input().split()
A = int(x[0])
B = int(x[1])
C = int(x[2])
if (math.floor(B/A) >= C):
  print(C)
else:
  print(math.floor(B/A))
Buggy python submission (verdict: Runtime Error):
line = input()
num = [int(n) for n in line.split()]
sides = [num_a, num_b, num_c]
sides.sort()
area = round(sides[0] * sides[1]/2)
print(area)

Fixed submission:
a, b, c = map(int, input().split())
area = int((b * a)/2)
print(area)

Buggy python submission (verdict: Runtime Error):
a, b, c = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
area = int((0.5*a)*b)
print(area)

Fixed submission:
a, b, c = map(int, input().split())
area = int((b * a)/2)
print(area)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=[10**6]+list(map(int,input().split()))
c=[0]*(n+1)
for i in range(2,n+1):
  a=c[i-1]+abs(h[i]-h[i-1])
  b=c[i-2]+abs(h[i]-h[i-2])
  c[i]=min(a,b)
print(c[n]

Fixed submission:
N = int(input())
h = list(map(int, input().split()))
     
dp = [10**9]*N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
     
for i in range(2, N):
  dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
     
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
from time import time

def funcion():
    n = int(input())
    indice_anterior = -1
    total = 0

    for i in range(n):
        mayor = 0
        cadena = input()
        lista = cadena.split()
        cont = 0
        for j in lista:
            jnum = int(j)
            if (jnum > mayor) and cont != indice_anterior:
                mayor = jnum
            cont = cont + 1
        indice_anterior = lista.index(str(mayor))
        total = total + mayor
    print(total, tiempo_ejecucion)

def main():
    return(funcion())

if __name__ == "__main__":
    main()

Fixed submission:
n = int(input())
h = []
for _ in range(n):
    a, b, c = [int(x) for x in input().split()]
    h.append((a, b, c))

vals = {}
a, b, c = h[0]
vals[(0, 'A')] = a
vals[(0, 'B')] = b
vals[(0, 'C')] = c

for i in range(1, n):
    a, b, c = h[i]
    vals[(i, 'A')] = max(vals[(i-1, 'B')], vals[(i-1, 'C')]) + a
    vals[(i, 'B')] = max(vals[(i-1, 'A')], vals[(i-1, 'C')]) + b
    vals[(i, 'C')] = max(vals[(i-1, 'B')], vals[(i-1, 'A')]) + c

print(max(vals[(n-1, 'A')], vals[(n-1, 'B')], vals[(n-1, 'C')]))
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>
#include<bits/stdc++.h>
 
#define get(a, i, j) *((*(a+i))+j)
 
typedef long long ll;
 
int N;
ll W, rec[101][2], mem[105][100005];
 
ll dp(int pos, ll cw); // cw = cumulative weight
 
int main()
{
    //freopen("input.txt", "r", stdin);
    memset(mem, -1, sizeof(mem));
 
    int i;
    scanf("%d%lld", &N, &W);
 
    for(i=0; i<N; ++i) scanf("%lld%lld", &get(rec, i, 0), &get(rec, i, 1));
 
    ll v1;
    v1 = dp(0, 0);
    //v2 = dp(0, 0);
 
    printf("%lld\n",v1);
 
    return 0;
}
 
 
ll dp(int pos, ll cw)
{
    //printf("Inside dp with pos = %d & cw = %lld\n", pos, cw);
    if(pos >= N || cw > W) {
        //printf("returning 0\n\n");
        return 0;
    }
    if(get(mem, pos, cw) > -1) {
        //printf("returning %lld from mem\n\n", get(mem, pos, cw));
        return get(mem, pos, cw);
    }
 
    ll w = get(rec, pos, 0);
 
    ll v1 = 0, v2 = 0;
 
    if((cw + w <= W ) ) {
        //printf("going to next pos including weight\n");
        v1 = get(rec, pos, 1);
        v1 += dp(pos+1, cw + w);
    }
 
    //printf("going to next pos excluding weight\n");
    v2 = dp(pos+1, cw);
 
 
    //printf("returning value either %lld or %lld\n\n", v1, v2);
    return get(mem, pos, cw) = (v1>v2)? v1:v2;
}

Fixed submission:
def main():
  import numpy as np
  N,W = map(int, input().split())
  
  dp = np.zeros(W+1, dtype=np.int64)
  
  for _ in range(N):
    w,v = map(int,input().split())
    np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])
  
  print(dp[-1])

if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
def main():
    n, w = [int(x) for x in input().split()]
    itens = []
    dp = [[-1]*w for i in range(n)]
    
    for _ in range(n):
        itens.append([int(x) for x in input().split()])#item([peso, valor])

    print(knapsack(n, w, itens, dp))

def knapsack(n, w, itens, dp):

    if n == 0 or w == 0:
        return 0

    if dp[n-1][w-1] != -1:
        return dp[n-1][w-1]

    if itens[n-1][0] > w:
        dp[n-1][w-1] = knapsack(n-1, w, itens, dp)
        return dp[n-1][w-1]

    else:
        dp[n-1][w-1] = max(itens[n-1][1] + knapsack(n-1, w - itens[n-1][0], itens, dp),
                           knapsack(n-1, w, itens, dp))

        return dp[n-1][w-1]

main()

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

w = []
v = []

for i in range(N):
    peso,valor = map(int,input().split())
    w.append(peso)
    v.append(valor)

V = sum(v)

dp = [[W+1] * (V + 1) for i in range(N+1)]
#DP[i][j] = menor peso para obter o i-th item com valor j

dp[0][0] = 0

for i in range(1,N+1):
    for j in range(V + 1):
        if v[i-1] <= j:
            dp[i][j] = min(dp[i-1][j], w[i-1] + dp[i-1][j- v[i-1]])

        else:
            dp[i][j] = dp[i-1][j]

resp = 0

for i in range(V + 1):
    if dp[-1][i] <= W:
        resp = max(i,resp)

print(resp)
Buggy python submission (verdict: Runtime Error):
n = int(input())

words = []
for i in range(n):
    words.append(input())

ret = "Yes"
if len(set(words)) != n:
    ret = "No"
else:
    for i in range(n-1):
        if words[i][-1] != words[i+1][0]:
            ret = "No"
            break

print(ret)

Fixed submission:
a, b = map(int, input().split())
if a == 2 or b == 2:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input())
words = ['']*n
for i in range(n):
    words[i] = input()
for i in range(len(words) - 1):
    if words.count(words[i]) > 1 or words[i][-1] != words[i+1][0]:
        print('No')
        exit()
print('Yes')

Fixed submission:
def Condition(W):
    for i in range(len(W)):
        for j in range(i,len(W)):
            if W[i]==W[j] and i!=j:
                print('No')
                return None
    for i in range(len(W)-1):
        k=len(W[i])-1
        if W[i][k]!=W[i+1][0]:
            print('No')
            return None
    print('Yes')    


N=int(input())
W=[]
for i in range (N):
    W.append(input())    
Condition(W)

Buggy python submission (verdict: Runtime Error):
import sys 
from collections import Counter
f = open('pokemon', 'r')
names = []
for line in f:
    names.append(line)
max_length = 0
pokemon = ''
for i in range(len(names)):
    p = [names[i]]
    start = names[i][-2]
    shiritori = True
    count = 1
    while shiritori == True:
        shiritori = False
        for j in range(len(names)):
            if i != j and names[j][0] == start and not names[j] in p:
                count += 1
                start = names[j][-2]
                shiritori = True
                p.append(names[j])
                if count > max_length:
                    max_length = count
                    pokemon = names[i]
                break
    print (p)
print (pokemon + str(max_length))

Fixed submission:
def Condition(W):
    for i in range(len(W)):
        for j in range(i,len(W)):
            if W[i]==W[j] and i!=j:
                print('No')
                return None
    for i in range(len(W)-1):
        k=len(W[i])-1
        if W[i][k]!=W[i+1][0]:
            print('No')
            return None
    print('Yes')    


N=int(input())
W=[]
for i in range (N):
    W.append(input())    
Condition(W)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n>=2 and n<=100:
    if n%2==0:
        print( (n/2)^2)
    else:
        print( ((n//2)+1)^2)


Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))

Buggy python submission (verdict: Runtime Error):
N =int(input())
if N%2==1:
    odd = N-even
else:
    even = N/2
    odd = N/2
print(int(even*odd))

Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))

Buggy python submission (verdict: Runtime Error):
k= input()  
odd=1
even=0
for i in range(2,k+1):
     if i%2==0:
        even+=1
     else:
           odd+=1
print(odd*even)

Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))

Buggy python submission (verdict: Runtime Error):
k= input ()  
odd=1
even=0
for i in range(2,k+1) 
     if i%2==0:
        even+=1
     else:
           odd+=1
print(odd*even)

Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))

Buggy python submission (verdict: Runtime Error):
k=input()
odd=0
even=0
for i in range(1,k+1) 
     if i%2==0:
        even+=1
     else:
            odd+=1
print(odd*even)

Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))

Buggy python submission (verdict: Runtime Error):
k=input()
pair=0
for i in range(1,k+1):
     for j in range (2,k+1)
          if i%2==0 and j%2!=0:
              pair+=1
         ELIF i%2!=0 and j%2==0 :
               pair+=1
         
print(pair)

Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))

Buggy python submission (verdict: Runtime Error):
k = map(int, input())
if k%2 == 0:
    print((k/2)*(k/2))

else:
    print(((k-1)/2)*(((k-1)/2)-k))

Fixed submission:
import math

n = int( input())

print( math.ceil(n/2) * math.floor(n/2))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from itertools import product
b=list(map(int,input().split(" ")))
c=2*b[0]/b[1]
a=[i for i in range(1,int(c)+1)]
a=list(product(a,repeat=3))
t=0
for i in a:
    if (i[0]+i[1]-i[2])*b[1]/2.0>=1 and (i[0]+i[1]-i[2])*b[1]/2.0<=b[0] and math.modf((i[0]+i[1]-i[2])*b[1]/2.0)[0]==0:
        if (i[0]+i[2]-i[1])*b[1]/2.0>=1 and (i[0]+i[2]-i[1])*b[1]/2.0<=b[0] and math.modf((i[0]+i[2]-i[1])*b[1]/2.0)[0]==0:
            if (i[2]+i[1]-i[0])*b[1]/2.0>=1 and (i[2]+i[1]-i[0])*b[1]/2.0<=b[0] and math.modf((i[2]+i[1]-i[0])*b[1]/2.0)[0]==0:
                t+=1
print (t)


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

ans = 0
for a in range(1, N+1):
    if(2 * a % K == 0):
        beg = K - a % K
        end = N
        cnt = (end - beg + K) // K
        ans += cnt * cnt

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a+1-b)
//Source code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 characters

Fixed submission:
N, i = [int(x) for x in input().split()]
print(N - i + 1)

Buggy python submission (verdict: Runtime Error):
N,I=map(int,input().split())
x = N -I
x+=1
print(x)

Fixed submission:
N, i = [int(x) for x in input().split()]
print(N - i + 1)

Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split()))
    print(s[0]-s[1]+1)

Fixed submission:
N, i = [int(x) for x in input().split()]
print(N - i + 1)

Buggy python submission (verdict: Runtime Error):
N= int(input())
i= int(input())

j=N-i+1

print (j)
    


Fixed submission:
N, i = [int(x) for x in input().split()]
print(N - i + 1)
Buggy python submission (verdict: Runtime Error):
rating = int(input())
switch(rating):
  case rating>0 and rating < 1200:
    print("ABC")
    break
  case rating > 1200 and rating < 2800:
    print("ARC")
    break
  case rating > 2800 :
    print("AGC")
    break
  default:
    print("ERROR")
    break


Fixed submission:
rating = int(input())
if(rating>=0 and rating<1200):
  print("ABC")
elif(rating < 2800):
  print("ARC")
elif(rating <= 4208):
  print("AGC")
Buggy python submission (verdict: Runtime Error):


#if WATCH_RUNTIME
	#include <ctime>
	clock_t startTime;
#endif

#include <cstdio>
#include <cstring>

int main(void)
{
	#if DEBUG 
	freopen("_in","r",stdin);
	#endif
	#if WATCH_RUNTIME
	startTime=clock();
	#endif
	bool winFlag;
	int i,j,N;
	char msg[200],patten[100];
	scanf("%s",msg);
	scanf("%s",patten);
	N=strlen(msg);
	for(i=0;i<N;i++)
	{
		msg[N+i]=msg[i];
	}
	msg[N+i]='\0';
	for(i=0;i<N;i++)
	{
		winFlag=true;
		for(j=0;patten[j];j++)
		{
			if(patten[j]!=msg[i+j])
			{
				winFlag=false;
				break;
			}
		}
		if(winFlag)
			break;
	}
	printf("%s\n",winFlag?"Yes":"No");

	#if WATCH_RUNTIME
	printf("----------\n");
	printf("\n+===============+\n");
	printf("|RUNTIME =%3dms.|\n",clock()-startTime);
	printf("+===============+\n");
	#endif

	return 0;
}

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

for _ in range(len(S)):
    if S == T:
        print('Yes')
        break
    else:
        S = S[-1] + S[:-1]
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

from math import *

def lcm(a,b):
    return a*(b//gcd(a,b))

n = int(input())
A = [int(x) for x in input().split()]
m = 1
for i in A:
    m = lcm(i,m)

m -= 1
ans = 0
for i in A:
    ans += m%i

print(ans)


Fixed submission:
n = input()
a = input().split()
b = []
for i in a :
    b.append(int(i));
c = 0
for i in b :
    c += i-1
print(c)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if(a + b > 16):
    print(":(")
elif(a <= 8 and b <= 8):
    print("Yay!")
else:
    print(":(")

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

if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Runtime Error):
d = int(input("Digite um numero sendo ele 0, 1 ou 2"))
n = int(input("Digite um numero de 0 a 100"))

if (d == 0):
    x = 1
    y = 0
    n0 = []
    while ( x <= n ):
        n0.append(y)
        x = x + 1
        y = y + 1
    print(n0[-1])
elif (d == 1):
    x = 1
    y = 100
    n1 = []
    while (x <= n ):
        n1.append(y)
        x = x + 1
        y = y + 100
    print(n1[-1])
elif (d == 2):
    x = 1
    y = 1000
    n2 = []
    while (x <= n):
        n2.append(y)
        x = x + 1
        y = y + 1000
    print(n2[-1])

Fixed submission:
d,n = map(int,input().split())
for i in range (n):
    ans=100 ** d * (i+1)
if n==100:
    ans+=100 ** d
print(ans)