akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict


def is_testimony_correct(hypothesis, testimony):
    # 証言の対象者が仮説上、正直者となっているかを検証。
    for target, is_honest in testimony.items():
        if int(hypothesis[target]) == is_honest:
            continue
        return False
    return True


def is_hypothesis_correct(hypothesis, testimony_dict):
    for witness_num, testimony in testimony_dict.items():
        # 仮説上の正直者の証言だけ検証する
        if hypothesis[witness_num] == "1":
            # 証言を検証
            if is_testimony_correct(hypothesis, testimony):
                continue
            else:
                # 証言に誤りがある場合、Falseで抜ける
                return False
    return True


def main():
    N = int(input())
    testimony_dict = defaultdict(dict)

    # 証人ごとに証言をdictで保存
    for witness_num in range(N):
        for _ in range(int(input())):
            target, is_honest = list(map(int, input().split()))
            testimony_dict[witness_num][target - 1] = is_honest

    # 仮説を検証  e.g.'010010' 正直者が2人 (witness_num =1, 4)
    max_count = 0
    for i in range(1, 2**N):
        # 仮説を01で表現
        hypothesis = format(i, 'b').zfill(N)
        # 仮説が正しい場合のみ、正直者の数でmax_countを更新
        if is_hypothesis_correct(hypothesis, testimony_dict):
            max_count = max(max_count, hypothesis.count(str("1")))
    print(max_count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatro
{
    static int K, S;
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        K = int.Parse(s[0]);
        S = int.Parse(s[1]);
        int cnt = 0;
        for(int i = 0; i <= K; i++)
        {
            for(int j = i; j <= K; j++)
            {
                int k = S - (i + j);
                if (k < 0 || k > K)
                {
                    continue;
                }
                if (k < j)
                {
                    continue;
                }
                if (i == j)
                {
                    if (j == k)
                    {
                        cnt++;
                    }
                    else
                    {
                        cnt += 3;
                    }
                }
                else
                {
                    if (j == k)
                    {
                        cnt += 3;
                    }
                    else
                    {
                        cnt += 6;
                    }
                }
                
            }
        }
        Console.WriteLine(cnt);
    }
}


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

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

using namespace std;
using ll = long long int;

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



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

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

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

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

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


int main(){
	double pi = 3.14159265358979323846;
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	
	double tb = 1.0 * m * 6;
	double ta = 1.0 * h * 30 + tb/12;
	double t = min(360 - abs(ta - tb), abs(ta - tb));
	cout << fixed << setprecision(15) << sqrt(a * a + b * b - 2 * a * b * cos(t * pi / 180)) << endl;

	return 0;
}

Measured memory_bytes: 4076
n, m = map(int, input().split())
spans = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1])
cnt = 0
x = 0

for span in spans:
    if span[0] > x:
        x = span[1] - 1
        cnt += 1

print(cnt)


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

void solve()
{
    ll c,t,i,j=0,r=0,k=0,kk=0,ans=0,sum=0,y=0,x,sk,m,z=0,s1=0,s2=0,n;
    vector<ll> a(1,0);
    vector<ll> b(1,0);

    cin >> n >> m >>k;

    for (i = 1; i <= n; i++)
    {
        cin >> x;
        a.push_back(x);
        a[i] = a[i] + a[i-1];
    }
    for (i = 1; i <= m; i++)
    {
        cin >> x;
        b.push_back(x);
        b[i] = b[i] + b[i-1];
    }

    r = m;

    for (i = 0; i <= n; i++)
    {
        if(a[i] > k)
        {
            break;
        }

        while (b[r] > k - a[i])
        {
            r--;
        }

        sum = max(sum,i+r);
    }

    cout << sum << endl;;

}

int main()
{
    ll l;

    //while()
        solve();
}


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

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

    int sum = 0;

    for(int i = 1; i <= n; i++) {
        int c, d;
        int tmp = i;
      	int ketawa = 0;
      
      	rep(i, 5) {
        	ketawa += tmp%10;
          	tmp /= 10;
        }
      
        if(ketawa >= a && ketawa <= b) sum+=i;
    }

    cout << sum << endl;

  	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    long long int n,m,k,r,l,z=0;
    long long int a[200001];
    long long int b[200001];
    a[0]=0;
    b[0]=0;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>b[i];
        b[i]+=b[i-1];
    }
    l=m;
    for(int i=0;i<=n;i++)
    {
        r=k-a[i];
        if(r<0)break;
        while(1)
        {
            if(b[l]>r)
            {
                l--;
            }
            else
            {
                break;
            }
        }
        z=max(z,i+l);
    }
    cout<<z<<endl;
    return 0;
}


Measured memory_bytes: 6716
N = int(input())
ORDER = list(map(int,input().split()))
SUTISFUCTION = list(map(int,input().split()))
ADDITTIONAL_SUTISFUCTION = list(map(int,input().split()))

s, prev = 0, 50
for i in ORDER:
    s = s + SUTISFUCTION[i - 1]
    if prev == i - 1:
        s = s + ADDITTIONAL_SUTISFUCTION[prev - 1]
    prev = i
    
print(s)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<math.h>

using namespace std;



int main(){
    const double pi=3.14159265358979323846;
    int a,b,h,m;
    double wa,wb,ans,d;

    cin >> a >> b >> h >> m;
    wa = pi/6*h + pi/360*m;
    wb = pi*2*h + pi/30*m;
    d = (a*cos(wa) - b*cos(wb))*(a*cos(wa) - b*cos(wb)) + (a*sin(wa) - b*sin(wb))*(a*sin(wa) - b*sin(wb));
    ans = sqrt(d);
    printf("%.10f", ans);

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a;
    map<int, int> mp;
    for(int i = 0; i < n; ++i) {
        cin >> a;
        mp[a]++;
    }
    vector<int> v;
    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        // first: key, second: value
        if(iter->second >= 2) {
            for(int i = 0; i < iter->second/2; ++i)
                v.push_back(iter->first);
        }
    }

    sort(v.rbegin(), v.rend());
    
    cout << ((v.size()>1)?(long long)v[0]*v[1]:0) << '\n';

    return 0;
}

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

int main(){
  int N,a,b,c,d;
  cin>>N;
  
  a=N/1000;
  b=(N-a*1000)/100;
  c=(N-a*1000-b*100)/10;
  d=N-a*1000-b*100-c*10;
  
  if(a==b && b==c||b==c && c==d) {
    cout << "Yes" << endl;
  }
    else {
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
VL s,t;
int main(){
    int A,B,Q;
    R(A,B,Q);
    s.PB(-1e12);
    REP(i,A){
        LL x;
        R(x);
        s.PB(x);
    }
    s.PB(1e12);
    t.PB(-1e12);
    REP(i,B){
        LL x;
        R(x);
        t.PB(x);
    }
    t.PB(1e12);
    REP(cs,Q){
        LL x;
        R(x);
        auto it1=lower_bound(ALL(s),x);
        LL v1=x-*prev(it1);
        LL v2=*it1-x;
        auto it2=lower_bound(ALL(t),x);
        LL v3=x-*prev(it2);
        LL v4=*it2-x;
        //W(v1,v2,v3,v4);
        LL an=max(v2,v4);
        an=min(an,max(v1,v3));
        an=min(an,v1+v4+min(v1,v4));
        an=min(an,v2+v3+min(v2,v3));
        W(an);
    }
    return 0;
}


Measured memory_bytes: 3060
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut itr = s.split_whitespace();

    let a: i64 = itr.next().unwrap().parse().unwrap();
    let op = itr.next().unwrap();
    let b: i64 = itr.next().unwrap().parse().unwrap();

    println!("{}", if op == "+" { a + b } else { a - b });
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>

using namespace std;

int main(){

 long long int N,x,sum=0, hug=0;

 cin>>N;

 int i=0;

for(int i=0; i<N; ++i){
  cin>>x;
  hug=max(x,hug);
  if(x<=hug){
    sum+=hug-x;
  }

 }

  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 3644
#include<cstdio>
char field[105][105];
int main(void) {
    int h, w;
    scanf("%d %d", &h ,&w);
    for (int i = 0; i < h; i++) scanf("%s", field[i]);
    for (int i = 0; i < h; i++) {
        int lastPos = -1;
        for (int j = 0; j < w; j++) {
            if(field[i][j] == 'c') lastPos = j;
            int res = -1;
            if(lastPos != -1) res = j - lastPos;
            printf("%d%c", res, j == w-1 ? '\n': ' ');
        }
    }
    return 0;
}

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

int n, *a, Ans;

int main() {
    scanf( "%d", &n );
    n <<= 1;
    a = new int [ n ];
    for( int i = 0; i < n; ++i ) scanf( "%d", a + i );
    sort( a, a + n );
    Ans = 0;
    for( int i = 0; i < n; i += 2 ) Ans += *( a + i );
    printf( "%d\n", Ans );
    return 0;
}

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

int main() {
    long N, T;
    unsigned long long a = 0;
    cin >> N;
    vector<int> s(N);
    for(int i = 0; i < N; ++i) {
        cin >> s[i];
        a += s[i];
    }
    if(a == 0 || a % ((N * (N + 1)) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    } else {
        T = a / ((N * (N + 1)) / 2);
    }
    
    long tN = 0, j = N - 1;
    for(int i = 0; i < N; ++i) {
        if(i != 0) j = i - 1;
        if( s[i] - T < 0 || (s[j] - (s[i] - T)) < 0 || (s[j] - (s[i] - T)) % N != 0 ) {
            cout << "NO" << endl;
            return 0;
        } else {
            tN += (s[j] - (s[i] - T)) / N;
        }
    }
    if(tN == T) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
}

Measured memory_bytes: 640
#include <iostream>
#include <string>

int main()
{
  int K,A,B;
  std::cin>>K>>A>>B;
  
  std::string result="NG";
  for(int i=A;i<=B;i++)
  {
    if(i%K==0)
    {
      result="OK";
    }
  }
  
  std::cout<<result<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int main()
{
    long long int a,b;
    cin >> a >> b;
    if((a + b) % 2 == 0)
    {
        cout << (a+b)/2 << endl;
    }
    else
    {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main() {
  int N,K;
  cin >> N >> K;
  int sum =K;
  if(N == 1) cout << K <<endl;
  else{
    for(int i = 2;i <= N;i++){
      sum *= K-1;

    }
    cout << sum <<endl;
  }
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
A = list(map(int, input().split()))

cnt = Counter(A)

ans = 0
for v in cnt.values():
    ans += v * (v - 1) // 2

for k in A:
    # n*(n-1)//2 - (n-1)*(n-2)//2 = n - 1
    print(ans - (cnt[k] - 1)) 


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


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    long long n, d;
    cin >> n >> d;
    long long mx = d*d;
    int ns = 0;
    while(n--){
        long long x, y; cin >> x >> y;
        long long dist = x*x + y*y;
        if(dist<=mx){
            ns++;
        }
    }
    cout << ns;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    vector<int>q(m);
    int s = 0;
    f(i,0,m){
        cin >> q[i];  
        s+= q[i];
    }
    if(s > n){
        cout << -1;
    }
    else
        cout << n-s;
    
    return 0;
}
 

Measured memory_bytes: 3736
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  bool ok = false;
  if(s[0] == s[1] && s[1] == s[2]) ok = true;
  if(s[1] == s[2] && s[2] == s[3]) ok = true;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

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




int main() {
	int n;
	cin >> n;
	vector<int> data(n);
	for(int i=0;i<n;++i){
		cin >> data[i];
	}
	
	double res = 9999999999;
	
	for(int i=1;i<=100;++i){
		double tmp = 0;
		for(int j=0;j<n;++j){
			tmp += (i-data[j])*(i-data[j]);
		}
		//cout << tmp << " " << i <<endl;
		res = min(res,tmp);
	}
	
	
	cout << res <<endl;
	
	
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef unsigned int uint;
typedef unsigned char uchar;
#define umap unordered_map
const static ull INVALID_DIGIT = ~(ull)0;

int main()
{
    int A, B;

    cin >> A >> B;

    if (A >= 13) {
        cout << B << endl;
    }
    else if (A >= 6) {
        cout << B / 2 << endl;
    }
    else {
        cout << "0" << endl;
    }

    return 0;
}

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

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

    int H, W, D;
    //cin >> H >> W >> D;
    scanf("%d%d%d", &H, &W, &D);
    vector<pair<int, int>> r(H * W + 1);
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            int A;
            //cin >> A;
            scanf("%d", &A);
            r[A] = { i, j };
        }
    }

    vector<int> cost(H * W + 1, -1);
    for (int i = 1; i <= D; i++) {
        pair<int, int> curr_sq = r[i];
        cost[i] = 0;

        int as = 0;
        for (int j = i + D; j <= H * W; j += D) {
            cost[j] = abs(r[j].first - curr_sq.first) + abs(r[j].second - curr_sq.second) + as;
            as = cost[j];
            curr_sq = r[j];
        }
    }

    int Q;
    //cin >> Q;
    scanf("%d", &Q);
    for (int i = 0; i < Q; i++) {
        int L, R;
        //cin >> L >> R;
        scanf("%d%d", &L, &R);
        //cout << cost[R % D == 0 ? D : R % D][R] - cost[L % D == 0 ? D : L % D][L] << endl;
        printf("%d\n", cost[R] - cost[L]);
    }
}

Measured memory_bytes: 2176
#include <iostream>

using namespace std;

int main()
{
    int S, h, m, s;
    cin >> S;
    h = S / 3600;
    m = (S % 3600) / 60;
    s = S % 60;
    cout << h << ":" << m << ":" << s << endl;

    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int maxn = 200105;
ll n, c, h[maxn], f[maxn], q[maxn] = {0, 1};
double slope(int i, int j) {
	return (f[i] - f[j] + h[i] * h[i] - h[j] * h[j]) / 2.0 / (h[i] - h[j]);
}
void go() {
	cin >> n >> c;
	f1(n) {
		cin >> h[i];
	}
	int l = 1, r = 1;
	for (int i = 2 ; i <= n ; i++) {
		while (l < r && slope(q[l], q[l + 1]) <= h[i]) {
			l++;
		}
		f[i] = f[q[l]] + (h[i] - h[q[l]]) * (h[i] - h[q[l]]) + c;
		while (l < r && slope(q[r - 1], q[r]) >= slope(q[r], i)) {
			r--;
		}
		q[++r] = i;
	}
	cout << f[n] << '\n';
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int c = 0;
    int t;
    if (!c) {
        t = 1;
    }
    else {
        cin >> t;
    }
    while (t--) {
        go();
    }
}

Measured memory_bytes: 8344
#define s(p)!strstr(a,#p)
char*c;main(i,a){for(;~scanf("%[^\n] ",a);puts(a))for(;s(this)&&s(that)&&s(the);)for(c=a;*c;c++)*c<97||(*c=(*c+8)%26+97);c=0;}

Measured memory_bytes: 0
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int dp[510][510][510];
int num[510];
lint co[510][510];
lint mo=1000000007;
int main()
{
	rep(i,505){
		co[i][0]=co[i][i]=1;
		REP(j,1,i) co[i][j]=(co[i-1][j]+co[i-1][j-1])%mo;
	}
	memset(num,0,sizeof(num));
	int n,L,x;
	cin>>n>>x;
	rep(i,n){
		cin>>L;num[L]++;
	}
	memset(dp,0,sizeof(dp));
	dp[500][0][0]=1;
	for(int i=500;i>0;i--) rep(j,500/i+5) rep(k,505){
		if(dp[i][j][k]<1) continue;
		//cout<<i<<' '<<j<<' '<<k<<' '<<dp[i][j][k]<<endl;
		lint t=dp[i][j][k];
		lint can=j+k-(i+1)*j;
		if(j<1) can=0;
		rep(l,num[i+1]){
			t*=can;t%=mo;
		}
		/*if(i<1){
			dp[i][j][k]=(int)(t%mo);continue;
		}*/
		for(int l=0;k+i*l<=x;l++){
			dp[i-1][j+l][k+i*l]=(dp[i-1][j+l][k+i*l]+t*co[j+l][l])%mo;
			//dp[i-1][j+l][k+i*l]%=mo;
		}
	}
	lint out=0;
	rep(i,x+1) REP(j,1,x+1){
		if(dp[0][i][j]<1) continue;
		if(j+i-1>x) continue;
		//dp[0][i][j]=(dp[0][i][j]*num[1])%mo;
		//cout<<0<<' '<<i<<' '<<j<<' '<<dp[0][i][j]<<endl;
		lint t=dp[0][i][j];
		rep(k,num[1]){
			t*=j;t%=mo;
		}
		//cout<<0<<' '<<i<<' '<<j<<' '<<t<<endl;
		t*=co[x-j+1][i];t%=mo;
		if((x-j)%2==0) out+=t;else out-=t;
		out%=mo;
	}
	out%=mo;out+=mo;out%=mo;
	cout<<out<<endl;
}


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

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ign cin.ignore(numeric_limits<streamsize>::max(),'\n')

#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long int ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<vector<int>> MAT;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef map<int,int> MCI;
typedef unordered_map<int,int> UMII;
typedef unordered_map<ll,ll> UMLL;
typedef unordered_map<char,int> UMCI;
typedef set<int> SI;
typedef unordered_set<int> USI;

// Display Map
//~for (auto const& pair: m) {
//~std::cout << "{" << pair.first << ": " << pair.second << "}\n";
//~}

// Extract word(w) from sentence(s)
//~stringstream str(s);
//~string w;
//~while(str >> w){
//~// w is your word
//~}

//Memset Syntax
// memset(array, value,sizeof(array)) val is 0,-1 or bool only

// To get accurate precision
//~cout.precision(20);

// Concatinate Vectors
//~

//~Vector of size n*m with zero
//~vector<vector<int> > vec( n , vector<int> (m, 0));



int main() {
    fast_io;
    int n;
    cin >> n;
    int c = 1;
    int ans = 0;
	while(c < n){
		if(n%c == 0){
			ans += (n/c)-1;
		}
		else{
			ans += n/c;
		}
		c++;
	}
	cout << ans << endl;
}



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

using namespace std;

#define ll long long

ll M = 1000000007;

ll bin_pow(ll a, ll pow) {
    if (pow == 0) return 1;
    if (pow == 1) return a;
    if (pow % 2 == 0) {
        ll tmp = bin_pow(a, pow / 2) % M;
        return tmp * tmp % M;
    }
    return a * bin_pow(a, pow - 1) % M;
}

ll inv(ll a) {
    return bin_pow(a, M - 2) % M;
}

ll fact(ll a) {
    ll ans = 1;
    for (int i = 1; i <= a; i++) {
        ans *= i;
        ans %= M;
    }
    return ans;
}

vector<vector<int>> d;
vector<pair<int, int>> a;

int ans(int n, int t) {
    if (t <= 0 || n == 0) return 0;
    if (d[n][t] == -1) {
        d[n][t] = max(ans(n - 1, t), ans(n - 1, t - a[n - 1].first) + a[n - 1].second);
    }

    return d[n][t];
}

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

    int a; cin >> a; cout << (a + 1) / 2;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        //static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var xyxy = Sarray();
            var sx = xyxy[0];
            var sy = xyxy[1];
            var tx = xyxy[2];
            var ty = xyxy[3];
            var x = (int)(tx - sx);
            var y = (int)(ty - sy);
            var ans = new string('U', y) + new string('R', x) + 
                      new string('D', y) + new string('L', x) +
                      'L' +
                      new string('U', y + 1) + new string('R', x + 1) +
                      'D' + 'R' +
                      new string('D', y + 1) + new string('L', x + 1) +
                      'U';
            WriteLine(ans);
        }
    }
}

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

const long long INF = 1LL << 60;
const ll MOD = ll(1e9)+7;

bool has_key(unordered_map<string, ll> &m, string s){
    if (m.find(s) == m.end()){
        return false;
    }
    else{
        return true;
    }
}


bool vector_find(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}


void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

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

ll count_black(vector<vector<string>> C) {

  ll num = 0;
  for (ll i = 0; i < C.size(); i++) {
    for (ll j = 0; j < C.at(i).size(); j++) {
      if (C.at(i).at(j) == "#") num++;
    }
    
  }

  return num;
  
}

vector<vector<string>> paint(vector<vector<string>> C, vector<ll> x, vector<ll> y) {

  vector<vector<string>> C_painted = C;

  for (ll i = 0; i < x.size(); i++) {
    if(x.at(i) == 1) {
      for (ll j = 0; j < C_painted.size(); j++) {
        C_painted.at(j).at(i) = "r";
      }
    }
  }

  for (ll i = 0; i < y.size(); i++) {
    if(y.at(i) == 1) {
      for (ll j = 0; j < C_painted.at(0).size(); j++) {
        C_painted.at(i).at(j) = "r";
      }
    }
  }

  return C_painted;
  
}

vector<vector<ll>> vec_x;

void sublistx(vector<ll> tmp, ll n) {
    if (n == 0) {
      vec_x.push_back(tmp);
    }
    if (n > 0) {
      vector<ll> tmp0 = tmp;
      vector<ll> tmp1 = tmp;
      tmp0.push_back(0);
      tmp1.push_back(1);
      sublistx(tmp0, n - 1);
      sublistx(tmp1, n - 1);
    }
}

vector<vector<ll>> vec_y;

void sublisty(vector<ll> tmp, ll n) {
    if (n == 0) {
      vec_y.push_back(tmp);
    }
    if (n > 0) {
      vector<ll> tmp0 = tmp;
      vector<ll> tmp1 = tmp;
      tmp0.push_back(0);
      tmp1.push_back(1);
      sublisty(tmp0, n - 1);
      sublisty(tmp1, n - 1);
    }
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main() {

  ll N;
  cin >> N;

  vector<ll> A(N);

  ll sum = 0;
  ll sqsum = 0;

  for (ll i = 0; i < N; i++) {
    cin >> A.at(i);


    sum = (sum + A.at(i) % MOD) % MOD;
    sqsum = (sqsum + A.at(i) * A.at(i) % MOD) % MOD;
  }
  
  ll ans = ((sum*sum % MOD - sqsum)* modinv(2, MOD)) % MOD;

  if (ans < 0) ans = ans + MOD;


  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4848
#!/usr/bin/python3

import os
import sys


def main():
    N = read_int()
    A = read_ints()
    print(solve(N, A))


def solve(N, A):
    ans = 1
    i = 0
    while i < N:
        j = i + 1
        while j < N and A[i] == A[j]:
            j += 1
        if A[i] == 1:
            ans = max(ans, j - i + 1)
        i = j
    return ans


###############################################################################

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()



Measured memory_bytes: 5612
#include<stdio.h>
#define N 500000
#define M 2000000000

void merge(int [],int,int,int);
void mergeSort(int [],int,int);

int L[N/2+2],R[N/2+2];
int count=0;


void merge(int A[],int left,int mid,int right){
  int n1;
  int n2;
  int i,j,k;
  n1=mid-left;
  n2=right-mid;

  for(i=0;i<n1;i++) L[i]=A[left+i];
  for(i=0;i<n2;i++) R[i]=A[mid+i];

  L[n1]=R[n2]=M;
  i=0;
  j=0;

  for(k=left;k<right;k++){
    count++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);

  }
}

main(){

  int A[N],n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  mergeSort(A,0,n);

 for(i=0;i<n-1;i++){
   printf("%d ",A[i]);
 }
 printf("%d\n",A[n-1]);
 printf("%d\n",count);
 return 0;
}

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


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  constexpr char endl = '\n';

  int n, k;
  const int INF=1e9+5;
  cin >> n;
  vector<vector<int>> points;
  vector<vector<int>> dp(n,vector<int>(3,0));
  for (int i=0; i<n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    points.emplace_back(vector<int>{a, b, c});
  }

  dp[0][0]=points[0][0];
  dp[0][1]=points[0][1];
  dp[0][2]=points[0][2];

  for (int i=1; i<n; ++i) {
    for (int j=0; j<3; ++j) {
      for (int k=0; k<3; ++k) {
        if (j==k)
          continue;
        dp[i][j]=max(dp[i][j], dp[i-1][k]+points[i][j]);
      }
    }
  }

  int ans=0;
  for (int j=0; j<3; ++j) {
    ans=max(ans,dp[n-1][j]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12340
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<sstream>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;

int main()
{
    char s[10];
    scanf("%s", s);
    cout << (s[1] == 'B' ? "ARC" : "ABC") << endl;
    return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;   //m[3]=5;
vector<int> v;
 
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;++i){
		int x;
		cin>>x;
		if(m[x]==0)v.push_back(x);  //m.count(x)==0
		++m[x];
	}
	int ans=0;
	for(int i=0;i<v.size();++i)
		if(v[i]>m[v[i]]) ans+=m[v[i]];
		else if(v[i]<m[v[i]]) ans+=m[v[i]]-v[i];
	cout<<ans<<"\n";
	return 0; 
}

Measured memory_bytes: 5112
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define clr(s, x) memset(s, x, sizeof(s))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
inline int read(){int r=0;char c=getchar();while(c<'0'||c>'9') {c=getchar();}while(c>='0'&&c<='9') {r=r*10+c-'0';c=getchar();}return r;}
inline ll readll(){ll r=0;char c=getchar();while(c<'0'||c>'9') {c=getchar();}while(c>='0'&&c<='9') {r=r*10+c-'0';c=getchar();}return r;}
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
inline ll gcd(ll a,ll b){while(b^=a^=b^=a%=b);return a;}
const double eps = 1e-8;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int MAXN = 1e6+100;
const int MAXM = 1e5;
ll n,m;
ll a[MAXN];
ll vis[MAXN];
bool cmp(ll a,ll b){
	return a>b; 
}
vector<ll> dis;
int main(){
	cin>>m>>n;
	memset(vis,0,sizeof(vis));
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(ll i=2;i<=n;i++){
		dis.push_back(a[i]-a[i-1]);
	}
	sort(dis.begin(),dis.end(),cmp);
	for(ll i=0;i<=m-2&&i<(ll)(dis.size());i++){
		vis[dis[i]]++;
	}
	ll l,r;
	l=1;
	ll ans=0;
	for(ll i=2;i<=n;i++){
		if(vis[a[i]-a[i-1]]){
			r=i-1;
			ans+=a[r]-a[l];
			l=i;
			vis[a[i]-a[i-1]]--;
		}
	}
	if(r!=n) ans+=a[n]-a[l];
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 11640
#include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;
int a, b;
int main() {
	cin >> a>> b;
	if (a > 0 && b > 0)cout << "Positive" << endl; else
		if (a < 0 && b < 0)
		{
			if ((a - b) % 2 == 0) {
				cout << "Negative" << endl;
			}else cout << "Positive" << endl;
		}
		else cout << "Zero" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n == 3){
        cout << "2 5 63\n";
        return 0;
    }else if(n == 4){
        cout << "2 5 20 63\n";
        return 0;
    }else if(n == 5){
        cout << "2 5 20 63 630\n";
        return 0;
    }
    set<int> st;
    int val = 2;
    ll sm = 0;
    rep(i,n){
        while(val % 2 != 0 && val % 3 != 0) val++;
        st.insert(val);
        sm += val++;
    }
    if(sm % 6 == 2){
        st.erase(2), st.insert((val/6+1)*6);
    }else if(sm % 6 == 3){
        st.erase(3), st.insert((val/6+1)*6);
    }else if(sm % 6 == 5){
        st.erase(2);
        while(val % 6 != 3) val++;
        st.insert(val);
    }
    each(it,st){
        if(it == *(--st.end())) break;
        cout << it << " ";
    }
    cout << *(--st.end()) << "\n";
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long
#define N 500005
using namespace std;
int n;long long a[N],b[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%lld%lld",&a[i],&b[i]);
	ll tmp=0;
	for (int i=n;i;i--){
		ll x=(a[i]+tmp)%b[i];
		if (x==0) continue;
		x=b[i]-x;tmp+=x;
	}printf("%lld\n",tmp);
	return 0;
}

Measured memory_bytes: 5120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		int zero = 0;
		int one = 0;
		for(char c : s.toCharArray()) {
			if(c == '0')
				zero++;
			else
				one++;
		}
		System.out.println(zero+one - Math.abs(zero-one));
	}
}

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

int main() {
  int N, Q;
  int a, e;
  string S;
  cin >> N >> Q >> S;
  vector<int> b(N, 0);
  b.at(0)=0;
  //cout << b.at(0);////////////////////
  for (int i=1; i<N; i++) {
    b.at(i) = b.at(i-1);
    if ( (S.at(i-1) == 'A') 
          && (S.at(i) == 'C') ) b.at(i)++;
    //cout << b.at(i);////////////////
  }
  for (int i=0; i<Q; i++) {
    cin >> a >> e;
    cout << b.at(e-1)-b.at(a-1) << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
from sys import stdin
import math

def dgtsum(x):
    if(x==0):
        return 0
    return x%10+dgtsum(x//10)

n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    if(a<=dgtsum(i) and dgtsum(i)<=b):
        ans=ans+i

print(ans)

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define ull unsigned long long
#define ld long double

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
template <class T>
using VVV = V<V<V<T>>>;

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define rep1(i, n) rep1(i, 1, n + 1)

// #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
// #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()  //

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);
    //    cout << std::setfill('0') << std::setw(2);

    std::vector<long long> A(3);
    for (int i = 0; i < 3; i++) {
        std::cin >> A[i];
    }
    sort(all(A));
    int ans = A[2] - A[0];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
import math
for _ in range(n):
    ax,ay,bx,by,cx,cy = [float(i) for i in input().split()]
    ab = math.sqrt((ax-bx)**2+(ay-by)**2)
    bc = math.sqrt((bx-cx)**2+(by-cy)**2)
    ca = math.sqrt((cx-ax)**2+(cy-ay)**2)
    cos_a = (ab**2+ca**2-bc**2)/(2*ab*ca)
    sin_a = math.sqrt(1-cos_a**2)
    r = bc/(2*sin_a)
    px = ((ay-cy)*(ay**2 -by**2 +ax**2 -bx**2) -(ay-by)*(ay**2 -cy**2 +ax**2 -cx**2)) / (2*(ay-cy)*(ax-bx)-2*(ay-by)*(ax-cx))
    py = ((ax-cx)*(ax**2 -bx**2 +ay**2 -by**2) -(ax-bx)*(ax**2 -cx**2 +ay**2 -cy**2)) / (2*(ax-cx)*(ay-by)-2*(ax-bx)*(ay-cy))
    def round3(x):
        x_ = x*10**3
        if x_%1 < 0.5:
            x_ = math.floor(x_)
        else:
            x_ = math.ceil(x_)
        return x_*10**(-3)
        
            
    print("{:.3f} {:.3f} {:.3f}".format(round3(px),round3(py),round3(r)))


Measured memory_bytes: 5716
import math
N = int(input())
a = [int(x) for x in input().split()]
a4,a2 = 0,0

for x in a:
    if x % 4 == 0:  a4 += 1
    elif x % 2 == 0:    a2 += 1

if N//2 <= a4 or math.ceil((N-a2)/2) <= a4: print("Yes")
else:   print("No")


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h, w, k;
    cin >> h >> w >> k;
    
    int cnt = 0, ans = 0;
    char c[h][w];
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cin >> c[i][j];
            if(c[i][j] == '#'){
                cnt++;
            }
        }
    }
    /*
    if(cnt < k){
        cout << 0;
        //return 0;
    }
    else if(cnt == k){
        cout << 1;
        //return 0;
    }
    */
    //else{
        for(int i = 0;i < pow(2, h);i++){
            for(int j = 0;j < pow(2, w);j++){
                int tmp = 0;
                for(int m = 0;m < h;m++){
                    for(int n = 0;n < w;n++){
                        if(((i >> m) & 1) == 1 && ((j >> n) & 1) == 1 && c[m][n] == '#'){
                            tmp++;
                        }
                    }
                }
                if(tmp == k){
                    ans++;
                }
            }
        }
        cout << ans;
        return 0;
    //}
}


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

//nC2
ll choose2(ll n)
{
    return n *(n-1)/2;
}

int main(void) 
{
    int n,m;
    cin >> n >>m;
    int ans = choose2(n) + choose2(m);
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,K = MI()

if N-2*K+1 < 0:
    print(-1)
    exit()

ANS = [[0]*3 for _ in range(N)]
for i in range(K+2*N,K+3*N):
    ANS[i-(K+2*N)][2] = i

if N % 2 == 0:
    for i in range(N//2):
        ANS[2*i][0] = K+i
        ANS[2*i][1] = K+N+(N//2)+i
        ANS[2*i+1][0] = K+(N//2)+i
        ANS[2*i+1][1] = K+N+i

else:
    for i in range(N//2):
        ANS[2*i][0] = K+i
        ANS[2*i][1] = K+N+(N//2)+i
        ANS[2*i+1][0] = K+(N//2)+1+i
        ANS[2*i+1][1] = K+N+i
    ANS[-1][0] = K+(N//2)
    ANS[-1][1] = K+(2*N-1)

for i in range(N):
    a,b,c = ANS[i]
    print(a,b,c)


Measured memory_bytes: 105064
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll A, B, C, K;
  cin >> A >> B >> C >> K;
  if (A >= K)
    cout << K << endl;
  else if (A + B >= K)
    cout << A << endl;
  else
    cout << (A - (K - A - B)) << endl;
  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
typedef long long ll;

const int MAX_N = 1e5 + 1;

ll A[MAX_N], positive[MAX_N], negative[MAX_N];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        if (A[i] >= 0) positive[i] = A[i];
        else negative[i] = A[i];
        positive[i] += positive[i - 1];
        negative[i] += negative[i - 1];
    }
    ll sum = positive[N];
    ll ans = 0;
    for (int i = 1; i <= N - K + 1; i++) {
        if (ans < sum + negative[i + K - 1] - negative[i - 1]) {
            ans = sum + negative[i + K - 1] - negative[i - 1];
        }
        if (ans < sum - positive[i + K - 1] + positive[i - 1]) {
            ans = sum - positive[i + K - 1] + positive[i - 1];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	int A[n];

	for(int i = 0; i < n; i++) scanf("%d",&A[i]);

	for(int i = n-1; i > 0; i--) printf("%d ",A[i]);
		printf("%d\n",A[0]);
}



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

int INF = 1001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  vector<int> d(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n; i++) cin >> c[i] >> d[i];
  vector<vector<int>> res;
  for (int i = 0; i < n; i++) res.push_back({a[i], b[i], 1});
  for (int i = 0; i < n; i++) res.push_back({c[i], d[i], 0});
  sort(res.begin(), res.end());
  bitset<1001> confirmed(0);
  int cnt = 0;
  for (int i = n * 2 - 2; i > -1; i--) {
    if (res[i][2]) {
      int yr = res[i][1];
      int yb = INF;
      int k;
      for (int j = i + 1; j < n * 2; j++) {
        if (confirmed[j] || res[j][2]) continue;
        if (res[j][1] > yr && res[j][1] < yb) {
          yb = res[j][1]; k = j;
        }
      }
      if (yb == INF) continue;
      confirmed.set(k);
      cnt++;
    }
  }
  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 256