akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <set>
#include <iostream>

struct segment_tree {
    void build(std::string const &a) {
        t.resize(4 * a.size());
        build(0, 0, a.size(), a);
    }

    void update(size_t pos, char new_value) {
        update(0, 0, t.size() / 4, pos, new_value);
    }

    int32_t get(size_t l, size_t r) {
        return get(0, 0, t.size() / 4, l, r + 1).size();
    }

private:
    std::vector<std::set<char>> t;
    void build(size_t v, size_t l, size_t r, std::string const &a) {
        if (l + 1 == r) {
            std::set<char> m;
            m.insert(a[l]);
            t[v] = m;
        } else {
            size_t mid = (l + r) / 2;
            build(2 * v + 1, l, mid, a);
            build(2 * v + 2, mid, r, a);
            for (auto elem : t[2 * v + 1]) {
                t[v].insert(elem);
            }
            for (auto elem : t[2 * v + 2]) {
                t[v].insert(elem);
            }
        }
    }

    void update(size_t v, size_t l, size_t r, size_t pos, char new_value) {
        if (l + 1 == r) {
            std::set<char> m;
            m.insert(new_value);
            t[v] = m;
        } else {
            size_t mid = (l + r) / 2;
            if (pos < mid) {
                update(2 * v + 1, l, mid, pos, new_value);
            } else {
                update(2 * v + 2, mid, r, pos, new_value);
            }
            t[v].clear();
            for (auto elem : t[2 * v + 1]) {
                t[v].insert(elem);
            }
            for (auto elem : t[2 * v + 2]) {
                t[v].insert(elem);
            }
        }
    }

    std::set<char> get(size_t v, size_t l, size_t r, size_t req_l, size_t req_r) {
        if (req_l >= req_r) {
            return std::set<char> ();
        } else if (l == req_l && r == req_r) {
            return t[v];
        } else {
            size_t mid = (l + r) / 2;
            std::set<char> cur = get(2 * v + 1, l, mid, req_l, std::min(mid, req_r));
            for (auto elem : get(2 * v + 2, mid, r, std::max(mid, req_l), req_r)) {
                cur.insert(elem);
            }
            return cur;
        }
    }
};

int main() {
    std::ios_base::sync_with_stdio(false);
    segment_tree chr;
    size_t n;
    std::string a;
    std::cin >> n >> a;
    chr.build(a);
    size_t k;
    std::cin >> k;
    while (k-- > 0) {
        size_t type;
        std::cin >> type;
        if (type == 1) {
            size_t pos;
            char ch;
            std::cin >> pos >> ch;
            chr.update(pos - 1, ch);
        } else {
            size_t l, r;
            std::cin >> l >> r;
            std::cout << chr.get(l - 1, r - 1) << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 235696
#include<bits/stdc++.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a%3==0 || b%3==0 || (a+b)%3==0)
        printf("Possible\n");
    else
        printf("Impossible\n");
    return 0;
}


Measured memory_bytes: 256
/*

                                  In the name of Allah, Most Gracious, Most Merciful


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

//*** constant value ***
const long double PI = 3.141592653589793238;
const double EPS = 1e-6 ;
//*** constant value ***

//****** define ********
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define dd double
#define vll vector<ll>
#define vs vector<string>
#define fn(i,n) for(ll i = 0; i<n; i++)
#define f(i,a,b) for(i=a;i<b;i++)
#define f1(i,a,b) for(i=b-1;i>=a;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define vpl vector<pll>
#define pb push_back
#define mk make_pair
#define x first
#define y second
#define tt cout<<"Came here"<<endl;
//****** define ********
void solve()
{
    string s1,s2;
    cin>>s1>>s2;
    ll cnt = 0;
    fn(i,s2.length())
    {
        if(s1[i] != s2[i])
            cnt++;
    }

    cout<<cnt<<endl;
}

int main()
{
    IOS;
    ll tc = 1;
    while(tc--)
    {
        solve();
    }


return 0;
}



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

int main() {
  int n, w;
  cin >> n >> w;
  vi wei(n), val(n);
  rep(i, n) cin >> wei[i] >> val[i];
  int vmax = n * 1000;
  vector<vi> dp(n + 1, vi(vmax + 1, w + 1));
  dp[0][0] = 0;
  rep(i, n) rep(j, vmax + 1) {
    dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
    if(j +val[i] <= vmax)
      dp[i + 1][j + val[i]] = min(dp[i + 1][j + val[i]], dp[i][j] + wei[i]);
  }
  int ans = 0;
  rep(j, vmax + 1) if(dp[n][j] <= w) ans = j;
  cout << ans << endl;
}

Measured memory_bytes: 40192
import java.util.*;

public class Main
{
  static int n;
  static double[] p;
  static Double[][] memo;
  public static void main(String[] args)
  {
	Scanner in = new Scanner(System.in);
    n = in.nextInt();
    p = new double[n];
    for (int i = 0; i < n; i++)
      p[i] = in.nextDouble();
    memo = new Double[n][n];
    System.out.println(dp(0, 0));
    in.close();
  }
  
  public static double dp(int at, int cnt)
  {
	if (at == n)
      return cnt > n/2 ? 1.0 : 0.0;
    if (memo[at][cnt] != null)
      return memo[at][cnt];
    double ans = 0;
    ans = p[at]*dp(at+1, cnt+1)+(1-p[at])*dp(at+1, cnt);
    return memo[at][cnt] = ans;
 }
} 

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 3005;

/* ...o(^-^)o... */

int main(){
    int n, k; cin >> n >> k;
    vector<int> a(n); rep(i, n) cin >> a[i];
    vector<bool> dp(k+1);
    rep(i, k+1){
        dp[i] = true;
        for(int j = 0; (i-a[j]>=0 && j<n); j++) dp[i] = dp[i] & dp[i-a[j]];
        dp[i] = !dp[i];
    }
    out(dp[k]?"First":"Second");
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


def cumsum(l):
    s = 0
    for v in l:
        s += v
        yield s


a = [0] + list(cumsum(A))
b = [0] + list(cumsum(B))
ans = 0
n = N + 1
m = M
for i in range(n):
    if a[i] > K:
        continue
    for j in range(m, -1, -1):
        if a[i] + b[j] <= K:
            m = j
            break
        else:
            continue
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 50536
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  string s;
  cin >> s;
  int ans = 0;
  if (s[0] == s[1] && s[1] == s[2] && s[0] == 'R') {
    ans = 3;
  } else {
    if (s[0] == 'R' && s[1] == 'R') {
      ans = 2;
    } else if (s[1] == 'R' && s[2] == 'R') {
      ans = 2;
    } else if (s[0] == s[1] && s[1] == s[2] && s[0] == 'S') {
      ans = 0;
    }else{
      ans = 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
if __name__ == "__main__":
    N = int(input())
    A1 = list(map(int, (input().split(' '))))
    A2 = list(map(int, (input().split(' '))))
    max_point = 0
    for i in range(0, N):
        tmp = 0
        for i_n in range(0, i+1):
            tmp += A1[i_n]
        for j in range(i, N):
            tmp += A2[j]
        if max_point < tmp:
            max_point = tmp
    print(max_point)

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

int main() {
  long A=2000000;
  vector<char>N(A);
  long ANS=0;
  for(long i=0;i<A;i++){
    cin>>N[i];
    ANS+=N[i];
    if(N[i]!=0){
      ANS-=48;
    }
  }
  if(ANS%9==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 4908
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

using ll = long long;

int main() {
    int n, m;
    cin >> n >> m;
    
    if (n==1 && m==1)
        cout << 1 << endl;
    else if ((n==1) != (m==1)) {
        ll a = max(n, m);
        ll res = a-2;
        cout << res << endl;
    } else {
        ll res = ((ll)m-2) * ((ll)n-2);
        cout << res << endl;
    }
}


Measured memory_bytes: 256
num = int(input())
array = [int(x) for x in input().split()]
m = int(input())
l = [ int(x) for x in input().split()]


s = {0}
for i in array:
    s |= { x + i for x in s }


for q in l :
    if q in s:
        print("yes")
    else:
        print("no")




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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long n;
    cin>>n;
    long a[n],b[n],req[n],reqsum=0,reqind=0;
    for(long i=0;i<n;i++)
        cin>>a[i];
    for(long i=0;i<n;i++)
      cin >> b[i];
    for (long i = 0; i < n; i++)
      req[i]=a[i]-b[i];
    sort(req,req+n);
    for(long i=0;i<n && req[i]<0;i++)
    {
        reqsum-=req[i];
        reqind++;
    }
    if(reqsum<=0)
    {
        cout<<"0";
        exit(0);
    }
    for(long i=n-1;i>=0 && req[i]>0;i--)
    {
        reqsum-=req[i];
        if(reqsum<=0)
        {
            cout<<reqind+n-i;
            exit(0);
        }
    }
    cout<<"-1";
}



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

#define debug(n) cerr << #n << ':' << n << endl;

using namespace std;

using  ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using  vi = vector<int>;
using  vl = vector<ll>;
using  vd = vector<double>;
template<class T,class U>
using umap = unordered_map<T,U>;
template<class T>
using uset = unordered_set<T>;

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

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

template<class T>
inline void putv(const vector<T>&v,char c = '\n'){
  for(auto&&e:v){
    cout << e << c;
  }
}

template<class T>
inline void readv(vector<T>&v){
  if(v.empty()){
    cerr << "void readv(vector<T>&v) v.empty()\n";
  }
  for(auto&&e:v){
    cin >> e;
  }
}

bool ok(vector<int>&v){
  bool f = true;
  int s = (int)v.size();
  for(int i = 0; i < s-1; ++i){
    if(v[i]>v[i+1]){f=false;break;}
  }
  return f;
}


int main(){
  int n;cin >> n;
  vector<int>v(n);
  readv(v);
  for(int i = 0; i < n; ++i){
    for(int j = i; j < n; ++j){
      swap(v[i],v[j]);
      if(ok(v)){
	cout << "YES\n";
	return 0;
      }
      swap(v[i],v[j]);
    }
  }
  cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    vector<int> L(N + 1, 0), R(N + 1, 0);
    REP(i, 0, N) {
        L[i + 1] = __gcd(A[i], L[i]);
        R[N - i - 1] = __gcd(A[N - i - 1], R[N - i]);
    }

    int ans = 0;
    REP(i, 0, N) {
        ans = max(ans, __gcd(L[i], R[i + 1]));
    }
    cout << ans << endl;
    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
struct SuffixArray {
  vector< int > SA;
  const string s;

  SuffixArray(const string &str) : s(str) {
    SA.resize(s.size());
    iota(begin(SA), end(SA), 0);
    sort(begin(SA), end(SA), [&](int a, int b) {
      return s[a] == s[b] ? a > b : s[a] < s[b];
    });
    vector< int > classes(s.size()), c(s.begin(), s.end()), cnt(s.size());
    for(int len = 1; len < s.size(); len <<= 1) {
      for(int i = 0; i < s.size(); i++) {
        if(i > 0 && c[SA[i - 1]] == c[SA[i]] && SA[i - 1] + len < s.size() && c[SA[i - 1] + len / 2] == c[SA[i] + len / 2]) {
          classes[SA[i]] = classes[SA[i - 1]];
        } else {
          classes[SA[i]] = i;
        }
      }
      iota(begin(cnt), end(cnt), 0);
      copy(begin(SA), end(SA), begin(c));
      for(int i = 0; i < s.size(); i++) {
        int s1 = c[i] - len;
        if(s1 >= 0) SA[cnt[classes[s1]]++] = s1;
      }
      classes.swap(c);
    }
  }

  int operator[](int k) const {
    return SA[k];
  }

  size_t size() const {
    return s.size();
  }

  bool lt_substr(const string &t, int si = 0, int ti = 0) {
    int sn = (int) s.size(), tn = (int) t.size();
    while(si < sn && ti < tn) {
      if(s[si] < t[ti]) return true;
      if(s[si] > t[ti]) return false;
      ++si, ++ti;
    }
    return si >= sn && ti < tn;
  }

  int lower_bound(const string &t) {
    int low = -1, high = (int) SA.size();
    while(high - low > 1) {
      int mid = (low + high) / 2;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    return high;
  }

  pair< int, int > lower_upper_bound(string &t) {
    int idx = lower_bound(t);
    int low = idx - 1, high = (int) SA.size();
    t.back()++;
    while(high - low > 1) {
      int mid = (low + high) / 2;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    t.back()--;
    return {idx, high};
  }

  void output() {
    for(int i = 0; i < size(); i++) {
      cout << i << ": " << s.substr(SA[i]) << endl;
    }
  }
};


int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string in;
    cin >> in;
    SuffixArray sfx(in);
    int Q;
    cin >> Q;
    while(Q--) {
        string sub;
        cin >> sub;
        pair<int, int> a = sfx.lower_upper_bound(sub);
        //cerr << a.first << " " << a.second << endl;
        if(a.first != a.second) cout << "1" << endl;
        else cout << "0" << endl;
    }
    return 0;
}


Measured memory_bytes: 19712
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=200005;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0',ch=getchar();}
    return x*f;
}
int n,m,fa[N],siz[N];
int getfa(int x)
{
	return fa[x] == x ? x : fa[x] = getfa(fa[x]);
}
void solve()
{
	n=read(); m=read();
	for(int i=1; i<=n; i++) fa[i]=i,siz[i]=1;
	for(int i=1; i<=m; i++) {
		int u=read(),v=read();
		u=getfa(u),v=getfa(v);
		if(u!=v) fa[v]=u,siz[u] += siz[v];
	}
	int ans=0;
	for(int i=1; i<=n; i++) {
		int x=getfa(i);
		ans=max(ans, siz[x]);
	}
	printf("%d\n",ans);
}
int main()
{
	int T=1;
	while(T--) solve();
}

Measured memory_bytes: 5420
#include <iostream>
#include <bitset>
#define ll long long
using namespace std;
const int MDSZ = 4;
const int MD[MDSZ] = {1000000007, 1069696919, 701, 1018199999};
int n, k, ar[5001] = {}, rs = 0, a = 0, b = 0;
int dp[5001][MDSZ] = {};
void outDP(string s)
{
	cout << s << " : \n";
	for (int i = 0; i < k; i++)
	{
		cout << i << " " << dp[i][0] << "\n";
	}
}
int main()
{
	ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k; rs = n;
	for (int i = 0; i < n; i++) 
	{
		cin >> ar[i];
		if (ar[i] >= k) {a++;}
	}
	rs -= a;
	for (int i = 0; i < MDSZ; i++) {dp[0][i] = 1;}
	for (int i = 1; i <= n; i++)
	{
		for (int j = k - 1; j >= ar[i - 1]; j--) 
		{
			for (int kk = 0; kk < MDSZ; kk++)
			{
				dp[j][kk] += dp[j - ar[i - 1]][kk];
				dp[j][kk] %= MD[kk];
			}
		}
	}
	//outDP("ALL");
	for (int i = 1; i <= n; i++)
	{
		if (ar[i - 1] < k)
		{
			for (int j = ar[i - 1]; j < k; j++)
			{
				for (int kk = 0; kk < MDSZ; kk++)
				{
					dp[j][kk] -= dp[j - ar[i - 1]][kk];
					dp[j][kk] %= MD[kk];
					dp[j][kk] = (dp[j][kk] + MD[kk]) % MD[kk];
				}
			}
			//outDP("REM" + to_string(i));
			for (int j = k - ar[i - 1]; j < k; j++)
			{
				bool ck = 1;
				for (int kk = 0; kk < MDSZ; kk++) {ck &= (dp[j][kk] > 0);}
				if (ck) {rs--; break;}
			}
			for (int j = k - 1; j >= ar[i - 1]; j--) 
			{
				for (int kk = 0; kk < MDSZ; kk++)
				{
					dp[j][kk] += dp[j - ar[i - 1]][kk];
					dp[j][kk] %= MD[kk];
				}
			}
			//outDP("FIX" + to_string(i));
		}
	}
	cout << rs << "\n";
	return 0;
}

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

//.define
// #define FILE_IN_OUT
#define RET(_x)                       return cout << (_x) << '\n', 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define CeilDiv(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)                     std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)                     {}
#endif
#define endl "\n"
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data
bool HasBit(int x, int b) {
    return (x >> b) & 1;
}

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n, m, k;
    cin >> n >> m >> k;
    vector<string> gr(n);
    loop(n) {
        cin >> gr[i];
    }
    int ans = 0;
    for (int r = 0; r < (1 << n); ++r) {
        for (int c = 0; c < (1 << m); ++c) {
            auto ngr = gr;
            for (int b = 0; b < n; ++b) {
                if (HasBit(r, b)) {
                    loop(m) {
                        ngr[b][i] = '1';
                    }
                }
            }
            for (int b = 0; b < m; ++b) {
                if (HasBit(c, b)) {
                    loop(n) {
                        ngr[i][b] = '1';
                    }
                }
            }
            int cnt = 0;
            loop(n) {
                for (int j = 0; j < m; ++j) {
                    if (ngr[i][j] == '#') {
                        ++cnt;
                    }
                }
            }
            ans += cnt == k;
        }
    }
    cout << ans << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  int n=a/100,m=a%10,o=a%100,h=o/10;
  if(n==7||m==7||h==7)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}

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

int main(void) {
    int n, index = 1, count = 0;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
        if (a.at(i)==index) {
            index++;
        }
        else {
            count++;
        }
    }
    if (count == n) {
        cout << -1 << endl;
    }
    else {
        cout << count << endl;
    }
}

Measured memory_bytes: 1024
N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]
xy.sort(reverse=True)

ans = 0
M = xy[0][0] + xy[0][1]
m = xy[0][0] - xy[0][1]
for x, y in xy[1:]:
    ans = max(ans, M-x-y, m-x+y)
    M = max(M, x+y)
    m = max(m, x-y)

print(ans)

Measured memory_bytes: 37424
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n;
string s;
int main()
{
        cin >> s;
        n = s.length();
        ll ans = n;
        for(ll i=0;i<n-1;i++)
        {
                if(s[i] != s[i+1]){
                        ans = min(ans , max(i+1 , n - i - 1));
                }
        }
        cout << ans << endl;
}


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

using namespace std;

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

  int ans = 0;
  if (a < 0) ans += -a * c;
  a = max(a, 0);
  if (a == 0) ans += d;
  ans += (b - a) * e;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main()
{
	int h, w;
	char map[101][101];
	
	while (cin >> h >> w, h * w){
		int x = 0, y = 0;
		bool check[101][101];
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				cin >> map[i][j];
				check[i][j] = false;
			}
		}
		
		while (map[y][x] != '.'){
			if (check[y][x])	break;
			check[y][x] = true;
			if (map[y][x] == '>')	x++;
			else if (map[y][x] == '<')	x--;
			else if (map[y][x] == '^')	y--;
			else if (map[y][x] == 'v')	y++;
		}
		if (check[y][x])	cout << "LOOP";
		else cout << x << ' ' << y;
		cout << endl;
	}
	return (0);
}

Measured memory_bytes: 1180
#define R(i,r)for(int i=0;i<r;i++)
#define P(x,y)x=(x+y)%998244353
b,N,f,A,s[3],dp[1<<18][3][3][2];
main(c){
	for(;read(0,&c,1),c-10;N++)s[c-'a']++,f|=b==c,b=c;
	dp[0][0][0][0]=dp[0][1][1][0]=dp[0][2][2][0]=1;
	R(n,N-1)R(i,3)R(j,3)R(k,2)R(d,3)P(dp[n+1][d][(j+d)%3][k|(i==d)],dp[n][i][j][k]);
	R(i,3)P(A,dp[N-1][i][(s[1]+2*s[2])%3][1]);P(A,!f);
	printf("%d\n",!s[0]+!s[1]+!s[2]>1?:N<4?(s[0]|s[1]|s[2])&2?6+!f:N:A);
}

Measured memory_bytes: 14464
def jmp(h,k):
    n=len(h)
    dp=[1000000000 for i in range(n+1)]
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(n+1):
        for j in range(i+1,i+k+1):
            if(j<n):
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]))
    # print(dp)
    return dp[n-1]


n,k=map(int,input().split())
l=list(map(int,input().split()))
print(jmp(l,k))

Measured memory_bytes: 56544
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
#define int 		long long
#define vi 			vector<int>
#define vec(x) 		vector<x>
#define matrix 		vector<vector<int>>
#define pii 		pair<int,int>
#define rep(i,s,e)  for(int i=s;i<e;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define MOD			1000000007
#define pb 			push_back
#define ff 			first
#define ss 			second		
#define w(x)		int x; cin>>x; while(x--)
const int INF=1e18;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k-1)  returns iterator to kth element starting from 0; Returns the kth smallest element
// order_of_key(k) returns count of elements strictly smaller than k;Returns the number of elements less than k
// erase,insert same as normal set


void solve(){
	int x,y,z;
	cin>>x>>y>>z;

	cout<<z<<' '<<x<<' '<<y<<endl;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ipyth = [[i] * 4 for i in range(m)]
for i in range(m):
    ipyth[i][1], ipyth[i][2] = map(int, input().split())
ipyth.sort(key=lambda x:(x[1], x[2]))
for i in range(m):
    if i:
        if ipyth[i][1] == ipyth[i - 1][1]:
            ipyth[i][3] = ipyth[i - 1][3] + 1
        else:
            ipyth[i][3] = 1
    else:
        ipyth[i][3] = 1
ipyth.sort(key = lambda x: x[0])
for i in range(m):
    print(str(ipyth[i][1]).zfill(6) + str(ipyth[i][3]).zfill(6))

Measured memory_bytes: 33548
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    long long int n;
    cin >> n;
    int d[n];
    for(int i = 0; i < n; ++i) {
        cin >> d[i];
    }
    sort(d, d+n);
    cout << d[n/2]-d[n/2-1] << "\n";
}

Measured memory_bytes: 640
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,tn;
char s[100111],t[100111];
int a[100111],an;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]!='x')
		{
			t[++tn]=s[i];
			a[++an]=cnt;
			cnt=0;
		}
		else
		{
			cnt++;
		}
	}
	a[++an]=cnt;
	for(int i=1;i<=tn;i++)
	{
		if(t[i]!=t[tn-i+1])
		{
			puts("-1");
			return 0;
		}
	}
	int ans=0;
	for(int i=1;i*2<=an;i++)
	{
		ans+=abs(a[i]-a[an-i+1]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 896
from fractions import Fraction
while True:
  s=input()
  if s=="#": break
  s="".join([c for c in s if c=='n' or c=='w'])
  x=0 if s[-1]=='n' else 90
  for i in range(len(s)-1):
    if s[-2-i]=='n':
      x-=Fraction(45,1<<i)
    else:
      x+=Fraction(45,1<<i)
  print(x)

Measured memory_bytes: 14756
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,o,b,c,len,p,best,f;
    int x1,x2,x3,x4,x5;
    cin>>x1>>x2>>x3>>x4>>x5;
    if(x1==0)
        cout<<1;
    else if(x2==0)
        cout<<2;
    else if(x3==0)
        cout<<3;
       else if(x4==0)
        cout<<4;
       else if(x5==0)
        cout<<5;

}





Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef long long ll;

int main()
{
    ll n,k,i,j;
    scanf("%lld %lld",&n,&k);
    
    i=n%k;
    j=k-i;

    if(i>=j)
    {
        printf("%lld\n",j);
    }
    else
    {
        printf("%lld\n",i);
    }

}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int N, M;
    cin >> N >> M;
    ll ans = 1;
    rep(i, M) ans *= 2;
    cout << ans * (1800 * M + 100 * N) << endl;
}

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


int main()
{
	int i, S, n;
	while (cin >> n) {
		i = 0;
		for (S = 1;S <= 9999;S++) {
			if (S/1000+(S-S/1000*1000)/100+(S-S/100*100)/10+S-S/10*10==n)  
				i++;
		}
		cout << i << endl;
	}
    return 0;
}


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long LL;
const int N=2e5+5;

int n,a[N],p[N],dp[N];

int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		p[a[i]]=i;
		dp[i]=1;
	}
	int ans=1;
	for(int i=2;i<=n;i++) {
		if(p[i]>p[i-1]) {
			dp[i]=dp[i-1]+1;
		}
		ans=max(ans,dp[i]);
	}
	ans=n-ans;
	printf("%d\n",ans);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define MAX_N 1000000
#define INF 10000001

static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int N, M;
vector<int> adj[MAX_N];
vector<int> ans(MAX_N);

bool dijkstra() {
    priority_queue<P> PQ;
    int color[MAX_N];
    int d[MAX_N];
    for (int i = 0; i < N; i++) {
        d[i] = INF;
        color[i] = WHITE;
        ans.at(i) = -1;
    }
    d[0] = 0;
    PQ.push(make_pair(0, 0));
    color[0] = GRAY;

    while( !PQ.empty() ) {
        P f = PQ.top();
        PQ.pop();
        int u = f.second;
        color[u] = BLACK;

        if (d[u] < f.first * (-1)) continue;

        for (int j = 0; j < adj[u].size(); j++) {
            int v = adj[u][j];
            if (color[v] == BLACK) continue;
            if (d[v] > d[u] + 1) {
                d[v] = d[u] + 1;
                ans.at(v) = u + 1;
                PQ.push(make_pair(d[v] * (-1), v));
                color[v] = GRAY;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        if (d[i] == INF) return false;
    }
    return true;
}

int main(){
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    bool flag = dijkstra();
    if (flag) {
        cout << "Yes" << endl;
        for (int i = 1; i < N; i++) cout << ans.at(i) << endl;
    } else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 36204
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let xs: Vec<i32> = read_vec();
    match (xs[0] * xs[1]) % 2 {
        0 => println!("Even"),
        1 => println!("Odd"),
        _ => println!(""),
    }
}


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

int main(){
    int N, K;
    char s[51];
    scanf("%d %d", &N, &K);
    getchar();//改行読み捨て
    scanf("%s",s);
    if(s[K-1] == 'A'){
        s[K-1] = 'a';
    }else if(s[K-1] == 'B'){
        s[K-1] = 'b';
    }else if(s[K-1] == 'C'){
        s[K-1] = 'c';
    }
    printf("%s\n",s);
    return 0;
}

Measured memory_bytes: 128
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    xor = 0
    for a in A:
        xor ^= a
    ans = [xor ^ a for a in A]
    print(*ans)
resolve()

Measured memory_bytes: 107712
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
struct cake {
  LL value;
  int a, b, c;
};
bool operator<(cake a, cake b) { return a.value < b.value; }

int main() {
  LL X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  VEC<LL> A(X), B(Y), C(Z);
  REP(i, 0, X) cin >> A[i];
  REP(i, 0, Y) cin >> B[i];
  REP(i, 0, Z) cin >> C[i];
  sort(ALL(A), greater<LL>());
  sort(ALL(B), greater<LL>());
  sort(ALL(C), greater<LL>());

  priority_queue<cake> sums;
  sums.push({A[0] + B[0] + C[0], 0, 0, 0});
  map<tuple<int, int, int>, bool> used;
  REP(i, 0, K) {
    auto t = sums.top();
    cout << t.value << endl;
    // DUMP(t.value, t.a, t.b, t.c);
    sums.pop();
    if (t.a + 1 < X) {
      tuple<int, int, int> tup = make_tuple(t.a + 1, t.b, t.c);
      if (used.count(tup) == 0) {
        sums.push({A[t.a + 1] + B[t.b] + C[t.c], t.a + 1, t.b, t.c});
        used[tup] = true;
      }
    }
    if (t.b + 1 < Y) {
      tuple<int, int, int> tup = make_tuple(t.a , t.b+1, t.c);
      if (used.count(tup) == 0) {
        sums.push({A[t.a] + B[t.b + 1] + C[t.c], t.a, t.b + 1, t.c});
        used[tup] = true;
      }
    }
    if (t.c + 1 < Z) {
      tuple<int, int, int> tup = make_tuple(t.a , t.b, t.c+1);
      if (used.count(tup) == 0) {
        sums.push({A[t.a] + B[t.b] + C[t.c + 1], t.a, t.b, t.c + 1});
        used[tup] = true;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int rate;;
	cin>>rate;
	if(rate<1200)cout<<"ABC";
	else cout<<"ARC";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int

using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,s;s=0;
    cin>>n>>m;
    ll i;ll a[m];
    for(i=0;i<m;i++)
    {
	
	
    cin>>a[i];
    s+=a[i];
}
   if(s<=n)
   cout<<n-s<<endl;
   else
   cout<<-1<<endl;
   return 0; 
}


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

int main() {
string s;
cin >>s;
if(s =="Sunny"){
    cout <<"Cloudy"<<endl;
}
else if(s =="Cloudy"){
    cout <<"Rainy"<<endl;
}
else{
    cout <<"Sunny"<<endl;
}
}





Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200010;
int n,m,a[N];
ll k;
bool st[N];
int main()
{
	cin>>n>>k;
	k++;
	for(int i=1;i<=n;i++) cin>>a[i];
	vector<int> ve;
	int pos=1;
	while(!st[pos])
	{
		ve.push_back(pos);
		st[pos]=1;
		pos=a[pos];
	}
//	for(int i=0;i<ve.size();i++) cout<<ve[i]<<' ';
//	cout<<endl;
	int l,len;
	for(int i=0;i<ve.size();i++)
		if(ve[i]==pos)
		{
			l=i;
			break;
		}
	len=ve.size()-l;
	if(k>ve.size())
	{
		k-=ve.size();
		k%=len;
		if(k==0) cout<<ve[ve.size()-1];
		else
			cout<<ve[k+l-1];
	}
	else cout<<ve[k-1];
	return 0;
}

Measured memory_bytes: 5236
import std.stdio, std.string, std.conv, std.algorithm, std.range, std.math;

void main() {
  string[] s = readln.chomp.split;
  auto input = map!(a => a.to!double)(s);
  double a = input[0], b = input[1];

  writefln("%s", ceil((a + b) / 2));
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	
	int count = 0;
	
	void run() throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] dataSet = br.readLine().split(" ");
		int W = Integer.parseInt(dataSet[0]);
		int H = Integer.parseInt(dataSet[1]);
		
		List<Integer> result = new ArrayList<Integer>();
		
		while (W != 0 || H != 0) {
			char[][] tile = new char[H][W];
			for (int i = 0; i < H; i++) {
				String[] line = br.readLine().split(" ");
				for (int j = 0; j < W; j++) {
					tile[i][j] = line[j].charAt(0);
				}
			}
			for (int m = 0; m < H; m++) {
				for (int n = 0; n < W; n++) {
					if (tile[m][n] == '1') {
						trace(m, n, tile, H, W);
						count++;
					}
				}
			}	
			result.add(count);
			count = 0;
			dataSet = br.readLine().split(" ");
			W = Integer.parseInt(dataSet[0]);
			H = Integer.parseInt(dataSet[1]);
		}
		for (int i = 0; i < result.size(); i++) {
			System.out.println(result.get(i));
		}
	}
	
	void trace(int i, int j, char tile[][], int H, int W) {
		
		// ??????????????¢?´¢
		if (i - 1 >= 0) {
			if (tile[i - 1][j] == '1') {
				tile[i - 1][j] = '2';
				trace(i - 1, j, tile, H, W);
			}
		}
		// ??????????????¢?´¢
		if (j + 1 < W) {
			if (tile[i][j + 1] == '1') {
				tile[i][j + 1] = '2';
				trace(i, j + 1, tile, H, W);
			}
		}
		// ??????????????¢?´¢
		if (i + 1 < H) {
			if (tile[i + 1][j] == '1') {
				tile[i + 1][j] = '2';
				trace(i + 1, j, tile, H, W);
			}
		}
		// ??????????????¢?´¢
		if (j - 1 >= 0) {
			if (tile[i][j - 1] == '1') {
				tile[i][j - 1] = '2';
				trace(i, j - 1, tile, H, W);
			}
		}
		// ?????????????????¢?´¢
		if (i - 1 >= 0 && j - 1 >= 0) {
			if (tile[i - 1][j - 1] == '1') {
				tile[i - 1][j - 1] = '2';
				trace(i - 1, j - 1, tile, H, W);
			}
		}
		// ?????????????????¢?´¢
		if (i - 1 >= 0 && j + 1 < W) {
			if (tile[i - 1][j + 1] == '1') {
				tile[i - 1][j + 1] = '2';
				trace(i - 1, j + 1, tile, H, W);
			}
		}
		// ?????????????????¢?´¢
		if (i + 1 < H && j - 1 >= 0) {
			if (tile[i + 1][j - 1] == '1') {
				tile[i + 1][j - 1] = '2';
				trace(i + 1, j - 1, tile, H, W);
			}
		}
		// ?????????????????¢?´¢
		if (i + 1 < H && j + 1 < W) {
			if (tile[i + 1][j + 1] == '1') {
				tile[i + 1][j + 1] = '2';
				trace(i + 1, j + 1, tile, H, W);
			}
		}
	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		new Main().run();
	}

}

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

int main(){
    int n;
    
    string s;
    double sum=0.0;

    std::cin>>n;

    for(int i=0;i<n;i++){
       double x;
       std::string s;
       std:cin>>x>>s;

       if(s=="JPY"){
        sum+=x;
       }
       else{
           sum+=x*380000.0;
       }
    }

    cout<<sum<<endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

int N;
int A[100000], B[100000], P[100000];

int abs(int x) {
    return x >= 0 ? x : -x;
}

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &A[i], &B[i]);
        P[i] = i;
    }
    std::sort(P, P + N, [&](int i, int j) { return A[i] + B[i] > A[j] + B[j]; });
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            ans += A[P[i]];
        } else {
            ans -= B[P[i]];
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
// #pragma comment(linker, "/stack:200000000"]
 
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
#include <random>
#include <fstream>
#include <sstream>
 
#define fr first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define hm unordered_map 
#define pii pair<int, int>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define cinv(v) for (auto& x: v) cin >> x
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forln(i, l, n) for (int i = l; i < n; ++i)

#define int ll

using namespace std;

#ifdef __LOCAL
	#define dbg(x) cerr << #x << " : " << x << '\n'
	const int maxn = 20;
#else 
	#define dbg(x)
	const int maxn = 2e5 + 20;
#endif

//tg: @galebickosikasa
 
const ll inf = (ll) 2e9;
const ld pi = 3.14159265358979323846264;
const ld eps = 1e-8;
const ll mod = (ll)1e9 + 7;
const ll ns = 97;

random_device rd;
mt19937 SuperRandom(rd());



signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<int> A (a), B (b), C (c);
	cinv (A);
	cinv (B);
	cinv (C);
	sort (all (A));
	sort (all (B));
	sort (all (C));
	reverse (all (A));
	reverse (all (B));
	reverse (all (C));
	vector<int> kek;
	for (int i = 0; i < x; ++i) kek.pb (A[i]);
	for (int i = 0; i < y; ++i) kek.pb (B[i]);
	for (auto& x: C) kek.pb (x);
	sort (all (kek));
	reverse (all (kek));
	int ans = 0;
	for (int i = 0; i < x + y; ++i) ans += kek[i];
	cout << ans;








}

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

int main() {
  int a, b, c;
  cin >> a >> b;
  
  if (b == 100) {
    c = 1000 * a + b;
  }else if (b >= 10){
    c = 100 * a + b;
  }else {
    c = 10 * a + b;
  }
  
  for(int i = 1; i < 400; i ++) {
    if (c == i*i){
      cout << "Yes" << endl;
      exit(0);
     }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int MOD = 998244353;

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int N, S;
   cin >> N >> S;
   VI A(N+1);
   FOR(i, 1, N)
      cin >> A[i];

   int res = 0;

   VVI DP(N+1, VI(S+1));
   DP[0][0] = 1;
   FOR(n, 1, N) {
      DP[n][0] = n+1;
      FOR(s, 1, S-1) {
         DP[n][s] = DP[n-1][s];
         if (s-A[n] >= 0) {
            DP[n][s] += DP[n-1][s-A[n]];
            if (DP[n][s] >= MOD)
               DP[n][s] -= MOD;
         }
      }
      if (S-A[n] >= 0) {
         res = (res + DP[n-1][S-A[n]] * 1LL * (N-n+1)) % MOD;
      }
   }
   
   /*
   FOR(n, 0, N) {
      FOR(s, 0, S) {
         cerr << DP[n][s] << ' ';
      }
      cerr << endl;
   }
   */

   cout << res << '\n';

   return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
    } else if (a >= 6) {
        cout << b/2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import numpy as np


def sum_of_digits(x):
  res = np.zeros_like(x)
  for i in range(len(x)):
    s = 0
    while x[i] > 0:
      s += x[i] % 10
      x[i] = int(x[i] / 10)
    res[i] = s
  return res


n = int(input())
a = np.arange(1, n)
b = a[::-1].copy()
print(np.min(sum_of_digits(a) + sum_of_digits(b)))


Measured memory_bytes: 29816
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        scan.close();

        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            for (int j = i+1; j <= s.length(); j++) {
                String a = s.substring(i, j);
                boolean isOK = true;
                for (int k = 0; k < a.length(); k++) {
                    char c = a.charAt(k);
                    if (c != 'A' && c != 'C' && c != 'G' && c != 'T') {
                        isOK = false;
                        break;
                    }
                }
                if (isOK) {
                    ans = Math.max(ans, a.length());
                }
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 21972
def main():
    n=int(input())
    A=list(map(int,input().split()))
    acc=0
    for a in A:
        acc^=a
    Ans=[0]*n
    for i,a in enumerate(A):
        Ans[i]=acc^a
    print(*Ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 98668
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let q: usize = read();
    let mut tree = vec![vec![]; n];
    for _ in 0..(n - 1) {
        let a: usize = read::<usize>() -1;
        let b: usize = read::<usize>() -1;
        tree[a].push(b);
        tree[b].push(a);
    }
    let mut ans = vec![0; n];
    for _ in 0..q {
        // operation vertex
        let p: usize = read::<usize>() - 1;
        // add value
        let x: usize = read::<usize>();
        ans[p] += x;
    }
    get_values(&tree, 0, 0, &mut ans);
    println!(
        "{}",
        ans
            .iter()
            .map(|i| i.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}
fn get_values(
    tree: &Vec<Vec<usize>>,
    vertex: usize,
    before: usize,
    ans: &mut Vec<usize>,
) {
    for vert in &tree[vertex] {
        if *vert == before {
            continue;
        }
        ans[*vert] += ans[vertex];
        get_values(&tree, *vert, vertex, ans)
    }
}


Measured memory_bytes: 45564