akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/perl

use strict;
use warnings;

my ($a, $b, $c);
{
    my $in = <STDIN>;
    ($a, $b, $c) = split(" ", $in);
}
my $ans = "No";

if ($a==$b && $a==$c)
{}
elsif ($a==$b || $a==$c || $b==$c)
{
    $ans = "Yes";
}

print "$ans\n";

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

#define lint long long

#define Pair pair<string, int>;
const int INF = 1E9;

int main(){
    int N, M;
    cin >> N >> M;
    
    vector<int> k(M), p(M);
    vector<vector<int>> s(M);
    
    for(int i = 0; i < M; ++i){
        cin >> k[i];
        s[i].resize(k[i]);
        for(int j = 0; j < k[i]; ++j){
            int temp;
            cin >> temp;
            s[i][j] = temp - 1;
        }
    }
    for(int i = 0; i < M; ++i){
        cin >> p[i];
    }
    
    vector<bool> lamp(N);
    int count = 0;
    
    for(int i = 0; i < pow(2, N); ++i){
        bool flag = true;
        
        for(int j = 0; j < N; ++j){
            lamp[j] = (i >> j) %2;
        }
        
        for(int j = 0; j < M; ++j){
            int sum = 0;
            for(int l = 0; l < k[j]; ++l){
                sum += lamp[s[j][l]];
            }
            
            if(sum % 2 != p[j]){
                flag = false;
            }
            if(!flag){
                break;
            }
        }
        if(flag){count ++;}
        
    }
    
    cout << count << endl;
    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
	return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
	return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)

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

	printf("%d\n", n * n * n);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a[4];
    int dem=0;
    for (int i=0;i<3;i++){
        cin>>a[i];
    }
    sort(a,a+3);
    // cout<<b<<" "<<c<<" ";
    for (int i=a[1];i<a[2]-1;i+=2){
        a[1]+=2;
        dem++;
    }
    for (int i=a[0];i<a[2]-1;i+=2){
        a[0]+=2;
        dem++;
    }
    int b=a[2]-a[1];
    int c=a[2]-a[0];
    if (b==c && c==0){
        cout<<dem;
    }
    else if (b==c && c==1){
        dem+=1;
        cout<<dem;
    }
    else if (b!=c && a[1]==a[2] || b!=c && a[0]==a[2]){
        dem+=2;
        cout<<dem;
    }
  

    return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end

int mod=998244353;
struct Mint {
    int val;
    Mint inv() const{
        int tmp,a=val,b=mod,x=1,y=0;
        while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
        return Mint(x);
    }
public:
    Mint():val(0){}
    Mint(ll x){if((val=x%mod)<0)val+=mod;}
    Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
    Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;}
    Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
    Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;}
    Mint& operator/=(const Mint& x){return *this*=x.inv();}
    Mint operator+(const Mint& x) const{return Mint(*this)+=x;}
    Mint operator-(const Mint& x) const{return Mint(*this)-=x;}
    Mint operator*(const Mint& x) const{return Mint(*this)*=x;}
    Mint operator/(const Mint& x) const{return Mint(*this)/=x;}
};
struct factorial {
    vector<Mint> Fact, Finv;
public:
    factorial(int maxx){
        Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1);
        Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i;
    }
    Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];}
    Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];}
    Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];}
};

Mint dp[200010][3][3][2];

int main(){
    string s; cin>>s; int n=s.size(),r=0;
    if(n==3){
        if(s[0]==s[1]&&s[1]==s[2])printf("1\n");
        else if(s[0]==s[1]||s[1]==s[2])printf("6\n");
        else if(s[0]==s[2])printf("7\n");
        else printf("3\n"); return 0;
    }
    rep(i,0,n)r+=(s[i]-'a'); r%=3;
    bool f=1;
    rep(i,0,n-1)if(s[i]!=s[i+1])f=0;
    if(f){printf("1\n"); return 0;}
    rep(i,0,3)dp[0][i][i][0]=1;
    rep(i,0,n-1)rep(j,0,3)rep(k,0,3)rep(l,0,2)if(dp[i][j][k][l].val){
        rep(nxt,0,3){
            dp[i+1][nxt][(k+nxt)%3][l|(j==nxt)]+=dp[i][j][k][l];
        }
    }
    Mint ans=0;
    rep(i,0,3)ans+=dp[n-1][i][r][1];
    f=0;
    rep(i,0,n-1)if(s[i]==s[i+1])f=1; ans+=!f;
    printf("%d\n",ans.val);
    return 0;
}

Measured memory_bytes: 14720
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main(void)
{
    int A, B, C, ans;
    scanf("%d %d %d", &A, &B, &C);
    ans = B + C - A;
    if (ans >= 0) {
        printf("%d", ans);
    }
    else {
        printf("0");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N;
    cin >> N;
    map<string,ll> m;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    auto begin=m.begin();auto end=m.end();
    ll sum = 0;
    for (auto iter = begin; iter != end; ++iter) {
        sum += (iter->second) * (iter->second-1)/2;
    }
    cout << sum << endl;
}


Measured memory_bytes: 11136
// D - Disjoint Set of Common Divisors
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b){
	if(a<b) swap(a,b);
	while(b){ll r =a%b; a=b; b=r;}
	return a;
}

ll p_count(ll n){
	ll count = 0;
	if((n&1) == 0) count++;
	while((n&1) == 0) n >>= 1;

	for(ll p=3; p*p<=n; p+=2){
		if(n%p) continue;
		count++;
		while(n%p == 0) n /= p;
	}

	if(n != 1) count++;
	return count;
}

int main(){
	ll A,B; cin>>A>>B;
	cout<< p_count(gcd(A,B)) + 1 <<endl;;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    N, A, B = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int

    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))

    r = N // (A + B)
    q = N % (A + B)

    print(A * r + min(q, A))


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """8 3 4"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8 0 4"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6 2 4"""
        output = """2"""
        self.assertIO(input, output)

Measured memory_bytes: 6392
#　A - Can't Wait for Holiday
S = str(input())
if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

using Complex = complex<double>;

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

  vector<Complex> xs(3);
  REP(i,3){
	double x, y;
	cin >> x >> y;
	xs[i] = Complex(x, y);
  }

  vector<double> rs(3);
  REP(i,3) rs[i] = abs(xs[i] - xs[(i+1)%3]);
  double mx = *max_element(ALL(rs));

  double s = accumulate(ALL(rs), 0.) / 2.;
  double S = accumulate(ALL(rs), s, [s](double acc, double x){ return acc * (s-x); });
  S = sqrt(S);
  double R = S / s;
  
  double lb = 0., ub = R;
  REP(_,100){
	double m = (lb + ub) / 2.;
	if(mx * (1. - m / R) >= 2*m) lb = m;
	else ub = m;
  }
  cout << fixed << setprecision(12) << lb << endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
  ll res = 1;
  while(b){
    if(b&1)res = res * x % MOD;
    x = x * x % MOD;
    b>>=1;
  }
  return res;
}

ll modinv(ll x){
  return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

template<class t>
void in(t&x){
  cin >> x;
}

ll func(){
  ll w = in();
  ll h = in();
  if(h>w)swap(h,w);
  if(h==1)return 1;
  return h/2*w + (h&1)*(w+1)/2;
}

int main(){
  cout << func () << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

#define MAX 100002

int main() {
  int n;
  int a, b;
  int v[MAX] = {};
  
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    v[a] ++;
    v[b+1] --;
  }

  int now = 0;
  int ans = 0;
  for(int i=0; i<MAX; i++) {
    now += v[i];
    if(i <= now+1) ans = i-1;
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1560
#include<stdio.h>

int main(void){
	int n;
    int i;
    int sum_recover = 0;
    scanf("%d",&n);

    int d[n];

    for (i = 0; i < n; i++){
    	scanf("%d", &d[i]);
    }

    for (i = 0; i < n - 1; i++){
    	for (int j = i + 1; j < n; j++){
    		sum_recover += d[i] * d[j];
    	}

    }

    printf("%d", sum_recover);


    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#define MOD 1000000007
#define MAX_N 53
#define INF 100000

#define ll long long
#define forall(i,a,b) for(int i = a; i < b; ++i)
#define sd(s) scanf("%d", &s)
#define sc(s) scanf("%c", &s)
#define sll(s) scanf("%lld", &s)
#define mp(a,b) make_pair(a,b)

using namespace std;

struct edge {
	int u;
	int v;
	int cost;

	// Decending Order 
	bool operator<(const edge& r) const {
		return cost > r.cost;
	}
};

int N;
string s1, s2;
ll Prev[9];
ll Temp[9];

int main() {
	sd(N);
	cin >> s1;
	cin >> s2;
	int a;
	if (s1[0] == s2[0]) Prev[0] = 1, Prev[4] = 1, Prev[8] = 1, a = 1;
	else {
		Prev[1] = 1;
		Prev[2] = 1;
		Prev[3] = 1;
		Prev[5] = 1;
		Prev[6] = 1;
		Prev[7] = 1;
		a = 2;
	}
	// 0 : 00
	// 1 : 01
	// 2 : 02
	// 3 : 10
	// 4 : 11
	// 5 : 12
	// 6 : 20
	// 7 : 21
	// 8 : 22
	forall(i, a, N) {
		if (s1[i] == s2[i]) {
			Temp[0] = Prev[4] + Prev[5] + Prev[7] + Prev[8];
			Temp[4] = Prev[0] + Prev[2] + Prev[6] + Prev[8];
			Temp[8] = Prev[0] + Prev[1] + Prev[3] + Prev[4];
		}

		else {
			Temp[1] = Prev[3] + Prev[5] + Prev[6] + Prev[8];
			Temp[2] = Prev[3] + Prev[4] + Prev[6] + Prev[7];
			Temp[3] = Prev[8] + Prev[1] + Prev[2] + Prev[7];
			Temp[5] = Prev[0] + Prev[1] + Prev[6] + Prev[7];
			Temp[6] = Prev[1] + Prev[2] + Prev[4] + Prev[5];
			Temp[7] = Prev[0] + Prev[2] + Prev[3] + Prev[5];
			i += 1;
		}
		forall(j, 0, 9) {
			Prev[j] = (Temp[j] % MOD);
			Temp[j] = 0;
			//cout << Prev[j] << " ";
		}
		//cout << i << endl;
	}

	ll ret = 0;
	forall(i, 0, 9) ret += Prev[i];
	cout << (ret % MOD) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class T> struct FenwickTree {
  const int n;
  V<T> t;
  FenwickTree(int n) : n(n), t(n + 1) {}
  void add(int i, T x) { for (++i; i <= n; i += i & -i) t[i] += x; }
  T sum(int i) const {
    T s = 0;
    for (; i; i -= i & -i) s += t[i];
    return s;
  }
  T sum(int l, int r) const { return sum(r) - sum(l); }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  int m = n * (n - 1) / 2;
  V<double> a(n), b(n), c(n); for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];
  auto fn = [&]() -> double {
    V<> idx(n);
    iota(begin(idx), end(idx), 0);
    sort(begin(idx), end(idx), [&](int i, int j) { return -a[i] / b[i] < -a[j] / b[j]; });
    V<> ord(n);
    for (int i = 0; i < n; ++i) {
      ord[idx[i]] = i;
    }
    auto chk = [&](double x) -> bool {
      sort(begin(idx), end(idx), [&](int i, int j) { return (c[i] - a[i] * x) / b[i] < (c[j] - a[j] * x) / b[j]; });
      FenwickTree<int> ft(n);
      int k = 0;
      for (int i : idx) {
        k += ft.sum(ord[i]);
        ft.add(ord[i], 1);
      }
      return k >= m + 1 >> 1;
    };
    double ng = -1e10, ok = 1e10;
    for (int _ = 0; _ < 100; ++_) {
      double mid = (ng + ok) / 2;
      (chk(mid) ? ok : ng) = mid;
    }
    return ok;
  };
  cout << fixed << setprecision(15) << fn() << ' ';
  swap(a, b);
  cout << fn() << '\n';
}

Measured memory_bytes: 1696
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


int main(){

	int Q,N,count,tmp,max,S;
	bool FLG;
	scanf("%d",&Q);
	bool* table = new bool[1000001];

	for(int loop = 0; loop < Q; loop++){

		count = 0;
		scanf("%d",&N);
		for(int i = 0; i <= N;i++)table[i] = false;
		table[N] = true;

		FLG = false;
		while(true){
			if(N/10 == 0)break;

			max = 0;

			for(S = 10;N/S != 0; S *= 10){
				tmp = (N/S)*(N%S);
				max = (max >= tmp)?max:tmp;
			}
			N = max;
			if(table[N] == true){
				FLG = true;
				break;
			}else{
				table[N] = true;
				count++;
			}
		}

		if(FLG){
			printf("-1\n");
		}else{
			printf("%d\n",count);
		}

	}

	return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <cmath>

using namespace std;


bool isPrime(int num){
    if(num==2)
        return true;
    if(num%2==0)
        return false;

    for(int i=3; i<=std::sqrt(num); i+=2){
        if(num%i==0)
            return false;
    }
    return true;
}

int main() {
    int X;
    cin >> X;

    for(int i=X; i<=std::numeric_limits<int>::max() ; i++){
        if(isPrime(i)){
            cout << i << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  

int N;
vvi G;
vp E;
vi c;
vi anss;
vi visited;

int getNodeNum(int root) {
  int ans = 1;
  visited[root] = true;
  rep(i,sz(G[root])) {
    if(!visited[G[root][i]]) {
      ans += getNodeNum(G[root][i]);
    }
  }
  return ans;
}

void dfs(int root,int parent) {
  if(anss[root] != -1) return;
  anss[root] = c[0];
  c.erase(c.begin()+0);
  vi near = G[root];
  rep(i,sz(near)) {
    if(near[i] == parent){
      near.erase(near.begin()+i);
    }
  }
  vp nearL(sz(near));
  rep(i,sz(near)) {
    visited = vi(N,false);
    visited[root] = true;
    int n = getNodeNum(near[i]);
    nearL[i] = P(n,near[i]);
  }
  sort(rng(nearL));
  reverse(rng(nearL));
  rep(i,sz(near)) {
    dfs(nearL[i].second,root);
  }
}
int main() {
  cin >> N;
  G = vvi(N);
  E = vp(N-1);
  c = vi(N);
  anss = vi(N,-1);

  rep(i,N-1) {
    int a,b;
    cin >> a >> b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
    E[i] = P(a-1,b-1);
  }
  rep(i,N) {
    cin >> c[i];
  }
  sort(rng(c));
  reverse(rng(c));
  vp nodes(N);
  rep(i,N) {
    nodes[i] = P(sz(G[i]),i);
  }
  sort(rng(nodes));
  int r = nodes[N-1].second;
  dfs(r,-1);
  
  int ans1 = 0;
  vi ans2(N);
  rep(i,N-1) {
    int a = E[i].first;
    int b = E[i].second;
    ans2[i] = min(anss[a],anss[b]);
    ans1 += ans2[i];
  }
  cout << ans1 << endl;
  rep(i,N) {
    if(i < N-1) cout << anss[i] << " ";
    else cout << anss[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main()
{
	char test[1000];
	int num1;

	cin>>test;
	num1=strlen(test);
	for(int j=0;j<num1;j++){
		if(test[j]=='A'){
			test[j]='X';
			goto AA;
		}
		if(test[j]=='B'){
			test[j]='Y';
			goto AA;
		}
		if(test[j]=='C'){
			test[j]='Z';
			goto AA;
		}
		if(test[j]=='D'){
			test[j]='A';
			goto AA;
		}
		if(test[j]=='E'){
			test[j]='B';
			goto AA;
		}
		if(test[j]=='F'){
			test[j]='C';
			goto AA;
		}
		if(test[j]=='G'){
			test[j]='D';
			goto AA;
		}
		if(test[j]=='H'){
			test[j]='E';
			goto AA;
		}
		if(test[j]=='I'){
			test[j]='F';
			goto AA;
		}
		if(test[j]=='J'){
			test[j]='G';
			goto AA;
		}
		if(test[j]=='K'){
			test[j]='H';
			goto AA;
		}
		if(test[j]=='L'){
			test[j]='I';
			goto AA;
		}
		if(test[j]=='M'){
			test[j]='J';
			goto AA;
		}
		if(test[j]=='N'){
			test[j]='K';
			goto AA;
		}
		if(test[j]=='O'){
			test[j]='L';
			goto AA;
		}
		if(test[j]=='P'){
			test[j]='M';
			goto AA;
		}
		if(test[j]=='Q'){
			test[j]='N';
			goto AA;
		}
		if(test[j]=='R'){
			test[j]='O';
			goto AA;
		}
		if(test[j]=='S'){
			test[j]='P';
			goto AA;
		}
		if(test[j]=='T'){
			test[j]='Q';
			goto AA;
		}
		if(test[j]=='U'){
			test[j]='R';
			goto AA;
		}
		if(test[j]=='V'){
			test[j]='S';
			goto AA;
		}
		if(test[j]=='W'){
			test[j]='T';
			goto AA;
		}
		if(test[j]=='X'){
			test[j]='U';
			goto AA;
		}
		if(test[j]=='Y'){
			test[j]='V';
			goto AA;
		}
		if(test[j]=='Z'){
			test[j]='W';
			goto AA;
		}
		AA:;
	}
	for(int l=0;l<num1;l++){
		cout<<test[l];
	}
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 1104
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<bitset>
#include<random>
#include<cstdint>
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
ll longinf=(1ll<<60);
ll inf=1ll<<29;
int main(){
      int D;
      cin>>D;
      cout<<"Christmas";
      rep0(i,25-D) cout<<" Eve";
      return 0;
}

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

typedef long long ll;

int main() {
    multimap<string,int> m;
    int q; cin >> q;
    for(int i=0; i<q; i++){
        int query;
        cin >> query;
        if(query==0){
            string key; int x;
            cin >> key >> x;
            m.insert(make_pair(key,x));
        }
        else if(query==1){
            string key;
            cin >> key;
            auto p = m.equal_range(key);
            for(auto it=p.first; it!=p.second; it++){
                cout << it->second << endl;
            }
        }
        else if(query==2){
            string key;
            cin >> key;
            auto p = m.equal_range(key);
            m.erase(p.first,p.second);
        }
        else if(query==3){
            string L,R;
            cin >> L >> R;
            auto l = m.lower_bound(L);
            auto r = m.upper_bound(R);
            for(auto itr=l; itr!=r; itr++){
                if(itr->second!=0) cout << itr->first <<" "<< itr->second << endl;
            }
        }
    }
}



Measured memory_bytes: 24748
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

int main()
{
  ll a,b, x;
  cin >> a >> b >> x;

  ll ans;

  if(a == 0)
    ans = b/x + 1;
  else
    ans = b/x - (a-1)/x;


  cout << ans << endl;
}


Measured memory_bytes: 3588
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){
    string s; cin >> s;
    int cnt = 0;
    for(char c: s){
        int num = c - '0';
        cnt += num;
    }
    if(cnt%9==0)cout << "Yes" << ln;
    else cout << "No" << ln;
}
    


Measured memory_bytes: 3716
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();

    if ((b - a) <= 0) {
      System.out.println("delicious");
    } else if ((b - a) <= x) {
      System.out.println("safe");
    } else {
      System.out.println("dangerous");
    }

  }
}

Measured memory_bytes: 35592
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#include<cmath>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<list>
#include<deque>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<chrono>


/*  auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<milliseconds>(stop - start);
pr(duration.count());    */


#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define siz         100009
#define mp          make_pair
#define ll          long long int
#define inf         1000000007
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define pi          acos(-1.0)
#define all(x)      x.begin(),x.end()
#define ull		    unsigned long long int
#define m(a)	    memset(a,0,sizeof(a))
#define f(i,n)	    for(ll i=0;i<n;i++)
#define sc(a)	    scanf("%lld",&a)
#define pr(a)	    printf("%lld\n",a)
using namespace std;
int main()
{
	FastIO;
	ll a,b,c,d,i;
	map<ll,ll>m;
	cin >> a;
	for (i = 0; i < a - 1; i++)
	{
		cin >> b;
		m[b]++;
	}
	for (i = 1; i <= a; i++)
		cout << m[i] << endl;
	return 0;
}


Measured memory_bytes: 16160
#include<stdio.h>

int main(){
	int m[10],i,j,big;
	for(i=0;i<10;i++){
		scanf("%d",&m[i]);
	}
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			if(m[i]>m[j]){
				big=m[i];
				m[i]=m[j];
				m[j]=big;
			}
		}
	}
	for(i=0;i<3;i++){
		printf("%d\n",m[i]);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

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

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, x;
    cin >> n >> x;
    
    int ans = 0;
    if(x > 0) ans -= x;
    else if(-x >= n) ans -= x + n - 1;

    REP(i, n) ans += x+i;
    cout << ans << endl;
}


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

int main(){
//srandom((unsigned long)time(NULL));

int n;
cin>>n;
vector<int> s;
int sum=0;
for(int i=0;i<n;i++){
    int x;
    cin>>x;
    s.emplace_back(x);
    sum+=x;
}
if(sum%10!=0){
    cout<<sum<<endl;
    return 0;
}
sort(s.begin(),s.end());
int ans=0;
for(int i=0;i<n;i++){
    if(s[i]%10!=0){
        ans=sum-s[i];
        break;
    }
    ans=0;
}
cout<<ans<<endl;


return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
//const long long MOD = 998244353;
long long MOD;
using namespace std;


int main(int argc, char* argv[])
{
    ll n;
    scanf("%lld", &n);

    ll min=LINF;
    int m=(int)sqrt((double)n+1);
    int i;
    for(i=1; i<=m; i++) {
        if(n%i==0) {
            ll j=n/i;
            min=MIN(min,(i-1)+(j-1));
        }
    }
    printf("%lld\n", min);

    return 0;
}


Measured memory_bytes: 128
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long

const int maxn = 1e5 + 7;
const LL mod = 1e9 + 7;

LL fac[maxn],finv[maxn],inv[maxn];
LL a[maxn];

void Cominit(int SIZE,LL mod) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2 ; i < SIZE ; 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 Com(int n,int m,LL mod) {
    if(n < m) return 0;
    if(n < 0 || m < 0) return 0;
    return (fac[n]*((finv[m]*finv[n-m])%mod))%mod;
}

int main() {
    Cominit(maxn,mod);
//    for(int i = 0 ; i <= 6 ; i++) {
//        for(int j = 0; j <= i ; j++) {
//            cout << Com(i,j) << " ";
//        }
//        cout << endl;
//    }
	int n,k;
	while(~scanf("%d%d",&n,&k)) {
        for(int i = 1 ; i <= n ; i++) {
            scanf("%lld",&a[i]);
        }
        sort(a+1,a+n+1);
        LL MIN = 0 , MAX = 0;
        for(int i = k ; i <= n ; i++) {
//            cout << Com(i-1,k-1) << " ";
            MAX = ((MAX%mod) + (Com(i-1,k-1,mod)*a[i])%mod)%mod;
        }
//        cout << endl;
        for(int i = 1 ; i <= n - k + 1 ; i++) {
            MIN = ((MIN%mod) + (Com(n-i,k-1,mod)*a[i])%mod)%mod;
        }
//        cout << MAX << " " << MIN << endl;
        printf("%lld\n",(MAX - MIN + mod)%mod);
	}
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 998244353;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

int main(){
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    vector<vector<mint>> dp(C+1, vector<mint>(D+1));
    dp[A][B] = 1;
    for(ll i = A; i<C; i++){
        dp[i+1][B] = mint(B)*dp[i][B];
    }
    for(ll i = B; i<D; i++){
        dp[A][i+1] = mint(A)*dp[A][i];
    }
    REP(i,A,C){
        REP(j,B,D){
            dp[i+1][j+1] = mint(j+1)*dp[i][j+1] + mint(i+1)*dp[i+1][j];
            dp[i+1][j+1] -= dp[i][j]*i*j;
        }
    }
    cout << dp[C][D] << endl;
}

Measured memory_bytes: 73648
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string t=s;
  reverse(t.begin(),t.end());
  int l=s.size(),i=0,j=0,ans=0;
  while(1){
    if(s[i]==t[j]){
      i++;
      j++;
    }else if(s[i]=='x'){
      ans++;
      i++;
    }else if(t[j]=='x'){
      ans++;
      j++;
    }else {
      puts("-1");
      return 0;
    }
    
    if(i==l&&j==l){
      ans/=2;
      cout << ans << endl;
      return 0;
    }
  }
}

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

int main() {
  int l, r, d;
  cin >> l >> r >> d;
  int count = 0;
  for (int i = l; i <= r; i++) {
    if (i % d == 0) count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int maxn = 1000100;
const int base = 1e9+7;

int n;
ll fac[maxn],ifac[maxn];

ll pw(int a,int n) {
    if (n==0) return 1ll;
    if (n==1) return a;
    ll tg = pw(a,n/2);
    tg = (tg*tg) % base;
    if (n%2) return (tg*a)%base;
    return tg;
}

ll C(int k,int n) {
    if (k > n) return 0;
    return (fac[n] * ifac[k] % base * ifac[n-k])%base;
}

int main() {
    //freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    fac[0] = 1, ifac[0] = 1;
    for (int i=1;i<maxn;i++) {
        fac[i] = (fac[i-1]*1ll*i)%base;
        ifac[i] = pw(fac[i],base-2);
    }
    //cout<<C(1,1)<<endl;
    cin>>n;
    ll res=fac[n];
    for (int i=1;i<n;i++) {
        res = (res - C(n-i-1,i-1) * fac[i] %base * fac[n-i-1] % base + base) % base;
    }
    cout<<res;
}



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

typedef complex<double> P;
typedef pair<P,P> L;

struct Circle{
  double r;
  P c;
  Circle(){}
  Circle(double r,P c): r(r),c(c) {}
};

const double INF = 1e+8;
const double EPS = 1e-8;

bool equal(double a, double b){ return fabs(a-b) < EPS;}

double dot(P a, P b){ return real(conj(a)*b);}
double cross(P a, P b){ return imag(conj(a)*b); }

int contains(vector<P> v, P p){ 
  bool in = false; 
  for(int i=0;i<v.size();i++){ 
    P a = v[i] - p; 
    P b = v[(i+1)%v.size()] - p; 
    if(imag(a) > imag(b)) swap(a,b); 
    if(imag(a) <= EPS && EPS < imag(b)) 
      if(cross(a,b) < -EPS) in = !in; 
    if(equal(cross(a,b), 0.0) && dot(a,b) < EPS) return 1; 
  } 
  return in ? 2 : 0; 
} 

P proj(P p, L l){
  return l.first + dot(p - l.first, l.second - l.first) / norm(l.second - l.first) * (l.second - l.first);
}

bool isIntersectSP(L s, P p){ 
  return abs(s.first-p) + abs(s.second-p) - abs(s.second-s.first) < EPS; 
}

bool isIntersectCS(Circle c, L s){
  P h = proj(c.c, s);
  double d = abs(c.c - h);
  
  if(d > c.r + EPS) return false;
  else if(d > c.r - EPS){
    //return isIntersectSP(s,h);
    return false;
  }
  else {
    P v = s.second - s.first;
    v = (sqrt(c.r*c.r - d*d) / abs(v)) * v;
    if(isIntersectSP(s, h+v)) return true;
    if(isIntersectSP(s, h-v)) return true;
    return false;
  }  
}


int n,r;
vector<int> v[50];
vector<P> line;

bool check(Circle c){ 
  if(contains(line, c.c) == 0) return false;
  for(int i=0;i<line.size();i++){
    if(abs(line[i] - c.c) < c.r - EPS || isIntersectCS(c, L(line[i],line[(i+1)%line.size()]))) return false;
  }
  return true;
}

void solve(){
  for(int i=0;i<50;i++){
    v[i].push_back(0);
    sort(v[i].begin(), v[i].end(), greater<int>());      
  }
  
  line.clear();
  for(int i=49;i>=0;i--){
    if(i != 49 && v[i][0] != v[i+1][0]) line.push_back(P(i-24, v[i][0]));
    line.push_back(P(i-25, v[i][0]));
  }
  line.push_back(P(-INF, 0));
  line.push_back(P(-INF, -INF));
  line.push_back(P(INF, -INF));
  line.push_back(P(INF, 0));

  double st = 0.0, ed = INF, mid;
  while(!equal(ed,st)){
    mid = (st + ed) / 2.0;
    Circle c = Circle(r, P(0, mid - (double)r));
    if(check(c)) st = mid;
    else ed = mid;
  }
  
  printf("%.7f\n", mid);
}

int main(){
  while( cin >> r >> n && (r|n) ){
    for(int i=0;i<50;i++) v[i].clear();
    for(int i=0;i<n;i++){
      int x1,x2,h;
      cin >> x1 >> x2 >> h;
      for(int j=x1;j<x2;j++) v[j+25].push_back(h);
    }
    
    solve();
  }
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 1e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int N;
  cin >> N ;
  cout << (N % 2 == 0? N : N * 2) << endl;
  
  
}


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

#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> a(n);
  Bint j("1000000000000000000");
  arep(i, a) cin >> i;
  sort(all(a));

  Bint ans = a[0];
  
  rep(i, 1, n) {
    ans *= a[i];
    if (ans > j) {
      cout << -1 << '\n';
      return 0;
    }
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4012
#include <iostream>
#include <algorithm>
#include <functional>
#include <utility>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <cmath>
#include <climits>
using namespace std;

#define rep(i,end)          rep2(i,0,(end))
#define rep2(i,beg,end)   for (int i=(beg);i<(end);i++)
#define all(cont)           begin(cont), end(cont)
#define inf                   LLONG_MAX
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef list<ll> li;
typedef pair<ll, ll> pii;
typedef pair<ll, string> pis;
typedef pair<string, ll> psi;

int main(void);

string gets(bool skipnewline);
vi get_n_array(int n);

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, x;
    cin >> k >> x;
    rep2(i, x - k+1, k + x)
    {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

string gets(bool skipToNextline)
{
    if (skipToNextline) gets(false);
    const int BUFF_MAX = 1024;
    char buf[BUFF_MAX];
    cin.getline(buf, sizeof(buf));
    return buf;
}

vi get_n_array(int n)
{
    vi v;
    while (n-- > 0) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    return v;
}

Measured memory_bytes: 256
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
if b[0]>a[0]:
    if a[1]==31 or a[1]==30 or a[1]==29 or a[1]==28:
        print('1')
    else:
        print('0')

else:
    print('0')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod=1000000007;
const double PI = 3.14159265359;
#define INF 1000000000000
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define count_1(n)  __builtin_popcountll(n)
#define parity(n)   __builtin_parityll(n)   //Even parity 0 as output
void show    (int a[], int arraysize) { for (int i = 0; i < arraysize; ++i)  {cout << a[i] << " ";}	cout<<endl;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
void sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}
int main()
{FAST
string s1,s2;
int v=0;
cin>>s1>>s2;
FOR(i,s1.size())
{
	if(s1[i]==s2[i])
	{
		continue;
	}
	else
	{
		v++;
		cout<<"No\n";
		break;
	}
}
if(v==0)
{
	cout<<"Yes\n";
}

return  0;
}





Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i< n;i++)
using P = pair<int,string>;

int main() {
  int a,b;
  cin>>a>>b;
  
  if (a%2==0 || b%2 == 0){
    cout << "Even" << endl;
  }
  else{
    cout << "Odd" <<endl;
  }
}

Measured memory_bytes: 256
class queue:
    listQ = []
    def push(self, x):
        self.listQ.append(x)
    def pop(self):
        a = self.listQ[0]
        del self.listQ[0]
        return a
    def length(self):
        return len(self.listQ)


n, m = map(int, input().split())
nodeMap = {}
doneL = [0]*(n+1)
doneL[1] = -1
for i in range(m):
    a, b = map(int, input().split())
    if a in nodeMap:
        nodeMap[a].append(b)
    else:
        nodeMap[a] = [b]
    if b in nodeMap:
        nodeMap[b].append(a)
    else:
        nodeMap[b] = [a]

q = queue()
q.push(1)
while q.length():
    poped = q.pop()
    popedL = nodeMap[poped]
    for r in popedL:
        if doneL[r] != 0:
            pass
        else:
            doneL[r] = poped
            q.push(r)
print("Yes")
for r in doneL:
    if r <= 0:
        pass
    else:
        print(r)

Measured memory_bytes: 40008
<?php
$r1=(int)trim(fgets(STDIN));
$r2=$r3=0;

for($i=1;$i<10;$i++){
  $d=(int)trim(fgets(STDIN));
  if($r1<$d){$r3=$r2;$r2=$r1;$r1=$d;}
  elseif($r2<$d){$r3=$r2;$r2=$d;}
  elseif($r3<$d){$r3=$d;}
}

echo $r1,PHP_EOL,$r2,PHP_EOL,$r3;
?>

Measured memory_bytes: 15368
#include <iostream>
#include <algorithm>
using namespace std;

const int MAX_M = 100005;

int n, m, X[MAX_M], R[MAX_M];

int main() {
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        cin >> X[i];
    }
    sort(X + 1, X + 1 + m);
    for(int i = 1; i < m; i++) {
        R[i] = X[i + 1] - X[i];
    }
    sort(R + 1, R + m);
    int wynik = 0;
    for(int i = 1; i <= m - n; i++) {
        wynik += R[i];
    }
    cout << wynik;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

int main(void)
{
    int a, n, m;
    int y, y2;
    long long x, x2;
    int num;
    
    scanf("%d%d%d", &a, &n, &m);
    
    num = 0;
    y = 1;
    while (1){
        x = pow(y + a, n);
        if (x > m){
            break;
        }

        x2 = x;
        y2 = 0;
        while (x2 > 0){
            y2 += (x2 % 10);
            x2 /= 10;
        }

        if (y2 == y){
            num++;
//printf("[%d]", x);
        }
        y++;
    }
    
    printf("%d\n", num);
    
    return (0);
}



Measured memory_bytes: 2104