akhauriyash/Code-Regression huggingface dataset:
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n: usize,
        mut a: [usize;n],
    }

    a.sort();
    a.reverse();
    let mut ans = 0;
    let mut index = 0;
    for i in 0..n-1 {
        if i%2==0 {
            ans += a[index];
            index += 1;
        } else {
            ans += a[index];
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 6212
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

string s2[100001];
int main() {

	int n;

	cin>>n;

	rep(i,n){
		char c[11];
		cin>>c[0]>>c[1]>>c[2]>>c[3]>>c[4]>>c[5]>>c[6]>>c[7]>>c[8]>>c[9];
		sort(c,c+10);
		s2[i]+=c[0];
		s2[i]+=c[1];
		s2[i]+=c[2];
		s2[i]+=c[3];
		s2[i]+=c[4];
		s2[i]+=c[5];
		s2[i]+=c[6];
		s2[i]+=c[7];
		s2[i]+=c[8];
		s2[i]+=c[9];
	}
	sort(s2,s2+n);

	ll t2=0,f=1;
	rep(i,n-1){
		if(s2[i]==s2[i+1]){
			t2+=f;
			f++;
		}else{
			f=1;
		}
	}
	cout<<t2<<endl;
	return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

/*UnionFind--------------------------*/
class UnionFind {
    using i32 = int_fast32_t;
private:
    std::vector<i32> parent;
    std::vector<i32> siz;

public:
    UnionFind(i32 sz): parent(sz), siz(sz, 1) {
        for(i32 i = 0; i < sz; ++i) parent[i] = i;
    }
    void init(i32 sz) {
        for(i32 i = 0; i < sz; ++i) parent[i] = i;
    }
    /*Member Func------*/
    /*return root id*/
    i32 root(i32 x) {
        while(parent[x] != x) {
            x = parent[x] = parent[parent[x]];
        }
        return x;
    }
    /*merge two groups*/
    bool merge(i32 x, i32 y) {
        x = root(x);
        y = root(y);
        if(x == y) return false;
        //Merge Tech
        if (siz[x] < siz[y]) std::swap(x,y);
        siz[x] += siz[y];
        parent[y] = x;
        return true;
    }
    /*同じ集合にあるか*/
    bool issame(i32 x, i32 y) {
        return (root(x) == root(y));
    }
    /*xの属する集合の大きさ*/
    i32 size(i32 x) {
        return siz[root(x)];
    }
};

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    ll n,m,a,b; cin >> n >> m;
    stack<pair<ll, ll>> inputs;
    rep(i,m) {
        cin >> a >> b;
        --a, --b;
        inputs.emplace(a,b);
    }

    UnionFind uf(n);
    stack<ll> ans;
    ll cnt = n*(n-1)/2;
    ans.push(cnt);
    while(inputs.size() > 1) {
        tie(a,b) = inputs.top(); inputs.pop();
        if(!uf.issame(a,b)) {
            cnt += uf.size(a)*(uf.size(a)-1)/2;
            cnt += uf.size(b)*(uf.size(b)-1)/2;
            uf.merge(a,b);
            cnt -= uf.size(a)*(uf.size(a)-1)/2;
        }
        ans.push(cnt);
    }

    while(ans.size()) {
        cout << ans.top() << '\n'; ans.pop();
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 4608
#include <stdio.h>

int main()
{
  char S[51];
  int N,i,count=0;

  scanf("%d", &N);
  scanf("%s",S);

  for(i=0; i<N-2; i++){
    if( S[i] != 'A')
      continue;
    if( S[i+1] != 'B')
      continue;
    if( S[i+2] == 'C')
      count++;
    }

  printf("%d", count);
return 0;
}


Measured memory_bytes: 1732
T=!!0
F=!T
[T,F].map{|c|
class<<c
alias:%:==
def!=x
!self|x
end
end
}
until gets=~/#/
puts (0..2047).all?{|x|
eval $_.tr("-=>*+abcdefghijk","!%=&|"+("%011b"%x).tr("01","TF"))
}?'YES':'NO'
end

Measured memory_bytes: 13020
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	cout << max(a+b, max(a*b, a-b)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	map<int,int>mp;
	for(int i=0;i<n-1;i++)
	{
		int a;
		cin>>a;
		mp[a]++;
	}
	for(int i=1;i<=n;i++)
	cout<<mp[i]<<"\n";
	
}

Measured memory_bytes: 12992
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, n, r);
	OUT(n >= 10 ? r : r + 100 * (10 - n));
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> B(N, 0);

    ll Bmidsum = 0;
    rep(i, N - 1) Bmidsum += A[i];
    Bmidsum -= A[N - 1];

    ll Bjumpsum = 0;
    for (ll i = 0; i < N - 1; i += 2) {
        Bjumpsum += A[i];
    }
    Bjumpsum *= 2;

    B[0] = Bjumpsum - Bmidsum;

    for (ll i = 1; i < N - 1; i++) {
        B[i] = A[i - 1] * 2 - B[i - 1];
    }

    B[N - 1] = 2 * A[N - 1] - B[0];

    rep(i, N) cout << B[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 2944
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var aArray = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            var count = 0;

            while (true)
            {
                for (int i = 0; i < n; i++)
                {
                    if (aArray[i] % 2 == 0)
                    {
                        aArray[i] = aArray[i] / 2;
                    }
                    else
                    {
                        Console.WriteLine(count.ToString());
                        return;
                    }
                }
                count++;
            }
        }
    }
}

Measured memory_bytes: 13396
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
int n;
  cin>>n;
  vector<int>p(n),q(n);
  rep(i,n) cin>>p[i];
  rep(i,n) cin>>q[i];
  vector<int>a(n);
  rep(i,n) a[i]=i+1;
  
  map<vector<int>,int> mp;
   while(next_permutation(a.begin(),a.end())){
    mp[a]=mp.size();
   }
  int ans=abs(mp[p]-mp[q]);
              cout<<ans<<endl;
               }
  


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
int N,Q;
signed main(){
  while(cin >> N >> Q && (N!=0 || Q!=0)){
    map<int,string> start;
    map<string,int> finish;
    rep(i,N){
      string Eraname;
      int Erabaseyear,Westernyear;
      cin >> Eraname >> Erabaseyear >> Westernyear;
      start[Westernyear-(Erabaseyear-1)]=Eraname;
      finish[Eraname]=Westernyear;
    }
    rep(i,Q){
      int q,label=0;
      cin >> q;
      for(auto p=start.begin();p!=start.end();p++){
        if(p->first<=q){
          string e=start[p->first];
          if(finish[e]>=q){
            cout << e  << " " << q-p->first+1<< endl;
            label++;
            break;
          }
        }
      }
      if(label==0) cout << "Unknown" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
using ll = long long;

int main() {
    string s;
    cin >> s;
    deque <char> S(s.size());
    rep(i, 0, s.size()) S[i] = s[i];
    int Q;
    cin >> Q;
    bool flag = true;
    rep(i, 0, Q){
        int nowq ;
        cin >> nowq;
        if(nowq == 1) flag = !flag; 
        if(nowq == 2){
            int f;
            char c;
            cin >> f >> c;
            if(f == 1){
                if(flag)S.push_front(c);
                else{
                    S.push_back(c);
                }
            }
            if(f == 2){
                if(flag)S.push_back(c);
                else{
                    S.push_front(c);
                }
            }
        }
    }
    if(!flag) reverse(S.begin(), S.end());
    
    rep(i, 0, S.size()){
        cout << S[i];
    }
    cout << endl;
}

Measured memory_bytes: 896
<?php
  const DIRS = array('R','D','L','U');
  $p = array(1,0,0);
  $path = 'R';
  $step =  array(array(1,0), array(0,1), array(-1,0), array(0,-1));

  function frontIsClear($p, $l) {
      list($x,$y,$d) = $p;
      return ($d == 0 && ($y>0 ? !$l[2*$y-1][$x] : 1))
             || ($d == 1 && ($x<4 ? !$l[2*$y][$x] : 1))
             || ($d == 2 && ($y<4 ? !$l[2*$y+1][$x] : 1))
             || ($d == 3 && ($x>0 ? !$l[2*$y][$x-1] : 1));
  }

  function canMove($p,$l) {
      list($x,$y,$d) = $p;
      switch($p[2]) {
      case 0:
          return $x!=4 && $l[2*$y][$x];
      case 1:
          return $y!=4 && $l[2*$y+1][$x];
      case 2:
          return $x!=0 && $l[2*$y][$x-1];
      case 3:
          return $y!=0 && $l[2*$y-1][$x];
      }
  }

  function move(&$p,$step) {
      $p[0] = $p[0] + $step[$p[2]][0];
      $p[1] = $p[1] + $step[$p[2]][1];
  }

  for($i=0;$i<9;$i++)
      $l[] = trim(fgets(STDIN));

  while(true) {
       if(!frontIsClear($p,$l)){
          $p[2] = ($p[2]+3) % 4;
       } else {
           while(!canMove($p,$l)) {
              $p[2] = ($p[2]+1) % 4;
           }
       }
       if($p == array(0,0,0))
           break;
       move($p,$step);
       $path .= DIRS[$p[2]];
  }

  echo $path.PHP_EOL;

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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define Debug(X) cout << #X << " = " << X << '\n'
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

map<ll, int> st;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);
//  freopen(Task".out", "w", stdout);
  ll n;
  cin >> n;
  ll m = n - 1;
  vector<ll> a;
  for (ll d = 1; d * d <= m; ++d){
    if (m % d) continue;
    a.push_back(d);
    if (d * d != m) a.push_back(m / d);
  }
  for (auto d : a) st[d] = 1;

  vector<ll> b;
  for (ll d = 1; d * d <= n; ++d){
    if (n % d) continue;
    b.push_back(d);
    if (d * d != n) b.push_back(n / d);
  }
  for (auto d : b){
    if (d == 1){
      st[d] = 1; continue;
    }
    ll x = n;
    while (x % d == 0) x /= d;
    if (x % d == 1) st[d] = 1;
  }
  cout << (int)st.size() - 1;
}



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

int main(){
  int n,ans = -1, tmp=1 ;cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  for (int i = 0; i < n; i++) {
    if (tmp == 2) {
      ans = i;
      break;
    }
    tmp = a.at(tmp-1);
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 640
/*
strlenはcharへのポインタが引数なので、今回の
intの配列は渡せない
*/

#include<stdio.h>
#include<string.h>

void motiSort(int *p, int n);

int main(void)
{
  int n = 0;
  int wid[100] = {0};
  int i;//for loop
  int sum = 1;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", wid+i);
  }
  //printf("***\n");
  motiSort(wid, n);

  for(i=1; i<n; i++){
    if(wid[i-1] != wid[i]) sum++;
  }

  printf("%d\n", sum);
}

void motiSort(int *p , int n)
{
  int i = 1, buffer = 0;
  int j;

  while(i < n){
    j = i;
    while(j > 0){
      if(p[j-1] > p[j]){
        buffer = p[j-1];
        p[j-1] = p[j];
        p[j] = buffer;
      }
      j--;
    }
    i++;
  }
}


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

int main(){
	int n;
	cin >> n;
	vector<int> a;
	int b;
	for(int i=0;i<n;++i){cin>>b;a.push_back(b);}
	b=1;
	int cnt=1;
	while(n--){
		if(a[b-1]==2){
			cout << cnt << endl;
            return 0;
		}else{
			cnt++;
			b=a[b-1];
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<map>
using namespace std;
const int N = 2e5 + 10;

long long a[N],n;
map<long long,int> vis;
int main(){
    scanf("%lld",&n);

    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
        vis[a[i]]++;
    }
    long long ans = 0;
    for(map<long long,int>::reverse_iterator it=vis.rbegin();it!=vis.rend();it++){
        long long k = 1;
        while(k <= it->first)k*=2;
        while(it->second != 0){
            it->second--;
            if(vis[k - it->first] != 0){
                vis[k - it->first]--;
                ans++;
            }
        }

    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 26752
public class Main{
  static int N = 50001;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int[] p;
    int pn, i, j, n, count, l, m, r;

    p = new int[N / 6];
    pn = getprime(p);

    for(;;){
      n = sc.nextInt();
      if(n == 0)break;
      count = 0;
      for(i = 0;i < pn && p[i] <= n / 2;i++){
        l = 0; r = pn - 1;
        for(;l <= r;){
          m = (l + r) / 2;
          if(p[i] + p[m] < n)l = m + 1;
          else if(p[i] + p[m] > n)r = m - 1;
          else{ count++; break; }
        }
      }
      out.println(count);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static int getprime(int[] p){
    int i, j, count = 0;
    boolean[] e;
    e = new boolean[N];
    e[0] = true; e[1] = true;
    for(i = 2;i < N;i++)if(!e[i]){
      p[count++] = i;
      for(j = i * 2;j < N;j+=i)e[j] = true;
    }
    return count;
  }
}

Measured memory_bytes: 35256
n=int(input())
s=[]
def dfs(string,cur):
  if cur==len(str(n)):
    if string.count('3')>0 and string.count('5')>0 and string.count('7'):
      s.append(string)
    return
  dfs(string+"",cur+1)
  dfs(string+"7",cur+1)
  dfs(string+"5",cur+1)
  dfs(string+"3",cur+1)
dfs("",0)

cnt=0
for i in set(s):
  if int(i)<=n:
    cnt+=1
print(cnt)

Measured memory_bytes: 19228
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String line = sc.next();
        String str [] = line.split("");
        int k = sc.nextInt();
        String letter = str[k-1];
        for(int i = 0; i < n; i++){
            
            if(!str[i].equals(letter)){
                str[i] = "*";
            }
            System.out.print(str[i]);
            
        }
        System.out.println("");
        
        
    }
}


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


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

	if (b <= a) {
		cout << "delicious" << endl;
	}

	else if (b<=a+x) {
		cout << "safe" << endl;
	}

	else {
		cout << "dangerous" << endl;
	}



	
	return 0;

}




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

using ll = long long;
using namespace std;

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll total = 0;
  if (a >= k) {
    total = k;
  } else {
    total = a;
    if (k - a - b > 0) {
      total -= (k - a - b);
    }
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 3540
N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]

total = 0
for i in range(1, N+2):
    total += abs(A[i] - A[i-1])
    
for i in range(1, N+1):
    diff = abs(A[i+1]-A[i-1]) - abs(A[i]-A[i-1]) - abs(A[i+1]-A[i])
    print(total + diff)

Measured memory_bytes: 14048
n, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = [0]
for i in range(n):
	b.append(b[-1] + a[i])
ans = 0
for i in range(1, n + 1):
	if b[i] > x:
		break
	else:
		ans += 1

if ans == n and b[-1] != x:
	ans -= 1
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

ll gcd(ll A, ll B){
  ll R = A % B;
  if (R == 0){
    return B;
  }
  else{
    return gcd(B, R);
  }
}

int main(){
  ll A, B;
  cin >> A >> B;
  
  ll tar = gcd(A, B);
  
  ll ans = 1, num = 2;
  while (tar != 1){
    bool div = false;
    
    if (num > 1000000){
      ans++;
      break;
    }
    
    while (tar % num == 0){
      tar /= num;
      div = true;
    }
    
    if (div == true){
      ans++;
    }
    
    num++;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3152
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	static LinkedList<Integer> fact(int n){
		int tn = n;
		LinkedList<Integer> ans = new LinkedList<Integer>();
		if(ip(n)) {
			ans.add(n);
			return ans;
		}
		for(int i = 2; i <= tn; i++) {
			if(n == 1) break;
			if(ip(i)) {
				while(n % i == 0) {
					ans.add(i);
					n /= i;
				}
			}
		}
		return ans;
	}
    static boolean ip(long x){
        if(x==1) return false;
        for(long i=2;i*i<=x;i++) if(x%i==0) return false;
        return true;
    }
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt();
		LinkedList<Integer> yaku = new LinkedList<Integer>();
		for(int i = 1; i * i <= M; i++) {
			if(M % i == 0) {
				yaku.add(i);
				yaku.add(M / i);
			}
		}
		int ans = 0;
		for(int y : yaku) {
			if(M / y >= N) ans = Math.max(ans, y);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

internal class Program {
    static void Main() => CustomMain();

    static void Solve() {
        string a, b;
        ReadMulti(out a, out b);

        bool af = a[0] == 'H';
        bool bf = b[0] == 'H';
        if (!(af ^ bf)) {
            WriteAnswer("H");
        } else {
            WriteAnswer("D");
        }
    }


    static void CustomMain() {
#if DEBUG
        // ファイルからテストケースを読み込む
        ChangeStdIn();
        // 時間計測
        var stopwatch = new Stopwatch();
        stopwatch.Start();
#endif
        // 出力高速化
        var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(streamWriter);
        // 回答
        Solve();
#if DEBUG
        stopwatch.Stop();
        Console.WriteLine(stopwatch.Elapsed);
#endif
        Console.Out.Flush();
    }

    static string ReadString() => Console.ReadLine().Trim();
    static int ReadInt() => int.Parse(ReadString());
    static long ReadLong() => long.Parse(ReadString());
    static float ReadFloat() => float.Parse(ReadString());
    static double ReadDouble => double.Parse(ReadString());

    static string[] ReadStringArray() => ReadString().Split(' ');
    static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
    static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
    static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
    static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

    static T TypeConversion<T>(string s) {
        if (typeof(T) == typeof(int)) {
            return (T) Convert.ChangeType(int.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(long)) {
            return (T) Convert.ChangeType(long.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(double)) {
            return (T) Convert.ChangeType(double.Parse(s), typeof(T));
        } else {
            return (T) Convert.ChangeType(s, typeof(T));
        }
    }

    static void ReadMulti<T, U>(out T a, out U b) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
    }

    static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
        c = TypeConversion<V>(str[2]);
    }

    static void WriteAnswer(object ans) => Console.WriteLine(ans);

    static bool IsOdd(long num) {
        return (num & 1) == 1;
    }

    static bool IsEven(long num) {
        return (num & 1) == 0;
    }

    static long GCD(long a, long b) {
        return b != 0 ? GCD(b, a % b) : a;
    }

    static long RoundUp(long a, long b) {
        return (a + b - 1) / b;
    }


    static void ChangeStdIn() {
        var path = "./../../TestCase.txt";
        var exStdIn = new System.IO.StreamReader(path);
        Console.SetIn(exStdIn);
    }
}

Measured memory_bytes: 11092
N = int(input())
S = input()
T = input()
res = 3*(1+(S[0]!=T[0]))
if N == 1:
    print(res)
    exit()
if N == 2:
    print(6)
    exit()
for i in range(1,N-1):
    if S[i-1] == S[i-1+1] and T[i-1] == T[i-1+1] and S[i-1+2] == T[i-1+2]:
        res *= 1
    elif S[i-1+1] == S[i-1+2] and T[i-1+1] == T[i-1+2] and S[i-1] == T[i-1]:
        res *= 2 
    elif S[i-1] == T[i-1] and S[i-1+1] == T[i-1+1] and S[i-1+2] == T[i-1+2]:
        res *= 2
    elif S[i-1+1] == S[i-1+2] and T[i-1+1] == T[i-1+2] and S[i-1] != T[i-1]:
        res *= 3
    elif S[i-1] == S[i-1+1] and T[i-1] == T[i-1+1] and S[i-1+2] != T[i-1+2]:
        res *= 1
    elif S[i-1] != T[i-1] and S[i-1+1] == T[i-1+1] and S[i-1+2] == T[i-1+2]:
        res *= 1
    elif S[i-1] == T[i-1] and S[i-1+1] == T[i-1+1] and S[i-1+2] != T[i-1+2]:
        res *= 2
    else:
        res *= 1
    res %= 10**9+7
if S[-1]==T[-1] and S[-2]==T[-2]:
    res *= 2
    res %= 10**9+7
print(res)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  int n,w; cin>>n>>w;
  vector<int> weight(n), value(n);
  for(int i=0; i<n; i++) cin>>weight[i]>>value[i];
  // 価値が1以上~品物の総価値以上までの範囲で考えたときの、取りうる重量の最小値
  int value_MAX = 1e3*n+1;
  vector<vector<ll>> dp(n+1,vector<ll>(value_MAX,1e11+1));
  dp[0][0] = 0;
  for(int i=0; i<n; i++) {
    for(int j=0; j<value_MAX; j++) {
      if(j-value[i]<0) dp[i+1][j] = dp[i][j];
      else dp[i+1][j] = min(dp[i][j], dp[i][j-value[i]]+weight[i]);
    }
  }
  int ans;
  for(int i=0; i<value_MAX; i++) {
    if(dp[n][i]<=w) ans=i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 83196
import java.util.*;
import java.awt.Point;

// CODEFES_B 2017-C
// http://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_c	

public class Main {
	
	public static void main (String[] args) throws InterruptedException {
		Scanner in = new Scanner(System.in);

		int N = in.nextInt();
		int K = in.nextInt();
		
		Point[] points = new Point[N];
		for (int i = 0; i < N; i++) {
			points[i] = new Point(in.nextInt(), in.nextInt());
		}
		
		long answer = Long.MAX_VALUE;
		long smallerX, smallerY, biggerX, biggerY;
		int count;
		
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				if (K == 2) {
					smallerX = Math.min(points[i].x, points[j].x);
					smallerY = Math.min(points[i].y, points[j].y);
					biggerX = Math.max(points[i].x, points[j].x);
					biggerY = Math.max(points[i].y, points[j].y);
					
					answer = Math.min(answer, (biggerX - smallerX) * (biggerY - smallerY));
					continue;
				}
				for (int a = j + 1; a < N; a++) {
					if (K == 3) {
						smallerX = (long) Math.min(Math.min(points[i].x, points[j].x), points[a].x);
						smallerY = (long) Math.min(Math.min(points[i].y, points[j].y), points[a].y);
						biggerX = (long) Math.max(Math.max(points[i].x, points[j].x), points[a].x);
						biggerY = (long) Math.max(Math.max(points[i].y, points[j].y), points[a].y);
						
						answer = Math.min(answer, (biggerX - smallerX) * (biggerY - smallerY));
						continue;
					}
					for (int b = a + 1; b < N; b++) {
						smallerX = (long) Math.min(Math.min(points[i].x, points[j].x), Math.min(points[a].x, points[b].x));
						smallerY = (long) Math.min(Math.min(points[i].y, points[j].y), Math.min(points[a].y, points[b].y));
						biggerX = (long) Math.max(Math.max(points[i].x, points[j].x), Math.max(points[a].x, points[b].x));
						biggerY = (long) Math.max(Math.max(points[i].y, points[j].y), Math.max(points[a].y, points[b].y));

						count = 0;
						for (int x = 0; x < N; x++) {
							if (smallerX <= points[x].x && points[x].x <= biggerX && smallerY <= points[x].y && points[x].y <= biggerY) {
								count++;
							}
						}
						
						if (K <= count) {
							answer = Math.min(answer, (biggerX - smallerX) * (biggerY - smallerY));
						}
 					}
				}
			}
		}
		
		System.out.println(answer);
	}
}


Measured memory_bytes: 23764
#include <cstdio>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL; 
typedef vector<int> vii; 
//__int128


int main(int argc, char const *argv[])
{

	int n;
	string s;
	int c = 0;
	cin >> n >> s;
	for(int i = 0; i < n; ++i){
		if(s[i] == 'R') 
			++c;
	}
	if(c > n - c){
		puts("Yes");
	} else {
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    scanf("%d",&K);
    printf("%d",arr[K-1]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    ll n, m;
    cin >> n >> m;

    vector<ll> n_ac(n);
    vector<ll> n_wa(n);

    for(int i = 0; i < m; i++){
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC"){
            n_ac[p-1] = 1;
        }
        else{
            if( n_ac[p-1] == 0) n_wa[p-1] ++;
        }
    }

    for(int i = 0; i < n; i++){
        if(n_ac[i] == 0) n_wa[i] = 0;
    }

    cout << accumulate(all(n_ac), 0ll) << " " << accumulate(all(n_wa), 0ll) << endl;


}

Measured memory_bytes: 1792
M, D = map(int,input().split())
cnt = 0
for month in range(1,M+1):
    for day in range(D+1):
        d_10 = day//10
        d_1 = day%10
        if d_10 >= 2 and d_1 >= 2 and d_10*d_1 == month:
            cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  string S;
  cin >> S;
  rep(i, S.size()-1) {
    if (S.substr(i, 2) == "AC") {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int A, B;
	cin >> A >> B;
	cout << max(max(A + B, A - B), A * B) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define ll long long
using namespace std;
int main()
{
	ll int n,a,b;
	cin>>n>>a>>b;
    if(a>b)
    {
    	cout<<0<<endl;
	}
	else if(n==1)
	{
		if(a==b)
		  cout<<1<<endl;
		else
		  cout<<0<<endl;
	}
	else
	{
		ll int answer=(n-2)*(b-a)+1;
		cout<<answer<<endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //char[] coffee = "coffee".toCharArray;
        char[] S = sc.next().toCharArray();

        if (S[2] == S[3] && S[4] == S[5]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
function Main(input) {
  const S = input.split("\n")[0].trim().split("");
  const T = input.split("\n")[1].trim().split("");
  let result = 0;

  for (i=0;i<S.length;i++){
    if (S[i] !== T[i] ){
      result++
    }
  }
  console.log(result)

  }

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 36420
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200010


int main() {
	char a[N];
	f(i, N)a[i] = 0;
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%s", a);
	n = strlen(a);
	if (n % 2 != 0) {
		printf("No\n");
		return 0;
	}
	f(i, n) {
		if (i % 2 == 0) {
			if (a[i] != 'h') {
				printf("No\n");
				return 0;
			}
		}
		else {
			if (a[i] != 'i') {
				printf("No\n");
				return 0;
			}
		}


	}
	printf("Yes\n");


	return 0;
}

Measured memory_bytes: 384
n, k = map(int, input().split())
P = [int(x)-1 for x in input().split()]
C = [int(x) for x in input().split()]

vis = [0 for i in range(n+1)]
	

res = -10000000000000000000000
for i in range(0,n):
	if vis[i] == 0:
		su = 0
		vis[i] = 1
		v = []
		v.append(C[i])
		su += C[i]
		x = P[i]
		while x != i:
			vis[x] = 1
			su += C[x]
			v.append(C[x])
			x = P[x]
		vs = len(v)
		for ii in range(vs):
			umm = 0
			for j in range(min(k,vs)):
				x = (ii+j)%vs
				umm += v[x]
				steps = 1+(x-ii+vs)%vs
				if k >= vs:
					if(su > 0):
						r = max((k-steps)//vs,0)
						res = max(res, r*su + umm)
					else:
						res = max(res,umm)
				else:
					if steps <= k:
						res = max(res,umm)


print(res)

Measured memory_bytes: 75072
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        string s,ss;
        cin>>s>>ss;

        for(int i=0;s[i];++i){
            if(s[i]!=ss[i]){
                printf("No\n");
                return 0;
            }
        }     
        printf("Yes\n");

        //printf("Case %d: ",++te);
    }
    return 0;
}



Measured memory_bytes: 3556
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n;

int main() {

	cin >> n;

	n++;

	cout << n / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

char bits[1500000];
LL primes[750000], n_primes; 

void sieve(){
	int i, j;
	memset(bits, 1, 1500000);
	bits[0] = bits[1] = 0;
	for (i = 0; i < sqrt(1500000.0)+1; i++)
		if (bits[i])
			for (j = i * i; j < 1500000; j += i)
				bits[j] = 0;
	for (i = j = 0; i < 100000; i++)	
		if (bits[i]) primes[j++] = i;
	n_primes = j;
}
int main(){
	sieve();
	int n;
	while(cin>>n, n){
		if(bits[n]==1)cout << 0 << endl;
		else{
			int ret = 0;
			int tmp = n;
			while(!bits[tmp]){
				ret++;
				tmp--;
			}
			tmp = n;
			while(!bits[tmp]){
				ret++;
				tmp++;
			}
			cout << ret << endl;
		}
	}
	return 0;
}

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if(M1 == M2){
        PRINT("0");
    }
    else{
        PRINT("1");
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
  
int main(void)
{
	double x1, x2, x3, y1, y2, y3;
	double p, q, r;
	int n, i;
	
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
		p = ((y2 - y3)*(x1*x1 + y1*y1) + (y3 - y1)*(x2*x2 + y2*y2) + (y1 - y2)*(x3*x3 + y3*y3))/(2*(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2)));
		q = ((x2 - x3)*(x1*x1 + y1*y1) + (x3 - x1)*(x2*x2 + y2*y2) + (x1 - x2)*(x3*x3 + y3*y3))/(2*(y1*(x2 - x3) + y2*(x3 - x1) + y3*(x1 - x2)));
		r = sqrt((x1 - p)*(x1 - p) + (y1 - q)*(y1 - q));
		printf("%.3lf %.3lf %.3lf\n", p, q, r);
	}
 
	return 0;
}

Measured memory_bytes: 664
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S; cin >> S;
    int Q; cin >> Q;

    bool rev = false;
    string H, T;
    rep(_, Q){
        int op1; cin >> op1;
        if(op1 == 1){
            rev ^= true;
        }
        else {
            int op2; cin >> op2;
            char c; cin >> c;
            bool ta = (rev ^ (op2 == 2));
            if(ta){
                T.push_back(c);
            }
            else {
                H.push_back(c);
            }
        }
    }
    if(rev){
        reverse(_all(S));
        swap(H, T);
    }
    reverse(_all(H));

    cout << H << S << T << endl;

    return 0;
}


Measured memory_bytes: 1040
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
const int INF=1000000000;
const int MAX_N=1000;
const int MAX_M=1000;
typedef pair<int,int> P;
char maze[MAX_N][MAX_N+1];
int N,M,a,b,c,e,f;
int sx,sy;
int gx,gy;
int d[MAX_N][MAX_N];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int bfs(){
 queue<P>que;
  que.push(P(sx,sy));
  d[sx][sy]=0;
  while(que.size()){
    P p=que.front();que.pop();
    if(p.first==gx&&p.second==gy)break;
    for(int i=0;i<4;i++){
      int nx=p.first+dx[i],ny=p.second+dy[i];
      if(0<=nx&&nx<N&&0<=ny&&ny<M&&maze[nx][ny]!='X'&&d[nx][ny]==INF){
        que.push(P(nx,ny));
        d[nx][ny]=d[p.first][p.second]+1;
      }
    }
  }
  return d[gx][gy];
}
int main(){
  string a;cin>>a;
  ll kotae=0,ans=0;
  rep(i,a.size()){
    if(a[i]=='R')ans++;
    else {
      kotae=max(ans,kotae);
      ans=0;
    }
  }
    cout<<max(kotae,ans)<<endl;
  return 0;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair



int main() {
    int M; cin >> M;
    vector<ll> d(M), c(M); REP(i, M) cin >> d[i] >> c[i];

    ll d_sum = 0;
    ll c_sum = 0;
    REP(i, M) {
        d_sum += d[i] * c[i];
        c_sum += c[i];
    }    

    ll ans = (d_sum - 1) / 9 + (c_sum - 1);
    PRINT(ans);    
    return 0;
}

Measured memory_bytes: 6432
n,x=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
ans=0
for i in range(n):
  x=x-a[i]
  if x>=0:
    ans+=1
  else:
    break
if x>0:
  ans=ans-1
print(ans)
  

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		if(a<b && b<c)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}

}

Measured memory_bytes: 26156