akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}

	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=998244353;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=1e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=4e3+10;
	//------------------FIXED------------------
	typedef bitset<N> bs;
	bool operator <= (bs a,bs b)
	{
		fd(i,N-1,0) if(a[i]!=b[i]) return a[i]<b[i];
		return 1;
	}
	char str[N];int ln;
	void read(bs &ret){ scanf("%s",str+1);ln=strlen(str+1);fo(i,1,ln) ret[ln-i]=(str[i]-'0'); }
	void main()
	{
		int n=qread();bs MX;read(MX);int L=ln;
		bs gcd;read(gcd);int ln1=ln;
		fo(i,2,n)
		{
			bs now;read(now);int ln2=ln;
			while(1)
			{
				if(ln1>ln2) swap(ln1,ln2),swap(gcd,now);
				now^=gcd<<(ln2-ln1);while(ln2 and now[ln2-1]==0) ln2--;if(ln2==0) break;
			}
		}
		if(ln1>L){write(1);return;}//0
		ll ans=0;int z=L-ln1+1;
		bs now;fd(i,L-1,L-z) {ans=(ans*2+MX[i])%MOD;if(MX[i]^now[i]) now^=gcd<<(i-ln1+1);}
		if(now<=MX) add(ans,1);write(ans);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s\n",1.0*clock()/CLOCKS_PER_SEC);
}

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

int main(){
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
    sort(vec.begin(), vec.end());
    cout << vec.at(0) << " "<< vec.at(1) <<  " " << vec.at(2) << endl;
    return 0;
}


Measured memory_bytes: 3148
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)



int main() {
	lint a, b, c;
	cin >> a >> b >> c;
	if (4 * a * b < (c - a - b) * (c - a - b) && c - a - b>0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

int main() {
  int n, u = 0, s = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l;
    cin >> l;
    u = max(u, l);
    s += l;
  }
  cout << (u * 2 < s ? "Yes" : "No") << endl;
}


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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
vector<T> Vec(int n, T v)
{
    return vector<T>(n, v);
}
template <class... Args>
auto Vec(int n, Args... args)
{
    auto val = Vec(args...);
    return vector<decltype(val)>(n, move(val));
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> a(N);
    ll maxi = -1;
    int maxind = -1;
    using P = pair<int, int>;
    vector<P> q;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (abs(maxi) < abs(a[i])) {
            maxi = a[i];
            maxind = i;
        }
    }
    if (maxi < 0) {
        for (int i = 0; i < N; i++) {
            if (a[i] > 0) {
                q.push_back({maxind, i});
            }
        }
        for (int i = N - 1; i >= 1; i--) {
            q.push_back({i, i - 1});
        }
    } else {
        for (int i = 0; i < N; i++) {
            if (a[i] < 0) {
                q.push_back({maxind, i});
            }
        }
        for (int i = 0; i < N - 1; i++) {
            q.push_back({i, i + 1});
        }
    }
    cout << q.size() << endl;
    for (const P& p : q) {
        cout << p.first + 1 << " " << p.second + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int a, b;
  cin >> a >> b;
  if ((a * b) % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
'''
ITP-1_5-C
 ?????§?????????????????????
??\????????????????????????H cm ?????? W cm ????????§????????????????????¢?????????????????°?????????????????????????????????
#.#.#.#.#.
.#.#.#.#.#
#.#.#.#.#.
.#.#.#.#.#
#.#.#.#.#.
.#.#.#.#.#
?????????????????? 6 cm ?????? 10 cm ???????????¢?????¨??????????????????
????????¢???????????? "#" ??¨????????????????????????????????????
???Input
??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????
H W
H, W ?????¨?????? 0 ?????¨????????\?????????????????¨????????????
???Output
?????????????????????????????????????????? H cm ?????? W cm ?????????????????????????????????
?????????????????????????????????????????????????????\??????????????????
'''
# import
import sys

for line in sys.stdin:
    # ?????°??????????????????
    H, W = map(int, line.split())
    if H == 0 and W == 0:
        break
    # ?????¢??????
    for a in range(H):
        # ?\???°?????????
        if a%2 == 1:
            for b in range(W):
                if b%2 == 1:
                    # ??????????????§'#'??????
                    print('#', end='')
                else:
                    # ??????????????§'.'??????
                    print('.', end='')
            # ???????????????????????????
            print('')
        # ??¶??°?????????
        else:
            for c in range(W):
                if c%2 == 1:
                    # ??????????????§'.'??????
                    print('.', end='')
                else:
                    # ??????????????§'#'??????
                    print('#', end='')
            # ???????????????????????????
            print('')
    # ????????????????????????
    print('')

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    vector<ll> a(2), b(2), c;
    rep(i, 2) cin >> a[i];
    rep(i, 2) cin >> b[i];
    rep(i, 2) {
        rep(j, 2) {
            c.PB(a[i]*b[j]);
        }
    }
    sort(ALL(c));
    cout << c[3] << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


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

int deg[10000], N, ans[10000], cnt, c[10000];
vector<int> G[10000];
queue<int> que;

void solve(void){
	for(int i=0; i<N; i++){
		if(deg[i] == 1) que.push(i);
	}
	while(que.size()){
		int a = que.front(); que.pop();
		ans[a] = c[cnt]; cnt++;
		for(int i=0; i<G[a].size(); i++){
			deg[G[a][i]]--;
			if(deg[G[a][i]] == 1) que.push(G[a][i]);
		}
	}
}

int main(){
	cin >> N;
	for(int i=0; i<N-1; i++){
		int a, b; cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
		deg[a]++; deg[b]++;
	}
	int sum = 0;
	for(int i=0; i<N; i++){ cin >> c[i]; sum += c[i];}
	sort(c, c+N);
	sum -= c[N-1];
	solve();
	cout << sum << endl;
	for(int i=0; i<N; i++){
		cout << ans[i] << " ";
	}
	return 0;
}


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

using namespace std;
typedef long long ll;
#define MOD 1000000007

int main()
{
  string s;
  cin >> s;
  if (s == "ABC")
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "ABC" << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
#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 ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, W; cin >> N >> W;
	vl w(N + 1), v(N + 1);
	FOR(i, 1, N + 1) cin >> w[i] >> v[i];
	vvl dp(N + 1, vl(1e5 + 10, numeric_limits<ll>::max()));
	dp[0][0] = 0;
	FOR(i,1,N + 1) {
		FOR(j,0,1e5 + 10) {
			dp[i][j] = dp[i - 1][j];
			if (j - v[i] >= 0 && dp[i - 1][j - v[i]] != numeric_limits<ll>::max()) {
				dp[i][j] = min(
					dp[i][j],
					dp[i - 1][j - v[i]] + w[i]
				);
			}
		}
	}
	int ans = 0;
	FOR(j,0,1e5 + 10) {
		if (dp[N][j] <= W) {
			ans = j;
		}
	}
	cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 80256
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).ok();
    return word.trim().to_string();
}

fn main() {
    let a:u32 = get_input().parse().unwrap();
    let b:u32 = get_input().parse().unwrap();
    let h:u32 = get_input().parse().unwrap();
    
    println!("{}", (a+b)*h/2);
}

Measured memory_bytes: 4352
#include <cmath>
#include <iostream>

int main(int argc, char *argv[]) {
  int d, n;
  std::cin >> d >> n;
  int b = pow(100, d);
  if (n == 100)
    std::cout << b * (n + 1) << std::endl;
  else
    std::cout << b * n << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	int ans = 1<<30;
	for(int i = 1; i <= 100; i++){
		int now = 0;
		for(int j = 0; j < n; j++){
			int d = abs(i - a[j]);
			now += d * d;
		}
		ans = min(ans, now);
	}
	cout << ans << '\n';
	return 0;
}


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

int main()
{
  int N, M;
  map<string, int> s, t;
  int res=0;
  cin >> N;
  rep(i,N){
    string sin;
    cin >> sin;
    auto it=s.find(sin);
    if(it==s.end()) s.insert(make_pair(sin, 1));
    else it->second++;
  }
  cin >> M;
  rep(i,M){
    string tin;
    cin >> tin;
    auto it=t.find(tin);
    if(it==t.end()) t.insert(make_pair(tin,1));
    else it->second++;
  }

  for(auto it=s.begin();it!=s.end();it++){
    int gain = it->second;
    auto itr_t = t.find(it->first);
    if(itr_t!=t.end()) gain -=itr_t->second;
    res = max(res,gain);
  }
  cout << res << endl;

}

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 count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35984
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
map<int, int>M; int n, m, a; vector<int>v; vector<pair<int, int>>G;
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a; M[a] = i; v.push_back(a);
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (int i = 0; i < v.size(); i++) {
		G.push_back(make_pair(-M[v[i]], v[i]));
	}
	sort(G.begin(), G.end());
	for (int i = 0; i < min((int)G.size(), m); i++) {
		cout << G[i].second << endl;
	}
	return 0;
}

Measured memory_bytes: 8840
n = int(input())
S = [list(input()) for i in range(n)]
al = "abcdefghijklmnopqrstuvwxyz"
ans = ""
for i in range(26):
    cnt = 100
    for j in range(n):
        cnt = min(cnt, S[j].count(al[i]))
        if cnt == 0:
            break
    ans += al[i]*cnt
print(ans) 

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


int main(){
    ll a,b,c,k;cin>>a>>b>>c>>k;
    if(a>=k)cout<<k<<endl;
    else if(a+b>=k)cout<<a<<endl;
    else cout<<a-(k-a-b)<<endl;

    
}

    









Measured memory_bytes: 3636
using System;
using System.IO;
using System.Collections.Generic;

class Test{
  static void Main() {
 var n = int.Parse(Console.ReadLine());
  var arr = Console.ReadLine().Split(' ');
var list = new List<int>();
foreach(var k in arr) {
list.Add(int.Parse(k));
}
var current = n + 1;
var count = 0;
foreach (var p in list){
if(current > p){
 current = p;
  count++;
}
}

Console.WriteLine(count);
}
}

Measured memory_bytes: 33500
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    vec l(n), r(n);

    for (int i = 1; i < n; i++) {
        l[i] = l[i-1];
        if (s[i-1] == 'W') l[i]++;
    }

    for (int i = n-2; i >= 0; i--) {
        r[i] = r[i+1];
        if (s[i+1] == 'E') r[i]++;
    }

    int res = INF;

    rep(i, n) {
        res = min(res, l[i] + r[i]);
    }

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

Measured memory_bytes: 2948
#include<bits/stdc++.h>
#define endl '\n';
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  string S = "255456376";
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  for(int i=0; i<M; i++){
    cin >> A[i];
  }
  vector<string> dp(11000,"-");
  dp[0] = "";
  for(int i=0; i<=N; i++){
    if(dp[i] == "-") continue;
    for(int m: A){
      if(dp[i+S[m-1]-'0'] == "-"){
        dp[i+S[m-1]-'0'] = dp[i] + to_string(m);
      }else if(dp[i+S[m-1]-'0'].size() < dp[i].size()+1){
        dp[i+S[m-1]-'0'] = dp[i] + to_string(m);
      }else if(dp[i+S[m-1]-'0'] < dp[i]+to_string(m)){
        dp[i+S[m-1]-'0'] = dp[i] + to_string(m);
      }
    }
  }
  cout << dp[N] << endl;
  return 0;
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main(){
    int n;
    cin >>n;
    vector<int> a(n+1);
    vector<int> b(n);
    rep(i,n+1) cin >>a[i];
    rep(i,n) cin >>b[i];
    long long ans=0;
    rep(i,n){
        ans += min(a[i],b[i]);
        b[i]-=min(a[i],b[i]);
        ans+= min(a[i+1],b[i]);
        a[i+1]-= min(a[i+1],b[i]);
    }

    cout << ans <<endl;
}

Measured memory_bytes: 1024
N = int(input())
H = list(map(int, input().split()))

MAX = 10 ** 4 + 1
dp = [MAX] * N
dp[0] = 0
dp[1] = abs(H[1] - H[0])

for i in range(2, N):
  dp[i] = min(dp[i-2] + abs(H[i]-H[i-2]), dp[i-1] + abs(H[i]-H[i-1]))

print(dp[N-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<62;
const double eps=1e-5;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	int n;cin>>n;
	vector<ll> a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	ll g=a[0];
	for(int i=1;i<n;i++){
		g=__gcd(a[i],g);
	}
	cout<<g<<endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int H, W;
        while(true){
            H = scan.nextInt();
            W = scan.nextInt();
            if(H == 0 && W == 0) break;
            drawRectangle(H, W);
            System.out.println();  
        }
    }
    public static void drawRectangle(int H, int W){
        for(int i = 0; i < H; i++){
            for(int k = 0; k < W; k++){
                System.out.print("#");
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 32824
import math

N=int(input())
p=[]
for i in range(N):
    x,y=map(int,input().split())
    p.append([x,y])

L=0
for i in range(N-1):
    for j in range(i+1,N):
        L += ((p[i][0]-p[j][0])**2 + (p[i][1]-p[j][1])**2 )**0.5

print(2*L/N)


Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader 
    { 
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} 
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];} 
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;} 
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();} 
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;} 
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;} 
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } 
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } 
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }
    
    
 
           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        int n=sc.i();
        int p=sc.i();
        HashMap<Integer,Integer> hm=new HashMap<>();
        for(int i=1;i<=n;i++)
        hm.put(i%p,hm.getOrDefault(i%p,0)+1);
        long ans=0;
        for(int i=1;i<=n;i++)
        {
            if(((p-i%p)%p)%p==i%p)
            ans+=(long)hm.getOrDefault((p-i%p)%p,0)*(long)hm.getOrDefault((p-i%p)%p,0);
        }
        out.println(ans);
        out.flush();
    }
}

Measured memory_bytes: 30676
#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    double r ;
    cin >> r ;
    const double PI=3.14159265358979323846;

    cout << 2 * PI * r << endl;
    return 0 ;
}

 


Measured memory_bytes: 3788
# dpC
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
    dp = [[0] * 3 for _ in range(n)]
    dp[0] = A[0]
    for i in range(1, n):  # i-th day
        for j in range(3):  # today
            for k in range(3):  # yesterday
                if j != k:
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + A[i][j])
    print(max(dp[-1]))


if __name__ == "__main__":
    main()

Measured memory_bytes: 71516
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;

ll a[500010];
ll sum=1;
ll inf=1e18;
int main()
{
    int k=0;
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            k=1;
        }
    }
    if(k==1)
    {
        cout<<0<<endl;
        return 0;
    }
    for(int i=0; i<n; i++)
    {
        if(a[i]>inf/sum)
        {
            cout<<-1<<endl;
            return 0;
        }
        sum=sum*a[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4372
a, b, k = list(map(int, input().split()))

ans = set([])
for i in range(a, min(a+k, b+1)):
    ans.add(i)
for i in range(max(a, b-k+1), b+1):
    ans.add(i)
for a in sorted(list(ans)):
    print(a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

int k;
int cnt;

vector<vector<int>> grid_bfs(int h,int w,int x,int y,vector<string> &maze,char obstacle='#') {
  const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };//4方向移動
  const int init=1e7;
  vector<vector<int>>d(h,vector<int>(w,init));
  d[x][y]=0;
  queue<pair<int, int>>q;
	pair<int, int>p;
  q.emplace(x,y);
	while (!q.empty()) {
		p = q.front();
		q.pop();
		for (int i = 0; i < 4; ++i) {
			REP(j,1,k+1){
				int nx = p.first+dx[i]*j; int ny = p.second+dy[i]*j;
				if(!(0 <= nx && nx < h && 0 <= ny && ny < w))break;
				if(maze[nx][ny]==obstacle)break;
				if (d[nx][ny] == init) {
					cnt=0;
					q.emplace(make_pair(nx, ny));
					d[nx][ny] = d[p.first][p.second] + 1;
				}
				else ++cnt;
				if(cnt>=1000)break;
			}
		}
	}
  return d;//initを含むことに注意
}

void solve()
{
	int h,w;
	cin>>h>>w>>k;
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	x1--;y1--;
	x2--;y2--;
	cnt=0;
	vector<string>c(h);
	rep(i,h)cin>>c[i];
	auto d=grid_bfs(h,w,x1,y1,c,'@');
	ll ans=d[x2][y2];
	if(ans==1e7)cout<<-1;
	else cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 12168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int K = sc.nextInt();//好きな数字
		//
		int num = 7;
		int ans = -1;
		for (int i = 1; i <= K; i++) {
			if (num % K == 0) {
				ans = i;
				break;
			}
			num = (num * 10 + 7) % K;
		}
		System.out.println(ans);

	}

}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

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

    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    if(a[0] == a[1]  &&  a[1] != a[2])cout << "Yes";
    else if(a[1] == a[2]  &&  a[0] != a[2])cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int int 
#define ff(i,a,b) for (int i = a; i < b; i++) 
#define bf(i,a,b) for (int i = a; i >= b; i--) 
#define aint(v) v.begin(),v.end() 
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define F first 
#define S second
#define pb push_back
#define mp make_pair
#define lb lower_bound   
#define ub upper_bound
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define one cout<<"-1"<<endl
#define pi 3.141592653589793238
#define mod 1000000007
#define intmx INT_MAX 
#define intmi INT_MIN
void solve(){
    double d,t,s;
    cin>>d>>t>>s;
    if(d/s<=t)
    yes;
    else
    no;
}
signed main() {
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3708
from collections import defaultdict
import queue

def main():
    N,M = [int(x) for x in input().split()]
    vum = defaultdict(list)
    for i in range(M):
        a,b = [int(x) for x in input().split()]
        vum[a].append(b)
        vum[b].append(a)
        
    ### bfs ###
    q = queue.Queue()
    F = [-1]*N # 道標の先の部屋
    s = 1 # 始点
    while True:
        for v in vum[s]:
            if F[v-1] < 0:
                q.put(v)
                F[v-1] = s
        if q.empty():
            break
        s = q.get()

    if -1 in F[1:]:
        print('No')
    else:
        print('Yes')
        for f in F[1:]:
            print(f)

if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long MOD = 1000000007;

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

    ll h;
    cin >> h;
    ll n = 1;
    ll ans = 0;
    while (h > 1) {
        ans += n;
        h /= 2;
        n *= 2;
    }
    cout << ans + n;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <vector>
#include <sstream>

using namespace::std;

void inputNums(vector<int> &nums){
  string input;

  getline(cin, input);

  stringstream ss(input);

  string buf;

  while(!ss.eof()){
    ss >> buf;
    nums.push_back(stoi(buf));
  }

}

int main(void){
  vector<int> num;

  inputNums(num);

  int res =  num.at(0) % num.at(1);
  if(res !=0)res=1;//>= num.at(1)) res/=(num.at(1)-1);

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



Measured memory_bytes: 256
N = int(input())
As = list(map(int,input().split()))
Bs = list(map(int,input().split()))
Cs = list(map(int,input().split()))

As.sort(reverse = True)
Bs.sort(reverse = True)
Cs.sort(reverse = True)

ls = [0]
sum = 0
for i in range(N):
    l = 0
    r = N-1
    while(r-l>1):
        mid = (l+r)//2
        if Cs[mid] <= Bs[i]:
            r = mid
        else:
            l = mid
    if Cs[0] <= Bs[i]:
        r = 0
    if Cs[N-1] > Bs[i]:
        r = N
    sum += r
    ls.append(sum)

ans = 0
for i in range(N):
    l = 0
    r = N-1
    while(r-l>1):
        mid = (l+r)//2
        if Bs[mid] <= As[i]:
            r = mid
        else:
            l = mid
    if Bs[0] <= As[i]:
        r = 0
    if Bs[N-1] > As[i]:
        r = N
    ans += ls[r]

print(ans)


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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

using namespace std;

const int N = 200100;
int n, k, a[N];
long long ans;

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	}

	a[0] = -1;
	for(int i = 1; i <= n; i++) {
		if(a[i] - a[i - 1] > 1) {
			cout << -1 << '\n';
			return 0;
		}
		if(a[i] - a[i - 1] == 1) ans++;
		else ans += 1LL * a[i];
	}

	cout << ans - 1 << '\n';
}	

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f

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


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

ll dp[2][110][50];  /* dp[id][i+1][j] : 先頭からi桁目までで0でない数がj個現れるs以下の数の個数。
                                       ただし、id = 0 のとき現時点でsと等しい。
                                       id = 1 のとき現時点でsより小さいことが確定。 */

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    ll k;
    cin >> S >> k;
    ll n = S.size();

    dp[0][0][0] = 1;
    rep(id, 2){
        rep(i, n){
            rep(j, 4){
                ll lim = S[i]-'0';
                if(id) lim = 9;
                for(ll x = 0; x <= lim; x++){
                    dp[id || (x < lim)][i+1][j + (x != 0)] += dp[id][i][j];
                }
            }
        }
    }

    ll ans = 0;
    rep(id, 2){
        ans += dp[id][n][k];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void){
  int n;
  int i;
  double sum=0;
  double x[10];
  char u[3];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf %s",&x[i],u);
    if(u[0]=='B'){
      sum=sum+380000.0*x[i];
    }
    else{
      sum=sum+x[i];
    }
  }
  printf("%f",sum);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
#include <ctype.h>
using namespace std;

#define PI acos(-1.0)
#define EPS 1e-8
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

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

template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
    return os << "(" << P.fi << "," << P.se << ")";
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
    os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}

struct Matrix {
    vvi data;
    int r, c;
    Matrix(int row, int col, bool identity = false) : r(row), c(col) {
        data.assign(row, vector<int>(col, 0));
        if (identity) {
            for (int i = 0; i < r; ++i) {
                data[i][i] = 1;
            }
        }
    }
    Matrix operator * (Matrix& other) {
        int m = r, n = c, p = other.c;
        Matrix res(m, p);
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < p; ++j) {
                for (int k = 0; k < n; ++k) {
                    res.data[i][j] += data[i][k] * other.data[k][j];
                }
            }
        }
        return res;
    }
};

// 扩展欧几里得算法 res[1] * a + res[2] * b = res[0] = gcd(a, b)
vector<int> extendGcd(int a, int b) {
    if (b == 0) {
        return {a, 1, 0};
    } else {
        vector<int> tmp = extendGcd(b, a % b);
        return {tmp[0], tmp[2], tmp[1] - (a / b) * tmp[2]};
    }
}

// 矩阵快速幂
Matrix matrix_power(Matrix base, ll exp) {
    int n = base.r;
    Matrix res(n, n, true);
    while (exp) {
        if (exp & 1) {
            res = res * base;
        }
        base = base * base;
        exp >>= 1;
    }
    return res;
}

// 带模快速幂
template <typename T>
T power_mod(T base, int exp, int mod = MOD) {
    T res = 1;
    while (exp) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

// 快速幂
template <typename T>
T power(T base, int exp) {
    T res = 1;
    while (exp) {
        if (exp & 1) res *= base;
        base *= base;
        exp >>= 1;
    }
    return res;
}

// 求逆元
ll inv(ll a) {
    return power_mod(a, MOD - 2);
}

/******************************** template ********************************/
#define N 100010
int n, a;

int main() {
    cin >> n >> a;
    n %= 500;
    if (n <= a) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1e9+7;
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll solve(ll x){
    ll ans=0;
    for(int i=1;i<=10;i++){
        ll n=x*i;
        ans+=(x%10);
    }
    return ans;
}
int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    long double A[n];
    for(int i=0;i<n;i++)cin>>A[i];
    long double x=0;
    for(int i=0;i<n;i++){
        x+=(1/A[i]);
    }
   // cout<<x<<endl;
    x=(1/x);
    cout<<fixed<<setprecision(10)<<x;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
template<typename A, typename B> bool cmin(A &a, const B &b) { if (a > b) { a = b; return true; } else return false; }
 
main {
  int h,w;
  while(cin>>h>>w,h){
    int r=h*h+w*w;
    for(int f=0;;r++,f++) loop(H, 1, r) {
      if (!f&&H<=h) continue;
      int U=r-H*H;
      if (U>H*H) for(int i=0;i*i<=U;i++) if (i*i==U) {
         cout<<H<<' '<<sqrt(U)<<endl;
          goto a;
       }
     }
a:;
  }
  bye;
}

Measured memory_bytes: 3232
#include <iostream>
using namespace std;
 
int main (){
 char S[4];
  int ans = 0;
   for(int i = 0;i<4;i++){
   	cin >> S[i];
      if(S[i] == S[i-1]){
        ans = 1;
      }
   }
  	if (ans == 1){
    	cout << "Bad";
    }
  	else{
    	cout << "Good";
    }
      
}

Measured memory_bytes: 256
//Awwawa! Dis cold yis ratten buy tEMMIE!
#include <bits/stdc++.h>
#define ll long long
#define maxn 305 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

using namespace std;
ll ksm(ll a, ll b) {
   if (!b) return 1;
   ll ns = ksm(a, b >> 1);
   ns = ns * ns % mod;
   if (b & 1) ns = ns * a % mod;
   return ns;
}
int n, a;
char inp[maxn];
int dp[maxn][maxn][maxn]; // 长度 还没匹配啥 几个1 
int fl[maxn][maxn][maxn]; // 从 j 到 n， 提取出 x 个 1 y 个 b 
int mx[maxn][maxn];
int ed[maxn];
int main() {
	scanf("%s", inp + 1);
	int l = strlen(inp + 1);
	for (int i = l; i >= 1; i--) {
		ed[i] = ed[i + 1];
		if (inp[i] == '1') ed[i]++;
	}
	dp[0][l][0] = 1;
	for (int i = 0; i <= l; i++)
		for (int j = 0; j <= l; j++)
			for (int k = 0; k <= i; k++)
				for (int s = 0; s < 2; s++) {
					int ei = i + 1, ej = j, ek = k;
					if (s == 1) ek++;
					if (s == inp[j] - '0') ej--;
					dp[ei][ej][ek] = (dp[ei][ej][ek] + dp[i][j][k]) % mod;
				}
	fl[1][0][0] = 1;
	for (int i = 1; i <= l + 1; i++)
		for (int j = l; j >= 0; j--) // j : 0 k : 1
			for (int k = l; k >= 0; k--) {
				if (!fl[i][j][k]) continue;
				mx[l + 1 - i + j + k][k + ed[i]] = i;
				if ((j + k) >= 2) {
					if (j) fl[i][j - 1][k] = 1;
					if (k) fl[i][j][k - 1] = 1;
					//填上一项 
				}
				if (i != l + 1) {
					//后面选一个
					int um = inp[i] - '0';
					if (j) {
						if (um == 1) fl[i + 1][j - 1][k + 1] = 1;
						if (um == 0) fl[i + 1][j][k] = 1;
						fl[i + 1][j][k] = 1;
					} 
					if (k) {
						if (um == 1) fl[i + 1][j][k] = 1;
						if (um == 0) fl[i + 1][j + 1][k - 1] = 1;
						fl[i + 1][j][k] = 1;
					}
				}
				if (i <= l - 1) {
					int um = inp[i] - '0', vm = inp[i + 1] - '0';
					if (um == 1 || vm == 1) fl[i + 2][j][k + 1] = 1;
					if (um == 0 || vm == 0) fl[i + 2][j + 1][k] = 1;
				}
			}
	ll ans = 0;
	for (int i = 1; i <= l; i++)
		for (int j = 0; j <= i; j++)
			if (mx[i][j]) {
				for (int u = mx[i][j] - 1; u >= 0; u--)
					ans += dp[i][u][j], 
					ans %= mod;	
			}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 140976
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n;
    std::cin >> n;
    vector<ll> a(n),b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i]>>b[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    
    if(n%2==1){
        std::cout << b[n/2]-a[n/2]+1 << std::endl;
    }else{
        std::cout << b[n/2-1]+b[n/2]-a[n/2-1]-a[n/2]+1 << std::endl;
    }
}


Measured memory_bytes: 6356
#include<stdio.h>

int main(){
  int ai, min,max, i,n;
  long sum;
 sum = 0;
 scanf("%d", &n);
 for(i= 0; i<n; i++){
   scanf("%d", &ai);
   if(i == 0){min =max = ai;}
   if(min > ai){min = ai;}
   if(max < ai){max = ai;}
   sum = sum + ai;
 }
 printf("%d %d %ld\n", min, max, sum);
 return 0;
}
  
  

Measured memory_bytes: 600
"use strict";

function main(arg) {
    const N = arg.split("\n")[0].split(" ");
    
    for(let i=0; i<N.length; i++) {
        if(N.filter(n=>n==N[i]).length == 1) {
           console.log(N[i]);
           return;
       }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11468
<?php
	fscanf(STDIN,"%s", $str);

	$A = substr($str, 0, 1);
	$B = substr($str, 1, 1);
	$C = substr($str, 2, 1);
	$D = substr($str, 3, 1);


	$w1 = array($A + $B, $A - $B);

	$w2 = array($C + $D, $C - $D);

	for ($i = 0; $i < 2; $i++){

		for($j = 0; $j < 2; $j++){
			if ($w1[$i] + $w2[$j] === 7){
				if ($i === 0){
					if ($j === 0){
						echo "$A+$B+$C+$D=7\n";
						return;
					}else{
						echo "$A+$B+$C-$D=7\n";
						return;					}
				}else{
					if ($j === 0){
						echo "$A-$B+$C+$D=7\n";
						return;
					}else{
						echo "$A-$B+$C-$D=7\n";
						return;
					}
				}
			}elseif($w1[$i] - $w2[$j] === 7){
				if ($i === 0){
					if ($j === 0){
						echo "$A+$B-$C-$D=7\n";
						return;
					}else{
						echo "$A+$B-$C+$D=7\n";
						return;
					}
				}else{
					if ($j === 0){
						echo "$A-$B-$C-$D=7\n";
						return;
					}else{
						echo "$A-$B-$C+$D=7\n";
						return;
					}
				}
			}
		}


	}


Measured memory_bytes: 3576
#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 pq priority_queue
#define P pair<ll,ll>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n;
string s;

int main(){
	cin >> s >> n;
	for(char c='a';c<='z';c++) REP(i,0,s.size()) if(s[i]>c and n>=('z'-'a'+1+c-'a')-(s[i]-'a')) n-=('z'-'a'+1+c-'a')-(s[i]-'a'),s[i]=c;
	cout << s.substr(0,s.size()-1) << (char)((s[s.size()-1]-'a'+n%26)%26+'a') << endl;
	return 0;
}


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

template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}

ll dp[51][51][3010];//dp[i][j][k] ... iまでのカードでj枚選んで合計がkであるような組み合わせ


int main(){
    int n, a;
    cin >> n >> a;
    vector<int> x(n);
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    dp[0][0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k < 2500; k++){
                if(dp[i][j][k]){
                    //カードを選ばない
                    dp[i+1][j][k] += dp[i][j][k];
                    //カードを選ぶ
                    dp[i+1][j+1][k+x[i]] += dp[i][j][k];
                }
            }
        }
    }

    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += dp[n][i][i*a];
    }

    cout << ans << endl;



}

Measured memory_bytes: 9600
#include <stdio.h>

int root,c[25][2];

void preParse(int);
void inParse(int);
void postParse(int);

int main()
{
  int n,id,left,right,s[25],p[25],i,j;

  /* input */
  scanf("%d",&n);

  /* 初期化 */
  for(j=0;j<n;j++){
    c[j][0]=-1;
    c[j][1]=-1;
    p[j]=-1;
    s[j]=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d %d",&left,&right);

    if(left!=-1){
      s[left]=right;
      p[left] = id;
    }
    if(right!=-1){
      s[right]=left;
      p[right] = id;
    }
    c[id][0]=left;
    c[id][1]=right;
  }

  /* root */
  for(j=0;j<n;j++){
    if(p[j]==-1) {
      root=j;
    }
  }

  /* output */
  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");
  return 0;
}

void preParse(int u){
  if (u == -1) return;
  printf(" %d",u);
  preParse(c[u][0]);
  preParse(c[u][1]);
}

void inParse(int u){
  if (u == -1) return;
  inParse(c[u][0]);
  printf(" %d",u);
  inParse(c[u][1]);
}

void postParse(int u){
  if (u == -1) return;
  postParse(c[u][0]);
  postParse(c[u][1]);
  printf(" %d",u);
}

Measured memory_bytes: 616