akhauriyash/Code-Regression huggingface dataset:
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1153&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;


int main() {
	int N,M;

	while(cin >> N >> M && N && M)
	{
		vector<int> tarou(N,0);
		vector<int> hanako(M,0);

		rep(i,N){ cin >> tarou[i]; }
		rep(i,M){ cin >> hanako[i]; }

		pair<int, int> ans = make_pair(150,150);
		
		rep(i,N)
		{
			rep(j,M)
			{
				swap(tarou[i],hanako[j]);
				if(accumulate(ALL(tarou),0) == accumulate(ALL(hanako),0))
				{
					if((ans.first+ans.second) > (tarou[i]+hanako[j])){
						ans = make_pair(hanako[j], tarou[i]);	
					}
				}
				swap(tarou[i],hanako[j]);
			}
		}

		if(ans.first == 150 && ans.second == 150){
			cout << -1 << endl;
		}else{
			cout << ans.first << " " << ans.second << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1196
N,K = map(int,input().split())
n = []
temp = N
count = temp
for i in range(N):
    while count >=K:
        a = count//K
        b = count%K
           #  print(a)
   #     print(b)
        n.append(b)
        count = a
    #    print(count)
    else:
        n.append(count%K)
        break
print(len(n))


Measured memory_bytes: 2940
#include <stdio.h>
int main()
{
    int n, reversedInteger = 0, remainder, originalInteger;

    scanf("%d", &n);

    originalInteger = n;
    while( n!=0 )
    {
        remainder = n%10;
        reversedInteger = reversedInteger*10 + remainder;
        n /= 10;
    }
    if (originalInteger == reversedInteger)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 128
n,m = map(int,input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]
flag = False

for p in range(n): #Aの中の始点の縦座標
    for q in range(n): # Aの中の始点の横座標
        # print('p,q =',p,q)
        # print(p+m-1 < n) #縦にはみ出ないかチェック
        # print(q+m-1 < n) #横にはみ出ないかチェック
        # print(all(all( a[p+i][q+j] == b[i][j] for j in range(m)) for i in range(m))) #全部のマスが同じかどうかチェック
        if p+m-1 < n and q+m-1 < n and all(all( a[p+i][q+j] == b[i][j] for j in range(m)) for i in range(m)):
            flag = True

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int n, ans, h, before;

int main() {
    cin >> n;
    rep(i, n) {
        cin >> h;
        if (h > before) ans += h - before;
        before = h;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define fod find_by_order
#define fastio ios::base_sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x  << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;

void readf(string x){
	freopen((x+".in").c_str(),"r",stdin);
	freopen((x+".out").c_str(),"w",stdout);
}


int read()
{
	bool min = 0;
	int  result = 0;
	char ch;
	ch = getchar();
	while(1)
	{
		if(ch == '-') break;
		if(ch >='0' && ch <= '9') break;
		ch = getchar();
	}
	if(ch == '-') min = 1;else result = ch-'0';
	while(1)
	{
		ch =getchar();
		if(ch< '0' || ch>'9') break;
		result = result * 10 + (ch-'0');
	}
	if(min) return -result;
	return result;
}

int main(){
	int N;
	cin >> N;
	int temp;
	int ans = 0;
	int ok = 0;
	int x[N+5];
	for(int i=1;i<=N;i++){
		cin >> x[i];
	}
	for(int i=2;i<=N;i++){
		
		if(x[i] >= x[i-1] && (ok == 0 || ok == 1)){
			if(ok == 0 && x[i] == x[i-1]) ok = 0;
			else
			ok = 1;
			continue;
		}
		else if(x[i] <= x[i-1] && (ok == 0 || ok == 2)){
			if(ok == 0 && x[i] == x[i-1]) ok = 0;
			else
			ok = 2;
			continue;
		}
		else {
		
			ans++;
			ok = 0;
		}
	}
	ans++;
	cout << ans << "\n";
}


Measured memory_bytes: 640
def f(i, r)
   (i * r / 100 - i).to_i
end

a, b = gets.split.map(&:to_i)

ans = -1
for i in 0..1000000
    if f(i,108) == a && f(i,110) == b
        ans = i 
        break
    end
end

puts ans

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

using namespace std;

struct node
{
	int num,l,r,ls,rs,lazy;
	node(int _l,int _r)
	{
		num=INT_MAX;
		l=_l;
		r=_r;
	}
};

vector<node> T;

int make(int l,int r)
{
	int id=T.size();
	T.push_back(node(l,r));
	T[id].ls=(l+1==r?-1:make(l,(l+r)/2));
	T[id].rs=(l+1==r?-1:make((l+r)/2,r));
	return id;
}

void update(int id,int l,int r,int t)
{
	if(l==r||T[id].l>=r||T[id].r<=l)
		return ;
	if(T[id].l>=l&&T[id].r<=r)
	{
		T[id].num=t;
		return ;
	}
	int mid=(T[id].l+T[id].r)>>1;
	if(T[id].num>=0)
		T[T[id].ls].num=T[T[id].rs].num=T[id].num;
	if(l<mid)
		update(T[id].ls,l,r,t);
	if(r>mid)
		update(T[id].rs,l,r,t);
	T[id].num=-1;
}

int getmin(int id,int l,int r)
{
	if(l==r||T[id].l>=r||T[id].r<=l)
		return INT_MAX; 
	if(T[id].num>=0)
		return T[id].num;
	int mid=(T[id].l+T[id].r)>>1,mi=INT_MAX;
	if(l<mid)
		mi=min(mi,getmin(T[id].ls,l,r));
	if(r>mid)
		mi=min(mi,getmin(T[id].rs,l,r));
	return mi;
}

int main()
{
	T.reserve(200100);
	int n,q;
	scanf("%d%d",&n,&q);
	make(0,n);
	for(int i=0;i<q;i++)
	{
		int com;
		scanf("%d",&com);
		if(com==0)
		{
			int s,t,x;
			scanf("%d%d%d",&s,&t,&x);
			update(0,s,t+1,x);
		}
		else
		{
			int s;
			scanf("%d",&s);
			printf("%d\n",getmin(0,s,s+1));
		}
	}
	return 0;
}

Measured memory_bytes: 7560
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <unordered_map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	string s;
	cin >> s;

	auto check = [&](int len) {

		unordered_map<string, int> mp;
		for (int j = 0; j <= N - len; j++) {
			string tmp = s.substr(j, len);
			auto itr = mp.find(tmp);
			if (itr == mp.end()) mp.emplace(tmp, j);
			else if (j - itr->second >= len) return true;
		}
		
		return false;
	};

	vector<int> len(N);
	iota(len.begin(), len.end(), 0);
	cout << *partition_point(len.begin(), len.end(), check) - 1 << endl;

	return 0;
}


Measured memory_bytes: 6696
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
 
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979
 
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	int N,A;
	cin>>N>>A;
	if(N%500<=A) print("Yes");
	else print("No");
	return 0;
}


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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; }

// const int INF = 1001001001;
// long long max => LLONG_MAX

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    
    vector<ll> t(n);
    for(int i = 0; i < n; i++) cin >> t[i];
    ll ans = t[0];
    for(int i = 1; i < n; i++){
        ll gcd = gcd_euclid(ans, t[i]);
        ans = (ans / gcd) * t[i];
    }
    cout << ans << endl;

    return 0;
}


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

typedef long long ll;
typedef double ld;

#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int > 
#define pii pair< ll, ll > 
#define len length 
#define fi first
#define se second
#define dt cout<<"HEre\n";
#define sz size
const ll inf=1e18+1e17;
const ll mod = 1e9+7;


ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const ll N=4e5+5;


void solve() {
	int x;
	cin>>x;
	x=x/200;
	x=x-2;
	x=8-x;
	cout<<x<<'\n';


  
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
	ll t=1;
//	cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
    //	cout << clock() / double(CLOCKS_PER_SEC) << endl;
}

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

string reverse(string a){
  string r;
  for( int i=0;i<(int)a.length();i++ )
    r = a[i] + r;
  return r;
}
int main(){
  int m;
  cin >> m;
  string s;
  while(m--){
    cin >> s;
    set<string> st;
    for( int i=1;i<(int)s.length();i++ ){
      string a = s.substr(0,i);
      string b = s.substr(i);
      string ra = reverse(a);
      string rb = reverse(b);
      st.insert( a+b );
      st.insert( a+rb);
      st.insert( ra+b );
      st.insert( ra+rb);
      st.insert( b+a );
      st.insert( b+ra);
      st.insert( rb+a );
      st.insert( rb+ra);
    }
    cout << st.size() << endl;
  }
  return 0;
}

Measured memory_bytes: 1296
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;

        for(int i = 1;i <= num ;i++){
            int sum = 0;
            int n = i;
            while(n != 0){
                sum += n%10;
                n /= 10;
            }
            if(a<=sum && sum<=b)
                ans += i;
        }

        System.out.println(ans);
    }
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m; assert(b>=0); for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int d, n;

signed main() {
	cin >> d >> n;
	if (n==100) n++;
	if (d==0) cout << n << ln;
	else if (d==1) cout << n*100 << ln;
	else cout << n*10000 << ln;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		long w=s.nextInt();
		long h=s.nextInt();
		long x=s.nextInt();
		long y=s.nextInt();
		System.out.println(w*h*0.5+" "+(x*2==w&&y*2==h?1:0));
	}
}

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

int main() 
{
  auto cmp = [](const string &s1, const string &s2) 
  {
    if (s1.size() != s2.size())
      return s1.size() > s2.size();
    return s1 > s2;
  };
  int n, m;
  cin >> n >> m;
  vector<int> as(m);
  for (auto &a : as) cin >> a;
  sort(as.begin(), as.end(), greater<>());
  vector<int> need = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  vector<int> dp(n + 1, -1);
  dp[0] = 0;
  for (int i = 0; i < n; i++) 
    for (auto a : as) 
    {
      if (dp[i] == -1)
        continue;
      if (i + need[a] > n)
        continue;
      dp[i + need[a]] = max(dp[i + need[a]], dp[i] + 1);
    }
  int cur = n;
  vector<int> ans;
  while (cur > 0) 
    for (auto a : as) 
    {
      int left = cur - need[a];
      if (left >= 0 && dp[left] != -1 && dp[cur] == dp[left] + 1) 
      {
        ans.push_back(a);
        cur = left;
        break;
      }
    }
  for (auto x : ans)
    cout << x;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  for (int i = 0; i < tx - sx; i++) cout << 'R';
  for (int i = 0; i < ty - sy; i++) cout << 'U';
  for (int i = 0; i < tx - sx; i++) cout << 'L';
  for (int i = 0; i < ty - sy; i++) cout << 'D';
  cout << "DR";
  for (int i = 0; i < tx - sx; i++) cout << 'R';
  for (int i = 0; i < ty - sy; i++) cout << 'U';
  cout << "ULUL";
  for (int i = 0; i < tx - sx; i++) cout << 'L';
  for (int i = 0; i < ty - sy; i++) cout << 'D';
  cout << "DR" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf 1000000000000000000

using namespace std;

signed main(){
    int n,k;
    cin>>n>>k;
    vi x(n);
    rep(i,n){
        cin>>x[i];
    }
    int ans=inf;
    rep(i,n-k+1){
        ans=min({ans,abs(x[i])+abs(x[i+k-1]-x[i]),abs(x[i+k-1])+abs(x[i+k-1]-x[i])});
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
typedef long long ll;
#define rep(i,a,b,c) for(ll i=(a);i<(b);i+=(c))

int main(void){
    ll K,X;
    scanf("%lld %lld",&K,&X);
    rep(i,X-(K-1),X+K,1){
        if(i==X+K-1){
            printf("%lld",i);
            break;
        }
        printf("%lld ",i);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1724
'use strict'

const Main = (input) => {
  const tmp = input.trim().split('\n')
  const N = parseInt(tmp[0].split(' ')[0])
  const M = parseInt(tmp[0].split(' ')[1])
  const C = parseInt(tmp[0].split(' ')[2])

  const Barr = tmp[1].split(' ').map(Number)

  let count = 0

  for (let i = 2; i <= N + 1; i++) {
    let Sum = 0
    const Aarr = tmp[i].split(' ').map(Number)
    for (let j = 0; j < M; j++) {
      Sum += Aarr[j] * Barr[j]
    }
    Sum += C
    if (Sum > 0) {
      count += 1
    }
  }

  let result = count

  console.log(result)
  return result
}

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

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n, a[maxn];

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

 ll x; cin>>x;
  --x;
  ll ans = x * (x + 1) / 2;
  cout<<ans;
  

  return 0;
}


Measured memory_bytes: 256
public class Main {


  private static void solve() {
    int n = ni();
    int[] v = na(n);
    int[] c = na(n);
    
    int sum = 0;
    for (int i = 0; i < n; i ++) {
      if (v[i] - c[i] > 0) {
        sum += v[i] - c[i];
      }
    }
    System.out.println(sum);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)     for(lint i=n-1;i>=0;--i)
#define REPR1(i,n)    for(lint i=n;i>0;--i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	string s = in<string>();
	int w = in();
	for (int i = 0; i < s.length(); i += w)cout << s[i];
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a[2000005];
int main()
{
    string s;
    int cnt=0;
    cin >> s;
    int mx=0;;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='R')
            cnt++;
        else
        {
            mx = max(cnt,mx);
            cnt=0;
        }
    }
    mx = max(cnt,mx);
    cout << mx << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e+9 + 7;

int main(){
 ll n;
  cin >> n;
  ll a[n];
  ll suma = 0;
  for(int i = 0;i<n;++i){
    cin >> a[i];
    suma += a[i];
  }
  
  ll sum = 0;
  
  for(int i = 0;i<60;++i){
    ll x = 0;
    for(int j = 0;j<n;++j){
      if((a[j] >> i) & 1) ++x;
    }
    
    sum += ((x*(n-x))%mod) * ((1ll << i)%mod);
  }
  ll ans = sum%mod;
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <tuple>
#include <ctime>
#include <list>
#include <map>
#include <set>

#define REP(i,n) for(int i=0;i<(n);i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))
#define SIZE(x) (int)(x).size()

#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

const int MAXN = 1e5 + 10;

int p[MAXN], q[MAXN];

int main() {
    int W, H;
    while (cin >> W >> H) {
        vector<PII> val;
        REP(i, W) {
            scanf("%d", p + i);
            val.PB(MP(p[i], i));
        }
        REP(i, H) {
            scanf("%d", q + i);
            val.PB(MP(q[i], W + i));
        }
        int cntx = W + 1;
        int cnty = H + 1;
        SORT(val);
        LL ans = 0, r = (LL)cntx * cnty - 1;
        TR(it, val) if (r > 0) {
            if (it->second < W) {
                --cntx;
                r -= cnty;
                ans += (LL)cnty * it->first;
            } else {
                --cnty;
                r -= cntx;
                ans += (LL)cntx * it->first;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2932
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i(a); i <= (b); ++i)

template <class T> inline bool smin(T&x, const T&y) { return y < x ? x = y, 1 : 0; }
template <class T> inline bool smax(T&x, const T&y) { return x < y ? x = y, 1 : 0; }

typedef long long ll;

const int P(1e9 + 7);
inline void inc(int &x, int y) { if ((x += y) >= P) x -= P; }
char s[10002];
int a, n, f[10002][100];
int dfs(int p, int d, bool lim){
	if (p > n) return !d;
	if (!lim && ~f[p][d]) return f[p][d];
	int up = lim ? s[p] : 9, r = 0;
	REP(i, 0, up) inc(r, dfs(p + 1, (d + i) % a, lim && i == up));
	if(!lim) f[p][d] = r;
	return r;
}
int main() {
	scanf("%s%d", s + 1, &a), n = strlen(s + 1);
	REP(i, 1, n) s[i] ^= '0';
	memset(f, -1, sizeof f);
	std::cout << (dfs(1, 0, 1) + P - 1) % P;
	return 0;
}



Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ALDS_1_4_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int targetCnt = int.Parse(Console.ReadLine());
            
            List<int> targetList = Console.ReadLine()
                                         .Split(' ')
                                         .Select(i => int.Parse(i))
                                         .ToList();
            int missingCnt = int.Parse(Console.ReadLine());

            List<int> missingList = Console.ReadLine()
                                           .Split(' ')
                                           .Select(i => int.Parse(i))
                                           .ToList();

            Console.WriteLine(missingList.Count(i => Program.IsLinearSearch(targetList, i)));
        }

        /// <summary>
        /// 目的リストに迷い数字？が見つかったらtrue、そうでなければfalse
        /// </summary>
        /// <param name="targetList"></param>
        /// <param name="missing"></param>
        /// <returns></returns>
        private static bool IsLinearSearch(List<int> targetList, int missing)
        {
            foreach (int tmpNum in targetList)
            {
                if (tmpNum == missing)
                {
                    return true;
                }
            }

            return false;
        }
    }
}



Measured memory_bytes: 20336
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        sc.nextLine();
        String slimesStr = sc.nextLine();
        StringBuilder newStr = new StringBuilder();
        
        char lastchar = 0;
        for(int i = 0; i < slimesStr.length(); i++){
            char ci = slimesStr.charAt(i);
            if ( ci != lastchar ){
                newStr.append(String.valueOf(ci));    
            }
            lastchar  = ci;
        }
        
        System.out.println(newStr.length());
    }
}

Measured memory_bytes: 30396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
#define INF 1001001001
#define debug(...) fprintf(stderr, __VA_ARGS__)

int dp[60][60][60];

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < 60; j++) {
      for (int k = 0; k < 60; k++) {
        dp[i][j][k] = INF;
      }
    }
  }
  dp[a][b][c] = 0;
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < 60; j++) {
      for (int k = 0; k < 60; k++) {
        if (i && j) dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j - 1][k] + 1);
        if (i && k) dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j][k - 1] + 1);
        if (j && k) dp[i][j][k] = min(dp[i][j][k], dp[i][j - 1][k - 1] + 1);
        if (i >= 2) dp[i][j][k] = min(dp[i][j][k], dp[i - 2][j][k] + 1);
        if (j >= 2) dp[i][j][k] = min(dp[i][j][k], dp[i][j - 2][k] + 1);
        if (k >= 2) dp[i][j][k] = min(dp[i][j][k], dp[i][j][k - 2] + 1);
      }
    }
  }
  int reza = INF;
  for (int i = 0; i < 60; i++) {
    reza = min(reza, dp[i][i][i]);
  }
  cout<<reza;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 

typedef long long ll;
const ll mod=1000000007;

// xの逆元,x!,x!の逆元
// intではダメ
ll inv[300001],fact[300001],invfact[300001];
void get_inv(){
	
	fact[0]=invfact[0]=inv[1]=1;

	for(int i=2;i<300001;i++){
		inv[i]=mod-(mod/i)*inv[mod%i]%mod;
	}

	for(int i=1;i<300001;i++){
		fact[i]=(fact[i-1]*i) % mod;
		invfact[i]=(invfact[i-1]*inv[i]) % mod;
	}
	
}

ll Choose(ll n,ll k)
{
	if (!(0 <= k && k <= n)) return 0;
	return (((fact[n] * invfact[k]) % mod) * invfact[n - k]) % mod;

}

int main(){

	long long h,w,a,b;
	cin>>h>>w>>a>>b;
	get_inv();

	long long res=0;
	for(int i=b;i<w;i++){
//		cout<<Choose(h-a-1+i,h-a-1)<<endl;
//		cout<<Choose(a+w-b-2-(i-b),w-b-1-(i-b))<<endl;
		res=(res+(Choose(h-a-1+i,h-a-1)*Choose(a+w-b-2-(i-b),w-b-1-(i-b)))%mod)%mod;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 7296
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    c_arr = []
    for i in range(3):
        _ = list(map(int,_in[i].split(' ')))
        c_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    sum_c_arr = sum([sum(c) for c in c_arr])
    if (c_arr[0][0]+c_arr[1][1]+c_arr[2][2]) == sum_c_arr/3 and \
       (c_arr[1][0]+c_arr[2][1]+c_arr[0][2]) == sum_c_arr/3 and \
       (c_arr[0][1]+c_arr[1][2]+c_arr[2][0]) == sum_c_arr/3 and \
       (c_arr[2][0]+c_arr[1][1]+c_arr[0][2]) == sum_c_arr/3 and \
       (c_arr[1][0]+c_arr[0][1]+c_arr[2][2]) == sum_c_arr/3 and \
       (c_arr[0][0]+c_arr[2][1]+c_arr[1][2]) == sum_c_arr/3:
        TF = 'Yes'
    else:
        TF = 'No'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(){
	int n,m,c,ans=0;
	cin>>n>>m>>c;
	vector<int>b(m);
	vector<vector<int>>a(n,vector<int>(m));
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<n;i++){
		int tmp=0;
		for(int j=0;j<m;j++){
			tmp+=a[i][j]*b[j];
		}
		tmp+=c;
		if(tmp>0) ans++;
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
	
  string s;
  int a,b,c,d,i,j,k;
  cin >> s;
  vector<int> l(26);
  
  for(i=0; i < s.length() ; i++){
    l[int(s[i]-'a')]++;
  }
  a=0;
  while(a<26){
	if(l[a]%2!=0){
		cout << "No" <<endl;
      return 0;
    }
    a++;
  }
  
  cout << "Yes" <<endl;
  
  return 0;
}


Measured memory_bytes: 256
S = str(input())
N = len(S)
A = []
B = []
for s in S:
    if s == 'R':
        A.append(1)
        B.append(0)
    if s == 'L':
        A.append(0)
        B.append(1)

for i in range(N - 1):
    if S[i] == 'R':
        if S[i + 1] == 'R':
            A[i + 2] += A[i]
            A[i] = 0

for i in range(1, N):
    if S[-i] == 'L':
        if S[-i - 1] == 'L':
            B[-i - 2] += B[-i]
            B[-i] = 0

C = []
for i in range(len(S)):
    C.append(str(A[i] + B[i]))

print(' '.join(C))


Measured memory_bytes: 11680
N, K = map(int, input().split())
A_list = list(map(int, input().split()))

LARGE = 10 ** 9 + 7
res_lr = 0
res_rl = 0

for i in range(N):
    for j in range(N):
        if A_list[i] > A_list[j]:
            if i < j:
                res_lr += 1
            else:
                res_rl += 1

res_1 = (res_lr * K) % LARGE
res_2 = ((res_lr + res_rl) * K * (K - 1) // 2) % LARGE

print((res_1 + res_2) % LARGE)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
void solve() {
	int n, d;
	cin >> n >> d;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		if (x * x + y * y <= (long long)d * d)
			ans++;
	}
	cout << ans;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
}

Measured memory_bytes: 3664
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

f=0
g=[a%10,b%10,c%10,d%10,e%10]
saisyo=10

f+=math.ceil(a/10)*10
f+=math.ceil(b/10)*10
f+=math.ceil(c/10)*10
f+=math.ceil(d/10)*10
f+=math.ceil(e/10)*10

for i in g:
    if 0<i<saisyo:
        saisyo=i
        

print(f-10+saisyo)

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

typedef long long ll;

using namespace std;

int main()
{
    ll t;
    cin>>t;
    int a=0,w=0,t1=0,r=0;
    while(t--)
    {
        string s;
        cin>>s;
        if(s[0]=='W'){w++;}
        else if(s[0]=='T'){t1++;}
        else if(s[0]=='R'){r++;}
        else{a++;}
    }
        cout<<"AC"<<" "<<"x"<<" "<<a<<endl;
        cout<<"WA"<<" "<<"x"<<" "<<w<<endl;
        cout<<"TLE"<<" "<<"x"<<" "<<t1<<endl;
        cout<<"RE"<<" "<<"x"<<" "<<r<<endl;
        
}


Measured memory_bytes: 3624
#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(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

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; }

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int n;
int s[100], e[100];
vector<vector<int>> edge(100,vector<int>());

int dfs(int v, int t){
  if(s[v]!=0)return t-1;
  s[v] = t;
  REP(i,edge[v].size()){
    int nx = edge[v][i];
    if(s[nx] != 0)continue;
    t = dfs(nx, t+1);
  }
  e[v] = ++t;
  return t;
}

int main(){
  cin >> n;
  
  REP(i,n){
    int u;
    cin >> u;
    int k;
    cin >> k;
    REP(j,k){
      int v;
      cin >> v;
      v--;
      edge[i].emplace_back(v);
    }
  }

  int t = 0;
  REP(i,n){
    t = dfs(i,t+1);
  }

  REP(i,n){
    printf("%d %d %d\n", i+1, s[i], e[i]);
  }


}



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

int main() {
  pair<double, double> p1, p2;
  cin >> p1.first >> p1.second >> p2.first >> p2.second;
  double ans = sqrt( pow(p1.first - p2.first, 2) + pow(p1.second - p2.second, 2) );
  cout << fixed << setprecision(10);
  cout << ans << endl;
}


Measured memory_bytes: 3264
import sys
readline = sys.stdin.readline

import heapq
T = int(readline())
from collections import deque
for t in range(T):
  N,A,B,C,D = map(int,readline().split())
  q = [(0, N)]
  heapq.heapify(q)
  seen = set()
  while q:
    cost,n = heapq.heappop(q)
    if n in seen:
      continue
    seen.add(n)
    if n == 0:
      print(cost)
      break
      
    heapq.heappush(q, (cost + n * D, 0))
    if n % 2 == 0:
      heapq.heappush(q, (cost + A, n // 2))
    else:
      heapq.heappush(q, (cost + D + A, (n + 1) // 2))
      heapq.heappush(q, (cost + D + A, (n - 1) // 2))
      
    if n % 3 == 0:
      heapq.heappush(q, (cost + B, n // 3))
    else:
      rest = n % 3
      heapq.heappush(q, (cost + rest * D + B, (n - rest) // 3))
      heapq.heappush(q, (cost + (3 - rest) * D + B, (n - rest + 3) // 3))
      
    if n % 5 == 0:
      heapq.heappush(q, (cost + C, n // 5))
    else:
      rest = n % 5
      heapq.heappush(q, (cost + rest * D + C, (n - rest) // 5))
      heapq.heappush(q, (cost + (5 - rest) * D + C, (n - rest + 5) // 5))


Measured memory_bytes: 12956
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

int main() {

    IO; 

    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll> m;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        m[a[i]]++;
    }
    sort(a,a+n);
    
    
    ll ans=0;
    ll N=n-m.size();
    cout<<n-(N+1)/2 * 2;
}


Measured memory_bytes: 7296
import java.util.*;
import java.awt.geom.*;
public class Main {
	double EPS = 1.0e-08;
	
	private void doit() {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int M = sc.nextInt()-1;
			int L = sc.nextInt()-1;
			if(n == 0 && M == -1 && L == -1) break;
			Point2D [][] point = new Point2D.Double[n][5];
			Line2D [][] line = new Line2D.Double[n][5];
			//input
			for(int i=0; i < n; i++){
				double x = sc.nextDouble();
				double y = sc.nextDouble();
				double a = sc.nextDouble();
				double r = sc.nextDouble();
				//each point
				for(int j=0; j < 5; j++){
					double rad = Math.toRadians(-a + (double)j * 72);
					double endx = x + r * Math.sin(rad);
					double endy = y + r * Math.cos(rad);
					point[i][j] = new Point2D.Double(endx, endy);
				}
				//each line
				for(int j=0; j < 5; j++){
					line[i][j] = new Line2D.Double(point[i][j] , point[i][(j+2)%5]);
				}
			}
			double [][] pass = new double[n][n];
			//calc
			for(int i=0; i < n; i++){
				pass[i][i] = 0.0;
				for(int j=i+1; j< n; j++){
					double ans = 1 << 24;
					for(int k = 0; k < 5; k++){
						for(int l = 0; l < 5; l++){
							Line2D nowi = line[i][k];
							Line2D nowj = line[j][l];
							if(nowi.intersectsLine(nowj)){
								ans = 0.0;
								continue;
							}
							double res = getDis1(nowi,nowj);
							ans = Math.min(ans, res);
						}
					}
					pass[i][j] = ans; pass[j][i] = ans;
				}
			}//end i
			
			
			for(int j=0; j < n; j++){
				for(int i = 0;i < n; i++){
					for(int k = 0; k < n; k++){
						pass[i][k] = Math.min(pass[i][k], pass[i][j] + pass[j][k]);
					}
				}
			}
			System.out.printf("%1.16f\n",pass[M][L]);
		}
	}

	private double getDis1(Line2D a, Line2D b) {
		Point2D a1 = a.getP1();
		Point2D a2 = a.getP2();
		Point2D b1 = b.getP1();
		Point2D b2 = b.getP2();
		double res = getD(a1,a2,b1);
		res = Math.min(res, getD(a1,a2,b2));
		res = Math.min(res, getD(b1,b2,a1));
		res = Math.min(res, getD(b1,b2,a2));
		return res;
	}

	private double getD(Point2D a, Point2D b, Point2D c) {
		Point2D ba = getV(b,a);
		Point2D ca = getV(c,a);
		Point2D ab = getV(a,b);
		Point2D cb = getV(c,b);
		double result;
		if(getDot(ba,ca) < EPS){
			result = a.distance(c);
		}
		else if(getDot(ab,cb) < EPS){
			result = c.distance(b);
		}
		else{
			result = Math.abs(getCross(ba,ca)) / b.distance(a);
		}
		return result;
	}

	private double getCross(Point2D a, Point2D b) {
		return (a.getX() * b.getY() - a.getY() * b.getX());
	}

	private double getDot(Point2D a, Point2D b) {
		return (a.getX() * b.getX() + a.getY() * b.getY());
	}

	private Point2D getV(Point2D a, Point2D b) {
		Point2D res = new Point2D.Double(a.getX() - b.getX(), a.getY() - b.getY());
		return res;
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

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

  double x[n], y[n];
  rep(i, n) cin >> x[i];
  rep(i, n) cin >> y[i];

  double D=0;
  rep(i, n) {
    D += abs(x[i] - y[i]);
  }
  printf("%.15lf\n", D);

  D=0;
  rep(i, n) {
    D += pow(abs(x[i] - y[i]), 2);
  }
  printf("%.15lf\n", sqrt(D));

  D=0;
  rep(i, n) {
    D += pow(abs(x[i] - y[i]), 3);
  }
  printf("%.15lf\n", cbrt(D));

  double Dr[n]={0};
  rep(i, n) {
    Dr[i] = abs(x[i] - y[i]);
  }
  printf("%.15lf\n", *max_element(Dr, Dr+n));

}



Measured memory_bytes: 3420
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int N,K,X,Y,s=0;
    cin>>N>>K>>X>>Y;
    if(N<=K) s=N*X;
    else s=X*K+(N-K)*Y;
    cout<<s<<endl;
return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
read = sys.stdin.read
#readlines = sys.stdin.readlines
from collections import defaultdict

def main():
    def from10to2(p):
        res = []
        while p:
            p, t = divmod(p, 2)
            res.append(str(t))
        return "".join(res[::-1])

    def from2to10(p):
        res = 0
        num2 = 1
        for c in p[::-1]:
            if c == '1':
                res += num2
            num2 *= 2
        return res

    def f(p):
        if p == 0:
            return 0
        elif d1[p] > 0:
            return d1[p]
        else:
            ppop = from10to2(p).count('1')
            p2 = p % ppop
            fp = f(p2) + 1
            d1[p] = fp
            return fp

    n = int(input())
    x = list(input())

    numof1 = x.count('1')
    bin2_p = [0] * n
    num2 = 1
    for i1 in range(1, n+1):
        bin2_p[-i1] = num2
        num2 = (num2 * 2) % (numof1 + 1)

    bin2_m = [0] * n
    num2 = 1
    if numof1 == 1:
        pass
    else:
        for i1 in range(1, n+1):
            bin2_m[-i1] = num2
            num2 = (num2 * 2) % (numof1 - 1)

    xas10 = from2to10(x)
    xas10_p = xas10 % (numof1 + 1)
    if numof1 == 1:
        xas10_m = 0
    else:
        xas10_m = xas10 % (numof1 - 1)
    d1 = defaultdict(int)
    d1[0] = 0
    for j1 in range(n):
        if x[j1] == '1':
            if numof1 == 1:
                print(0)
            else:
                t0 = xas10_m - bin2_m[j1]
                t0 = t0 % (numof1 - 1)
                if t0 == 0:
                    print(1)
                else:
                    print(f(t0) + 1)
        else:
            t0 = xas10_p + bin2_p[j1]
            t0 = t0 % (numof1 + 1)
            if t0 == 0:
                print(1)
            else:
                print(f(t0) + 1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 103604
x,y=map(int,input().split())

if abs(y)-abs(x) == 0:
  print(1)
elif x==0 or y==0:
  if y>x:
    print(abs(y-x))
  else:
    print(abs(y-x)+1)
else:
  if (x<0 and y>0) or (x>0 and y<0):
    print(abs(abs(y)-abs(x))+1)
  else:
    if x>y:
      print(x-y+2)
    else:
      print(y-x)

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b)
        cout << c << endl;
    else if (a == c)
        cout << b << endl;
    else
        cout << a << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >

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

    ll n, m, v, p;
    cin >> n >> m >> v >> p;

    ll arr[n];
    for (int i = 0; i < n; i++)
        cin >> arr[i];

    sort(arr, arr + n);
    
    ll ans = p;

    ll minus = m * (n - v);
    ll c = 0;
    for (int i = n - p - 1; i >= 0; i--)
    {
        if (arr[n - p] - m > arr[i])
            break;
        
        minus += (arr[i] - arr[i + 1]) * (c + 1);

        if (minus < 0)
            break;
        c++;
    }

    ans += c;

    cout << ans << "\n";
}


Measured memory_bytes: 1024
program main

  implicit none
  
  integer       ::  a(32), k  

  read(*,*) k
 a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51] 
  print*, a(k)

end program main


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

int main(int argc, char const *argv[])
{
    int a,b,c,sum;
    sum = 0;
    cin >> a >> b >> c;
    for (int i = a; i <= b; ++i)
    {
        if (c%i == 0)
        {
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, x1, x2, x3, x4, x5;
  cin >> a >> b;
  c = 0;
  for (int i = a; i <= b; i++) {
    x1 = i / 10000;
    x2 = (i - x1 * 10000) / 1000;
    x3 = (i - x1 * 10000 - x2 * 1000) / 100;
    x4 = (i - x1 * 10000 - x2 * 1000 - x3 * 100) / 10;
    x5 = i - x1 * 10000 - x2 * 1000 - x3 * 100 - x4 * 10;
    if (x1 == x5 && x2 == x4){
      c++;
    }
   }
  cout << c << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var b00, b01, b02, b10, b11, b12, b20, b21, b22 int
	fmt.Scanf("%d %d %d", &b00, &b01, &b02)
	fmt.Scanf("%d %d %d", &b10, &b11, &b12)
	fmt.Scanf("%d %d %d", &b20, &b21, &b22)
	var n int
	fmt.Scanf("%d", &n)
	bingo := [][]int{
		{b00, b01, b02},
		{b10, b11, b12},
		{b20, b21, b22},
	}
	for i := 0; i < n; i++ {
		var b int
		fmt.Scanf("%d", &b)
		for x := 0; x < 3; x++ {
			for y := 0; y < 3; y++ {
				if bingo[x][y] == b {
					bingo[x][y] = -1
				}
			}
		}
	}
	if (bingo[0][0] == -1 && bingo[0][1] == -1 && bingo[0][2] == -1) ||
		(bingo[1][0] == -1 && bingo[1][1] == -1 && bingo[1][2] == -1) ||
		(bingo[2][0] == -1 && bingo[2][1] == -1 && bingo[2][2] == -1) ||
		(bingo[0][0] == -1 && bingo[1][0] == -1 && bingo[2][0] == -1) ||
		(bingo[0][1] == -1 && bingo[1][1] == -1 && bingo[2][1] == -1) ||
		(bingo[0][2] == -1 && bingo[1][2] == -1 && bingo[2][2] == -1) ||
		(bingo[0][0] == -1 && bingo[1][1] == -1 && bingo[2][2] == -1) ||
		(bingo[2][0] == -1 && bingo[1][1] == -1 && bingo[0][2] == -1) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512