CSES Solutions
#1754Introductory Problems

Coin Piles

View on CSES

Solution

1754-Coin_Piles.cpp
1#include<bits/stdc++.h>
2using namespace std;
3#define int long long
4signed main(){
5  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
6  int t; cin>>t;
7  while(t--){
8    int a,b; cin>>a>>b;
9    if(a<b) swap(a,b);
10    cout<<(a<=2*b&&(2*b-a)%3==0?"YES\n":"NO\n");
11  }
12  return 0;
13}

Editorial not yet generated for this problem. Run the editorial generation script to add hints and detailed explanations.