akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> f0(n), f1(n);
	ll mx0 = -INF, mi0 = INF, mx1 = -INF, mi1 = INF;
	rep(i,n){
		ll x, y;
		cin >> x >> y;
		f0[i] = x - y;
		f1[i] = x + y;
		chmax(mx0, f0[i]);
		chmin(mi0, f0[i]);
		chmax(mx1, f1[i]);
		chmin(mi1, f1[i]);
	}
	ll ans = mx0 - mi0;
	chmax(ans, mx1 - mi1);
	cout << ans << endl;
	return 0;
}

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

int main() {
  ll l, r;
  cin >> l >> r;
  r = min(r, l + 2019);
  int ans = 2019;
  for (ll i = l; i < r; i++) {
    for (ll j = i+1; j < r+1; j++) {
      int temp = i * j % 2019;
      ans = min(ans, temp);
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3564
import java.util.Scanner;

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

		n = sc.nextInt();
		sum = 0;
		f = true;
		
		for (int i = 0; i < n; i++) {
			String p = sc.next();
			int x = sc.nextInt();
			if (p.equals("(")) {
				sum += x;
			} else {
				sum -= x;
			}
			if (sum < 0) {
				f = false;
			}
		}
		if (sum != 0) {
			f = false;
		}

		System.out.println(f ? "YES" : "NO");
	}
}

Measured memory_bytes: 24924
def main():
    n, k, s = map(int, input().split())

    other = 0
    if s == 10**9:
        other = 10**9 - 1
    else:
        other = s + 1

    if n > k:
        ans = [s for _ in range(k)] + [other for _ in range(n-k)]
    else:
        ans = [s for _ in range(n)]

    print(*ans)

if __name__ == "__main__":
    main()

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

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

template <class Head>
void dbgLog(Head&& head) {
  cerr << head << endl;
}

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

#if DEBUG
  #define DLOG(...)        dbgLog(__VA_ARGS__)
  #define DFMT(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DFMT(...)
  #define DCALL(func, ...)
#endif

// operator<< definitions for some classes

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

template <typename T>
ostream& operator<< (ostream& os, const vector<T>& v) {
  os << '[';
  for (auto it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  os << ']';

  return os;
}

template <typename T, typename T2, typename T3>
ostream& operator<< (ostream& os, const priority_queue<T, T2, T3>& orig) {
  priority_queue<T, T2, T3> pq(orig);
  bool first = true;
  os << '[';
  while (!pq.empty()) {
    T x = pq.top(); pq.pop();
    if (!first) os << ", ";
    os << x;
    first = false;
  }
  return os << ']';
}

int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;
  ll ans = 0;
  if (K == 0) {
    cout << N*N << endl;
    return 0;
  }
  for (ll b = K + 1; b <= N; b++) {
    ll m = N / b;
    ll cnt = m * (b - K) + max(0LL, (N - b * m) - (K-1));
    DLOG(b, cnt);
    ans += cnt;
  }
  cout << ans << endl;

  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 repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

const int MOD = 1000000007;

struct mint {
  int x;
  mint(): x(0) {}
  mint(int a) { x = a % MOD; if (x < 0) x += MOD; }
  mint &operator+=(mint that) { x = (x + that.x) % MOD; return *this; }
  mint &operator-=(mint that) { x = (x + MOD - that.x) % MOD; return *this; }
  mint &operator*=(mint that) { x = (i64) x * that.x % MOD; return *this; }
  mint &operator/=(mint that) { return *this *= that.inverse(); }
  mint operator-() { return mint(-this->x); }
  friend ostream& operator<<(ostream &out, mint m) { return out << m.x; }
  mint 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 mint(u);
  }
  #define op(o, p) mint operator o(mint that) { return mint(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  #define op(o) bool operator o(mint that) const { return x o that.x; }
    op(==) op(!=) op(<) op(<=) op(>) op(>=)
  #undef op
};

mint dp[100010][4];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  string s;
  cin >> s;
  i32 n = s.size();
  dp[0][0] = 1;
  rep(i, n) {
    if (s[i] == 'A') dp[i + 1][1] += dp[i][0];
    if (s[i] == 'B') dp[i + 1][2] += dp[i][1];
    if (s[i] == 'C') dp[i + 1][3] += dp[i][2];
    if (s[i] == '?') {
      rep(j, 4) dp[i + 1][j] += dp[i][j] * 3;
      rep(j, 3) dp[i + 1][j + 1] += dp[i][j];
    } else {
      rep(j, 4) dp[i + 1][j] += dp[i][j];
    }
  }
  cout << dp[n][3] << endl;
  return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]!=t[i])
        {
            cnt++;

        }
    }
    cout<<cnt<<endl;



}


Measured memory_bytes: 3900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_N = 3e3 + 50, INF = 1e15, MOD = 1e9 + 7;
ll N, arr[max_N];
ll DP[max_N][max_N];

ll max_diff(ll s, ll e)
{
    if (s == e)
        return arr[s];
    if (e == s + 1)
        return abs(arr[s] - arr[e]);
    ll &res = DP[s][e];
    if (res != -INF)
        return res;
    ll opt1 = arr[s] + min(-arr[e] + max_diff(s + 1, e - 1), -arr[s + 1] + max_diff(s + 2, e));
    ll opt2 = arr[e] + min(-arr[e - 1] + max_diff(s, e - 2), -arr[s] + max_diff(s + 1, e - 1));
    return res = max(opt1, opt2);
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; ++i)
        fill(DP[i], DP[i] + max_N, -INF);
    for (int i = 0; i < N; ++i)
        cin >> arr[i];
    cout << max_diff(0, N - 1) << "\n";
    return 0;
}

Measured memory_bytes: 75248
#include <stdio.h>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
int main(){
  string S;
  cin>>S;
  long long num=0;
  long long numW=0;
  for(long long i=0;i<S.size();++i){
   	if(S[i]=='B'){
      
    }else{
      num+=(i-numW);
  	  ++numW;
    }
  }
  cout<<num<<endl;
  return 0;
}

Measured memory_bytes: 832
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <numeric>

int main() {
  int n;
  std::vector<int> l;

  std::cin >> n;
  for (auto i=0; i < n; i++) {
    int tmp;
    std::cin >> tmp;
    l.push_back(tmp);
  }

  auto max = *std::max_element(l.begin(), l.end());
  auto g = std::accumulate(l.begin(), l.end(), 0) - max;
  if (g > max) {
    std::cout << "Yes";
  } else {
    std::cout << "No";
  }


  return 0;
}


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

#define PI 3.1415926535897932

//typedef long long ll;


int lcm(int a,int b) { return a*b/__gcd(a,b); }
//ll lcm(ll a,ll b) { return a*b/__gcd(a,b); }
class UnionFind {
public:
    vector<int> parent;
    UnionFind(int n) {
        parent=vector<int>(n,-1);
    }

    int root(int a) {
        if (parent[a]<0) return a;
        return parent[a] = root(parent[a]);
    }

    int size(int a) {
        return -parent[root(a)];
    }

    bool connect(int a, int b) {
        a=root(a);
        b=root(b);
        if (a==b) return false;
        if (size(a)<size(b)) swap(a,b);
        parent[a]+=parent[b];
        parent[b]=a;
        return true;
    }
};


int main(){
    int mod=1000000007;
    int n,m;
    scanf("%d %d",&n,&m);
    vector<int> a(m), b(m);
    for (int i=0;i<m;i++) {
        scanf("%d %d",&a[i],&b[i]);
        a[i]--;
        b[i]--;
    }

    vector<long long> ans(m);
    ans[m-1] = (long long)n*(n-1)/2;
    UnionFind uni(n);
    for(int i=m-1;i>=1;i--) {
        ans[i-1]=ans[i];
        if (uni.root(a[i]) != uni.root(b[i])) {
            ans[i-1]-=(long long)uni.size(a[i])*uni.size(b[i]);
            uni.connect(a[i],b[i]);
        }
    }
    for (int i=0;i<m;i++) printf("%lld\n",ans[i]);
}


Measured memory_bytes: 3328
# City Savers
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def kill(saver, next, curr):
	killed = 0
	if saver >= next:
		saver -= next
		killed += next
		if saver >= curr:
			killed += curr
			return 0, killed
		else:
			killed += saver
			return curr-saver, killed 
	else:
		killed += saver
		return curr, killed

cnt = 0
res = A[-1]
for i in range(len(B)):
	ans = kill(B[len(B)-i-1], res, A[len(A)-i-2])
	res = ans[0]
	cnt += ans[1]
print(cnt)	


Measured memory_bytes: 18624
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vector<vector<pair<ll,ll> > > nei(n);
    REP(i,m){
        ll l,r,d;
        cin >> l >> r >> d;
        l--; r--;
        nei[l].pb(make_pair(r,d));
        nei[r].pb(make_pair(l,-d));
    }
    vll visited(n,0);
    vll where(n,0LL);
    REP(i,n){
        if(visited[i]==1) continue;
        ll mi=0,mx=0;
        stack<ll> st;
        st.push(i);
        visited[i]=1;
        while(!st.empty()){
            ll now = st.top();
            st.pop();
            
            for(auto p:nei[now]){
                ll t = where[now]+p.se;
                if(visited[p.fi]==1){
                    if(where[p.fi]==t){

                    }else{
                        cout << "No" << endl;
                        return 0;
                    }
                }else{
                    visited[p.fi]=1;
                    where[p.fi] = t;
                    mx = max(mx,t);
                    mi = min(mi,t);
                    st.push(p.fi);
                }
            }
        }
        if(mx-mi>1000000000){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 14848
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;

int N;
std::string s;
int dp[1010][10];

// joi -> 0,1,2
int toInt(char c){
    if(c == 'J'){
        return 0;
    }else if(c == 'O'){
        return 1;
    }
    return 2;
}

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

    int sch[1010];
    REP(i, N){
        sch[i] = toInt(s[i]);
    }

    REP(i, 10){
        REP(j, 1010){
            dp[i][j] = 0;
        }
    }

    //std::cout << sch[0] << std::endl;
    REP(i, 8){
        if((i & 1) && ((i >> sch[0]) & 1)){
            dp[0][i] = 1;
        }
    }

    FOR(i, 1, N){
        REP(j, 8){// 今日の参加者
            if((j >> sch[i]) & 1){
                REP(k, 8){// 昨日の参加者
                    if(j & k){
                        dp[i][j] = (dp[i][j] + dp[i-1][k]) % 10007;
                    }
                }
            }
        }
    }

    int res = 0;
    REP(i, 8){
        res = (res + dp[N-1][i]) % 10007;
    }

    std::cout << res << std::endl;
}

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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

int main() {
  int H,W,N,a;
  cin >> H >> W >> N;
  queue<int> q;
  rep(i,N) {
    cin >> a;
    q.push(a);  
  }
  vector<vector<int>> ans(H,vector<int>(W));
  int now = q.front(),col=1;
  q.pop();
  rep(i,H){
    rep(j,W) {
      ans[i][j] = col;
      now--;
      if (now==0) {
        now = q.front();
        q.pop();
        col++;
      }
    }
  }

  rep(i,H){
    rep(j,W) {
      int res = ans[i][j];
      if (i%2) res = ans[i][W-1-j];
      cout << res << ' ';
    }
    cout << endl;
  }

} 

Measured memory_bytes: 384
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=jp*/

#include <iostream>
#include <vector>

using namespace std;

vector<int> s;

int mybinarysearch(int value,int max,int min){
    int mid=(max+min)/2;

    if(max<=min){
        return 0;
    }else if(s[mid]==value){
        return 1;
    }else if(s[mid]<value){
        return mybinarysearch(value,max,mid+1);
    }else{
        return mybinarysearch(value,mid,min);
    }
}

int main(){
    int count=0;
    int n,q;

    cin>>n;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin>>tmp;
        s.push_back(tmp);
    }
    cin>>q;
    for (int i = 0; i < q; i++) {
        int tmp;
        cin>>tmp;
        count+=mybinarysearch(tmp,s.size(),0);
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1672
th=1000
v=[1]
for b in range(2,32):
  p=2
  while b**p <= th:
    v.append(b**p)
    p+=1

v=sorted(list(set(v)))
X=int(input())
m=0
for i in range(len(v)):
  if v[i] <= X and m < X:
    m = v[i]

print(m)


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

#define LL long long
#define MAXN 100009

int arr[MAXN]={0};

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	int temp=arr[0];
	int cnt=0;
	int res=0;
	for(int i=0;i<n;i++){
		if(arr[i]==temp){
			cnt++;
		}else{
			res+=cnt%2;
			temp=arr[i];
			cnt=1;
		}
	}
	res+=cnt%2;
	cout<<res;

	// for(int i=0;i<n;i++){
	// 	if(vis[arr[i]]==false){
	// 		if(cnt[arr[i]]%2==0){
	// 			vis[arr[i]]==true;
	// 		}else{
	// 			res++;
	// 			vis[arr[i]]==true;
	// 		}
	// 	}else{

	// 	}
	// }
	return 0;
}

Measured memory_bytes: 640
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

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

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N;cin>>N;
    
    VI A(N);

    REP(i, N)
    {
        cin >> A.at(i);
    }
    SORT(A);
    
    int counter=1;
    int ans=0;
    FOR(i, 1, N)
    {
        if (A.at(i-1)==A.at(i))
        {
            if (counter==1) counter=0;
            else counter=1;
        }
        else
        {
            ans += counter;
            counter=1;
        }
    }
    ans+=counter;
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iA = int.Parse(sS[0]);
            int iB = int.Parse(sS[1]);
            int iC = int.Parse(sS[2]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iZ = iA - iB;
            int iOut = iC - iZ;
            if (iOut < 0) { iOut = 0; }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main() {
    ll x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    V p(a),q(b),r(c);
    rep(i,a)cin>>p[i];
    rep(i,b)cin>>q[i];
    rep(i,c)cin>>r[i];
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    rep(i,x)r.push_back(p[i]);
    rep(i,y)r.push_back(q[i]);
    sort(r.rbegin(), r.rend());
    cout<<accumulate(r.begin(), r.begin()+x+y,0LL)<<endl;;
}


Measured memory_bytes: 6384
def solve():
    data = read()
    result = think(data)
    write(result)


def read():
    return read_int(1)[0]


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    return data ** 3


def write(result):
    print(result)


if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    # import sys
    # sys.setrecursionlimit(10000)
    solve()

Measured memory_bytes: 3064
#pragma GCC optimize("O2,unroll-loops")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using vi = vector<int>;
using ll = long long;
const int maxn = 506;
ll n, a, b, c, d;
map<ll, ll> cst;
#define ccc(n, x, t) (((n) - (n)/x) <= 1000000000 ? min(((n) - (n)/x)*d, (t)) : (t))
ll f(ll n) {
	if(n == 0) return 0;
	if(cst.count(n)) return cst[n];
	cst[n] = n <= 1000000000 ? n*d : 1ll<<60;
	cst[n] = min(cst[n], f(n/2) + ccc(n, 2, a + (n%2)*d));
	cst[n] = min(cst[n], f((n+1)/2) + (n%2)*d + ccc(n+1, 2, a));
	cst[n] = min(cst[n], f(n/3) + ccc(n, 3, b + (n%3)*d));
	cst[n] = min(cst[n], f((n+2)/3) + (3 - (n%3))*d + ccc(n+2, 3, b));
	cst[n] = min(cst[n], f(n/5) + ccc(n, 5, c + (n%5)*d));
	cst[n] = min(cst[n], f((n+4)/5) + (5 - (n%5))*d + ccc(n+4, 5, c));
	//cout << n << " " << cst[n] << '\n';
	return cst[n];
}
void solve() {
	cst.clear();
	cin >> n >> a >> b >> c >> d;
	cout << f(n) << '\n';
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	int t;
	cin >> t;
	while(t--) solve();
}


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



int main(){

    map<int,int>m;
    map<int,int>::iterator it;

    int n;
    cin>>n;

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


    for(it=m.begin();it!=m.end();it++)
        cout<<it->second<<" ";



    cout<<endl;



}


Measured memory_bytes: 5504
macro_rules! input {
    ($x:expr) => {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        $x = buf.trim().parse().unwrap();
    };

    ($x:expr, $($y:expr), +) => {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).ok();
        input_iter!(buf.split_whitespace(), $x, $($y), +);
    };

    ($v:expr; $size:expr) => {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).ok();
        for v in buf.split_whitespace() {
            $v.push(v.parse().unwrap());
        }
    };

    ($v:expr; $h_size:expr, $w_size:expr) => {
        for _ in 0..$h_size {
            let mut part_vec = Vec::new();
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).ok();
            for v in buf.split_whitespace() {
                part_vec.push(v.parse().unwrap());
            }
            $v.push(part_vec);
        }
    };
}

#[allow(unused_macros)]
macro_rules! input_iter {
    ($iter:expr, $x:expr) => {
        $x = $iter.next().unwrap().parse().unwrap();
    };

    ($iter:expr, $x:expr, $($y:expr), +) => {
        let mut iter = $iter;
        $x = iter.next().unwrap().parse().unwrap();
        input_iter!(iter, $($y), *);
    };
}

fn gcd(mut a: i32, mut b: i32) -> i32 {
    if a < b {
        std::mem::swap(&mut a, &mut b);
    }
    if b == 0 {
        return a;
    }
    return gcd(b, a % b);
}

fn main() {
    let _n: i32;
    input!(_n);
    let mut a: Vec<i32> = Vec::new();
    input!(a; _n);
    let mut g = -1;
    let mut g_order: Vec<i32> = Vec::new();
    let mut g_rev: Vec<i32> = Vec::new();
    for _a in &mut a {
        g = if g < 0 { *_a } else { gcd(*_a, g) };
        g_order.push(g);
    }
    g = -1;
    a.reverse();
    for _a in &mut a {
        g = if g < 0 { *_a } else { gcd(*_a, g) };
        g_rev.push(g);
    }
    let mut ans = 0;
    for i in 0.._n {
        let l: i32 = if i == 0 { g_rev[(_n - i - 2) as usize] } else { g_order[(i - 1) as usize] };
        let r: i32 = if i == _n-1 { l } else { g_rev[(_n - i - 2) as usize] };
        let tmp_g = gcd(l, r);
        ans = std::cmp::max(ans, tmp_g);
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
#include <climits>
using namespace std;

int main()
{

    int H, N;
    cin >> H >> N;

    long long sum = 0;
    for(int i = 0; i < N; i++)
    {
        int y;
        scanf("%d", &y);
        sum += y;
    }

    if(sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import heapq

def main():
    [N, M] = [int(number) for number in input().split()]
    part_times = []
    for i in range(N):
        job= [int(number) for number in input().split()]
        part_times.append(job)
    part_times = [part_time for part_time in sorted(part_times, key = lambda x: x[0])] #if part_time[0] <= M]
    money = 0
    hp = []
    for day in range(M):
        while part_times != [] and part_times[0][0] <= day + 1:
            part_time = part_times[0]
            heapq.heappush(hp, - part_time[1])
            part_times.pop(0)
        if hp != []:
            money -= heapq.heappop(hp)

    print(money)

if __name__ == '__main__':
    main()


Measured memory_bytes: 23568
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine
getNString n = map readString <$> replicateM n BS.getLine

calc :: [String] -> Int -> Int -> Int -> Int -> [Int]
calc [] ac wa tle re = [ac, wa, tle, re]
calc (s : ss) ac wa tle re
  | s == "AC" = calc ss (ac + 1) wa tle re
  | s == "WA" = calc ss ac (wa + 1) tle re
  | s == "TLE" = calc ss ac wa (tle + 1) re
  | s == "RE" = calc ss ac wa tle (re + 1)

main = do
  n <- getInt
  ss <- getNString n
  let ss' = map head ss
  let [ac, wa, tle, re] = calc ss' 0 0 0 0
  putStrLn $ "AC x " ++ show ac
  putStrLn $ "WA x " ++ show wa
  putStrLn $ "TLE x " ++ show tle
  putStrLn $ "RE x " ++ show re


Measured memory_bytes: 22292
import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())


directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])
directions = list(map(np.array, directions))

mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact


def permutate(x, A):
    n = len(x)
    res = [-1]*n
    for i in range(n):

        res[i] = x[A[i]]
    return res


def generate_bin(digit):
    for b in range(2**digit):
        b = bin(b)
        tmp = b[2:].zfill(digit)
        yield list(map(int, tmp))
        # b=list(map(int,list(b[2:].zfill(digit))))
        # yield b


def search(x, count):
    #print("top", x, count)

    for d in directions:
        nx = d+x
        # print(nx)
        if np.all(0 <= nx) and np.all(nx < (H, W)):
            if field[nx[0]][nx[1]] == "E":
                count += 1
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)
                continue
            if field[nx[0]][nx[1]] == "#":
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)

    return count


N = II()
A = acinput()

A.insert(0, A[0]+1)
A.append(A[-1]-1)

tmp = []
for i in range(len(A)):
    if A[i] != A[i-1]:
        tmp.append(A[i])

A = tmp

x = 1000
k = 0

for i in range(len(A)-1):
    #print(i, x, k)
    if A[i-1] > A[i] and A[i] < A[i+1]:
        k += x//A[i]
        x = x % A[i]
    elif A[i-1] < A[i] and A[i] > A[i+1]:
        #print(i, x, k)
        x += A[i]*k
        k = 0


print(x)

# print(A)


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  bool ans = true;
  if (s.length() % 2 != 0) {
    ans = false;
  } else {
    for (int i = 0; i < s.length() / 2; i++) {
      if (s[i] != s[s.length() / 2 + i]) {
        ans = false;
        break;
      }
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

signed main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  int ans = 0;
  if( B >= C ){
    ans += B+C;
    cout << ans << endl;
    return 0;
  }else{
    ans += B*2;
    if( A >= C-B ){
      ans += C-B;
      cout << ans << endl;
      return 0;
    }else{
      ans += A+1;
      cout << ans << endl;
      return 0;
    }
  }
  

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int t; scanf("%d", &t);
	while(t--) {
		i64 a, b, c, d; scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
		
		if(a < b or d < b) {
			printf("No\n");
			continue;
		}
		if(b <= c + 1) {
			printf("Yes\n");
			continue;
		}
		
		i64 g = std::__gcd(b, d);
		i64 latte = (b - a % g + g - 1) / g * g + a % g - g;
		if(latte <= c) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct iofix
{
	ios_base::Init i;
	iofix() {
		cin.sync_with_stdio(0);
		cin.tie(0);
		cout.sync_with_stdio(0);
		cout.tie(0);
		cout.precision(10);
		cout << fixed;
	}
} iofix;

void solve(){ 
	int N; cin >> N;
	vector<int64_t > dp(3, 0);
	for(int i = 0; i < N; ++i){
		vector <int64_t > cost(3);
		for(int c = 0; c < 3; ++c)
			cin >> cost[c];
		vector <int64_t > new_dp(3, 0);
		for(int j = 0; j < 3 ; ++j){
			for(int k = 0 ; k < 3 ; ++k){
				if(j != k)
			        	new_dp[k] = max(new_dp[k], dp[j] + cost[k]);
			}
		}
		dp = new_dp;
	}
	cout << max({dp[0], dp[1], dp[2]}) << "\n";
}


int main(){

	solve();

#ifndef Time
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3856
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000;

int main(){
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int cou = 0, kco = 0;
    rep (i, n) {
        if (s[i] == 'c') {
            cout << "No" << endl;
            continue;
        }

        else if (s[i] == 'a'){
            if (cou < a + b) {
                cout << "Yes" << endl;
                cou++;
                continue;
            }
            else {
                cout << "No" << endl;
                continue;
            }
        }

        else {
            if (cou < a + b && kco < b) {
                cout << "Yes" << endl;
                cou++;
                kco++;
                continue;
            }
            else {
                cout << "No" << endl;
                continue;
            }
        }
    }

    return 0;
} 

Measured memory_bytes: 3704
list_MFR = list()
while True:
    base = input()
    term = base.split(' ')
    if(int(term[0]) == -1 and int(term[1]) == -1 and int(term[2]) == -1):
        break
    else:
        map_MFR = {'M': int(term[0]), 'F': int(term[1]), 'R': int(term[2])}
        list_MFR.append(map_MFR)

for s in list_MFR:
    if s['M'] == -1 or s['F'] == -1:
        print('F')
    elif s['M'] + s['F'] >= 80:
        print('A')
    elif s['M'] + s['F'] >= 65 and s['M'] + s['F'] < 80:
        print('B')
    elif s['M'] + s['F'] >= 50 and s['M'] + s['F'] < 65:
        print('C')
    elif s['M'] + s['F'] >= 30 and s['M'] + s['F'] < 50:
        if s['R'] >= 50:
            print('C')
        else:
            print('D')
    elif s['M'] + s['F'] < 30:
        print('F')



Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    string S;cin >> S;
    ll A[S.size()+1] = {};
    REP(i,S.size()){
        if(S[i] == '<'){
            A[i+1] = max(A[i+1],A[i]+1);
        }
    }
    rep(i,S.size()){
        if(S[i] == '>'){
            A[i] = max(A[i+1]+1,A[i]);
        }
    }
    ll sum = 0;
    REP(i,S.size()+1){
        sum += A[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
#define rep(i,a) for(i=0;i<a;i++)
using namespace std;

int main(void){
    int i,j,q;
    string x,y;
    vector<vector<int> > lcs;
    cin >> q;
    while(q--){
        cin >> x >> y;
        int M = x.size();
        int N = y.size();
        lcs.resize(M+1);
        rep(i,M+1){
            lcs[i].resize(N+1);
        }
        rep(i,M){
            rep(j,N){
                if(x[i] == y[j])
                    lcs[i+1][j+1] = lcs[i][j]+1;
                else
                    lcs[i+1][j+1] = max(lcs[i+1][j],lcs[i][j+1]);
            }
        }
        cout << lcs[M][N] << endl;
    }
    return 0;
}

Measured memory_bytes: 4964
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;

int main() {
    int N, L; cin >> N >> L;
    
    int m = abs(L + 1 - 1);
    int sum = 0, idx = 1;
    for (int i = 1; i <= N; ++i) {
        int t = L + i - 1;
        sum += t;
        if (m > abs(t)) {
            m = abs(t);
            idx = i;
        }
    }

    cout << sum - (L + idx - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		int a = scan.nextInt();
		int h[]= new int [n];
		for(int i=0;i<n;i++) {
			h[i]=scan.nextInt();
		}
		scan.close();
		double min =Integer.MAX_VALUE;
		int num=0;
		for(int i=0;i<n;i++) {
			if(Math.abs(a-( t-h[i]*0.006)) < min ) {
				min =Math.abs(a-( t-h[i]*0.006));
				num=i+1;
			}
		}
		System.out.println(num);
	}
}

Measured memory_bytes: 21972
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / INF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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

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

using namespace std;

//===================================== template =========================================================

int main() {
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    int D, G; cin >> D >> G;
    vector<int> vp(D), vc(D);
    REP(i, D) cin >> vp[i] >> vc[i];
    int res = INF;
    for (int bit = 0; bit < pow(2, D); ++bit) {
        int pnum = 0; int score = 0;
        for (int i = 0; ; ++i) {
            if (bit >> i < 1) break;
            if (bit >> i & 1) {
                score += 100 * (i+1) * vp[i] + vc[i];
                pnum += vp[i];
            }
        }
        for (int i = D-1; i >= 0; i--) {
            if (score >= G) { chmin(res, pnum); break; }
            if ((bit >> i & 1) == 0 && 100 * (i+1) * vp[i] >= G - score) {
                pnum += ((G - score) + 100 * (i+1) - 1) / (100 * (i + 1));
                chmin(res, pnum);
                break;
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	if(c-a-b>=0&&(c-a-b)*(c-a-b)>4*a*b)puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define N 300020
#define MOD 1000000007
using namespace std;

char a[N];
int f[N][3][3];

inline int Mod(int x)
{
    return x + ((x >> 31) & MOD);
}

inline void Modadd(int &x, int y)
{
    x = Mod(x + y - MOD);

    return;
}

int main(void)
{
    int n;
    int i, j, k;

    scanf("%s", a);
    n = (int)strlen(a);

    f[0][0][0] = 1;
    for(i = 0; i < n; i ++)
        for(j = 0; j < 3; j ++)
            for(k = 0; k < 3; k ++)
                if(f[i][j][k])
                {
                    if(a[i] != '1')
                    {
                        if(j == 2)
                            Modadd(f[i + 1][1][k], f[i][j][k]);
                        else
                            Modadd(f[i + 1][j + 1][k], f[i][j][k]);
                    }
                    if(a[i] != '0')
                    {
                        if(j)
                            Modadd(f[i + 1][j - 1][k], f[i][j][k]);
                        else
                            Modadd(f[i + 1][0][min(k + 1, 2)], f[i][j][k]);
                    }
                }
    k = 0;
    // Modadd(k, f[n][0][0]);
    Modadd(k, f[n][0][1]);
    Modadd(k, f[n][0][2]);
    // Modadd(k, f[n][1][1]);
    Modadd(k, f[n][1][2]);
    Modadd(k, f[n][2][2]);
    printf("%d\n", k);

    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define pr_arr(name, a, w, h) \
  for (int i = (a); i < (h); i++) { \
    for (int j = (a); j < (w); j++) {\
      if (j > (a)) printf(" "); \
      printf("%d", name[i][j]); \
    }\
    printf("\n");\
  }\


using namespace std;

typedef long long ll;

int ans;
int H, W;
char S[2005][2005];
int d[2005][2005];

int main(void) {
    scanf("%d %d", &H, &W);
    rep(i, 0, H) {
      scanf("%s", &S[i]);
    }

    rep(i, 0, H) {
      int j = 0;
      while (j < W) {
        if (S[i][j] == '#') j++;
        else {
          int c = 1;
          int k = j + 1;
          while (S[i][k] == '.' && k < W) {c++; k++;}
          rep(x, j, j+c) d[i][x] = c;
          j += c;
        }
      }
    }

    rep(j, 0, W) {
      int i = 0;
      while (i < H) {
        if (S[i][j] == '#') i++;
        else {
          int c = 1;
          int k = i + 1;
          while (S[k][j] == '.' && k < H) {c++; k++;}
          rep(x, i, i+c) d[x][j] += c - 1;
          i += c;
        }
      }
    }


    rep(i, 0, H) {
      rep(j, 0, W) {
        ans = max(ans, d[i][j]);
      }
    }
   

  
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 19840
#include <stdio.h>

int main(void) {
  int a, b;

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

  if (a < b)
    printf("a < b\n");
  else if (a > b)
    printf("a > b\n");
  else
    printf("a == b\n");
  return 0;
}

Measured memory_bytes: 580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Competition
{
    public class Program
    {
        
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            if (N == 1) Console.WriteLine("No");
            else if (N % 2 != 0) Console.WriteLine("No");
            else
            {
                if (S.Substring(0, N / 2) == S.Substring(N / 2, N / 2)) Console.WriteLine("Yes");
                else Console.WriteLine("No");
            }
        }

    }
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int i = a; i <= (n); ++i)
#define repD(i, a, n) for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	int n; cin >> n;
	vi a(n+1,0);
	for(int i = 1; i <= 100; i++){
		for(int j = 1; j <= 100; j++){
			for(int k = 1; k <= 100; k++){
				int aa = (i+j)*(i+j);
				int bb = (i+k)*(i+k);
				int cc = (k+j)*(k+j);
				int dd = (aa + bb + cc)/2;
				if(dd <= n){
					a[dd]++;
				}
			}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << a[i] << '\n';
	}
	return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n,arr[200001],ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>arr[i];
        if (i%2==1 && arr[i]%2==1) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main(void) {
	int i = 1, n, ans = 0;
	cin >> n;
	while (i <= n) {
		if (i < 10)
			ans++;
		else if (i >= 100 && i < 1000)
			ans++;
		else if (i >= 10000 && i < 100000)
			ans++;
		i++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
/*
       Hi there <3 
──────▄▀▄─────▄▀▄
─────▄█░░▀▀▀▀▀░░█▄
─▄▄──█░░░░░░░░░░░█──▄▄
█▄▄█─█░░▀░░┬░░▀░░█─█▄▄█

*/
#include <bits/stdc++.h>
#define MOD 1000000007
#define re return
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repa(i, a, n) for (int i = a; i < n; i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrepa(i, a, n) for (int i = n; i >= a; i--)
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define ba back()
#define popcount __builtin_popcountll
#define fastIO()                 \
    {                            \
        ios::sync_with_stdio(0); \
        cin.tie(0);              \
        cout.tie(0);             \
    }
#define in(x) \
    int x;    \
    cin >> x;
#define in1(x) \
    int x;     \
    cin >> x;  \
    x--;
#define inll(x) \
    ll x;       \
    cin >> x;
#define ins(x) \
    string x;  \
    cin >> x;

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef pair<double, double> pdd;
typedef long double LD;
typedef double D;

void Solve()
{
    int n, m,op;
    cin >> n >> m>>op;
    vector<vector<char>> arr;
    rep(i, n)
    {
        vector<char> temp;
        rep(j, m)
        {
            char temp2;
            cin >> temp2;
            temp.pb(temp2);
        }
        arr.pb(temp);
    }
    
    int N = n + m;
    int total = 0;
    vi A;
    for (int i = 0; i < n; i++)
    {
        A.pb(i);
    }
    for (int i = 1; i <= m; i++)
    {
        int temp=i*-1;
        A.pb(temp);
    }

    for (int i = 0; i < (1 << N); ++i)
    {
        vi temp;
        for (int j = 0; j < N; ++j)
        {
            if (i & (1 << j))
            {
                temp.pb(A[j]);
            }
            
        }

        vector<vector<char>> M;
        M = arr;
        
        for (auto x : temp)
        {
            if (x >= 0)
            {
                for (int k = 0; k < m; k++)
                {
                    M[x][k] = 'r';
                }
            }
            else
            {
                for (int k = 0; k < n; k++)
                {
                    int s=x*-1;
                    s--;
                    M[k][s] = 'r';
                }
            }
        }
        
        int tempcount=0;
        
        rep(i, n)
        {
            rep(j, m)
            {
                if (M[i][j] == '#')
                    tempcount++;
            }
        }
        if(tempcount==op)
            total++;
        
    }
    cout<<total<<endl;
}

int main()
{
    fastIO();
    int t;
    t = 1;
    while (t--)
    {
        Solve();
    }
    return 0;
}

Measured memory_bytes: 3664
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0 ; i < 4 ; i++) {
            String t = s.substring(i, i + 1);
            if (map.containsKey(t)) {
                map.put(t, map.get(t) + 1);
            } else {
                map.put(t, 1);
            }
        }
        if (map.size() == 2) {
            for (Integer integer : map.values()) {
                if (integer == 2) {
                    System.out.println("Yes");
                } else {
                    System.out.println("No");
                }
                return;
            }
        } else {
            System.out.println("No");
        }
    }

}

Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<vector>
#include<set>

using namespace std;

int main(void){
	int a,b,c,d;
	int n,k;
	while(1){
		cin >> n;
		cin >> k;
		if(n==0 && k==0)break;
		vector<string> num;
		set<string> str;
		for(a=0;a<n;a++){
			string s;
			cin >> s;
			num.push_back(s);
		}
		if(k==2){
			for(a=0;a<n;a++){
				for(b=0;b<n;b++){
					if(a!=b)str.insert(num[a]+num[b]);
				}
			}
		}
		if(k==3){
			for(a=0;a<n;a++){
				for(b=0;b<n;b++){
					if(a!=b)for(c=0;c<n;c++){
						if(a!=c && b!=c)str.insert(num[a]+num[b]+num[c]);
					}
				}
			}
		}
		if(k==4){
			for(a=0;a<n;a++){
				for(b=0;b<n;b++){
					if(a!=b)for(c=0;c<n;c++){
						if(a!=c && b!=c)for(d=0;d<n;d++){
							if(a!=d && b!=d && c!=d)str.insert(num[a]+num[b]+num[c]+num[d]);
						}
					}
				}
			}
		}
		cout << str.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 0
// https://atcoder.jp/contests/abc172/tasks/abc172_b
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < (int)s.size(); i++) {
		if (s[i] != t[i]) {
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3844