Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  int 64_t T,TT,A,AA,B,BB,ans=0;
  cin>>T>>TT>>A>>AA>>B>>BB;
  
  //常にA<Bとなるようにする
  if(A>B){
    ll W=A;
    A=B;
    B=W;
    W=AA;
    AA=BB;
    BB=W;
  }
  
  int 64_t P=(A-B)*T,Q=(AA-BB)*TT;
  
  
  if(P+Q==0){
    cout<<"infinity"<<endl;
    return 0;
  }
  
  if(P+Q<0){
    cout<<0<<endl;
    return 0;
  }
  
  if((-1*P)%(P+Q)!=0){
    ans++;
  }
  ans+=2*(-1*P)/(P+Q);
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: expected unqualified-id before numeric constant
   32 |   int 64_t T,TT,A,AA,B,BB,ans=0;
      |       ^~~~
a.cc:33:8: error: 'T' was not declared in this scope
   33 |   cin>>T>>TT>>A>>AA>>B>>BB;
      |        ^
a.cc:33:11: error: 'TT' was not declared in this scope
   33 |   cin>>T>>TT>>A>>AA>>B>>BB;
      |           ^~
a.cc:33:15: error: 'A' was not declared in this scope
   33 |   cin>>T>>TT>>A>>AA>>B>>BB;
      |               ^
a.cc:33:18: error: 'AA' was not declared in this scope
   33 |   cin>>T>>TT>>A>>AA>>B>>BB;
      |                  ^~
a.cc:33:22: error: 'B' was not declared in this scope
   33 |   cin>>T>>TT>>A>>AA>>B>>BB;
      |                      ^
a.cc:33:25: error: 'BB' was not declared in this scope
   33 |   cin>>T>>TT>>A>>AA>>B>>BB;
      |                         ^~
a.cc:45:7: error: expected unqualified-id before numeric constant
   45 |   int 64_t P=(A-B)*T,Q=(AA-BB)*TT;
      |       ^~~~
a.cc:48:6: error: 'P' was not declared in this scope
   48 |   if(P+Q==0){
      |      ^
a.cc:48:8: error: 'Q' was not declared in this scope
   48 |   if(P+Q==0){
      |        ^
a.cc:53:6: error: 'P' was not declared in this scope
   53 |   if(P+Q<0){
      |      ^
a.cc:53:8: error: 'Q' was not declared in this scope
   53 |   if(P+Q<0){
      |        ^
a.cc:58:10: error: 'P' was not declared in this scope
   58 |   if((-1*P)%(P+Q)!=0){
      |          ^
a.cc:58:16: error: 'Q' was not declared in this scope
   58 |   if((-1*P)%(P+Q)!=0){
      |                ^
a.cc:59:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   59 |     ans++;
      |     ^~~
      |     abs
a.cc:61:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   61 |   ans+=2*(-1*P)/(P+Q);
      |   ^~~
      |   abs
a.cc:61:14: error: 'P' was not declared in this scope
   61 |   ans+=2*(-1*P)/(P+Q);
      |              ^
a.cc:61:20: error: 'Q' was not declared in this scope
   61 |   ans+=2*(-1*P)/(P+Q);
      |                    ^