akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

int dp[100005][13];

const int MOD = 1000000007;

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    string s;
    cin >> s;
    int n = s.size();
    dp[0][0] = 1;
    for(int i=1; i<=n; i++){
        if(s[i-1] == '?'){
            for(int j=0; j<=9; j++){
                for(int k=0; k<13; k++){
                    dp[i][(10*k+j)%13] += dp[i-1][k];
                    dp[i][(10*k+j)%13] %= MOD;
                }
            }
        }
        else{
            int j = s[i-1] - '0';
            for(int k=0; k<13; k++){
                dp[i][(10*k+j)%13] += dp[i-1][k];
                dp[i][(10*k+j)%13] %= MOD;
            }
        }
    }
    cout << dp[n][5] << "\n";
    return 0;
}


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

using namespace std;
using int64 = long long;

int main() {
    string s, s_re = "";
    int q;
    cin >> s >> q;
    
    bool d = false;
    for (int i=0; i<q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            d = !d;
            continue;
        }

        int f;
        char c;
        cin >> f >> c;

        if (d ^ (f==1))
            s_re += c;
        else
            s += c;
    }

    string ans;
    if (d) {
        reverse(s.begin(), s.end());
        ans = s + s_re;
    }
    else {
        reverse(s_re.begin(), s_re.end());
        ans = s_re + s;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1280
///17571@nith.ac.in @Ankit Verma
#include <bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define pb          push_back
#define MP          make_pair
#define int         long long
#define ll          long long
#define inf         0x3f3f3f3f
#define MOD         1000000007
#define ld          long double
#define eb          emplace_back
#define pii         pair<int,int>
#define ull         unsigned long long
#define all(v)      v.begin(), v.end()
#define f(i,x,n)    for(int i=x;i<n;i++)
#define fr(i,x,n)   for(int i=x;i>=n;i--)
#define fastio      ios::sync_with_stdio(false)

#define n_l '\n'
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define debug(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

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

int32_t main() {
    //IO();
    fastio;
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a; ld b;
    cin >> a >> b;
    ld c = a * b;
    int x = floor(c);
    cout << x << endl;
    

    return 0;
}


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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int par[1000010];
int Rank[1000010];

void init(int n){
    rep(i,n){
        par[i]=i;
        Rank[i]=0;
    }
}

int find(int x){
    if(par[x]==x) {
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}

void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    
    if(Rank[x]<Rank[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(Rank[x]==Rank[y])Rank[x]++;
    }
}



int main(){
    int dx[]={0,1,0,-1};
    int dy[]={1,0,-1,0};
    string data[1100];
    int w,h;
    cin>>w>>h;
    rep(i,h)cin>>data[i];
    int gy=0,gx=0;
    rep(i,h){
        rep(j,w){
            if(data[i][j]=='t')gy=i,gx=j;
        }
    }
    init(w*h);
    rep(i,h){
        rep(j,w){
            if(data[i][j]!='#'){
                rep(k,4){
                    int ddx=j+dx[k],ddy=i+dy[k];
                    if(ddx>=0&&ddx<w&&ddy>=0&&ddy<h&&data[ddy][ddx]!='#'){
                        unite(i*w+j,ddy*w+ddx);
                    }
                }
            }
        }
    }
    int n;
    cin>>n;
    int ans=-1;
    rep(i,n){
        if(find(0)==find(gy*w+gx)&&ans==-1){
            ans=i;
        }
        int x,y;
        cin>>x>>y;
        data[y][x]='.';
        int ddx[5],ddy[5];
        rep(k,4){
            ddx[k]=x+dx[k];
            ddy[k]=y+dy[k];
        }
        ddx[4]=x;
        ddy[4]=y;
        rep(k,5){
            if(ddx[k]<0||ddx[k]>=w||ddy[k]<0||ddy[k]>=h||data[ddy[k]][ddx[k]]=='#')continue;
            rep(l,5){
                if(k==l)continue;
                if(ddx[l]<0||ddx[l]>=w||ddy[l]<0||ddy[l]>=h||data[ddy[l]][ddx[l]]=='#')continue;
//                cout<<ddy[k]<<" "<<ddx[k]<<" "<<ddy[l]<<" "<<ddx[l]<<endl;
                unite(ddy[k]*w+ddx[k],ddy[l]*w+ddx[l]);
            }
        }
    }
    if(find(0)==find(gy*w+gx)&&ans==-1)
        ans=n;

    cout<<ans<<endl;
}

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

int main() {
  //入力M
  int N;	//マス目
  int A;	//白色に塗るマス数
  int x;	//黒色のマス数
  
  cin >> N;
  cin >> A; 

  x = N * N -A; 
  
  cout << x << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int n, m;
vector<string> A, B;

bool check(int y, int x){
    bool flag = true;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
            if(A[i+y][j+x] == B[i][j])continue;
            else{
                flag = false;
                break;
            }
        }
    }
    return flag;
}

int main(){
    string s;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> s;
        A.push_back(s);
    }
    for (int i = 0; i < m; i++) {
        cin >> s;
        B.push_back(s);
    }
    for (int i = 0; i <= n-m; i++) {
        for (int j = 0; j <= n-m; j++) {
            if(check(i,j)){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		// int m = sc.nextInt();

		int n = s.length();
		boolean isPal = true;
		for (int i = 0; i < (n - 1) / 2; i++) {
			if (s.charAt(i) == s.charAt(n - 1 - i)) {
				continue;
			} else {
				isPal = false;
				break;
			}
		}
		for (int i = 0; i < n / 4; i++) {
			if (s.charAt(i) == s.charAt((n - 3) / 2 - i) && s.charAt((n + 3) / 2 - 1 + i) == s.charAt(n - 1 - i)) {
				continue;
			} else {
				isPal = false;
				break;
			}
		}
		if (isPal) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
}

Measured memory_bytes: 35824
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    string s;cin>>s;
    lli ans=0;
    tr(s,it)
    {
    	int temp=*it-'0';
    	ans+=temp;
    }
    if(ans%9==0)cout<<"Yes";
    else cout<<"No";
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3884
#include<stdio.h>

int main(){

  int n,ka[31],i,nen;
    while(1){

    scanf("%d",&n);
    if(n==0) break;

    ka[1]=1;
    ka[2]=2;
    ka[3]=4;
    for(i=4;i<=30;i++){
      ka[i]=ka[i-3]+ka[i-2]+ka[i-1];
    }

    nen=(ka[n]+3650)/3650;
    printf("%d\n",nen);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli h, w, m;
    cin >> h >> w >> m;
    vector<lli> v;
    set<pll> s;
    map<lli, lli> r, c;
    for1(i, 0, m)
    {
        lli x, y;
        cin >> x >> y;
        s.insert(mp(x, y));
        r[x] += 1;
        c[y] += 1;
    }
    vector<pll> row, col;
    for1(i, 1, h + 1)
    {
        if (r[i])
        {
            row.pb(mp(r[i], i));
        }
    }
    for1(i, 1, w + 1)
    {
        if (c[i])
        {
            col.pb(mp(c[i], i));
        }
    }
    sort(row.rbegin(), row.rend());
    sort(col.rbegin(), col.rend());
    lli t = 0;
    t += row[0].first;
    t += col[0].first;
    if (s.find(mp(row[0].second, col[0].second)) != s.end())
    {
        t -= 1;
    }
    for (int i = 0; i < row.size(); i++)
    {
        for (int j = 0; j < col.size(); j++)
        {
            lli f = row[i].first + col[j].first;
            if (f <= t)
            {
                break;
            }
            if (s.find(mp(row[i].second, col[j].second)) != s.end())
            {
                f -= 1;
            }
            t = max(t, f);
        }
    }
    cout << t << endl;
}

Measured memory_bytes: 76516
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e4 + 7;
const double pi = acos(-1);
const int mod = 100007;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;

int main(){
	ll n;
	cin >> n;
	int cnt = 0;
	ll x = 100;
	while(x < n){
		x += x /100;
		cnt++;
	}
	cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main() {
    int N,K; cin >> N >> K;
    long long ans = K*pow(K-1,N-1);
    cout <<  ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

int main(){
    ll n=in();
    ll ans=n*(n+1)*(n+2)/6;
    rep(i,n-1){
        ll x=in(),y=in();
        if(x>y)swap(x,y);
        ans -= x*(n+1-y);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;



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

int n;
cin >> n;
vector<int> h(n);
int mx = 0, ans = 0;
forn(i, 0, n){
	cin >> h[i];
	mx = max(mx, h[i]);
	if(mx == h[i])ans++;
}
cout << ans << endl;



}




Measured memory_bytes: 3660
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 2160
def func():
    time = []

    for i in range(5):
        t = int(input())
        remainder = t % 10
        if remainder == 0:
            remainder = 10
        tmp = [t, remainder]
        time.append(tmp)

    time = sorted(time, reverse=True, key=lambda x: x[1])

    sum = 0
    for i in range(5):
        if i == 4:
            sum += time[i][0]
        else:
            sum += time[i][0] + (10 - time[i][1])

    print(sum)


if __name__ == '__main__':
    func()


Measured memory_bytes: 3064
n = int(input())
ls = []
for i in range(n):
    ls.append(list(map(int, input().split())))
#print(ls)
sub_ls = []
for i in range(n):
    for j in range(i+1,n):
        a = (ls[i][0] - ls[j][0], ls[i][1] - ls[j][1])
        sub_ls.append(a)
#print(sub_ls)
#print(len(sub_ls))
sub = 0
#print(sub_ls[1][0])
for i in range(len(sub_ls)):
    sub+=(sub_ls[i][0]**2 + sub_ls[i][1]**2)**0.5
print(sub/len(sub_ls)*(n-1))


Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <map>

using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;

    int ans = 0;
    for (int i = 0; i < N - 1; ++i) {
        set<char> f, l;
        for (char c: S.substr(0, (unsigned) i + 1)) {
            f.insert(c);
        }

        for (char c: S.substr((unsigned) i + 1)) {
            l.insert(c);
        }

        map<char, int> m;
        for (char c: f) {
            m[c]++;
        }

        for (char c: l) {
            m[c]++;
        }

        int res = 0;
        for (auto it = m.begin(); it!=m.end(); ++it) {
            if (it->second >= 2) res++;
        }

        ans = max(ans, res);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
alist=list(map(int,input().split()))

alist.sort()

retrum=0

retrum+=alist.pop()
for i in range(n-2):
    if i%2==0:
        retrum+=alist[-1]
    if i%2==1:
        retrum+=alist.pop()
print(retrum)

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

using namespace std;

typedef long long ll;

int a[505];
ll dp[505][505];
ll pref[505];

int main()
{
    int n ;
    cin >> n;
    for(int i = 1 ; i <= n ;i++ ){
        int num;
        scanf("%d",&num);
        pref[i] = pref[i-1] + num;
    }

    for(int i = n - 1 ; i ;i--){
        for(int j = i + 1 ; j <= n ; j++){
            ll minv = 1e18;
            for(int k = i ; k < j ; k++){
                minv = min(minv , dp[i][k] + dp[k+1][j]);
            }
            dp[i][j] = minv + pref[j] - pref[i-1];
        }
    }

    cout << dp[1][n];


    return 0;
}


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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

int a,b;
int main()
{
    

    cin>>a>>b;
    cout<<(a+b)%24;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int lcs(string s1,string s2){
    int m=s1.length();
    int n=s2.length();
    s1=' '+s1;
    s2=' '+s2;
    vector2d(int,c,m+1,n+1,0);
    int maxl=0;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(s1[i]==s2[j]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}

int main(){
    string s,t;
    codefor{
        in(s,t);
        out(lcs(s,t));
    }
}


Measured memory_bytes: 6892
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	int ans1 = A + B;
	int ans2 = A - B;
	int ans3 = A * B;

	cout << max({ ans1,ans2,ans3 }) << endl;
}





Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			int count[] = new int[4];
			while (true) {
				buf = br.readLine();
				StringTokenizer st = new StringTokenizer(buf, " ");
				ArrayList<Integer> e = new ArrayList<Integer>();
				for (int i=0;i<3;i++) {
					e.add(Integer.parseInt(st.nextToken()));
				}
				Collections.sort(e);
				if (e.get(0)+e.get(1)<=e.get(2)) {
					System.out.println(count[0]+" "+count[1]+" "+count[2]+" "+count[3]);
					break;
				}
				int l = e.get(0)*e.get(0)+e.get(1)*e.get(1);
				int r = e.get(2)*e.get(2);
				if (l==r) {
					count[1]++;
				} else if (l>r) {
					count[2]++;
				} else {
					count[3]++;
				}
				count[0]++;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}



Measured memory_bytes: 24224
#-*-coding:utf-8-*-

def main():
    a, b, c, d = map(int, input().split())
    e = -(-c // b)
    f = -(-a // d)
    if e > f:
        print("No")
    else: 
        print("Yes")
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 9116
let () =
  let n, m = Scanf.scanf "%d %d\n" (fun x y -> x, y) in
  let a = Array.make_matrix n m 0 in
  let b = Array.make m 0 in
  let c = Array.make n 0 in
  for i = 0 to (n-1) do
    for j = 0 to (m-1) do
      a.(i).(j) <- Scanf.scanf "%d " (fun x -> x)
    done
  done;
  
  for i = 0 to (m-1) do
    b.(i) <- Scanf.scanf "%d\n" (fun x -> x)
  done;

  for i = 0 to (n-1) do
    for j = 0 to (m-1) do
      c.(i) <- c.(i) + a.(i).(j) * b.(j)
    done
  done;

  for i = 0 to (n-1) do
    Printf.printf "%d\n" c.(i)
  done ;;


Measured memory_bytes: 4616
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;

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

    ll count = 1, str = 1;
    while (str + pow(26, count) <= n) {
        str += pow(26, count);
        ++count;
    }

    while (count >= 1) {
        ll a = pow(26, count - 1), b = 0;
        while (str + a <= n) {
            str += a;
            ++b;
        }

        if (count > 1)
            cout << (char)('a' + b);
        else
            cout << (char)('a' + b);
        --count;
    }
}

Measured memory_bytes: 4064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
//Binary Indexed Tree
template<class T>
struct BIT{
    int n; //length of array
    vector<T> d; //each content of BIT node
    BIT(int n=0):n(n), d(n+1){} //d is initialized by 0.
    void add(int i, T x=1){ //add x to index i
        for(i++; i<=n; i+=i&-i){
            d[i] += x;
        }
    }
    T sum(int i){ //calculate the sum of index 0 - i.
        T ans=0;
        for(i++; i; i-=i&-i){
            ans+=d[i];
        }
        return ans;
    }
};
int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    BIT<int> bit(n);
    for(int i=0; i<n-1; i++){
        if(s[i]=='A'&&s[i+1]=='C') bit.add(i);
    }
    rep(qi,q){
        int l,r;
        cin >> l >> r;
        l--; r--;
        int ans = bit.sum(r-1) - bit.sum(l-1);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
<?php
  $n = trim(fgets(STDIN));
  $max = 0;
  $sum = 0;
  for($i=0; $i<$n; $i++){
      $p = trim(fgets(STDIN));
      $sum += $p;
      $max = max($max, $p);
  }
  echo $sum-($max/2);

Measured memory_bytes: 16192
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;

void Candles() {
	int N,K;
	cin >> N >> K;
	long long res = 1e10;
	long long x[100005];

	for (size_t i = 0; i < N; i++)
	{
		cin >> x[i];
		if (i + 1 >= K) {
			long long f = x[i - K + 1];
			long long r = x[i];
			if (f < 0) {
				if (r < 0) {
					res = min(res, abs(f));
				}
				else {
					long long add = abs(f);
					res = min(res, min(abs(f), r) + abs(f) + r);
				}
			}
			else {
				res = min(r, res);
			}
		}
	}
	cout << res << "\n";
}
int main() {
	Candles();
	return 0;
}


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


int main() {
	// your code goes here
	int n,m;
	std::vector<int> vec,ds;
	cin>>m>>n;
	long long int ans=0;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		vec.push_back(a);
	}
	sort(vec.begin(),vec.end());
	for(int i=1;i<n;i++){
		ds.push_back(vec[i]-vec[i-1]);
	}
	sort(ds.begin(),ds.end());
	for(int i=0;i<n-m;i++){
		ans+=ds[i];
	}
	cout<<ans<<"\n";
	return 0;
}

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

class Node {
   public:
   // long vertex;
   vector<long> to;
   // vector<long> length;
   // int grp;
   long weight = 0;
   long ans = 0;
   bool seen = false;
   bool finish = false;
   Node(){;};
};
vector<Node> vGr;

void dfs(int vertex, ll wnow) {
   if (vGr[vertex].seen) return;
   vGr[vertex].seen = true;
   vGr[vertex].ans = wnow + vGr[vertex].weight;
   for (auto el : vGr[vertex].to) {
      dfs(el, vGr[vertex].ans);
   }
   vGr[vertex].finish = true;
   return;
};



int main(void) {
   int N,Q;
   cin>>N>>Q;

   vGr.resize(N);
   rep(i,N-1) {
      ll a,b;
      cin>>a>>b;
      vGr[a-1].to.push_back(b-1);
      vGr[b-1].to.push_back(a-1);
   }
   rep(i,Q) {
      ll p,x;
      cin>>x>>p;
      vGr[x-1].weight += p;
   }
   dfs(0,0);
   rep(i,N) {
      cout<<vGr[i].ans<<" ";
   }
   cout<<endl;

   
   return 0;
}

Measured memory_bytes: 24320
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll q,h,s,d,n; cin >> q >> h >> s >> d >> n;
  s = min({s,4*q,2*h});
  d = min(d, 2*s);
  cout << (n/2)*d + (n%2) * s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    int N;
    int p[11];
    int i,j;
    int max = 0;
    int sum = 0;
 
    scanf("%d", &N);
 
    for(i=0; i<N; i++){
        scanf("%d", &p[i]);
        if(max<p[i]){
            max = p[i];
        }
        sum = sum + p[i];
    }
    printf("%d", sum-max/2);
 
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>

using namespace std;

const int MAX_M=1000,MAX_N=1000;
const int MAX_K=100000;

int m,n;
int k;
char field[MAX_N+1];
struct type{
	int j,o,i;
};
type operator +(const type &a,const type &b){
	type c;
	c.j=a.j+b.j;
	c.o=a.o+b.o;
	c.i=a.i+b.i;
	return c;
}
type operator -(const type &a,const type &b){
	type c;
	c.j=a.j-b.j;
	c.o=a.o-b.o;
	c.i=a.i-b.i;
	return c;
}
type table[MAX_M+1][MAX_N+1];
type res[MAX_K];

int main(){
	scanf("%d %d",&m,&n);
	scanf("%d",&k);
	for (int y=0;y<m;y++){
		scanf("%s",field);
		for (int x=0;x<n;x++){
			table[y+1][x+1]=table[y][x+1]+table[y+1][x]-table[y][x];
			switch (field[x]){
				case 'J':
					table[y+1][x+1].j++;
					break;
				case 'O':
					table[y+1][x+1].o++;
					break;
				case 'I':
					table[y+1][x+1].i++;
					break;
			}
		}
	}
	for (int p=0;p<k;p++){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		res[p]=table[c][d]-table[c][b-1]-table[a-1][d]+table[a-1][b-1];
	}
	for (int p=0;p<k;p++){
		printf("%d %d %d\n",res[p].j,res[p].o,res[p].i);
	}
	return 0;
}

Measured memory_bytes: 13820
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
int A, B;

void solve() {
    printf("%d\n", A * B - A - B + 1);
}

int main() {
    cin >> A >> B;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<array>
#include<vector>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <tuple>
#include<cmath>

using lli = long long int;
using namespace std;
#define sort(X) sort(X.begin(),X.end())

int inf = 1000000007;
int N;

int main() {
	cin >> N;
	vector<int> b(N + 1);
	for (int i = 1; i <= N; i++) {
		int a;
		cin >> a;
		b[a] = i;
	}
	set<int> s = { 0,N + 1 };
	lli ans = 0;
	for (int i = 1; i <= N; i++) {
		//iを追加、座標はb[i]
		auto itr = s.lower_bound(b[i]);
		lli r = *(itr);
		lli l = *(--itr);
		ans += (r - b[i]) * (b[i] - l) * i;
		s.insert(b[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10368
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size()
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //  // freopen("output.txt", "w", stdout);
    // #endif
    int p, n; cin >> p >> n;
    int data[n+5];
    for(int i = 1; i <= n; i++) {
        cin >> data[i];
    }
    int ans = data[n]-data[1];
    for(int i = 2; i <= n; i++) {
        int temp = (p-data[i]+data[i-1]);
        ans = min(ans, temp);
    }
    cout << ans << '\n';
}



Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#define rep(i,n) for(ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
int main(){
    int n;
    string s;
    cin >> n >> s;

    rep(i,s.size())
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    cout << s << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  for(int i = 1; i <= n; i++) {
    if(i * 1.08 >= n && i * 1.08 < n + 1) {
      cout << i;
      break;
    } else if(i * 1.08 / 1 > n) {
      cout << ":(";
      break;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int gcd(int a, int b) {
    while (b) {
        int c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main() {
    ios::sync_with_stdio(false);
    int n, a[1000006] = {}, g = 0, b[1000006] = {}, p[1000006] = {1, 1};
    vector<int> c;
    for (int i = 2; i <= 1000000; i++) if (!p[i]) {
        c.push_back(i);
        for (int j = i + i; j <= 1000000; j += i) p[j] = 1;
    }
    vector<int> f[1000006] = {};
    for (int i = 2; i <= 1000000; i++) {
        int j = i;
        for (int k : c) {
            if (k * k > j) break;
            if (j % k == 0) {
                f[i].push_back(k);
                while (j % k == 0) j /= k;
            }
        }
        if (j > 1) f[i].push_back(j);
    }
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], g = gcd(g, a[i]);
    if (g != 1) cout << "not";
    else {
        for (int i = 0; i < n; i++) {
            for (int j : f[a[i]]) b[j]++;
        }
        bool y = 0;
        for (int i = 1; i <= 1000000; i++) if (b[i] > 1) {
            y = 1;
            break;
        }
        if (y) cout << "setwise";
        else cout << "pairwise";
    }
    cout << " coprime";
}


Measured memory_bytes: 70768
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        mut a: i64, mut b: i64, k: i64,
    }

    for i in 0..k {
        let (mut a, mut b) = (&mut a, &mut b);
        if i % 2 == 1 {
            std::mem::swap(&mut a, &mut b);
        }
        *b += *a / 2;
        *a /= 2;
    }

    println!("{} {}", a, b);
}


Measured memory_bytes: 2076
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;

int main() {
  int n;
  deque<int> b;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (i % 2)
      b.push_front(a);
    else
      b.push_back(a);
  }
  if (n % 2)
    reverse(b.begin(), b.end());

  for (int i = 0; i < n; ++i) {
    if (i) cout << " ";
    cout << b[i];
  }
  cout << "\n";

  return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer number = scanner.nextInt();

        if (number >= 10) {
            number = number % 10;
        }

        if (number == 2 | number == 4 | number == 5 | number == 7 | number == 9) {
            System.out.println("hon");
        } else if (number == 0 | number == 1 | number == 6 | number ==8) {
            System.out.println("pon");
        } else {
            System.out.println("bon");
        }
    }
}


Measured memory_bytes: 26984
n=gets.to_i

sam1=Array.new(n)
sam2=Array.new(n)
sam1=gets.split.map!(&:to_i)
sam2=gets.split.map!(&:to_i)

kot1=1
kot2=1
kazu1=n
for i in 0..n-2
  ans1=1
  for j in 1..kazu1
    ans1*=j
  end
  kot1+=ans1/kazu1*(sam1[i]-1)
  kazu1-=1
  for k in 0..n-1
    if sam1[k]>sam1[i]
      sam1[k]-=1
    end
  end
end
kazu1=n
for i in 0..n-2
  ans1=1
  for j in 1..kazu1
    ans1*=j
  end
  kot2+=ans1/kazu1*(sam2[i]-1)
  kazu1-=1
  for k in 0..n-1
    if sam2[k]>sam2[i]
      sam2[k]-=1
    end
  end
end
puts (kot1-kot2).abs


Measured memory_bytes: 14248
a = [int(i) for i in input().split()]
f = lambda x: x-x%2
ans = a[1]+f(a[0])+f(a[3])+f(a[4])
if a[0] and a[3] and a[4]: ans = max(ans, a[1]+f(a[0]-1)+f(a[3]-1)+f(a[4]-1)+3)
print(ans)

Measured memory_bytes: 3064
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
ll n,d;
void solve(){
	cin>>n;
	int j=0;
	int mx1=0,mx2=0;
	rep(i,0,n){
		ll t;
		cin>>t;
		if(t>mx1){
			mx1 = t;
			j = i;
		}else if(t>mx2){
			mx2 = t;
		}
	}
	rep(i,0,n)if(i==j)printf("%d\n",mx2);else printf("%d\n",mx1);
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 1664
#include<stdio.h>

int main(void){
	int a,b,c,z=0;
		scanf("%d %d %d",&a,&b,&c);
	for(int i=a;i<=b;i++){
		if((c%i)==0)z++;
	}
		printf("%d\n",z);
return 0;
}


Measured memory_bytes: 2100
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var input1 = input[0].split(' ');
	var n = toInt(input1[0]);
	var k = toInt(input1[1]);

	var ans = Math.ceil((n-1)/(k-1));
	console.log(ans);
}


Measured memory_bytes: 8012
#include<stdio.h>


int main(void)
{
   int i;
   char s[3];
   scanf("%s",s);
   for(i=0;i<3;i++){
        if(s[i]=='1')   s[i]='9';
        else if(s[i]=='9')      s[i]='1';
        }
   printf("%s\n",s);
   return 0;
}


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

int main(void){

  double mountain;
  double Max = 0;
  double Min = 999999;
  while( cin >> mountain ){
    Max = max( mountain , Max );
    Min = min( mountain , Min );
  }
  printf("%.1f",Max - Min);
  return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
vector<int> pre, in, post;
int pos;
int n, k;

void reconstruction(int left, int right) {
    // 遍历到叶结点
    if (left >= right)
        return;

    // 当前子树的根
    int root = pre[pos++];
    // 找出当前根的值在中序数组里的下标
    int m = distance(in.begin(), find(in.begin(), in.end(), root));

    reconstruction(left, m);
    reconstruction(m + 1, right);

    //存入到后序数组
    post.push_back(root);

}
void solve() {
    pos = 0;
    reconstruction(0, pre.size());
    for (int i = 0; i < n; i++) {
        printf("%d%c", post[i], i == n-1?'\n':' ');
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &k);
        pre.push_back(k);
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &k);
        in.push_back(k);
    }
    solve();
    return 0;
}


Measured memory_bytes: 3308
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

int main(){
  vector<int> a(3);
  for(auto &x : a) cin>>x;
  sort(a.begin(),a.end());
  cout<<a[0]*a[1]/2<<endl;
  return 0;
}


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

using namespace std;

struct Show
{
    int start;
    int stop;
    int channel;

    bool CanFollow(const Show &prev) const
    {
        return channel == prev.channel && start == prev.stop;
    }

    bool operator<(const Show &other) const
    {
        if (channel != other.channel) {
            return channel < other.channel;
        }
        return start < other.start;
    }
};

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

    vector<Show> shows(n);
    for (auto &show : shows) {
        cin >> show.start >> show.stop >> show.channel;
    }
    sort(shows.begin(), shows.end());

    constexpr int kMaxTime = 1e5;
    vector<int> count(kMaxTime + 10, 0);

    for (int i = 0; i < n; i += 1) {
        if (i == 0 || !shows[i].CanFollow(shows[i - 1])) {
            count[shows[i].start] += 1;
            count[shows[i].stop + 1] -= 1;
        } else {
            count[shows[i - 1].stop + 1] += 1;
            count[shows[i].stop + 1] -= 1;
        }
    }

    int res = 0;
    for (int i = 1; i <= kMaxTime; i += 1) {
        count[i] += count[i - 1];
        res = max(res, count[i]);
    }

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


Measured memory_bytes: 1792
N = input()

num = len(N)
N = int(N)

def calc(s):
    c = 0
    for i, j in enumerate(s):
        c +=  int(j) * 10**(num-i-1)
    return c

temp = ['0', '3', '5', '7']
ans = 0

while temp:
    p = temp.pop()
    if len(p)==num:
        if set(list(p)) == {'3', '5', '7'} or set(list(p)) == {'3', '5', '7', '0'}:
            ans += 1
    else:    
        if set(list(p))=={'0'}:
            temp.append(p+'0')
        for i in ('3', '5', '7'):
            if calc(p+i)<=N:
                temp.append(p+i)
            
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
//#pragma GCC optimize ("-O3")

using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//const long double PI = 3.14159265358979323846;  /* pi */

double dist(int x, int y)
{
	return sqrt((double)x*x + (double)y*y);
}
int main() {
    //ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, d;
	cin >> n >> d;
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		if (dist(x, y) <= d)
			ans ++;
	}
	cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3680
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }
void printint(uint32_t x){ if(x<0){x=-x; putchar_unlocked('-');}else if(x==0){putchar_unlocked('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar_unlocked(s[i]); putchar_unlocked('\n'); }

char s[4002];

int main(void){
	uint32_t n=nextpint();
	uint32_t dr=0, dg=0, db=0;
	for(uint32_t i=1; i<=n; i++){
		s[i]=getchar_unlocked();
		if(s[i]=='R'){
			dr++;
		}else if(s[i]=='G'){
			dg++;
		}else{
			db++;
		}
	}
	uint32_t ans=dr*dg*db;
	for(uint32_t i=n/2; i>0; i--){
		for(uint32_t j=i-1; j>0; j--){
			if(s[i-j]!=s[i] && s[i+j]!=s[i] && s[i-j]!=s[i+j]){
				ans--;
			}
		}
	}
	for(uint32_t i=n/2+1; i<=n; i++){
		for(uint32_t j=n-i; j>0; j--){
			if(s[i-j]!=s[i] && s[i+j]!=s[i] && s[i-j]!=s[i+j]){
				ans--;
			}
		}
	}
	printf("%"PRIu32"\n", ans);
}


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

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

  string res="";

  if(n==0){
    cout << "0" << endl;
  }
  
  while(n!=0){
    res = to_string(abs(n)%2) + res;
    n = (n - abs(n)%2) / -2;
  }

  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 256
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
/*---------------------------------------------------------------------*/
const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int x,y,a,b,c,t;
    cin>>x>>y>>a>>b>>c;
    vector<int>aa(a),bb(b),cc;
    rep(i,a)cin>>aa[i];
    rep(i,b) cin>>bb[i];
    rep(i,c) cin>>t,cc.PB(t);
    sort(aa.rbegin(),aa.rend());
    sort(bb.rbegin(),bb.rend());
    sort(cc.rbegin(),cc.rend());
    vector<int>sap;
    for(int i=0;i<min(x,a);i++)
    {
        sap.PB(aa[i]);
    }
    for(int i=0;i<min(y,b);i++)
    {
        sap.PB(bb[i]);
    }
    sap.insert(sap.end(),cc.begin(),cc.end());
    int ss=SZ(sap);
    sort(sap.rbegin(),sap.rend());
    ll ans=0;
    for(int i=0;i<min(ss,x+y);i++)
    {
        ans+=sap[i];
    }
    cout<<ans<<nl;
    return 0;
}



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

using namespace std;

typedef long long  ll;

ll NumberOfInversions(int l, int r, vector<int> &a)
{
    if (r - l <= 1)
        return 0;

    ll res = 0;
    int mid = (r + l) / 2;

    res += NumberOfInversions(l, mid, a);
    res += NumberOfInversions(mid, r, a);

    vector<int> tmp(r - l);
    int idx = 0, idx_l = l, idx_r = mid;
    while (idx < (r - l)) {
        if (idx_l == mid)
            tmp[idx++] = a[idx_r++];
        else if (idx_r == r)
            tmp[idx++] = a[idx_l++];
        else {
            if (a[idx_l] <= a[idx_r])
                tmp[idx++] = a[idx_l++];
            else {
                res += mid - idx_l;
                tmp[idx++] = a[idx_r++];
            }
        }
    }

    for (int i = l; i < r; ++i)
        a[i] = tmp[i - l];

    return res;
}

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

    cout << NumberOfInversions(0, n, a) << endl;

    return 0;
}

Measured memory_bytes: 2904
while True:
    plen = input()
    if plen == 0:
        break
    cnum = input()
    width = input()
    cspace = input()
    def formated_print(note):
        for i in xrange(plen):
            print ("."*cspace).join(note[j*plen+i].ljust(width, ".") for j in xrange(cnum))
        print "#"
    note = []
    line = raw_input()
    while line != "?":
        if len(note) >= plen * cnum:
            formated_print(note)
            note = []
        if len(line) > width:
            note.append(line[:width])            
            line = line[width:]
        else:
            note.append(line)
            line = ""
        if line == "":
            line = raw_input()
    if not all(s == "" for s in note):  # !?!!!?!???
        while len(note) < plen * cnum:
            note.append("")    
        formated_print(note)
    print "?"

Measured memory_bytes: 4252
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(){
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a*n, b) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main() {
  int N, A, B, C, D, result;
  int i;
  scanf ("%d", &N);
  
  result = 0;
  for (i=1;i<10;i++) {
  	if (N%i==0) {
  		if (N/i<10) result = 1;
  	}
  }
  
  
  printf("%s", result?"Yes":"No");
  return 0;
}




Measured memory_bytes: 128