akhauriyash/Code-Regression huggingface dataset:
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------
vector<int>G[100001];
list<int> out;
bool V[100001];
int N;
int indeg[100001];

void bfs(int s){
    queue<int>q;
    q.push(s);
    V[s]=1;
    while(!q.empty()){
        int u=q.front();q.pop();
        out.pb(u);
        for(int i=0;i<G[u].size();i++){
            int v=G[u][i];
            indeg[v]--;
            if(indeg[v]==0&&!V[v]){
                V[v]=1;
                q.push(v);
            }
        }
    }
}

void tsort(){
    for(int i=0;i<N;i++){
        indeg[i]=0;
    }
    for(int u=0;u<N;u++){
        for(int i=0;i<G[u].size();i++){
            indeg[G[u][i]]++;
        }
    }
    for(int u=0;u<N;u++){
        if(indeg[u]==0&&!V[u])bfs(u);
    }
    for(list<int>::iterator it=out.begin();it!=out.end();it++){
        cout<<*it<<endl;
    }
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int s,t,M;
    cin>>N>>M;
    for(int i=0;i<N;i++)V[i]=0;
    for(int i=0;i<M;i++){
        cin>>s>>t;
        G[s].pb(t);
    }
    tsort();
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------







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

typedef long long i64;


#define rep(i,s,e) for(int i = (s);i <= (e);i++)

vector<i64> vec(3);

int main()
{
    rep(i,0,2) cin >> vec[i];
    sort(vec.begin(),vec.end());
    bool even = false;
    rep(i,0,2) even = even || (vec[i] % 2 == 0);
    if(even) cout << 0 << endl;
    else cout << vec[0] * vec[1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include "stdio.h"

int num;
int p_cal;
int cal[100];
int p_price;
int price;
int box;
double per;
double cal_sum;

int main() {

	scanf("%d", &num);
	scanf("%d %d", &p_price, &price);
	scanf("%d", &p_cal);
	for (int i = 0; i < num; i++) {
		scanf("%d", &cal[i]);
	}
	for (int i = 0; i < num; i++) {
		for (int j = i + 1; j < num; j++) {
			if (cal[i] < cal[j]) {
				box = cal[i];
				cal[i] = cal[j];
				cal[j] = box;
			}
		}
	}
	per = (double)p_cal / (double)p_price;
	cal_sum = p_cal;
	for (int i = 0; i < num; i++) {
		cal_sum += cal[i];
		if (per >= cal_sum / (p_price + price*(i + 1))) {
			printf("%d\n", (int)per);
			return 0;
		}
		per = cal_sum / (p_price + price*(i + 1));
	}
	return 0;
}

Measured memory_bytes: 1028
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int d,n;
  cin >> d >> n;
  if(d==0&&n!=100) {
    cout << n << endl;
  }
  else if(d==0) {
    cout << 101 << endl;
  }
  else if(d==1&&n!=100) {
    cout << 100*n << endl;
  }
  else if(d==1) {
    cout << 10100 << endl;
  }
  else if(d==2&&n!=100) {
    cout << 10000*n << endl;
  }
  else {
    cout << 1010000 << endl;
  }
}

Measured memory_bytes: 256
W,H,x,y,r=map(int,input().split())
if -100<=x<=100 and -100<=y<=100 and 0<W<=100 and 0<H<=100 and 0<r<=100:
    if x-r<0 or x+r>W:
        print("No")
    if x-r>=0 and x+r<=W:
        if y-r>=0 and y+r<=H:
            print("Yes")
        if y-r<0 or y+r>H:
            print("No")


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

int main(){

    bool flag=false;
    ll ans=1,sum=0;

    int n;
    cin >>n;

    while (ans <= n){
        ans *= 2;
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans/2 << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	double a[n+1];
	for(int i=0;i<n;i++)cin >> a[i];
	sort(a,a+n);
	double sum=0;
	for(int i=0;i<n-1;i++){
		sum=(a[i]+a[i+1])/2;
		a[i+1]=sum;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt(),k=scan.nextInt();
		if(k>1){
			System.out.println(n-k);
		}else{
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 21588
def stable?(in_arr, out_arr)
  n = in_arr.size

  0.upto(n - 1) do |i|
    (i + 1).upto(n - 1) do |j|
      next unless eq?(in_arr[i], in_arr[j])

      0.upto(n - 1) do |a|
        (a + 1).upto(n - 1) do |b|
          if in_arr[i] == out_arr[b] && in_arr[j] == out_arr[a]
            # puts "i = #{i}, j = #{j}, a = #{a}, b = #{b}"
            return false
          end
        end
      end
    end
  end

  true
end

def eq?(a, b)
  a = a[-1].to_i
  b = b[-1].to_i

  a == b
end

def compare(a, b)
  a = a[-1].to_i
  b = b[-1].to_i

  a > b
end

def bubble_sort(n, a)
  ret = a.dup
  n.times do |i|
    j = n - 1
    while j > i
      if compare(ret[j - 1], ret[j])
        tmp = ret[j]
        ret[j] = ret[j - 1]
        ret[j - 1] = tmp
      end
      j -= 1
    end
  end
  ret
end

def selection_sort(n, a)
  ret = a.dup
  0.upto(n - 1) do |i|
    minj = i
    i.upto(n - 1) do |j|
      if compare(ret[minj], ret[j])
        minj = j
      end
    end

    if i != minj
      tmp = ret[i]
      ret[i] = ret[minj]
      ret[minj] = tmp
    end
  end
  ret
end

n = gets.chomp.to_i
a = gets.chomp.split

b = bubble_sort(n, a)
puts b.join(' ')
puts stable?(a, b) ? 'Stable' : 'Not stable'

s = selection_sort(n, a)
puts s.join(' ')
puts stable?(a, s) ? 'Stable' : 'Not stable'


Measured memory_bytes: 6884
#include <stdio.h>

int main(void) {
	int w=0;
	while( scanf("%d", &w) != EOF ) {
		int cost = 1150;
		if(w<0) break;
		else if(w>30) cost += 1250+1400+160*(w-30);
		else if(w>20)	 cost += 1250+140*(w-20);
		else if(w>10) cost += 125*(w-10);
	
		printf("%d\n", 4280-cost);
	}

	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,s,c=0,z;
	scanf("%d%d",&k,&s);
		for(int x=0;x<=k;x++)
		{
            for(int y=0;y<=k;y++)
            {
                int z=s-(x+y);
                if(z>=0&&z<=k)
                    c++;
            }
	   }
	   printf("%d",c);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << a << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {}

int main(void) {
  int a,p;cin>>a>>p; 
  pr((a*3+p)/2);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int x,a,b;
  cin >> x >> a >> b;
  int y = abs(x-a);
  if (y > abs(x-b)){
    cout << "B" << endl;
  } else {
    cout << "A" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
 
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
 
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define T int t = 0; cin >> t; while(t--)
#define pr(a) for(int i = 0; i < (int)a.size(); ++i)cout << a[i] << " ";cout << endl;
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef long double lld;
const ll mod = 1e15;
const ll mx = 1e3 + 1;
const ll inf = 2e18;
const int sz = 256;
const int max_k = 20;
typedef long long ll;

void input(){
    IOS;
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll y = min(k, x / d);
    k -= y;
    x -= y * d;
    if(k & 1){
        cout << abs(x - d) << endl;
    }else{
        cout << x << endl;
    }
    
}

int main(){
    input();
    return 0;
} 
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 3632
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 1e18+10 : 1e9+10;
// int dx[]={0,1,0,-1,1,1,-1,-1};
// int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int dx[]={-1,-1,0,0,1,1};
int dy[]={-1,0,-1,1,0,1};//RDLU
int main(){
	ll n,m,d;
	cin>>n>>m>>d;
	double co=(double)(n-d)/n*(m-1)/n;
	if(d)co*=2;
	cout<<shosu(9)<<co<<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(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m, r;
    cin >> n >> m >> r;

    vector<int> R(r);
    REP(i, r){
        cin >> R[i];
        R[i]--;
    }
    sort(R.begin(), R.end());

    int A[n][n] = {};
    REP(i, n){
        REP(j, n){
            if(i != j) A[i][j] = 1e9;
        }
    }

    REP(i, m){
        int a, b, c;
        cin >>  a >> b >> c;
        a--; b--;
        A[a][b] = c;
        A[b][a] = c;
    }

    REP(i, n){
        REP(j, n){
            REP(k, n){
                A[j][k] = min(A[j][k], A[j][i] + A[i][k]);
            }
        }
    }

    int ans = 1e9;
    do{
        int cost = 0;
        REP(i, r - 1){
            cost += A[R[i]][R[i + 1]];
        }
        ans = min(ans, cost);
    }while(next_permutation(R.begin(), R.end()));

    cout << ans << endl; 

    return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
from sys import stdin

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

N = d_in()
rotated = []
for _ in range(N):
    x, y = ds_in()
    u = x + y
    v = x - y
    rotated.append([u, v])

Mod = rotated[0][0] % 2
for r in rotated:
    if r[0] % 2 != Mod:
        print(-1)
        exit()
    
# abs(2 * 10**9) < 2**31
# Answer : m
if Mod == 1:
    m = 31
else:
    m = 32
print(m)
d_list = [str(2 ** i) for i in range(0, m-1+Mod)]
if Mod == 0:
    d_list.insert(0, str(1))
print(' '.join(d_list))

for r in rotated:
    ans_u = bin((r[0] + 2**31 - Mod) // 2)[2:]
    ans_v = bin((r[1] + 2**31 - Mod) // 2)[2:]

    if len(ans_u) < m - 1 + Mod:
        ans_u = '0' * (m-1+Mod - len(ans_u)) + ans_u
    if len(ans_v) < m - 1 + Mod:
        ans_v = '0' * (m-1+Mod - len(ans_v)) + ans_v

    if Mod == 1:
        w = ''
    else:
        w = 'L'
    for i, j in zip(ans_u[::-1], ans_v[::-1]):
        if i == '0' and j == '0':
            w += 'L'
        elif i == '0' and j == '1':
            w += 'D'
        elif i == '1' and j == '0':
            w += 'U'
        else:
            w += 'R'
    print(w)
    

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

template <typename _tp> inline void read(_tp&x){
	char c11=getchar(),ob=0;x=0;
	while(c11!='-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();
	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;
}

int main(){
	int N,n,M,m;
	read(N),read(M),read(n),read(m);
	printf("%d\n",(N-n)*(M-m));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string N;
  cin>>N;

  if(N.at(0) =='7' || N.at(1)=='7' || N.at(2)=='7') {
    cout<<"Yes"<<endl;
   }
    
   else {
     cout<<"No"<<endl;
   }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
//#define MOD 1000000007
#define MOD 998244353
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int H,W,N;
    int sr,sc;
    string S,T;
    cin >> H >> W >> N;
    cin >> sr >> sc;
    cin >> S >> T;
    
    bool NO=false;
    //UD=sc,LR=sr;
    int now=sc;
    REP(i,N){
        //Lに出す
        //SはLに振り、TはRに振る
        if(S[i]=='L'){
            now--;
        }
        if(1>now || now>W){
            NO=true;
        }
        if(T[i]=='R' && now!=W){
            now++;
        }
        if(1>now || now>W){
            NO=true;
        }
        
    }
    
    now=sc;
    REP(i,N){
        //Rに出す
        //SはRに振り、TはLに振る
        if(S[i]=='R'){
            now++;
        }
        if(1>now || now>W){
            NO=true;
        }
        if(T[i]=='L' && now!=1){
            now--;
        }
        if(1>now || now>W){
            NO=true;
        }
    }
    //----------ここから横-----------
    now=sr;
    REP(i,N){
        //Uに出す
        //SはUに振り、TはDに振る
        if(S[i]=='U'){
            now--;
        }
        if(1>now || now>H){
            NO=true;
        }
        if(T[i]=='D' && now!=H){
            now++;
        }
        if(1>now || now>H){
            NO=true;
        }
    }
    
    now=sr;
    REP(i,N){
        //Dに出す
        //SはDに振り、TはUに振る
        if(S[i]=='D'){
            now++;
        }
        if(1>now || now>H){
            NO=true;
        }
        if(T[i]=='U' && now!=1){
            now--;
        }
        if(1>now || now>H){
            NO=true;
        }
    }
    
    if(NO==true){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    
    return 0;
}


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





pair<complex<double>, double> min_circle (vector<complex<double>> data, int seed = 1331) {
    using point = complex<double>;
    using circle = pair<point, double>;
    const double eps = 1e-10; int n = data.size();
    auto is_inner = [&](const point &a, const circle &c)->bool{ 
        return norm(a-c.first) <= c.second+eps;
    };
    auto make_circle_2p = [&](const point &a, const point &b)->circle {
        point c = (a+b)/(double)2; double r = norm(a-c);
        return {c, r};
    };
    auto make_circle_3p = [&](const point &a, const point &b, const point &c)->circle {
        double A = norm(b-c), B = norm(c-a), C = norm(a-b);
        double S = norm((a-c)*conj(b-c)-conj(a-c)*(b-c));
        point p = (A*(B+C-A)*a + B*(C+A-B)*b + C*(A+B-C)*c) / S;
        double r = norm(p - a);
        return {p, r};
    };
    
    if (n == 1) { return {data[0], 0}; };
    shuffle (data.begin(), data.end(), mt19937(seed));
    circle D = make_circle_2p(data[0], data[1]);        
    // MinDisk
    for (int i = 2; i < n; i++) {
        if (!is_inner(data[i], D)) {
            // MinDiskWithPoint
            shuffle(data.begin(), data.begin()+i-1, mt19937(seed));
            D = make_circle_2p(data[0], data[i]);
            for (int j = 1; j < i; j++) {
                if (!is_inner(data[j], D)) {
                    // MinDiskWith2Point
                    D = make_circle_2p(data[i], data[j]);
                    for (int k = 0; k < j; k++) {
                        if (!is_inner(data[k], D)) {
                            D = make_circle_3p(data[k], data[j], data[i]);
                        }
                    }
                }
            }
        }
    }
    return D;
}



int main() {
    using point = complex<double>;
    int N;
    cin >> N;
    vector<point> data(N);
    for (int i = 0; i < N; i++) {
        double a, b;
        cin >> a >> b;
        data[i] = point(a, b);
    }
    
    double ans = min_circle(data).second;
    cout << fixed << setprecision(10) << sqrt(ans) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb emplace_back
#define ll long long
#define mp make_pair
#define PI acos(-1)
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll i,j,k,x,y,z,m,t,b,c,d,l,r;
    string s;
    cin>>s;
    ll cnt=0,cnts=0;
    for(i=0; i<3; i++)
        if(s[i]=='R')
            cnt++;
        else
            cnts++;
    if(cnt==3)
        cout<<3<<'\n';
    else if(cnts==3)
        cout<<0<<'\n';
    else if(s[0]=='R' && s[1]=='R' || s[1]=='R' && s[2]=='R')
        cout<<2<<'\n';
    else
        cout<<1<<'\n';
}







Measured memory_bytes: 3652
n = int(input())
for i in range(n):
    lst = list(map(float, input().split()))
    a, b = lst[0], lst[1]
    c, d = lst[2], lst[3]
    e, f = lst[4], lst[5]
    
    px = ((a+c)*(a-c)*(b-f)-(a+e)*(a-e)*(b-d)+(b-d)*(b-f)*(d-f))/(2*((a-c)*(b-f)-(a-e)*(b-d)))
    py = ((a-c)*(a-e)*(c-e)+(b+d)*(b-d)*(a-e)-(b+f)*(b-f)*(a-c))/(2*((b-d)*(a-e)-(b-f)*(a-c)))
    r = ((a-px)**2 + (b-py)**2)**0.5


    print('{:.3f}'.format(px), end= " ")
    print('{:.3f}'.format(py), end= " ")
    print('{:.3f}'.format(r))


Measured memory_bytes: 5672
H, W = map(int, input().split())
input_list = [[i for i in input()] for j in range(H)]

option = ["#"]*(W+2)
input_list.insert(0, option)
input_list.append(option)

for i in range(1, H+1):
    input_list[i].insert(0, "#")
    input_list[i].append("#")

for i in range(H+2):
    print("".join(input_list[i]))


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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<pair<string, int>, int>> sp(n);
    REP(i, n) {
        cin >> sp[i].first.first >> sp[i].first.second;
        sp[i].first.second *= -1;
        sp[i].second = i + 1;
    }
    sort(ALL(sp));

    REP(i, n) cout << sp[i].second << ln;
    return 0;
}


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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int H, W, h, w;
  cin >> H >> W >> h >> w;

  vvt<int> vec(H, vt<int>(W, 1000));
  rep(i, 1, H + 1) {
    rep(j, 1, W + 1) {
      if(i % h == 0 && j % w == 0) vec[i - 1][j - 1] = -1000 * (h * w - 1) - 1;
    }
  }

  int sum = 0;
  rep(i, 0, H) rep(j, 0, W) sum += vec[i][j];
  if(sum <= 0) return cout << "No\n", 0;

  cout << "Yes\n";
  rep(i, 0, H) {
    cout << vec[i][0];
    rep(j, 1, W) cout << " " << vec[i][j];
    cout << endl;
  }
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        char[][] c = new char[3][3];
        Scanner input = new Scanner(System.in);
        c[0] = input.next().toCharArray();
        c[1] = input.next().toCharArray();
        c[2] = input.next().toCharArray();
        for(int i=0;i<3;i++) {
            System.out.print(c[i][i]);
        }
        System.out.println();
        input.close();
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;


void b_algae(void) {
	int r, d, x;
	cin >> r >> d >> x;
	int now = x;

	for (int i = 0; i < 10; i++) {
		int before = now;
		now = r * before - d;
		cout << now << endl;
	}
}

int main()
{
    b_algae();

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N; cin >> N;
    cout << (N + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;


struct UnionFind{
	vector<int> parent, size;

	UnionFind(int n) : parent(n), size(n, 1){
		for(int i = 0; i < n; i++) parent[i] = i;
	}

	int root(int x){
		if(parent[x] == x) return x;
		else return parent[x] = root(parent[x]);
	}

	bool same(int x, int y){
		return root(x) == root(y);
	}

	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y)return;
		if(size[x] > size[y])swap(x, y);
		size[x] += size[y];
		parent[x] = y;
	}
};


signed main() {
	int x, y;
	cin >> x >> y;

	UnionFind UF(12);

	UF.unite(0, 2);
	UF.unite(0, 4);
	UF.unite(0, 6);
	UF.unite(0, 7);
	UF.unite(0, 9);
	UF.unite(0, 11);
	UF.unite(3, 5);
	UF.unite(3, 8);
	UF.unite(3, 10);
	UF.unite(1, 1);

	x--;
	y--;

	cout << (UF.same(x, y) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <set>
#include <utility>
using namespace std;
const int N = 100005;
struct P{
	int x,y,num;
}p[2*N];
bool cmp(P x,P y){
	return x.x < y.x;
}
bool cmp1(P x,P y){
	return x.y < y.y;
}
struct E{
	int from,to,v;
}e[2*N];
int node,f[N],n;
void addedge(int from,int to,int v){
	node++;	e[node].from = from;	e[node].to = to;	e[node].v = v;
}
bool cmp2(E x,E y){
	return x.v < y.v;
}
int ff(int x){
	if (f[x] == x)	return f[x];
	return f[x] = ff(f[x]);
}
typedef long long ll;
int main(){
//	freopen("read.in","r",stdin);
	cin >> n;
	for (int i = 1;i <= n;i++)	f[i] = i;
	for (int i = 1;i <= n;i++){
		cin >> p[i].x >> p[i].y;
		p[i].num = i;
	}
	sort(p+1,p+n+1,cmp);
	for (int i = 1;i < n;i++){
		addedge(p[i].num,p[i+1].num,p[i+1].x-p[i].x);
	}
	sort(p+1,p+n+1,cmp1);
	for (int i = 1;i < n;i++){
		addedge(p[i].num,p[i+1].num,p[i+1].y-p[i].y);
	}
	sort(e+1,e+node+1,cmp2);
	ll ans = 0;	int sum = 1;
	for (int i = 1;i <= node;i++){
		int x = e[i].from,y = e[i].to;
		x = ff(x);	y = ff(y);
		if (x == y)	continue;
		f[x] = y;	ans += e[i].v;	sum++;
		if (sum == n)	break;
	}
	cout << ans << endl;
	return 0;
}

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

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

	int A,B;

	cin >> A >> B;

	cout << max(A+B,max(A-B,A*B)) << '\n';
	
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

//1-2-3-4
//    |
//    5

//先に青木くんの各地点での最短移動距離を調べる
//次に高橋くんの最短移動距離を調べる(その際、青木くんに会わないようにする)
//最後に青木くんから、最も遠く高橋くんの行ける箇所を求める
//(その差異、高橋くんの移動距離と偶奇をが異なれば-1)

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N,u,v;
    cin >> N >> u >> v;
    --u;--v;

    vector <vector <int>> G(N);

    REP(i,N-1)
    {
        int a, b;
        cin >> a >> b;
        --a;--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    //0からの最短経路と最短経路でNを使用するか
    vector <int> aoki(N, N + 100);
    vector <int> taka(N, N + 100);

    aoki[v] = 0;
    //0からN-1を経由して到達できる箇所を調べる
    queue <int> que;
    que.push(v);
    int from, to;
    while(!que.empty())
    {
        from = que.front();
        que.pop();

        for(int i = 0; i < G[from].size(); ++i)
        {
            to = G[from][i];
            if(aoki[from] + 1 < aoki[to])
            {
                aoki[to] = aoki[from] + 1;
                que.push(to);
            }
        }
    }

    //高橋
    taka[u] = 0;

    que.push(u);
    while(!que.empty())
    {
        from = que.front();
        que.pop();

        for(int i = 0; i < G[from].size(); ++i)
        {
            to = G[from][i];
            //cout << taka[from] + 1 << " ";
            //cout << aoki[to] << endl;
            if(taka[from] + 1 < taka[to] && taka[from] + 1 < aoki[to])
            {
                taka[to] = taka[from] + 1;
                que.push(to);
            }
        }
    }
    int res = 0;
    int tmp;

    REP(i,N)
    {
        if(taka[i] > N)continue;
        tmp = aoki[i];
        //cout << aoki[i] << " " << taka[i] << endl;
        //偶奇に関わらない
        //if(taka[i] % 2 != aoki[i] % 2)
        --tmp;

        res = max(res, tmp);
    }


    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6656
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int n,k,ans,p;
int map[12][6]={
    {4,2,0,9,7},
    {1,10,8,6,4},
    {9,7,5,3,1},
    {6,4,2,0,9},
    {3,1,10,8,6},
    {0,9,7,5,3},
    {8,6,4,2,0},
    {5,3,1,10,8},
    {2,0,9,7,5},
    {10,8,6,4,2},
    {7,5,3,1,10}};
int main()
{
    scanf("%d%d",&n,&k);
	n-=2;
    p=n%11;
	n/=11;
    ans=n*5;
    for(int i=0;i<p;i++)
     for(int j=0;j<5;j++)
      if(map[i][j]==k)ans++;
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#include<unordered_map> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fio ios_base::sync_with_stdio(false)
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%lld",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 100000000000000005
#define MINN -10000000000000000
#define INTMAX 1000001000
#define pii pair<ll,ll> 
#define pdd pair<double,double>
#define pic pair<int,char>
//#define N 5005
#define lgn 20
#define ddouble long double
#define minus minu
#define PI 3.1415926535
#define lgn 20
using namespace std;
li mod=1000000007,n,k;
vector<vector<li>> mul(vector<vector<li>>A,vector<vector<li>>B){
    li N=A.size(),M=A[0].size(),i,j,k,s;
    vector<vector<li>>C(N,vector<li>(N));
   for(i=0;i<N;i++){
       for(j=0;j<M;j++){s=0;
           for(k=0;k<M;k++){
s=(s+(A[i][k]*B[k][j]))%mod;
           }
           C[i][j]=s;
       }
   }
   return(C); 
}

vector<vector<li>> pp(vector<vector<li>>a,li b){
    if(b==1) return(a);
vector<vector<li>> ans=pp(a,b/2);ans=mul(ans,ans);
if(b%2) ans=mul(ans,a);
return(ans);    
}

int main(){
    readl(n);readl(k);li i,j,c=0;
    vector<vector<li>>v(n,vector<li>(n));
for(i=0;i<n;i++){
    for(j=0;j<n;j++){readl(v[i][j]);}
}
vector<vector<li>>ans=pp(v,k);
for(i=0;i<n;i++){
    for(j=0;j<n;j++){
c=(c+ans[i][j])%mod;
    }
}
cout<<c;
}

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

int main(){
  string s,t;
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    if(s==t){
      cout<<"Yes"<<endl;
      return 0;
    }
    s=s.substr(1)+s[0];
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
P = list(map(int, input().split()))

if x in P:
    f = 0
    d = 0
    ans1 = x
    while f == 0:
        d += 1
        ans1 -= 1
        if ans1 in P:
            pass
        else:
            f = 1

    f = 0
    d2 = 0
    ans2 = x
    while f == 0:
        d2 += 1
        ans2 += 1
        if  ans2 in P:
            pass
        else:
            f = 1

    if d <= d2:
        print(ans1)
    else:
        print(ans2)
else:
    print(x)

Measured memory_bytes: 9164
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
const int MOD=1000000007;
int c[200001],w[200001],inv[200001],cnt[200001],siz,curans;
bool vst[200001];
vector<int> sc[200001],mp[200001],vv;
void dfs(int k)
{
    vv.push_back(k);
    vst[k]=true;
    curans=(long long)curans*(++siz)%MOD*inv[++cnt[c[k]]]%MOD;
    for (size_t i=0;i<mp[k].size();++i)
        if (!vst[mp[k][i]])
            dfs(mp[k][i]);
}
int main()
{
    inv[0]=inv[1]=1;
    for (int i=2;i<=200000;++i)
        inv[i]=MOD-(long long)MOD/i*inv[MOD%i]%MOD;
    int n,x,y;
    scanf("%d%d%d",&n,&x,&y);
    for (int i=1;i<=n;++i)
    {
        scanf("%d%d",c+i,w+i);
        sc[c[i]].push_back(i);
    }
    vector<int> least;
    for (int i=1;i<=n;++i)
        if (sc[i].size())
        {
            int best=sc[i][0];
            for (size_t j=1;j<sc[i].size();++j)
                if (w[sc[i][j]]<w[best])
                    best=sc[i][j];
            for (size_t j=0;j<sc[i].size();++j)
                if (sc[i][j]!=best&&w[best]+w[sc[i][j]]<=x)
                {
                    mp[best].push_back(sc[i][j]);
                    mp[sc[i][j]].push_back(best);
                }
            least.push_back(best);
        }
    int a1=least[0],a2=0;
    if (least.size()>1u)
    {
        for (size_t i=1;i<least.size();++i)
        {
            if (w[least[i]]<w[a1])
            {
                a2=a1;
                a1=least[i];
            }
            else if (!a2||w[least[i]]<w[a2])
                a2=least[i];
        }
    }
    for (int i=1;i<=n;++i)
        if (i!=a1&&c[i]!=c[a1]&&w[i]+w[a1]<=y)
        {
            mp[i].push_back(a1);
            mp[a1].push_back(i);
        }
    if (a2)
        for (int i=1;i<=n;++i)
            if (i!=a1&&i!=a2&&c[i]!=c[a2]&&w[i]+w[a2]<=y)
            {
                mp[i].push_back(a2);
                mp[a2].push_back(i);
            }
    int ans=1;
    for (int i=1;i<=n;++i)
        if (!vst[i])
        {
            vv.clear();
            curans=1;
            siz=0;
            dfs(i);
            ans=(long long)ans*curans%MOD;
            for (size_t j=0;j<vv.size();++j)
                --cnt[c[vv[j]]];
        }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 25904
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))

l = [a[0]]
r = [a[-1]]
for i in range(n-1):
  l.append(gcd(l[-1], a[i+1]))
  r.append(gcd(r[-1], a[-2-i]))
r = r[::-1]

maxi = max(l[-2], r[1])
for i in range(1, n-1):
  maxi = max(maxi, gcd(l[i-1], r[i+1]))
print(maxi)


Measured memory_bytes: 16148
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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 square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
#define co(x) cout << x << endl;
#define cins(n,v) rep(i,n){cin >> v.at(i);}
#define couts(v) rep(i,v.size()){cout << v.at(i) << endl;}
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#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
*/
int main() {
  int a,b;
  cin >> a>>b;
  cout << a*b << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,D,X;
    cin>>N>>D>>X;
     vector<int>A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
    int m=0;
    for(int i=0;i<N;i++){
        for(int j=0;1+A.at(i)*j<=D;j++){
                m++;
            }
        }
    
    cout<<m+X<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2;
    int cnt =0;
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i++)
    if(s1[i]==s2[i])
    cnt++;
    cout<<cnt<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

int N, M, L;

struct edge {
	int to, distance, enemy;
};

struct P {
	int from, money, enemy;
	
	bool operator >(const P& p) const {
		return enemy > p.enemy;
	}
};

struct city {
	int money, enemy;
};

int main() {
	while (cin >> N >> M >> L, N|M|L) {
		vector<vector<edge> > E(N);
		int a, b, d, e;
		for (int i = 0; i < M; i++) {
			cin >> a >> b >> d >> e;
			E[a-1].push_back({b, d, e});
			E[b-1].push_back({a, d, e});
		}
		
		bool G[N+1][L+1];
		fill_n((bool *)G, (N+1)*(L+1), false);

		priority_queue<P, vector<P>, greater<P>> q;
		city arr[N];
		for(int i = 0; i < N; i++) {
			arr[i].money = 0;
			// arr[i].enemy = ;
		}
		q.push((P){0, L, 0});
		while(!q.empty()) {
			P p = q.top(); q.pop();
			// goal
			if (p.from == N-1) {
				cout << p.enemy << endl;
				break;
			}
			if (G[p.from][p.money]) continue;
			G[p.from][p.money] = true;
			for (int i = 0; i < E[p.from].size(); i++) {
				edge e = E[p.from][i];
				q.push((P){e.to-1, p.money, p.enemy+e.enemy});
				if (p.money-e.distance >= 0) {
					q.push((P){e.to-1, p.money-e.distance, p.enemy});
				}
			}
		}
	}	
	return 0;
}

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

int main() {
  vector<int>X(5);
  
  cin >>X.at(0)>> X.at(1) >> X.at(2) >> X.at(3) >> X.at(4);
  
  for(int i=0; i<5; i++){
    if(X.at(i)==0){
    cout<< i+1 << endl;
    }
  }
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
  string s;
 

  while(cin >> s){
 int ans_JOI = 0,ans_IOI = 0;
    for(int i = 0 ; i < s.size() ; i++ ){
      if(s[i] == 'J' && s[i + 1] == 'O' && s[i + 2] == 'I')ans_JOI++;
      if(s[i] == 'I' && s[i + 1] == 'O' && s[i + 2] == 'I')ans_IOI++;
    }
  cout << ans_JOI << endl;
  cout << ans_IOI << endl;
  }
  return 0;
}

Measured memory_bytes: 1196
n, k = map(int, input().split())
S = input().replace("01", "0 1").replace("10", "1 0").split()
S = [""]*("0" in S[0])+S+[""]*("0" in S[-1])
*L, = map(len, S)
A = [sum(L[:2*k+1])]
for i in range(0, len(S)-2*k-1, 2):
    A += A[-1]-L[i]-L[i+1]+L[i+2*k+1]+L[i+2*k+2],
print(max(A))

Measured memory_bytes: 54252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,M;
  cin>>N>>M;
  if(N==1&&M==1){
    cout<<1<<endl;
  }
  if(N==1&&M!=1){
    cout<<M-2<<endl;
  }
  if(M==1&&N!=1){
    cout<<N-2<<endl;
  }
  if(M>1&&N>1){
    cout<<(N-2)*(M-2)<<endl;
  }
  
  
  
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
struct Edge { int nxt, to; }edge[100000];
LL n, m, sum = 0, f[100000] = {}, w[1000000] = {}, now = 0;
int main() {
	cin >> w[0] >> w[1]>>w[2];
	std::cout <<(w[0]==w[1]?w[2]:w[1]==w[2]?w[0]:w[1]) << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

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

int main() {
	int T;
	cin >> T;
	while (T--) {
		ll A, B, C, D;
		cin >> A >> B >> C >> D;
		puts([&] {
			if (A < B || B > D) return false;
			if (C + 1 - B >= 0) return true;
			// C + 1 < B -> C < B - 1
			ll g = gcd(B, D);
			A %= B;
			if (C < A || g == 1) return false;
			ll mt = (A + ((C - A) / g + 1) * g) % B;
			return C >= mt;
		}() ? "Yes" : "No");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lp(i, n) for(int i = 0; i < n; i++)
#define rlp(i, n) for(int i = n-1; i >= 0; i--)
#define loop(i, a, b) for(int i = a; i <= b; i++)
#define rloop(i, a, b) for(int i = a; i >= b; i--)
#define mem(a, val) memset(a, val, sizeof a);
#define all(v) v.begin(),v.end()
#define ll long long
#define ld long double
#define mp_ make_pair
#define sz(s) (int)s.size()
#define pb push_back
const int MAX = 1e5 + 5;
const int inf = 1e9+1;
const ll OO = 1e18;
const ll mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

ll MOD(ll a, ll b){
    return ((a % b) + b) % b;
}

int main(){


    int n;
    cin>> n;
    vector<ll> v(n);

    ll sum = 0, ans = 0;
    lp(i, n) cin>> v[i], sum += v[i];

    lp(i, n-1){
        sum -= v[i];
        ans = MOD(ans + MOD(MOD(sum, mod) * v[i], mod), mod);
    }
    cout<< ans;
    return 0;
}


Measured memory_bytes: 4824
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>
typedef long long ll;
#define maxn 50
using namespace std;
priority_queue<ll> maxqueue;
priority_queue<ll,vector<ll>,greater<ll> > minqueue;
ll a[300010],aa[100100],bb[100010],fsum,bsum;


int main(int argc,char const* argv[])
{
  ll n,N,M;
  cin >> n;
  N=3*n;
  for(int i=0;i<N;i++)
    {
      cin >> a[i];
    }
  fsum=0;
  for(int i=0;i<n;i++)
    {
      minqueue.push(a[i]),fsum+=a[i];
    }
  aa[0]=fsum;
  bsum=0;
  for(int i=N-1;i>=2*n;i--)
    {
      maxqueue.push(a[i]),bsum+=a[i];
    }
  bb[n]=bsum;
  for(int i=n;i<2*n;i++)
    {
      fsum+=a[i];
      minqueue.push(a[i]);
      fsum-=minqueue.top();minqueue.pop();
      aa[i-n+1]=fsum;
    }
  for(int i=n*2-1;i>=n;i--)
    {
      bsum+=a[i];
      maxqueue.push(a[i]);
      bsum-=maxqueue.top();maxqueue.pop();
      bb[i-n]=bsum;
    }
  M=-100000000000000;
  for(int i=0;i<=n;i++)
    {
      M=max(M,aa[i]-bb[i]);
    }

  cout << M << endl;
  return 0;
}

Measured memory_bytes: 5876
#include<stdio.h>

int main(void)
{
    int a,b,h;

    scanf("%d %d %d",&a,&b,&h);
    if(((a>=1||a<=100)&&(b>=1||b<=100))&&((h>=1||h<=100)&&(h%2==0)))
        printf("%d\n",((a+b)*h)/2);

    return 0;

}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int h, w, s;
int u[33][33];
int sum[33][33];
int S;
pint dp[33][33][33][33];

int get(int sx, int sy, int gx, int gy) {
  return sum[gy][gx] - sum[gy][sx] - sum[sy][gx] + sum[sy][sx];
}

pint solve(int lx, int ly, int rx, int ry) {
  pint &res = dp[lx][ly][rx][ry];
  if(~res.first) return res;
  int ss = get(lx, ly, rx, ry);
  if(s - S + ss < 0) {
    res = make_pair(0, inf);
    return res;
  }
  res = make_pair(1, s - S + ss);
  reps(x, lx+1, rx) {
    pint ld = solve(lx, ly, x, ry);
    pint rd = solve(x, ly, rx, ry);
    pint tmp = make_pair(ld.first+rd.first, min(ld.second, rd.second));
    chmax(res, tmp);
  }
  reps(y, ly+1, ry) {
    pint ud = solve(lx, ly, rx, y);
    pint dd = solve(lx, y, rx, ry);
    pint tmp = make_pair(ud.first+dd.first, min(ud.second, dd.second));
    chmax(res, tmp);
  }
  return res;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(cin >> h >> w >> s, h || w || s) {
    memset(u, 0, sizeof(u));
    memset(sum, 0, sizeof(sum));
    rep(i, h) rep(j, w) cin >> u[i][j], sum[i+1][j+1] = u[i][j];
    rep(i, h) rep(j, w) {
      sum[i+1][j+1] += sum[i+1][j] + sum[i][j+1] - sum[i][j];
    }
    rep(i, 33) rep(j, 33) rep(k, 33) rep(l, 33) {
      dp[i][j][k][l] = make_pair(-1, -1);
    }
    S = get(0, 0, w, h);
    pint ans = solve(0, 0, w, h);
    cout << ans.first << " " << ans.second << endl;
  }

  return 0;
}

Measured memory_bytes: 21724
#include <iostream>
#include <vector>
#include <cstdlib>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main() {
  int N, A;
  string ans = "APPROVED";
  cin >> N;
  rep(i, N) {
    cin >> A;
    if (A % 2 != 0) continue;
    else if (A % 3 != 0 && A % 5 != 0) ans = "DENIED";
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 999999999
#define llong long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
7
50
30
50
100
50
80
30
)");
#define cin input
#endif

int main()
{
	int n;
	cin >> n;
	vector<int> vec(n);
	REP(i,n)
		cin >> vec[i];
	
	VSORT(vec);
	vec.erase(unique(vec.begin(), vec.end()), vec.end());
	cout << vec.size() << endl;
}

Measured memory_bytes: 256
N = int(input())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


ans = 0
prime = factorization(N)
if N == 1:
    print(0)
    exit()
for li in prime:
    check = li[1]
    i = 1
    while check > 0:
        if check >= i:
            ans += 1
        check -= i
        i += 1
print(ans)


Measured memory_bytes: 9492