akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int lli;
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define F first
#define S second
#define forn(i,n) for(int i = 0; i<n; i++)
#define forab(i,a,b) for(int i = a; i<b; i++)
#define forll(i,a,b) for(lli i = a; i<b; i++)
#define mp make_pair
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define debug(x) cout<<#x<<" : "<<x<<endl
#define all(x) x.begin(),x.end()
#define printv(v) for(auto it : v) cout<<it<<" ";cout<<endl;
#define prec(n) fixed<<setprecision(n)
const int mod1 = 1000000007;
const int mod2 = 998244353;
const int N = 1e5;

int main()
{
	optimize

	#ifndef ONLINE_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
	#endif

	int n;
	cin>>n;
	vi a(n);
	forn(i,n) cin>>a[i];

	lli ans = 0;

	forn(i,n-1)
	{
		if(a[i+1]<a[i]){
			ans += (lli)a[i]-a[i+1];
			a[i+1] = a[i];

		}
	}
	
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3952
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
using namespace std;

vector<bool> makeIsPrime(int n){
    vector<bool> prime(n + 1, true);
    if(n >= 0)prime[0] = false;
    if(n >= 1)prime[1] = false;

    for(int i = 2; i * i <= n; i++){
        if(!prime[i])continue;

        for(int j = i * i; j <= n; j += i){
            prime[j] = false;
        }
    }
    return prime;
}

int main(){
    vector<bool> prime = makeIsPrime(10000000);
    /*
    vector<int> primeCnt(n+1, 0);
    for(int i = 1; i <= n; i++){
        primeCnt[i] = primeCnt[i - 1] + (prime[i] ? 1 : 0);
    }
    */
    int a, d, n;
    while(cin >> a >> d >> n){
      //cout << a << " " << d << "  " << n << endl;
        if(a == 0 && d == 0 && n == 0){return 0;}
        a -= d;
        while(1){
            a += d;
            if(prime[a])n--;
            if(n == 0){
                cout << a << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3892
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc097/tasks/abc097_b

int main() {
    int X; cin >> X;
    vector<int> expo(X+1);
    expo[1] = 1;
    for (int i = 2; i <= X; i++) {
        int v = i*i;
        while(v <= X) {
            expo[v] = 1;
            v = v * i;
        }
    }

    for (int i = X; i > 0; i--) if(expo[i]){
            cout << i << "\n";
            return 0;
    }

    return 0;
}


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

using namespace std;

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define SORT(v) sort(v.begin(), v.end())
typedef long long ll;

int main()
{
    ll x, n = 0;
    ll a;
    string s;

    cin >> x;

    //vector<int> v(/*size*/);
    a = 100;
    while (a < x)
    {
        a *= 1.01;
        n++;
    }

    cout << n;
}


Measured memory_bytes: 3596
#include<iostream>
#include<locale>
#include<string>
#include<cctype>
using namespace std;
int main(void){
    int n,k = 0;
    string s;
    cin >> n >> k >> s;
    
    char hs = s[k-1];
    //cout << int(hs) << endl;
    hs += 32;
    //cout << hs << endl;
    s[k-1] = hs;
    

    cout << s;
}

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

using namespace std;


int main() {
    int a,b;
    string s;
    cin>>a>>b;
    cin>>s;
    if(s.length()==a+b+1){
        for (int i = 0; i <a+b+1; ++i) {
            if(i==a){
                if(s[i]!='-') {
                    cout << "No" << endl;
                    return 0;
                }
            }
            else if(s[i]<48 || s[i]>57){
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
        return 0;
    }
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll n;
  cin >> n;

  cout << (n * (n + 1)) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define eps 1e-9
int main()
{
	 long double N;
	 long long h,n;
	 long double w;
	 cin>>N;
 	   for(h=1;h<=3500;h++)
        {
            for(n=1;n<=3500;n++)
            {
                w = (N * h * n) / (4 * h * n - N * n - N * h);
                if(w>0&&w-int(w)<eps)
                {
                    cout<<h<<' '<<n<<' '<<int(w)<<endl;
                    return 0;
                }
                else
                    continue;
            }
        }

return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
    int k;
    char s[101];
    scanf("%d%s",&k,s);
    int l = strlen(s);
    if(l <= k){
        printf("%s",s);
    }
    else{
        int i = 0;
        for(; i < k; i++)
            printf("%c",s[i]);
        printf("...\n");
    }
    return 0;
}

Measured memory_bytes: 1712
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  int r, D, x;
  cin >> r >> D >> x;
  for (int i = 1; i <= 10; i++) {
    x = r * x - D;
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

int main(){
    int n;cin>>n;
    map<int,int>mp;
    while(n--){
        int a;cin>>a;
        mp[a]++;
    }
    ll res = 0;
    for(auto p : mp){
        res += p.second%2;
    }
    cout<<res<<endl;
}



Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int b;
    vector<int> c(n - 1);
    int sum = 0;
    for(int i = 0;i < n;i++) {
        cin >> a.at(i);
    }
    for(int i = 0;i < n;i++) {
        cin >> b;
        sum += b;
    }
    for(int i = 0;i < n - 1;i++) {
        cin >> c.at(i);
    }
    for(int i = 0;i < n - 1;i++) {
        if(a.at(i + 1) == a.at(i) + 1) {
            sum += c.at(a.at(i) - 1);
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

ans, tmp = 0, 0
for i in range(n - 1, 0, -1):
    if a[i] - a[i - 1] > 1:
        print(-1)
        break
    if tmp != a[i]:
        ans += a[i]
    tmp = max(a[i] - 1, 0)
else:
    print(-1 if a[0] > 0 else ans)


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

int main() {
  string s;
  cin >> s;
  string ans = "Yes";
  
  if (s.at(0) == s.at(1) && s.at(1) == s.at(2)){
    ans = "No";
  }
  
  cout << ans << endl;
}


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

using namespace std;
#define ll long long
#define ull unsigned ll
#define all(x) x.begin(), x.end()
const ll MOD = 1e9 + 7;
const int MAX = 5000010;
int lastInc[MAX] = {};

int main()
{
    int n, k;
    string s;
    cin >> n >> k >> s;
    if (s.find('0') == string::npos || s.find('1') == string::npos)
        return cout << n << endl, 0;

    s.insert(s.begin(), '*');

    vector<int> v;
    for (int i = 1; i <= n; i++)
    {
        if (s[i - 1] != '0' && s[i] == '0')
            v.push_back(i);
    }

    v.erase(v.begin());
    // for (auto x : v)
    //     cout << x << " ";
    int id = 0, ans = INT_MIN, cnt = 0, l = 1;
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == '0' && s[i - 1] != '0')
            cnt++;
        if (cnt > k)
        {
            l = v[id++] - 1;
            while (l > 0 && s[l] == '1')
                l--;
            l++;
            cnt--;
        }
        ans = max(ans, i - l + 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
import copy
S = list(map(int,input()))
cnt0 = 0
cnt1 = 0
for i in range(len(S)):
    if S[i] == 0:
        cnt0 += 1
    else:
        cnt1 += 1

ans = cnt0 + cnt1 - abs(cnt0-cnt1)
print(ans)

Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
int even (int x[],int n)
{
    int c=0,p=0;
    for(int i=0; i<n; i++)
    {
        if(x[i]%2==0)
        {
            x[i]=x[i]/2;
            c++;
        }


    }
    return c;

}
int main()
{
    int n,b,i,c=0,d,ans=0,p=0;
    cin>>n;
    int a[n+2];
    for(i=0; i<n; i++)
    {
        cin>>a[i];

    }
    while(1)
   {
    ans=even(a,n);
    if(n==ans)
    {
        p++;
    }
    else break;
   }

    cout<<p<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, K, A[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> A[i];

	rep(i, K, N) {
		if (A[i - K] < A[i]) printf("Yes\n");
		else printf("No\n");
	}
}







Measured memory_bytes: 4400
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb; 
typedef long long ll;  
typedef double db;                         
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 2e5 + 48, mod = 1e9 + 7;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, a, b, c, dp[N][3];

main () {
	cin >> n;
	forn (i, 1, n) {
		cin >> a >> b >> c;
		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b;
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c;
	}


	cout << max({dp[n][0], dp[n][1], dp[n][2]});	
} 

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
ll N;

ll get_num(ll n)
{
    ll ans = 0;
    ll div = 10;
    while (n / div) {
        ans += n / div;
        div *= 5;
    }
    return ans;
}

signed main()
{
    cin >> N;
    if (N % 2) {
        cout << 0 << endl;
        return 0;
    } else {
        cout << get_num(N) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M) = Slice2<long>();
            graph = Enumerable.Repeat(0, (int)N).Select(_ => new List<(long to, long dst)>()).ToArray();
            for (var i = 0; i < M; ++i)
            {
                var (l, r, d) = Slice3<long>();
                --l; --r;
                graph[l].Add((r, d));
                graph[r].Add((l, -d));
            }
            used = new bool[N];
            dsts = Enumerable.Repeat(MIN, (int)N).ToArray();
            for (var i = 0; i < N; ++i)
            {
                if (used[i]) continue;
                dsts[i] = 0;
                if (dfs(i)) continue;

                WriteLine("No");
                return;
            }
            WriteLine("Yes");
        }
        static long MIN = long.MinValue / 2;
        static List<(long to, long dst)>[] graph;
        static bool[] used;
        static long[] dsts;
        static bool dfs(long root)
        {
            used[root] = true;
            foreach (var g in graph[root])
            {
                var nv = g.to;
                var nd = dsts[root] + g.dst;
                if (MIN == dsts[nv]) dsts[nv] = nd;
                if (dsts[nv] != nd) return false;
                if (used[nv]) continue;
                if (dfs(nv)) continue;
                return false;
            }
            return true;
        }
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 70296
N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = {}
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    if total in info:
        info[total] += 1
    else:
        info[total] = 1

#print(info)

ans = 0

for j in info:
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)


Measured memory_bytes: 14368
char s[1001],*S="JOI";
int N,M[1000][8];
int dfs(int d,int prev){
	if(d==N)return 1;
	if(M[d][prev])return M[d][prev];
	int i=1,r=0;
	for(;i<8;i++)if((s[d]&i) && (prev&i))r=(r+dfs(d+1,i))%10007;
	return M[d][prev]=r;
}
main(){
	int i=0;
	scanf("%d%s",&N,s);
	for(;i<N;i++)s[i]=1<<(strchr(S,s[i])-S);
	printf("%d\n",dfs(0,1));
exit(0);}

Measured memory_bytes: 692
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int INF=1e9+7;
ll find(ll aa[],ll nn)
{
    vector<ll> dp(nn,INF);
    dp[0]=0;
    for(ll i=0;i<nn;i++)
    {
        for(ll j=i+1;j<=(i+2);j++)
        {
           if(j<nn) dp[j]=min(dp[j],dp[i]+abs(aa[i]-aa[j]));
           else break;
        }
    }
    return dp[nn-1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll nn; cin>>nn;
    ll aa[nn];
    for(ll i=0;i<nn;i++) cin>>aa[i];
    cout<<find(aa,nn);
}

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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
// end of Template

int n,k,a[200010],type,ans;
priority_queue <int> q;
int main(){

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

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=1; i<=n; i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n);

    int f = 1;
    for(int i=2; i<=n; i++){
        if(a[i]==a[i-1]){
            f++;
        }
        else{
            q.push (-1*f);
            f = 1;
        }
    }
    q.push(-1*f);

    while(q.size()>k){
        int temp = q.top()*-1;
        ans += temp;
        q.pop();
    }
    cout<<ans<<newl;

}


Measured memory_bytes: 2168
#include <stdio.h>
#include <string.h>
 
int main(void) 
{
  int i;
  char s[1000000];
  scanf("%s", s);
  for (i = 0; i < strlen(s); i++) 
    if (i % 2 == 0)
       printf("%c", s[i]);
  return 0;
}

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

int main(){
    int n;
    double vol_1 = 0.0, vol_2 = 0.0, vol_3 =0.0, vol_m=0.0, x[1000], y[1000], avg = 0.0;

    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> x[i];
    }
    for (int i = 0; i < n; i++){
        cin >> y[i];
    }
    for (int i = 0; i < n; i++){
        vol_1 += abs(x[i]-y[i]);
    }
    for (int i = 0; i < n; i++){
        vol_2 += pow(abs(x[i]-y[i]), 2.0);
    }
    vol_2 = sqrt(vol_2);
    for (int i = 0; i < n; i++){
        vol_3 += pow(abs(x[i]-y[i]), 3.0);
    }
    vol_3 = pow(vol_3, 1.0/3.0);
    for(int i = 0; i < n; i++){
        vol_m = max(abs(x[i]-y[i]),vol_m);
    }  
    printf("%lf\n%lf\n%lf\n%lf\n", vol_1, vol_2, vol_3, vol_m);

    return 0;
}


Measured memory_bytes: 3400
N,M,Q=map(int,input().strip().split())

l=[]
for n in range(Q):
    l.append(list(map(int,input().strip().split())))

def score(A):
    SUM=0
    for i in range(Q):
        if A[l[i][1]]-A[l[i][0]]==l[i][2]:
            SUM+=l[i][3]
    return SUM    

ans=0
def dfs(A,N,M):
    if len(A)==N+1:
        global ans
        ans=max(ans,score(A))
        return
    else:
        last=A[-1]
        for n in range(last,M+1):
            A.append(n)
            dfs(A,N,M)
            A.pop()

dfs([1],N,M)
print(ans)

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/b.in", "r", stdin);
//  freopen("../IO/b.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  int64_t a[4];
  for (int i = 0; i < 4; ++i) in >> a[i];
  int64_t mx = numeric_limits<int64_t>::min();
  for (int i = 0; i < 2; ++i) {
    for (int j = 2; j < 4; ++j) {
      mx = max(mx, a[i] * a[j]);
    }
  }
  if (a[0] <= 0 && 0 <= a[1] || a[2] <= 0 && 0 <= a[3]) {
    mx = max(mx, (int64_t)0);
  }
  out << mx << '\n';
}

Measured memory_bytes: 3648
#include <stdio.h>

int a[100];
int main(){
	int N;
	scanf("%d",&N);
	int i;
	for(i = 0;i<N;i++){scanf("%d",&a[i]);}
	int min = 1000000;
	int j;
	for(i = -100;i<=100;i++){
		int t = 0;
		for(j = 0;j<N;j++){
			t += (a[j] - i)*(a[j] - i);
		}
		if(t<min)min = t;
	}
	printf("%d\n",min);
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int N, K; cin >> N >> K;
    string S; cin >> S;

    int cnt = 0, diff = 0;
    char prev = S[0];
    for (int i = 1; i < N; i++) {
        if (prev == S[i]) {
            cnt++;
        } else {
            diff++;
        }
        prev = S[i];
    }

    for (int i = 0; i < K; i++) {
        if (diff > 1) {
            cnt += 2;
            diff -= 2;
        } else if (diff == 1) {
            cnt++;
            diff--;
            break;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int N;
int C[600];
int S[600];
int F[600];
int sol(int s) {
  int now = 0;
  for (int i = s; i < N - 1; ++i) {
    now = max(now, S[i]);
    if (now == S[i] || (now % F[i]) == 0) {
      // some
    } else {
      now = (1 + now / F[i]) * F[i];
    }
    now += C[i];
  }

  return now;
}
int main() {
  cin >> N;
  for (int i = 0; i < N - 1; ++i) {
    cin >> C[i] >> S[i] >> F[i];
  }

  for (int i = 0; i < N; ++i) {
    cout << sol(i) << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    SP = []
    for i in range(N):
        line = input().split()
        SP.append([i + 1, line[0], int(line[1])])
    SP = sorted(SP, key=lambda x: (x[1], -x[2]))
    for i in SP:
        print(i[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 38512
# A_i + A_j = j - i
# A_i + i = j - A_j
# 必ず i != j となる(A_x + x = x - A_xが成り立つとA_x = 0となり制約と反するため)

N = int(input())
A = list(map(int,input().split()))

iList = [0] * N
jList = [0] * N
for i in range(N):
  iList[i] = A[i] + i
  jList[i] = i - A[i]
  
from collections import defaultdict
iDic = defaultdict(int)
jDic = defaultdict(int)

for i in range(N):
  iDic[iList[i]] += 1
  jDic[jList[i]] += 1
  
ans = 0
for item in iDic.items():
  ans += jDic[item[0]] * item[1]

print(ans)

Measured memory_bytes: 73764
N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))

A = []
for _ in range(N):
    A.append(list(map(int,input().split())))

res = 0
for i in range(N):
    val = 0
    for j in range(M):
        val += A[i][j] * B[j]
    val += C
    if val > 0: res += 1
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int a[1401][1401];
int cur_row[1401];
long long find_max_area_histogram(int m) {
    stack<int>s;
    long long max_area = 0;
    long long area = 0;
    int i = 0;
    int top_value = 0;
    while (i < m)
    {
        if (s.empty() || cur_row[i] >= cur_row[s.top()]) {
            s.push(i++);
        }
        else {
             top_value = cur_row[s.top()];
            s.pop();
            area = top_value*i;//incase stack is empty

            //if not empty then
            if (!s.empty()) {
                area = top_value*(i - 1 - s.top());
            }
            max_area = max(area, max_area);
        }
    }

    while (!s.empty())
    {
        int top_value = cur_row[s.top()];
        s.pop();
        area = top_value*i;//in case stack is empty

                           //if not empty then
        if (!s.empty()) {
            area = top_value*(i - 1 - s.top());
        }        
       max_area = max(area, max_area);
    }
    return max_area;
}
long long find_max_rectangle(int n, int m) {
    long long max_area = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++)
        {
            if (a[i][j]) {
                cur_row[j] += a[i][j];
            }
            else {
                cur_row[j] = 0;
            }
        }

        max_area = max(max_area, find_max_area_histogram(m));

    }
    return max_area;
}
int main() {

    long long n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            a[i][j] = !a[i][j];
        }
    }
    

    long long answer = find_max_rectangle(n, m);
    cout << answer << endl;
    return 0;

}



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

typedef long long ll;

const int MAX_K = 100000;
ll K, A[MAX_K];

int main() {
  cin >> K;
  for (int i=0; i<K; i++) {
    cin >> A[K-i-1];
  }
  if (A[0] != 2) {
    cout << "-1" << endl;
    return 0;
  }
  ll min = 2, max = 3;
  for (int i=1; i<K; i++) {
    if (max < A[i]) {
      cout << "-1" << endl;
      return 0;
    }
    max = A[i]*(max/A[i])+A[i]-1;
    min = A[i]*((min-1)/A[i])+A[i];
    // cout << min << " " << max << endl;
    if (max < min) {
      cout << "-1" << endl;
      return 0;
    }
  }

  cout << min << " " << max << endl;
  return 0;
}


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

int main(){
    long long x;
    cin >> x;
    for(long long i=-1000; i<1000; i++){
        for(long long j=-1000; j<1000; j++){
            if(pow(i,5)-pow(j,5) == x){
                cout << i << ' ' << j << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4012
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll k,x;
  cin >> k >> x;
  k *= 500;
  if(k>=x){
    cout <<"Yes\n";
  }
  else cout <<"No\n";
}


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

if n != 0:
  p = list(map(int, input().split()))
  lists = []
  for i in range(0, 102):
    if i in p:
      continue
    lists.append(i)

  ans = lists[0]
  mins = abs(lists[0] - x)
  for i in range(1, len(lists)):
    dist = abs(lists[i]-x)
    if mins > dist:
      ans = lists[i]
      mins = dist
      
  print(ans)
else:
  print(x)

Measured memory_bytes: 9208
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
p=0
q=0

s=list(map(int,input().split()))

for i in a:
  if s[0]==i:
    p=0
  elif s[0]==2:
    p=2
  else:
    p=1

for i in a:
  if s[1]==i:
    q=0
  elif s[1]==2:
    q=2
  else:
    q=1

if p==q:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 9200
#include <stdio.h>

#define debug
#define NMAX 2000000
#define VMAX 10000

int main() {
    int n, C[VMAX + 10];
    int *A = new int[NMAX+10];
    int *B = new int[NMAX+10];
    debug("=== LINE %d ===\n", __LINE__);
    scanf("%d", &n);
    // x in [0,VMAX]
    for (int i = 0; i <= VMAX; i++) {
        C[i] = 0;
    }
    // A doesn't need to be 1-origin
    // here use 1-origin to match B
    for (int i = 1; i <= n; i++) {
        scanf("%d", &A[i]);
        C[A[i]]++;
    }
    debug("=== LINE %d ===\n", __LINE__);
#if 0
    //{x<=k}={x=k}+{x<=k-1}
    //{x<=0}={x=0}
    for (int i = 1; i <= VMAX; i++) {
        C[i] += C[i - 1];
    }
    // B has to be 1-origin
    for (int i = n; i >= 1; i--) {
        B[C[A[i]]--] = A[i];
    }
    for (int i = 1; i <= n; i++) {
        printf("%d", B[i]);
        if (i == n) {
            printf("\n");
        } else {
            printf(" ");
        }
    }
#else
    bool first = true;
    for (int i = 0; i <= VMAX; i++) {
        while (C[i] > 0) {
            if (first) {
                first = false;
                printf("%d", i);
            } else {
                printf(" %d", i);
            }

            C[i]--;
        }
    }
    printf("\n");
#endif

    return 0;
}



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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(24);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;

ll n, m, x, k, a , b;
string s, t;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	vll a(n);
	ll flag = 0;
	for(ll i=0;i<n;i++) {
		cin>>a[i];
		if(a[i] == 0) flag = 1;
	}
	if(flag) { cout<<0; return; }

	ld prod = 1;
	for(ll i=0;i<n;i++) {
		prod*=a[i];
		if(prod > 1e+18) {
			cout<<-1;
			return;
		}		
	}
	cout<<(ll)prod;
}

int main() {
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 4048
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N = INT()
H = INT()
W = INT()

print((N-H+1)*(N-W+1))

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

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

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

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

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

const string YES = "Yes";
const string NO = "No";

int main(){
    int n;
    cin >> n;
    vi v(3);
    rep(i, 3) cin >> v[i];
    vpii q(n);
    rep(i, n) {
        string s;
        cin >> s;
        q[i].first = (int)(s[0] - 'A');
        q[i].second = (int)(s[1] - 'A');
    }
    q.emplace_back(0, 1);
    string ans;
    auto move = [&] (int to, int from) {
        v[to]++;
        v[from]--;
        ans += to + 'A';
    };
    bool ok = true;
    rep(i, n) {
        int v1 = q[i].first, v2 = q[i].second;
        if (v[v1]==0&&v[v2]==0) {
            ok = false;
            break;
        }
        if (v[v1]==0) {
            move(v1, v2);
        }
        else if (v[v2]==0) {
            move(v2, v1);
        }
        else {
            int nv1 = q[i+1].first, nv2 = q[i+1].second;
            if (nv1==v1||nv2==v1) {
                move(v1, v2);
            }
            else {
                move(v2, v1);
            }
        }
    }
    if (ok) {
        cout << YES << endl;
        rep(i, n) cout << ans[i] << endl;
    }
    else {
        cout << NO << endl;
    }
    return 0;
}


Measured memory_bytes: 4824
N = int(input())
X = [int(i) for i in input().split()]
L, R = min(X), max(X)

ans = 10**1000
for i in range(L, R+1):
    box = 0
    for j in range(N):
        box += (X[j] - i)**2
    if ans > box:
        ans = box

print(ans)


Measured memory_bytes: 3060
N = int(input())
'''
SP = [list(input().split()) for _ in range(N)]

tmp = sorted(SP)

print(tmp)
'''

d = []
for i in range(N):
    S,P = input().split()
    d.append([S,int(P),i])

d.sort(key=lambda x:(x[0],-x[1]))

for i in d:
    print(i[2]+1)

Measured memory_bytes: 3060
#include <stdio.h>
int main()
{
	int a[10000],i;
	for(i=0; i<10000; i++)
		{
			scanf("%d",&a[i]);
			if(a[i]==0)
			{
				break;
			}
				printf("Case %d: %d\n",i+1,a[i]);
		}
return 0;}

Measured memory_bytes: 2692
/*
    Author : Wasi Ur Rahman
*/
#include <bits/stdc++.h>
using namespace std;
// defines
#define ll long long int
#define ull unsigned long long int
#define MOD 100000
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sc scanf
#define pf printf
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(d, min(a, min(b, c)))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(d, max(a, max(b, c)))
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 3.141592653589793238462643
#define no cout << "No" << endl;
#define yes cout << "Yes" << endl;
#define elif else if
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
/* important funct */
int Int()
{
    int c;
    cin >> c;
    return c;
}
ll Long()
{
    ll c;
    cin >> c;
    return c;
}
double Double()
{
    double c;
    cin >> c;
    return c;
}

#define Int Int()
#define Long Long()
#define Double Double()
void sortString(string &str)
{
    sort(str.begin(), str.end());
}
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i < n; i++)
        if (n % i == 0)
            return false;
    return true;
}
ll ManualGcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll ManualLcm(ll a,ll b)
{
    return((a)*(b)/gcd(a,b));
}
ll fact(ll n)
{
    ll res = 1;
    for(ll i = n; i>=1; i--)
        res *= i;
    return res;
}
ll nCr(ll n,ll r)
{
    return (fact(n)/(fact(r)*fact(n-r)));
}
ll nPr(ll n,ll r)
{
    return fact(n)/fact(n-r);
}
const string s = "hello";
// Main
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    IOS
    ll h=Long;
    ll n=Long;
    ll arr[n];
    ll i,j;
    ll cnt = 0;
    for(i = 0;i<n;i++)
        {
            cin >> arr[i];
            cnt += arr[i];
        }
        if(cnt >= h)
            yes
        else no
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n;
		int a[];
		int count;

		while (true) {
			n = sc.nextInt();
			if (n == 0) {
				break;
			}

			a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			count = 0;
			for (int i = 0; i < n - 1; i++) {
				for (int j = 0; j < n - i - 1; j++) {
					if (a[j + 1] < a[j]) {
						int swap = a[j];
						a[j] = a[j + 1];
						a[j + 1] = swap;
						count++;
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 12000
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		int N = int.Parse(str);
		string ans = "ABC";
		if(N >= 1000){
			ans = "ABD";
		}
		Console.WriteLine(ans);
	}
}

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

int top;
int S[1000];

void push(int x) {
	S[++top] = x;
}

int pop() {
	top--;
	return S[top+1];
}

int main(void) {
	int a, b;
	top = 0;
	char s[100];
	int count = 0;
	
	while ( scanf("%s", s) != EOF ) {
		if (s[0] == '+') {
			a = pop();
			b = pop();
			push(a + b);
		} else if (s[0] == '-') {
			b = pop();
			a = pop();
			push(a - b);
		} else if (s[0] == '*') {
			a = pop();
			b = pop();
			push(a * b);
		}else {
			push(atoi(s));
		}
		if (getchar() == '\n') break;
	}
	printf("%d\n", pop());

	return 0;
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> digits;
    while (n!=0){
		digits.push_back(n%10);
		n/=10;
    }
    int ans = 0;
    for (int i=0; i < digits.size(); i++) ans += digits[i];
    int D = digits.back();
    if (D==1){
		cout << max((int) ans, (int) (9*(digits.size()-1)));
	}
	else{
		cout << max((int) ans, (int) (D-1 + 9*(digits.size()-1)));
	}


}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
  
  int i,a[3];
  int flag5=0,flag7=0;
  
  for(i=0; i < 3; i++){
  scanf("%d", &a[i]);
    if(a[i] == 5){
      flag5++;
    }else if(a[i] == 7){
      flag7++; 
    }
  }
  
  if(flag5==2 && flag7 == 1){
    printf("YES");
  }else{
    printf("NO");
  }
  
  return 0;
}

Measured memory_bytes: 1704
import java.util.Scanner;
public class Main
{
  public static void main(String[]args)
  {
    Scanner input=new Scanner(System.in);
    while(true)
    { int a=input.nextInt();
    String op=input.next();
    int b=input.nextInt();
    if(op.equals("?"))
      break;
    else if(op.equals("+"))
      System.out.println(a+b);
    else if(op.equals("-"))
      System.out.println(a-b);
    else if(op.equals("*"))
      System.out.println(a*b);
    else if(op.equals("/"))
      System.out.println(a/b);
    }
}
}


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

using namespace std;

int main() {
  int N, L;

  cin>>N>>L;

  int total = N * (L - 1); 
  for(int i=1; i<N+1; i++) {
    total = total + i;
  }

  if(L<=0 && L+N-1>=0) {
    cout<<total<<endl;
  } else if(L>0 && L+N-1>0) {
    cout<<total-L<<endl;
  } else if(L<0 && L+N-1<0) {
    cout<<total-(L+N-1)<<endl;
  }

  return 0;
}

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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back
#define DEBUG(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

inline void proc_status ()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) << endl;
}

const int Maxn = 5e5 + 100;
const int Mod = 998244353;

namespace MATH
{
	int fac[Maxn], ifac[Maxn];

	inline void Add (int &a, int b) { if ((a += b) >= Mod) a -= Mod; }

	inline int Pow (int a, int b)
	{
		int ans = 1;
		for (int i = b; i; i >>= 1, a = (LL) a * a % Mod) if (i & 1) ans = (LL) ans * a % Mod;
		return ans;
	}

	inline void init (int n = 5e5)
	{
		fac[0] = 1;
		for (int i = 1; i <= n; ++i) fac[i] = (LL) fac[i - 1] * i % Mod;
		ifac[n] = Pow (fac[n], Mod - 2);
		for (int i = n - 1; i >= 0; --i) ifac[i] = (LL) ifac[i + 1] * (i + 1) % Mod;
	}

	inline int C (int n, int m) { if (n < m) return 0; return (LL) fac[n] * ifac[m] % Mod * ifac[n - m] % Mod; }
}

using namespace MATH;

int N, M;

inline void Solve ()
{
	int ans = 0;
	for (int k = 0; k <= min (N, M); ++k)
	{
		int sum = (LL) C (N, k) * C (M, k) % Mod * fac[k] % Mod * Pow (M + 1, N - k) % Mod * Pow (N + 1, M - k) % Mod;
		if (k & 1) Add (ans, Mod - sum);
		else Add (ans, sum);
	}
	cout << ans << endl;
}

inline void Input ()
{
	N = read<int>(), M = read<int>();
}

int main()
{

#ifdef hk_cnyali
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	MATH :: init ();
	Input ();
	Solve ();

	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

/* 基本要素 */
typedef complex<double> Point;
typedef pair<Point, Point> Line;
typedef vector<Point> VP;
const double PI = acos(-1);
const double EPS = 1e-9; // 許容誤差^2
const double INF = 1e9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) - (m) < EPS)
#define GE(n,m) (EPS > (m) - (n))
#define EQ(n,m) (abs((n)-(m)) < EPS)

const int L = 100;

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

    VP p(n);
    rep(i,n){
        int x,y;
        cin >>x >>y;
        p[i] = {x,y};
    }

    auto R = [&](Point c){
        double ret = 0;
        rep(i,n) ret = max(ret, abs(c-p[i]));
        return ret;
    };

    auto calc_y = [&](double x){
        double ly=0, ry=1000;
        rep(loop,L){
            double y1 = (2*ly+ry)/3, y2 = (ly+2*ry)/3;
            if(R({x,y1}) > R({x,y2})) ly = y1;
            else ry = y2;
        }
        return ly;
    };

    double lx=0, rx=1000;
    rep(loop,L){
        double x1 = (2*lx+rx)/3, x2 = (lx+2*rx)/3;
        double y1 = calc_y(x1), y2 = calc_y(x2);

        if(R({x1,y1}) > R({x2,y2})) lx = x1;
        else rx = x2;
    }

    printf("%.15f\n", R({lx, calc_y(lx)}));
    return 0;
}


Measured memory_bytes: 256
N = int(input().split()[0])

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

Nod = make_divisors(N-1)
divs = make_divisors(N)

for d in divs:
    c = N
    while True:
        if d == 1:
            break
        if c%d == 1:
            Nod.append(d)
            break
        elif c%d == 0:
            c = c//d;
            continue
        else:
            break

print(len(Nod)-1)

Measured memory_bytes: 10164
using namespace std;

#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>

#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;

string s, t;
int n, m;

bool check(int index) {
    for (int j = 0; j < (int)t.size(); j++) {
        if (index + j >= n) return false;
        if (s[index + j] != '?' && t[j] != s[index + j]) {
            return false;
        }
        //printf("%lld\n", j);
    }
    return true;
}

signed main() {
    //freopen("out.txt", "w", stdout);
    cin >> s >> t;
    n = (int)s.size();
    m = (int)t.size();
    int pos;
    for (pos = n - m; pos >= 0; pos--) {
        if (check(pos)) break;
    }
    if (pos == -1) {
        printf("UNRESTORABLE\n");
        return 0;
    }
    
    for (int i = 0; i < m; i++) {
        s[pos + i] = t[i];
    }
    //cout << s;
    
    for (int i = 0; i < n; i++) {
        if (s[i] == '?') printf("%c", 'a');
        else printf("%c", s[i]);
    }
    printf("\n");
    return 0;
}


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

int main(){
    int N, M, tmp, ans=0;
    string S;
    cin >> N ;
    for(int i=1; i<=N; i++){
	S = to_string(i);
	if(S.size()%2==1){
	    ans++;
	}
    }

    cout << ans << endl;


}


Measured memory_bytes: 256