akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

int main() {
	int w, h, n;
	cin >> w >> h >> n;
	bool grid[110][110];
	for (int i = 0; i < 110; i++) {
		for (int j = 0; j < 110; j++) {
			grid[i][j] = false;
		}
	}
	for (int i = 0; i < n; i++) {
		int x, y, a;
		cin >> x >> y >> a;
		switch (a) {
		case 1:
			for (int i = 0; i < x; i++) {
				for (int j = 0; j <= h; j++) {
					grid[i][j] = true;
				}
			}
			break;
		case 2:
			for (int i = x; i <= w; i++) {
				for (int j = 0; j <= h; j++) {
					grid[i][j] = true;
				}
			}
			break;
		case 3:
			for (int i = 0; i < y; i++) {
				for (int j = 0; j <= w; j++) {
					grid[j][i] = true;
				}
			}
			break;
		case 4:
			for (int i = y; i <= h; i++) {
				for (int j = 0; j <= w; j++) {
					grid[j][i] = true;
				}
			}
			break;
		}

	}
	int count = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (!grid[j][i]) {
				count++;
			}
		}
	}
	cout << count << endl;
}

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

using namespace std;

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

    vector<long long> a(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i - 1];
    }

    long long res = 1LL << 61;
    for (int i = 1, j = 2, k = 3; j <= n - 2; j++) {
        for (; i < j - 1; i++) {
            long long p0 = a[i] - a[0], p1 = a[i + 1] - a[0];
            long long q0 = a[j] - a[i], q1 = a[j] - a[i + 1];
            if (max(p0, q0) - min(p0, q0) < max(p1, q1) - min(p1, q1)) {
                break;
            }
        }

        for (; k < n - 1; k++) {
            long long r0 = a[k] - a[j], r1 = a[k + 1] - a[j];
            long long s0 = a[n] - a[k], s1 = a[n] - a[k + 1];
            if (max(r0, s0) - min(r0, s0) < max(r1, s1) - min(r1, s1)) {
                break;
            }
        }

        long long p = a[i] - a[0];
        long long q = a[j] - a[i];
        long long r = a[k] - a[j];
        long long s = a[n] - a[k];
        res = min(res, max({p, q, r, s}) - min({p, q, r, s}));
    }

    cout << res << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
using boost::adaptors::reversed;
namespace rng { using namespace boost; using namespace boost::range; }
struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    string s, t;
    cin >> s >> t;
    map<char, char> s2t, t2s;
    for (auto i : irange(0ul, s.size())) {
        if (s2t.count(s[i]) == 0) {
            s2t.emplace(s[i], t[i]);
        }
        if (t2s.count(t[i]) == 0) {
            t2s.emplace(t[i], s[i]);
        }
        if (s2t[s[i]] != t[i] || s[i] != t2s[t[i]]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


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




int main() {
    int N;  cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; ++i) cin >> H[i];

    vector<int> dp(N);
    for (int i = 1; i < N; ++i) {
        if (H[i] <= H[i - 1]) dp[i] = dp[i - 1] + 1;
    }

    cout << *max_element(dp.begin(), dp.end()) << endl;
}


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

using namespace std;

int main(){
    int a[100][100],b[100],c[100]={};
    int n,m;cin >> n >> m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        cin >> b[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            c[i] += a[i][j]*b[j];
        }
        cout << c[i] << endl;
    }
    return 0;
}


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

vector<vector<pair<int, int>>> v;
vector<int> r;

void dfs(int i, int j, ll d) {
  r[j] = d % 2;
  for (auto e : v[j]) {
    if (e.first == i) continue;
    dfs(j, e.first, d + e.second);
  }
}

int main() {
  int n;
  cin >> n;
  v = vector<vector<pair<int, int>>>(n);
  for (int i = 0; i < n - 1; i++) {
    int p, q, w;
    cin >> p >> q >> w;
    p--;
    q--;
    v[p].push_back({q, w});
    v[q].push_back({p, w});
  }
  r = vector<int>(n);
  dfs(0, 0, 0);
  for (auto e : r) cout << e << endl;
}


Measured memory_bytes: 8192
a, b, ab, x, y = map(int, input().split())

ans = 0
if a + b < 2 * ab:
    print(a * x + b * y)
else:
    ans += min(x, y) * 2 * ab
    if x > y:
        cost_one = min(a, 2 * ab)
        ans += cost_one * (x - y)
    else:
        cost_one = min(b, 2 * ab)
        ans += cost_one * (y - x)

    print(ans)


Measured memory_bytes: 3060
#include <iostream>
using namespace std ;
int main () {
    string s;
    int a =700;
    cin >> s;
    
    for(int i = 0; i < 3; i++)
    {
        
        if (s[i] == 'o') {
            a+=100;
        }
        
    }
    cout << a << endl;
    
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;



int main(){
  int k,x;
  cin >> k >> x;

  int minx = max(x-k+1,-1000000);
  int maxx = min(x+k-1,1000000);

  int i;
  for(i=minx;i<=maxx;i++){
    cout << i << " ";
  }

  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int>P(n);
  for(int i=0;i<n;i++){
  cin >> P.at(i);
  }
  int count = 0;
  for(int i=0;i<n;i++){
    if(P.at(i)!=i+1){
      count++;
    }
  }
  if(count<=2){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<ll,P> PP;
int x[200000] = {};
int main() {
	int n, m; cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		if (a == 0)x[b]++;
		if (b == n - 1)x[a] += 2;
	}
	bool f = false;
	rep(i, n) {
		if (x[i] == 3)f = true;
	}
	if (f)cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(void){
    unsigned int n;
    unsigned int h[100000];

    cin >> n; 
    for(unsigned int i=0; i<n; i++){
        cin >> h[i];
    }

    int ans = 1;
    unsigned int max = 0;

    for(unsigned int i=0; i<n; i++){
        if( h[i] > max){
            max = h[i];
            continue;
        }
        if( max > h[i] + 1){
            ans = 0;
            break;
        }
    }

    if(ans == 0){
        cout << "No"; 
    }else{
        cout << "Yes";
    }

    return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
    b.at(a.at(i) - 1) = i + 1;
  }
  for(int i = 0; i < n; i++){
    cout << b.at(i) << endl;
  }
}


Measured memory_bytes: 1664
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    sort(a, a + n);
    int c = 1, ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] == a[i + 1])
        {
            c++;
        }
        if (a[i] != a[i + 1])
        {
            if (c % 2 == 0)
            {
                ans--;
                c = 1;
            }
            if (c % 2 == 1)
            {
                ans++;
                c = 1;
            }
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 896
#include<stdio.h>
int main()
{  int a,b;
   scanf("%d %d",&a,&b);
   if(a<b){
   printf("a < b\n");
   }else if(a>b){
   printf("a > b\n");
   }else if(a==b){
   printf("a == b\n");
   }
   return 0;
}


Measured memory_bytes: 2036
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment(" -Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n,k,cnt;
int ans[6666],factor[6666];
int main(){
	cin>>n>>k;
	for(int i=1;i*i<=n;i++){
		if(n%i==0)factor[++cnt]=i;
	}
	for(int i=sqrt(n)+5;i>=1;i--){
		if(n%i==0&&(n/i>factor[cnt]))factor[++cnt]=n/i;
	}
	for(int i=1;i<=cnt;i++){
		ans[i]=modpow(k,(factor[i]+1)/2);
		for(int j=1;j<i;j++){
			if(factor[i]%factor[j]==0){
				ans[i]-=ans[j];
				if(ans[i]<0)ans[i]+=mod;
			}
		}
	}
	ll res=0;
	for(int i=1;i<=cnt;i++){
		if(factor[i]%2==0){
			res=res+1ll*ans[i]*factor[i]%mod;
			res%=mod;
		}else{
			res=res+2ll*ans[i]*factor[i]%mod;
			res%=mod;
		}
	}
	cout<<res*500000004ll%mod<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int m, f, r, i, j;
  char grade[10000] = {};

  for(i = 0; ;i++){
    scanf("%d %d %d", &m, &f, &r);
    if(m == -1 && f == -1 && r == -1)
      break;
    else if(m == -1 || f == -1)
      grade[i] = 'F';
    else if(80 <= m + f)
      grade[i] = 'A';
    else if(65 <= m + f && m + f < 80)
      grade[i] = 'B';
    else if(50 <= m + f && m + f < 65)
      grade[i] = 'C';
    else if(30 <= m + f && m + f < 50)
      if(50 <= r)
	grade[i] = 'C';
      else
	grade[i] = 'D';
    else
      grade[i] = 'F';
  }

  for(j = 0; j < i; j++)
    printf("%c\n", grade[j]);
  
  return 0;
}

Measured memory_bytes: 616
S = list(input())
NS = [s for s in S]
K = int(input())
L = len(S)

if "".join(S) == S[0] * L:
  print(L * K // 2)
  exit()

ans = 0
for i in range(L-1):
  f_s = S[i]
  s_s = S[i+1]
  if f_s == s_s:
    S[i+1] = '-'
    ans += 1

# 先頭と末尾が異なる
if S[0] != S[-1]:
  ans *= K
# 一緒
else:
  a = 0
  for i in range(L):
    if NS[i] == NS[0]:
      a += 1
    else:
      break
  
  b = 0
  for i in range(L)[::-1]:
    if NS[i] == NS[-1]:
      b += 1
    else:
      break
      

  ans *= K
  #t = (- (-a // 2)) + (- (-b // 2)) - (- (-a-b) // 2)
  #t = -(-a // 2) - (-b // 2) + (-(a+b) // 2)
  t = a // 2 + b // 2 - (a+b) // 2
  ans -= t * (K-1)
  
print(ans)
  


Measured memory_bytes: 9236
import sys
sys.setrecursionlimit(10**9)
N,W = map(int,input().split())
w = []
v = []
for i in range(N):
  w_,v_ = map(int,input().split())
  w.append(w_)
  v.append(v_)

dp = [[0]*(W+1) for _ in range(N+1)]

def memo(i,j):
  if dp[i][j]:
    return dp[i][j]
  if i == N:
    dp[i][j] = 0
  elif w[i] > j:
    dp[i][j] = memo(i+1,j)
  else:
    dp[i][j] = max(memo(i+1,j),memo(i+1,j-w[i])+v[i])
  return dp[i][j] 
print(memo(0,W))

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

int ab(int x){
  if(x>0){
    return x;
  }else{
    return -x;
  }
}

int main(){
  int N;
  cin>>N;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin>>h.at(i);
  }
  vector<int> dp(N,1000000000);
  dp.at(0)=0;
  for(int i=1;i<N-1;i++){
    dp.at(i)=min(dp.at(i),dp.at(i-1)+ab(h.at(i)-h.at(i-1)));
    dp.at(i+1)=min(dp.at(i+1),dp.at(i-1)+ab(h.at(i+1)-h.at(i-1)));
  }
  dp.at(N-1)=min(dp.at(N-1),dp.at(N-2)+ab(h.at(N-1)-h.at(N-2)));
  
  cout<<dp.at(N-1)<<endl;
}

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

using namespace std;

constexpr int MX = 100005;
int rnk[MX];
int w_diff[MX];
int root[MX];

int find(int x){
  if (x == root[x]) return x;
  int r = find(root[x]);
  w_diff[x] += w_diff[root[x]];
  return root[x] = r;
}

int weight(int x){
    find(x);
    return w_diff[x];
}

int diff(int x, int y){
    return weight(y) - weight(x);
}

void merge(int x, int y, int w){
    
    w += weight(x);
    w -= weight(y);

    x = find(x);
    y = find(y);
    
    if (x == y) return;
    
    if(rnk[x] < rnk[y]) swap(x, y),  w = -w;
    if(rnk[x] == rnk[y]) ++rnk[x];
    root[y] = x;
    w_diff[y] = w;
}

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

    int n, q;
    cin >> n >> q;
    
    for(int i=0; i<MX; i++) {
        rnk[i]=0;
        w_diff[i]=0;
        root[i]=i;
    }
 
    for(int i=0; i<q; i++){
        int c, x, y, z;
        cin >> c;
        if(c == 0){
            cin >> x >> y >> z;
            merge(x, y, z);
        }else if (c == 1){
            cin >> x >> y;
            if (find(x) != find(y)){
                cout << "?" << endl;
            }else{
                cout << diff(x, y) << endl;   
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4376
#include <unordered_map>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using hash_type = ll;

template <typename T>
struct poly_hash {
    poly_hash(const string& s, T P, T MOD):
        s_(s), P_(P), MOD_(MOD) {

        int n = s_.size();
        pows_.resize(n);

        pows_[0] = 1;
        for (int i = 1; i < n; ++i)
            pows_[i] = (pows_[i - 1] * P_) % MOD_;

        pref_.resize(n + 1); 
       for (int i = 0; i < n; ++i)
            pref_[i + 1] = (pref_[i] + ((s[i] - 'a' + 1) * pows_[i]) % MOD) % MOD_;
    }

    T hash_substr(int i, int l) const {
        int n = s_.size();
        T h = (pref_[i + l] + MOD_ - pref_[i]) % MOD_;
        h = (h * pows_[n - i - 1]) % MOD_;

        return h;
    }

    string s_;
    T P_;
    T MOD_;
    vector<T> pows_;
    vector<T> pref_;
};

bool is_good(const poly_hash<hash_type>& h1, const poly_hash<hash_type>& h2, int l,
             int n)
{
    unordered_map<int, hash_type> cnt1;
    unordered_map<int, hash_type> cnt2;

    for (int i = 0; i <= n - l; ++i) {
        hash_type x = h1.hash_substr(i, l);
        hash_type y = h2.hash_substr(i, l);

        auto itx = cnt1.find(x);
        auto ity = cnt2.find(y);

        if (itx == cnt1.end() || ity == cnt2.end()) {
            if (itx == cnt1.end())
                cnt1.insert({x, i});

            if (ity == cnt2.end())
                cnt2.insert({y, i});

            continue;
        }

        if (i >= itx->second + l && i >= ity->second + l)
            return true;
    }

    return false;
}

int main()
{
    std::ios::sync_with_stdio(false);

    int n;
    cin >> n;
    string s;
    cin >> s;

    poly_hash<hash_type> h1(s, 31, 1e9 + 9);
    poly_hash<hash_type> h2(s, 29, 1e9 + 7);

    int l = 1, r = n;
    while (l < r) {
        int m = r - (r - l)/2;
        if (is_good(h1, h2, m, n))
          l = m;
        else
          r = m - 1;
    }


    if (is_good(h1, h2, l, n))
        cout << l << endl;
    else
        cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 908
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<sstream>
#include<string>
#include<string.h>
#include<cmath>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#define E (2.71828182)
#define PI (3.1415926535898)
#define	mem(a,b)	memset(a,b,sizeof(a))
#define mod	1000000007
#include<set>
#define gc getchar
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<float, int> P;
const int N = 1000000;
const long long  MAX_V = 5005, INF = 2147483647, MOD = 998244353;
bool prime[N + 5];
int p[N + 5], tot;
void init()
{
	for (int i = 2; i < N; i++) prime[i] = true;
	for (int i = 2; i < N; i++)
	{
		if (prime[i])	p[tot++] = i;
		for (int j = 2 * i; j < N; j += i)
			prime[i] = false;
	}
}
ll a, b, ans, x;
ll gcd(ll a, ll b)
{
	if (b == 0)	return a;
	return gcd(b, a % b);
}
int main()
{
	init();
	while (~scanf("%lld%lld", &a, &b))
	{
		ans = 1;
		x = gcd(a, b);
		for (int i = 0; p[i] <= sqrt(x); i++)
		{
			if (x % p[i] == 0)	
			{
				ans++;
				while (x % p[i] == 0)	x /= p[i];
			}
		}
		if (x != 0 && x != 1)	ans++;
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 5752
from collections import deque

H,W = [int(i) for i in input().split()]
l = [list(input()) for _ in range(H)]
ans = [[-1]*W for _ in range(H)]
q = deque()

for i in range(H):
    for j in range(W):
        if l[i][j] == '#':
            q.append([i,j])
            ans[i][j] = 0

t = 0
while q:
    i,j = q.popleft()
    for next_i, next_j in [[i+1,j], [i-1,j], [i,j+1], [i,j-1]]:
        if 0 <= next_i < H and 0 <= next_j < W:
            if ans[next_i][next_j] == -1 and l[next_i][next_j] == '.':
                ans[next_i][next_j] = ans[i][j] + 1
                t = max(t, ans[next_i][next_j])
                q.append([next_i,next_j])

print(t)


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

int Dfs(int n, int s, int p) {
  if (n == 0 && s == 0)
    return 1;
  if (n < 0)
    return 0;
  int res = 0;
  for (int i = p + 1; i <= 9; ++i)
    res += Dfs(n - 1, s - i, i);
  return res;
}

int main() {
  while (true) {
    int n, s;
    cin >> n >> s;
    if (n == 0 && s == 0)
      break;
    cout << Dfs(n, s, -1) << endl;
  }
}


Measured memory_bytes: 3016
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;

int main(){
	long long a,b;
	char c;
	scanf("%lld %c %lld", &a, &c, &b);

	if(c=='+'){
		printf("%lld\n",a+b);
	}else{
		printf("%lld\n", a-b);
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

#define PB push_back
#define ALL(v) (v).begin(), (v).end()
#define SZ size()
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define REP(i, n) FOR((i), 0, (n))
#define GET(a) cin >> (a)
#define GET2(a, b) cin >> (a) >> (b)
#define GET3(a, b, c) cin >> (a) >> (b) >> (c)
#define SHOW(v) cout << (v) << endl
#define SHOW2(a, b) cout << (a) << " " << (b) << endl
#define SHOW3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define MOD 1000000007
template<class T> void GETV(T &v) { REP(i, v.size()) { GET(v[i]); } }
template<class T> void SHOWV(T &v) { REP(i, v.size()) { SHOW(v[i]); } }

typedef long long ll;


int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	int sum = 0;
	for(int i = 0; i < n; i++) {
		cin >> v[i];
		sum += v[i];
	}
	
	int max = v[0];
	for(int i = 0; i < n; i++) {
		if(max < v[i]) {
			max = v[i];
		}
	}
	
	if(sum - max > max) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?(c=getchar()):0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
const int N=2010,O=1000000007;
inline int fpow(lint x,int n){
	int a=1;
	for(;n;n>>=1,x=x*x%O){
		if(n&1){
			a=a*x%O;
		}
	}
	return a;
}
inline int inv(int x){
	return fpow(x,O-2);
}
int fac[N*N],invfac[N*N];
inline void gmath(int n){
	fac[0]=1;
	for(int i=1;i<=n;i++){
		fac[i]=(lint)fac[i-1]*i%O;
	}
	invfac[n]=inv(fac[n]);
	for(int i=n;i>=1;i--){
		invfac[i-1]=(lint)invfac[i]*i%O;
	}
}
inline int C(int n,int m){
	if(n<m){
		return 0;
	}
	return (lint)fac[n]*invfac[m]%O*invfac[n-m]%O;
}
lint f[N];
int main(){
	int n=ni,k=ni;
	if(k<=1){
		puts("1");
		return 0;
	}
	gmath(n*k);
	memset(f,0,sizeof(f));
	f[0]=1;
	for(int i=1;i<=n;i++){
		for(int j=i;j>=0;j--){
			f[j]=f[j+1];
			if(j){
				(f[j]+=(lint)f[j-1]*C((i-1)*(k-1)+(i-j)+(k-2),k-2)%O*(n-i+1))%=O;
			}
		}
	}
	printf("%lld\n",f[0]);
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  ll a, b, k; cin >> a >> b >> k;
  for(int i = a; i <= min(b, a+k-1); ++i) {
    cout << i << endl;
  }
  for(int i = max(b-k+1, a+k); i <= b; i++) {
    cout << i << endl;
  }

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int x;
  cin >> x;

  int t = 0;
  while (t*(t+1) / 2 < x) {
    t++;
  }
  cout << t << endl;

}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
use std::collections::BinaryHeap;
fn main(){
    input!{
        n:usize,
        m:usize,
        an:[usize;n],
    }
    let mut heap = BinaryHeap::new();
    for &a in &an {
        heap.push(a);
    }
    for _ in 0..m {
        let res = heap.pop().unwrap()/2;
        heap.push(res);
    }
    let ans:usize = heap.into_iter().sum();
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
map<string,int> mp;
set<string> s;
int main() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++) {
        string st;
        cin>>st;
        s.insert(st);
        mp[st]++;
    }
    vector<string> v;
    int maxn=0;
    for(set<string>::iterator it=s.begin();it!=s.end();it++) {
        if(mp[*it]>maxn) {
            maxn=mp[*it];
            v.clear();
            v.push_back(*it);
        }
        else if(mp[*it]==maxn) {
            v.push_back(*it);
        }
    }
    for(int i=0;i<v.size();i++) cout<<v[i]<<endl;
    return 0;
}

Measured memory_bytes: 36212
package main

import "fmt"

func main() {
	// Code for C - Candies
	var N int
	fmt.Scanf("%d", &N)

	var temp1 int
	A1 := make([]int, N)
	S1 := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A1[i])
		temp1 += A1[i]
		S1[i] = temp1
	}

	A2 := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A2[i])
	}

	var temp2 int
	S2 := make([]int, N)

	for i := N - 1; 0 <= i; i-- {
		temp2 += A2[i]
		S2[i] = temp2
	}

	var score int
	var max int
	for i := 0; i < N; i++ {
		score = S1[i] + S2[i]
		if max < score {
			max = score
		}
	}

	fmt.Println(max)
}


Measured memory_bytes: 1844
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<memory>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a)   a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }
    ModInt operator<<(const int n){
        return ModInt(*this)*ModInt(2).pow(n);
    }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;
int main(){
    ll R,G,B,N; cin >> R >> G >> B >> N;
    ll cnt = 0;
    
    for(ll r = 0;r*R<=N;r++){
        ll N1 = N-r*R;
        for(ll g = 0;N1>=0&&g*G<=N1;g++){
            ll B2 = N1 - g*G;
            if(B2<0) break;
            if(B2==0) cnt++;
            else if(B2%B==0){
                cnt++;
            }
            
        }
    }
    cout << cnt <<endl;
    return 0;
}

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

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

    int i, j;
    int n, m, k, q;
    cin >> n >> m >> k >> q;
    int o[n];
    int mi = 1010101010;
    for (i = 0; i < n; i++) {
        cin >> o[i];
        k -= o[i];
        mi = min(mi, o[i]);
    }
    mi--;
    int x[q];
    for (i = 0; i < q; i++) cin >> x[i];

    vector<bool> v(200020, 0);

    if (m != 0) {
        for (i = 0; i < 200020; i++) {
            if (i > k) break;
            int rest = m - i / mi;
            if (i % mi != 0) rest--;
            if (mi * rest + i >= k) v[i] = 1;
        }
    }

    else {
        v[0] = 1;
    }

    vector<vector<bool> > w(n);
    for (i = 0; i < n; i++) w[i] = v;

    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            if (i == j) continue;
            for (int l = 200019; l >= 0; l--) {
                if (l - o[j] >= 0 && w[i][l - o[j]] == 1) w[i][l] = 1;
            }
        }
    }

    for (i = 0; i < q; i++) {
        vector<int> ans;
        for (j = 0; j < n; j++) {
            if (!w[j][x[i]]) ans.push_back(j);
        }
        if (ans.size() == 0) {
            cout << -1 << endl;
        } else {
            for (int a = 0; a < ans.size(); a++) {
                cout << ans[a] + 1;
                if (a != ans.size() - 1) cout << ' ';
            }
            cout << endl;
        }
    }
}



Measured memory_bytes: 3920
#include<iostream>
#include<string>
#include<map>
#define int long long int

using namespace std;

signed main(){

    int N, M, X;
    cin >> N >> M >> X;

    int A[1000];
    int i, cnt = 0;

    for(i = 0; i < M; i++){
        cin >> A[i];

        if(X > A[i]){
            cnt++;
        }
    }

    if(cnt < M - cnt){
        cout << cnt << endl;
        return 0;
    }else{
        cout << M - cnt << endl;
        return 0;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m; cin >> n >> m;
  vector<pair<int,int> > e;
  for(int i = 0; i < m; i++){
    int x, y; cin >> x >> y; x--; y--;
    e.push_back({x, y});
  }
  vector<int> uf(n), sz(n);
  for(int i = 0; i < n; i++) uf[i] = i, sz[i] = 1;
  auto find = [&](int x){
    vector<int> path;
    while(uf[x] != x){
    	path.push_back(x);
      	x = uf[x];
    }
    for(int v: path) uf[v] = x;
    return x;
  };
  long long tot = 1ll * n * (n - 1) / 2;
  vector<long long> ans(m);
  for(int i = m - 1; i >= 0; i--){
    ans[i] = tot;
  	int x, y; tie(x, y) = e[i];
    x = find(x);
    y = find(y);
    if(x != y){
    	tot -= 1ll * sz[x] * sz[y];
     	sz[x] += sz[y]; sz[y] = 0;
      	uf[y] = x;
    }
  }
  for(int i = 0; i < m; i++) cout << ans[i] << endl;
  return 0;
}
  


Measured memory_bytes: 3700
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int curr=1;
    int i;
    for(i=0; i<20; i++) {
        if(n==curr) {
            printf("No\n"); return 0;
        }
        if(curr*2>n) break;
        curr*=2;
    }
    printf("Yes\n");

    printf("%d %d\n", 2+n, 1+n);
    int k=(n-1)/2;
    for(i=1; i<=k; i++) {
        printf("%d %d\n", 1, 2*i);
        printf("%d %d\n", 1, 2*i+1);
        printf("%d %d\n", 2*i,   n+2*i+1);
        printf("%d %d\n", 2*i+1, n+2*i);
    }
    if((n-1)%2) {
        printf("%d %d\n", curr, n);
        printf("%d %d\n", n^curr^1, 2*n);
    }

    return 0;
}



Measured memory_bytes: 2176
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e5+10,inf=2147483647;
int a[N],b[N];
int n,m;
int ans;

int main(){
#ifndef ONLINE_JUDGE
	//freopen("a.in","r",stdin);
#endif
	int x;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i){
		scanf("%d",&x);
		if (x>0) a[++a[0]]=x;
		else if (x<0) b[++b[0]]=-x;
		else --m;
	}
	int tmp1,tmp2;
	ans=inf;
	for (int i=0;i<=a[0];++i){
		if (b[0]<m-i) continue;
		tmp1=a[i];
		tmp2=b[b[0]-(m-i)+1];
		ans=min(ans,min(tmp1*2+tmp2,tmp2*2+tmp1));
	}
	/*if (b[0]>=m) ansleft=b[m];
	else{
		tmp1=b[b[0]];
		tmp2=a[a[0]-(n-b[0])+1];
		ansleft=min(tmp1*2+tmp2,tmp2*2+tmp1);
	}*/
	printf("%d\n",ans);
}

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

#define int long long
//#define uint __int128_t

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int A,B,C,N;
string s;

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>A>>B>>C;
    cout<<A*B*C/max({A,B,C})/2<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void read(int &x){
	char c=getchar();
	int f=1;
	x=0;
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	x*=f;
}
int main(){
	int i,j,k,m,n;
	read(n);read(m);read(k);
	cout<<max(0,m+k-n)<<endl;
	return 0;
}

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

int main()
{
    int n, a, yes = 1;

    cin >> n;

    while(n--)
    {
        cin >> a;
        if(yes && (a % 2 == 0 && (a % 3 &&  a % 5)))
            yes = 0;
    }

    cout << (yes ? "APPROVED" : "DENIED");

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
typedef long long ll;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,a[N];
ll ans=0;
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) {
        a[i]=gi();
        ans+=min(a[i-1],a[i]);a[i]-=a[i-1];
        if(a[i]<0) a[i]=0;
        ans+=a[i]/2;a[i]=a[i]&1;
    }
    printf("%lld\n",ans);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 640
#include<stdio.h>

int main(void){

	int sum = 0,high = 0,amount = 0,num = 0,cnt;
	
	scanf("%d",&num);
	for(cnt = 1 ; cnt <= num ; cnt = cnt + 1){
	
		scanf("%d",&amount);
		sum += amount;
		if(amount > high){
			high = amount;
		}
	
	}
	sum = sum - (high / 2);
	printf("%d",sum);
	
	return 0;
}

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

signed main(void)
{
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout << H * W - h * W - (H - h) * w << endl;
	return 0;
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	s := getString()
	t := getString()

	for i := 0; i < len(s); i++ {
		if s[i] != t[len(t)-1-i] {
			out("NO")
			return
		}
	}
	out("YES")
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		sc.close();
		if (X == 3 || X == 5 || X == 7) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  char c;
  cin >> c;
  cout << (char)(c + 1) << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    int X, N;
    cin >> X >> N;

    if (N == 0)
    {
        printf("%d\n", X);
        return (0);
    }

    vector<int> p(N);
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }
    sort(p.begin(), p.end());

    int temp = INF;
    int mn = INF;
    int ans;
    bool ok = false;
    for (int i = 0; i <= 101; i++)
    {
        ok = false;
        for (int j = 0; j < N; j++)
        {
            if (i == p[j])
            {
                break;
            }
            if (j == N - 1)
            {
                // printf("num = %d\n", i);
                ok = true;
            }
        }
        if (ok == true)
        {
            temp = abs(i - X);
            if (temp < mn)
            {
                mn = temp;
                ans = i;
            }
        }
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define FASTIO
#define endl "\n" // Since endl forces a buffer flush which slows down large I/O operations.
#define ff first
#define ss second
#define pb push_back
#define input(c, n)             \
	for (int i = 0; i < n; i++) \
		cin >> c[i];
#define exit_message(s) return 0 * printf(s)
#define show(c)           \
	for (auto i : c)      \
		cout << i << " "; \
	cout << "\n";
#define display(c, n)           \
	for (int i = 0; i < n; i++) \
		cout << c[i] << " ";    \
	cout << "\n";
#define forl(i, a, n) for (int i = a; i < n; i++)
#define dugbe(k) cout << "-\t> " << #k << " = " << k << "\n";

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vill;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 1e9 + 7;
const int N = 1e5 + 5;

ll mod_pow(ll a, ll b)
{
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;

	return res;
}

ll n, k;
ll happy[N][3];

int32_t main()
{
#ifdef FASTIO
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#endif
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int n;
	cin >> n;
	int m[n + 5][3];
	forl(i, 0, n)
	{
		forl(j, 0, 3)
			cin >> m[i][j];
	}
	forl(j, 0, 3)
		happy[0][j] = m[0][j];
	forl(i, 1, n)
	{
		forl(j, 0, 3)
		{
			happy[i][j] = -1;
			forl(k, 0, 3)
			{
				if (k == j)
					continue;
				happy[i][j] = max(happy[i][j], happy[i - 1][k] + m[i][j]);
			}
		}
	}
	ll answer = -1;
	forl(k, 0, 3)
		answer = max(answer, happy[n - 1][k]);
	
	cout << answer << "\n";

	return 0;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h> 
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;
#define fo(i,s,e_ex) for(i=s;i<e_ex;i++)
#define Fo(i,k,n) for(i=k;k<n?i<=n:i>=n;k<n?i+=1:i-=1)
#define endl '\n'
#define MOD 1000000007//998244353
#define pbb push_back
#define mpp make_pair
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define mset(arr,val) memset(arr,val,sizeof(arr))
ll a[20][20],n;
ll dp[66000],gc[66000];
vi sm[66000];
bool dpp[66000];
void findsm(ll pos,ll bitmask,ll submask){
    if(pos==n){
        if(setbits(submask)==0) return;
        sm[bitmask].pbb(submask);
        return;
    }
    findsm(pos+1,bitmask,submask);
    findsm(pos+1,bitmask|(1<<pos),submask);
    findsm(pos+1,bitmask|(1<<pos),submask|(1<<pos));
}
void findgc(){
    for(ll b=1;b<pow(2,n);b++){
        //b is the bitmask
        gc[b]=0;
        for(ll i=0;i<n;i++){
            if(        ((1<<i) & b)==0   ) continue;
            for(ll j=i+1;j<n;j++){
                if(        ((1<<j) & b)==0   ) continue;
                gc[b]+=a[i][j];
            }
        }
    }
}
ll findans(ll bitmask){
    if(bitmask==0) return 0;
    if(dpp[bitmask]) return dp[bitmask];
    ll ans=LLONG_MIN;
    for(auto submask:sm[bitmask]){
        ans = max(ans,findans(bitmask^submask)+gc[submask]);
    }
    dpp[bitmask]=true;
    return dp[bitmask]=ans;
}
void solve(ll caseno){
	ll i,j,ans;
    cin>>n;
    fo(i,0,n){
        fo(j,0,n){
            cin>>a[i][j];
        }
    }
    findsm(0,0,0);
    findgc();
    mset(dpp,0);
    ans = findans(pow(2,n)-1);
    cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll t=1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		solve(i);
	}
	return 0;
}


Measured memory_bytes: 347976
#include <stdio.h>

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (a == b)
    {
        printf("%d\n", c);
    }
    if (a == c)
    {
        printf("%d\n", b);
    }
    if (b == c)
    {
        printf("%d\n", a);
    }

    return 0;
}


Measured memory_bytes: 128