akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag) {
    if (flag) cout << "Yes" << endl; else cout << "No" << endl;
}

void ansYES(bool flag) {
    if (flag) cout << "YES" << endl; else cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

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

struct datas {
    Int max;
    Int size;
};

class ContainChecker {
protected:
    Int minx, miny, maxx, maxy;
public:
    ContainChecker(Int minx, Int miny, Int maxx, Int maxy) : minx(minx), miny(miny), maxx(maxx), maxy(maxy) {};

    bool in(Int x, Int y) {
        return (minx <= x && miny <= y && x <= maxx && y <= maxy);
    }
};





int main(void) {
    Int n,k;
    cin >> n >> k;
    cout << (Int)(k * powl(k-1,n-1)) << endl;
}




Measured memory_bytes: 512
n = int(input())

A = list(map(int, input().split()))
t = 0
for i in A:
    if i % 2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            t = 1
    else:
        continue
if t == 1:
    print("DENIED")
else:
    print("APPROVED")

Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

// ����̕�����𐔂���֐�
size_t count(const string& str, const string& sub, const size_t ini = 0, const size_t fin = string::npos) {
	size_t pos = str.find(sub, ini);
	size_t cnt = 0;
	while (pos < fin) {
		cnt += 1;
		pos = str.find(sub, pos + sub.length());
	}
	return cnt;
}

int main() {

	string S;
	cin >> S;

	bool jdg = true;

	string rain = "R";
	int ans = 0;

	while (jdg == true) {
		ans = count(S, rain);
		if (ans == 0) {
			ans = rain.length() - 1;
			break;
		}
		rain += "R";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

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

  string word[4] = {"dream","dreamer","erase","eraser"};

  int pos = s.size();
  int size;
  bool judge = false;

  while(pos > 0){
    judge = false;
    //cout << "pos : " << pos << endl;

    for(int i=0; i<4; i++){
      size = word[i].size();
      if(pos - size >= 0){
        if(s.compare(pos - size, size, word[i]) == 0){
          pos -= size;
          //cout << "i : " << i << endl;
          s.erase(pos,size);
          judge = true;
        }
      }
    }



    if(!judge) break;

  }

  if(judge)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

}


Measured memory_bytes: 3772
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
	int X, S[4];

	cin >> X;

    for(int i = 3; i >= 0; i--){
		S[i] = X % 10;
		X = X - S[i];
		X = X / 10;
	}

	if (S[0] == 0) {
		if(S[1] != 0) {
			if (S[2] == 0) {
				if (S[3] != 0) {
				cout << "AMBIGUOUS" << endl;
				}
				else {
					cout << "MMYY" << endl;
				}
			}
			else if (S[2] == 1) {
				if (S[3] >= 0 && S[3] <= 2) {
					cout << "AMBIGUOUS" << endl;
				}
				else {
					cout << "MMYY" << endl;
				}
			}
			else {
				cout << "MMYY" << endl;
			}
		}
		else {
			if (S[2] == 0) {
				if (S[3] != 0) {
					cout << "YYMM" << endl;
				}
				else {
					cout << "NA" << endl;
				}
			}
			else if (S[2] == 1) {
				if (S[3] >= 0 && S[3] <= 2) {
					cout << "YYMM" << endl;
				}
				else {
					cout << "NA" << endl;
				}
			}
			else {
				cout << "NA" << endl;
			}
		}
	}
	else if(S[0] == 1){
		if (S[1] >= 0 && S[1] <= 2) {
			if (S[2] == 0) {
				if (S[3] != 0) {
					cout << "AMBIGUOUS" << endl;
				}
				else {
					cout << "MMYY" << endl;
				}
			}
			else if (S[2] == 1) {
				if (S[3] >= 0 && S[3] <= 2) {
					cout << "AMBIGUOUS" << endl;
				}
				else {
					cout << "MMYY" << endl;
				}
			}
			else {
				cout << "MMYY" << endl;
			}
		}
		else {
			if (S[2] == 0) {
				if (S[3] != 0) {
					cout << "YYMM" << endl;
				}
				else {
					cout << "NA" << endl;
				}
			}
			else if (S[2] == 1) {
				if (S[3] >= 0 && S[3] <= 2) {
					cout << "YYMM" << endl;
				}
				else {
					cout << "NA" << endl;
				}
			}
			else {
				cout << "NA" << endl;
			}
		}
	}
	else {
		if (S[2] == 0) {
			if (S[3] != 0) {
				cout << "YYMM" << endl;
			}
			else {
				cout << "NA" << endl;
			}
		}
		else if (S[2] == 1) {
			if (S[3] >= 0 && S[3] <= 2) {
				cout << "YYMM" << endl;
			}
			else {
				cout << "NA" << endl;
			}
		}
		else {
			cout << "NA" << endl;
		}
	}

	return 0;
}

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

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)

template <typename Iterator>
inline constexpr auto max_of (Iterator first, Iterator last) -> decltype (auto)
{
  return first != last ? * max_element (first, last) : throw out_of_range ("max_of");
}

template <typename Graph>
inline auto topological_sort (const Graph & graph)
{
  using node_t = size_t;
  enum class flag_t { YET, VISITED, DONE };
  auto n = graph.size ();
  vector <flag_t> visited (n, flag_t::YET);
  vector <node_t> res (n);
  auto res_ite = res.end ();
  auto impl = [&] (auto self, auto && from) {
    if (visited[from] == flag_t::DONE) return;
    if (visited[from] == flag_t::VISITED) throw runtime_error ("Error in topological_sort: The graph must be DAG.");
    visited[from] = flag_t::VISITED;
    for (auto && to : graph[from]) self (self, to);
    * -- res_ite = from;
    visited[from] = flag_t::DONE;
  };
  rep (i, n) impl (impl, node_t {i});
  return res;
}

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

  size_t n, m;
  cin >> n >> m;

  using node_t = size_t;
  using graph_t = vector <vector <node_t>>;
  graph_t g (n + 1);

  rep (i, m)
  {
    node_t from, to;
    cin >> from >> to;
    g[from].push_back (to);
  }

  vector <int> dp (n + 1, 0);
  for (auto && from : topological_sort (g))
  {
    for (auto && to : g[from])
    {
      dp[to] = max (dp[to], dp[from] + 1);
    }
  }

  cout << max_of (begin (dp), end (dp)) << endl;
}



Measured memory_bytes: 8576
//  |. . . . . . . . . .|       NEXT  
//  |. . . . . . . . . .|      ______ 
//  |. . . . . . . . . .|     |      |
//  |. . . . . . . . . .|     |  OO  |
//  |. . . . . . . . . .|     |  OO  |
//  |. . . . . . . . . .|     |______|
//  |. . . . I . . . . .|             
//  |. . . . I . . . . .|             
//  |. . . . I . . . . .|     PLAYER  
//  |. . . . I . . . . .|    STYXCEL  
//  |. . . . . . . . . .|             
//  |I J J J . T T T S S|      LINES  
//  |I J O O . L T S S T|          0  
//  |I L O O . L Z Z T T|      SCORE  
//  |I L L L . L L Z Z T|      00021  

#include <bits/stdc++.h>

using namespace std;
//#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC target ("tune=native")

#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<ll>
#define vii vector<vector<ll>>
#define fr() front()
#define bc() back()
#define pushb push_back
#define popb pop_backtop

#define pii pair<ll,ll>
#define piii pair<pair<ll,ll>,ll>
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define psplit(pp,a,b) (a=pp.fi,b=pp.se);
#define ppsplit(ppp,a,b,c) (a=ppp.fi.fi,b=ppp.fi.se,c=ppp.se);

#define endl ("\n")
const ll INF=1<<30;
const ll LINF=1<<62;
const double EPS=1e-9;
const ll MOD=1e9+7;

int main(){

    //freopen("inp.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    
    int n=0,m=0;
    string s;
    
    cin>>n>>m;
    cin>>s;
    int ye=0;
    stack<int> jumps;
    int cur=n;
    while(cur>0){
        ye=0;
        for(int i=m;i>0;i--){
            if(cur-i>=0 && s[cur-i]=='0'){
                jumps.push(i);
                cur-=i;
                ye=1;
                break;
            }
        }
        if(!ye){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<jumps.top();
    jumps.pop();
    while(!jumps.empty()){
        cout<<" "<<jumps.top();
        jumps.pop();
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 876
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, l; cin >> n >> m >> l;
    vvll d(n, vll(n, HIGHINF));
    REP(i, n) d[i][i] = 0;
    REP(i, m) {
        ll a, b, c; cin >> a >> b >> c;
        d[a-1][b-1] = d[b-1][a-1] = c;
    }
    REP(k, n) REP(i, n) REP(j, n) chmin(d[i][j], d[i][k]+d[k][j]);
    vvll cd(n, vll(n, HIGHINF));
    REP(i, n) cd[i][i] = 0;
    REP(i, n) REP(j, n) if (d[i][j] <= l) cd[i][j] = 1;
    REP(k, n) REP(i, n) REP(j, n) chmin(cd[i][j], cd[i][k]+cd[k][j]);

    ll q; cin >> q;
    REP(i, q) {
        ll s, t; cin >> s >> t;
        if (cd[s-1][t-1] == HIGHINF) cout << -1 << '\n';
        else cout << cd[s-1][t-1] - 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 2048
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline-------------------------------------------
    N = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    ans = 0
    for i in range(N):
        ans += min(A[i],B[i])
        B[i] -= min(A[i],B[i])
        ans += min(A[i+1],B[i])
        A[i+1] -= min(A[i+1],B[i])
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 20504
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  if(S == "Sunny") {
    cout << "Cloudy" << endl;
  }else if(S == "Cloudy") {
    cout << "Rainy" << endl;
  }else if(S == "Rainy") {
    cout << "Sunny" << endl;
  }
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

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

int main(void){

    string str;
    cin >> str;

    int al[26] = {0};
    roop(i, str.length()) al[str[i]-'a']++;

    roop(i, 26){
        if(al[i] == 0){
            str += (char)(i+'a');
            cout << str << endl;
            return 0;
        }
    }

    string t = str;
    if(next_permutation(t.begin(), t.end()) == false){
        cout << -1 << endl;
        return 0;
    }


    roop(i, str.length()-1){
        cout << t[i];
        if(t[i] != str[i]) break;
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
	
	char a[4];
	
	scanf("%s",&a);
	
	if(a[0] != a[1] && a[1] != a[2] && a[2] != a[0]){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using tuplis = array<ll, 3>;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef long double ld;
#define print(out) cout<< out  << "\n";
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for(auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
const int MOD=1000000007;
const int INF = 1e9;
const ld EPS=1e-9;
template<class T> inline auto max(const T& a){ return *max_element(all(a)); }
template<class T> inline auto min(const T& a){ return *min_element(all(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

ll ret=0;

ll dfs(ll a,ll idx){
  a/=2;
  ret+=powl(2,idx);
  //print(a<<" "<<ret)
  if(a<=1){return 0;}
  ll b=(dfs(a,idx+1));
  return ret;
}

int main(){
  ll L;cin>>L;
  if(L==2){
    print(3)
    return 0;
  }
  //if(L%2==1)L--;
  ll ans=dfs(L,0);
  ll tmp=-1;
  while(L){
    tmp++;
    L/=2;
  }
  ans+=powl(2,tmp);
  print(ans)

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int n;
	cin >> n;
	vector<ll> v(n);
	rep(i,n) cin >> v[i];
	ll ans = 0;
	rep(i,n) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (v[i] == v[j] || v[j] == v[k] || v[k] == v[i]) continue;
				if (v[i] + v[j] > v[k] && v[j] + v[k] > v[i] && v[k] + v[i] > v[j]) ans++;
			}
		}
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 3636
#!/usr/bin/env python
# coding: utf-8


def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    h, w = rli()
    if h == 1 or w == 1:
        print(1)
        return
    ans = (h*w)//2
    if (h*w%2 == 1): ans += 1
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for i in range(H)]
P = [None]*(H*W+1)
for i in range(H):
    for j in range(W):
        P[A[i][j]] = (i, j)
C = [0]*(H*W+1)
for i in range(D+1, H*W+1):
    pi, pj = P[i]; qi, qj = P[i-D]
    C[i] = C[i-D] + abs(pi - qi) + abs(pj - qj)

ans = []
Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    ans.append(C[R] - C[L])
print(*ans, sep='\n')

Measured memory_bytes: 23672
local n = io.read("*n")
local cnt, rem = 0, 0
for i = 1, n do
  local a = io.read("*n")
  if a == 0 then
    rem = 0
  else
    a = a + rem
    cnt = cnt + a // 2
    rem = a % 2
  end
end
print(cnt)


Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	string s[10005];
	for(int i=0;i<n;i++){
		cin >> s[i];
	}
	long long int ans = 0LL;
	long long int acnt = 0LL;
	long long int bcnt = 0LL;
	long long int cnt = 0LL;
	for(int i=0;i<n;i++){
		for(int j=0;j<s[i].size()-1;j++){
			if(s[i][j]=='A' && s[i][j+1]=='B'){
				ans++;
			}
		}
	}
	for(int i=0;i<n;i++){
		int k = s[i].size()-1;
		if(s[i][0]=='B' && s[i][k]=='A'){
			cnt++;
		}
		else if(s[i][0]=='B'){
			bcnt++;
		}
		else if(s[i][k]=='A'){
			acnt++;
		}
	}
	ans += max(cnt-1, 0LL);
	if(cnt>0){
		acnt += 1;
		bcnt += 1;
		if(acnt==1 && bcnt==1){
			cout << ans << endl;
			return 0;
		}
	}
	cout << ans+min(acnt, bcnt) << endl;
	return 0;
}

Measured memory_bytes: 768
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        int R = sc.nextInt();
        if(N>=10){

            System.out.println(R);
        }else{

            System.out.println(R+(100*(10-N)));
        }
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int MAX_N=200000;
int main(){
    ios::sync_with_stdio(false);
    int n;
    int p[MAX_N+5];
    cin >> n;
    rep(i,n){
        cin >> p[i];
    }
    int ans=0;
    int mi=1e9;
    rep(i,n){
        mi=min(mi,p[i]);
        if(mi==p[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
xy = [LI() for _ in range(n)]
lst = [[x+y, x-y] for x, y in xy]
lst.sort(reverse=True)
ans = lst[0][0] - lst[-1][0]
lst.sort(key=itemgetter(1), reverse=True)
ans = max(ans, abs(lst[0][1] - lst[-1][1]))
print(ans)

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

int main() {
  int N, A=0, B=0, i;
  cin >> N;
  vector<int> a(N);
  for(i=0; i<N; i++){
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  for(i=N-1; i>=0; i-=2){
    A += a.at(i);
  }
  for(i=N-2; i>=0; i-=2){
    B += a.at(i);
  }
  cout << A-B << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int d[100];
		for (int i = 0; i <= n; ++i)
			scanf("%d", d + i);

		int l = 0;
		int u = n-1;
		int ans = 0;
		while (l <= u)
		{
			++ans;
			int m = (l + u) / 2;
			if (d[m] == d[n])
				break;
			else if (d[m] > d[n])
				u = m - 1;
			else
				l = m + 1;
		}
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var O = Read();
            var E = Read();
            string ret = string.Empty;
            for (int i = 0; i < E.Length; i++)
            {
                ret += O[i].ToString() + E[i].ToString();
            }

            if (O.Length != E.Length)
            {
                ret += O.Last().ToString();
            }

            Console.WriteLine(ret);
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

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

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

  if(n<=1000){
    cout << 1000-n << endl;
  }else if(n <= 2000){
    cout << 2000-n << endl;
  }else if(n<=3000){
    cout << 3000-n << endl;
  }else if(n<=4000){
    cout << 4000-n << endl;
  }else if(n<=5000){
    cout << 5000-n << endl;
  }else if(n<=6000){
    cout << 6000-n << endl;
  }else if(n<=7000){
    cout << 7000-n << endl;
  }else if(n<=8000){
    cout << 8000-n << endl;
  }else if(n<=9000){
    cout << 9000-n << endl;
  }else{
    cout << 10000-n << endl;
  }

  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S,T;
  cin>>S>>T;
  int A,B;
  cin>>A>>B;
  string tmp;
  cin>>tmp;
  if(tmp==S){
    A--;
  }else{
    B--;
  }
  cout<<A<<" "<<B<<endl;
}

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

using namespace std;

int main(){
    int N, L, T;
    int X[100000], W[100000], ans[100000];
    int cnt = 0;
    cin >> N >> L >> T;
    for(int i = 0; i < N; i++){
        cin >> X[i] >> W[i];
        if(W[i] == 1){
            if(T >= (L-X[i])){
                cnt -= (1+(T-(L-X[i]))/L);
            }
            X[i] = (X[i]+T)%L;
        }else{
            if(T > X[i]){
                cnt += (1+(T-X[i]-1)/L);
            }
            X[i] = ((X[i]-T)%L+L)%L;
        }
    }
    cnt = ((cnt%N)+N)%N;
    //cout << cnt << endl;
    sort(X, X+N);
    
    for(int i = 0; i < N; i++){
        ans[i] = X[(i-cnt+N)%N];
    }
    for(int i = 0; i < N; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[3];
    char b[3];
    char c[3];
    for(int i=1;i<=3;i++)
    {
        cin>>a[i];
    }
    for(int j=1;j<=3;j++)
    {
        cin>>b[j];
    }
    for(int m=1;m<=3;m++)
    {
        cin>>c[m];
    }
    cout<<a[1]<<b[2]<<c[3];
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll,pair<ll,ll>> pii;
typedef pair<ll,ll> pi;
typedef vector<ll> vl;

#define matrix vector<vector<ll>>
#define llmax LLONG_MAX
#define llmin LLONG_MIN
#define rep(i,n) for(ll (i)=0;(i)<n;++(i))
#define crep(i,m,n) for(ll (i)=m;(i)<n;++(i))
#define zero(a) memset((a),0,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)));
#define sq(a) ((a)*(a))
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define ff first
#define ss second

ll global=0;

// return nCr value
long long C(int n, int r) {
	if(r>n) return 0;
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;
    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }
    return ans;
}

// return whether number is prime or not
vector<ll> sieve(ll n){
    vector<ll> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i] && (long long)i * i <= n) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return is_prime;
}


void test_case();
int main(){
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    for(ll T=0;T<t;T++){
        test_case();
    }
    //**************************************************************************//
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

void test_case(){
    ll n;cin>>n;
    vector<vector<ll>> v(n,vector<ll>(3)), dp(n,vector<ll>(3,0));
    rep(i,n){rep(j,3)cin>>v[i][j];}
    dp[0][0]=v[0][0], dp[0][1]=v[0][1], dp[0][2]=v[0][2];
    crep(i,1,n){
        dp[i][0] = v[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = v[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = v[i][2] + max(dp[i-1][1], dp[i-1][0]);
    }
    cout<<max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
}


Measured memory_bytes: 14228
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;

int main() {
  int N,M;
  cin >> N >> M;
  int f[N+1];
  for(int i=0;i<N+1;i++) f[i]=1;
  for(int i=0;i<M;i++){
    int a; cin >> a; f[a]=0;
  }
  long long s[N+1];
  s[0]=1;
  s[1]=f[1];
  for(int i=2;i<N+1;i++){
    s[i] = ((s[i-1]+s[i-2])*f[i])%MOD;
  }
  cout << s[N] << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime> 

using namespace std;

int main(void){
	int n;
	int a,b;
	int sc=0,oc=0,lun[4]={0,0,0,0,};
	cin >> n;
	for(a=0;a<n;a++){
		sc=0;
		oc=0;
		for(b=0;b<4;b++)lun[b]=0;
		while(oc<3){
			string str;
			getline(cin,str);
			if(str=="HIT"){
				if(lun[3]==1)sc++,lun[3]=0;
				lun[3]=lun[2];
				lun[2]=lun[1];
				lun[1]=1;
			}
			if(str=="HOMERUN"){
				for(b=1;b<4;b++)sc+=lun[b],lun[b]=0;
				sc++;
			}
			if(str=="OUT")oc++;
		}
		cout << sc << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using  namespace std;
int main(){
    long long n, rate, ansm = 0, ansM, freeColor = 0;
    cin >> n;
    bool A[8] = {};
    for(int i=0;i<n;i++){
        cin >> rate;
        if(rate<3200){
          //cout << rate/400 <<endl;
            A[rate/400] = true;
        }else{
            freeColor++;
        }
    }
    
    for(int i=0;i<8;i++){
        if(A[i]==true){
            ansm++;
        }
      //cout << A[i] << endl;
    }
    ansM = ansm + freeColor;
  	if(ansm==0){
      ansm=1;
    }
    cout << ansm << " " << ansM << endl;
    return 0;
 
}


Measured memory_bytes: 256
def main():
    sectionalview = input()
    stack = []
    a_surface = 0
    surfaces = []
    for cindex in range(len(sectionalview)):
        if sectionalview[cindex] == "\\":
            stack.append(cindex)
        elif sectionalview[cindex] == "/" and 0 < len(stack):
            if 0 < len(stack):
                left_index = stack.pop()
                a = cindex - left_index
                a_surface += a
                while 0 < len(surfaces):
                    if left_index < surfaces[-1][0]:
                        a += surfaces.pop()[1]
                    else:
                        break
                surfaces.append((cindex, a))
    t = [i[1] for i in surfaces]
    print(sum(t))
    print(" ".join(map(str, [len(t)] + t)))

if __name__ == "__main__":
    import os
    import sys
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main()

Measured memory_bytes: 7908
#include <bits/stdc++.h>
    #define ll long long
    #define f(i, a, b) for(ll i=a; i<b; i++)
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    using namespace std;
    ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
    {
        unordered_map<ll, ll> prevSum;
        ll res = 0;
        ll currsum = 0;
        for (ll i = 0; i < n; i++)
        {
            currsum += arr[i];
            if (currsum == sum) res++;
            if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
            prevSum[currsum]++;
        }
        return res; 
    } 
    ll gcd(ll a, ll b) 
    { 
        if (a == 0) 
            return b; 
        return gcd(b % a, a); 
    } 
      
    ll findGCD(ll arr[], ll n) 
    { 
        ll result = arr[0]; 
        for (ll i = 1; i < n; i++)
            result = gcd(arr[i], result); 
      
        return result; 
    } 
    ll powmp(ll x, ll y, ll p) 
    { 
        ll res = 1;     x = x % p;   
        while (y > 0) 
        {  
            if (y & 1)  res = (res*x) % p; 
            y = y>>1; 
            x = (x*x) % p;   
        } 
        return res; 
    } 
     
    int main()
    {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        ll n,b,a; cin>>n;
        ll i;
        double x=sqrt(n);
     for(i=(int)x;i>=1;i--)
     {
     if(n%i==0)
     {
     a=i;b=n/i;break;
     }
     }
      ll ans=0;
      ans=a-1+b-1;
      cout<<ans;
    }

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);

    ll N;
    cin >> N;
    ll Ans = 0;
    for (int n = 1; n <= N; ++n) {
        ll Tmp = N/n;
        Ans += n * Tmp * (Tmp+1) / 2;
    }
    cout << Ans << endl;
    
    return 0;
}


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

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	int X = 1 << N;
	vector<long long> dp(X, INT_MAX);
	for (int i = 0; i < M; i++) {
		long long a, b;
		cin >> a >> b;
		int t = 0;
		for (int j = 0; j < b; j++) {
			int c; cin >> c;
			c--;
			t |= 1 << c;
		}
		dp[t] = min(a, dp[t]);
	}
	for (int i = 0; i < X; i++) {
		for (int j = 0; j < X; j++) {
			dp[i | j] = min(dp[i | j], dp[i] + dp[j]);
		}
	}
	if (dp[X-1] == INT_MAX) cout << -1 << endl;
	else  cout << dp[X-1] << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main() {
	string s;
	cin >> s;
	string L[] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
	rep(i, 7) {
		if (s == L[i]) {
			cout << 7 - i << endl;
		}
	}
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(X < A ? 0 : 10);
	}
	int X, A;
	public Sol(){
		var d = ria();
		X = d[0]; A = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#include<stdio.h>

int main(void){
	
	while(1){
		
	int n,x,i,k,j,ans=0;
	scanf("%d %d", &n,&x);
	
		if(n==0 && x==0) break;
		
	for(i=1;i<n-1;i++){
		
		for(k=i+1; k<n;k++){
			
			for(j=k+1;j<n+1;j++){
				
				if(i+k+j==x){
					ans++;
				}
			}
		}
	}
	
		printf("%d\n",ans);
	}	
		return 0;
	}
	



Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    string s;
    cin >> s;
    int n = s.size();
    n++;
    int a[n] = {};
    rep(i,n-1){
        a[n-2-i] = s[i] - '0';
    }

    int ans = 0;
    rep(i,n){
        if(a[i] <= 4){
            ans += a[i];
            a[i] = 0;
        }else if(a[i] == 5){
            if(a[i+1] < 5){
                ans += a[i];
                a[i] = 0;
            }else{
                ans += 10 - a[i];
                a[i] = 0;
                a[i+1]++;
            }
        }else if(a[i] <= 9){
            ans += 10 - a[i];
            a[i] = 0;
            a[i+1]++;
        }else{
            a[i] = 0;
            a[i+1]++;
        }
    }
    
    cout << ans << endl;
    return 0;
}
 
 


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

vector<int> to[100005];
const int INF = 1001001001;

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

  int A,B;
  for(int i=0;i<M;i++){
    cin >> A >> B;
    --A;
    --B;
    to[A].push_back(B);
    to[B].push_back(A);
  }
  queue<int> q;
  vector<int> dist(N, INF);
  vector<int> pre(N,-1);
  dist[0] = 0;
  q.push(0);
  while(!q.empty()){
  	int v = q.front(); q.pop();
  	for(int u : to[v]){
  		if(dist[u] != INF) continue;
  		dist[u]  = dist[v] +1;
  		pre[u] = v;
  		q.push(u);
  	}
  }

  cout << "Yes" << endl;

  for(int i=0;i<N;i++){
  	if(i==0) continue;
  	int ans = pre[i];
  	++ans;
  	cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 10624
#include <iostream>
using namespace std;
#define inf 1e12
int main()
{
    long long n,w;
    cin>>n>>w;
    long long we[n];
    int v[n];
    int sum=0;
    for(int i=0;i<n;i++) {
        cin>>we[i]>>v[i];
        sum+=v[i];
    }
    
    long long int dp[n][sum+1];
    for(int i=0;i<n;i++) dp[i][0]=0;
    for(int i=1;i<=sum;i++) 
    if(i==v[0]) dp[0][i]=we[0];
    else dp[0][i]=inf;
    
    for(int i=1;i<n;i++)
    for(int j=1;j<=sum;j++)
    if(j>=v[i]) dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+we[i]);
    else dp[i][j]=dp[i-1][j];
    
    int ans=-1;
    for(int i=0;i<n;i++)
    for(int j=0;j<=sum;j++) 
    if(dp[i][j]<=w) ans=max(ans,j);
    
 
    cout<<ans;
    
    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD 998244353ll
char S[5050],U[10101];
ll N,N2, K;
char ans[5050];
ll i, j, k;
int main(){
    scanf("%lld%lld%s",&N, &K,S);
    N2 = N * 2;
    fornum(i,0,N){
        U[i] = S[i];
        U[N * 2 - 1 - i] = S[i];
    }
    K--;
    char a = 'z';
    ll b = 0;
    j = 0;
    fornum(i,0,N2){
        if(U[i]<a){
            a = S[i];
            b = 1;
            j = 1;
        }else if(U[i]==a){
            j++;
            b = max(b, j);
        }else{
            j = 0;
        }
    }
    for (i = 0; (b<<i)<N;i++)
        ;
    if(i<=K){
        fornum(i,0,N){
            printf("%c", a);
        }
        return 0;
    }
    fornum(i,0,b){
        ans[i] = a;
    }
    fornum(i,i,N){
        ans[i] = 'z';
    }
    for (i = N2 - 1; i >= N-1;i--){
        bool f = false;

        fornum (j ,0,N){
            if(ans[j]>U[i-j]){
                break;
            }else if(ans[j]<U[i-j]){
                f = true;
                break;
            }
        }
        if(f)
            continue;
        fornum(j,j,N){
            ans[j] = U[i - j];
        }
    }
    //printf("%s\n", ans);
    fornum(i,0,(b<<K)){
        printf("%c", a);
    }
    fornum(j,i,N)
    {
        printf("%c", ans[b+j-i]);
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define pb push_back
#define mp make_pair
#define Chkmax(a,b) a=a>b?a:b
#define Chkmin(a,b) a=a<b?a:b
#define mx(a,b) (a>b?a:b)
#define mn(a,b) (a<b?a:b)
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef long long ll;
using namespace std;

namespace IO
{
    const uint32 Buffsize=1<<15,Output=1<<23;
    static char Ch[Buffsize],*S=Ch,*T=Ch;
    inline char getc()
	{
		return((S==T)&&(T=(S=Ch)+fread(Ch,1,Buffsize,stdin),S==T)?0:*S++);
	}
    static char Out[Output],*nowps=Out;
    
    inline void flush(){fwrite(Out,1,nowps-Out,stdout);nowps=Out;}

    template<typename T>inline void read(T&x)
	{
		x=0;static char ch;T f=1;
		for(ch=getc();!isdigit(ch);ch=getc())if(ch=='-')f=-1;
		for(;isdigit(ch);ch=getc())x=x*10+(ch^48);
		x*=f;
	}

	template<typename T>inline void write(T x,char ch='\n')
	{
		if(!x)*nowps++='0';
		if(x<0)*nowps++='-',x=-x;
		static uint32 sta[111],tp;
		for(tp=0;x;x/=10)sta[++tp]=x%10;
		for(;tp;*nowps++=sta[tp--]^48);
		*nowps++=ch;
	}
}
using namespace IO;

inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("c.in","r",stdin);
	freopen("c.out","w",stdout);
#endif
}

const int MAXN=407;

static int n,m;

static struct edg
{
	int u,v;
}q[100011];

inline void init()
{
	read(n);read(m);
	static int u,v;
	Rep(i,1,m)read(q[i].u),read(q[i].v);
}

bitset<407>need[MAXN];

static int ans;

inline void solve()
{
	Rep(i,1,n)
	{
		need[i].set(i);
		Repe(j,m,1)if(need[i].test(q[j].u))
		{
			if(need[i].test(q[j].v)){need[i].set(0);break;}
			need[i].set(q[j].v);
		}
		else if(need[i].test(q[j].v))need[i].set(q[j].u);
	}
	Rep(i,1,n)if(!need[i].test(0))Rep(j,i+1,n)
		if(!need[j].test(0)&&!((need[i]&need[j]).count()))
			++ans;
	printf("%d\n",ans);
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    sort(ALL(l));
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k < n; k++)
            {
                if (l[i] + l[j] > l[k])
                {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
#define USINT_MAX 4294967295

int main(){
	char a[13];
	cin >> a;
	for (int i = 12; i > 4; i--) {
		a[i] = a[i - 1];
	}
	a[4] = ' ';
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX;
const ll MOD = 998244353;

int main() {
  int N;cin >> N;
  vint a(N);
  repeat(i,N) cin >> a[i];
  sort(a.begin(),a.end());
  int M = a[N-1];
  if(a[0]!=(M+1)/2){
    cout << "Impossible" << endl;
    return 0;
  }
  vint cnt(M+1,0);
  repeat(i,N){
    cnt[a[i]]++;
  }
  debugArray(cnt,M+1);
  bool isok = (M&1)? (cnt[(M+1)/2]==2):(cnt[(M+1)/2]==1);
  debug(isok);
  for(int i=(M+1)/2+1;i<=M;i++){
    isok &= cnt[i]>=2;
  }
  debug(isok);
  cout << (isok? "Possible":"Impossible") << endl;
  return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

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

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  cin >> n >> m;
  ll x,y;
  vector<ll> v(n,1),f(n,0);
  v[0] = 1;
  f[0] = 1;
  rep(i,m){
    cin >> x >> y;
    --x,--y;
    if(f[x] == 1 && v[x] > 0){
      f[y] = 1;
    }
    v[y]++;
    v[x]--;
    if(v[x] == 0 && f[x] == 1){
      f[x] = 0;
    }
  }
  ll ans = 0;
  rep(i,n){
    if(v[i] && f[i]){
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define MAX 100001
using namespace std;

int root;
vector<int> parent;
vector<int> parent_cnt;
vector<deque<int>> child;
deque<int> que;

/*
  入力を読み込みながら
  -親を記録
  -親の数をカウント
  -子をリストに記録
  ※親が複数いる場合どれか1つを記録しておけばいい
  
  親の記録を辿って根を決定
  
  根から順に頂点を取り出す
  取り出したことで出来た新しい根をさらに取り出す
  
  キューで管理することで浅いところから順に処理
*/
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n, m;
  cin >> n >> m;
  root = 1;
  
  parent    .resize(n+1);
  parent_cnt.resize(n+1);
  child     .resize(n+1, deque<int>(0));
  
  for(int i=1; i<n+m; i++){
    int a, b;
    cin >> a >> b;
    parent.at(b) = a;
    parent_cnt.at(b)++;
    child.at(a).push_back(b);
  }
  
  while(parent.at(root) != 0)
    root = parent.at(root);
  
  que.push_back(root);
  while(!que.empty()){
    int r = que.front();
    que.pop_front();
    for(int c: child[r]){
      parent_cnt.at(c)--;
      if(parent_cnt.at(c)==0){
        que.push_back(c);
        parent.at(c) = r;
      }
    }
  }
  
  for(int i=1; i<=n; i++)
    cout << parent.at(i)  << "\n";
  
  cout << flush;
  return 0;
}

Measured memory_bytes: 69632
#include <stdio.h>

int main()
{
    int i = 1; 
    int x;
    do
    {
        scanf("%d", &x);
        if (x != 0)
        {
            printf("Case %d: %d\n", i, x);
        }
        i++;
    } while (x != 0);

    return 0;
}


Measured memory_bytes: 2036
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

h,w = I()
board = [X() for _ in range(h)]
num = []
nn = []

for i in range(h):
    if "#" not in board[i]:
        num.append(i)

for i in num:
    a = i - count
    del board[a]
    count += 1

for i in range(w):
    nn.append(i)
    for j in range(len(board)):
        if board[j][i] == "#":
            nn.remove(i)
            break

for i in range(len(board)):
    cnt = 0
    for j in nn:
        b = j-cnt
        del board[i][b]
        cnt += 1

for i in range(len(board)):
    print("".join(board[i]))


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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
#define mod 998244353

int f[100010];
int n,m;
vector<int> edge[100010];

int lowbit(int x) {return x&(-x);}

int getf(int node) {
	if (edge[node].size()==0) return 0;
	if (f[node]!=-1) return f[node];
	for (int i=0;i<edge[node].size();i++)
		f[node]=max(f[node],getf(edge[node][i])+1);
	return f[node];
}

int main(){
	memset(f,-1,sizeof(f));
	scanf("%d%d",&n,&m);
	for (int i=0;i<m;i++) {
		int x,y;
		scanf("%d%d",&x,&y);
		edge[x].pb(y);
	}
	int ans=0;
	for (int i=1;i<=n;i++) ans=max(ans,getf(i));
	cout<<ans;
	return 0;
}


Measured memory_bytes: 8192