akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BCollectingBallsEasyVersion {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        int k;
        in >> k;
        int res = 0;
        vi X(n);
        in >> X;
        trav(x, X) {
            res += 2 * min(x, abs(k - x));
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BCollectingBallsEasyVersion solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  string s,t,ans;
  cin >> s >> t;
  for(int i=0;i<n;i++){
    ans += s[i];
    ans += t[i];
  }
  cout<< ans <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(ll i=0; i<N; i++)
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

struct Corr{
    ll a;
    ll b;
};

bool Comp(Corr c1, Corr c2){
    ll a1 = c1.a; ll b1 = c1.b;
    ll a2 = c2.a; ll b2 = c2.b;
    if(b1 != b2) return b1 < b2;
    else{
        return a1 > a2;
    }
}

int main(){
    ll N; cin >> N;
    vector<Corr> M;
    rep(i,N){
        ll A; ll B; cin >> A >> B;
        M.push_back({A,B});
    }

    sort(M.begin(), M.end(), Comp);

    ll time = 0; bool flag = true;
    rep(i,N){
        time += M[i].a;
      	//cout << time << " " << M[i].b << endl;
        if(time > M[i].b){
            flag = false;
            break;
        }
    }
    if(flag) cout << "Yes";
    else cout << "No";

}

Measured memory_bytes: 6512
n,p,i,a[51];
main(){
	for(;~scanf("%d", &n),n;) {
		for(p=i=0;i<n;i++)scanf("%d",&a[i]);
		for(i=1;i<=n;i++){
			if(a[i-1]+1!=a[i]||n-i==0) {
				if(i-p-1)printf(n-i?"%d-%d ":"%d-%d\n",a[p],a[i-1]);
				else printf(n-i?"%d ":"%d\n",a[p]);
				p=i;
			}
		}
	}
	exit(0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  	string s;cin>>s;
  	sort(s.begin(), s.end());
  	if(s[0]==s[2]){				
    	cout<<"No\n";
    } else{
      	cout<<"Yes\n";
    }

	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define mii map<lli,lli>
#define msi map<string,lli>
#define pii pair<lli,lli> 
#define vi vector<lli> 
#define vvi vector< vector<lli> >
#define sz(x) (lli)x.size()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX1 998244353
#define MAX2 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define input(data,n,command) for(lli i=0;i<n;i++){lli tmp;cin>>tmp;data.pb(tmp);command}
#define sort_asc(a) sort(a.begin(),a.end());
//#define sort_desc(a) sort(a.begin(),a.end(),greater<lli>());
#define display(a) for(lli i = 0 ;i<a.size();i++){cout<<a[i]<<" ";} cout<<endl;
#define rep(i,a,b) for(lli i = a;i < b;i++)
#define endl "\n"

//Written By MUDIT BHARDWAJ...
/*--------------------------------------------------------------------*/
//vector<pair<lli,lli>>adj[300010];

lli solve()
{
    //start from here
    lli k;
    cin>>k;
    if((k%2 == 0)||(k%5 == 0))
    {
        cout<<"-1";
    }
    else
    {
        lli ans = 0;
        lli cur = 7%k;
        ans++;
        while(cur != 0)
        {
            cur = cur*10 + 7;
            cur = cur%k;
            ans++;
        }
        cout<<ans;
    }
    return 0;
}

int main()
{
    ios
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli T=1;
    //cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}
/*-----------------------------------------------------------------------*/

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


void solve()
{
	ll n;
	cin>>n;
	ll nn=n;
	ll ans=0;
	for(auto x:prime_factor(n)){
		ll y=x.second;
		ll c=1;
		while(y>=c){
			++ans;
			y-=c;
			++c;
		}
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3664
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll combination(ll n,ll r){
    ll sum=1;
    rrep(i,min(r,n-r)) (sum*=(n-i+1))%=mod;
    return sum;
}

//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,sum=0;
    cin>>n;

    rrep(i,n){
        if(i%3!=0 && i%5!=0) sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u = sc.next();

		if(s.equals(u)) {
			System.out.println((a-1)+" "+b);
		}else {
			System.out.println(a + " "+(b-1));
		}

		sc.close();
	}

}

Measured memory_bytes: 38668
import java.util.*;

class Main {
    public static void main(final String[] args) {
        int  n[] = new int[3];
        try  (Scanner scanner = new Scanner(System.in);) {
            for(int i = 0; i < 3; i++) {
                n[i] = scanner.nextInt();
            }
            System.out.println(calculation(n));
        }
    }

    private static int calculation(final int[] n) {
        int train = n[0] * n[1];
        int taxi = n[2];
        if (train < taxi) {
            return train;
        }
        return taxi;
    }
}


Measured memory_bytes: 21844
#include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<set>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0)break;
		
		int hon[1000];
		rep(i,m){
			cin>>hon[i];
		}
		
		int right,left;
		right=0;
		left=1000000000;
		
		int ans;
		while(1){
			double harf = double(right+left)/2;
			
			int cont=0;
			int sum=0;
			
			int flg=1;
			rep(i,m){
				if(sum+hon[i]<=harf){
					sum+=hon[i];
				}else{
					i--;
					cont++;
					sum=0;
				}
				
				if(cont>=n){
					flg=0;
					break;
				}
			}
			
			if(flg==0){
				right=harf;
			}else{
				left = harf+0.5;
			}
			
			ans=left;
			if(right+1 == left)break;
		}
		
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 0
#include <cstdlib>
#include <iostream>


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

    int v;
    while (std::cin >> v) {
        if (v < 1000) {
            std::cout << "ABC" << std::endl;
        }else{
            std::cout << "ABD" << std::endl;
        }
    }
    return EXIT_SUCCESS;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n;
  ll buf;
  cin >> n;
  if(n == 3)
    cout << "2 5 63" << endl;
  else if(n <= 15002){
    for(i = 1; i <= n - 3; i++){
      cout << i * 2 << " ";
    }
    if((n - 2) % 3 == 1)
      cout << (i + 2) * 2 << " ";
    else
      cout << i * 2 << " ";
    cout << 3 spa 9 << endl;
  }
  else{
    if(n % 2 == 0)
      buf = 15000;
    else
      buf = 14999;
      
    for(i = 1; i <= buf; i++){
      cout << i * 2 << " ";
    }
    
    for(i = 1; i <= n - buf; i++)
      cout << (2 * i - 1) * 3 << " ";
    cout << endl;
  }
    

  

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
//const int mod= int(1e9)+7;
const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin >>n;
    string s;cin >>s;
    string x,y;
    int ans=0;
    for (int i = 0; i <n; ++i) {
        x=s.substr(0,i);
        y=s.substr(i,n-i);
        int a=x.size();
        int b=y.size();
        int now=0;
        for (char j ='a'; j <='z'; ++j) {
            bool flg=false;
            bool tmp=false;
            for (int k = 0; k <a; ++k) {
                if(j==x[k])flg=true;
            }
            for (int k = 0; k < b; ++k) {
                if(j==y[k])tmp=true;
            }
            if(flg and tmp)now++;
        }
        ans=max(ans,now);
    }
    cout <<ans<<"\n";
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(in) in.begin(), in.end()
#define FIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int, int> PII;

ll getAns(vector<ll> v1, vector<ll> v2){
    ll n = v1.size(), ans = 0;
    for(ll i = 0 ; i < n ; i++){
        ll x = v1[i], y = v2[i];
        x -= y;
        x *= x;
        ans += x;
    }
    return ans;
}

int main(){
    FIO;
    ll n, d;
    cin >> n >> d;
    vector<ll> arr[n];
    for(ll i = 0 ; i < n ; i++){
        for(ll j = 0 ; j < d ; j++){
            ll x;
            cin >> x;
            arr[i].push_back(x);
        }
    }
    ll cnt = 0;
    for(ll i = 0 ; i < n ; i++){
        for(ll j = i+1 ; j < n ; j++){
            ll x2 = getAns(arr[i], arr[j]);
            ll x = sqrt(x2);
            if(x * x == x2){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int a[305][305],l[100010],r[100010],ax[305*305],ay[305*305],sum[305*305];

int main(){
    int h,w,d;
    cin>>h>>w>>d;
    rep(i,h)rep(j,w){
        cin>>a[i][j];
        a[i][j]--;
        ay[a[i][j]]=i;
        ax[a[i][j]]=j;
    }
    int q;
    cin>>q;
    rep(i,q){
        cin>>l[i]>>r[i];
        l[i]--; r[i]--;
    }
    for(int i=h*w-1; i>=0; --i){
        if(i+d>=h*w)continue;
        sum[i]=sum[i+d]+(abs(ay[i]-ay[i+d])+abs(ax[i]-ax[i+d]));
    }
    rep(i,q){
        cout<<sum[l[i]]-sum[r[i]]<<endl;
    }
}

Measured memory_bytes: 5800
#include <iostream>
#include <vector>

using namespace std;

class UnionFind {
public:
    explicit UnionFind(int N) : root(N, -1), size(N, 1) {}
    int getRoot(int u){ return root[u] == -1 ? u : root[u] = getRoot(root[u]); }
    int getSize(int u){ return size[getRoot(u)]; }
    bool same(int a, int b){
        return getRoot(a) == getRoot(b);
    }
    bool merge(int a, int b){
        int u = getRoot(a);
        int v = getRoot(b);
        if(u == v) return false;
        root[u] = v;
        size[v] += size[u];
        return true;
    }
private:
    vector<int> root;
    vector<int> size;
};

int main(){
    int N, M, K;
    while(cin >> N >> M >> K){
        vector<int> frNum(N, 0);
        vector<vector<int>> block(N);
        UnionFind uf(N);
        for(int i=0;i<M;i++){
            int A, B; cin >> A >> B;
            uf.merge(A-1, B-1);
            ++frNum[A-1];
            ++frNum[B-1];
        }
        for(int i=0;i<K;i++){
            int C, D; cin >> C >> D;
            block[C-1].push_back(D-1);
            block[D-1].push_back(C-1);
        }
        for(int i=0;i<N;i++){
            int res = uf.getSize(i) - frNum[i] - 1;
            for(auto& b : block[i]) if(uf.same(i, b)) --res;
            if(i) cout << " ";
            cout << res;
        }
        cout << endl;
    }
}

Measured memory_bytes: 7552
#include<cstdio>
    #define mod (1000000007)
    long long f[110000];
    int main()
    {
    	int n,m;
    	scanf("%d%d",&n,&m);
    	if(n>m) {int t=n;n=m;m=t;}
    	if(m-n>1) {printf("0\n");return 0;}
    	f[0]=1;
    	for(int i=1;i<=m;i++) f[i]=f[i-1]*i%mod;
    	int x=n==m?2:1;
    	printf("%lld\n",f[n]*f[m]*x%mod);
    	return 0;
    }

Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#pragma _attribute_((optimize("-O2")))
#pragma comment(linker, "/STACK:102400000,102400000")

#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include <sstream>
#include <time.h>
#include <iomanip>

//#define Local

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input1.txt", "r", stdin);
	//freopen("output1.txt", "w", stdout);

	int n;
	cin >> n;
	int res = 0;
	int cont = 0;
	for (int i = 1; i <= n; i++)
	{
		int tmp;
		cin >> tmp;
		if (tmp == i)
			cont++;
		else if (cont != 0)
		{
			if (cont == 1)
				res++;
			else
				res += (cont + 1) / 2;
			cont = 0;
		}
	}
	if (cont != 0)
	{
		if (cont == 1)
			res++;
		else
			res += (cont + 1) / 2;
	}
	cout << res << endl;

#ifdef Local
	cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  double l;
  cin >> l;
  double ans = pow(l / 3, 3);
  print10(ans);
  return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*n]

    def det(x, y, z):
        a = [x[0]-y[0], x[1]-y[1]]
        b = [z[0]-x[0], z[1]-x[1]]
        return a[0]*b[1]-a[1]*b[0]

    def convex_hull(ab):
        q, k = [], 0
        xy = sorted(ab)  # ここをいじることで初期位置を変えられる。
        for i in range(n):
            while k > 1 and det(q[k-1], q[k-2], xy[i]) <= 0:
                k -= 1
                q.pop()
            q.append(xy[i])
            k += 1
        t = k
        for i in range(n-2, -1, -1):
            while k > t and det(q[k-1], q[k-2], xy[i]) <= 0:
                k -= 1
                q.pop()
            q.append(xy[i])
            k += 1
        return q[:k-1]

    ans = convex_hull(ab)
    l = len(ans)
    d = dict()
    from math import acos
    from math import pi
    if l == 2:
        for a, b in ans:
            d[(a, b)] = 0.5
    else:
        b = 0
        ans += ans
        for i in range(l):
            a1 = ans[i][0]-ans[i-1][0]
            b1 = ans[i][1]-ans[i-1][1]
            a2 = ans[i+1][0]-ans[i][0]
            b2 = ans[i+1][1]-ans[i][1]
            a = acos((a1*a2+b1*b2)/((a1**2+b1**2)*(a2**2+b2**2))**0.5)
            d[tuple(ans[i])] = a/2/pi
    for a, b in ab:
        if (a, b) in d:
            print(d[(a, b)])
        else:
            print(0)


main()

Measured memory_bytes: 3192
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//nCrを返す関数.
long long int comb(long long int n, long long int r){
	if(n < r || n < 0)
		return 0;
	long long int x = 1, y = 1;
	if (n-r < r) r = n - r;
	for (long long int i = 0; i < r; i++)
	{
		x = x * (n - i);
		y = y * (i + 1);
	}
	return x / y;
}


int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int k = 0;
	rep(i, n)
	{
		if(a[i] != i+1)
			k++;
	}
	cout << (k <= 2 ? "YES" : "NO") << endl;
	return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    while (cin >> n && n) {
        char c[100];
        for (int i = 0; i < 100; ++i) cin >> c[i];
        int pla = 0;
        vector<int> num(n);
        int now = 0;
        for (int i = 0; i < 100; ++i) {
            if (c[i] == 'M') ++num[now];
            if (c[i] == 'S') {
                ++num[now];
                pla += num[now];
                num[now] = 0;
            }
            if (c[i] == 'L') {
                ++num[now];
                num[now] += pla;
                pla = 0;
            }
            now = (now + 1) % n;
        }
        sort(num.begin(), num.end());
        for (int i = 0; i < n; ++i) {
            cout << num[i] << " ";
        }
        cout << pla << '\n';
    }
    return 0;
}


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

bool f(vector<pair<int, int>> edges) {
	for (int i = 0; i < 2; ++i)
		if (edges[i].second != edges[i + 1].first)
			return false;
	set<int> s;
	for (auto &&x : edges) {
		s.insert(x.first);
		s.insert(x.second);
	}
	return s.size() == 4;
}

bool f(vector<pair<int, int>> edges, const int mask) {
	for (int i = 0; i < 3; ++i)
		if (mask & (1 << i))
			swap(edges[i].first, edges[i].second);
	return f(edges);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	vector<pair<int, int>> edges(3);
	for (auto &&x : edges)
		cin >> x.first >> x.second;

	sort(edges.begin(), edges.end());

	do {
		for (int mask = 0; mask < (1 << 3); ++mask)
			if (f(edges, mask)) {
				cout << "YES";
				return 0;
			}
	} while (next_permutation(edges.begin(), edges.end()));
	cout << "NO";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

//絶対値を返す
int ToPositive(int x) {
	return (0 < x) * x - (0 > x) * x;
}

int main(){

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((ToPositive(a-b)<=d&&ToPositive(c-b)<=d)||ToPositive(a-c)<=d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }



    return 0;
}

Measured memory_bytes: 760
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
	int a = 0;
	int b = 0;
	int k = 0;
	
	cin >> a >> b >> k;
	int i = 0;
	for (i = max(a,b); i > 0; i--) {
		if (a % i == 0 && b % i == 0) {
			k--;
		}
		if (k == 0) {
			break;
		}
	}
	cout << i << endl;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

def main():
	n,k=map(int,input().split())
	
	cnt=0
	
	while True:
		if n==0:
			print(cnt)
			exit(0)
		else:
			n//=k
			cnt+=1
	
	
	
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 38384
#!/usr/bin/env python3
import sys
import collections
from itertools import groupby

def solve(N: int, s: "List[str]"):
    s = [sorted(s[i]) for i in range(N)]
    s.sort()
    group = groupby(s)
    answer = 0
    for key, group in group:
        a = len(list(group))
        answer += int(a*(a-1)/2) if a > 1 else 0
    print(answer)
   


    # for i in range(N):
    #     a = 1
    #     pop_index = []
    #     for j in range(i+1,len(ss)):
    #         if ss[i] == ss[j]:
    #             a += 1
    #             pop_index.append(j)
        
    #     ss = [ss[i] for i in range(len(ss)) if i not in pop_index]
    #     answer += int(a*(a-1)/2) if a > 1 else 0
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32448
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  string s;
  R s;
  int ans=0;
  rep(i,s.size()) {
    if(s[i]=='o') ans++;
  }
  ans+=15-s.size();
  if(ans>=8) pr("YES");
  else pr("NO");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

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


int main(int argc, char** argv) {
    string s;
    cin >> s;
    if (s.length() == 6 && s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strs = br.readLine().split(" ");
		int[] inputData = new int[n];
		for (int i = 0; i < n; i++) {
			inputData[i] = Integer.parseInt(strs[i]);
		}
		printArray(inputData, bubbleSort(inputData, n));
	}

	public static int bubbleSort(int[] A, int N) {
		int swapCnt = 0;
		int flag = 1;
		while (flag == 1) {
			flag = 0;
			for (int i = N - 1; i > 0; i--) {
				if (A[i] < A[i - 1] ) {
					int temp = A[i];
					A[i] = A[i - 1];
					A[i - 1] = temp;
					swapCnt++;
					flag = 1;
				}
			}
		}
		return swapCnt;
	}

	public static void printArray(int[] target, int swapCnt) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < target.length; i++) {
			sb.append(target[i]);
			if (i < target.length - 1) {
				sb.append(" ");
			}
		}
		sb.append("\n");
		sb.append(swapCnt);
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 24244
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
S,T = read().decode('utf-8').rstrip().split()
 
A = [None]*(N+N)
A[::2] = S
A[1::2] = T


print(''.join(A))

Measured memory_bytes: 3060
Nu=int(input())
dic={}
ls=[]
maxd=0
for i in range(Nu):
  tmp=input()
  if tmp in dic:
    dic[tmp]=dic[tmp]+1
    maxd=max(dic[tmp],maxd)
  else:
    dic[tmp]=0
for k,v in dic.items():
  if v==maxd:
    ls.append(k)
ls.sort()
for x in ls:
  print(x)

Measured memory_bytes: 32096
#include<stdio.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7,MAX=1e6;
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
typedef struct{int SPF[1000001];int Primes[1229];int sz;}Template;
struct T{int fact[1000001],inv[1000001];};
Template P;struct T MODINV;
static inline int MPow(int a,int b){return b?1l*MPow(1l*a*a%MOD,b>>1)*(b&1?a:1)%MOD:1;}
static inline void ready(void)
{
  *P.SPF=1,*P.Primes=2,P.sz=1;
  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;
  rep(i,MAX/2-1)
  {
    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;
    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}
  }
}
static inline void init(void)
{
  MODINV.fact[0]=1;rep(i,MAX)MODINV.fact[i+1]=1l*MODINV.fact[i]*(i+1)%MOD;
  MODINV.inv[MAX]=MPow(MODINV.fact[MAX],MOD-2);
  rep(i,MAX)MODINV.inv[MAX-1-i]=1l*MODINV.inv[MAX-i]*(MAX-i)%MOD;
}
int main(void)
{
  int N=IN(),A=0,flag=0,invsum=0,k=0,lcm=1,x=0,unique[10000],box[168]={0};ready();init();
  rep(i,N)
  {
    A=IN();invsum=(invsum+1l*MODINV.fact[A-1]*MODINV.inv[A]%MOD)%MOD;
    rep(j,168){x=0;while(A%P.Primes[j]==0){A/=P.Primes[j];if(box[j]<++x)box[j]=x;}}
    if(A!=1){rep(j,k){if(unique[j]==A)flag=1;continue;}if(!flag)unique[k++]=A;}flag=0;
  }
  rep(i,168){rep(j,box[i]){lcm=1l*lcm*P.Primes[i]%MOD;}}
  rep(i,k){lcm=1l*lcm*unique[i]%MOD;}
  x=1l*lcm*invsum%MOD;return printf("%d\n",x),0;
}

Measured memory_bytes: 13336
#include <iostream>

using namespace std;

#define rep(i,q) for(int i = 0; (q) > i; i++)

int main(){
  int N,W;cin>>N>>W;
  int we[N],val[N];
  rep(i,N){
    cin >> we[i] >> val[i];
  }
  long long dp[N+1][100006];
  rep(i,100005){
    dp[0][i] = 1000000001;
  }
  dp[0][0] = 0;
  
  rep(i,N){
    rep(j,100005){
      if(j >= val[i]){
        dp[i+1][j] = min(dp[i][j],dp[i][j-val[i]]+we[i]);
        //cout << dp[i][j] << " | " <<dp[i][j-val[i]]+we[i] << " = " << dp[i+1][j] << endl;
      } else {
        dp[i+1][j] = dp[i][j];
        //cout << dp[i][j] << " = " << dp[i+1][j]   << endl;
      }
    }
  }
  int mx;
  rep(i,100005){
    if(dp[N][i] <= W){
      mx = i;
    }
  }
  cout << mx << endl;
}

//dp[i番目][重さ] = 価値
//dp[i番目][価値] = 重さ

//1000*100

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long LL;
const int maxn=1e5+10;
int a[maxn];
int main()
{
	int n;
	scanf("%d",&n);
	ll sum=0;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	for(int j=i+1;j<=n;j++)sum+=a[i]*a[j];
	printf("%lld\n",sum);
}

Measured memory_bytes: 256
#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
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int n; cin >> n;
    vector<int> x(n),l(n);
    for(int i = 0;i < n;i ++) cin >> x.at(i) >> l.at(i);

    vector<pair<int,int> > xl(n);
    for(int i = 0;i < n;i ++){
        xl.at(i).first = x.at(i);
        xl.at(i).second = l.at(i);
    }
    sort(xl.begin(),xl.end());

    for(int i = 0;i < n;i ++){
        x.at(i) = xl.at(i).first;
        l.at(i) = xl.at(i).second;
    }

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }

    vector<int> hantei(n,1);
    int a = 0,b = 1;
    while(a < n && b < n){
        int tuka1,tuka2;
        tuka1 = a;
        tuka2 = b;
        a = min(tuka1,tuka2);
        b = max(tuka1,tuka2);

        if(x.at(a) + l.at(a) > x.at(b) - l.at(b)){
            if(x.at(a) + l.at(a) < x.at(b) + l.at(b)){
                hantei.at(b) = 0;
                b ++;
                continue;
            }else{
                hantei.at(a) = 0;
                a = b+1;
                continue;
            }
        }

        a = b + 1;

    }

    int ans = 0;
    for(int i = 0;i < n;i ++) ans += hantei.at(i);

    cout << ans << endl;
}

Measured memory_bytes: 7132
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }


        static void Main(string[] args)
        {
            var s = ReadLine()[0];
            WriteLine(s == 'S' ? "Cloudy" : s == 'C' ? "Rainy" : "Sunny");
        }
    }
}


Measured memory_bytes: 11092
//AtCoder ABC049 A - 居合を終え、青い絵を覆う / UOIAUAI
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

int main() {
    string c;
    cin>>c;
    if(c[0]=='a'||c[0]=='e'||c[0]=='i'||c[0]=='o'||c[0]=='u'){
        cout<<"vowel"<<endl;
    } else{
        cout<<"consonant"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <math.h>

using namespace std;

int main(void){
  long long int n,k,i,j;
  string s;
  cin >> n >> k;
  cin >> s;
  
  list<int> oneList;
  int oneCount = 0;
  int zeroCount = 0;
  bool isOne = false;
  for(auto ch:s){
    if(ch == '1'){
      if(zeroCount>0) oneList.push_back(zeroCount*-1);
      zeroCount = 0;
      oneCount++;
    }
    else{
      if(oneCount>0) oneList.push_back(oneCount);
      oneCount = 0;
      zeroCount++;
    }
  }
  if(zeroCount>0) oneList.push_back(zeroCount*-1);
  if(oneCount>0) oneList.push_back(oneCount);
  
  int flipCount = 0;
  int maxOneCount = 0;
  int currentCount = 0;
  list<int> flippedOneList;
  for(auto count:oneList){
    if(count>0){
      currentCount += count;
    }
	else{
      currentCount -= count;
      flipCount++;
    }
    flippedOneList.push_back(count);
    if(flipCount>k){
      while(true){
        int value = flippedOneList.front();
        flippedOneList.pop_front();
        if(value>0){
          currentCount -= value;
          continue;
        }
        else{
          currentCount += value;
        }
        flipCount--;
        break;
      }
    }
    if(currentCount > maxOneCount){
      maxOneCount = currentCount;
    }
  }
  cout << maxOneCount << endl;
   
  return 0;
}




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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
        cout<<a[i];
        if(i<n-1)cout<<" ";
    }
    cout<<"\n";
    //InsertionSort
    for(int i=1;i<n;i++){
        int v=a[i];
        int j=i-1;
        while(j>=0&&a[j]>v){
            a[j+1]=a[j];
            j--;
            a[j+1]=v;
        }
        for(int k=0;k<n;k++){
            cout<<a[k];
            if(k<n-1)cout<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3080
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	char a;
	
	cin>>a;
	
	a++;
	
	cout<<a<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 256
L, R = map(int, input().split())
MOD = 2019
ans = float("inf")
if R - L >= MOD - 1:
    ans = 0
else:
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min(ans, (i*j) % MOD)
print(ans)

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,x,t;
	cin >> n >> x >> t;
	if (n % x == 0) cout << (n/x)*t;
	else cout << (n/x + 1)*t;
	return 0;
}


Measured memory_bytes: 3644
n=int(input())
l1=list(map(int,input().split()))
p=1
k=0
if 0 in l1:
  print("0")
  exit()
for i in range(n):
  p*=l1[i]
  if p>10**18:
    k=1
    break
if k==1:
  print("-1")
else:
  print(p)

Measured memory_bytes: 21640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    long double N,T,A;
    cin >>N>>T>>A;
    ll ans=-1;
    long double mn = 2000000.0;
    rep(i,N){
        ll h;
        cin>>h;
        long double t = T-h*0.006;
        if(abs(A-t) <mn){
            mn = abs(A-t);
            ans = i+1;
        }
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3704
#include<stdio.h>
#include<string.h>
#define maxn 10005
char s[] = {"abcdefghijklmnopqrstuvwxyz"};
int a[maxn];


int main()
{
	int i;
	char c;
	memset(a, 0, sizeof(a));
	while(scanf("%c", &c) != EOF)
		for(i = 0; i < 26; i++)
			if(s[i] == c)
			{
				a[i] = 1;
				break;
			}
	for(i = 0; i < 26; i++)
			if(!a[i])
			{
				printf("%c", s[i]);
				break;
			}
	if(i == 26)
		printf("None");
	return 0;
}

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

int main(){
  int s;
  cin >> s;
  vector<int> a;
  int i=1;
  a.push_back(s);
  while(true){
    i++;
    if(a[i-2]%2==0){
      a.push_back(a[i-2]/2);
    }else{
      a.push_back(3*a[i-2]+1);
    }
    
    for(int j=0; j<(i-1); j++){
      if(a[j] == a[i-1]){
        cout << i << endl;
        return 0;
      }  
    }
  }

  return 0;
}




Measured memory_bytes: 256
from collections import Counter

H, W, N = map(int, input().split())

# dict[(i, j)]: 左上が(i,j)である3*3のマスに含まれる、黒マスの個数
dict = {}
for  _ in range(N):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    for i in range(max(0, a - 2), min(H - 3, a) + 1):
        for j in range(max(0, b - 2), min(W - 3, b) + 1):
            dict[(i, j)] = dict.get((i, j), 0) + 1

nums = Counter(dict.values())
print((H - 2) * (W - 2) - sum(nums.values()))
for i in range(1, 10):
    if i in nums:
        print(nums[i])
    else:
        print(0)


Measured memory_bytes: 152072
unittest
{
	assert( [ "000" ].parse.expand.solve == 1 );
	assert( [ "10010010" ].parse.expand.solve == 3 );
	assert( [ "0" ].parse.expand.solve == 0 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	auto wb = 0L;		// 白黒白黒…の順で並べるときの塗り替え要の枚数
	auto bw = 0L;		// 黒白黒白…の順で並べるときの塗り替え要の枚数
	foreach( i, c; s )
	{
		if( i % 2 == 0 )
		{
			if( c == '0' ) bw++;
			else           wb++;
		}
		else
		{
			if( c == '0' ) wb++;
			else           bw++;
		}
	}
	return min( wb, bw );
}


Measured memory_bytes: 536
#include "bits/stdc++.h"
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 202020;
ll in[NM];
ll cnt[NM];
ll cnt2[NM];

void solve() {
    ll N;
    cin >> N;
    ll tmp=0;
    for (ll i = 0; i < N; i++) {
        cin >> in[i];
        cnt[in[i]]++;
    }
    ll sum=0;

    for (ll i = 0; i <= N; i++) {
        ll a = cnt[i];
        cnt2[i] = (a*(a-1))/2;
        sum += cnt2[i];
    }

    for (ll i = 0; i < N; i++) {
          ll a=cnt[in[i]] ;
            cout << sum  - (((a * (a-1))/2) - ((a-1) * (a-2))/2);
            cout << "\n";
    }
}




int main() {
    solve();
    return 0;
}








Measured memory_bytes: 6912
n = gets.to_i
ts = n.times.map{gets.chomp.split.map(&:to_i)}
dp = Array.new(n+1){Array.new(3,0)}
0.upto(n-1) do |i|
  0.upto(2) do |j|
    0.upto(2) do |k|
      next if j == k
      if dp[i+1][k] < dp[i][j] + ts[i][k]
        dp[i+1][k] = dp[i][j] + ts[i][k]
      end
    end
  end
end
puts dp[n].max

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

int main() {
    long long int n,m,t1,t2,temp;
    cin >>n >>m ;
    long long int arr[n],h[n],ans=n;
    for(long long int i=0;i<n;i++)
    {
        cin>>h[i];
        arr[i]=1;
    }
    while(m--)
    {
        cin>>t1>>t2;
        if(h[t1-1]<h[t2-1])
        {
            if(arr[t1-1])
            {
                arr[t1-1]=0;
                ans--;
            }
        }
        else if(h[t1-1]>h[t2-1])
        {
            if(arr[t2-1])
            {
                arr[t2-1]=0;
                ans--;
            }
        }
        else
        {
            if(arr[t2-1])
            {
                arr[t2-1]=0;
                ans--;
            }
            if(arr[t1-1])
            {
                arr[t1-1]=0;
                ans--;
            }
        }
        
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N, M;
string S;

int main() {
  cin >> N >> M >> S;

  stack<int> m;
  int i = N;
  while (i != 0) {
    bool found = false;
    for (int j = i - M; j < i; ++j) {
      if (j >= 0 && S[j] == '0') {
        m.push(i - j);
        i = j;
        found = true;
        break;
      }
    }
    if (!found) break;
  }

  if (i != 0) {
    cout << -1 << endl;
    return 0;
  }

  cout << m.top();
  m.pop();
  while (!m.empty()) {
    cout << " " << m.top();
    m.pop();
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 868
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  while (a >= b) {
    b *= 2;
    --k;
  }
  while (b >= c) {
    c *= 2;
    --k;
  }
  if (k >= 0) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}



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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

int main() {
    li a,b;
    cin>>a>>b;
    repp(i,1,100100){
        li aa=i*0.08;
        li bb=i*0.1;
        if(aa==a&&bb==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;

    return 0;
}

Measured memory_bytes: 256