akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000002

long long N,L;

long long get(vector<long long> X){
	long long ret = X.back();

	vector<long long> S0(N+1,0LL),S1(N+1,0LL);
	for(int i=1;i<=N;i++){
		S0[i] = X[i-1]*2;
		S1[i] = (L-X[i-1])*2;
		S0[i]+=S0[i-1];
		S1[i]+=S1[i-1];
	}
	
	for(int i=0;i+1<N;i++){
		long long t = X[i]*2;
		int n = N-i-1;
		t += S1.back() - S1[N-(n+1)/2];
		t += S0[N-(n+1)/2] - S0[i+1];
		
		if(n%2==1){
			t -= (L-X[N-(n+1)/2]);
		}
		else{
			t -= X[N-(n+1)/2-1];
		}
		
		ret = max(ret,t);
	}
	return ret;
}

int main(){

	cin>>L>>N;
	
	vector<long long> X(N);
	for(int i=0;i<N;i++)cin>>X[i];
	
	long long ans = get(X);
	
	for(int i=0;i<N;i++){
		X[i] = L-X[i];
	}
	sort(X.begin(),X.end());
	ans = max(ans,get(X));
	
	cout<<ans<<endl;
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(char, a);
  if ('a' <= a && a <= 'z') {
    out('a');
  } else {
    out('A');
  }
}


Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
using namespace std;
long long all_patti[51] = {};


long long solve(long long L, long long x){
    if(x <= 0){
        return 0;
    }
    if(L == 0){
        return 1;
    }
    long long all = pow(2LL, L + 2) - 3;
    if(x >= all && all_patti[L] != 0){
        return all_patti[L];
    }

    
    long long ans = 0;
    if(x > all / 2){
        // mid patti
        ans += 1;
    }
    ans += solve(L - 1, x - 1);
    ans += solve(L - 1, x - all/2 - 1);
    if(x >= all){
        all_patti[L] = ans;
    }
    return ans;

}

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


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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


mint ans;
int N,M;
vector<mint> Perm;
combination comb= combination(int(1e6)+5);




// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
   cin >> N >> M;
  
   Perm.resize(M+5);
   Perm[0] = mint(1);
   Perm[1] = mint(1);
   for(int i=2;i<=M;i++){
       Perm[i] = Perm[i-1]*i;
   }
   mint A = Perm[M]/Perm[M-N];
   ans =0;
   cerr <<"A =" << A << endl; 
   for(int i=0;i<=N;i++){
       mint div = 1;
       if(i%2==1){
           div-=2;
       }
       ans +=  A*(div*comb(N,i)*Perm[M-i]/Perm[M-i-(N-i)]);
    //    cerr << ans << endl;
   }
   cout << ans << endl;
   return 0;
}


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

const int INF = 1000000000;

typedef pair<int,int> P;

#define fr first
#define sc second

int main(){
	static int n,m;
	static int d[100010];
	static int a[200010],b[200010];
	scanf("%d%d",&n,&m);
	for(int i = 1 ; i <= n ; i ++){
		scanf("%d",&d[i]);
	}
	for(int i = 1 ; i <= m ; i ++){
		scanf("%d%d",&a[i],&b[i]);
	}
	
	vector<int> G[100010];
	for(int i = 1 ; i <= m ; i ++){
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}
	
	vector<P> vec;
	for(int i = 1 ; i <= n ; i ++){
		vec.push_back(P(d[i],i));
	}
	sort(vec.begin(),vec.end());
	
	static int color[100010] = {};
	map<P,int> M;
	for(int i = 0 ; i < vec.size() ; i ++){
		int v = vec[i].sc;
		if(color[v] != 0)continue;
		int u = -1;
		for(int j = 0 ; j < G[v].size() ; j ++){
			if(d[G[v][j]] <= d[v]){
				u = G[v][j];
				break;
			}
		}
		if(u == -1){
			puts("-1");
			return 0;
		}
		if(color[u] == 0)color[u] = 1;
		color[v] = -color[u];
		M[P(u,v)] = d[v];
		M[P(v,u)] = d[v];
	}
	
	for(int i = 1 ; i <= n ; i ++){
		if(color[i] == 1)printf("B");
		else printf("W");
	}
	cout << endl;
	for(int i = 1 ; i <= m ; i ++){
		map<P,int>::iterator itr = M.find(P(a[i],b[i]));
		if(itr == M.end()){
			printf("%d\n",INF);
		}
		else printf("%d\n",itr->sc);
	}
}

Measured memory_bytes: 23924
#include <iostream>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	ll i,n,ans=0ll;
	std::cin >> n;
	for(i=0; i<=n; ++i){
		if(i%3&&i%5){
			ans += i;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


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

bool isPossible(int n){
  if(n < 0) return false;
  if(n % 4 == 0 or n % 7 == 0) return true;
  return (isPossible(n-4) or isPossible(n-7));
}

int main(){
  int n;
  cin >> n;
  if(isPossible(n)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

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

void solve() 
{
    int n,m;cin>>n>>m;
    int a[n];
    double sum=0;
    REP(i,n){cin>>a[i];sum+=a[i];}
    sum=sum/4/m;
    double ans=0;
    REP(i,n){
        if(a[i]>=sum)ans++;
    }
    cout<<(ans>=m?"Yes":"No")<<endl;
}

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

Measured memory_bytes: 256
var n,m,i,x:longint;
    ans:int64;

begin
  read(n);
  read(m);
  for i:=1 to n do
  begin
    read(x);
    if x*2<abs(m-x)*2 then inc(ans,x*2) else inc(ans,abs(m-x)*2);
  end;
  writeln(ans);
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n, i;
	cin >> n;
	map <string, lld> str_pair;
	foi(i, n)
	{
		string s;
		cin >> s;
		if (!str_pair.count(s))
			str_pair.insert(pair<string, lld>(s, 1));
	}
	cout << str_pair.size();
	return 0;
}

Measured memory_bytes: 19276
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	if (a < b) return lcm(b, a);
	lint A = a;
	lint B = b;
	lint r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return (A / b) * B;
}

int main() {
	lint A, B;
	cin >> A >> B;
	cout << lcm(A, B) << endl;
}

Measured memory_bytes: 256
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#include <variant>

// Yay!!
#define endl codeforces

// macros for iterator
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

// alias
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

// variadic min/max
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }

// variadic chmin/chmax
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

// multi demension array
template <typename T, std::size_t Head, std::size_t... Tail> struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

// fill container
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { if constexpr (std::is_invocable<F, Args...>::value) { t = f(args...); } else { for (ssize_t i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); } }

// make multi dimension vector
template <typename T> vec<T> make_v(ssize_t sz) { return vec<T>(sz); }
template <typename T, typename... Tail> auto make_v(ssize_t hs, Tail&&... ts) { auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); return vec<decltype(v)>(hs, v); }

// init
namespace init__ { 
struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; 
}


int main() {
    ll s;
    std::string k;
    std::cin >> s >> k;
    if (s < k.size()) {
        k = k.substr(0, s);
        k += "...";
    }
    std::cout << k << "\n";
    return 0;
}


Measured memory_bytes: 3656
/// write by natto-
//#include<stdio.h>

#include<iostream>

using namespace std;

int main(){
    //scanf("%d",&n);
    int h,w;
    cin>>h>>w;
    char cloud[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>cloud[i][j];
        }
    }
    for(int i = 0; i < h; i++){
        int j=0;
            while(cloud[i][j] != 'c'&&j<w){
                cout << -1;
                j++;
                                if(j<w){
                    cout<<" ";
                }
            }
            int count = 0;
            while(j<w){
                if(cloud[i][j] == 'c'){
                    //int count = 0;
                    count=0;
                    cout<<count;
                }
                else{
                    count++;
                    cout<<count;
                }
                j++;
                if(j<w){
                    cout<<" ";
                }
            }
            cout << endl;
    }
    //input finish
    return 0;
}

Measured memory_bytes: 3084
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)]

s = 0
cnt = [0] * (10**5+1)
for a in A:
    cnt[a] += 1
    s += a

for b, c in BC:
    n = cnt[b]
    s -= b * n
    s += c * n
    cnt[c] += n
    cnt[b] = 0
    print(s)


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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N;
  cin >> N;

  if (N == 0) {
    cout << "0" << endl;
    return 0;
  }

  string ans = "";
  while (N != 0) {
    if (N % 2 != 0) {
      ans = "1" + ans;
      N--;
    } else {
      ans = "0" + ans;
    }
    N /= -2;
  }

  // 解答
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include "stdio.h"
int main()
{
  int t,a[100],i,tt=1;
  scanf("%d",&t);
  for(i=0;i<t;i++)
  {
    scanf("%d",&a[i]);
    if(a[i]%2==0&&(a[i]%3!=0&&a[i]%5!=0))
      tt=0;
  }
  if(tt==0)
    printf("DENIED\n");
  else
    printf("APPROVED\n");
  return 0;
}
    
    

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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 T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    if(n%2==1){
        cout<<0<<endl;
        return 0;
    }
    int ans=0;
    while(n>0){
        ans += n/10;
        n /= 5;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import math

a, b, x = map(float, input().split())

v = b*a*a

if v < 2*x:
    print( math.degrees( math.atan(2*(v-x)/(a**3)) ))
elif v == 2*x:
    print( math.degrees( math.atan( b/a ) ) )
else:
    print( math.degrees( math.atan( a*b*b/(2*x) ) ) )

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	switch {
	case (a + b) > (c + d):
		fmt.Println("Left")
	case (a + b) < (c + d):
		fmt.Println("Right")
	default:
		fmt.Println("Balanced")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(ll i=0; i < n; i++)
#define reps(i, n) for(ll i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int sc[101010];

int main() {
  int n,k,q;cin >> n >> k >> q;
  rep(i,n)sc[i]=k-q;
  rep(i,q){
    int s;cin >> s;s--;
    sc[s]++;
  }
  rep(i,n)cout <<(sc[i]>0?"Yes":"No")<< endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n,nmax=0,nmin=1000000009,aax,ain;
struct bagge{int b,r;}bg[200009];
bool cmp(bagge x,bagge y){
	if(x.r<y.r)	return true;
	else if(x.r==y.r&&x.b<y.b)	return true;
	else return false;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&bg[i].b,&bg[i].r);
		if(bg[i].b<bg[i].r)	swap(bg[i].b,bg[i].r);
	}
	sort(bg+1,bg+1+n,cmp);
	for(int i=1;i<=n;i++)
		if(bg[i].r<=nmin&&bg[i].b>=nmax){
			nmin=bg[i].r;nmax=bg[i].b;
			aax=i;ain=i;
		}
		else if(bg[i].r<nmin){
			nmin=bg[i].r;
			aax=i;
		}
		else if(bg[i].b>nmax){
			nmax=bg[i].b;
			ain=i;
		}
	int bmax=nmax,rmin=nmin,bmin=1000000009,rmax=0;
	for(int i=1;i<=n;i++)	rmax=max(rmax,bg[i].r),bmin=min(bmin,bg[i].b);
	long long ans=(long long)(bmax-bmin)*(rmax-rmin);
	bg[n+1].r=1000000009;
	if(ain!=aax){
		bmin=nmin;bmax=nmax;rmax=max(bg[1].b,bg[n].r);rmin=min(bg[1].b,bg[2].r);
		int premin=bg[1].b;ans=min(ans,(long long)(bmax-bmin)*(rmax-rmin));
		for(int i=2;i<=n;i++){
			rmax=max(rmax,bg[i].b);
			rmin=min(min(premin,bg[i].b),bg[i+1].r);
			premin=min(premin,bg[i].b);
			ans=min(ans,(long long)(bmax-bmin)*(rmax-rmin));
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>


using namespace std;
typedef long long ll;

#define INF 2000000000
#define LLINF 4000000000000000000
#define SIZE 3000

int mm[SIZE][SIZE];
int mo[5] = {0,1,0,-1,0};

void calc(int n){
    int x[SIZE],y[SIZE],dx,dy,ans=0;
    set<pair<int,int> > ss;
    double S=0;
    
    for(int i=0;i<n;i++){
        scanf("%d%d",&x[i],&y[i]);
        
        ss.insert(make_pair(x[i],y[i]));
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            
            dx = abs(x[i]-x[j]);
            dy = y[i]-y[j];
            
            if(ss.find(make_pair(x[i]+dy,y[i]+dx))!=ss.end()){
                
                if(ss.find(make_pair(x[j]+dy,y[j]+dx))!=ss.end()){
                    S = pow(sqrt(pow(dx,2) + pow(abs(dy),2)),2);
                }
                
            }
            
            if(ss.find(make_pair(x[i]-dy,y[i]-dx))!=ss.end()){
                
                if(ss.find(make_pair(x[j]-dy,y[j]-dx))!=ss.end()){
                    S = pow(sqrt(pow(dx,2) + pow(abs(dy),2)),2);
                }
                
            }
            
            ans = max(ans, (int)(S + 0.3));
        }
    }
    
    printf("%d\n",ans);
}

int main(){
    int n;
    
    while(1){
        scanf("%d",&n);
        if(n==0) break;
        calc(n);
    }
    
    return 0;
}

Measured memory_bytes: 1340
package main

import (
	"fmt"
)

func abs(a int) int {
	if a < 0 {
		return -a
	} else {
		return a
	}
}

func main() {
	a := make([]int, 3)
	fmt.Scan(&a[0], &a[1], &a[2])
	max := a[0]
	min := a[2]
	for i := 0; i < 3; i++ {
		if a[i] > max {
			max = a[i]
		}
		if a[i] < min {
			min = a[i]
		}
	}
	fmt.Println(max - min)
}


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

int main()
{
    string S;
    cin >> S;
    int N = S.size();
    int left[N + 1] = {};
    int right[N + 1] = {};

    for (int i = 1; i <= N; i++)
    {
        if (S[i - 1] == '<')
        {
            left[i] = left[i - 1] + 1;
        }
    }
    for (int i = N - 1; i >= 0; i--)
    {
        if (S[i] == '>')
        {
            right[i] = right[i + 1] + 1;
        }
    }
    int64_t sum = 0;
    for (int i = 0; i < N + 1; i++)
    {
        sum += max(left[i], right[i]);
    }
    cout << sum << endl;
}


Measured memory_bytes: 4740
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
long long X=0,x=0,ans=1000000000000000000LL;
cin>>n;
vector<long long> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
X+=a[i];
}
for(int i=0;i<n;i++){
x+=a[i];
if(i+1<n)ans=min(ans,abs(X-2*x));
}
cout<<ans<<endl;
}


Measured memory_bytes: 4768
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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


int main(void) {
	
	long long int n, h, w;

	cin >> n;
	cin >> h;
	cin >> w;

	cout << (n - h+1)*(n - w+1) << endl;


	return 0;
}

Measured memory_bytes: 768
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
	ll n,k,cnt = 0;
	cin >> n >> k;
	ll a[n];
	
	rep(i,0,n){
		cin >> a[i];
		if(i > 0){
			if(a[i]+a[i-1] > k){
				cnt += max(a[i]-(k-a[i-1]),(ll)0);
				a[i] -= max(a[i]-(k-a[i-1]),(ll)0);
			}
		}
		else{
			if(a[i] > k){
				cnt += max(a[i]-k,(ll)0);
				a[i] -= max(a[i]-k,(ll)0);
			}
		}
	}
	
	cout << cnt << endl;
	return 0;
}

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

Measured memory_bytes: 3912
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	static int N;
	static int[] nums;
	static int[] dp;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();

		int[] nums = new int[N+1];
		int[] dp = new int[N+1];


		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}

		Arrays.fill(dp, Integer.MAX_VALUE);

		dp[0] = 0;

		for (int i = 1; i < N; i++) {
			dp[i] = Math.min(dp[i], dp[i-1] + Math.abs(nums[i] - nums[i-1]));
			if (i>1) {
				dp[i] = Math.min(dp[i], dp[i-2] + Math.abs(nums[i] - nums[i-2]));
			}
		}

		System.out.println(dp[N-1]);

	}
}


Measured memory_bytes: 60280
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            checked
            {
                var N = cin.ReadInt;
                int[] C, S, F;
                cin.ReadIntArrays(N - 1, out C, out S, out F);

                for (int i = 0; i < N; ++i)
                {
                    var t = 0;
                    for (int j = i; j < N - 1; ++j)
                    {
                        if (t < S[j]) t = S[j];
                        else if (t % F[j] != 0) t += F[j] - t % F[j];
                        t += C[j];
                    }
                    WriteLine(t);
                }
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; }}
        public void ReadIntArrays(long N, out int[] A, out int[] B, out int[] C) { A = new int[N]; B = new int[N]; C = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; C[i] = ReadInt; }}
        public void ReadLongArrays(long N, out long[] A, out long[] B) { A = new long[N]; B = new long[N]; for (long i = 0; i < N; ++i) { A[i] = ReadLong; B[i] = ReadLong; }}
    }
}


Measured memory_bytes: 13268
def main():
    n,k = map(int,input().split())
    a = [int(i) for i in input().split()]
    """
    ruiseki = [1]
    for i in range(n):
        ruiseki.append(ruiseki[-1]*a[i])
    #ruiseki.pop(0)
    
    ans = [ruiseki[k]/ruiseki[0]]
    for i in range(k+1,n+1):
        tmp = ruiseki[i]/ruiseki[i-k]
        if ans[-1] >= tmp:
            print('No')
        else:
            print('Yes')
        ans.append(tmp)
    """
    for i in range(k,n):
        if a[i]>a[i-k]:
            print('Yes')
        else:
            print('No')
main()

Measured memory_bytes: 30920
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int n;
int arr[22][22];
int dp[22][(1<<21)+1];
int fun(int x, int mask)
{
    if(x<0)
    return mask==0;
    if(dp[x][mask]!=-1)
    return dp[x][mask];
    dp[x][mask]=0;
    for(int i=0;i<n;i++)
    {
        if(arr[x][i] && mask&(1<<i))
        dp[x][mask]=(0LL+dp[x][mask]+fun(x-1,mask^(1<<i)))%mod;
    }
    return dp[x][mask];
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        cin>>arr[i][j];
    }
    for(int i=0;i<22;i++)
    {
        for(int j=0;j<(1<<21)+1;j++)
        dp[i][j]=-1;
    }
    cout<<(fun(n-1,(1<<n)-1)+mod)%mod<<"\n";
    return 0;
}

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

namespace geometry {
	using Real = double;
	using Point = complex<Real>;
	constexpr Real EPS = 1e-9;
	struct Circle {
		Point p;
		Real r;
		Circle(const Point p, const Real r) : p(p), r(r) {}
	};
	struct Line {
		Point a, b;
		Line(const Point a, const Point b) : a(a), b(b) {}
	};
	// 内積
	inline Real dot(const Point& lhs, const Point& rhs) {
		return (conj(lhs) * rhs).real();
	}
	// 外積
	inline Real cross(const Point& lhs, const Point& rhs) {
		return (conj(lhs) * rhs).imag();
	}
	// 円の交点
	vector<Point> intersect(const Circle& c1, const Circle& c2) {
		const Real dist = abs(c1.p - c2.p);
		vector<Point> ret;
		if(dist > c1.r + c2.r) return ret;
		if(dist < abs(c1.r - c2.r)) return ret;
		const Real rc = (dist * dist + c1.r * c1.r - c2.r * c2.r) / (2 * dist);
		const Real rs = sqrt(c1.r * c1.r - rc * rc);
		const Point vec = (c2.p - c1.p) / dist;
		ret.emplace_back(c1.p + vec * Point(rc, rs));
		ret.emplace_back(c1.p + vec * Point(rc, -rs));
		return ret;
	}
	// a の b に対する正射影ベクトル
	inline Point projection(const Point& a, const Point& b) {
		return b * dot(a, b) / norm(b);
	}
	// 点pから直線lに下ろした垂線の足
	inline Point projection(const Line& l, const Point& p) {
		return projection(p - l.a, l.b - l.a) + l.a;
	}
	// 直線lを対称軸として点pと線対称な点
	inline Point reflection(const Line &l, const Point &p) {
		return p + (projection(l, p) - p) * 2.0;
	}


	// 直線の交点
	// Point intersect(const Line& l1, const Line& l2) {
	// 	const Point v1 = l1.p2 - l1.p1;
	// 	const Point v2 = l2.p2 - l2.p1;

	// }

	inline istream& operator>>(istream& is, Point& p) {
		Real x, y;
		is >> x >> y;
		p = Point(x, y);
		return is;
	}
	inline ostream& operator<<(ostream& os, const Point &p) {
		return os << fixed << setprecision(15) << p.real() << " " << p.imag();
	}
}

using namespace geometry;
int main() {
	Point p1, p2; cin >> p1 >> p2;
	Line l(p1, p2);
	int q; cin >> q;
	while(q--) {
		Point p; cin >> p;
		cout << reflection(l, p) << '\n';
	}
	return 0;
}


Measured memory_bytes: 3360
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int j;
int prime(){
	int k,fg=0;
	while(1){
		if(j%2==0){
			fg=1;
			j++;
		}
		else{
			k=3;
			while(k<=sqrt(j)){
				if(j%k==0){
					fg=1;
					j++;
					break;
				}
				k+=2;
			}
		}
		if(fg==0){
			j++;
			return j-1;
		}
		fg=0;
	}
}

int main(){
	int p_s[10000];
	p_s[0]=2;
	j=3;
	for(int i=1;i<10000;i++){
		p_s[i]=p_s[i-1]+prime();
	}
	int n;
	while(scanf("%d",&n)){
		if(n==0)
		break;
		printf("%d\n",p_s[n-1]);
	}
}

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

int main(){
  string x;
  cin >> x;
  
  int l = x.size();
  stack<char> ans;
  for(int i = 0; i < l; i++){
    char now = x.at(i);
    if(now == 'S') ans.push(now);
    else if(ans.size() == 0) ans.push(now);
    else if(ans.top() == 'S') ans.pop();
    else ans.push(now);
  }
  
  cout << ans.size() << endl;
}

Measured memory_bytes: 644
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;

const int NMAX = 1e5 + 1;
int n, m, p, was[NMAX];
string s;
bool accepted[NMAX];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n >> m;
    
    int acs = 0, penalties = 0;
    
    for(int i = 0; i < m; i ++){
		cin >> p >> s;
		
		if(! accepted[p]){
			
			if(s == "AC"){
				accepted[p] = true;
				acs ++;
			}
			else if(s == "WA"){
				was[p] ++;
			}
		}
		
	}
	
	for(int i = 1; i <= n ;i ++){
		if(accepted[i]) penalties += was[i];
	}
	
	cout << acs << ' ' << penalties << '\n';
	
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int> x(n),y(n),h(n);
  rep(i,n) cin>>x[i]>>y[i]>>h[i];
  int Hmax=0;
  rep(i,n) Hmax=max(Hmax,h[i]);
  rep(cx,101){
    rep(cy,101){
      for (int H=Hmax;H<Hmax+216;H++){
        bool flg=true;
        rep(i,n){
          if(h[i]!=max(H-abs(cx-x[i])-abs(cy-y[i]),0))flg=false;  
        }
        if(flg==true){
          cout<<cx<<" "<<cy<<" "<<H<<endl;
          return 0;
        }
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3632
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
xs = [A, B, C, D, E]
xs.sort(key=lambda x: 10 if x % 10 == 0 else x % 10, reverse=True)
t = 0
for x in xs[:-1]:
    t += (x + 9) // 10 * 10
t += xs[-1]
print(t)

Measured memory_bytes: 38256
// luogu-judger-enable-o2
#include<iostream>
#include<algorithm>
using namespace std;
bool cmp(int a,int b){
    return a>b;
}
int main(){
    int a[55];
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n,cmp);
    int sum=0;
    for(int i=0;i<k;i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
    return 0;
}


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

int main() {
  int N;
  int A;
  cin >> N;
  cin >> A;
  int x = N % 500;
  
  if (x <= A) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    int m=x*2;
    int n=x*4;
    if(y>0&&y%2==0)
    {
        if(y>=m&&y<=n)
        {
            cout<<"Yes";
        }
        else
        {
            cout<<"No";
        }
    }
    else
    {
        cout<<"No";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int f(int x){
    int ans = 0;
    while (x > 0){
        ans += x % 10;
        x /= 10;
    }
    return ans;
}
int main (){
    int n, a, b;
    while (~scanf("%d%d%d", &n, &a, &b)){
        ll ans = 0;
        for (int i=1; i<=n; i++){
            int x = f(i);
            if (a<=x && x<=b)  ans += (ll)i;
        }
        printf("%lld\n", ans);
    }
    return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
const ll INFL = 1e18;
const int INFI = 1e9;
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}
ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	ll n; cin>>n;
	ll sum = 0;
	forne(i, n){
		ll cnt = n/i;
		sum += i*(cnt*(cnt+1))/2;
	}
	cout<<sum<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	while(t--)
		solve();
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    ll h, w;
    cin >> h >> w;

    if (h * w % 3 == 0)
    {
        cout << 0 << endl;
        return 0;
    }

    ll s = INF;
    for (int i = 0; i <= h; i++)
    {
        ll a = i * w;
        ll b = (h - i) * (w / 2);
        ll c = h * w - (a + b);
        s = min(s, max({a, b, c}) - min({a, b, c}));
        a = i * w;
        b = ((h - i) / 2) * w;
        c = h * w - (a + b);
        s = min(s, max({a, b, c}) - min({a, b, c}));
    }
    swap(h, w);
    for (int i = 0; i <= h; i++)
    {
        ll a = i * w;
        ll b = (h - i) * (w / 2);
        ll c = h * w - (a + b);
        s = min(s, max({a, b, c}) - min({a, b, c}));
        a = i * w;
        b = ((h - i) / 2) * w;
        c = h * w - (a + b);
        s = min(s, max({a, b, c}) - min({a, b, c}));
    }
    cout << s << endl;
}

//書き方の工夫
//↑によって記述量かなり減らせる


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  REP(i,s.size()){
    if(s[i] == '?')s[i] = 'D';
  }
  ANS(s);
  return 0;
}

Measured memory_bytes: 3768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int count = s.length() - t.length() + 1;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < count; i++) {
            int tmp = 0;
            for (int j = 0; j < t.length(); j++) {
                if(s.charAt(i + j) != t.charAt(j)) {
                    tmp++;
                }
            }
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35660
i = input()
a,b,c = map(int, i.split())

if b>c:
    tmp = b
    b = c
    c = tmp
    
if a>b:
    tmp = a
    a = b
    b = tmp
    
if b>c:
    tmp = b
    b = c
    c = tmp

print(a,b,c)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(n);i++);
#define FOR(i,m,n) for(int i=(m);i<(n);i++);
#define VSORT(v) sort(v.begin(),v.end());
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;
const int di[]={-1,0,1,0},dj[]={0,-1,0,1};
const int INF = 99999999;
const ll LINF = 9999999999999;

const int MAXN=510000;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


//k<=1e5
mint COM(long long N, long long K) {
    mint res = 1;
    for (long long n = 0; n < K; ++n) {
        res *= (N - n);
        res /= (n + 1);
    }
    return res;
}

ll fac[MAXN],finv[MAXN],inv[MAXN];

void COMint()
{
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAXN;i++)
    {
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

ll COM(int n,int k)
{
    if(n<k)return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

mint factorial(ll a)
{
    mint ret=1;
    for(ll i=a;i>0;i--)
    {
        ret*=i;
    }
    return ret;
}
int main()
{
    int n;
    cin>>n;
    mint ans=0;
    ll maxv=n/3;
    for(ll i=maxv;i>0;i--)
    {
        ll md=n%i;
        ll res=n/i-3;
        if(res<0)continue;

        ans+=COM(res*i+md+i-1,i-1);
    }
    cout<<ans.x;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
    int N, P;
    string S;
    cin >> N >> P >> S;
    
    int64_t ans = 0;
    if(10 % P == 0) {
        for(int i=0; i<N; i++) {
            if((S[i]-'0') % P == 0) {
                ans += i+1;
            }
        }
    } else {
        vector<int64_t> v(P);
        int t = 0;
        int ten = 1;
        for(int i=0; i<N; i++) {
            t += (S[N-1-i]-'0') * ten;
            ten *= 10;
            t %= P;
            ten %= P;
            v[t]++;
        }
        for(auto e: v) {
            ans += e * (e-1) / 2;
        }
        ans += v[0];
    }

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


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

std::vector<int> primes(int n) {
    std::vector<int> primes;
    std::vector<bool> isPrime(n+1, true);
    for (int i = 2; i <= n; i++) {
        if (!isPrime[i]) continue;
        primes.push_back(i);
        long long buf = i * 2;
        while (buf <= n) {
            isPrime[buf] = false;
            buf += i;
        }
    }

    return primes;
}

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

    Vi v = primes(1e6);
    std::cout << *lower_bound(ALL(v), n) << '\n';

    return 0;
}


Measured memory_bytes: 1020
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] ar = new int[5];
		for(int i = 0; i < 5; i++) ar[i] = in.nextInt();
		for(int i = 0; i < 5; i++) {
			if(ar[i] == 0) {
				System.out.println(i + 1);
				break;
			}
		}
	}
}

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

using namespace std;

int power(int a, int b){
  if( b == 0){return 1;}
  return  a * power( a, b - 1);}

int main(){
int N; cin >> N; 
  vector<int> A(N); int min_cost = 1e9;
  
  for(int i = 0; i < N; i++){cin >> A[i];}
 
  for(int i = -100;  i <= 100; i++){
    int cost = 0;
   for(int j = 0; j < N; j++){
     cost += power((A[j] - i) , 2);}
    min_cost = min(cost,min_cost);}
  cout << min_cost << endl;return 0;}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long r = sc.nextLong();
    long d = sc.nextLong();
    long x = sc.nextLong();
    for(int i = 0;i<10;i++){
      x = r*x-d;
      System.out.println(x);
    }
  }
}


Measured memory_bytes: 35676
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
   
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;

int main(){
    double d,n,x,y=0,z,m,k,w,sum=0,ans=0;
    string s,t;
    bool count=false,ok=false;
    cin >> n;
    VI a(n);
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    sum /= n;
    rep(i,n){
        if(chmin(Min,abs(n*sum-n*a[i]))){
            ans = i;
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,n=0,t,a,b,c=0,sum=0;
	string s,s1,s2;
	cin>>t;
	for(i=1;i<=t;i++)
    {
        if(t%i==0)
        {
            sum+=(t/i)-1;
        }
        else
        {
            sum+=(t/i);
        }

    }
    cout<<sum<<"\n";
	return 0;
}


Measured memory_bytes: 3600