akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    ll L; int N;
    cin >> L >> N;
    ll X[N];
    rep(i, N) cin >> X[i];
    ll suml[N+1], sumr[N+1];
    suml[0] = sumr[0] = 0;
    rep(i, N){
        suml[i+1] = suml[i]+X[i];
        sumr[i+1] = sumr[i]+(L-X[N-1-i]);
    }
    ll ans = 0;
    rep(i, N){
        ll tmp;
        if(2*i+1 < N){
            tmp = 2*(sumr[N-i-1]-sumr[N-2*i-2]);
            tmp += 2*suml[i+1]-X[i];
        }
        else{
            tmp = 2*(suml[i+1]-suml[2*i+1-N]);
            tmp += 2*sumr[N-i-1]-X[i];
        }
        ans = max(ans, tmp);
    }
    rep(i, N){
        ll tmp;
        if(2*i+1 < N){
            tmp = 2*(suml[N-i-1]-suml[N-2*i-2]);
            tmp += 2*sumr[i+1]-(L-X[N-1-i]);
        }
        else{
            tmp = 2*(sumr[i+1]-sumr[2*i+1-N]);
            tmp += 2*suml[N-i-1]-(L-X[N-1-i]);
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1 << 30;
const ll MOD = 1000000007;
long long X;
int main(void) {
  cin >> X;
  long long val = 100;
  int year = 0;
  while (true) {
    if (val >= X) {
      cout << year << endl;
      return 0;
    }
    val = floor(val * 1.01);
    year++;
  }

  cout << year << endl;

  return 0;
}

Measured memory_bytes: 3716
#入力
N = int(input())
s = []
t = []
for i in range(N):
    s.append(input())
M = int(input())
for i in range(M):
    t.append(input())
#s-tが最大のものを探す
s_set = set(s)
sub = []
for i in s_set:
    a = s.count(i)
    b = t.count(i)
    sub.append(a-b)
if max(sub) >0:
    print(max(sub))
else:
    print('0')

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

// {
#define debug(var)  do{ std::cout << #var << " : "; view(var); }while(0)
using ll = long long;
using ld = long double;
inline int num (const std::string& S, int idx) noexcept { return S.at(idx) - '0'; }
inline int ctoi(char c) noexcept { return c - '0'; }
inline bool isNumber(char c) noexcept { return ('0'<c && c<'9'? true : false); }
inline int safeCtoi(char c) { if(isNumber(c)) { return ctoi(c); } else { throw 1; } }
inline char itoc(int i) noexcept { return i + '0'; }
inline unsigned int bitMask(int i) noexcept { return (1 << i); }
inline bool isTrue(unsigned int bit, int i) noexcept { return bit & bitMask(i); }
inline bool isEven(int num) noexcept { return !num%2; }
inline bool isOdd(int num) noexcept { return num%2; }
template<typename T> inline short sgn(T num) noexcept { return (num==0? 0 : (num>0? 1 : -1) ); }
template<typename T> inline bool isZero(T num) noexcept { return (num==0? true : false); }
template<typename T> inline bool isPositive(T num) noexcept { return (num>0? true : false); }
template<typename T> inline bool isNegative(T num) noexcept { return (num<0? true : false); }
template<typename T> void view(T e) noexcept { cout << e; }
template<typename T> void view(std::vector<T> v) noexcept { for(const auto& e : v) cout << e << " "; }
template<typename T> void view(std::vector<std::vector<T>> vv) noexcept { for(const auto& v : vv) view(v); }
//}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
	return 0;
}


Measured memory_bytes: 3604
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <tuple>
# include <functional>
# include <utility>
# define INF 1000000000
# define MOD 1000000000+7
using namespace std;

char islands[15][15];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

void dfs(int h, int w) {
	islands[h][w] = '0';
	for (int i = 0; i < 4; i++) {
		if (h + dx[i] >= 0 && h + dx[i] <= 12 && w + dy[i] >= 0 && w + dy[i] <= 12 && islands[h + dx[i]][w + dy[i]] == '1') {
			dfs(h + dx[i], w + dy[i]);
		}
	}
}
int main() {
	string a;
	while (cin>>a) {
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				islands[i][j] = a[j];
			}
			if(i!=11)cin >> a;
		}
		int ans = 0;
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				if (islands[i][j] == '1')dfs(i, j), ans++;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3156
//ALL GLORY TO JESUS CHRIST 
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<vector<int>> vvi;

#define clr(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define frpn(x) freopen(#x ".in","r",stdin);freopen(#x ".out","w",stdout);
#define all(a) a.begin(), a.end()
#define mkp make_pair
#define forn(i, n) for(int i=0; i<(int)(n); ++i)
#define forab(i, a, b) for(int i=(int)(a); i<=(int)(b); ++i)
#define fornd(i, n) for(int i=(int)(n-1); i>=0; --i)
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )

const int MOD = (int)1e9+7;

template <class T>
inline void rem(T &n){
   n = (-MOD <= n && n <= MOD) ? n : n%MOD ;
  if(n < 0) n += MOD; 
}
//modular inverse
//inv(a,m) - inverse of a mod m
template <class T>
inline T inv(T a, T m){
 return 1<a ? m - inv(m%a, a)*m/a : 1;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef LOCAL
    clock_t tStart = clock();
#endif
    int n; cin >> n;
    for(int i=1; i<=9; ++i)
        for(int j=1; j<=9; ++j)
            if(i*j == n) {
              cout << "Yes\n";
              return 0;
            }
    cout << "No\n";
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * (clock() - tStart)/ CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int left=a+b;
    int right=c+d;
    if(left > right){
        cout<<"Left"<<endl;
    }else if( left < right){
        cout<<"Right"<<endl;
    }else{
        cout<<"Balanced"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n,h,w;
  cin>>n>>h>>w;
  int a[n],b[n];
  int ans=0;
  for(int i=0;i<n;i++){
      cin>>a[i]>>b[i];
      if(a[i]>=h&&b[i]>=w) ans++;
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
//nani?
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ )
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
using namespace __gnu_pbds;
const int inf=1e7;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 1e5+5;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------


ll a[MAX_N];

int main(){
    fastio;
    ll n;
    cin>>n;
    ll sum=0;
    f(i,1,n+1){
        f(j,1,n+1){
            f(k,1,n+1){
                sum+= __gcd(__gcd(i,j),k);
            }
        }
    }
    cout<<sum<<endl;
    
} 

Measured memory_bytes: 3644
import java.util.*;
class Main{
	static int a,b;
	static boolean s;
	public static void main(String[]$){
		Scanner c=new Scanner(System.in);
		int k=c.nextInt(),x=c.nextInt(),y=c.nextInt();
		x*=a=x<0?-1:1;
		y*=b=y<0?-1:1;
		if(s=x<y)x^=y^(y=x);
		int n=(x+y+k-1)/k;
        if (k % 2 == 0 && (x + y) % 2 == 1) {
            System.out.println(-1);
            return;
        } else if (x + y < k) {
            if ((x + y) % 2 == 1) {
                System.out.println(3);
                p(x, x - k);
                p(x + (k + x - y) / 2, x - k + (k - x + y) / 2);
                p(x, y);
                return;
            } else {
                n = 2;
            }
        } else if ((k - (x + y) % k) % k % 2 == 1) {
            n++;
        }
		System.out.println(n);
		int m=(k*n-x-y)/2,i=0;
		while(++i<=n)if(m>k*i)p(0,-k*i);
			else if(x+m>k*i)p(k*i-m,-m);
			else p(x,k*i-m-m-x);
	}
	static void p(int x,int y){
		System.out.println(a*(s?y:x)+" "+b*(s?x:y));
	}
}

Measured memory_bytes: 44656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

// 隣接リスト
const ll MAX_V = 100010;
VV<pll> g(MAX_V, vp());
vi visited(MAX_V, 0);
vll dist(MAX_V, 0);

// グラフに対する深さ優先探索
void dfs(ll node, ll d){
    dump(node, d);
    visited[node] = 1;
    dist[node] = d;
    rep(i, SZ(g[node])){
        if(!visited[g[node][i].first]) dfs(g[node][i].first, d+g[node][i].second);
    }
}


void pr(bool f){
    cout << (f ? "Yes" : "No") << endl;
    exit(0);
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, m;
    cin >> n >> m;
    vll l(m), r(m), d(m);
    rep(i, m){
        cin >> l[i] >> r[i] >> d[i];
        g[l[i]].emplace_back(r[i], d[i]);
        g[r[i]].emplace_back(l[i], -d[i]);
    }
    rep(i, n+1) dump(g[i]);
    repr(i, 1, n+1){
        if(!visited[i]) dfs(i, 0);
    }
    rep(i, m){
        dump(dist[r[i]], dist[l[i]], d[i]);
        if(dist[r[i]]-dist[l[i]] != d[i]) pr(0);
    }
    pr(1);
    return 0;
}

Measured memory_bytes: 20608
while True:
    try:
        Num_lis = list(map(int,map(str,input())))

        while len(Num_lis) > 1:
            List1 = []
            for i in range(len(Num_lis) - 1):
                List1.append((Num_lis[i] + Num_lis[i + 1]) % 10)
            Num_lis = List1
        print(Num_lis[0])
            
    except EOFError:
        break

Measured memory_bytes: 7536
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
#define ll long long
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
	fastio();
	string s;
	cin>>s;
	set<char>b;
	for(auto i:s) b.insert(i);

	(b.size()==1)? cout<<"No":cout<<"Yes";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

template<typename T>
using v = vector<T>;

int main() {
	int N;
	cin >> N;
	vi s(N);
	int sum = 0;
	rep(i, N) {
		cin >> s[i];
		sum += s[i];
	}
	sort(all(s));

	if (sum % 10 != 0) {
		cout << sum << endl;
	}
	else {
		rep(i, N) {
			if (s[i] % 10 != 0) {
				cout << sum - s[i] << endl;
				return 0;
			}
		}
		cout << 0 << endl;
	}

	return 0;
}

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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 16, msksz = (1 << nsz) - 1;
int n, to, a[nsz + 5][nsz + 5];
num sum[msksz + 5], dp[msksz + 5];

string inline str(int S) {
    string s;
    loop (i, n) {
        s += ((S >> i) & 1) ^ 48;
    }
    return s;
}

void inline upd(num &a, num b) {
    a < b && (a = b);
}

int main() {
    ios::sync_with_stdio(0);
    cin >> n;
    to = (1 << n) - 1;
    loop (i, n) {
        loop (j, n) {
            cin >> a[i][j];
        }
    }
    circ (S, 0, to) {
        loop (u, n) {
            if (!((S >> u) & 1))  continue;
            circ (v, u + 1, n) {
                if (!((S >> v) & 1))  continue;
                sum[S] += a[u][v];
            }
        }
    }
    circ (S, 0, to) {
        int rS = S ^ to;
        for (int t = rS; t; t = rS & (t - 1)) {
            upd(dp[S | t], dp[S] + sum[t]); 
        }
    }
    cout << dp[to] << ln;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

int main()
{
    int n;
    ll d, a;
    cin >> n >> d >> a;
    map<ll, ll> monster;
    set<ll> query;
    map<ll, ll> detail;
    for (int i = 0; i < n; i++)
    {
        ll x, h;
        cin >> x >> h;
        monster[x - 1] = (h + a - 1) / a; // [座標][倒すのに必要な爆弾の個数]
    }

    ll ans = 0;
    ll cnt = 0;     // 現在の位置の爆弾の影響の個数
    ll before = -1; // 一つ前のモンスターの座標
    for (auto mon : monster)
    {
        int pos = mon.first;
        int hp = mon.second;
        if (!query.empty())
        {
            auto iter = query.lower_bound(before + 1);
            if (iter != query.end())
            {
                while (iter != query.end() && *iter <= pos)
                {
                    cnt -= detail[*iter];
                    ++iter;
                }
            }
        }
        if (hp - cnt > 0)
        {
            query.insert(pos + d + d + 1);
            detail[pos + d + d + 1] = hp - cnt;
            ans += hp - cnt;
            cnt += hp - cnt;
        }
        before = pos;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 37892
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    LL n;
    int x, m;
    cin >> n >> x >> m;
    VI to(m, -1);
    FOR(i, 0, m)
    {
        to[i] = (LL)i * i % m;
    }
    VI vis(m);
    vis[x] = true;
    VI path = {x};
    while (!vis[to[x]])
    {
        x = to[x];
        path.PB(x);
        vis[x] = true;
    }
    int beg = 0;
    while (path[beg] != to[x])
        beg++;
    LL csum = 0;
    VL cycle;
    FOR(i, beg, SZ(path))
    {
        cycle.PB(path[i]);
        csum += path[i];
    }
    LL ans = 0;
    int where = 0;
    while (n > 0 && where != beg)
    {
        ans += path[where];
        n--;
        where++;
    }
    if (n > 0)
    {
        LL full = n / SZ(cycle);
        ans += full * csum;
        cycle.back() = 0;
        int rem = n % (SZ(cycle));
        FOR(i, 0, rem)
            ans += cycle[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4852
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    int dec=0;
    string n;
    cin>>n;
    for(int i=0;i<3;i++){
        if(n.at(i)==n.at(i+1)){
            dec+=1;
        }
    }
    if(dec>=1){
        cout<<"Bad";
    }
    else
        cout<<"Good";
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  int a, min, max;
  long sum;
  for (int i = 0; i < n; i++) {
    std::cin >> a;
    if (i == 0) {
      min = a;
      max = a;
      sum = a;
      continue;
    }
    if (min > a) {
      min = a;
    }
    if (max < a) {
      max = a;
    }
    sum += a;
  }
  std::cout << min << " " << max << " " << sum << std::endl;
}



Measured memory_bytes: 3084
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <set>
#include <complex>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

const int MN = 220;
int h, w;
ll g[MN][MN];

bool bc(int x, int y) {
    return (0 <= x && x < w && 0 <= y && y < h);
}


ll dp[2*MN][MN][MN];
bool used[2*MN][MN][MN] = {};

ll solve(int d, int ax, int bx) {
    int ay = d-ax, by = d-bx;
    if (!bc(ax, ay) || !bc(bx, by)) return -TEN(15);
    if (d == h+w-2) return g[ay][ax];
    if (used[d][ax][bx]) return dp[d][ax][bx];
    used[d][ax][bx] = true;
    ll &ans = dp[d][ax][bx];
    ans = -TEN(15);
    ans = max(ans, solve(d+1, ax, bx));
    ans = max(ans, solve(d+1, ax+1, bx));
    ans = max(ans, solve(d+1, ax, bx+1));
    ans = max(ans, solve(d+1, ax+1, bx+1));
    ans += g[ay][ax] + g[by][bx];
    if (ax == bx) {
        ans -= g[ay][ax];
    }
    return ans;
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> g[i][j];
        }
    }
    cout << solve(0, 0, 0) << endl;
    return 0;
}



Measured memory_bytes: 80768
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 4e6 + 111;
     
using namespace std;

int n, q, dp[5][maxn], a[25][25];
vector <int> g[maxn];
bool was[maxn];

int dfs(int v){
	was[v] = true;
	bool ch = false;
	dp[0][v] = 1;
	dp[1][v] = 1;
	for (auto to : g[v]){
		if (!was[to]){
			ch = true;
			dfs(to);
			dp[0][v] *= (dp[0][to] + dp[1][to]);
			dp[1][v] *= dp[0][to];
			dp[0][v] %= mod;
			dp[1][v] %= mod;
		}
	}
}

void solve(){
	cin >> n;

	int x, y;

	for (int i = 1; i < n; i++){
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}

	dfs(1);

	cout << (dp[0][1] + dp[1][1]) % mod;
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

Measured memory_bytes: 111488
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x


def main():
    from math import ceil
    N = int(input())
    A = list(map(int, input().split()))

    if(N == 0):
        if(A[0] == 1):
            print(1)
        else:
            print(-1)
        exit(0)
    if(A[0] != 0 or A[N] == 0):
        print(-1)
        exit(0)
    # curは作り出せる最大ノード数
    if(N == 1):
        print(A[1] + 1)
        exit(0)
    cur = 0
    S = [0] * (N + 1)
    for i in range(N, 0, -1):
        cur += A[i]
        S[i - 1] = cur
    # print(S)

    ans, cur = 0, 2
    node = [0] * (N + 1)
    a = [0] * (N + 1)
    node[0] = 2
    for i in range(1, N + 1):
        if(A[i] > cur):
            print(-1)
            exit(0)
        if(A[i] > pow(2, i)):
            print(-1)
            exit(0)
        cur = 2 * (cur - A[i])
        node[i] = cur

        if(node[i] > S[i]): node[i] = S[i]
        a[i] = node[i - 1] + cur
        # print("i={}, cur={}".format(i, cur))
    # print(node)
    # print(a)
    # 最初の頂点
    print(sum(node) + 1)
    '''
  cur = 0
  for i in range(N, 0, -1):
      cur += A[i]
      if(cur >= 2**(i - 1)): cur = 2**(i - 1)
      # if(cur >= 2 * A[i - 1]): cur = 2 * A[i - 1]
      ans += cur
      print(cur, ans)
  print(ans)

  '''


if __name__ == "__main__":
    main()


Measured memory_bytes: 705108
import math
import fractions
import sys
import itertools
import numpy as np
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))

n=input1()
s=list(str(input()))

mid=n//2
if s[:mid] == s[mid:]:
	print("Yes")
else:
	print("No")


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

#define endl "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define deb(x) cerr << #x << " => " << x << "\n"
#define deba(x) cerr << #x << "\n"; for (auto a : x) cerr << a << " "; cerr << "\n";
#define debm(x) cerr << #x << "\n"; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << "\n";}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)

int fastpow(int a, int b, int m) {
    int res = 1; a %= m; while (b > 0) {
        if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1;
    } return res;
}

int now() {
    return chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now()
    .time_since_epoch()).count();
}

int32_t main() { fastio;
    time_t start = now();

    double x;
    cin >> x;
    pout << (x / 3) * (x / 3) * (x / 3) << endl;

    cerr << "TIME => " << now() - start << endl;
    return 0;
}

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

int main(void){
    int N;
    cin>>N;
    vector<long long> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    int ans=0;
    int count;
    while(count!=N){
        count=0;
        for(int i=0;i<N;i++){
            if(A[i]%2==0){
                ans++;
                A[i]=A[i]/2;
            }
        }
        for(int i=0;i<N;i++){
            if(A[i]%2!=0) count++;
        }
    }
    cout<<ans<<endl;
    return 0;
}



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

int main(){
  int Month;
  string Memo;
  int Day[2],result=0,a,b;
  cin >> Month >> Memo ;
  int Me = stoi(Memo);
  for (int i=0;i<2;i++){
    Day[i] = (int)(Memo[i]-'0');
  }

  for(int i=1;i<Month+1;i++){
    for(int j=20;j<Me+1;j++){
      Memo = to_string(j);
      a = (int)(Memo[0]-'0');
      b = (int)(Memo[1]-'0');
      if(i==a*b && b!=1){
        result++;
        // cout <<a << " "<<b <<endl;
      }
       
    }
  }
  cout <<result;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a, b;
  string s;
  cin >> s;
  s.at(5)=' ';
  s.at(13)=' ';
  co(s);
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

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

template <int mod>
struct ModInt {
  int x;
  ModInt(): x(0) {}
  ModInt(long long a) { x = a % mod; if (x < 0) x += mod; }
  ModInt &operator+=(ModInt that) { x = (x + that.x) % mod; return *this; }
  ModInt &operator-=(ModInt that) { x = (x + mod - that.x) % mod; return *this; }
  ModInt &operator*=(ModInt that) { x = (long long) x * that.x % mod; return *this; }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return ModInt(u);
  }
  #define op(o, p) ModInt operator o(ModInt that) { return ModInt(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  friend ostream& operator<<(ostream &os, ModInt m) { return os << m.x; }
};

using mint = ModInt<1000000007>;

void solve() {
  int n;
  cin >> n;
  vi32 c;
  {
    vi32 _c(n);
    cin >> _c;
    int prev = -1;
    rep(i, n) if (prev != _c[i]) {
      c.push_back(_c[i]);
      prev = _c[i];
    }
  }
  n = sz(c);
  vi32 indices(n, -1);
  {
    map<int, int> mp;
    rrep(i, n) {
      if (mp.count(c[i])) {
        indices[i] = mp[c[i]];
      }
      mp[c[i]] = i;
    }
  }
  vector<mint> dp(n + 1);
  dp[0] = 1;
  rep(i, n) {
    dp[i+1] += dp[i];
    if (indices[i] != -1) dp[indices[i]] += dp[i];
  }
  cout << dp[n] << endl;
}


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

using namespace std;

int main() {
  int K, l;
  string S;
  cin >> K;
  cin >> S;
  l = S.size();
  if (l <= K) {
    cout  << S << endl;
  } else {
    cout << S.substr(0, K) << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]
# i番目までの魔法を使った時にjを削るために必要な最小のコスト
dp = [[10**10]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(H+1):
        # 使わない場合
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        # 使う場合
        dp[i+1][min(j+magic[i][0], H)] = min(dp[i+1][min(j+magic[i][0], H)], dp[i+1][j] + magic[i][1])
print(dp[N][H])


Measured memory_bytes: 120668
#include<stdio.h>
#include<string.h>

int main(void){
  int n,i,j,flag,k;
  char str[10000],ch[8]="Hoshino";

  scanf("%d",&n);
  scanf("%c",&str[0]);

  for(k=0;k<n;k++){
  scanf("%[^\n]%*c",str);
  
  for(i=0;i<strlen(str);i++){
    flag=0;
    for(j=0;j<7;j++){
      if(str[i+j]==ch[j])flag++;
    }
    if(flag==7)str[i+6]='a';
  }
  printf("%s\n",str);
  }
  return 0;
}

Measured memory_bytes: 0
import itertools
import numpy as np

a1, a2, a3 = map(int, input().split())

A = [i for i in itertools.permutations([a1, a2, a3])]

cost = [np.abs(A[i][0] - A[i][1]) + np.abs(A[i][1] - A[i][2]) 
    for i in range(len(A))]

print(min(cost))

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

int main() {
 int H,W;
 cin >> H >> W;
 for(int i=0; i<W+2; i++){
  cout << '#' ;
 }
  cout << endl;
  for(int i=0; i<H; i++){
   string A;
   cin >> A;
   cout << '#' << A << '#' <<endl;
 }
  for(int i=0; i<W+2; i++){
   cout << '#' ;
 }
  cout << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct M_SET
{
    int value;
    int index;
    char str;
};
void BabbleSort(M_SET *A, int n);
void SelectionSort(M_SET *A, int n);
bool Judge(M_SET a, M_SET b);
void print(M_SET *A, int N);
int main()
{
    int N;
    string str;
    cin >> N;
    M_SET A[N], B[N];
    for (int i = 0; i < N; ++i)
    {
        str.clear();
        cin >> str;
        A[i].index = B[i].index = i;
        A[i].str = B[i].str = str[0];
        A[i].value = B[i].value = str[1] - '0';
    }
    BabbleSort(A, N);
    SelectionSort(B, N);
    print(A, N);
    print(B, N);
}
void BabbleSort(M_SET *A, int n)
{
    for (int i = 0; i < n; ++i)
    {
        for (int j = n - 1; j >= i + 1; --j)
        {
            if (A[j].value < A[j - 1].value)
                swap(A[j], A[j - 1]);
        }
    }
}
void SelectionSort(M_SET *A, int n)
{
    for (int i = 0; i < n - 1; ++i)
    {
        int minj = i;
        for (int j = i + 1; j < n; ++j)
        {
            if (A[j].value < A[minj].value)
                minj = j;
        }
        swap(A[minj], A[i]);
    }
}
bool Judge(M_SET a, M_SET b) { return a.index < b.index; }

void print(M_SET *A, int N)
{
    for (int i = 0; i < N; ++i)
    {
        cout << A[i].str << A[i].value << flush;
        if (i < N - 1)
            cout << ' ' << flush;
    }
    cout << endl;
    bool ans = true;
    for (int i = 0; i < N - 1; ++i)
    {
        for (int j = i + 1; j < N; ++j)
        {
            if (A[i].value == A[j].value)
            {
                ans = Judge(A[i], A[j]);
                if (ans == false)
                    break;
            }
        }
        if (ans == false)
            break;
    }
    if (ans == false)
        cout << "Not stable" << endl;
    else
    {
        cout << "Stable" << endl;
    }
}


Measured memory_bytes: 3156
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

#define MAX_D	(365)

/* typedef */

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

/* classes */

class Req {
public:
  int d0, d1, w;

  Req(int _d0 = 0, int _d1 = 0, int _w = 0) {
    d0 = _d0; d1 = _d1; w = _w;
  }

  bool operator <(const Req& r) const {
    if (d0 != r.d0) return d0 < r.d0;
    return d1 < r.d1;
  }
};

/* main */

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (n == 0) break;

    vector<Req> reqs(n);
    int max_d = 0;

    for (int i = 0; i < n; i++) {
      cin >> reqs[i].d0 >> reqs[i].d1 >> reqs[i].w;
      if (max_d < reqs[i].d1) max_d = reqs[i].d1;
    }

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

    int maxws[MAX_D + 1][MAX_D + 1], maxws0[MAX_D + 1][MAX_D + 1];
    memset(maxws, 0, sizeof(maxws));

    for (int k = 0; k < n; k++) {
      int d0 = reqs[k].d0;
      int d1 = reqs[k].d1;
      int w = reqs[k].w;
      memcpy(maxws0, maxws, sizeof(maxws));

      for (int i = 1; i <= max_d; i++)
	for (int j = 1; j <= max_d; j++) {
	  if (i == j && i == d1) {
	    int wi = maxws[d0 - 1][j] + w;
	    int wj = maxws[i][d0 - 1] + w;
	    if (maxws0[i][j] < wi) maxws0[i][j] = wi;
	    if (maxws0[i][j] < wj) maxws0[i][j] = wj;
	  }
	  else if (i == d1) {
	    int wi = maxws[d0 - 1][j] + w;
	    if (maxws0[i][j] < wi) maxws0[i][j] = wi;
	  }
	  else if (j == d1) {
	    int wj = maxws[i][d0 - 1] + w;
	    if (maxws0[i][j] < wj) maxws0[i][j] = wj;
	  }

	  int wij0 = maxws0[i - 1][j];
	  int wij1 = maxws0[i][j - 1];
	  if (maxws0[i][j] < wij0) maxws0[i][j] = wij0;
	  if (maxws0[i][j] < wij1) maxws0[i][j] = wij1;
	}

      memcpy(maxws, maxws0, sizeof(maxws));
    }

    cout << maxws[max_d][max_d] << endl;
  }

  return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    for (int i = 0; i < n; i++)cin >> p[i];
    for (int i = 0; i < n; i++)cin >> q[i];

    vector<int> v(n);
    for (int i = 0; i < n; i++)v[i] = i + 1;

    int count = 0;
    int x = -1, y = -1;
    do {
        if (p == v)x = count;
        if (q == v)y = count;
        count++;
    } while (next_permutation(v.begin(), v.end()));

    cout << abs(x - y) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func intArray(n []string) []int {
	var m []int
	for i, _ := range n {
		v, _ := strconv.Atoi(n[i])
		m = append(m, v-1)
	}
	return m
}

func intExistIn(v int, arr []int) bool {
	for _, a := range arr {
		if a == v {
			return true
		}
	}

	return false
}

func gcd(m, n uint64) uint64 {
	x := new(big.Int)
	y := new(big.Int)
	z := new(big.Int)
	a := new(big.Int).SetUint64(m)
	b := new(big.Int).SetUint64(n)
	return z.GCD(x, y, a, b).Uint64()
}

func main() {
	// sc.Split(bufio.ScanWords)
	// strings.Split(nextLine(), " ")

	N := nextInt()

	var nums []int

	for i := 0; i < N; i++ {
		nums = append(nums, nextInt())
	}

	for len(nums) > 1 {
		tmp := nums[0:2]
		nums = nums[2:]

		x := gcd(uint64(tmp[0]), uint64(tmp[1]))
		mx := uint64(tmp[0]) / x * uint64(tmp[1])

		nums = append(nums, int(mx))
	}

	fmt.Println(nums[0])
}


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

const int MAX = 1000000;

int main() {
    long long N;
    std::cin >> N;

    std::vector<bool> prime(MAX, true);

    for (int i = 2; i <= MAX; i++) {
        if (prime[i] == false) continue;
        for (int j = i + i; j <= MAX; j += i) {
            prime[j] = false;
        }
    }

    int ans = 0;
    for (int i = 2; i <= MAX; i++) {
        if (prime[i] == false) continue;
        long long x = i;
        while (N % x == 0) {
            N /= x;
            x *= i;
            ans++;
        }
    }

    if (N > MAX) ans++;
    std::cout << ans << "\n";
}

Measured memory_bytes: 3756
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <deque>
#include <list>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define pb push_back
#define mp make_pair
#ifdef GRAPH
typedef pair <int, int> Edge;
#define v first
#define w second
#endif
using LL = long long;
using ULL = unsigned long long;
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define rep(i, n) for (int (i) = 0; (i) < n; (i)++)
#define until(x) while (!x)
#define fail(s) assert(!s)
const int INF = 0x3f3f3f3f;
const int EPS = 1e-6;

int main()
{
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	cout << max(a + b, max(a - b, a * b)) << endl;
	return 0;
}



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

int h,w,m,sz;
vector<int> ob[300005];

int dat[1200005];

void upd(int pos,int val){
    pos+=sz-1;
    dat[pos]+=val;
    while(pos>1){
        pos>>=1;
        dat[pos]=max(dat[pos<<1],dat[pos<<1|1]);
    }
}

int qry(int bk,int l,int r,int ql,int qr){
    if(qr<l||r<ql)return 0;
    if(ql<=l&&r<=qr)return dat[bk];
    return max(qry(bk<<1,l,(l+r)>>1,ql,qr),qry(bk<<1|1,((l+r)>>1)+1,r,ql,qr));
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>h>>w>>m;
    sz=1;while(sz<w)sz<<=1;
    while(m--){
        int x,y;
        cin>>x>>y;
        ob[x].emplace_back(y);
        upd(y,1);
    }
    int ans=0;
    for(int i=1;i<=h;i++){
        for(int &j:ob[i])upd(j,-1);
        ans=max(ans,(int)ob[i].size()+qry(1,1,sz,1,sz));//cerr<<ob[i].size()<<' '<<qry(1,1,sz,1,sz)<<endl;
        for(int &j:ob[i])upd(j,1);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 22380
#include<bits/stdc++.h>
#define ll long long int
 
using namespace std;
 
int main(){
	string s,t;
	cin>>s>>t;
	ll dp[3003][3003];
	for(ll i=1;i<=s.size();i++){
		for(ll j=1;j<=t.size();j++){
			if(s[i-1]==t[j-1]){
				dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	string ans="";
	ll i=s.size();
	ll j=t.size();
	while(i>=1 && j>=1){
			if(s[i-1]==t[j-1]){
				ans=s[i-1]+ans;
				i--;j--;
			}
			else{
				if(dp[i-1][j]>=dp[i][j-1]){
					i--;
				}
				else{
					j--;
				}
			}
		}
	
	cout<<ans;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;
    vector<ll> A(N);

    REP(i, N)
        cin >> A.at(i);

    ll count = 0;

    REP(i,N){
        if(A.at(i)<0){
            count++;
        }
    }

    ll ans = 0;
    if (count == 0)
    {
    }
    else if(count==1){
        sort(A.begin(), A.end());
        if(abs(A.at(0))>abs(A.at(1))){
            A.at(0) *= -1;
            A.at(1) *= -1;
        }
    }
    else if(count%2==0){
        sort(A.begin(), A.end());
        REP(i,count){
            A.at(i) *= -1;
        }
    }
    else{
        sort(A.begin(), A.end());
        REP(i, count-1)
        {
            A.at(i) *= -1;
        }
        if(count==A.size()){
        }
        else{
            if (abs(A.at(count-1)) > abs(A.at(count)))
            {
                A.at(count) *= -1;
                A.at(count - 1) *= -1;
            }
        }

    }
    REP(i, N)
    ans += A.at(i);
    cout << ans << endl;
}


Measured memory_bytes: 1024
/*
______________________________
                              |
Shubham Singhal               |
                              |
CodeChef          torque      |
HackerEarth       torque      |
SPOJ              torque      |
HackerRank        torquecode  |
CodeForces        torquecode  |
AtCoder           torque            |
______________________________| */


// If Tyrion dies, I am gonna riot :P


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

# define MOD         1000000007
# define gc          getchar
# define LL          long long
# define L           long
# define pb          push_back
# define mp          make_pair
# define vi          vector<int>
# define MAXN        100005
# define INF         1e9



int main()
{

    int a[3],c1=0,c2=0;
    for(int i=0;i<3;i++)
    {
        cin>>a[i];
        if(a[i]==5)
            c1++;
        else if(a[i]==7)
            c2++;
    }
    if(c1==2 && c2==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";

    return 0;
}


Measured memory_bytes: 764
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,n) for(int i=(1);i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 200005;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Test.insert(x)late ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}

/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    sort(rall(v));
    int ans=1,cnt=0;
    for(int i=0;i<n-1;){
        if(v[i]==v[i+1]&&cnt<2){
            ans*=v[i];
            i+=2;
            cnt++;
        }
        else i++;
    }
    if(cnt==2)cout<<ans;
    else cout<<0;
    return 0;
}


Measured memory_bytes: 3976
<?php
  $a = explode(" ", trim(fgets(STDIN)));

  sort($a);

  $a1 = $a[2]-$a[0];
  $a2 = $a[2]-$a[1];

  $ans = intdiv($a1, 2);
  $ans += intdiv($a2, 2);

  if($a1 % 2 == 1 && $a2 % 2 == 1){
    $ans += 1;
  }else if($a1 % 2 == 1 || $a2 % 2 == 1){
    $ans += 2;
  }
  echo $ans;

Measured memory_bytes: 15948
#include<stdio.h>

int main(){

	long n;
	scanf("%d",&n);
	int dsum=0;
	long tmp=n;
	while(n!=0){
			dsum+=n%10;
			n-=n%10;
			n=n/10;
	}
	if(tmp%dsum==0)puts("Yes");
	if(tmp%dsum!=0)puts("No");
	return 0;
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }

int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll res = min(A, B) + min(C, D);
    cout << res << "\n";
}


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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  ll a;
  string b;
  cin >> a >> b;

  ll c = 0;
  rep(i, 4) {
    if (i == 1) continue;
    int x = b[i] - '0';
    if (i == 0) x *= 100;
    if (i == 2) x *= 10;
    if (i == 3) x *= 1;
    c += x;
  }

  ll ans = a * c / 100;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588