akhauriyash/Code-Regression huggingface dataset:
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  VI a(n);
  REP(i, n) cin >> a[i];

  sort(ALL(a));
  int ma = -1;
  REP(i, n-1) {
    if(min(a[i], a[n-1]-a[i]) > ma) {
      ma = a[i];
    }
  }
  cout << a[n-1] << " " << ma << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

Int cnt[100][100];
Int n;
string num;

int main(){
    cin >> n;
    for(Int i = 0;i < n;i++){
        cin >> num;
        Int a = 0;
        Int p = 1000000000;
        bool before = true;        
        for(Int j = 0;j < num.size();j++){
            if(num[j] == '.'){
                a *= p;
                p/=10;
                before = false;
                continue;
            }
            if(before){
                a *= 10;
                a += num[j] - '0';
            }
            else{
                a += (num[j] - '0') * p;
                p /= 10;
            }
        }
        if(before)a *= p;
        Int two = 0, five = 0;
        while(a % 2 == 0){
            a /= 2;
            two++;
        }
        while(a % 5 == 0){
            a /= 5;
            five++;
        }
        cnt[two][five]++;
    }
    Int ans = 0;
    for(int i = 0;i < 100;i++){
        for(int j = 0;j < 100;j++){
            if(cnt[i][j] == 0)continue;
            for(int k = 0;k < 100;k++){
                for(int l = 0;l < 100;l++){
                    if(i + k < 18 || j + l < 18)continue;

                    if(i == k && j == l)ans += cnt[i][j] * (cnt[k][l] - 1);
                    else ans += cnt[i][j] * cnt[k][l];

                }
            }
        }
    }
    ans /= 2;
    cout << ans << endl;
    return 0;
}

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

#define slld(longvalue) scanf("%lld", &longvalue)
#define plld(longvalue) printf("%lld\n", longvalue)

#define slf(longvalue) scanf("%lf", &longvalue)
#define plf(longvalue) printf("%lf\n", longvalue)
#define sc(letter) scanf("%c", &letter)
#define pc(letter) printf("%c", letter)

#define ss(name) scanf("%s", name)
#define ps(name) printf("%s", name)

#define pnew printf("\n")

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >
#define pii pair < int, int >

#define printcase(indexing,ans) printf("Case %lld: %lld\n", indexing, ans)

#define pb(x) push_back(x)

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 1000000009


using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n)
    {
        ll cnt = 1;

        ans = 0;

        while(n)
        {
            n /= 2;

            ans += cnt;

            cnt *= 2;
        }

        cout << ans << endl;
    }


}



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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

const ll mod = 1e9 + 7;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}


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

	string ans;
	ll N = S.size();

	rep(i, N) {
		if ((i + 1) % 2 == 0){
			if (S[i] == 'R') {
				No();
				return 0;
			}
		}
		else {
			if (S[i] == 'L') {
				No();
				return 0;
			}
		}
	}
	Yes();
	return 0;
}

Measured memory_bytes: 256
function Main(inp) {
    var num = 0;
    inp[0] == 1 ? num++ : null;
    inp[1] == 1 ? num++ : null;
    inp[2] == 1 ? num++ : null;
    console.log(num);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

template<typename T>
vector<int> Zalgorithm(const T &s){
    int n=s.size();
    vector<int> z(n);
    z[0]=n;
    int i=1,j=0;
    while(i<n){
        while(i+j<n&&s[j]==s[i+j]) ++j;
        z[i]=j;
        if (j==0){++i; continue;}
        int k=1;
        while(i+k<n&&k+z[k]<j) z[i+k]=z[k],++k;
        i+=k,j-=k;
    }
    return z;
}

template<typename T>
vector<int> LCP(const T &s,const T &t){
    T u(s);
    u.insert(u.begin(),all(t));
    vector<int> Z=Zalgorithm(u);
    for (auto &i:Z) chmin(i,(int)t.size());
    return vector<int>(Z.begin()+t.size(),Z.end());
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> a(N),b(N),c(2*N),d(N);
    rep(i,N) cin >> a[i];
    rep(i,N) cin >> b[i];
    rep(i,N) c[i]=a[i]^a[(i+1)%N],c[i+N]=c[i];
    rep(i,N) d[i]=b[i]^b[(i+1)%N];
    vector<int> v=LCP(c,d);
    rep(k,N){
        if (v[k]>=N) cout << k << ' ' << (a[k]^b[0]) << endl;
    }
}

Measured memory_bytes: 18248
#include<iostream>
using namespace std;
int main(){
	int n, b, f, r, v;
	int d[4][3][10];
	for (int a = 0; a < 4; a++){
		for (int b = 0; b < 3; b++){
			for (int c = 0; c < 10; c++){
				d[a][b][c] = 0;
			}
		}
	}
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		d[b-1][f-1][r-1] += v;
	}
	for (int j = 0; j < 4; j++){
		for (int k = 0; k < 3; k++){
			for (int l = 0; l < 10; l++)
			{
					cout << ' ' << d[j][k][l];
			}
			cout << endl;
		}
		if (j != 3){
			cout << "####################" << endl;
		}
	}

		





 










	return 0;
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("YES\n")
#define NO printf("NO\n")
#define all(c) (c).begin(),(c).end()
using namespace std;
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define N 100005
lld fact[N],invfact[N];
lld nCr(lld n,lld r) {
	lld tmp = (fact[n] * invfact[n-r]) %MOD;
	tmp = (tmp * invfact[r]) %MOD;
	return tmp;
}
int main()
{
	fact[0]=invfact[0]=1;
	rep(i,1,N) fact[i]=(fact[i-1] * i) %MOD;
	rep(i,1,N) invfact[i]=powm(fact[i],MOD-2);
	lld n,m,ans;
	cin>>n>>m;
	ans= (fact[n] * fact[m])%MOD;
	if(m==n-1) {
		cout<<ans;
	}
	else if(m==n) {
		cout<<(2*ans)%MOD;
	}
	else if(m==n+1) {
		cout<<(ans);
	}
	else {
		cout<<0;
	}
	return 0;
}

Measured memory_bytes: 1792
main :-
	read_str(S),
        string_codes(S, Codes),
        find_sums(Codes, Ans),
	write(Ans),
	nl,
	halt.

find_sums(Codes, Sums) :-
        find_sums(Codes, 0, 0, DoubleSums),
        Sums is DoubleSums // 2.
find_sums([], N, Acc, Sums) :-
        Sums is Acc + N.
find_sums([H|T], Digits, Acc, Sums) :-
        code_to_number(H, N),
        NewAccWhenPlus is Acc + Digits,
        find_sums(T, N, NewAccWhenPlus, PlusResult), % +を入れる場合
        NewDigitsWhenNotPlus is Digits * 10 + N,
        find_sums(T, NewDigitsWhenNotPlus, Acc, NotPlusResult), % +を入れない場合
        Sums is PlusResult + NotPlusResult.

code_to_number(Code, Number) :-
        Number is Code - 48.
        
	

read_str(S) :-
        read_string(current_input, ' \n', '', _, S).



Measured memory_bytes: 8168
#include<cstdio>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
ll M(ll a,ll b)
{
    if(a<b) swap(a,b);
    while(a%b!=0)
    {
        ll t=a%b;
        a=b;
        b=t;
    }
    return b;
}
int main()
{
    ll n,m;
    string a,b;
    scanf("%lld%lld",&n,&m);
    cin>>a>>b;
    if(a[0]!=b[0]) {printf("-1\n");return 0;}
    ll ans=n*m/M(n,m);
    bool flag=true;
    ll x=ans/n,y=ans/m;
    ll xx=x,yy=y;
    ll cot1=1,cot2=1;
    while(cot1<n&&cot2<m)
    {
       if(xx<yy) xx+=x,cot1++;
       else if(yy<xx) yy+=y,cot2++;
       else if(xx==yy)
            {
              if(a[cot1]!=b[cot2])
              {
                    flag=false;break;
              }
              xx+=x;yy+=y;cot1++;cot2++;
            }
     }
      if(flag)
     {
            printf("%lld\n",ans);return 0;
     }
    printf("-1\n");
} 

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n;
	scanf("%d", &n);
	vi h(n);
	for (int i = 0; i < n; i++) scanf("%d", &h[i]);
	int ans = 1, m = h[0];
	for (int i = 1; i < n; i++) {
		if (h[i] >= m) ++ans;
		m = max(m, h[i]);
	}
	printf("%d\n", ans);
}


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

int main(){

 int N,R,L;
 int INF = 1e9;

 cin >> N >> R >> L;


 pair <int,int>  score[200005];
 int time[100005];
 for(int i=1;i<200005;i++)score[i]=make_pair(INF,-1);
 int id[200005] = {};
 for(int i=1;i<=N;i++) {
   score[i]=make_pair(0,i);
   id[i] = i;
   time[i] = 0;
 }
 
 int  mae = 0;
 
 int d,t,x;
 for(int i=0;i<R;i++) {
   cin >> d >> t >> x;

 int site1 = id[d];
   assert(site1>=1);
   
   time[score[1].second] += t - mae;
   score[site1].first -= x;
   mae = t;

   if(x>0){ 
     while(site1>1) {
       if(score[site1] < score[site1/2] ) {
	 swap(score[site1], score[site1/2]);
	 id[score[site1].second]= site1;
	 id[score[site1/2].second] = site1/2;
       site1 = site1/2;
     } else break;
     }
   }
   else {
     while(1) {
       if( score[2*site1] < score[site1] || score[2*site1+1] < score[site1]) {
	 int flg = 0;
	 if(score[2*site1] > score[2*site1+1]) flg = 1;
	 swap(score[site1],score[2*site1+flg]);
	 id[score[site1].second] = site1;
	 id[score[2*site1+flg].second] = 2*site1+flg;
	 site1 = 2*site1+flg;
       }else break;
     }
   }
   /*    for(int j=1;j<=N;j++) cout<<score[j].second;
	 cout << endl;
	 for(int j=1;j<=N;j++) cout <<score[j].first <<" ";
	 cout << endl;
	 for(int j=1;j<=N;j++) cout <<time[j] << " ";
	 cout << endl;
   */
 }
 

 time[score[1].second] += L-mae;
 
 int maxtime = -1;
 int ans;
 for(int i=1;i<=N;i++) 
   if(maxtime < time[i]) maxtime = time[i] ,ans = i;

 // for(int i=1;i<=N;i++) cout << time[i] <<" ";
 //cout << endl;
 
 cout << ans << endl;

 return 0;
 
 
}

Measured memory_bytes: 3900
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define lw(vc,num) lower_bound(vc.begin(), vc.end(), num) - vc.begin();
#define hg(vc,num) upper_bound(vc.begin(), vc.end(), num) - vc.begin();
#define bn(v,x) binary_search (v.begin(), v.end(), x)
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
bool isprime(int n)
{
    if(n == 1) return false;
    if(n == 2 || n == 3) return true;
    if(n%2 == 0 || n%3 == 0) return false;
    for(int i=5; i*i<=n; i+=6){
        if((n%i == 0)||(n%(i+2) == 0)) return false;
    }
    return true;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
ll ncr(ll x, ll y) {
	ll ans = 1;
	for (ll i = 1; i <= y; ++i) {
		ans *= (x - y + i);
		ans /= i;
	}

	return ans;
}
int main()
{
    fio;
   int n;
   cin>>n;
   vi v1(n);
   int a1[n+1]= {0};
   loop(i,0,n)
   {
       cin>>v1[i];
   }
   ll sum = 0,h=0;
   loop(i,0,n)
   {
    if(h > v1[i])
       sum += h-v1[i];
    else
        h = v1[i];

   }
   cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 4748
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
int read()
{
	int k=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) k=k*10+c-'0';return k*f;
}
ll n,d;
int main()
{
	n=read();d=read();int res=0;
	for(int i=1;i<=n;i++)
	{
		ll x=read(),y=read();
		if(x*x+y*y<=d*d) res++;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3192
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cstdlib>
#include<cstdio>
#include<string>

using namespace std;
long long dis[100005];
long long vis[100005];
long long p[100005];
long long q[100005];

int main()
{
    //long long  dis[100005],vis[100005],p[100005],q[100005];
    long long  temp,before,i,n,a,c,you,zuo,ymax,zmax;
    cin>>n>>c;
    for(i=0,temp=zmax=before=0; i<n; i++)
    {
        cin>>dis[i]>>vis[i];
        temp=vis[i]+temp-(dis[i]-before);
        before=dis[i];
        if(zmax<temp-dis[i])
            zmax=temp-dis[i];
        q[i+1]=zmax;
        //if(zuo<temp)
        // zuo=temp;
    }
    q[0]=0;
    for(i=n-1,temp=ymax=you=0,before=c; i>=0; i--)
    {
        temp=vis[i]+temp-(before-dis[i]);
        before=dis[i];
        if(ymax<temp-(c-dis[i]))
            ymax=temp-(c-dis[i]);
        p[i]=ymax;
        if(you<temp+q[i])
            you=temp+q[i];
    }
    p[n]=0;
    for(i=0,temp=before=zuo=0; i<n; i++)
    {
        temp=vis[i]+temp-(dis[i]-before);
        before=dis[i];
        if(zuo<temp+p[i+1])
            zuo=temp+p[i+1];
    }
    a=zuo>you?zuo:you;
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cctype>
#include <string>
using namespace std;
int main (){
    string  a, sub_fro, sub_beh, ans;
    int n, x;
    while(1){
        cin >> a >> n;
        if (a[0] == '-')break;
        for (int i = 0; i < n; i ++ ){
            cin >> x;
            sub_fro = a.substr(0,x);
            sub_beh = a.substr(x);
            a = sub_beh + sub_fro;
        }
        cout << a << endl;

    }

}


Measured memory_bytes: 3172
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <vector>
#include <cstdlib>
#define R register
#define IN inline
#define W while
#define gc getchar()
#define MX 100500
template <class T>
IN void in(T &x)
{
	x = 0; R char c = gc;
	for (; !isdigit(c); c = gc);
	for (;  isdigit(c); c = gc)
	x = (x << 1) + (x << 3) + c - 48;
}
int n;
std::vector <int> nex[MX];
IN void add(R int from, R int to) {nex[to].push_back(from);}
int dp[MX];
void DFS(R int now, R int fa)
{
	bool fir = false;
	for (auto i : nex[now])
	{
		if (i == fa) continue;
		DFS(i, now);
		dp[now] += dp[i];
		if (!dp[i]) fir ? dp[now]++ : fir = true;
	}
}
int main(void)
{
	in(n); int foo, bar, rt = -1;
	for (R int i = 1; i < n; ++i)
	in(foo), in(bar), add(foo, bar), add(bar, foo);
	for (R int i = 0; i < n; ++i) if (nex[i].size() > 2) {rt = i; break;}
	if (~rt) DFS(rt, -1), printf("%d", dp[rt]);
	else puts("1"); 
}

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

int main(){
    string s;

    while (getline(cin, s)){
	for (int j = 0; j < 26; j++){
	    for (int i = 0; i < s.size(); i++){
		if ('a' <= s[i] && s[i] <= 'z'){
		    s[i] = (s[i] == 'z')? 'a' : s[i] + 1;
		}
	    }
	    if (s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos)
		cout << s << endl;
	}
    }
    return 0;
}

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

int main()
{
    int n;
    int ans=100000;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        ans*=1.05;
        if((ans%1000)!=0)
            ans=ans-ans%1000+1000;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1164
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int[] data = new int[1000];
    while(true){
      int sum = 0;
      double p = 0;
      double ave;
      int n = scanner.nextInt();
    for (int i = 0; i < n; i++){
      int a = scanner.nextInt();
      data[i] = a;
      sum += a;
    }
    if(n == 0) break;
    ave = (double)sum / n;
    for(int i = 0; i < n; i++){
      p += ((double)data[i] - ave)*((double)data[i] - ave);
    }
    p /= n;
    double s = Math.sqrt(p);
    System.out.printf("%.8f\n", s);
  }
  }
}

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

#define lli long long int
#define pb push_back
#define f first
#define sec second

main()
{
    lli n,i,a,t,j,k,b,c,x,y,sum=0;

    cin>>n;
    lli arr[n],brr[n],crr[n-1];

    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        arr[i]--;
    }

    for(i=0;i<n;i++)
    {
        cin>>brr[i];
    }

    for(i=0;i<n-1;i++)
    {
        cin>>crr[i];
    }
    lli pre = -2;
    for(i=0;i<n;i++)
    {
        a = arr[i];

        if(a == pre+1)
        {
            sum += crr[a-1];
        }
        sum += brr[a];
        pre = a;
    }

    cout<<sum;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>

using namespace std;

int n,a,sm=0;

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        sm+=a;
    }
    printf("%d\n",sm-n);
    
}


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




int main()
{
	string s,t;
	int m,n;
	cin>>s>>t;
	m=s.size();
	n=t.size();

	int dp[m+1][n+1][2];//last [2] here 0 stores value and 1 will store from the valve came
	//1 if it came from diagonal 
	//2 if it came from row
	//3 if it came from column
	//when row and column are same and add 2
	//we may store the the cordinates from where it came by using pair in vector
	int i,j;
	
	for(i=0;i<=m;i++)
		dp[i][0][0]=0;

	for(i=0;i<=n;i++)
		dp[0][i][0]=0;	
	
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(s[i-1]==t[j-1])
			{
				dp[i][j][0]=dp[i-1][j-1][0]+1;
				dp[i][j][1]=1;
			}
			else
			{
				dp[i][j][0]=max(dp[i-1][j][0] , dp[i][j-1][0]);
				if(dp[i-1][j][0] > dp[i][j-1][0])
					dp[i][j][1]=3;
				else
					dp[i][j][1]=2;
			}
		}
	}
	int len=dp[m][n][0];
	char ans[len+1];



	j=n;
    for(i=m;i>0;)
    {
    	for(;j>0;)
    	{
    		if(dp[i][j][1]==1)
    		{
    			ans[len--]=t[j-1];
    			i--;
    			j--;
    		}
    		else if(dp[i][j][1]==2)
    		{
    			j--;
    		}
    		else
    		{
    			i--;
    		}
    		if(i<=0)
    			break;
    	}
    	if(j<=0)
    		break;
    }
    
    len=dp[m][n][0];
    for(i=1;i<=len;i++)
    	cout<<ans[i];


	return 0;
}

Measured memory_bytes: 70656
#include <iostream>
#include <algorithm>
#include <stack>
#include <map>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	if(a>=b){
		ans += a;
		a -= 1;
	}else{
		ans += b;
		b -= 1;
	}
	if(a>=b){
		ans += a;
		a -= 1;
	}else{
		ans += b;
		b -= 1;
	}
	cout << ans;
}

Measured memory_bytes: 256
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.numeric, std.math;

  int n;
  long m;
  rd(n, m);
  auto a = readln.split.to!(long[]);
  auto p = readln.split.to!(int[]);

  auto dp = new long[](1 << n);
  foreach (bit; 1 .. (1 << n)) {
    auto mul = 1L;
    foreach (i; 0 .. n) {
      if (bit & (1 << i)) {
        auto g = gcd(mul, a[i]), b = mul / g;
        if (1.0 * b * a[i] > m) {
          mul = m + 1;
          break;
        }
        mul = mul / g * a[i];
      }
    }
    dp[bit] = m / mul;
  }
  foreach (i; 0 .. n) {
    foreach (bit; 0 .. (1 << n)) {
      if ((bit & (1 << i))) {
        dp[bit] -= dp[bit ^ (1 << i)];
      }
    }
  }
  auto ans = 0.0;
  foreach (bit; 0 .. (1 << n)) {
    auto q = 1.0;
    foreach (i; 0 .. n) {
      if (bit & (1 << i)) {
        q *= p[i] / 100.0;
      } else {
        q *= (100 - p[i]) / 100.0;
      }
    }
    ans += (dp[bit].abs) * q;
  }
  writefln("%.18f", ans);

}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}



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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

long int M = 1e+9+7;
int main(void){
    int n,m;
    cin >> n >> m;
    vi p(m),wa(n);
    vector<string> s(m);
    vector<bool> ac(n,false);
    int cntac=0,cntwa=0;
    rep(i,m){
        cin >> p[i] >> s[i];
        p[i]--;
        if(ac[p[i]]) continue;
        if(s[i] == "WA"){
            wa[p[i]]++;
        }else{
            ac[p[i]]=true;
            //cout << p[i] << "OK" << endl;
        }
    }
    rep(i,n){
        if(ac[i]){
            cntac++;
            cntwa+=wa[i]; 
        }
    }
    cout << cntac << " " << cntwa << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
ll s[2000005];
void update(ll id, ll l, ll r, ll p){
	if (l == r){
		s[id]++;
		return;
	}
	ll mid = (l + r) / 2;
	if (p <= mid) update(id * 2, l, mid, p);
	else update(id * 2 + 1, mid + 1,  r, p);
	s[id] = s[id * 2] + s[id * 2 + 1];
}
ll query(ll id, ll l, ll r, ll L, ll R){
	if (L > r) return 0;
	if (r < L || R < l) return 0;
	if (L <= l && r <= R) return s[id];
	ll mid = (l + r) / 2;
	return query(id * 2, l, mid, L, R) + query(id * 2 + 1, mid + 1, r, L, R);
}
int main(){
	ll n, q;
	cin >> n >> q;
	ll a[n], b[n], ans[q], prev[n + 1], next[n], pos = 0;
	fill(prev, prev + n + 1, -1);
	fill(next, next + n, n);
	set<ll> s;
	for (ll i = 0; i < n; i++){
		cin >> a[i];
		s.emplace(a[i]);
		b[i] = s.size();
		if (prev[a[i]] != -1) next[prev[a[i]]] = i;
		prev[a[i]] = i;
	}
	pair<pair<ll, ll>, ll> p[q];
	for (ll i = 0; i < q; i++){
		cin >> p[i].ff.ff >> p[i].ff.ss;
		p[i].ff.ff--, p[i].ff.ss--, p[i].ss = i;
	}
	sort(p, p + q);
	vector<ll> v;
	for (ll i = 0; i < n; i++){
		while (pos < q && p[pos].ff.ff == i){
			ans[p[pos].ss] = b[p[pos].ff.ss] - query(1, 0, n, p[pos].ff.ss + 1, n);
			pos++;
		}
		update(1, 0, n, next[i]);
	}
	for (ll i = 0; i < q; i++) printf("%lld\n", ans[i]);
	printf("\n");
}

Measured memory_bytes: 58520
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;


public class Main {
    String A, B;
    private void solve() {
        A = next();
        B = next();
        BigDecimal ans = (new BigDecimal(A)).multiply(new BigDecimal(B)).setScale(0, BigDecimal.ROUND_FLOOR);
        out.println(ans.toPlainString());
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 25668
#include <cstdio>
#include <algorithm>
using namespace std;

class Pkt
{
public:
	int t,s,d;
	Pkt() {}
	Pkt(int t, int s, int d)
	:t(t),s(s),d(d)
	{}
	
	bool operator<(const Pkt& p) const
	{
		return t<p.t;
	}
};

int main()
{
	int N,M;
	while(scanf("%d%d", &N, &M), (N||M))
	{
		Pkt p[20000];
		for(int i=0; i<M; i++)
		{
			int t,s,d;
			scanf("%d%d%d",&t,&s,&d);
			s--; d--;
			p[i]=Pkt(t,s,d);
		}
		
		sort(p,p+M);
		
		bool infe[20000]={0};
		infe[0]=1;
		for(int i=0; i<M; i++)
		{
			if(!infe[p[i].s]) continue;
			infe[p[i].d]=1;
		}
		
		int cnt=0;
		for(int i=0; i<N; i++)
			if(infe[i]) cnt++;
			
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 1020
n = int(input())
dic = {}
def fun(n):
    result = 1
    if n == 3 or n == 4 or n == 5:
        return 1
    if n in dic:
        return dic[n]
    for i in range(3, n-2):
        result += fun(i)
        dic[i] = fun(i)
    return result


result = fun(n) % (10 ** 9 + 7)
if n < 3:
	print(0)
else:
	print(result)

Measured memory_bytes: 9436
#include <bits/stdc++.h>
const int N = 44721;
using namespace std;
int sum[N];
int main()
{
 
 
    for (int i = 1; i <= N; i++)
    {
        sum[i] = sum[i-1] + i;
    }
    int x;
    while (~scanf("%d", &x))
    {
        int loc = lower_bound(sum, sum + N, x) - sum;
  
        printf("%d\n", loc);
    }   
    return 0;
}


Measured memory_bytes: 1020
fun main(args: Array<String>) = hitachi2020b()

fun hitachi2020b() {
    val (a, b, m) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toInt() }
    val bList = readLine()!!.split(' ').map { it.toInt() }
    val xycList = (1..m).map { readLine()!!.split(' ').map { it.toInt() } }

    val aMin = aList.min()!!
    val bMin = bList.min()!!

    var answer = aMin + bMin

    for ((x, y, c) in xycList) {
        answer = Math.min(answer, aList[x - 1] + bList[y - 1] - c)
    }

    println(answer)
}


Measured memory_bytes: 108316
#include<iostream>
#include<vector>//可変長配列
#include<algorithm>//sort,二分探索,など
#include<map>//map(辞書)

using namespace std;

int main(void){
    string s, t;
    
    cin >> s >> t;
    int N = s.length();

    int count = 0;
    for(int i = 0; i < N; i++){
        if(s[i] != t[i]){
            count += 1;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3912
def main():
    n = input()
    if n[-1] == '2' or (n[-1] == '4') or (n[-1] == '5') or (n[-1] == '7') or (n[-1] == '9'):
        print('hon')
    elif n[-1] == '3':
        print('bon')
    else:
        print('pon')









main()

Measured memory_bytes: 9024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author GYSHGX868
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      long a = in.nextLong();
      char c = in.nextChar();
      long b = in.nextLong();
      if (c == '+') {
        out.printLine(a + b);
      } else {
        out.printLine(a - b);
      }
    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(long i) {
      writer.println(i);
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public char nextChar() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      return (char) c;
    }

    public interface SpaceCharFilter {
      boolean isSpaceChar(int ch);

    }

  }
}



Measured memory_bytes: 21332
#include<iostream>
using namespace std;
int main()
{
	int a, b, c, d, e, x[5], i, j, y;
	cin >> a >> b >> c >> d >> e;
	x[0] = a;
	x[1] = b;
	x[2] = c;
	x[3] = d;
	x[4] = e;
	for ( j = 0;j < 5; j++)
	{	for ( i = 0;i < 4; i++)
		{
			if (x[i] < x[i + 1])
				{
					y = x[i + 1];
					x[i + 1] = x[i];
					x[i] = y;
				}
		}
	}
	cout << x[0] << " " <<x[1] << " " << x[2] << " " << x[3] << " " << x[4] << endl;
return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int count = 0;
  rep(i,n-1) {
    if (s[i] == s[i+1]) count++;
  }
  int ans = min(count + 2*k, n-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define Rep(i,N) for(i=0;i<N;i++);
#define mod 1000000007

long mmax(long a,long b,long c){return a<b?max(b,c):max(a,c);}

long mmin(long a,long b,long c){return a<b?min(a,c):min(b,c);}

int mid(int a,int b,int c){
if((a<b&&b<c)||(a>b&&b>c))return 0;
return 1;
}
long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

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

long long modncr(long long n,long long r){
  long long i,plus=1;
  for(i=0;i<r;i++){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

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

int main(){
  ll i,N,K,bf=0,ans;
  cin>>N>>K;
  vector<ll> a(N);
  a[0]=N-K+1;
  bf=a[0];
  cout << N-K+1 << endl;
  for(i=1;i<K;i++){
 //   cout<< modncr(K-1,i) <<endl;
   // cout<< modncr(N-K+1,i+1) <<endl;
    cout<< (modncr(K-1,i)*modncr(N-K+1,i+1))%mod <<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=55,M=1e9+7,Z=3000;
int n,k,dp[N][N][N*N<<1];
void ck(int &x){
	if(x>=M)x-=M;
}
signed main(){
	scanf("%lld %lld",&n,&k);
	if(k&1||k>(n*n>>1)){
		puts("0");
		return 0;
	}
	dp[0][0][Z]=1;
	for(int i=0;i<n;++i){
		for(int o=0;o<=i;++o){
			for(int u=0;u<=6000;++u){
				if(!dp[i][o][u])continue;
				dp[i+1][o][u]+=dp[i][o][u];ck(dp[i+1][o][u]);
				dp[i+1][o][u]+=1ll*dp[i][o][u]*o%M;ck(dp[i+1][o][u]);
				dp[i+1][o][u]+=1ll*dp[i][o][u]*o%M;ck(dp[i+1][o][u]);
				dp[i+1][o+1][u-i]+=dp[i][o][u];ck(dp[i+1][o+1][u-i]);
				if(o)dp[i+1][o-1][u+i]+=1ll*dp[i][o][u]*o*o%M;ck(dp[i+1][o-1][u+i]);
			}
		}
	}
	printf("%lld\n",dp[n][0][Z+k/2]);
}

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

int main() {
  ll N,Y;
  cin >> N >> Y;
  ll money=Y/1000;
  ll x=-1, y=-1, z=-1;
  bool a = false;
 
  for(ll i=0; i<=2000; i++){
    for(ll j=0; j<4000; j++){
      ll c = N-i-j;
      if(10*i+5*j+c == money && c>=0){
        x=i;
        y=j;
        z=c;
        a=true;
        break;
      }
    }
    if(a)break;
  }
  cout << x << ' ' << y << ' ' << z << endl;
        
}


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

int main(){
  int n,t[2],x[2],y[2];cin>>n;
  bool f=1;
  t[0]=0;x[0]=0;y[0]=0;
  REP(i,n){
    cin>>t[1]>>x[1]>>y[1];
    int dt=abs(t[1]-t[0]),dist=abs(x[1]-x[0])+abs(y[1]-y[0]);
    if(dt<dist || (dt-dist)%2) f=0;
    t[0]=t[1];x[0]=x[1];y[0]=y[1];
  }
  cout<<(f?"Yes":"No");
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int f(int x) {
    int ans = 0;
    while(x%2==0){
        x/=2;
        ans++;
    }
    return ans;
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    //aが偶数じゃなかったら0返す
    //aを2で割る a=>a'(a'=a/2)
    rep(i,n) {
        if(a[i]%2==1) {
            cout << 0 << endl;
            return 0;
        }
        a[i]/=2;
    }

    //find how mamy times you can devide by 2(finding t)
    int t = f(a[0]);
    rep(i,n) {
        if(f(a[i])!=t){
            cout << 0 << endl;
            return 0;
        }
        a[i] >>= t;//2^tでわる
    }
    m >>= t;//2^tでわる
    ll x = 1;
    rep(i,n) {
       x = lcm(x,a[i]);
       if(x>m) {
           cout << 0 << endl;
           return 0;
       }
    }
    m/=x;
    int ans = (m+1)/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int64_t i=ini;i<n;i++)
#define _rep(i,ini,n) for(int64_t i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int64_t N,K; cin>>N>>K;
    vector<int64_t> A(N);
    rep(n,0,N) cin>>A.at(n);

    vector<int64_t> Lfall(N,0),Rfall(N,0);
    rep(i,0,N){
        rep(j,0,N){
            if(j<i && A.at(j)<A.at(i)) Lfall.at(i)++;
            if(i<j && A.at(j)<A.at(i)) Rfall.at(i)++;
        }
    }

    int64_t ans=0;
    rep(n,0,N){
        int64_t val=((K*(K-1))/2)%MOD;
        val*=(Lfall.at(n)+Rfall.at(n))%MOD;
        val%=MOD;
        val+=(K*Rfall.at(n))%MOD;
        val%=MOD;

        ans+=val;
        ans%=MOD;
    }

    cout<<ans<<endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> p(N),v(N);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
  }
  v=p;
  sort(v.begin(),v.end());
  int count=0;
  for(int i=0;i<N;i++){
    if(v.at(i)!=p.at(i)){
      count++;
    }
  }
  if(count<=2){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

int n;
vec<int> a;

vec<int> getCoef(int n, int sign) {
	vec<int> c(n);
	rep (i, n) {
		c[i] = (i == 0 or i == n-1 ? 1 : 2);
		if (i % 2 == 0) {
			c[i] *= sign;
		} else {
			c[i] *= -sign;
		}
	}


	return c;
}

signed main() {
	cin >> n;
	a.resize(n);
	rep (i, n) {
		cin >> a[i];
	}
	sort(all(a));

	int ans = 0;
	for (int sign : {-1, 1}) {
		auto c(getCoef(n, sign));
		sort(all(c));

		int sum = 0;
		rep (i, n) {
			sum += a[i] * c[i];
		}

		chmax(ans, sum);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1920
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        int count = 0;
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();

        for(int i=0; i <= a; i++){
            for(int j=0; j <= b; j++){
                for(int k=0; k <= c; k++){
                    int sum = 500*i + 100*j + 50*k;
                    if (sum == x)count++;
                }
            }
	    }

        System.out.println(count);
        sc.close();
    }
}


Measured memory_bytes: 21716
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		System.out.println((A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) ? "Possible" : "Impossible");
	}
}

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

int main() {
	double A, B, h,m;
	scanf("%lf",&A);
	scanf("%lf",&B);
	scanf("%lf",&h);
	scanf("%lf",&m);

	double C,x=0,f=0,j=0,y=0;

	f=m*6.0;
	j=(h*30)+m*0.5;

	if(f<=j){
		y=j-f;
		if(y>180)
			y=360-y;
	}else{
		y=f-j;
		if(y>180)
			y=360-y;
	}

	x=y*(M_PI/180);


	



	



	C = sqrt(A * A + B * B - 2 * A * B * cos(x));

	printf("%.20lf",C);

	return 0;
}


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

#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
#define FIX <<fixed<<setprecision(10)<<
using namespace std;

using ll = long long; using ull = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;

const ll MOD = 1e9+7;

int main(){
double x1;
double x2;
double y1;
double y2;
cin>>x1>>y1>>x2>>y2;
cout FIX sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
	string s;
	cin >> s;
	int topping = 0;
	for(int i=0;i<3;i++){
		if(s[i] == 'o'){
			topping++;
		}
	}
	cout << 700 + topping*100 << endl;
	
  return 0;
}

Measured memory_bytes: 256
N = gets.chomp.to_i
a = Array.new(N){Array.new(2)}
for i in 0...N do
    str = gets.split
    a[i][0], a[i][1] = str[0].to_i-str[1].to_i, str[0].to_i+str[1].to_i
end
a.sort_by! {|x| x[0]}

answer = 0
b = a[0][1]
for i in 1...N do
    c = a[i][0]
    if b <= c
        answer += 1
        b = a[i][1]
    else
        d = a[i][1]
        if b > d
            b = d
        end
    end
end
answer += 1
puts answer

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

int main() {
    int n;
    cin >> n;
    
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        if (s.length() % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

ll lcm(ll a,ll b){
    return (a*b/gcd(a,b));
}

int main(){
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    int ans=d[d.size()/2]-d[d.size()/2-1];
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = (ll) 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 300005;


int main() {
    FAST
    string h;
    cin>>h;
    if(h[h.size()-1]=='s')
        cout<<h<<"es"<<endl;
    else{
        cout<<h<<"s"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3656
n , m = input().split()
n , m = int(n) , int(m)

a = [0 for i in range (n)]

ans = 0
pnl = 0
ha = {}

for i in range (m) :
    p , s = input().split()
    p = int(p) - 1
    if s == 'WA' :
        a[p] += 1
    elif str(p) not in ha.keys() :
        ans += 1
        pnl += a[p]
        ha[str(p)] = '1'

print( str(ans) + ' ' + str(pnl))

Measured memory_bytes: 17904