akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<queue>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<set>
#include<iomanip>
#include<vector>
#include<stack>
#define pi acos(-1)
using namespace std;
typedef long long int LL;
const int inf=1e9+10;
char a[100],b[100];
int x[110],y[110],z[210];
int main()
{
    int len1,len2,i,j;
    cin>>a>>b;
    len1=strlen(a);
    len2=strlen(b);
    for(j=0,i=len1-1;i>=0;i--)
			x[j++]=a[i]-'0';
    for(j=0,i=len2-1;i>=0;i--)
    {
        if(b[i]!='.')
        {
            y[j++]=b[i]-'0';
        }
    }
    for(i=0;i<len1;i++)
		{
			for(j=0;j<len2;j++)
				z[i+j]=z[i+j]+x[i]*y[j];
		}
		for(i=0;i<200;i++)
		{
			if(z[i]>=10)
			{
				z[i+1]=z[i+1]+z[i]/10;
				z[i]=z[i]%10;
			}
		}
		for(i=200;i>0;i--)
		{
			if(z[i]==0)
				continue;
			else
				break;
		}
		 if(i<2)
       {
           printf("0\n");
           return 0;
       }
		for(;i>=2;i--)  //倒序输出
			printf("%d",z[i]);
		printf("\n");
		return 0;
}

Measured memory_bytes: 3768
from collections import Counter
m,k=map(int,input().split())
A=list(map(int,input().split()))
d=Counter(A)
l=d.most_common()[::-1]
ans=0
i=0
while len(d)>k:
  ans+=l[i][1]
  del d[l[i][0]]
  i+=1
print(ans)

Measured memory_bytes: 39344
#069d
H,W = map(int, input().split())
N = int(input())

a_list = [int(e) for e in input().split()]

paint_list = []

for i in range(N):
    paint_list += [i+1 for _ in range(a_list[i])]   

#回答の初期化
ans = []
for i in range(H+2):
    if i==0 or i==H+1:
        ans.append([-1 for _ in range(W+2)])
    else:
        line = [0 for _ in range(W+2)]
        line[0]=-1
        line[W+1]=-1
        ans.append(line)

#回答を埋めていく
x = 1
y = 1
direction = 0

def print_ans():
    for i in range(1,H+1):
        print(' '.join(map(str, ans[i][1:W+1])))

for color in paint_list:
    ans[y][x] = color
    #print_ans()
    #print("")
    
    if direction%4 == 0:
        if ans[y+1][x]==0:
            y += 1
        else:
            direction += 1
            x += 1
    elif direction%4 == 1:
        if ans[y][x+1]==0:
            x += 1
        else:
            direction += 1
            y -= 1
    elif direction%4 == 2:
        if ans[y-1][x]==0:
            y -= 1
        else:
            direction += 1
            x -= 1
    elif direction%4 == 3:
        if ans[y][x-1]==0:
            x -= 1
        else:
            direction += 1
            y += 1

print_ans()

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

using namespace std;
struct unin{
    vector<int>pr,sz;
    unin(int n){
        pr.resize(n+1);
        sz=pr;
        for(int i=0;i<=n;i++){
            sz[i]=1;
            pr[i]=i;
        }
    }

    int getrt(int x){
        if(pr[x]==x)
            return x;
        return getrt(pr[x]);
    }
    int cnct(int x,int y){
        x=getrt(x); y=getrt(y);
        if(x==y){
            return 0;
        }
        if(sz[x]>sz[y]){
            pr[y]=x;
            sz[x]+=sz[y];
            return sz[x];
        }else if(sz[x]<sz[y]){
            pr[x]=y;
            sz[y]+=sz[x];
            return sz[y];
        }else{
            pr[x]=y;
            sz[y]+=sz[x];
            return sz[y];
        }
    }
};
int main()
{
    ///{}
    int n;
    cin>>n;
    vector<int>v(1e6+5);
    int gcd;
    int f=0;
    for(int i=0;i<n;i++){
        int tm;
        cin>>tm;
        if(i==0)
            gcd=tm;
        else{
            gcd=__gcd(gcd,tm);
        }
        v[tm]++;
    }
    for(int i=2;i<=1000000;i++){
        int cnt=0;
        if(f)
            break;
        for(int j=i;j<=1000000;j+=i){
            cnt+=v[j];
        }
        if(cnt>1){
            f=1;
        }
    }
    if(!f){
        cout<<"pairwise coprime";
    }else if(gcd==1)
        cout<<"setwise coprime";
    else
        cout<<"not coprime";
    return 0;
}


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

using namespace std;

typedef pair<int,int> pi;

int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
int grid[1005][1005];
int dist[1005][1005];
int H, W, d;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> H >> W;
	queue<pi> q;
	for (int i = 1; i <= H; ++i){
		for (int j = 1; j <= W; ++j){
			char x;
			cin >> x;
			if (x == '.'){
				grid[i][j] = 0;
			}
			else{
				grid[i][j] = 1;
				q.push(pi(i,j));
			}
		}
	}
	while (!q.empty()){
		pi k = q.front();
		q.pop();
		for (int i = 0; i < 4; ++i){
			if (k.first + dx[i] >= 1 && k.first + dx[i] <= H && k.second + dy[i] >= 1 && k.second + dy[i] <= W){
				if (grid[k.first + dx[i]][k.second + dy[i]] == 0){
					dist[k.first + dx[i]][k.second + dy[i]] = dist[k.first][k.second]+1;
					d = max(d,dist[k.first][k.second]+1);
					grid[k.first + dx[i]][k.second + dy[i]] = 1;
					q.push(pi(k.first + dx[i],k.second + dy[i]));
				}
			}
		}
	}

	cout << d << '\n';
}

Measured memory_bytes: 14352
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  int n,k;
  cin>>n>>k;
  cout << (n%k==0 ? 0 : 1) << endl;
  return 0;
}


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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
//#define int ll
#define swap(x, y)((x)^=(y)^=(x)^=(y))
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define tcase int _; cin>> _; for( ; _; --_)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

int n;

void solve(){
	cin >> n;

	int ans = (n/500)*1000;
	ans += (n%500 / 5) * 5;
	cout<< ans<< endl;
}

int32_t main(){
	fastio;
	solve();
	return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

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

    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    long long int ans = 0;
    sort(A.begin(), A.end());

    int i = 0;
    while (i < N - 1) {
        if (A[i] >= 0) break;
        else if (A[i+1] <= 0 || -A[i] > A[i+1]) {
            ans = ans - A[i] - A[i+1];
            i += 2;
        }
        else break;
    }
    while (i < N) ans += A[i++];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> cnt;
  for(auto&e:a) cin >> e, cnt[e]++;
  ll x = 0;
  for(auto p : cnt) {
    x += (ll) p.second * (p.second - 1) / 2;
  }
  for(int i = 0; i < n; i++) {
    ll y = x;
    ll f = cnt[a[i]];
    y -= f * (f-1) / 2;
    f--;
    y += f * (f-1) / 2;
    cout << y << "\n";
  }
  return 0;
}


Measured memory_bytes: 8320
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int[] hairetu = new int[N];
            int[] H = new int[N];
            H[N - 1] = A[N - 1];
            hairetu[0] = A[0];
            for (int i = 1; i < N; i++)
            {
                hairetu[i] = Gcd(hairetu[i - 1], A[i]);
            }
            for (int i = N - 2; i > 0; i--)
            {
                H[i] = Gcd(H[i + 1], A[i]);
            }

            int ans = Math.Max(hairetu[N - 2], H[1]);
            for(int i = 1; i < N - 1; i++)
            {
                ans = Math.Max(ans, Gcd(hairetu[i - 1], H[i + 1]));
            }

            
            Console.WriteLine(ans);
        }
        public static int Gcd(int a, int b)
        {
            var x = 0;

            while (true)
            {
                // 割り切れたら
                if (a % b == 0)
                {
                    return b;
                }
                else
                {
                    x = a % b;
                    a = b;
                    b = x;
                }
            }
        }
    }
}

Measured memory_bytes: 39548
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll mod = 1e9 + 7;

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}
const int M = 200005;
ll dp1[M], dp2[M];
ll ans[M];

int main()
{
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll X = 0, N = 0;
	FOR0(i,n){
		if(s[i] == '1'){
			N++;
		}
	}
	memset(dp1, 0, sizeof(dp1));
	memset(dp2, 0, sizeof(dp2));
	memset(ans, -1, sizeof(ans));
	dp2[n-1] = 1;
	if((N-1) >= 1){
		dp1[n-1] = 1;
		for(int i = n-2; i >= 0; i--){
			dp1[i] = (2*dp1[i+1])%(N-1);
		}
	}
	for(int i = n-2; i >= 0; i--){
		dp2[i] = (2*dp2[i+1])%(N+1);
	}
	ll sum1 = 0, sum2 = 0;
	for(int i = n-1; i >= 0; i--){
		if((N-1) >= 1){
			if(s[i] == '1'){
				sum1 += dp1[i];
				sum1 %= (N-1);
			}
		}
		if(s[i] == '1'){
			sum2 += dp2[i];
			sum2 %= (N+1);
		}
	}
	FOR0(i,n){
		if(s[i] == '1'){
			X += (1LL<<(n-1-i));
		}
	}
	vector<ll> v;
	for(int i = 0; i < n; i++){
		ll val;
		if(s[i] == '0'){
			val = (sum2 + dp2[i])%(N+1);
		}else{
			val = 0;
			if(N == 1){
				ans[i] = 0;
			}
			if((N-1) >= 1){
				val = (sum1 - dp1[i] + N - 1)%(N-1);
			}
		}
		v.push_back(val);
	}
	for(int i = 0; i < n; i++){
		if(ans[i] == -1){
			ans[i] = 1;
		}
		ll val = v[i];
		ll cnt = 0;
		while(val > 0){
			val %= (__builtin_popcount(val));
			cnt++;
		}
		ans[i] += cnt;
	}
	FOR0(i,n){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 10252
N, M, Q = map(int, input().split())
table = [list(map(int, input().split())) for i in range(Q)]

best = 0


def cal_score(A):
    global table
    score = 0
    for i in table:
        if (A[i[1]-1] - A[i[0]-1]) == i[2]:
            score += i[3]
    return score


def next_number(A):
    global best
    global N
    global M
    if len(A) == N:
        return cal_score(A)
    if len(A) == 0:
        min_num = 1
    else:
        min_num = A[-1]
    candidate = list(range(min_num, M+1))
    for i in candidate:
        A.append(i)
        score = next_number(A)
        if score > best:
            best = score
        A.pop(-1)
    return best


A = []
print(next_number(A))


Measured memory_bytes: 9188
a[181],m1[1000000],m2[1000000],T;
int s(p,n,f){
	int *m=p,d=180;
	if(!n)return 0;
	if(m[n]<1000000)return m[n];
	for(;d;d--){
		if(a[d]>n||(f&&!(a[d]&1)))continue;
		T=s(p,n-a[d],f)+1;
		if(m[n]>T)m[n]=T;
	}
	return m[n];
}

main(n){
	for(n=1;n<181;n++)a[n]=n*(n+1)*(n+2)/6;
	memset(m1,99,sizeof(m1));
	memset(m2,99,sizeof(m2));
	for(;scanf("%d",&n),n;)printf("%d %d\n",s(m1,n,0),s(m2,n,1));
	exit(0);
}

Measured memory_bytes: 8420
#include <bits/stdc++.h>
 
 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define IFOR(i,a,b) for(int i=(a);i>=(b);--i)
 
using namespace std;
 
typedef long long lolo;
typedef pair<int, int> pii;
typedef unsigned long long ulolo;
 
const int maxn = 100000 + 5;
const int maxm = 300005;
const int INF = 0x3f3f3f3f;
const lolo inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int MOD = (int)1e9+9;
 
template<class T>
inline void read(T &x) {
    x = 0; T flag = 1;char c;
    do { c = (char) getchar(); if (c == '-') break; } while (c < '0' || c > '9');
    if (c == '-') c = '0', flag = -1;
    do { x = x * 10 + c - '0';c = (char) getchar();} while (c >= '0' && c <= '9');
    x *= flag;
}
template<class T>
inline void out(T x) {
    if (x > 9) out(x / 10);
    x = x % 10;
    putchar('0' + x);
}
pii pos[305*305];
int ans[305*305];
int main(){
//    freopen("../in.txt","r",stdin);
    int h,w,d,x;
    scanf("%d%d%d",&h,&w,&d);
    FOR(i,1,h) {
        FOR(j,1,w) {
            read(x);
            pos[x].first=i;
            pos[x].second=j;
        }
    }
    FOR(i,1,h*w-d) {
        ans[i+d]=ans[i]+abs(pos[i].first-pos[i+d].first)+abs(pos[i].second-pos[i+d].second);
    }
    int q,l,r;
    read(q);
    while (q--) {
        read(l);
        read(r);
        printf("%d\n",ans[r]-ans[l]);
    }
    return 0;
}

Measured memory_bytes: 2176
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> a(n);
    unordered_map<ll, ll> s;
    unordered_map<ll, ll> diff;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s[a[i] + i]++;
        diff[i - a[i]]++;
    }
    ll res = 0;
    for (auto it : diff) {
        if (s.count(it.first)) res += s[it.first] * it.second;
    }
    cout << res <<endl;
    return 0;
}


Measured memory_bytes: 19304
#ifndef CLion
//#pragma GCC optimize ("O3")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define rep(i,s,e) for (int i = s; i < e; ++i)
#define rev(i,s,e) for (int i = s; i > e; --i)
#define mem(a,v) memset(a , v , sizeof a)
//#define mod(x,m) ((x%m + m)%m)
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const int N = 2e5 + 99 ;

ll n , x , y;
set<pair<ll,ll>> s;

void Main(int cse , bool last){
    cin >> n;
    rep(i,0,n){
        cin >> x >> y;
        s.insert({ x , y });
    }

    ll ans = 0;
    ll mnSum = 1e18 , mxSum = -mnSum;
    ll mnDif = 1e18 , mxDif = -mnDif;
    if ( s.size() > 1 ){
        for ( auto &p : s ){
            mnSum = min(mnSum , p.F + p.S);
            mxSum = max(mxSum , p.F + p.S);
            mnDif = min(mnDif , p.F - p.S);
            mxDif = max(mxDif , p.F - p.S);
        }
        ans = max({ans , mxSum - mnSum , mxDif - mnDif});
    }
    cout << ans ;
}

int main(){

#ifndef CLion
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
#ifdef CLion
    freopen( "in.txt" , "r" , stdin  );
//    freopen( "out.txt", "w" , stdout );
    clock_t st = clock();
#endif

    int t = 1;
//    cin >> t;
    for ( int cse = 1; cse <= t; ++cse ) Main(cse, cse == t);

#ifdef CLion
    clock_t en = clock();
    cout << "\n\nTime: " << fixed << (en - st - 0.0) / CLOCKS_PER_SEC;
#endif
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N;
string S;

int main() {
    cin >> N >> S;
    int ans = 0;
    char cur = '*';
    for (int i = 0; i < N; ++i) {
        if (cur != S[i]) {
            ans++;
            cur = S[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
import math

a, b, x = [int(_) for _ in input().split()]

h = x / a / a
if a * b / 2 < a * h:
    theta = math.atan(2 * (b - h) / a)
else:
    theta = math.atan(b * b / a / h / 2)

ans = math.degrees(theta)
print(ans)


Measured memory_bytes: 9368
#include<cstdio>
int n,a[200001],S=0;
long long ans=0;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int r=0;
	for(int l=1;l<=n;l++){
		while(!(S&a[r+1])&&r<n) r++,S^=a[r];
		ans+=1ll*(r-l+1);
		S^=a[l];
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
    int N, M;  cin >> N >> M;
    vector<int> X(N);
    map<int, vector<int>> mp;
    for(int i=0; i<N; i++){
        cin >> X[i];
        mp[X[i]%M].push_back(X[i]);
    }

    ll ans = 0;
    for(int i=0; i<=M/2; i++){
        ll cnt = mp[i].size();
        if(i==0 || (M%2==0 && i == M/2)){
            ans += cnt/2;
        }else{
            ll cnt2 = mp[M-i].size();
            int selected, other, delta;
            if(cnt < cnt2){
                selected = M-i;
                other = i;
                delta = (cnt2 - cnt)/2;
            }else{
                selected = i;
                other = M-i;
                delta = (cnt - cnt2)/2;
            }

            map<int, int> ccc;
            for(int j : mp[selected]){
                ccc[j]++;
            }
            int tmp = 0;
            for(auto p : ccc){
                tmp += p.second/2;
            }
            ans += min(tmp, delta) + mp[other].size();
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 11520
#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

std::string n;

int main()
{
  std::cin >> n;

  rep( i, n.size() )
  {
    char ch = n[i];

    if( ch == '1' )
      ch = '9';
    else if( ch == '9' )
      ch = '1';

    std::cout << ch;
  }

  std::cout << std::endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
s_xy = set(xy)

count = 0
for i in range(n-1):
    for j in range(i+1, n):
        p, q = xy[j][0] - xy[i][0], xy[j][1] - xy[i][1]
        count = max(count, sum((x-p,y-q) in xy for x, y in s_xy))

print(n-count)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define FOR(i,a,n) for(int i=a;i<n;i++)

int t[100000];
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
int main(void)
{
    int n,c,k;
    int m=0,ans=0;
    scanf("%d %d %d",&n,&c,&k);
    FOR(i,0,n) scanf("%d",&t[i]);
    qsort(t,n,sizeof(int),comp);
    while(m<n){
        int num=0;
        int p=m;
        ans++;
        while(t[m]<=t[p]+k&&num<c&&m<n) m++,num++;
    }
    printf("%d\n",ans);
	return 0;
}




Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
string n;
long long ans;
int main()
{
    cin>>n;
    int length=n.length();
    for(int i=0;i<length;i++){
        ans+=n[i]-'0';
    }
    if(ans%9)
        printf("No");
    else
        printf("Yes");
    return 0;
}


Measured memory_bytes: 3888
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()))

S=list(ns())
T=list(ns())
T2=T[0:len(T)-1]
print('Yes' if S==T2 else 'No')

Measured memory_bytes: 9068
n, a, b = map(int, input().split(" "))

wholeSum = 0

def digitSum(n):
  result = sum(map(int, list(str(n))))
  return result
  

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

Measured memory_bytes: 2940
"use strict";
function main(input) {
    const line = input.split("\n");
    let arr = line[0].split(" ");
    const K = parseInt(arr[0]);
    const X = parseInt(arr[1]);
    let ans = []
    for (let i = X - K + 1; i < X + K; i++) ans.push(i);
    console.log(ans.join(" "));
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29816
// Created by  Ambesh kumar
#include "bits/stdc++.h"

#define  ll  long long  
# define  loop(x,n)  for(int x = 0; x < n; ++x)  
#define   constloop(x,a,n) for(int x = a; x < n; ++x)  
#define  revloop(x,a,n)  for(int x = a; x > n; x--) 

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif


    ios::sync_with_stdio(0);
    cin.tie(0);

   ll a,b,n;

   cin>>a>>b>>n;
   ll res;

   if(n<b)
   {


res= floor((a*n)/(double)b)-a*floor(n/b);


   }
   else
   {

ll x= b-1;

 res= floor((a*x)/(double)b)-a*floor(x/b);




   }

   cout<<res<<" \n";

    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int N, M;
int num[50];

int main() {
    while (cin >> N >> M) {
        memset(num, 0, sizeof(num));
        for (int i = 0; i < N; ++i) {
            int k; cin >> k;
            for (int j = 0; j < k; ++j) {
                int a; cin >> a; --a;
                num[a]++;
            }
        }
        int res = 0;
        for (int i = 0; i < M; ++i) {
            if (num[i] == N) ++res;
        }
        cout << res << endl;
    }
}















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

int main(){
    int n, a, min = 1000000, max = -1000000;
    long sum = 0;
    cin >> n;
    
    for(int i = 0; i < n; i++){
        cin >> a;
        sum += a;
        if(a < min){min = a;}
        if(a > max){max = a;}
    }
    
    cout << min << " " << max << " " << sum << endl;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18,MOD=1e9+7;
bool comp(pair<ll,ll>a,pair<ll,ll>b){
    return a.second<b.second;
}
int main(){
   ll n,l;
   cin>>n>>l;
   ll sum=0,ans=INF,ansn=0;
   for(int i=0;i<n;i++)sum+=l+i;
   for(int i=0;i<n;i++){
       int cmp=sum-i-l;
       if(ans>abs(cmp-sum)){
           ans=min(ans,abs(cmp-sum));
           ansn=cmp;
       }
   }
   cout<<ansn<<endl;
}

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


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

int n, m, a, b, N, P, x, y, cnt[2][100005], ans;
ll d[2][100005], D, dis;
vector<pii> v[100005];
pq<pair<pair<ll, int>, int> > q;
void add(int&A, int B){
    A=(A+B)%MN;
}
void dijk(int R, int T){
    cnt[T][0]=1;
    q.push(mp(mp(0, R), 0));
    while(!q.empty()){
        N=q.top().x.y; D=-q.top().x.x; P=q.top().y; q.pop();
        if (D>d[T][N]) continue;
        if (D<d[T][N]){
            d[T][N]=D;
            fox(l, v[N].size()){
                q.push(mp(mp(-D-v[N][l].y, v[N][l].x), N));
            }
        }
        if (D==d[T][N]){
            add(cnt[T][N], cnt[T][P]);
        }
    }
}
int main(){
    fox(l, 100002) d[0][l]=d[1][l]=(1LL<<60);
    scanf("%i%i%i%i", &n, &m, &x, &y);
    fox(l ,m){
        //a=l+1;
        //b=l+2; D=1000000000;
        scanf("%i%i%i", &a, &b, &D);
        v[a].pb(mp(b, D));
        v[b].pb(mp(a, D));
    }
    dijk(x, 0); dijk(y, 1);
    ans=(1LL*cnt[0][y]*cnt[1][x])%MN;
    dis=d[0][y];
    //cout << ans << endl;
    fox1(l, n){
        //cout << d[0][l] << ' ' << d[1][l] << endl;
        if (d[0][l]==d[1][l] && d[0][l]+d[1][l]==dis){
            add(ans, -((1LL*cnt[0][l]*cnt[1][l]%MN)*((1LL*cnt[0][l]*cnt[1][l]%MN))%MN));
        }
        fox(l2, v[l].size()){
            N=v[l][l2].x;
            if (d[0][l]+d[1][N]+v[l][l2].y!=dis) continue;
            if (d[0][l]+v[l][l2].y>d[1][N] &&
                d[1][N]+v[l][l2].y>d[0][l]){
                add(ans, -((1LL*cnt[0][l]*cnt[1][N]%MN)*(1LL*cnt[0][l]*cnt[1][N]%MN)%MN));
            }
        }
    }
    if (ans<0) ans+=MN;
    cout << ans;
    return 0;
}


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

int P(string str)
{
	int c=0,x=str.size()-1;
	for(int i=0;i<str.size()/2;i++)
	{
		if(str[i]!=str[x-i])
		{
			c=-1;
			break;
		}
	}
	if(c==-1)
	return 0;
	else
	return 1;
}

int main()
{
	string str;
	int c=0;
	getline(cin, str);
	int N=str.size();
	c=P(str)+P(str.substr(0,(N-1)/2))+P(str.substr(((N+3)/2)-1,N-1));
	if(c==3)
	cout<<"Yes"<<"\n";
	else
	cout<<"No"<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<29;

int main(){
  string S; cin >> S;
  int N = S.length();
  ll ans = 0;
  for (int bit = 0; bit < (1<<N-1); ++bit){
    ll tmp = 0;
    for (int i = 0; i < N; ++i){
      tmp = tmp * 10 + S[i] - '0';
      if(bit & (1<<i)){
        ans += tmp;
        tmp = 0;
      }
    }
    ans += tmp;
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    int count5, count7 = 0;

    for(int i = 0; i < 3; i++){
        if(a[i] == 5){
            count5++;
        }
        if(a[i] == 7){
            count7++;
        }
    }

    if(count5 == 2 && count7 ==1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int _=1e6+5,yl=1e9+7;
int n,f[_],ans=1;
void inc(int &x,int y){x+=y;if(x>=yl)x-=yl;}
void dec(int *x,int y){x-=y;if(x<0)x+=yl;}	
int main(){
	cin>>n;int s=1ll*(n-1)*(n-1)%yl; f[1]=1;
	for(int i=1,x=1,y=0;i<=n;++i){
		f[i+1]=x;inc(x,y);inc(y,f[i]);
		if(i<n)inc(ans,1ll*f[i]*s%yl);
		inc(ans,1ll*f[i]*(n-1)%yl);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4096
# Problem C - Build Stairs

# input
N = int(input())
h_list = list(map(int, input().split()))

# initialization
is_ok = True

if N>1:
    tmp_height = h_list[-1]
    for i in range(N-2, -1, -1):
        if h_list[i]>tmp_height:
            h_list[i] -= 1
        if not h_list[i]<=tmp_height:
            is_ok = False
            break
        tmp_height = h_list[i]

# output
if is_ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 20708
#include <stdio.h>
#include <math.h>

int main(void) {
	int n, a[1111], i, j, min, max, cmin=0, c[1111]={};
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	
	min=a[0];
	max=a[0];
	
	for(i=1;i<n;i++){
		if(min>a[i])
		min=a[i];
		if(max<a[i])
		max=a[i];
	}
	
	for(i=0;i<n;i++){
		cmin+=pow(a[i]-min, 2);
	}
	
	for(i=min;i<=max;i++){
		for(j=0;j<n;j++){
			c[i]+=pow(a[j]-i, 2);
		}
		if(c[i]<cmin)
		cmin=c[i];
	}
	
	printf("%d\n", cmin);
	
	
	return 0;
}


Measured memory_bytes: 128
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = getList()

ans = A[0]
for i in range(1, N):
    ans = fractions.gcd(ans, A[i])
print(ans)


Measured memory_bytes: 88428
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)


class EndLoop(Exception):
    pass


def debug_print(L):
    for col in L:
        print(col)


def debug_print_joined(L):
    for col in L:
        print("".join(col))


def transpose_matrix(L):
    transposed = list(map(list, zip(*L)))
    return transposed


def solve():
    N, M = list(map(int, input().split(" ")))
    graph = [[0] * N for _ in range(N)]
    for _ in range(M):
        a, b = list(map(int, input().split(" ")))
        graph[a - 1][b - 1], graph[b - 1][a - 1] = 1, 1

    visited = [False for _ in range(N)]
    cnt = 0
    def dfs(v, G):
        visited[v] = True
        for v2 in range(N):
            if G[v][v2] == 1 and visited[v2] != True:
                dfs(v2, G)

    check = [[False] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if check[i][j] == True:
                pass
            elif graph[i][j] == 1 and check[i][j] == False:
                graph[i][j], graph[j][i] = 0, 0
                dfs(0, graph)
                if visited.count(False) == 0:
                    pass
                else:
                    cnt += 1
                graph[i][j], graph[j][i] = 1, 1
                visited = [False for _ in range(N)]
                check[i][j], check[j][i] = True, True

    print(cnt)
    

solve()

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

class UnionFind {
	vector<int> data;
	vector<int> rank;
	int root(int a) {
		return data[a] < 0 ? a : data[a] = root(data[a]);
	}
public:
	UnionFind(int n) : data(n, -1), rank(n, 1) {}
	bool Find(int a, int b) {
		return root(a) == root(b);
	}
	void Union(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) return;
		if (rank[a] < rank[b]) {
			data[a] += data[b];
			data[b] = a;
		}
		else {
			data[b] += data[a];
			data[a] = b;
			if (rank[a] == rank[b]) rank[b]++;
		}
	}
	int Size(int a) {
		return -data[root(a)];
	}
	int Rank(int a) {
		return rank[root(a)];
	}
};

int main()
{
	ll N, M;
	cin >> N >> M;
	UnionFind uf(N * 2), uf2(N + 1);
	for (int i = 0, u, v; i < M; i++) {
		cin >> u >> v; u--; v--;
		uf.Union(u, v + N);
		uf.Union(u + N, v);
		uf2.Union(u, v);
	}
	ll res = 0, c1 = 0, c2 = 0, c3 = 0, sum = 0;
	for (int i = 0; i < N; i++) {
		if (!uf2.Find(i, N)) {
			if (uf2.Size(i) == 1) {
				res += sum * 2 + 1;
				c1++;
				sum++;
			}
			else if (!uf.Find(i, i + N)) {
				res += (c1 * uf2.Size(i) + c2 * 2 + c3) * 2 + 2;
				c2++;
				sum += uf2.Size(i);
			}
			else {
				res += (c1 * uf2.Size(i) + c2 + c3) * 2 + 1;
				c3++;
				sum += uf2.Size(i);
			}
			uf2.Union(i, N);
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
using ll = long long;
int n, m;
ll a[maxn][3];
ll dp[maxn][maxn][8];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i ++) {
		scanf("%lld%lld%lld", &a[i][0], &a[i][1], &a[i][2]);
	}
	for (int i = 0; i <= n; i ++)
		for (int j = 1; j <= n; j ++)
			for (int msk = 0; msk < (1 << 3); msk ++)
				dp[i][j][msk] = -1000000000000000007LL;
	for (int msk = 0; msk < (1 << 3); msk ++)
		dp[0][0][msk] = 0;
	for (int i = 1; i <= n; i ++) {
		for (int j = 1; j <= min(i, m); j ++) {
			for (int msk = 0; msk < (1 << 3); msk ++) {
				dp[i][j][msk] = dp[i - 1][j][msk];
				ll cur = 0;
				for (int k = 0; k < 3; k ++) {
					if (msk >> k & 1) cur += a[i][k];
					else cur -= a[i][k];
				}
				dp[i][j][msk] = max(dp[i][j][msk], dp[i - 1][j - 1][msk] + cur);
//				printf("dp %d %d %d = %lld\n", i, j, msk, dp[i][j][msk]);
			}
		}
	}
	ll mx = 0;
	for (int msk = 0; msk < (1 << 3); msk ++)
		mx = max(mx, dp[n][m][msk]);
	printf("%lld\n", mx);
	return 0;
}

Measured memory_bytes: 63232
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cassert>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<bitset>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n+1, 0);
    for(int i=0;i<n;++i) cin >> a[i];
    sort(all(a));

    int g = 0;
    int c = n;
    for(int i=1;i<=n;++i) {
        if((a[i]-a[i-1]) % 2) {
            g ^= c;
        }
        --c;
    }
    cout << (g?"first":"second") << endl;
}


Measured memory_bytes: 640
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

"""
[求めたいもの]
Σ(r1<=i<=r2)Σ(c1<=j<=c2) f(i,j)

g(R,C) := Σ(0<=i<=R)Σ(0<=j<=C)f(i,j) とすると
ans = g(r2,c2) - g(r2,c1-1) - g(r1-1,c2) + g(r1-1,c1-1)

[性質(パスカルの三角形)]
・f(r+1,c) = f(r,c) + f(r,c-1) + ... + f(r,0)
・g(R,C) = Σ(0<=i<=R)f(i+1,C)
       = f(R+1,C+1) - 1

g(r2,c2) = f(r2+1+c2+1,r2+1) - 1
g(r2,c1-1) = f(r2+1+c1,r2+1) - 1
g(r1-1,c2) = f(r1+c2+1,c2+1) - 1
g(r1-1,c1-1) = f(r1+c1,r1) - 1
"""
def nCr(n,r):
    return fact[n]*pow(fact[n-r],mod-2,mod)*pow(fact[r],mod-2,mod) % mod

r1,c1,r2,c2 = LI()

n = r2+c2+2
fact = [1]*(n+1)
for i in range(1,n+1):
    fact[i] = i*fact[i-1]
    fact[i] %= mod

ans = nCr(r2+c2+2,r2+1) -1
ans -= nCr(r2+c1+1,r2+1) - 1
ans -= nCr(r1+c2+1,c2+1) - 1
ans += nCr(r1+c1,c1) - 1
ans %= mod
print(ans)

Measured memory_bytes: 55660
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
const long long INF = 1LL<<60;

int main(){
	int a,b,c; cin >>a >> b >>c;
	int Max=max({a,b,c});
	int Min=min({a,b,c});
	int Mid=a+b+c-Max-Min;
	int dif1=abs(Max-Mid);
	int dif2=abs(Max-Min);
	int ans=0;
	ans=dif1+(dif2-dif1)/2+((dif2-dif1)%2==1?2:0);
	cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
a = deque(a)
alice = []
bob = []
for i in range(len(a)):
    if i % 2 == 0:
        alice.append(a.popleft())
    else:
        bob.append(a.popleft())
print(sum(alice) - sum(bob))

Measured memory_bytes: 9352
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a[3];
	REP(i, 3)cin >> a[i];
	sort(a, a + 3,greater<int>());
	cout << a[0] * 10 + a[1] + a[2] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

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

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i,j,N,M,T,a,b,c;
  cin>>N>>M>>T;
  vector<tdata> elist(M);
  vec d(N,LLONG_MIN),broken(N,0);
  rep(i,M){
    cin>>a>>b>>c;
    elist[i]=tdata(datas(a-1,b-1),c-T);
  }
  d[0]=0;
  rep(i,N){
    rep(j,M){
      a=elist[j].first.first;
      if(d[a]!=LLONG_MIN){
        b=elist[j].first.second;
        d[b]=max(d[b],d[a]+elist[j].second);
      }
    }
  }
  rep(j,N){
  rep(i,M){
    a=elist[i].first.first;
    b=elist[i].first.second;
    if(d[a]!=LLONG_MIN&&d[b]<d[a]+elist[i].second)broken[b]=1;
  }
  }
  rep(i,N){
    rep(j,M){
      a=elist[j].first.first;
      if(broken[a]){
        b=elist[j].first.second;
        broken[b]=1;
      }
    }
  }
  if(broken[N-1]){
    cout<<-1<<endl;
  }else{
    cout<<max(d[N-1],(ll)0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	static int maxSize;
	
	static boolean ok(int val) {
		return 0 <= val && val < maxSize;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int N = sc.nextInt();
		if (N == 1) {
			System.out.println(1);
			return;
		}
		maxSize = 2 * N - 1;
		char[][] table = new char[2*N-1][2*N-1];
		for (int i = 0; i < N; i++) {
			char[] chars = sc.next().toCharArray();
			for (int j = 0; j < N; j++) {
				table[i][j] = chars[j];
			}
		}
		for (int i = 0; i < table.length; i++) {
			for (int j = 0; j < table.length; j++) {
				table[i][j] = table[i%N][j%N];
			}
		}
		int complete = (N * N - N) / 2;
		int ans = 0;
		int[][] cant = new int[2*N-1][2*N-1];
		for (int delta = -N + 1; delta <= N - 1 ; delta++) {
			for (int i = 0; i < cant.length; i++) {
				Arrays.fill(cant[i], 0);
			}
			for (int dist = 1; dist < N; dist++) {
				for (int i = 0; i < 2 * N; i++) {
					int val = i + delta + dist;
					if (!ok(val) || !ok(i + dist) || !ok(i+delta)) continue;
					if (table[i][val] == table[i+dist][i+delta]) cant[i][val]=1;
					cant[i][val] += cant[i][val-1] + cant[i+1][val]-cant[i+1][val-1];
					if (dist == N - 1 && cant[i][val] == complete) ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 28884
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MAXN=15;
const int MAXP=(1<<MAXN);
int N,M;
int edge[MAXN][MAXN];
int cscore[MAXP];
int dp[MAXN][MAXP];
int main(){
    ios_base::sync_with_stdio(0);
    cin>>N>>M;
    for (int i=0;i<M;i++){
        int a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        edge[a][b]=edge[b][a]=c;
    }
    for (int i=0;i<(1<<N);i++){
        cscore[i]=0;
        for (int j=0;j<N;j++){
            for (int k=j+1;k<N;k++){
                if (i&(1<<j) && i & (1<<k))
                    cscore[i]+=edge[j][k];
            }
        }
    }
    for (int i=0;i<MAXN;i++)
        for (int j=0;j<MAXP;j++)
            dp[i][j]=-1e9;
    for (int i=1;i<(1<<N);i+=2)
        dp[0][i]=cscore[i];
    for (int i=0;i<(1<<N);i++){
        for (int j=0;j<N;j++){
            if (dp[j][i]<0) continue;
            int mask=(1<<N)-1-i;
            for (int sub=mask;sub>0;sub=(sub-1)&mask){
                for (int k=0;k<N;k++){
                    if (edge[j][k] && (sub&(1<<k)))
                        dp[k][i+sub]=max(dp[k][i+sub],dp[j][i]+cscore[sub]+edge[j][k]);
                }
            }
        }
    }
    ll ctot=0;
    for (int i=0;i<N;i++)
        for (int j=i+1;j<N;j++)
            ctot+=edge[i][j];
    cout<<ctot-dp[N-1][(1<<N)-1]<<"\n";
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
int main(){
  ll n,k; cin >>n >>k; ll sum=0;
  for(int i=k; i<n+2; i++) sum=(sum+i*(n+1-i)+1)%MOD;
  cout <<sum;
return 0;}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> v(N);
    copy_n(istream_iterator<unsigned long>(cin), N, v.begin());
    sort(v.begin(), v.end());
    long double ans(v[0]);
    for(unsigned long i = 1; i < N; ++i){
        (ans += v[i]) /= 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
public class Main {

	private static void solve() {
		int n = ni();
		int[] a = na(n);
		
		int[] count = new int[100010];
		for (int v : a) {
			count[v] ++;
		}
		
		int max = 0;
		for (int i = 1; i < count.length - 1; i ++) {
			max = Math.max(max, count[i] + count[i - 1] + count[i + 1]);
		}
		out.println(max);
	}

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

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

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

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 35852