Why am I getting "Runtime error or memory limit exceeded on sample input case"? Though My output is similar to the sample output. Below my code and output. Please help me!

Usaco Problem link: Problem 2. Block Game

#pragma GCC optimize(“Ofast”)
#pragma GCC target(“avx,avx2,fma”)
#pragma GCC optimization(“unroll-loops”)
#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl “\n”
#define pb push_back
#define reset(a) memset(a,0,sizeof a)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b)*b)
#define abs(a) (a<0?-(a):a)
#define pi acos(-1.0)
#define kkk(a) if(a)cout<<“Yes\n”; else cout<<“No\n”
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
const int inf=2e9+7;
const int mxN=3000000;
const int mod=1e9+7;
//cout<<"Case “<<cas++<<”: "<<
//freopen(“input.txt”,“r”,stdin);
int dir1[]={1,1,1,0,0,-1,-1,-1};
int dir2[]={1,0,-1,1,-1,1,0,-1};

void setIO(string name)
{
freopen((name+".in").c_str(),“r”,stdin);
freopen((name+".out").c_str(),“w”,stdout);
}

int main()
{
setIO(“blocks”);

int n,i;
cin>>n;
int ans[30];
reset(ans);

while(n--)
{
  string s1,s2;
  cin>>s1>>s2;

int freq1[30], freq2[30];
reset(freq1);
reset(freq2);

  for(i=0;i<s1.size();i++)
  {
    freq1[(s1[i]-'a')]++;
  }
  for(i=0;i<s2.size();i++)
  {
    freq2[(s2[i]-'a')]++;
  }
  for(i=0;i<26;i++)
  {
    ans[i] += max(freq1[i],freq2[i]);
  }
  s1.clear();
  s2.clear();
}
for(i=0;i<26;i++)
  cout<<ans[i]<<endl;

}

My output:
2
2
2
1
0
1
1
0
0
0
0
0
0
0
2
0
0
1
1
1
1
0
0
1
0
0

But judge reply

… avx2 is not supported and gives a runtime error due to unrecognized instruction

Also worth noting that #pragma GCC optimization ... doesn’t do anything …

1 Like

Thank you so much!