akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
//#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010
#define md 1000000007//998244353

#define pb push_back
#define _vcppunko4(tuple) _getname4 tuple
#define _getname4(_1,_2,_3,_4,name,...) name
#define _getname3(_1,_2,_3,name,...) name
#define _trep2(tuple) _rep2 tuple
#define _trep3(tuple) _rep3 tuple
#define _trep4(tuple) _rep4 tuple
#define _rep1(n) for(lint i=0;i<n;++i)
#define _rep2(i,n) for(lint i=0;i<n;++i)
#define _rep3(i,a,b) for(lint i=a;i<b;++i)
#define _rep4(i,a,b,c) for(lint i=a;i<b;i+=c)
#define _trrep2(tuple) _rrep2 tuple
#define _trrep3(tuple) _rrep3 tuple
#define _trrep4(tuple) _rrep4 tuple
#define _rrep1(n) for(lint i=n-1;i>=0;--i)
#define _rrep2(i,n) for(lint i=n-1;i>=0;--i)
#define _rrep3(i,a,b) for(lint i=b-1;i>=a;--i)
#define _rrep4(i,a,b,c) for(lint i=a+(b-a-1)/c*c;i>=a;i-=c)
template<class T>
istream& operator>>(istream& is,vector<T>& vec);
template<class T,size_t size>
istream& operator>>(istream& is,array<T,size>& vec);
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p);
template<class T>
ostream& operator<<(ostream& os,vector<T>& vec);
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p);
template<class T>
istream& operator>>(istream& is,vector<T>& vec){ for(T& x: vec) is>>x;return is; }
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p){ is>>p.first;is>>p.second;return is; }
//template<class T>
//ostream& operator<<(ostream& os,vector<T>& vec){ os<<vec[0];rep(i,1,vec.size())os<<' '<<vec[i];return os; }
//template<class T>
//ostream& operator<<(ostream& os,deque<T>& deq){ os<<deq[0];rep(i,1,deq.size())os<<' '<<deq[i];return os; }
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p){ os<<p.first<<" "<<p.second;return os; }

inline void in(){}
template <class Head,class... Tail>
inline void in(Head&& head,Tail&&... tail){ cin>>head;in(move(tail)...); }
template <class T>
inline bool out(T t){ cout<<t<<'\n';return 0; }
inline bool out(){ cout<<'\n';return 0; }
template <class Head,class... Tail>
inline bool out(Head head,Tail... tail){ cout<<head<<' ';out(move(tail)...);return 0; }

#define rep(...) _vcppunko4((__VA_ARGS__,_trep4,_trep3,_trep2,_rep1))((__VA_ARGS__))
#define rrep(...) _vcppunko4((__VA_ARGS__,_trrep4,_trrep3,_trrep2,_trrep1))((__VA_ARGS__))
#define lin(...) lint __VA_ARGS__;in(__VA_ARGS__)
#define stin(...) string __VA_ARGS__;in(__VA_ARGS__)
#define vin(type,name,size) vector<type> name(size);in(name)
#define fi i.first
#define se i.second

int main(){
	lin(n);
	vin(lint,a,n);
	lint l=0,r=0;
	lint c=0;
	lint ans=0;
	while(r<n){
		rep(bit,20)if((a[r]>>bit)&1){
			while((c>>bit)&1)c^=a[l],++l;
		}
		c^=a[r];++r;
		ans+=r-l;
	}cout<<ans<<endl;
}

//sub-EOF


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

typedef long long ll;
typedef long double ld;

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

    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if(s < t) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


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


    ll N ;
    cin >> N;

    ld k = (-1.0 + sqrt(1.0 + 8.0*N))/2.0;
    ll siz = k;
    if((siz * (siz+1)) != (2*N)){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    cout << siz+1<< endl;

    vector< vector<ll> > ans;

    ll till = 0;
    rep(i, siz+1){
        vector<ll> ret;
        ll now = ans.size();
        if(now >0){
            rep(i, now){
                ret.pb(ans[i][now-1]);
            }
        }

        now = siz - ret.size();
        rep(i, now){
            till++;
            ret.pb(till);
        }
        ans.pb(ret);
    }

    rep(i,ans.size()){
        cout << siz <<  " ";
        rep(j, ans[i].size()){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 2944
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        int[] q = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            q[i] = sc.nextInt();
        }
        System.out.println(Math.abs(dictLen(p) - dictLen(q)));
    }

    private static int dictLen(final int[] a) {
        final List<Integer> integers = new ArrayList<>();
        for (int i = 0; i < a.length; i++) {
            integers.add(i + 1);
        }
        int ret = 0;
        for (int i = 0; i < a.length; i++) {
            final int idx = integers.indexOf(a[i]);
            final int fact = fact(integers.size());
            ret += fact / integers.size() * idx;
            integers.remove(idx);
        }
        return ret;
    }
    private static int fact(int n) {
        int ret = 1;
        for (int i = 2; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }
}


Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>
#include<experimental/any>
#include<cstring>
#include<cctype>
#include<ctime>
#include<cstdbool>
#include<cstdint>
#include<cstddef>
#include<set>
#include<unordered_set>
#include<bitset>
 
using namespace std;
using experimental::any;
 
#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);
 
#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)
#define BitFOR(N) REP(Bit,1<<(N))
 
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) (f)? cout<<"true ":cout<<"false ";
#define FORDEB(n,X) for(int i=0;i<(n);i++)ARDEB(i,X)
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define ARDEB(i,X) {}
#define TFDEB(f) {}
#define FORDEB(n,X) {}
#define END {}
#endif
 
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
//struct edge{int from,cost,to;};
struct P2{int x,y;};
#define BIT(Bit,n) bitset<n>(Bit)
#define Endl endl
 
const int MOD7=1000000007;
const int INF=100000000;
const int SET=1000; 

int main(){
	int a,b,count=0,count2=0;
	string s;
	bool f=false;
	cin>>a>>b>>s;
	for(int i=0;i<s.size();i++){
		if(i<a && '0'<=s[i] && s[i]<='9'){
			count++;
		}
		if(s[a]=='-'){
			f=true;
		}
		if(a<i && '0'<=s[i] && s[i]<='9'){
			count2++;
		}
	}
	DEB(count)DEB(count2)
	cout<<((count==a && count2==b && f)?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;





signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int ans = n;
	rep(i, n + 1) {
		int cnt = 0;
		int tmp = i;
		while (tmp > 0) {
			cnt += tmp % 6; tmp /= 6;
		}
		tmp = n - i;
		while (tmp > 0) {
			cnt += tmp % 9; tmp /= 9;
		}
		chmin(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

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     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



int N, M, X, Y, x[101], y[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M >> X >> Y;
    rep(i, 0, N) cin >> x[i];
    rep(i, 0, M) cin >> y[i];

    rep(Z, X + 1, Y + 1) {
        int ok = 1;
        rep(i, 0, N) if (x[i] >= Z) ok = 0;
        rep(i, 0, M) if (y[i] < Z) ok = 0;
        if (ok) {
            printf("No War\n");
            return;
        }
    }

    printf("War\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll n;
    cin >> n;
    ll a[2][n], dp[2][n+1], s=  0;
    rep(i, 2)
    {
        rep(j, n)
        {
            cin >> a[i][j]; //s += a[i][j];
        }
    }
    mem(dp, 0);
    rep(i, n) dp[0][i+1] = dp[0][i] + a[0][i];
    rep(i, n) dp[1][i+1] = max(dp[0][i+1], dp[1][i]) + a[1][i];
    cout << dp[1][n];
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
n=int(input())
xy=[list(map(int,input().split())) for i in range(n)]

def dis(a,b):
    d=(a[0]-b[0])**2+(a[1]-b[1])**2
    return d**0.5

ans=0
from itertools import combinations
# listから２つ選ぶ組み合わせ
for a,b in combinations(xy, 2):
    ans+=dis(a,b)
print(2*ans/n)

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

int main() {
	int N;
	cin >> N;
	int digit = log10(N) + 1;
	int sum = 0;
	for (int i = 0; i < digit; i++) {
		sum += int(N / pow(10, i)) % 10;
		//cout << sum << ":" << int(N / pow(10, i)) % 10 << " " << pow(10, i) << endl;
	}
	if (N % sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	char str[55] = "\0";
	int j = 0, k = 0;
	scanf("%s", str);
	for (int i = 0; i < 54; i++){
		j = i;
		if (str[i] == '\0')
			break;
	}
	for (int i = 0; i < j - 8; i++)
		printf("%c", str[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
using llint = long long int;
using namespace std;

int main() {
    fastIO;
    string s;
    cin >> s;
    string left = s.substr(0, s.size() / 2);
    string right = s.substr(s.size() / 2);
    reverse(right.begin(), right.end());

    int hug = 0;
    for (size_t i = 0; i < s.size() / 2; i++) {
        if (left.at(i) != right.at(i))
            hug++;
    }
    cout << hug << endl;
}


Measured memory_bytes: 3620
//AtCoder Beginner Contest 134 - E
#include<bits/stdc++.h>
#define ll long long
using namespace std;

 
int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	vector<int> m;
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	m.push_back(a[0]);
	for (int i=1;i<n;i++){
		int yes=0;
		int ye=0;
		int l=0;
		int r=m.size()-1;
		
		while(r-l>=0){
			int mid=(l+r)/2;
			if (a[i]>m[mid]){
				yes=mid;
				ye=1;
				r=mid-1;
			}else if (a[i]<=m[mid]){
				l=mid+1;
			}
		}
		
		if (!ye){
			m.push_back(a[i]);
		}else{
			m[yes]=a[i];
		}
	}	
		
 
	printf("%d\n",m.size());
} 

Measured memory_bytes: 1276
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Globalization;

namespace Csharponly
{
    class Program
    {
        static public void Main()
        {

            int N = oneint();
            int sum = 0;
            for(int i = 0; i < N; i++)
            {
                for(int j = i; j < N; j++)
                {
                    for(int k = j; k < N; k++)
                    {
                        int d = Gcd(i + 1, j + 1);
                        int e = Gcd(k + 1, d);
                        int judge = 0;
                        if(i == j)
                        {
                            judge++;
                        }
                        if(j == k)
                        {
                            judge++;
                        }
                        if(k == i)
                        {
                            judge++;
                        }
                        switch (judge)
                        {
                            case 0:
                                sum += e * 6;
                                break;

                            case 1:
                                sum += e * 3;
                                break;
                            case 3:
                                sum += e;
                                break;

                        }

                    }
                }
            }

            Console.WriteLine(sum);

        }


        public static int Gcd(int a, int b)
        {
            if (a < b)
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }

        //一つの文字列を受け渡す
        static string onestring()
        {
            return Console.ReadLine();
        }

        //複数の文字列を配列で受け渡す
        //文字列と文字列の間は" "で区切る
        static string[] arraystring()
        {
            return Console.ReadLine().Split(' ');
        }

        //一つの数字を受け渡す
        static int oneint()
        {
            return int.Parse(Console.ReadLine());
        }

        //複数の数字を配列で受け渡す
        //数字と数字の間は" "で区切る
        static int[] arrayint()
        {
            String[] input_line = Console.ReadLine().Split(' ');
            int[] input_num = new int[input_line.Length];
            for (int i = 0; i < input_line.Length; i++)
            {
                input_num[i] = int.Parse(input_line[i]);
            }
            return input_num;
        }
    }
}


Measured memory_bytes: 27544
S=list(input())
min_range=999
for i in range(len(S)-2):
    S[i],S[i+1],S[i+2]=int(S[i]),int(S[i+1]),int(S[i+2])
    A=S[i]*100+S[i+1]*10+S[i+2]
    if abs(753-A)<min_range:
        min_range=abs(753-A)
print(min_range)

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

int main() {
    int day,hw;
    cin >> day >> hw;
    vector<int> hwd(hw);
    for (int i = 0; i<hw; ++i)
        cin >> hwd.at(i);

    int sum = accumulate(hwd.begin(), hwd.end(), 0);
    if ((day-sum) < 0)
        cout << -1;
    else
        cout << day-sum;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int happy[100005][3],dp[100005][3];
int main(){
	int n;
	while(~getI(n)){
		F(i,0,n) getIII(happy[i][0],happy[i][1],happy[i][2]);
		F(i,0,3) dp[0][i]=happy[0][i];
		F(i,1,n){
			dp[i][0]=max(dp[i-1][1],dp[i-1][2])+happy[i][0];
			dp[i][1]=max(dp[i-1][0],dp[i-1][2])+happy[i][1];
			dp[i][2]=max(dp[i-1][1],dp[i-1][0])+happy[i][2];
		}
		printf("%d\n",max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]));
	}
}


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

int N;
bool ada = false;

int main() {
    cin>>N;
    for (int i=1; i<=9; i++){
        for (int j=1; j<=9; j++){
            if (i*j==N){
                ada = true;
            }
        }
    }
    if (ada){
        cout<<"Yes"<<endl;
        }else{
        cout<<"No"<<endl;
        }
    }

Measured memory_bytes: 3580
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

#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(x) x.begin(),x.end()

using namespace std;

using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

template<typename T>
void chmax(T &a, T &b){
	a = max(a, b);
}

template<typename T>
void chmin(T &a, T &b){
	a = min(a, b);
}

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};
PLL a[114514];
ll res[114514] = {};

bool comp(PLL l, PLL r){
	return l.first == r.first ? l.second > r.second : l.first > r.first;
}

int main(void){
	int N;
	cin >> N;
	REP(i, N){
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(a, a+N, comp);
	a[N] = {0, -1};
	int in = 0;
	int add = a[0].second;
	REP(i, N){
		in = i;
		while(a[i].first == a[in].first && in < N){
			if(add > a[in].second)
				add = a[in].second;
			in++;
		}
		in--;
		res[add] += (a[in].first-a[in+1].first)*(in+1);
		a[in].first = a[in+1].first;
		i = in;
	}
	REP(i, N){
		cout << res[i] << endl;
	}
}


Measured memory_bytes: 3456
import sys


def dot(A, B, mod):
    r = len(A)
    c = len(B[0])
    m = len(A[0])
    res = [[0] * c for _ in range(r)]
    for i in range(r):
        for j in range(c):
            for k in range(m):
                res[i][j] += A[i][k] * B[k][j] % mod
                res[i][j] %= mod
    return res


def rec_pow(k, n, mod):
    if n == 1:
        return k

    k2 = dot(k, k, mod)
    if n % 2 == 0:
        return rec_pow(k2, n//2, mod)
    else:
        return dot(rec_pow(k2, n//2, mod), k, mod)


def main():
    input = sys.stdin.readline
    L, A, B, M = map(int, input().split())

    s = [[0, A%M, 1]]
    for d in range(1, 19):
        n1 = min(max(0, (10**d - 1 - A) // B + 1), L)
        n0 = min(max(0, (10**(d-1) - 1 - A) // B + 1), L)
        n = n1 - n0
        if n == 0:
            continue

        k = [[pow(10, d, M), 0, 0],\
             [1, 1, 0],\
             [0, B%M, 1]]
        s = dot(s, rec_pow(k, n, M), M)

        if n1 >= L:
            break

    return s[0][0]

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
 int isPrime(int);
#define N 10000
int main(){
  int n,i,judge;
  int num[N];
  scanf("%d",&n);
  judge=0;
  for(i=0;i<n;i++){
    scanf("%d",&num[i]);
  judge=judge+isPrime(num[i]);
    }
  printf("%d\n",judge);
  return 0;
}

int isPrime(int x){
  int i;
  if(x==2)
    return 1;
  if(x<2||x%2==0)
    return 0;
  for(i=3;i<=sqrt(x);i=i+2){
    if(x%i==0)
      return 0;
      }
  return 1;

}



Measured memory_bytes: 2768
using System;
using System.Collections;

class AOJ{
  static void Main(string[] args)
  {
    var stack = new Stack();
    string s;

    while ((s = Console.ReadLine()) != null){

      if (s == "0")
        Console.WriteLine(stack.Pop());

      else
        stack.Push(s);
    }
  }
}

Measured memory_bytes: 8840
from fractions import gcd

N,X = map(int,input().split())

A = sorted(list(map(int,input().split()))+[X])

B = []
for i in range(len(A)-1):
    B.append(A[i+1]-A[i])

G = B[0]
if G>1:
    for b in B[1:]:
        G = gcd(G,b)
        if G==1:break
            
print(G)

Measured memory_bytes: 16236
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pb push_back

vector<pii>adj[100005];
int nums[100005];
bool marked[100005];
bool comps[100005];
void dfs(int s, int c,int d)
{
	marked[s]=true;
	comps[s]=c;
	nums[s]=d;
	for(auto x:adj[s])
	{
		if(!marked[x.first])
			dfs(x.first,c,d+x.second);
	}
}
int main()
{

	int n,m;
	
	cin>>n>>m;
	int store[m][3];
	for(int i=0;i<m;i++)
	{
		int l,r,d;
		cin>>l>>r>>d;
		adj[l].pb({r,d});
		adj[r].pb({l,-d});
		store[i][0]=l;
		store[i][1]=r;
		store[i][2]=d;
	}
	int c=1;
	for(int i=1;i<=n;i++)
	{
		if(!marked[i])
			dfs(i,c++,0);
	}
	/*for(int i=1;i<=n;i++)
		cout<<nums[i]<<"\n";*/
	for(int i=0;i<m;i++)
	{
		int l=store[i][0],r=store[i][1],d=store[i][2];
		if(nums[r]-nums[l]!=d)
		{
				cout<<"No\n";
				return 0;
		}
	}
	cout<<"Yes\n";

}


Measured memory_bytes: 17872
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
#define pb push_back
using namespace std;
const int maxn=1e5+10;
int n,m,vis[maxn];vector<int> G[maxn],f;
void dfs(int u){
	for(int v:G[u]) if(!vis[v]){
		vis[v]=1;f.pb(v);
		dfs(v);return;
	}
}
int main(){
    scanf("%d%d",&n,&m);
    rep(i,1,m){int u,v;scanf("%d%d",&u,&v),G[u].pb(v),G[v].pb(u);}
	int u=1,v=G[u][0];vis[u]=vis[v]=1;f.pb(u);
	dfs(u);reverse(f.begin(),f.end());f.pb(v);
	dfs(v);printf("%d\n",f.size());
	for(int x:f) printf("%d ",x);
    return 0;
}

Measured memory_bytes: 10104
#include<stdio.h>
int main(void){
	
	int a,b,ans;
	
	scanf("%d", &a);
	scanf("%d", &b);
	
	switch(a){
		
		case 1:
		if(b==2) ans=3;
		else ans=2;
		break;
		case 2:
		
		if(b==1) ans=3;
		else ans=1;
		break;
		case 3:
		if(b==1) ans=2;
		else ans=1;
		break;
		default:
		break;
	}
	
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
n = int(input())
d = {}
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  u,v,w = map(int,input().split())
  d[(u-1,v-1)] = w
  graph[u-1].append(v-1)
  graph[v-1].append(u-1)
  
  
color = [-1 for i in range(n)] 
color[0] = 0
from collections import deque
queue =deque([0])

while queue:
  p = queue.popleft()
  color_p = color[p]
  for i in graph[p]:
    if color[i] != -1:
      continue
    else:
      if d[(min(i,p),max(i,p))] %2:
        color[i] = 1 - color_p
      else:
        color[i] = color_p
      queue.append(i)

for i in range(n):
  print(color[i])




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

const int N = 2e5 + 10;
const int mod = 1e9 + 7;

int n;
int inv[N], fac[N], f[4010][4010], a[N], b[N];

template<class T>inline void read(T &x) {
    x = 0; int f = 0; char ch = getchar();
    while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
    x = f ? -x : x;
    return;
}

int qpow(int a, int b) {
    int ans = 1;
    while (b) {
        if (b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod, b >>= 1;
    }
    return ans;
}

void init() {
    fac[0] = 1;
    for (int i = 1; i <= N - 10; ++i) fac[i] = fac[i - 1] * i % mod;
    inv[N - 10] = qpow(fac[N - 10], mod - 2);
    for (int i = N - 11; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % mod;
}

int C(int x, int y) {
    return fac[x] * inv[y] % mod * inv[x - y] % mod;
}

signed main() {
    init();
    read(n);
    for (int i = 1; i <= n; ++i) {
        read(a[i]), read(b[i]);
        f[2001 - a[i]][2001 - b[i]]++;
    }
    for (int i = 1; i <= 4001; ++i)
        for (int j = 1; j <= 4001; ++j) {
            f[i][j] = (f[i][j] + f[i - 1][j]) % mod;
            f[i][j] = (f[i][j] + f[i][j - 1]) % mod;
        }
    int ans = 0;
    for (int i = 1; i <= n; ++i) ans = (ans + f[2001 + a[i]][2001 + b[i]]) % mod;
    for (int i = 1; i <= n; ++i) ans = (ans - C(a[i] + a[i] + b[i] + b[i], a[i] + a[i]) + mod) % mod;
    printf("%lld\n", ans * qpow(2, mod - 2) % mod);
    return 0;
}

Measured memory_bytes: 132096
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *a,*b;

  int c[VMAX + 1],n,i,j;

  scanf("%d",&n);

  a = malloc(sizeof(short)*n+1);
  b = malloc(sizeof(short)*n+1);

  for(i = 0;i <= VMAX;i++){
    c[i] = 0;
  }

  for(i = 0;i < n;i++){
    scanf("%d",&a[i + 1]);
    c[a[i + 1]]++;
  }

  for(i = 1;i < VMAX;i++){
    c[i] = c[i] + c[i - 1];
  }

  for(j = 1;j <= n;j++){
    b[c[a[j]]] = a[j];
    c[a[j]]--;
  }

  for(i = 1;i <= n;i++){
    if(i > 1) printf(" ");
    printf("%d",b[i]);
  }

  printf("\n");

  return 0;
}



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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    vector<int> v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);

    sort(v.begin(), v.end());

    cout << v[0] << " " << v[1] << " " << v[2] << endl;

    return 0;
}

Measured memory_bytes: 1220
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC optimize("Ofast")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <random>
#include <cassert>
#include <complex>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef complex <LD> cld;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T1, typename T2>
T2 sum_mod(T1 x, T2 MOD) {
	if (x < 0)
		x += MOD;
	if (x >= MOD)
		x -= MOD;
	return x;
}

template <typename T1, typename T2>
T2 mul_mod(T1 x, T2 MOD) {
	if (x < 0)
		return (abs(x) % MOD == 0 ? 0 : MOD - abs(x) % MOD);
	return x % MOD;
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 gen_rand;

const int N = (int)1e5 + 7;
const int LOG = 20;
const int N_ = (int)8e2 + 7;
const int MAXN = (int)5e5 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const int CONST = 300;
const LL LINF = (i64)2e15;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1e-6;

/////////////////////////////////////////////////////////////////////

int n, m, a[N];

LL gcd(LL a, LL b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
	gen_rand.seed(0);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	gen_rand.seed(time(0));
#endif

	cin >> n >> m;
	set <int> pw;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		int cnt = 0;
		for (int j = 0; j < 30; j++) {
			int x = (1 << j);
			if (a[i] % x != 0) {
				cnt = j;
				break;
			}
		}
		pw.insert(cnt);
	}
	if (size(pw) > 1) {
		cout << 0;
		return 0;
	}

	LL d = 1;
	for (int i = 0; i < n; i++) {
		d = lcm(d, a[i] / 2);
		if (d > m) {
			cout << 0;
			return 0;
		}
	}
	cout << (m / d + 1) / 2;
		
#ifdef _DEBUG 
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 30

signed main()
{
    string S;
    cin >> S;
    bool isC = false;
    REP(i, S.length()) {
        if(isC) {
            if(S[i] == 'F') {
                printf("Yes\n");
                return 0;
            }
        } else {
            if(S[i] == 'C') { isC = true; }
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(void) {}
  Edge(int src, int dst) : src(src), dst(dst) {}
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void edges_to_graph(Graph &graph, const Edges &edges, const int vertices, const bool directed = true) {
  graph.resize(vertices);
  for (const auto &e : edges) graph[e.src].emplace_back(e);
  if (!directed) for (const auto &e : edges) graph[e.dst].emplace_back(Edge(e.dst, e.src, e.weight));
}

template <typename T>
void warshall_floyd(vector<vector<T>> &result, const Graph &graph) {
  const int   v   = graph.size();
  constexpr T inf = numeric_limits<T>::max();
  result.assign(v, vector<T>(v, inf));
  for (const auto &es : graph) {
    for (const auto &e : es) {
      result[e.src][e.dst] = e.weight;
    }
  }
  for (int i = 0; i < v; ++i) result[i][i] = 0;
  for (int k = 0; k < v; ++k) {
    for (int i = 0; i < v; ++i) {
      for (int j = 0; j < v; ++j) {
        if (result[i][k] == inf || result[k][j] == inf) continue;
        result[i][j] = min(result[i][j], result[i][k] + result[k][j]);
      }
    }
  }
}

Graph graph;
int main(void) {
  int n, m, l;
  cin >> n >> m >> l;
  Edges edges(m);
  rep (i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    edges[i] = {--a, --b, c};
  }
  int q;
  cin >> q;
  vector<int> s(q), t(q);
  rep (i, q) {
    cin >> s[i] >> t[i];
    --s[i], --t[i];
  }
  edges_to_graph(graph, edges, n, false);
  vector<vector<lint>> fuel, times;
  warshall_floyd(fuel, graph);
  graph.assign(n, Edges());
  rep (i, n) {
    rep (j, n) {
      if (fuel[i][j] <= l) graph[i].emplace_back(Edge(i, j, 1));
    }
  }
  warshall_floyd(times, graph);
  rep (i, q) cout << (times[s[i]][t[i]] != LLONG_MAX ? times[s[i]][t[i]] - 1 : -1) << endl;
  return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<ll>a;
    for(int i=0;i<n;i++)
    {
        ll c;
        cin>>c;
        a.push_back(c);
    }
    int r = 0;
    long long ans =0;
    long long sum =0;
    for(int i=0;i<n;i++)
    {
        while(r<n && (sum^a[r])==sum+a[r])
        {
            sum+= a[r];
            r++;
        }
        ans+=(r-i);
        if(i==r)
        {
            ans++;
        }
        else
        {
            sum-=a[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int D;
  string N;
  cin>>D>>N;
  if(N=="100"){
    cout<<101;
  }
  else{
    cout<<N;
  }
  for(int X=0;X<D;X++){
    cout<<"00";
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
bool solve(){
    ll N, M;
    cin >> N >> M;
    if(N == 0 && M == 0)return true;
    vector<ll> h(N),w(M);
    vector<ll> x(1,0), y(1,0);
    rep(i,N){
        cin >> h[i];
        x.push_back(x.back() + h[i]);
    }
    rep(j,M){
        cin >> w[j];
        y.push_back(y.back() + w[j]);
    }
    map<ll,int> mp[2];
    rep(i,N+1)rep(j,i){
        mp[0][abs(x[i] - x[j])]++;
    }
    rep(i,M+1)rep(j,i){
        mp[1][abs(y[i] - y[j])]++;
    }
    // print(x);
    // print(y);
    // print(mp[0]);
    // print(mp[1]);
    ll ans = 0;
    for(auto p: mp[0]){
        ans += mp[1][p.first] * p.second;
        // dump(ans);
    }
    cout << ans << endl;
    return false;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    while(1)if(solve())break;
}



Measured memory_bytes: 44888
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int, int> pi;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MKP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
const int INF = 999999;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll MOD = 1000000007;

int a,b;
 
int main()
{
  cin >> a >> b;
  cout << (a-1)*(b-1) << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;

signed main() {
    int H;
    cin >> H;
    int ans = 1, temp = 2;
    while (true) {
        if (H < temp) break;
        ans = (ans * 2) + 1;
        temp *= 2;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

long long D, N;

int main() {
	cin >> D >> N;
	if (N == 100)N++;
	if (D == 0)cout << N;
	else if (D == 1)cout << N << "00" << endl;
	else cout << N << "0000" << 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 all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    string n;
    cin >> n;
    if (n[0] == '1')
        cout << 9;
    else
        cout << 1;
    if (n[1] == '1')
        cout << 9;
    else
        cout << 1;
    if (n[2] == '1')
        cout << 9;
    else
        cout << 1;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define all(x) x.begin(),x.end()
using ll = long long;

int main() {
	int n, m, x; cin >> n >> m >> x;
	vector<int> a(m); rep(i, 0, m) cin >> a[i];

	int ans1 = 0, ans2 = 0;
	rep(i, 0, x) if (binary_search(all(a), i)) ans1++;
	rep(i, x, n+2) if (binary_search(all(a), i)) ans2++;

	cout << min(ans1, ans2) << endl;

	return 0;
}

Measured memory_bytes: 256
import collections

def main():
    N = int(input())
    A = list(map(int,input().split()))
    Q = int(input())
    B = [0] * Q
    C = [0] * Q
    
    for i in range(Q):
        B[i],C[i] = map(int,input().split())
    
    c = [0] * (10 ** 5 + 10)
    
    for i in range(N):
        c[A[i]] += 1
    SUM = sum(A)
    
    for i in range(Q):
        if c[B[i]] == 0:
            print(SUM)
            continue
        SUM -= B[i] * c[B[i]]
        SUM += C[i] * c[B[i]]
        c[C[i]] += c[B[i]]
        c[B[i]] = 0
        print(SUM)
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 22320
#include<bits/stdc++.h>
#define crap ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define endl "\n"
#define int ll

using namespace std;



int32_t main()
{
  
   
    crap;
   
    int n,m;
    cin>>n>>m;
    int A[n];
    int sum=0;
    for(int i=0;i<n;i++){ cin>>A[i]; sum+=A[i];}

    int cnt=0;
    int r = sum/(4*m);


    for(int i=0;i<n;i++){
        if(A[i]*4*m>=sum) cnt++;
    }
    if(cnt>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Sun Dec 23 23:41:00 2018
//
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N, &M)

	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}

	for i := range arr {
		if i+1 < len(arr) {
			arr[i+1] += arr[i]
		}
		arr[i] %= M
	}

	m := map[int]int{}
	for _, a := range arr {
		m[a]++
	}

	ans := m[0]
	for _, v := range m {
		ans += v * (v - 1) / 2
	}

	fmt.Println(ans)
}


Measured memory_bytes: 7040
#include<cstring>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;
typedef long long LL;
int main(){
	int a,b,x;
	scanf("%d%d",&a,&b);
	if((a+b)%2==0)printf("%d\n",(a+b)/2);
	else if((a+b)%2<1)printf("%d\n",(a+b)/2);
	else printf("%d\n",(a+b)/2+1);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //コンテスト参加回数
        int r = sc.nextInt(); //表示レーティング

        if(n>10){
          r=r;
        }else{
          r=r+(100*(10-n));
        }

        // 出力
        System.out.println(r);
    }
}


Measured memory_bytes: 21716
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
	 char s[200];
	 scanf("%s",&s);
	 int i,n;
	 n=strlen(s);
	 for(i=0;i<n;i++)
	 printf("x");
	 return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
  int A[4];
  int max,min;
  scanf("%d %d %d", &A[1],&A[2],&A[3]);

  max=A[1];
  if(max<=A[2]){
    max=A[2];
  }
  if(max<=A[3]){
    max=A[3];
  }

  min=A[1];
  if(min>=A[2]){
    min=A[2];
  }
  if(min>=A[3]){
    min=A[3];
  }

  printf("%d", max-min);
  return 0;
}


Measured memory_bytes: 128
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#include <map>
#include <utility>
#define ll long long 
#define PI 3.14159265358979323846
#define INF 10000000000
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
	ll N, ac = 0, wa = 0, tle = 0, re = 0;
	cin >> N;
	rep(i, N) {
		string S;
		cin >> S;
		if (S == "AC") ac++;
		else if (S == "WA") wa++;
		else if (S == "TLE") tle++;
		else re++;
	}
	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll l, r;
  cin >> l >> r;
  ll mx = min(r + 1, l + 2020);
  ll ans = 1e18;
  rep2(i, l, mx - 1) rep2(j, l + 1, mx) ans = min(ans, (i * j) % 2019);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
        int a,b,c;

        scanf("%d%d%d",&a,&b,&c);

        if(a<=c){
                if(c<=b){
                        printf("Yes\n");
                        return 0;
                }
        }

        printf("No\n");

        return 0;
}


Measured memory_bytes: 128