akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  Atcoder1
//
//  Created by Hamske on 2020/09/17.
//  Copyright © 2020 Author. All rights reserved.
//

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>

using namespace std;

//#define pb push_back
//#define mp make_pair
//
//#define F first
//#define S second

typedef long long ll;

#define rept(_i,iv,n,type) for(type _i=(type)(iv);_i<(type)(n);++_i)
//#define repi(_i,iv,n) rept(_i,iv,n,int)
//#define repl(_i,iv,n) rept(_i,iv,n,ll)

#define rept0(_i,n,type) rept(_i,0,n,type)
#define repi0(_i,n) rept(_i,0,n,int)
#define repl0(_i,n) rept(_i,0,n,ll)

//#define repst(_i,iv,n,type) for(type _i=iv;_i<=(type)(n);++_i)
//#define repsi1(_i,n) repst(_i,1,n,int)

#define REPT(_i,iv,_l,n,type) for(type _i=(type)(iv),_l=(type)(n);_i<_l;++_i)
//#define REPI(_i,iv,_l,n) REPT(_i,iv,_l,n,int)
//#define REPL(_i,iv,_l,n) REPT(_i,iv,_l,n,ll)
//
#define REPT0(_i,_l,n,type) REPT(_i,0,_l,n,type)
#define REPI0(_i,_l,n) REPT(_i,0,_l,n,int)
#define REPL0(_i,_l,n) REPT(_i,0,_l,n,ll)


//#define rrept(_i,x,e,type) for(type _i=((type)(x)-1);_i>=e;--_i)
//
//#define rrept0(_i,x,type) rrept(_i,x,0,type)
//
//#define RREPT(_i,x,_e,e,type) for(type _i=((type)(x)-1),_e=(type)(e);_i>=_e;--_i)
//
//#define RREPT0(_i,x,_e,type) RREPT(_i,x,_e,0,type)
//
//#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

//#define all(x) (x).begin(),(x).end()
#define REPV(v,_itr,_end) for(auto _itr=(v).begin(),_end=(v).end();_itr!=_end;++_itr)
#define REPVC(v,_itr,_end) for(auto _itr=(v).cbegin(),_end=(v).cend();_itr!=_end;++_itr)

#define td typedef
//#define tds(stl,type,name) typedef stl<type > name;
#define tdv(type,name) typedef vector<type > name;


//typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<vb > vvb;
typedef vector<int> vi;
typedef vector<vi > vvi;
typedef vector<ll> vll;
//typedef vector<vll > vvll;

#define mod99 998244353

int main(int argc, const char * argv[]) {
    int N;
    string S;
    cin>>N>>S;
    
    ll cnt=0;
    repi0(k, 1000){
        int match=0;
        int pin=k;
        int p=pin%10;
        repi0(i, N){
            if(p==S[i]-'0'){
                ++match;
                if(match==3){
                    ++cnt;
                    break;
                }
                pin/=10;
                p=pin%10;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
#define lli long long int

using namespace std;
vector<int>v;
int main()
{

    //freopen("input.txt","r",stdin);
    //ios_base::sync_with_stdio(false);cin.tie(0);
    //cout.precision(5);cout<<fixed;

    int a,b;
    cin>>a>>b;

    int prev=1;
    v.push_back(1);
    for(int i=2;i<=999;i++)
      {
          prev+=i;
          v.push_back(prev);
      }

    int indi = lower_bound(v.begin(),v.end(),a)-v.begin();

    for(int i=indi+1;i<v.size();i++)
    {
        if( abs(v[i-1] - a) ==  abs(v[i]-b) )
           {//cout<<"asfasfas";
               cout<<abs(v[i-1] - a);
               return 0;
            }
    }

   return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main()
{
	int n;
	set<int>s;
	cin>>n;
	for(int i=2;;i++)
	{
		s.insert(n);
		if(n%2)n=3*n+1;
		else n/=2;
		if(s.count(n))
		{
			cout<<i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class UnionFind(object):
    def __init__(self,n):
        self.__par=list(range(n))
        self.__rank=[0]*n
        self.__size=[1]*n

    def root(self,k):
        if(self.__par[k]==k): return k
        self.__par[k]=self.root(self.__par[k])
        return self.__par[k]

    def unite(self,i,j):
        i=self.root(i); j=self.root(j)
        par=self.__par; rank=self.__rank; size=self.__size
        if(i==j): return False
        if(rank[i]>rank[j]):
            par[j]=i
            size[i]+=size[j]
        else:
            par[i]=j
            size[j]+=size[i]
            if(rank[i]==rank[j]): rank[j]+=1
        return True

    def size(self,k):
        return self.__size[self.root(k)]

def resolve():
    n,m=map(int,input().split())
    uf=UnionFind(n)
    for _ in range(m):
        x,y,z=map(int,input().split())
        x-=1; y-=1
        uf.unite(x,y)
    print(len({uf.root(i) for i in range(n)}))
resolve()

Measured memory_bytes: 72920
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

N = ni()
H  = nl()

current = 0
ans = 0
for i in range(0,N-1):
    if H[i] >= H[i+1]:
        current +=1
    else:
        ans = max(current,ans)
        current = 0

ans = max(current, ans)
print(ans) 


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
int main(){
  	string s;
  	cin >> s;
  	long long a=s.size()-1;
  	for(int i=a;i>=0;i--){
  		if(s.substr(0,a/2)==s.substr(a/2,a/2)){
  			cout << a-1 << endl;
  			return 0;
  		}
  		a--;
  	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n,a,sum=1;
	string s;
	cin>>n;
	cin>>s;
	for(int i=0;i<n-1;i++)
	{
		a=i;
		for(int j=a+1;j<n;j++)
		{
			if(s[i]!=s[j])
			{
				sum++;
				i=j-1;
				break;
			}
			i=j-1;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 512
def solve(a, b):
    if a == b:
        yield []
    if a > b:
        for i in range(1, a+1):
            for x in solve(a % i, b):
                yield [i] + x

def subseq(a, b):
    if len(b) == 0: return True
    x = 0
    for t in a:
        if t == b[x]:
            x += 1
            if x == len(b):
                return True
    return False

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

R = []

for i in range(n):
    R.append(list(solve(A[i], B[i])))
    if len(R[-1]) == 0:
        print(-1)
        exit(0)

L = []
answer = 0

for i in range(50, 0, -1):
    T = L + list(range(i - 1, 0, -1))

    ok = True

    for j in range(n):
        cur = False

        for seq in R[j]:
            if subseq(T, seq):
                cur = True
                break

        if not cur:
            ok = False
            break

    if not ok:
        L.append(i)
        answer += 2**i

print(answer)


Measured memory_bytes: 4456
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N; cin >> N;
    vector<int> S(N); for (auto &s : S) cin >> s;
    Int ans = 0;
    for (int i = 1; i < N; i++) {
        int s = 0, e = N - 1;
        Int tmp = 0;
        if ((N-1) % i == 0) {
            while (s < e) {
                tmp += S[s] + S[e];
                s += i, e -= i;
                ans = max(ans, tmp);
            }
        } else {
            while (s < N-1 && i < e) {
                tmp += S[s] + S[e];
                s += i, e -= i;
                ans = max(ans, tmp);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 640
def read_i
  gets.chomp.split(' ').map(&:to_i)
end

n = read_i[0]

a = []
5.times do |i|
  a << read_i[0]
end

m = a.min

if n > m && (n % m) != 0
  puts (n / a.min) + 5
elsif n > m && (n % m) == 0
  puts (n / a.min) + 4
else
  puts 5
end


Measured memory_bytes: 1788
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main()
{
  int n;
  cin >> n;
  rep(i,n/7+1){
    rep(j,n/4+1){
      if(7*i+4*j==n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

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

int main() {

    string s,t, u;
    int a,b;
    cin >> s >> t;
    cin >> a >> b;

    cin >> u;

    if ( u==s )
        a--;
    else
        b--;

    cout << a << " " << b;

    return 0;
}


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

#define ll long long

using namespace std;

vector<ll> d[100005];
ll which;
ll dist[2][100005];

void dfs(ll cur, ll prev) {
  for (auto& child : d[cur]) {
    if (child != prev) {
      dist[which][child] = dist[which][cur] + 1;
      dfs(child, cur);
    }
  }
}

int main() {
  ll N;
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    d[a].push_back(b);
    d[b].push_back(a);
  }

  which = 0;
  dfs(0, -1);
  which = 1;
  dfs(N - 1, -1);
  ll black = 0, white = 0;
  for (int i = 0; i < N - 1; i++) {
    if (dist[0][i] > dist[1][i]) {
      black++;
    } else {
      white++;
    }
  }
  if (white > N / 2) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> h(N);
  rep(i, N) cin >> h[i];
  
  vector<int> dp(N);
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < N; i++) dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
  cout << dp[N-1] << endl;
  
  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

long long gcd(long long A, long long B) {  // A>B
  if (A < B) swap(A, B);
  if (B == 0)
    return A;
  else {
    return gcd(B, A % B);
  }
}


 



int main() {
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    
    ll ac = (A+C-1)/C; //切り上げ
    ll bc = B/C; //切り下げ
    ll ad = (A+D-1)/D; //切り上げ
    ll bd = B/D; //切り下げ

    ll t = (C*D)/gcd(C,D);
    ll at = (A+t-1)/t;
    ll bt = B/t; 
    ll ans = (B-A+1) - (bc-ac+1) - (bd-ad+1) + (bt-at+1);

    cout << ans << endl;


}



Measured memory_bytes: 256
from collections import deque

N = int(input())
A = [list(map(int, input().split())) for _ in range(N-1)]
Q, K = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(Q)]

d = [[] for _ in range(N)]
for a, b, c in A:
    d[a-1].append([b-1, c])
    d[b-1].append([a-1, c])

c = [0]*N
f = [False]*N
f[K-1] = True

q = deque([K-1])
while q:
    now = q.popleft()
    for nex, cost in d[now]:
        if f[nex]:
            continue
        c[nex] = c[now]+cost
        f[nex] = True
        q.append(nex)

for x, y in X:
    print(c[x-1]+c[y-1])

Measured memory_bytes: 87888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  double b=0;
  for(int i=0;i<n;i++){
    b += 1 / a[i];
  }
  double c=0;
  c = 1 / b;
  cout << c << endl;
 
}

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

int main(){
  int i,j,N,dig[30]={0},max,f=0;
  char ss[30];
  cin>>ss;
  N=strlen(ss);
  priority_queue<char> maxd;
  if(N==26){
     if(strcmp(ss,"zyxwvutsrqponmlkjihgfedcba")==0){
      printf("-1\n");
      return 0;
    }
    for(i=24;i>=0;i--){
      max=ss[i];
      for(j=25;j>i;j--){
        if(max<ss[j]){
          f=1;
          maxd.push(-ss[j]);
        }
      }
      if(f>0){
        for(j=0;j<i;j++){
          printf("%c",ss[j]);
        }
        max=maxd.top();
        printf("%c\n",-max);
        return 0;
      }
    }
  }else{
    for(i=0;i<N;i++)dig[ss[i]-'a']++;
    printf("%s",ss);
    i=0;
    while(dig[i]!=0)i++;
    printf("%c\n",'a'+i);
    return 0;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll MOD = (ll)pow(10, 9) + 7;

ll inv(ll x, ll y){
  ll p = x;
  ll e = y;
  ll ans = 1;
  
  while(e > 0){
    if(e % 2 == 0){
      p = p * p % MOD;
      e /= 2;
    } else{
      ans  = ans * p % MOD;
      e--;
    }
  }

  return ans;
}

int main(){
  ll X, Y;
  cin >> X >> Y;

  if((2*Y - X < 0) || (2*X - Y < 0) || ((2*Y - X) % 3 != 0) || ((2*X - Y) % 3 != 0)){
    cout << 0 << endl;
    return 0;
  }

  ll m = (2*Y - X) / 3;
  ll n = (2*X - Y) / 3;

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

  ll fact_mn = 1;
  ll fact_m, fact_n;

  rep2(i, 1, m + n + 1){
    fact_mn = fact_mn * i % MOD;
    if(i == m) fact_m = fact_mn;
    if(i == n) fact_n = fact_mn;
  }

  ll fact_m_inv = inv(fact_m, MOD - 2);
  ll fact_n_inv = inv(fact_n, MOD - 2);

  ll ans = fact_mn;
  ans = ans * fact_m_inv % MOD;
  ans = ans * fact_n_inv % MOD;

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


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

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

#define pb push_back
#define mp make_pair

const int N = 110;

int n;
char s[N];

int main(){
    scanf("%s", s);
    n = strlen(s);
    bool flag = 0;
    if(n & 1)   flag = 0;
    else{
        flag = 1;
        for(int i=0; i<n; i+=2){
            if(s[i] != 'h' || s[i+1] != 'i'){
                flag = 0;
                break;
            }
        }
    }
    puts(flag?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long maxn=2e6+5;
const long long inf=0x3f3f3f3f;
long long a[maxn],b[maxn],maxv=-inf;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	long long n,m,k;
	cin>>n>>m>>k;
	for(long long i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(long long i=1;i<=m;i++)
	{
		cin>>b[i];
		b[i]+=b[i-1];
	}
	for(long long i=0;i<=n;i++)
		 if(k>=a[i])
		 	maxv=max(maxv,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
	cout<<maxv<<endl;
	return 0;
}




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

int main()
{
  int n, d ;
  cin >> n >> d ;
  
  if(n%(2*d+1)==0)
    cout << n/(2*d+1) << endl ;
  else
    cout << (n/(2*d+1))+1 << endl ;    
  
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    ll n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();

    ll ans = 0;
    int x = 0, r = 0;
    REP(l,n){
        while (r < n && (x & a[r]) == 0){
            x |= a[r];
            r++;
        }
        ans += r - l;

        x &= (((1 << 22) - 1) ^ a[l]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include<complex>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;


int main(){
	int a, b;
	cin >> a >> b;
	cout << (a + b) % 24 << endl;
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>

using namespace std;
 
int main()
{
    int n,i,j,k,a[4][3][10];
	int b,f,r,v;
     
    for(j=0;j<4;j++){
        for(i=0;i<3;i++){
			for(k=0;k<10;k++){
				a[j][i][k]=0;
			}
        }
    }
             
    cin>>n;
    for(i=0;i<n;i++){
		cin>>b>>f>>r>>v;
		a[b-1][f-1][r-1]=a[b-1][f-1][r-1]+v;
	}
	
	for(j=0;j<3;j++){
		for(i=0;i<3;i++){
			for(k=0;k<9;k++){
				printf(" %d",a[j][i][k]);
			}
			printf(" %d\n",a[j][i][9]);
		}
		printf("####################\n");
	}
		for(i=0;i<3;i++){
			for(k=0;k<9;k++){
				printf(" %d",a[3][i][k]);
			}
			printf(" %d\n",a[3][i][9]);
		}
				

    return 0;
}

Measured memory_bytes: 1148
using System;
using System.Collections.Generic;
using System.Linq;

namespace _524_SearchingConstellation
{
	class Program
	{
		static void Main ( string[] args )
		{
			while (true)
			{
				//input
				int constellationElementCount = int.Parse (Console.ReadLine ());

				if (constellationElementCount == 0)
				{
					break;
				}

				Point[] constellationElementPoint = new Point[constellationElementCount];

				for (int lp = 0; lp < constellationElementPoint.Length; lp++)
				{
					int[] items = Console.ReadLine ().Split (' ').Select (str => int.Parse (str)).ToArray ();
					constellationElementPoint[lp] = new Point (items[0], items[1]);
				}

				int starCount = int.Parse (Console.ReadLine ());

				Point[] starPoint = new Point[starCount];
				for (int lp = 0; lp < starPoint.Length; lp++)
				{
					int[] items = Console.ReadLine ().Split (' ').Select (str => int.Parse (str)).ToArray ();
					starPoint[lp] = new Point (items[0], items[1]);
				}

				//process
				IEnumerable<Point> constellationList = constellationElementPoint.OrderBy (item => item.X).ThenBy (item => item.Y);
				List<Point> starList = starPoint.OrderBy (item => item.X).ThenBy (item => item.Y).ToList ();
				IComparer<Point> compare = new PointCompare ();

				Point movePoint = null;

				//?§?????????????????????????????????????
				foreach (var item in starList)
				{
					//?§?????????????????±???????
					int x = item.X - constellationList.First ().X;
					int y = item.Y - constellationList.First ().Y;
					movePoint = new Point (x, y);

					//?§???????????????§?????????
					bool isMatch = true;

					foreach (var item2 in constellationList)
					{
						int x2 = item2.X + movePoint.X;
						int y2 = item2.Y + movePoint.Y;

						//?????????????§?????????????
						Point destinationPoint = new Point (x2, y2);
						int result = starList.BinarySearch (destinationPoint, compare);

						//?§???????????????????????????°
						if (result < 0)
						{
							isMatch = false;
							break;
						}
					}

					//?????´?????????????????????????????°
					if (isMatch)
					{
						break;
					}
				}

				//output
				Console.WriteLine (movePoint.X + " " + movePoint.Y);
			}
		}
	}

	class Point
	{
		public Point ( int x, int y )
		{
			this.X = x;
			this.Y = y;
		}

		public int X { private set; get; }
		public int Y { private set; get; }
	}

	class PointCompare : IComparer<Point>
	{
		public int Compare ( Point ob1, Point ob2 )
		{
			if (ob1.X < ob2.X)
			{
				return -1;
			}
			else if (ob1.X > ob2.X)
			{
				return 1;
			}
			else
			{
				if (ob1.Y < ob2.Y)
				{
					return -1;
				}
				else if (ob1.Y > ob2.Y)
				{
					return 1;
				}
				else
				{
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 10404
use v6;
my $n = get().chomp;
my @t = get().chomp.split(' ');
my $m = get().chomp;
my (@p, @x);
loop (my $i = 0; $i < $m; $i++) {
	(@p[$i], @x[$i]) = get().chomp.split(' ');
}
my $ans = 0;
loop ($i = 0; $i < $n; $i++) {
	$ans += @t[$i];
}
loop ($i = 0; $i < $m; $i++) {
	say $ans - @t[@p[$i] - 1] + @x[$i];
}
exit;

Measured memory_bytes: 70716
#include <stdio.h>
#include <map>
#define MOD 1000000007

long long int abs(long long int k)
{
	return k>0?k:-k;
}
long long int gcd(long long int a, long long int b)
{
	return a?gcd(b%a,a):b;
}

long long int power(long long int a, long long int b)
{
	long long int ans = 1;
	long long int k = a;
	while(b)
	{
		if(b%2==1) ans*=k, ans%=MOD;
		k*=k , k%=MOD;
		b/=2;
	}
	return ans;
}

std::map< std::pair<long long int, long long int> , int> check1,check2;

int main()
{
	int a,count=0;
	scanf("%d",&a);
	for(int i=1;i<=a;i++)
	{
		long long int b,c;
		scanf("%lld%lld",&b,&c);
		if(b==0&&c==0)
		{
			count++;
			continue;
		}
		
		long long int d = gcd(abs(b),abs(c));
		b/=d, c/=d;
		if(b<0 && c<0) check1[std::make_pair(abs(b),abs(c))]++;
		if(b>0 && c>0) check1[std::make_pair(abs(b),abs(c))]++;
		if(b<0 && c>0) check2[std::make_pair(abs(b),abs(c))]++;
		if(b>0 && c<0) check2[std::make_pair(abs(b),abs(c))]++;
		if(b==0) check1[std::make_pair(abs(b),abs(c))]++;
		if(c==0) check2[std::make_pair(abs(b),abs(c))]++;
	}
	
	long long int ans = 1;
	std::map< std::pair<long long int, long long int> ,int > ::iterator it;
	
	for(it = check1.begin();it!=check1.end();it++)
	{
		std::pair<long long int, long long int> x0 = it->first;
		std::pair<long long int, long long int> x1 = std::make_pair(x0.second,x0.first);
		int y0 = it->second;
		if(check2.find(x1)!=check2.end())
		{
			long long int S = (power(2,y0) + power(2,check2[x1])-1)%MOD;
			ans *=S, ans%=MOD;
		}
		else
		{
			long long int S = (power(2,y0))%MOD;
			ans *=S, ans%=MOD;
		}
	}
	
	for(it = check2.begin();it!=check2.end();it++)
	{
		std::pair<long long int, long long int> x0 = it->first;
		std::pair<long long int, long long int> x1 = std::make_pair(x0.second,x0.first);
		int y0 = it->second;
		if(check1.find(x1)==check1.end())
		{
			long long int S = (power(2,y0))%MOD;
			ans *=S, ans%=MOD;
		}
	}
	
	ans += (count), ans%=MOD;
	printf("%lld",(ans+MOD-1)%MOD);
}

Measured memory_bytes: 15672
#include <iostream>
#include <algorithm>
using namespace std;
int dp[4][111111],a[4][111111];
int main(){
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[0][i] >> a[1][i] >> a[2][i];
	}
	for(int i=1;i<=n;i++){
		dp[0][i]=max(dp[1][i-1],dp[2][i-1])+a[0][i];
		dp[1][i]=max(dp[0][i-1],dp[2][i-1])+a[1][i];
		dp[2][i]=max(dp[1][i-1],dp[0][i-1])+a[2][i];
	}
	int m=-1e9;
	for(int i=0;i<3;i++){
		m=max(dp[i][n],m);
	}
	cout << m;
}

Measured memory_bytes: 5924
import java.io.*;
import java.util.*;

public class Main {

    private static void solver(InputReader sc, PrintWriter out) throws Exception {
          int n = sc.nextInt();
          int k = sc.nextInt();
          int arr[] = new int[n];
          for(int i=0; i<k; i++){
              int x = sc.nextInt();
                for(int z=0; z<x; z++){
                    int y = sc.nextInt()-1;
                    arr[y]++;
                }
          }
          int count=0;
          for(int xx: arr){
              if(xx==0)
                  count++;
          }
          out.println(count);
    }
    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair{
    long x;
    long y;
    Pair(long x, long y){
        this.x  =x ;
        this.y =y;
    }
}


Measured memory_bytes: 34072
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String line = sc.nextLine();

		int r = 0;
		int b = 0;
		for(int i=0;i<N;i++) {
			if(line.charAt(i) == 'R') {
				r++;
			}else if(line.charAt(i) == 'B'){
				b++;
			}
		}

		if(r>b) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

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

int main(){
	int x;
	int y;
	int a;
	int b;
	std::cin>> x;
	std::cin>> y;
	a = x*y;
	b = 2*x + 2*y;
	std::cout<< a;
	std::cout<< " ";
	std::cout<< b <<endl;
	return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  rep(i, n) { cout << s[i] << t[i]; }
  cout << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  ll A;
  double B;
  cin >> A >> B;
  ll B100 = (B*1000)/10;

  cout << (A/100)*B100 + ((A%100)*B100)/100 << endl;




  // cout << fixed << setprecision(6);
  return 0;
}


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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
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; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vint p(n); rep(i,n) cin>>p[i];

    vint imos_a(n+1,0), imos_b(n+1,0);
    rep(i,n){
        imos_a[p[i]] += i;
        imos_b[p[i]-1] += i;
    }
    rep(i,n){
        imos_a[i+1] += imos_a[i];
    }
    repr(i,n){
        imos_b[i] += imos_b[i+1];
    }

    vint a(n),b(n);
    rep(i,n){
        a[i] = i+1 + imos_a[i+1];
        b[i] = n-i + imos_b[i];
    }

    printv(a);
    printv(b);

    return 0;

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,c,d,e,f,g,h,i,j;
    int n;
cin>>n;

    int ar[n];
    int b[n];
    for (i=0;i<n;i++)
    {
        cin>>ar[i];
        b[i]=ar[i];
    }
    sort(b,b+n);
    for (i=0;i<n;i++)
    {
        if (ar[i]<=b[n/2-1])
        {
            cout<<b[n/2]<<endl;
        }

        else
        {
            cout<<b[n/2-1]<<endl;
        }
    }
    return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  bool flag = false;
  if (n % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  for (size_t i = 0; i < n / 2; i++) {
    if(s[i] != s[i + n / 2]){
      flag = true;
      break;
    }
  }
  if(flag) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long int ll;
#define REP(i, I, N) for (ll i = I; i < N; ++i)
#define rep(i, N) REP(i, 0, N)

struct shop {
    ll price;
    ll stock;

    bool operator<(const shop &another) const {
        return price < another.price;
    }
};

int main() {
    ll N, M, ans = 0;
    cin >> N >> M;
    vector<shop> S(N);
    ll A, B;
    rep(i, N) {
        cin >> A >> B;
        S[i].price = A;
        S[i].stock = B;
    }
    sort(S.begin(), S.end());

    rep(i, S.size()) {
        if (M > S[i].stock) {
            M -= S[i].stock;
            ans += S[i].price * S[i].stock;
        } else {
            ans += M * S[i].price;
            cout << ans << "\n";
            return 0;
        }
    }
}


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


int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	printf("%.6lf ",1ll*a*b/2.0);
	if(c*2==a&&d*2==b) printf("1");
	else printf("0");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <sstream>
#define lli long long int
#define vi vector<int> 
#define pb push_back
#define Brock_Lesnar ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int main(){
	Brock_Lesnar;
    int h1 , h2 , m1 , m2 , k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << (h2 - h1) * 60 + (m2 - m1) - k << endl;
    return 0;
}


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

using namespace std;

#define int int long

signed main(){
    int a,b,c;

    cin >> a >> b >> c;

    if(a == b + c)cout << "Yes" << endl;
    else if(a + b == c)cout << "Yes" << endl;
    else if(a + c == b)cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  Int ans=0;
  for(Int i=0;i<1000;i++)
    for(Int j=0;j<1000;j++)
      ans+=n==i*4+7*j;
  cout<<(ans?"Yes":"No")<<endl;
  return 0;
}


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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
inline double distance(double y1, double x1, double y2, double x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }

const int INF = 1L << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy4 = { 0, 1, 0, -1 }, dx4 = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };

using namespace std;

LL solve(long long N, long long K) {
    if (K == 0) {
        return N * N;
    }
    long long ans = 0;
    int no = 1;
    FOR(b, K + 1, N + 1) {
        ans += b - K;
        for (int a = b + K; a < N + 1; a += b) {
            ans += min<int>(a + no, N + 1) - a;
        }
        no++;

    }
    return ans;
}

int main(){
    long long N;
    long long K;
    cin >> N >> K;
    cout << solve(N, K) << endl;
    return 0;
}



Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    long x, y;
    scan(x, y);

    int ans = 1;

    while (2*x <= y) {
        x *= 2;
        ans++;
    }

    writeln(ans);
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
#define mod 1000000007
#define fi first
#define se second
#define be begin()
#define en end()
#define re reverse
#define Set setprecision
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define No cout<<"No\n"
#define Yes cout<<"Yes\n"
const int INFi=2147483647;
const long long INFl=9223372036854775807LL;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    for(int i=0;i<1300;i++){
	for(int j=0;j<1300;j++){
	    if((int)(i*0.08)==a&&j/10==b&&i==j){
		cout<<i<<"\n";
		return 0;
	    }
	}
    }
    cout<<"-1\n";
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define MAX 1000
#define VMAX 10000
 
int n, A[MAX], s;
int B[MAX], T[VMAX+1];
 
int partition(int A[], int p, int r){
  int i, j;
  int x, t;
  x = A[r];
  i = p-1;
  for( j = p ; j < r ; j++ ){
    if( A[j] <= x ){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;
  return i + 1;
}
 
void quickSort(int A[], int p, int r){
  int q;
  if( p < r ){
    q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}
 
 
int solve(){
  int i, ans = 0;
 
  int V[MAX];
  for( i = 0 ; i < n ; i++ ){
    B[i] = A[i];
    V[i] = 0;
  }
  quickSort(B, 0, n-1);
  for( i = 0 ; i < n ; i++ ) T[B[i]] = i;
  for( i = 0 ; i < n ; i++ ){
    if( V[i] ) continue;
    int cur = i;
    int S = 0;
    int m = VMAX;
    int an = 0;
    while( 1 ){
      V[cur] = 1;
      an++;
      int v = A[cur];
      m = fmin(m, v);
      S += v;
      cur = T[v];
      if( V[cur] ) break;
    }
    ans += fmin(S+(an-2)*m, m+S+(an+1)*s);
  }
 
  return ans;
}
 
int main(){
  int i;
  scanf("%d",&n);
  s = VMAX;
  for( i = 0 ; i < n ; i++ ){
    scanf("%d", &A[i]);
    s = fmin(s, A[i]);
  }
  int ans = solve();
  printf("%d\n", ans);
 
  return 0;
}



Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const ll INF = ll(1e15)+10;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;

int main() {
	string S; cin >> S;
	map<string, int> ans = {
		{"SUN", 7},
		{"MON", 6},
		{"TUE", 5},
		{"WED", 4},
		{"THU", 3},
		{"FRI", 2},
		{"SAT", 1},
	};
	cout << ans[S] << 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 in = new BufferedReader(new InputStreamReader(System.in));
		StackSub readDataArr = new StackSub(in.readLine().split(" "));
		System.out.println(readDataArr.calcData());
	}
}

class StackSub {
	private String[] readData;
	private int[] stack = new int[100];
	private int pointer = 0, result, operand2, operand1,
			strToIntData;

	StackSub(String[] readData) {
		this.readData = readData;
	}

	public void push(int data) {
		stack[pointer] = data;
		pointer++;
	}

	public int pop() {
		pointer--;
		return stack[pointer];
	}

	public int calcData() {
		String tempStrData;
		for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			}
		}
		return pop();
	}
}

Measured memory_bytes: 24512
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  rep(i,0,N) cin >> A[i];
  multiset<i64> st;
  rep(i,0,N) st.insert(A[i]);
  rep(i,0,N) {
    st.erase(st.lower_bound(A[i]));
    cout << *(--st.end()) << endl;
    st.insert(A[i]);
  }
}


Measured memory_bytes: 12544
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

typedef long double ld;

int main() {
  int N;
  cin>>N;
  ld sum; sum = 0;
  for (int i = 0; i < N; i++) {
    string s;
    ld x;
    cin>>x>>s;
    if (s == "JPY") sum += x;
    else sum += x*380000.0;
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main { 
public static void main(String args[]) { 
int n[] = new int[3];
Scanner sc = new Scanner(System.in);
n[0]=sc.nextInt();
n[1]=sc.nextInt();
n[2]=sc.nextInt();
for(int i=0;i<2;i++){
    for(int j=i+1;j<3;j++){
        if(n[i]>n[j]){
            int temp = n[i];
            n[i]=n[j];
            n[j]=temp;
        }
    }
}
System.out.print(n[0]);
System.out.print(" ");
System.out.print(n[1]);
System.out.print(" ");
System.out.println(n[2]);
 } }


Measured memory_bytes: 26416
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    int A[3];
    rep(i,3) cin >> A[i];
    sort(A,A+3);
    
    int res=0;
    rep(i,2) res += A[i+1]-A[i];
    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int counterAC = 0;
        int counterWA = 0;
        int counterTLE = 0;
        int counterRE = 0;
        for(int i = 0; i < N; i ++){
                    String S = sc.next();
                    if(S.equals("AC")){
                        counterAC++;
                    }else if(S.equals("WA")){
                        counterWA++;
                    }else if(S.equals("TLE")){
                        counterTLE++;
                    }else if(S.equals("RE")){
                        counterRE++;
                    }
            }
            System.out.println("AC x " + counterAC);
            System.out.println("WA x " + counterWA);
            System.out.println("TLE x " + counterTLE);
            System.out.println("RE x " + counterRE);
    }
}


Measured memory_bytes: 58452
N,K=map(int,input().split())
S=input()
po=[0]
X=[]
i=0
for i in range(N-1):
	if not S[i] == S[i+1]:
		po.append(i+1)
po.append(len(S))
for i in range(len(po)):
	if 2*K+1>=len(po):
		X.append(po[-1])
		break
	elif 2*K+i+1>=len(po):
		X.append(po[2*K+i]-po[i])
		break
	elif S[po[i]]=='0':
		X.append(po[2*K+i]-po[i])
	else:
		X.append(po[2*K+1+i]-po[i])
print(max(X))

Measured memory_bytes: 10328
#include <iostream>
#include <fstream>
#include <algorithm>
#include <assert.h>
using namespace std;

long long sum(long long N, const long long base) {
    long long s = 0;
    while (N > 0) {
        s += N % base;
        N = N / base;
    }
    return s;
}

int solve_less(const long long N, const long long S) {
    long long sq = 1;
    for ( ; sq * sq <= N; sq++);

    for (long long base = 2; base <= sq; base++) {
        if (sum(N, base) == S)
            return (int)base;
    }
    return -1;
}

long long solve_greater(const long long N, const long long S) {
    long long sq = 1;
    for ( ; sq * sq < N; sq++);

    long long sol = (1LL << 62);
    // sq * sq > N;
    // N = x + b * y, b >= sq => y <= sq
    for (long long y = 0; y <= sq; y++) {
        // N = x + b * y;
        // x + y = S;
        long long x = S - y;
        if (x < 0)
            continue;
        long long M = N - x;
        // M = b * y;
        if (M < 0) {
            continue;
        }
        if (y == 0) {
            if (M == 0) {
                sol = min(sol, max(sq, x + 1));
            }
        } else {
            if (M % y == 0) {
                long long base = M / y;
                if (base >= sq && x < base && y < base) {
                    sol = min(sol, base);
                }
            }
        }
    }
    if (sol == (1LL << 62))
        sol = -1;
    return sol;
}

long long solve(const long long N, const long long S) {
    int ret = solve_less(N, S);
    if (ret != -1)
        return ret;
    return solve_greater(N, S);
}

int main()
{
    ios_base::sync_with_stdio(false);

    long long N, S;
    // ifstream cin("code.in");
    cin >> N >> S;
    long long sol = solve(N, S);
    if (sol < 0) {
        cout << "-1\n";
        return 0;
    }
   // long long x = N % sol;
    //long long y = N / sol;
    // assert(x + y == S);
    cout << sol << '\n';
    return 0;
}


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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define debug(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define debug2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define debug3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define debug4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define debugarr(arr,N){if(isDebugMode){ rep(i,N+1)\
	{if(arr[i]==INF)printf("INF ");\
		else cout<<arr[i]<<" ";} cout<<endl;}}
#define debugarr2(arr,N,M){if(isDebugMode) rep(i,N+1){rep(j,M+1)\
	{if(arr[i][j]==INF)printf(" INF");\
		else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define show(a) cout<<a<<endl;

auto chmax =[](int &a,int b){a=max(a,b);};
auto chmin =[](int &a,int b){a=min(a,b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF=100000000;
const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={ 1, 0,-1, 0};

bool isDebugMode=true;
//--------------------------------------//
int n,x;
int a[100];

int main(){
	cin>>n>>x;
	rep(i,n) {
		cin>>a[i];
	}
	sort(a,a+n);
	int ans=0;
	while(true){
		x-=a[ans];
		if(ans==n-1){
			if(x==0)ans++;
			break;
		}
		if(x>=0) ans++;
		else break;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
// abc130b.cpp : Bounding
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

#define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define dw(i,s,e,d) for(int i=(s);i>(e);i-=(d))
#define in(x) cin>>(x)
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
void bye(auto x, int code=0){cout<<(x)<<endl;exit(code);}

void p1(vi v){
  for(auto a: v){ot(a);ot(",");}
}
void p2(vvi &x){
  for(auto v: x){ot("[");p1(v);ot("]\n");}
}

int main(){
	int n,x; cin>>n>>x;
	vi d(n+1);
	up(i,1,n+1,1){
		int l;cin>>l;
		// ote(l);
		d[i] = d[i-1] + l;
	}
	int c=0;
	rp(i,n+1){
		if(d[i]<=x) c++;
	}
	ote(c);
}

Measured memory_bytes: 256
n = gets.chomp.to_i
x = gets.chomp.split(/\s+/).map { |e| e.to_i }


cp = nil
1.upto(100) { |point|
  hp = x.map { |i|
    (i - point) ** 2
  }.inject(:+)

  if !cp || cp > hp
    cp = hp
  end
}

puts cp


Measured memory_bytes: 1916
S = input()

for i in range(1, len(S)):
    if i % 2 > 0: continue
    ans = None
    for j in range((len(S) - i) // 2):
        if S[j] == S[j + (len(S) - i) // 2]:
            continue
        else:
            break
    else:
        ans = len(S) - i
    #
    if ans != None: break

print(ans)

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

int main()
{
	int n;
	cin>>n;
	int tle=0,ac=0,wa=0,re=0;
	for(int i=1; i<=n; i++)
	{
		string s;
		cin>>s;
		if(s=="TLE")	tle++;
		else if(s=="WA")	wa++;
		else if(s=="AC")	ac++;
		else	re++;
	}
	cout<<"AC x "<<ac<<endl
		<<"WA x "<<wa<<endl
		<<"TLE x "<<tle<<endl
		<<"RE x "<<re;
	return 0;
}

Measured memory_bytes: 3612