akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n,l,r,ans=0;
    pair<int,int> left[100000],right[100000];
    vector<pair<int,int> > v1,v2;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&l,&r);
        v1.push_back({l,r});
        v2.push_back({r,l});
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    left[0]={v1[0].first,v1[0].second};
    for(int i=1;i<n;i++){
        left[i].first=max(left[i-1].first,v1[i].first);
        left[i].second=min(left[i-1].second,v1[i].second);
    }
    right[n-1]={v1[n-1].first,v1[n-1].second};
    for(int i=n-2;i>=0;i--){
        right[i].first=max(right[i+1].first,v1[i].first);
        right[i].second=min(right[i+1].second,v1[i].second);
    }
    for(int i=1;i<n;i++){
        int x=0;
        if(left[i-1].first<=left[i-1].second){
            x+=left[i-1].second-left[i-1].first+1;
        }
        if(right[i].first<=right[i].second){
            x+=right[i].second-right[i].first+1;
        }
        ans=max(ans,x);
    }
    for(int i=1;i<n-1;i++){
        int x=0;
        if(max(left[i-1].first,right[i+1].first)<=min(left[i-1].second,right[i+1].second)){
            x+=min(left[i-1].second,right[i+1].second)-max(left[i-1].first,right[i+1].first)+1;
        }
        x+=v1[i].second-v1[i].first+1;
        ans=max(ans,x);
    }
    left[0]={v2[0].second,v2[0].first};
    for(int i=1;i<n;i++){
        left[i].first=max(left[i-1].first,v2[i].second);
        left[i].second=min(left[i-1].second,v2[i].first);
    }
    right[n-1]={v2[n-1].second,v2[n-1].first};
    for(int i=n-2;i>=0;i--){
        right[i].first=max(right[i+1].first,v2[i].second);
        right[i].second=min(right[i+1].second,v2[i].first);
    }
    for(int i=1;i<n;i++){
        int x=0;
        if(left[i-1].first<=left[i-1].second){
            x+=left[i-1].second-left[i-1].first+1;
        }
        if(right[i].first<=right[i].second){
            x+=right[i].second-right[i].first+1;
        }
        ans=max(ans,x);
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 3572
#include <iostream>
#include <iostream>

using namespace std;

int main() {

  int a, b, k, poo;
  cin >> k >> a >> b;
  poo = ((a - 1) / k) * k + k;
  if(poo <= b){
    cout << "OK";
  }else{
    cout << "NG";
  }
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];
    
    ll ans = 0;
    for(int i = 0; i + 1 < n; ++i){
        if(a[i] + a[i + 1] <= x)    continue;
        int dif = a[i] + a[i + 1] - x;
        ans += dif;
        if(a[i + 1] >= dif) a[i + 1] -= dif;
        else    a[i + 1] = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
n, m = map(int, input().split())
s = [0 for i in range(n)]
e = [0 for i in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    if x == 1:
        s[y] = 1
    elif y == n:
        e[x] = 1
flag = False
for i in range(n):
    if s[i] == 1 and e[i] == 1:
        flag = True
        break
if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 55628
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int a=gi();
	    int b=gi();
	    //int c=gi();



        //System.out.println(Math.min(Math.min(a+b, b+c), c+a));
        if (a%3==0 || b%3==0 || ((a+b)%3==0) ) {
        	System.out.print("Possible");
        }else {
            System.out.print("Impossible");
        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
}

Measured memory_bytes: 35616
//https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_a
//A - Signboard
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    string S; cin>>S;
    string b="CODEFESTIVAL2016";
    assert(S.size()==b.size());
    ll ans=0;
    REP(i,S.size()){
        if(S.at(i)!=b.at(i)) ++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int gcd(int,int);
int main(){
  int a,b;

  scanf("%d %d",&a,&b);
  printf("%d\n",gcd(a,b));

  return 0;
}

int gcd(int a,int b){
  if(b==0) return a;
  else return gcd(b,a%b);
}

Measured memory_bytes: 592
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if ("abc" == s) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int n,m;
    int c;

    cin >> n >> m;

    vector<bool> buf(m);
    for (int i = 0; i < buf.size(); i++)
    {
        buf[i] = true;
    }

    for (int i = 0; i < n; i++)
    {
        int k;
        cin >> k;

        vector<bool> list(m);

        for (int j = 0; j < k; j++){
            int a;
            cin >> a;
            list[a-1] = true;
        }

        for (int i = 0; i < m; i++)
        {
            if (! list[i]) {
                buf[i] = false;
            }
        }

        // cout << "test:" << k << endl;
    }

    int count = 0;
    for (int i = 0; i < m; i++)
    {
        if (buf[i]) {
            count++;
        }

    }

    cout << count;


    return 0;
}

Measured memory_bytes: 256
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(12)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
#define    fbo    find_by_order
#define    ook    order_of_key
#define    upb    upper_bound
#define    lowb   lower_bound 
#define    lte(v,x)   upb(all(v),x)-v.be()
#define    gte(v,x)   v.end()-lowb(all(v),x)
const    ld   PI=3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{

ll n,k;
cin>>n>>k;

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



map<int,int> m;
int tim=0;
int i=1;

while(true)
{if(k==0)
{
	cout<<i;
	return 0;
}
	if(m.find(i)!=m.end())
	{
		int d=tim-m[i];
		k=k%d;
		while(true)
		{
			if(k==0)
			{cout<<i;
			return 0;}
			i=a[i];
			k--;
		}
	}
	
	m[i]=tim;
	tim++;
	i=a[i];
	k--;
	
	
}



}return 0;}

Measured memory_bytes: 11936
import java.util.Arrays;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] edge = new int[m][3];
        for (int i = 0; i < m; i++) {
            edge[i][0] = sc.nextInt() -1;
            edge[i][1] = sc.nextInt() -1;
            edge[i][2] = -sc.nextInt();
        }
        long[] d = bellmanFord(n, edge, 0);
        if(d == null) System.out.println("inf");
        else System.out.println(-d[n-1]);
        sc.close();

    }
    public static long[] bellmanFord(int n, int[][] edge, int s){
        long d[] = new long[n];
        Arrays.fill(d, Long.MAX_VALUE);
        d[s] = 0L;
        for (int i = 0; i < n; i++) {
            for(int j = 0; j < edge.length; j++){
                int[] e = edge[j];
                if(d[e[0]] != Long.MAX_VALUE && d[e[1]] > d[e[0]] + e[2]){
                    d[e[1]] = d[e[0]] + e[2];
                    if(i == n - 1 && e[1] == n - 1){
                        d = null;
                        break;
                    }
                }
            }
        }
        return d;
    }

}


Measured memory_bytes: 28452
import numpy as np
import itertools

H, W, K = map(int, input().split())

squares = np.array([
           [0 if w == "." else 1 for w in input()] for h in range(H)
          ])

count = 0
for w in itertools.product([0, 1], repeat=W):
  paintedW = np.delete(squares, np.where(np.array(w)==1), axis = 1)
  for h in itertools.product([0, 1], repeat=H):
    paintedH = np.delete(paintedW, np.where(np.array(h)==1), axis = 0)
    if np.sum(paintedH) == K:
      count += 1

print(count)

Measured memory_bytes: 27180
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if(a+b>=c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 768
// Problem : Forbidden List
// Contest : Virtual Judge - AtCoder
// URL : https://vjudge.net/problem/AtCoder-abc170_c
// Memory Limit : 1048 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testcases \
    int tcc;      \
    cin >> tcc;   \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
    fast_io;
    int x,n; cin>>x>>n; set<int> v;
    lp(i,0,n){
    	int t; cin>>t; v.insert(t);
    }
    for(int i=0;;i++){
    	if(v.find(x-i)==v.end()){
    		cout<<x-i; return 0;
    	}
    	if(v.find(x+i)==v.end()){
    		cout<<x+i; return 0;
    	}
    }
}

Measured memory_bytes: 3592
s1 = input()
s2 = input()
strlen = [n for n in range(len(s1)+1)]
for i,char1 in enumerate(s2):
    inner = [i+1]
    for k,char2 in enumerate(s1):
        inner.append(min(strlen[k+1]+1,inner[k]+1,strlen[k]+(char1!=char2)))
    strlen = inner
print(strlen[len(s1)])

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
#define PI (acos(-1))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAXN 1123456
#define MOD 1000000007

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

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

  string s;
  cin>>s;
  int n=sz(s);

  ll cnt=1;
  string a=string(1, s[0]);
  string b="";
  rep(i,1,n) {
    if (sz(b) == 0 || a==b) b += s[i];
    else 
    {
      ++cnt;
      a=b;
      b="";
      --i;
    }
  }

  if (sz(b) != 0 && a!=b) ++cnt;

  cout<<cnt<<endl;
}


Measured memory_bytes: 720
//56
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int N;
  cin>>N;
  while(N--){
    string s[2];
    for(int i=0;i<2;i++){
      cin>>s[i];
      reverse(s[i].begin(),s[i].end());
    }
    if(s[0].size()<s[1].size()){
      swap(s[0],s[1]);
    }
    string ans;
    int c=0;
    for(int i=0;i<s[0].size();i++){
      char d=(i<s[1].size())?s[1][i]:'0';
      d+=-'0'+s[0][i]+c;
      c=d>'9';
      if(d>'9'){
	d-=10;
      }
      ans+=d;
    }
    if(c){
      ans+='1';
    }
    reverse(ans.begin(),ans.end());
    if(ans.size()<=80){
      cout<<ans<<endl;
    }else{
      cout<<"overflow"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

//最大公約数
	long long GCD(long long a, long long b) {
		if (a < b)
			swap(a, b);
		if (b == 0) return a;
		else return GCD(b, a % b);
	}
	//素数判定
	bool sosuu_check(int num) {
		int i;
		for (i = 2; i <= sqrt(num); ++i) {
			if (num%i == 0)
				return false;
		}
		return (num < 2) ? false : true;
	}
	
	int check(int N, int a, int b) {
		int A,B,i;
		if (a > b) {
			A = a;
			B = b;
		}
		else {
			A = b;
			B = a;
		}
		for (i = N / b; i > 0; i--) {
			if ((N - b * i) % a == 0) {
				return i;
			}
		}
		return 0;
	}
	//コンビネーション(n,r)
	ull combination(int n, int r) {
		if (r * 2 > n) r = n - r;
		ull dividend = 1;
		ull divisor = 1;
		for (int i = 1; i <= r; ++i) {
			dividend *= (n - i + 1);
			divisor *= i;
		}
		return dividend / divisor;
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

const int maxa = 55555;

vector<int> prime_val(int n) {
    vector<int> res(n);
    int k = 0;
    for (int i = 2; i <= maxa; ++i) {
        bool ok = true;
        for (int j = 2; j * j <= i; ++j) {
            if (i % j == 0) {
                ok = false;
                break;
            }
        }
        if (ok && i % 5 == 1) {
            res[k] = i;
            ++k;
        }
        if (k == n) {
            return res;
            break;
        }
    }
    return res;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;

    vector<int> res = prime_val(n);

    rep(i, n) {
        cout << res[i];
        if (i != n-1) cout << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int a,b;
    cin>>a>>b;
    cout<<max({a+a-1,a+b,2*b-1})<<endl;


    return 0;
}

Measured memory_bytes: 256
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){

    int N, K;
    cin >> N >> K;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    vector<ll> sum_a;
    for (int l = 0; l < N; l++) {
        ll sm = 0;
        for (int r = l+1; r <= N; r++) {
            sm += a[r-1];
            sum_a.push_back(sm);
        }
    }
 
    /*
    int N,K;
    cin >> N >> K;
    int a[N];
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }

    //int sum_a[N * (N+1) / 2] = {0};
    //vector<int> sum_a(N * (N+1) /2);
    vector<ll> sum_a;
    for (int i = 0; i < N; i++){
        for (int k = i; k < N; k++){
            int t_sum = 0;
            for (int p = i; p <= k; p++){
                t_sum += a[p];
            }
            sum_a.push_back(t_sum);
        }
    }
    */

    /*
    int x = 0;
    int t = 40;
    while(t != 0){
        int cnt = 0;
        ll prov = x + pow(2,t-1);
        for (int i = 0; i < sum_a.size(); i++){
            if ((prov & sum_a[i]) == prov){
                cnt++;
            }
        }
        if (cnt >= K){
            x += prov -x;
        }
        t--;
    }

    cout << x << endl;
    */
    ll ans = 0;
    for (int lg = 50; lg >= 0; lg--) {
        ll nans = ans | (1LL << lg);
        int cnt = 0;
        for (ll d: sum_a) {
            if ((nans & d) == nans) cnt++;
        }
        if (cnt >= K) ans = nans;
    }
    cout << ans << endl;



}



Measured memory_bytes: 6388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n;
  cin >> n;
  vector<vll> ba(n, vll(2));
  for (ll i = 0; i < n; i++) cin >> ba[i][1] >> ba[i][0];
  sort(all(ba));
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    sum += ba[i][1];
    if (sum > ba[i][0]) {
      No();
      return 0;
    }
  }
  Yes();
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>


using namespace std;
using ll = long long;

const ll mod = 1000000007;

int N, K;
int a[4];
int A, B;

int main()
{
	cin >> N;
	cin >> A >> B;
	cout << (B >= A * N ? A * N : B) << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
	
def main():
	# ２つの整数を入力
	a, b = map(int, input().split(' '))
	# 結果を出力
	if (a & b & 1) == 0:
		print('Even')
	else:
		print('Odd')

if __name__ == '__main__':
	main()


Measured memory_bytes: 2940
H,W = map(int,input().split())
A = [list(input()) for i in range(H)]
a = 0
for h in range(H):
    for w in range(W):
        if A[h][w] == '#':
            a += 1
h = 0
w = 0
d = 0
fh = False
fw = False
while True:
    if h == H-1 and w == W-1:
        break
    
    if h == H-1:
        fh = True
    if w == W-1:
        fw = True
        
    if h < H-1:
        if A[h+1][w] == '#':
            h += 1
            d += 1
        elif fw:
            break
    if w < W-1:
        if A[h][w+1] == '#':
            w += 1
            d += 1
        elif fh:
            break
    
if a == d+1:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 3064
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
int n , m , q ;
vector<int> a , b , c , d ;
vector<int> v ;
int ans = 0 ;
void dfs(int x, int last){
    if ( x == n ){
        int sum = 0 ;
        for(int i = 0; i < q; i++){
            if ( v[b[i]] - v[a[i]] == c[i] ) sum += d[i] ;
        }
        ans = max(ans, sum) ;
    }
    else{
        for(int i = last; i <= m; i++){
            v.push_back(i) ; 
            dfs(x + 1, i) ;
            v.pop_back() ;
        }
    }
}

signed main(){
    fastio
    cin >> n >> m >> q ;
    a.resize(q) ;
    b.resize(q) ;
    c.resize(q) ;
    d.resize(q) ;
    for(int i = 0; i < q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i] ;
        a[i]--;
        b[i]--;
    }
    dfs(0, 1) ;
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 3604
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

int N;			//Number of vertices
int M;			//Number of edges
int x,y;			//start and end of an edge
vector <vector <int>> graph;	//graph
vector <int> LongestStart;		//longest path starting with given vertex
vector <bool> visited;			//with this we will avoid travelling subtree of given root again and again
/* We will first make the graph
 * then we will traverse the graph recursively
 * and to avoid repititions we will maintain a two lookup tables 
 * 1. LongestStart
 * 2. visited
 */
int solve(int root){
	if(visited[root])
		return LongestStart[root];
	for(auto child : graph[root]){
		LongestStart[root] = max(LongestStart[root],1+solve(child));
	}
	visited[root]=true;
	return LongestStart[root];
}


int main(){
	cin>>N>>M;

	graph.resize(N);
	LongestStart.resize(N,0);
	visited.resize(N,false);

	for(int i=0;i<M;i++){
		cin>>x>>y;
		graph[x-1].push_back(y-1);
	}

	int MaxLength=0;
	for(int i=0;i<N;i++){
		MaxLength = max(MaxLength,solve(i));
	}
	
	cout<<MaxLength<<endl;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll n;
    cin >> n;
    int info[n][n];
    memset(info, 0, sizeof info);
    rep(i, n) {
        ll a;
        cin >> a;
        rep(j, a) {
            ll x, y;
            cin >> x >> y;
            x--;
            if (y == 1) {
                info[i][x] = 1;
            } else {
                info[i][x] = 2;
            }
        }
    }

    ll ans = 0;
    rep(i, 1 << n) {
        ll temp = 0;
        bool correct = true;
        bool h[n];
        rep(j, n) { h[j] = i & (1 << j); }
        rep(j, n) {
            if (!h[j]) {
                continue;
            }
            temp++;
            rep(l0, n) {
                if (info[j][l0] == 1) {
                    if (!h[l0]) {
                        correct = false;
                    }
                } else if (info[j][l0] == 2) {
                    if (h[l0]) {
                        correct = false;
                    }
                }
            }
        }
        if (correct) {
            ans = max(ans, temp);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=2*100000 +117;
const int MM= +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
int fin,st;
int pcnt=0;
struct node{
	int xt;
	int to,rem;
}e[8*NN]={};
int ecnt=1;
int p[2*NN]={};
void add(int a,int b,int rem){
	e[++ecnt].to=b;
	e[ecnt].rem=rem;
	e[ecnt].xt=p[a];
	p[a]=ecnt;
}
void link(int a,int b,int rem){
	add(a,b,rem);
	add(b,a,0);
}
int g[2*NN]={};
int h[2*NN]={};
int q[2*NN]={};
bool bfs(){
	int std=h[fin]+3;
	h[st]=std;
	int hd=0,tl=0;
	q[tl++]=st;
	while(hd!=tl){
		int x=q[hd++];
		if(x==fin)break;
		for(int pos=p[x];pos;pos=e[pos].xt){
			if(!e[pos].rem)continue;
			int cur=e[pos].to;
			if(h[cur]<std){
				h[cur]=h[x]+1;
				q[tl++]=cur;
			}
		}
	}
	return h[fin]>std;
}
int dfs(int x,int f){
	if(x==fin)return f;
	int res=0;
	for(int &pos=g[x];pos;pos=e[pos].xt){
		int cur=e[pos].to;
		if(!e[pos].rem||h[cur]!=h[x]+1)continue;
		int tp=dfs(cur,min(e[pos].rem,f));
		if(tp){
			f-=tp,res+=tp;
			e[pos].rem-=tp;
			e[pos^1].rem+=tp;
		}
		if(!f){
			break;
		}
	}
	return res;
}
int getf(){
	int f=0;
	while(bfs()){
		for(int i=1;i<=pcnt;++i){
			g[i]=p[i];
		}
		f+=dfs(st,1e9);
	}
	//cerr<<f<<endl;
	return f;
}
int bel[2][NN]={};
int a[2][NN]={};
int cnt;
int main(){
	//open();
	n=read();
	for(int i=1;i<=n;++i){
		a[0][i]=read()+1;
	}
	for(int i=1;i<=n;++i){
		a[1][i]=read()+1;
	}
	for(int i=1;i<=n;++i){
		if(!bel[0][i]){
			++cnt;
			int pos=i;
			while(!bel[0][pos]){
				bel[0][pos]=cnt;
				pos=a[0][pos];
			}
		}
	}
	for(int i=1;i<=n;++i){
		if(!bel[1][i]){
			++cnt;
			int pos=i;
			while(!bel[1][pos]){
				bel[1][pos]=cnt;
				pos=a[1][pos];
			}
		}
	}
	st=cnt+1;
	pcnt=fin=st+1;
	LL ans=0;
	for(int i=1;i<=n;++i){
		if(a[0][i]==a[1][i]){
			if(a[0][i]==i)++ans;
			else{
				link(bel[0][i],bel[1][i],1);
				link(bel[1][i],bel[0][i],1);
			}
		}
		else{
			if(a[0][i]==i){
				link(bel[1][i],fin,1);
			}
			else if(a[1][i]==i){
				link(st,bel[0][i],1);
			}
			else{
				link(bel[1][i],bel[0][i],1);
			}
		}
	}
	ans+=getf();
	ans=n-ans;
	printf("%lld\n",ans);
	close();
	return 0;
}

Measured memory_bytes: 15744
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, K;
    scan(N, K);
    auto P = aryread();
    auto E = P.map!"cast(real)(a*(a+1)/2)/a"();
    // writeln(E);
    real sum = E[0 .. K].sum();
    real ans = sum;
    foreach (i; 0 .. N - K)
    {
        sum = sum - E[i] + E[i + K];
        ans = ans.max(sum);
    }
    writefln("%.10f", ans);
}


Measured memory_bytes: 10536
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
  ll a[3],b[3],c[5]={0};
  for(int i=0;i<3;i++){
    cin>>a[i];
    cin>>b[i];
    c[a[i]]++;
    c[b[i]]++;
  }





  if(c[4]<3&&c[1]<3&&c[2]<3&&c[3]<3){
  if(c[4]>0&&c[1]>0&&c[2]>0&&c[3]>0){
    printf("YES\n");
    return 0;
}
  }
printf("NO\n");

}


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

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int ans=0;
  rep(i,n){
    int t; cin>>t;
    if(!(a<=t&&t<b))ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3544
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(void){
	double xa,ya,xb,yb,xc,yc,xd,yd;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)!=EOF){
		if((xa-xb)*(xc-xd)+(ya-yb)*(yc-yd)==0)printf("YES\n"); else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N;
    cin>>N;
    int ans = 0;
    for (size_t i = 0; i < N; i++)
    {
        ll a;
        cin>>a;
        while(a%2==0)
        {
            ans++;
            a/=2;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
long long int dp[101][100001];
int main()
{
long long int n,s=0,i,j,k,w;
cin>>n>>w;
long long int a[n+1],v[n+1];
a[0]=0;
v[0]=0;
for(i=1;i<=n;i++)
{
cin>>a[i]>>v[i];
}
for(i=1;i<=n;i++)
{
for(j=1;j<=w;j++)
{
if(a[i]>j)
dp[i][j]=dp[i-1][j];
else
dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i]]+v[i]);
}
}

cout<<dp[n][w]<<endl;
}


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

long long N;
long long A[200001];
long long C[200001],B[200001];
long long ans = 0;

int main() {
  cin >> N;

  long long tmp;
  for(int i=0;i<N;i++){    
    scanf("%lld",&A[i]);
    B[A[i]]++;
  }

  for(int i=1;i<=N;i++){
    if(B[i] > 1)
      C[i] = B[i]*(B[i]-1)/2;
    ans += C[i];  
  }

  for(int i=0;i<N;i++){
    if(B[A[i]] < 2){
      printf("%lld\n",ans);
    }
    else{
      tmp = ans - C[A[i]] + (B[A[i]]-1)*(B[A[i]]-2)/2;
      printf("%lld\n",tmp);
    }
  }
}


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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	map<int,int> mp;
	for (int i = 2; i <= n; ++i)
	{
		int now=i,d=2;
		while (now>1)
		{
			while (now%d==0)
			{
				now/=d;
				++mp[d];
			}
			++d;
		}
	}
	int m3=0,m5=0,m15=0,m25=0,m75=0;
	for (int i = 2; i <= 100; ++i)
	{
		if (mp[i]>=3-1)
		{
			++m3;
		}
		if (mp[i]>=5-1)
		{
			++m5;
		}
		if (mp[i]>=15-1)
		{
			++m15;
		}
		if (mp[i]>=25-1)
		{
			++m25;
		}
		if (mp[i]>=75-1)
		{
			++m75;
		}
	}
	int ans=0;
	if (m5>1&&m3>2)
	{
		ans+=(m3-2)*m5*(m5-1)/2;
	}
	ans+=max(0,(m3-1)*m25);
	ans+=max(0,m15*(m5-1));
	ans+=m75;
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main(){

    int n, k;
    cin >>n >> k;
    vector<int> prices;
    int num;
    for(int i=0; i<n; ++i){
        cin >> num;
        prices.push_back(num);
    }
    sort(prices.begin(),prices.end());
    int mincost = accumulate(prices.begin(),prices.begin()+k,0);
    cout << mincost << '\n';



    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
const ll mo=1000000007;
ll ans=0;
ll dp[0][0];
int summ(ll num){
    string ss;
    ll su=0;
    ss=to_string(num);
    int len=(int)(ss.length());
    rep(i,len){
        string str1(ss, i,1);
        su+=stoll(str1);
    }
    return su;
}
int main()
{
ll n;
cin >> n;
string s;
ll num=0;
ll a=1;
ll nine=0;
ll num1,num2;
ll max=0;
while(num<n){
    num1=a;
    num2=a+1;
    rep(i,nine){
        num1=num1*10+9;
        num2=num2*10+9;
    }
    if(double(num1)/summ(num1)>double(num2)/summ(num2)){
        nine++;
        a=1;
        continue;
    }
    a++;
    if(num1<=max)continue;
    cout << num1 << endl;
    num++;
    max=num1;
  //  cout << summ(4685456) << endl;
   // cout << double(99)/summ(99)<<' '<<double(109)/summ(109) << endl;
}
return 0;
}


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

using namespace std;

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

int main(){
  uint64_t x;
  cin >> x;
  int n = 1;
  uint64_t d = 100;
  while(1){
    d += d / 100;
    if(d >= x) break;
    ++n;
  }
  cout << n << endl;
  return 0;
}

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

int main() {
	
	int n;
	cin >> n;
	string s[3];
	cin >> s[0];
	cin >> s[1];
	cin >> s[2];
	int cnt = 0;
	for(int i = 0; i < n; ++i) {
		
		if(s[0][i] == s[1][i] && s[1][i] == s[2][i])
		   continue;
		else if((s[0][i] == s[1][i]) || (s[1][i] == s[2][i]) || (s[2][i] == s[0][i]))
		  ++cnt;
		else
		  cnt += 2;
		  
	}
	cout << cnt;
	
	
	return 0;
}

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

int main(){
    int a, b, c;
    cin>>a>>b>>c;
    
    if(a > b) swap(a, b);
    if(b > c) swap(b, c);
    if(a > b) swap(a, b);
    
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;

signed main(){
	//cout << fixed << setprecision(10);
	ll h,w,m; cin >> h >> w >> m;
	vl hc(h),wc(w);
	set<pl> st;
	rep(i,0,m){
		ll a,b; cin >> a >> b ;
		--a; --b;
		hc[a]++;
		wc[b]++;
		st.emplace(a,b);
	}
	ll mh = 0,mw = 0;
	rep(i,0,h)chmax(mh,hc[i]);
	rep(i,0,w)chmax(mw,wc[i]);	
	vl ih,iw;
	ll ans = mw + mh;
	rep(i,0,h){
		if(hc[i] == mh){
			ih.emplace_back(i);
		}
	}
	rep(i,0,w){
		if(wc[i] == mw){
			iw.emplace_back(i);
		}
	}
	for(auto c:ih)for(auto d:iw){
		if(st.count(make_pair(c,d)))continue;
		cout << ans << endl;
		return 0;
	}
	cout << ans - 1 << '\n';


	return 0;
}

Measured memory_bytes: 34968
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 998244353;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

ll dp[3010][6010][3];

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

    int n, s; cin>>n>>s;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    dp[0][0][0] = 1;

    for(int i=0; i<n; i++){
        for(int j=0; j<=s; j++){
            dp[i+1][j][0] += dp[i][j][0];
            dp[i+1][j][0] %= MOD;
            dp[i+1][j+a[i]][1] += dp[i][j][0] * (i + 1);
            dp[i+1][j+a[i]][1] %= MOD;
            dp[i+1][j+a[i]][2] += dp[i][j][0] * (i + 1) * (n - i);
            dp[i+1][j+a[i]][2] %= MOD;

            dp[i+1][j][1] += dp[i][j][1];
            dp[i+1][j][1] %= MOD;
            dp[i+1][j+a[i]][1] += dp[i][j][1];
            dp[i+1][j+a[i]][1] %= MOD;
            dp[i+1][j+a[i]][2] += dp[i][j][1] * (n - i);
            dp[i+1][j+a[i]][2] %= MOD;

            dp[i+1][j][2] += dp[i][j][2];
            dp[i+1][j][2] %= MOD;
        }
    }

    cout << dp[n][s][2] << endl;

    return 0;
}

Measured memory_bytes: 423424
/*
 * atcoder/abc085/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }

int n, y;
vector<int> A = { 10000, 5000, 1000 };
void solve() {
  cin >> n >> y;
  loop(i,0,n+1) loop(j,0,n+1) {
    if (i+j>n) break;
    int k = n - (i+j);
    int x = y - (A[0]*i + A[1]*j);
    if (x == A[2]*k) {
      cout << i << " " << j << " " << k << endl;
      return;
    }
  }

  cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
using namespace std;

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

int main() {
	int a, b;
	cin >> a >> b;

	if (a >= 10 || b >= 10) cout << -1 << endl;
	else cout << a * b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define fir first
#define sec second
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N;

int main() {
	cin >> N;
	if (N < 10) {
		cout << N << endl;
	}
	else if (N < 100) {
		cout << 9 << endl;
	}
	else if (N < 1000) {
		cout << N - 90 << endl;
	}
	else if (N < 10000) {
		cout << 909 << endl;
	}
	else if (N < 100000) {
		cout << N - 9090 << endl;
	}
	else {
		cout << 90909 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  cout<<MAX(MAX(n+n-1,n+m),m+m-1)<<endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	a, b := nextInt(), next()

	c := int(b[0]-'0')*100 + int(b[2]-'0')*10 + int(b[3]-'0')

	puts(a * c / 100)
}


Measured memory_bytes: 1768