two2.cpp
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define DEBUG(x) cerr << ">> " << #x << ": " << x << endl;
#define REP(i,a) for (int i =0; i < (a);++i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
char pom;
int n;
unsigned long long x,y;
unsigned long long lft, rght;
int counter = 0;
bool once = false;
int main() {
// while (scanf("%d%d",) != EOF)
while ( cin >> pom >> pom >> n ){
int x = n + 1;
y = x;
counter = 0;
lft= n * ( x + y );
rght = x * y;
while ( true ){
if ( lft == rght ){
once = false;
//cout << "reseni " << x << " " << y;
x = x + 1;
y = x;
lft= n * ( x + y );
rght = x * y;
counter++;
} else if ( lft < rght ){
if ( !once ){
//moc velka x a y
break;
}
x++;
y = x;
lft= n * ( x + y );
rght = x * y;
once = false;
} else {
once=true;
y++;
lft = lft + n;
rght = rght + x;
}
}
cout << counter << endl;
}
return 0;
}