akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


int main()
{
	ll n, h;
	cin>>n>>h;
	std::vector<ll> a,b, b22;
	bool has = false;
	for (int i = 0; i < n; ++i)
	{
		int x,y;
		cin>>x>>y;
		a.push_back(x);
		b.push_back(y);
		b22.push_back(y);
		if (x >= h || y >= h)
		{
			has = true;
		}
	}
	// sort(otherPpl.begin(), otherPpl.end(), greater<int>());
	if (has)
	{
		printf("%d\n", 1);
		return 0;
	}
	ll ma = *max_element(a.begin(), a.end()), mb = *max_element(b.begin(), b.end());
	if (ma >= mb)
	{
		if (h%ma)
		{
			printf("%lld\n", 1+(h/(*max_element(a.begin(), a.end()))) );
		}
		else
			printf("%lld\n", (h/(*max_element(a.begin(), a.end()))) );
		return 0;
	}
	ll score = 0, maximum = INT_MIN, targetidx = 0;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] > maximum)
		{
			maximum = a[i];
			targetidx = i;
		}
	}

	ll othersum = 0;
	bool done = false;
	std::vector<ll> otherPpl;
	for (int i = 0; i < n; ++i)
	{
		if ((i != targetidx) && (b[i] > maximum))
		{
			otherPpl.push_back(b[i]);
			othersum += b[i];
			if (othersum >= h)
			{
				done = true;
				// break;
			}
		}
	}
	int answer1 = -1;
	if (done || (othersum + b[targetidx] >= h))
	{
		// ------------------------------
		otherPpl.push_back(b[targetidx]);
		sort(otherPpl.begin(), otherPpl.end(), greater<int>());
		ll scorehere = 0, sumhere = 0;
		for (int i = 0; i < otherPpl.size(); ++i)
		{
			sumhere += otherPpl[i];
			scorehere ++;
			if (sumhere >= h)
			{
				break;
			}
		}
		printf("%lld\n", scorehere);
		return 0;
		// answer1 = scorehere;
	}
	score += otherPpl.size();
	h -= othersum;
	if (h - b[targetidx] <= 0)
	{
		printf("%lld\n", score+1);
		return 0;
	}
	h -= b[targetidx];
	score++;
	if (h % a[targetidx])
	{
		score += 1 +(h/a[targetidx]);
	}
	else
	{
		score += (h/a[targetidx]);
	}
	printf("%lld\n", score);

	return 0;
}

Measured memory_bytes: 4192
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    int flag;
    string S;
    cin >> S;
    if(S[0] == S[1]){
        if(S[1] == S[2]){
        cout << "No" <<  endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        cout << "Yes" << endl;
    }

    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

const int N = 1e5 + 100;

int n;
std::set<int> red[N], blue[N];

void init() {
	std::cin >> n;
	for (int i = 1; i <= n - 1; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		red[u].insert(v);
		red[v].insert(u);
	}
	for (int i = 1; i <= n - 1; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		blue[u].insert(v);
		blue[v].insert(u);
	}
}

int find(int u, int father[]) {
	if (father[u] == u) {
		return u;
	} else {
		return father[u] = find(father[u], father);
	}
}

void work() {
	static std::vector<std::pair<int, int>> records;

	for (int u = 1; u <= n; u++) {
		for (auto v : red[u]) {
			if (v > u && blue[u].find(v) != blue[u].end()) {
				records.push_back({u, v});
			}
		}
	}

	static int father[N];
	for (int i = 1; i <= n; i++) {
		father[i] = i;
	}
	for (int l = 0; l < (int)records.size(); l++) {
		int u = find(records[l].first, father), v = find(records[l].second, father);
		if (red[u].size() + blue[u].size() > red[v].size() + blue[v].size()) {
			std::swap(u, v);
		}
		red[u].erase(v);
		red[v].erase(u);
		blue[u].erase(v);
		blue[v].erase(u);
		for (auto t : red[u]) {
			if (blue[v].find(t) != blue[v].end()) {
				records.push_back({t, v});
			}
		}
		for (auto t : blue[u]) {
			if (red[v].find(t) != red[v].end()) {
				records.push_back({t, v});
			}
		}
		for (auto t : red[u]) {
			red[v].insert(t);
			red[t].erase(u);
			red[t].insert(v);
		}
		for (auto t : blue[u]) {
			blue[v].insert(t);
			blue[t].erase(u);
			blue[t].insert(v);
		}
		father[u] = v;
	}
	if (records.size() == n - 1) {
		std::cout << "YES" << std::endl;
	} else {
		std::cout << "NO" << std::endl;
	}
}

int main() {
	init();
	work();

	return 0;
}


Measured memory_bytes: 31608
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var A = G;
		var sum = new long[N + 1];
		for (var i = 0; i < N; i++) sum[i + 1] = sum[i] + A[i];
		// [0, N) => [0, m) + [m, N), where 2 <= m <= N-2
		var l = new int[N];	// 1 <= l <= m-1, [0, m) => [0, l) + [l, m) and |sum[0, l] - sum[l, m]| is minimum, then l[m] = l
		var r = new int[N];	// m+1 <= r <= N-1, [m, N) => [m, r) + [r, N) and |sum[m, r] - sum[r, N]| is minimum, then r[m] = r
		l[2] = 1; r[N - 2] = N - 1;
		for (var m = 3; m <= N - 2; m++)
		{
			var p = l[m - 1];
			var d = Abs(2 * sum[p] - sum[0] - sum[m]);
			var q = p + 1;
			while (q <= m - 1)
			{
				var e = Abs(2 * sum[q] - sum[0] - sum[m]);
				if (e > d) break;
				if (e < d) { d = e; p = q; }
				q++;
			}
			l[m] = p;
			// WriteLine($"l[{m}] = {l[m]}");
		}
		for (var m = N - 3; m >= 2; m--)
		{
			var p = r[m + 1];
			var d = Abs(2 * sum[p] - sum[m] - sum[N]);
			var q = p - 1;
			while (q >= m + 1)
			{
				var e = Abs(2 * sum[q] - sum[m] - sum[N]);
				if (e > d) break;
				if (e < d) { d = e; p = q; }
				q--;
			}
			r[m] = p;
			// WriteLine($"r[{m}] = {r[m]}");
		}
		var ans = long.MaxValue;
		for (var m = 2; m <= N - 2; m++)
		{
			var P = sum[l[m]] - sum[0];
			var Q = sum[m] - sum[l[m]];
			var R = sum[r[m]] - sum[m];
			var S = sum[N] - sum[r[m]];
			var t = new long[] {P, Q, R, S};
			ans = Min(ans, t.Max() - t.Min());
		}
		WriteLine(ans);
	}
}


Measured memory_bytes: 32220
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N,x;
    cin >> N >> x;
    ll a[N];
    ll i;
    for(i=0;i<N;i++){
        cin >> a[i];
    }
    ll cnt=0;
    if(a[0]>x){
        cnt=a[0]-x;
        a[0]=x;
    }
    for(i=1;i<N;i++){
        if(a[i-1]+a[i]>x){
            cnt+=a[i-1]+a[i]-x;
            a[i]=x-a[i-1];
        }
    }
    cout << cnt <<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>

int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int32_t N;
  std::cin >> N;
  std::vector<int32_t> C(N-1);
  std::vector<int32_t> S(N-1);
  std::vector<int32_t> F(N-1);
  for (int32_t i = 0; i < N - 1; i++) {
    std::cin >> C[i] >> S[i] >> F[i];
  }

  for (int32_t start = 0; start < N - 1; start++) {
    int64_t cur_time = 0;
    for (int32_t cur = start; cur < N - 1; cur++) {
      if (cur_time < S[cur]) {
        cur_time += S[cur] - cur_time;
      }
      else if (cur_time % F[cur] != 0) {
        cur_time += F[cur] - (cur_time % F[cur]);
      }
      cur_time += C[cur];
    }
    std::cout << cur_time << std::endl;
  }
  std::cout << 0 << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mod 1000000007
#define N 100005

int main() {

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    ll t=1;
    //cin>>t;

    while(t--) {

        ll n;
        cin>>n;

        vector<ll>vec(n+1);
        map<int,int>mp1,mp2;

        for(int i=1;i<=n;i++) {
            cin>>vec[i];
            mp1[vec[i] - i]++;
            mp2[vec[i] + i]++;
        }

        ll ans = 0;
        for(int i=1;i<=n;i++) {
            ll k1 = vec[i] - i;
            ll k2 = vec[i] + i;
            k1 = -k1;
            k2 = -k2;
            ans+= mp1[k2] + mp2[k1];
        }
		ans /= 2;
        cout<<ans<<"\n";

    }



}


Measured memory_bytes: 38816
from bisect import bisect_left
 
N = int(input())
L = list(map(int, input().split()))
 
L.sort()
 
cnt = 0
 
# 2番目に長い棒bを固定
for b in range(N):
    # bより短い棒aを一つずつ探索
    for a in range(b):
        ab = L[a] + L[b]
        # 二分探索でa+bより短い棒（c<a+bが成り立つc）の範囲を求める
        r = bisect_left(L, ab)
        # cの範囲のうちbの範囲を除外して、cの本数を求める
        cnt += r - (b + 1)
 
print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>

using namespace std;

int main() {
    string o, e;
    cin >> o >> e;
    for(int i = 0; i < o.size(); ++i) {
        cout << o[i];
        if(i < e.size()) cout << e[i];
    }
    cout << endl;
    return 0;

}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

//デバッグ
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/


int main(){
  double ans;
  ll N;
  cin >> N;
  ll M = (N+1) / 2;
  ans = 1. * M / N;
  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int k;
string s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> k >> s;
    if (s.size() <= k)
    {
        cout << s;
    }
    else
    {
        string news;
        for (int i = 0; i < k; i++)
        {
            news += s[i];
        }
        cout << news + "...";
    }
}

Measured memory_bytes: 3656
while True:
    char = input()
    if char == '-':
        break
    else:
        char = list(char)
        m = int(input())
        for i in range(m):
            sl = int(input())
            a = char[0:sl] #スライス
            b = char.extend(a)#エクステンド
            del char[0:sl] #del
    print("".join(char))



Measured memory_bytes: 5592
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[100010],ans;
int main()
{
	cin>>n;
	for (int i=0;i<n;i++)
		cin>>a[i];
	for (int i=0;i<n;i++)
		if (a[i]-1==i){
			int t=a[i]+1;
			a[i+1]=a[i];
			a[i]=t;
			ans++;
		}
	cout<<ans;
  	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

int n;
vector<int> v;

int main(){
	ri(n);
	for(int i = 1; i <= n; i++){
		int x;
		ri(x);
		if(v.empty()){
			v.emplace_back(x);
			continue;
		}
		int lo = 0, hi = v.size() - 1;
		while(lo < hi){
			int mi = lo + (hi - lo) / 2;
			if(v[mi] < x) lo = mi + 1;
			else hi = mi;
		}
		if(v[lo] < x) v.emplace_back(x);
		else v[lo] = x;
	}
	printf("%d\n", (int)v.size());
	return 0;
}


Measured memory_bytes: 3412
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;

//mt19937 random(566);
//uniform_int_distribution<ll> distr;
//ll rnd(ll a, ll b) {return a + distr(random) % (b - a + 1);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, m;
    cin >> n >> m;
    if (n == 1 || m == 1) {
        cout << "1\n";
        return 0;
    }
    cout << (n * 1ll * m + 1) / 2 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdint>
#include <algorithm>

using namespace std;

int main()
{
  uint32_t N, T;

  cin >> N >> T;
  
  vector<uint32_t> t(N,0);

  for (uint32_t n=0; n<N; ++n)    
    cin >> t[n];

  uint64_t X = 0;

  for (uint32_t n=0; n<N-1; ++n)
    X += min(t[n+1]-t[n], T);

  X += T;

  cout << X << endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

int main()
{
	double a, b, theta;

	cin >> a >> b >> theta;

	double s = (a * b * sin((theta / 180) * M_PI)) / 2;
	double l = a + b + sqrt(a * a + b * b - 2.0 * a * b * cos((theta / 180)*M_PI)); 
	double h = 2 * s / a;
	printf("%.5f %.5f %.5f\n",s,l,h);
	return 0;
}


Measured memory_bytes: 3440
import java.util.Scanner;
public class Main{

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long s = 0;
        for (int i = 1;i <= n;i ++){

            if (i % 3 != 0 && i % 5 != 0)
                s += i;
        }
        System.out.print(s);
    }
}

Measured memory_bytes: 35848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long

int main() {
	intt N, T; std::cin >> N >> T;
	std::vector<intt> t(N);
	for (auto& r : t)
		std::cin >> r;
	intt ans = 0;
	for (intt i = 1; i < N; ++i) {
		if (t[i] - t[i - 1] <= T)
			ans += t[i] - t[i - 1];
		else
			ans += T;
	}
	std::cout << ans + T << std::endl;

}

Measured memory_bytes: 4840
#include <bits/stdc++.h>

using namespace std;

int toint(char c)
{
    if (c >= 'a') {
        return (c - 'a');
    }
    return 26 + (c - 'A');
}

char tochr(int i)
{
    i = i % 52;
    if (i >= 26) {
        return 'A' + (char)(i - 26);
    } else {
        return 'a' + (char)(i);
    }
}

char decode(char c, int i)
{
    i = i % 52;
    const int j = toint(c);
    char ch;
    if (j >= i) {
        ch = tochr(j - i);
    } else {
        ch = tochr(j + 52 - i);
    }
    return ch;
}

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        vector<int> k(n);
        for (int i = 0; i < n; i++) {
            cin >> k[i];
        }
        string s;
        cin >> s;
        for (int i = 0; i < s.size(); i++) {
            cout << decode(s[i], k[i % n]);
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  int n;
  cin >> n;
  if (n % 10 == 3) {
    cout << "bon" << endl;
  } else if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 ||
             n % 10 == 9) {
    cout << "hon" << endl;
  } else {
    cout << "pon" << endl;
  }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	double pi = acos(-1.0);
	int r;
	cin >> r;
	cout << fixed << setprecision(15) << 2.0 * pi * r;

	return 0;
}



Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m,c;
  cin>>n>>m>>c;
  vector<int> b(m);
  for(int i=0;i<m;i++) cin>>b.at(i);
  int cnt=0;
  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<m;j++){
      int k;
      cin>>k;
      sum+=b.at(j)*k;
    }
    if(sum+c>0) cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

void main() {
    int n, k;
    scan(n, k);
    auto a = readln.split.to!(int[]);
    foreach (i; k .. n) {
        yes(a[i] > a[i - k]);
    }
}

void scan(T...)(ref T args) {
    auto line = readln.split; // @suppress(dscanner.suspicious.unmodified)
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 10952
#include <bits/stdc++.h>

using namespace std;
#define BUF (1000)
#define ll long long 
#define A (10000)
#define B (5000)
#define C (1000)
int n;
int y;

int main(void){
	cin >> n >> y;

	//y= iA+jB+kC;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			int k=n-i-j;
			if(k<0 || k>n) continue;
			if(y==i*A+j*B+k*C){
				cout << i << " " << j << " " << k << endl;
				return 0; 
			}
		}
	}

	cout << "-1 -1 -1" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define rep(i,n) for(int i=0; i<(n);++i)

int main(){
    int N;cin>>N;
    vector<double> p(N);
    rep(i,N)cin>>p[i];
    // dp[i][j] はi番目のコインまで投げるとき表がj回以上出る確率
    vector<vector<double>> dp(N+1,vector<double>(N+1,0.0));
    rep(i,N+1)dp[i][0]=1.0;
    rep(i,N)rep(j,N){
        dp[i+1][j+1]=dp[i][j+1]*(1.0-p[i])+dp[i][j]*p[i];
    }
    std::cout<<std::fixed<<std::setprecision(15)<<dp[N][N/2+1]<<endl;
}

Measured memory_bytes: 70784
N,A,B = map(int,input().split())
def split_sum(number):
  number_split_string = list(str(number))
  number_split_int = [int(e) for e in number_split_string]
  return sum(number_split_int)
list_meet_condition = []
for i in range(1,N+1):
  if A <= split_sum(i) <= B:
    list_meet_condition.append(i)
print(sum(list_meet_condition))


Measured memory_bytes: 3296
#E
N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7
ans=0

fact=[1 for i in range(N+1)]
for i in range(2,N+1):
    fact[i]=(fact[i-1]*i)%mod
    
fact_inv=[1 for i in range(N+1)]
for i in range(2,N+1):
    fact_inv[i]=pow(fact[i],mod-2,mod)

def nCk(n,k):
    re=(fact[n]*fact_inv[n-k]*fact_inv[k])%mod
    return re

ans=0
A=sorted(A)
for i in range(K-1,N):
    ans+=nCk(i,K-1)*(A[i]-A[N-i-1])
    ans%=mod
    
print(ans)

Measured memory_bytes: 65448
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
arr=arr.map(v=>v.split(" ").map(Number));
var n = arr.shift();
var c=arr.shift();
var q = arr.shift();
var apple = [];
for(var i=0;i<=n;i++)apple[i]=0;
var ans=0;
for(var i=0;i<arr.length;i++){
   var [t,x,d]=arr[i];
   if(t==1){
      apple[x]+=d;
      if(c[x - 1] <apple[x]){
         ans=x;
         break;
      }
   } else {
      if(apple[x]<d){
         ans=x;
         break;
      }else{
         apple[x]-=d;
      }
   }
}
console.log(ans);



Measured memory_bytes: 48536
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  string s;
  int n;
  cin>>s>>n;
  r(i,s.size()){
    if(i!=s.size()-1&&s[i]=='a')continue;
    if(i==s.size()-1){
      n=n%26;
      r(j,n){
        if(s[i]=='z')s[i]='a';
        else s[i]=s[i]+1;
      }
      break;
    }
    int x=('z'-s[i]+1);
    if(x>n)continue;
    s[i]='a';
    n-=x;
  }
  cout<<s<<endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;

class DivideTheProblems
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] array = new int[N];
        int i = 0;

        foreach (string s in input)
        { 
            array[i] = int.Parse(s);
            i++;
        }

        Array.Sort(array);
        Console.WriteLine(array[N / 2] - array[N / 2 - 1]);
    }
        
}


Measured memory_bytes: 18912
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>

int main(void){
    int N, M;
    scanf("%d %d", &N, &M);

    int *A = (int*)malloc(M * sizeof(int));
    int i, j;
    for(i=0; i<M; i++) {
        A[i] = 0;
    }

    int K, temp;
    for(i=0; i<N; i++) {
        scanf("%d", &K);
            for(j=0; j<K; j++) {
                scanf("%d", &temp);
                A[temp-1]++;
            }
    }

    int count = 0;
    for(i=0; i<M; i++) {
        if(A[i] == N) {
            count++;
        }
    }
    printf("%d\n", count);

    
    free(A);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rreb(i,b,n) for(int i = b-1; i >= n; i--)
#define rrep(i,n) reb(i,n,0)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v) for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;

using namespace std;
using std::stringstream;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;}
template<class T> inline T sqr(T x) {return x*x;}

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
/* -------------------------------------------------------------------------- */

int main(int argc, char *argv[])
{
    ll X;
    cin >> X;
    ll dep = 100;
    int ans = 0;

    while (dep < X) {
        ans++;
        dep *= 1.01;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<int,int>
#define pip pair<int,pii>
#define ppi pair<pii,int>
#define ppp pair<pii,pii>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 200003, mod=1e9+7;
const ll inf=(1e9+11);
int ts[N];

signed main()
{
    warmup

    int n;
    cin>>n;
    int a[n+1],i,j;
    ll k;
    cin>>k;
    for(i=1;i<=n;++i)
        cin>>a[i];
    i=1,j=1;
    while(!ts[i])
    {
        ts[i]=j++;
        i=a[i];
        --k;
        if(!k)
            return cout<<i, 0;
    }
    int x=j-ts[i];
    k%=x;
    while(k--)
    {
        i=a[i];
    }
    cout<<i;

    return 0;
}


Measured memory_bytes: 5200
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = 0;
        int y = 0;
        while (true) {
            x = scanner.nextInt();
            y = scanner.nextInt();
            if (x==0 && y==0) break;

            if (x > y) {
                System.out.println(y + " " + x);
            } else {
                System.out.println(x + " " + y);
            }
        }
    }
}


Measured memory_bytes: 36332
if __name__ == '__main__':
    N = int(input())
    count = 0
    d = {}
    for _ in range(N):
        s = ''.join(sorted(input()))
        try:
            d[s]
        except KeyError:
            d[s] = 0
        d[s] += 1
        if d[s] > 1:
            count += d[s] - 1
    print(count)

Measured memory_bytes: 17896
def main():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    x,y = map(int, input().split())
    f = s.split('T')
    dx_list = list(map(len, f[::2]))
    dy_list = list(map(len, f[1::2]))
    
    nx = dx_list.pop(0)
    ny = 0

    dx_list.sort(reverse=True)
    dy_list.sort(reverse=True)

    for dx in dx_list:
        if x >= nx:
            nx += dx
        else:
            nx -= dx
    for dy in dy_list:
        if y >= ny:
            ny += dy
        else:
            ny -= dy

    if nx == x and ny == y:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCoder
{
    class ABC177C
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            long[] a = new long[n];
            long mod = 1000000007;
            for(int i = 0; i < n; i++)
            {
                a[i] = long.Parse(str[i]);
            }
            long ans = 0;
            long sum = 0;
            for(int i = 1; i < n; i++)
            {
                sum += a[i];
                sum = sum%mod;
            }
            for(int i = 1; i < n; i++)
            {
                ans += (a[i-1]%mod)*(sum%mod);
                sum -= a[i];
                if(sum<0)
                {
                    sum += mod;
                }
                ans = ans%mod;
            }
            ans = ans%mod;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 46712
#include <bits/stdc++.h>

using namespace std;

int main() {
  vector<int> nums(4);
  for (int i = 0; i < 4; i++) cin >> nums[i];
  sort(nums.begin(), nums.end());

  if (nums[0] == 1 and nums[1] == 4 and nums[2] == 7 and nums[3] == 9) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(a>b){a=b;return 1;}return 0;}

int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int a, b;
  cin >> a >> b;

  if(a <= 5){
    cout << 0 << endl;
    return 0;
  }
  else{
    if(6 <= a && a <= 12){
      cout << b/2 << endl;
    }
    else cout << b << endl;
  }
  
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
typedef int64_t i64;

int N, A, B, C; 
VI l;

int dfs(int cur, int a, int b, int c){
    if (cur == N) 
        return abs(a - A) + abs(b - B) + abs(c - C) - (min({a, b, c}) ? 30 : INF);
    int ret0 = dfs(cur + 1, a, b, c);
    int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
    int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
    int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;
    return min({ret0, ret1, ret2, ret3});
}

int main() {
cin.tie(0);
ios::sync_with_stdio(false);

cin >> N >> A >> B >> C;
l.assign(N, 0);
rep(i, 0, N) cin >> l[i];

cout << dfs(0, 0, 0, 0) << endl;

}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a<=8 && b<=8){
        cout << "Yay!";
    }else{
        cout << ":(";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, m, X, Y;
	cin >> n >> m >> X >> Y;
	int x[n];
	rep(i, n) cin >> x[i];

	int y[m];
	rep(i, m) cin >> y[i];

	sort(x, x+n);
	sort(y, y+m);

	int max_x = x[n-1];
	int min_y = y[0];

	if(min_y <= max_x){
		cout << "War" << endl;
	}else{
		if(min_y <= X || Y <= max_x){
			cout << "War" << endl;
		}else{
			cout << "No War" << endl;
		}
	}
}


Measured memory_bytes: 256
import math
n =  int(input())
s = list(input())

upper = s.count("R")*s.count("G")*s.count("B")

def counting(x):
  count = 0
  for i in range(1, math.ceil(x/2)):
    if s[x-1]!=s[x-1-i] and s[x-1-i]!=s[x-1-2*i] and s[x-1-2*i]!=s[x-1]:
      count += 1
    else:
      count += 0
  return count

if n>=3:
  minus = [0]*(n+1)
  if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[0]:
    minus [3] = 1
  else:
    minus [3] = 0
  for i in range(3,n):
    minus[i+1] = minus[i]+counting(i+1)
  print(int(upper-minus[n]))
else:
  print(int(0))

Measured memory_bytes: 9268
import math

a,b,C=map(float,input().split())
cs=math.radians(C)
S=a*b*0.5*math.sin(cs)
c=math.sqrt(a**2+b**2-2*a*b*math.cos(cs))
L=a+b+c
h=S/(a*0.5)

print('%5f'%(S))
print('%5f'%(L))
print('%5f'%(h))


Measured memory_bytes: 5692
d=int(input())
c=list(map(int,input().split()))
s=[]
for _ in range(d):
    s_i=list(map(int,input().split()))
    s.append(s_i)
t=[]
for _ in range(d):
    t_i=int(input())
    t.append(t_i)


dp=[0]*26

ans=0
for i in range(d):
    s_i = s[i][t[i]-1]
    ans+=s_i
    dp[t[i]-1]=i+1
    tmp=0
    for j in range(26):
        tmp+=c[j]*((i+1)-dp[j])

    
    

    ans -= tmp

    print(ans)

Measured memory_bytes: 9084
N=int(input())
listA=list(map(int, input().split()))
Q=int(input())

listB=[] #appendのために宣言が必要
while True:
    try:
        listB.append(list(map(int,input().split())))

    except:
        break;
        
sum=sum(listA)
numlist=[0]*(10**5+1)
for i in listA:
  numlist[i]+=1
  
for i in range(Q):
  B=listB[i][0]
  C=listB[i][1]
  if numlist[B]!=0:
    sum=sum+(C-B)*numlist[B]
    # print(C)
    numlist[C]+=numlist[B]
    numlist[B]=0
    # print(numlist)
  print(sum)


Measured memory_bytes: 31900
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

signed main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    int ans=0;
    for(int i=1; i*i<=n; i++){
        if(n%i==0){
            int tmp=i-1,tmp2=n/i-1;
            if(tmp!=0)if(n%tmp==n/tmp)ans+=tmp;
            if(tmp2!=0)if(n%tmp2==n/tmp2)ans+=tmp2;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main () {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> C(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> C.at(i).at(j);
    }
  }
  for (int i = 0; i < 2*H; i++) {
    if (i%2 == 0) {
      for (int j = 0; j < W; j++) {
        cout << C.at(i/2).at(j);
        if (j == W-1) cout << endl;
      }
    }
    if (i%2 == 1) {
      for (int j = 0; j < W; j++) {
        cout << C.at((i-1)/2).at(j);
        if (j == W-1) cout << endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  vector<int> ans(n);
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int dst = min(j - i, abs(i - x) + 1 + abs(j - y));
      dst = min(dst, abs(i - y) + 1 + abs(j - x));
      ans[dst]++;
    }
  }	
  for (int i = 1; i < n; i++) {
    cout << ans[i] << '\n';
  }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

void output(vector<P> ans){
	for(int i = 0;i < ans.size();i++) cout << (i ? " " : "") << ans[i];
	cout << endl;
}

signed main(){
	int n,a[20],b[20];
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	for(int i = 0;i < n;i++) cin >> b[i];
	int ans = INF;
	for(int i = 0;i < (1 << n);i++){
		vector<P> es,os;
		int odd = 0;
		for(int j = 0;j < n;j++){
			if((i >> j) & 1){
				odd++;
				((j % 2) ? es : os).emplace_back(b[j],j);
			}else{
				((j % 2) ? os : es).emplace_back(a[j],j);
			}
		}
		if((odd % 2) || (n / 2 != os.size())) continue;
		sort(all(es));
		sort(all(os));
		int prv = -1,sum = 0;
		bool exist[20];
		for(int j = 0;j < n;j++) exist[j] = true;
		for(int j = 0;j < n;j++){
			P p = ((j % 2) ? os : es)[j / 2];
			if(p.first < prv) sum = INF;
			for(int k = 0;k < p.second;k++) sum += exist[k];
			exist[p.second] = false;
			prv = p.first;
		}
		chmin(ans,sum);
	}
	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

const int N = 55;
char can[N][N][N];

int main() {
	for (int i = 0; i < N; ++i) {
		can[0][i][i] = 1;
	}
	for (int d = 1; d < N; ++d) {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				can[d][i][j] = can[d - 1][i][j] || can[d - 1][i % d][j];
			}
		}
	}

	int n = nxt();
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i) {
		a[i] = nxt();
	}
	for (int i = 0; i < n; ++i) {
		b[i] = nxt();
	}

	bool can_at_all = true;
	for (int i = 0; i < n; ++i) {
		if (!can[N - 1][a[i]][b[i]]) {
			can_at_all = false;
		}
	}
	if (!can_at_all) {
		puts("-1");
		return 0;
	}

	vector<vector<int>> poss(n);
	for (int i = 0; i < n; ++i) {
		poss[i] = {a[i]};
	}

	long long ans = 0;
	for (int d = N - 1; d > 0; --d) {
		bool can_without = true;
		for (int i = 0; i < n; ++i) {
			bool tmp = false;
			for (int x : poss[i]) {
				if (can[d - 1][x][b[i]]) {
					tmp = true;
				}
			}
			can_without &= tmp;
		}
		if (!can_without) {
			ans |= 1ll << d;
			vector<vector<int>> new_poss(n);
			for (int i = 0; i < n; ++i) {
				for (int x : poss[i]) {
					for (int y : {x % d, x}) {
						if (can[d - 1][y][b[i]]) {
							new_poss[i].push_back(y);
						}
					}
				}
				make_unique(new_poss[i]);
			}
			poss = new_poss;
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <limits>
#define ll long long
using namespace std;
int main(){
    double R,G;
    cin >> R >> G;
    double ans=0;
    ans = (G-R)+G;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  string s;
  int a=0;
  cin >>s;
  for (int i = 0; i < s.size(); i++){
   if(s[i]=='x'){
     a++;
   }
  }
  if(a>=8){
    cout<<"NO\n";
  }else{
    cout<<"YES\n";
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;
 
typedef long long int ll;

const ll INF=(ll)1e18;

int N,K;
int main(){
    cin >> N >> K;

    map<int, int> m;
    REP(i,N){
        int a;
        cin >> a;
        m[a]++;
    }
    vector<pair<int, int> > v;
    for(auto itr = m.begin(); itr != m.end(); itr++){
        v.push_back(make_pair(itr->second, itr->first));
    }
    sort(v.begin(), v.end());

    int ans = 0;
    if(v.size() > K){
        REP(i,v.size()-K){
            ans += v[i].first;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 11764
# 2020/06/14
# AtCoder Beginner Contest 170 - B

# Input
x, y = map(int,input().split())

# Calc
# i is Tsuru
ans = 'No'
for i in range(0, 101):
    # j is Kame
    for j in range(0, 101):
        if i + j == x and i * 2 + j * 4 == y:
            ans = 'Yes'
            break

# Output
print(ans)


Measured memory_bytes: 9188
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if p[i-1]<p[i] and p[i]<p[i+1]:
    ans+=1
  if p[i+1]<p[i] and p[i]<p[i-1]:
    ans+=1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mod (100000007)
using namespace std;
typedef long long ll;
struct po{ll x,y;};
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
ll w,h,a1,a2,b1,b2;

void Add(ll &a,ll b){a=(a+b)%mod;}

po D[1001][1001];
ll bfs(po s,po g){
  for(int i=0;i<1001;i++)
    for(int j=0;j<1001;j++) D[i][j]=(po){-1,0};
  
  queue<po> Q;
  Q.push(s);
  D[s.y][s.x]=(po){0,1};
  

  while(!Q.empty()){
    po t=Q.front();Q.pop();

    for(int i=0;i<4;i++){
      int nx=(w+t.x+dx[i])%w;
      int ny=(h+t.y+dy[i])%h;
      if(D[ny][nx].x==D[t.y][t.x].x+1)Add(D[ny][nx].y,D[t.y][t.x].y);
      else if(D[ny][nx].x==-1){
	D[ny][nx]=D[t.y][t.x];
	D[ny][nx].x++;
	Q.push((po){nx,ny});
      }
    }    
  }
  return D[g.y][g.x].y%mod;
}


int main(){
  cin>>w>>h>>a1>>a2>>b1>>b2;
  cout<<bfs((po){a1,a2},(po){b1,b2})<<endl;;
}

Measured memory_bytes: 18840
"""
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]

mod = 1000000007

ab1 = []
ab2 = []
ab3 = []
ab4 = []
count00 = 0
count01 = 0
count10 = 0

for i in range(n):
    if ab[i][0] != 0 and ab[i][1] != 0:
        ab1.append(ab[i][0]/ab[i][1])
        ab2.append(-ab[i][1]/ab[i][0])
        if ab[i][0]/ab[i][1] > 0:
            ab3.append((ab[i][0]/ab[i][1],-ab[i][1]/ab[i][0]))
        else:
            ab4.append((ab[i][0]/ab[i][1],-ab[i][1]/ab[i][0]))
    elif ab[i][0] == 0 and ab[i][1] == 0:
        count00 += 1
    elif ab[i][0] == 0 and ab[i][1] == 1:
        count01 += 1
    else:
        count10 += 1

dict1 = {}
dict2 = {}
ab3.sort()
ab4.sort(reverse = True)

print(ab3)
print(ab4)

for i in ab1:
    if i in dict1:
        dict1[i] += 1
    else:
        dict1[i] = 1

for i in ab2:
    if i in dict2:
        dict2[i] += 1
    else:
        dict2[i] = 1

sorted1 = sorted(dict1.items(), key = lambda x: x[0])
sorted2 = sorted(dict2.items(), key = lambda x: x[0])

print(sorted1)
print(sorted2)

cnt = 0
num1 = n - count00 - count01 - count10
ans = 0
for i in range(len(ab3)):
    a,b = ab3[i]
    num1 -= 1
    if cnt < len(sorted2):
        while cnt < len(sorted2):
            if sorted2[cnt][0] == a:
                ans += pow(2, num1+count01+count10-sorted2[cnt][1], mod)
                ans %= mod
                break
            elif sorted2[cnt][0] < a:
                cnt += 1
            else:
                ans += pow(2, num1+count01+count10, mod)
                ans %= mod
                break
        else:
            ans += pow(2, num1+count01+count10, mod) - pow(2, )
            ans %= mod
    print(ans)

for i in range(len(ab4)):
    num1 -= 1
    ans += pow(2, num1+count01+count10, mod)
    ans %= mod
    print(ans)

ans += pow(2, count01, mod) -1
print(ans)
ans += pow(2, count10, mod) -1
print(ans)
ans += count00
print(ans)

print(ans % mod)
"""

from math import gcd

n = int(input())

dict1 = {}
mod = 1000000007
cnt00 = 0
cnt01 = 0
cnt10 = 0

for _ in range(n):
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        cnt00 += 1
    elif a == 0:
        cnt01 += 1
    elif b == 0:
        cnt10 += 1
    else:
        c = gcd(a,b)
        if b < 0:
            a *= -1
            b *= -1
        set1 = (a//c, b//c)
        if set1 in dict1:
            dict1[set1] += 1
        else:
            dict1[set1] = 1

ans = 1

for k,v in dict1.items():
    a,b = k
    if dict1[(a,b)] == -1:
        continue
    if a > 0:
        if (-b,a) in dict1:
            ans *= 2**v + 2**dict1[(-b,a)] - 1
            dict1[(-b,a)] = -1
        else:
            ans *= 2**v
    else:
        if (b,-a) in dict1:
            ans *= 2**v + 2**dict1[(b,-a)] - 1
            dict1[(b,-a)] = -1
        else:
            ans *= 2**v
    ans %= mod

ans *= 2 ** cnt01 + 2 ** cnt10 - 1
ans += cnt00 - 1

print(ans%mod)


Measured memory_bytes: 118700