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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<long long int> x(N);
  vector<long long int> y(N);
  vector<long long int> h(N);
  
  long long int rx,ry,rh;
  
  for(int i = 0; i < N; i++){
  cin >> x[i] >> y[i] >> h[i];
    if(h[i] >= 1){
      rx = x[i];
      ry = y[i];
      rh = h[i];
    }
  }
  
  int X, Y, H;
  
  for(int i = 0; i < 101; i++){
    for(int j = 0; j < 101; j++){
      int V = abs(rx - i) + abs(ry - j) + rh;
      V = max(V,0);
      bool flag = false;
      for(int k = 0; k < N; k++){
        int W = V - abs(x[k] - i) - abs(y[k] - j);
        W = max(W,0);
        if(W != h[k]) flag = true;
      }
      if(!flag){
        X = i;
        Y = j;
        H = V;
      }
      flag = false;
    }
  }
  cout << X << " " << Y << " " << H;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn solve(n: i32) {
    for i in 1..=n {
        if (i * 108) / 100 == n {
            println!("{}", i);
            return;
        }
    }
    println!(":(");
}

fn main() {
    input! {
        n: i32,
    }
    solve(n);
}


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

#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        int n;
        cin >> n;
        string s;
        cin >> s;
        for( int i = 0; i < s.size(); i++ ) {
                int c = s[i] - 'A';
                for( int j = 1; j <= n; j++ ) {
                        c++;
                        c %= 26;
                }
                cout << (char)(c + 'A');
        }
        cout << endl;
        return 0;
}










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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string sss = Console.ReadLine();
            string[] str = sss.Split(' ');
            int W = int.Parse(str[0]);
            int H = int.Parse(str[1]);
            int X = int.Parse(str[2]);
            int Y = int.Parse(str[3]);
            int R = int.Parse(str[4]);
            if(X>=R && X<=W-R&& Y>=R && Y <= H - R)
            {
                Console.Write("Yes");
                Console.WriteLine();
            }
            else
            {
                Console.Write("No");
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9004
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repeq(i,a,b) for(int i=a;i<=(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i,0,n) cin >> a[i];
    rep(i,0,n) cin >> b[i];
    const int E=29;
    int ans=0;
    for(int e=E-1;e>=0;--e) {
        ll m = (1LL)<<e;
        rep(i,0,n) a[i]%=2*m, b[i]%=2*m;
        sort(a.begin(),a.end());
        sort(b.begin(),b.end());
        ll num=0;
        rep(t,1,4) {
            ll th = t*m;
            ll c=0;
            int j=0;
            for(int i=n-1;i>=0;--i) {
                while(j<n && a[i]+b[j]<th) ++j;
                c+=(n-j);
            }
            if(t==2) num-=c;
            else num+=c;
        }
        if(num%2==1) ans|=1<<e;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3456
in_n = input().split()
n = int(in_n[0])
in_l = []
in_r = []
for i in range(0,n):
    in_n = input().split()
    in_l.append(int(in_n[0]))
    in_r.append(int(in_n[1]))
l = 0
max_n =0
for i in range(0,n):
    if in_l[i] == in_r[i]:
        l = l +1
    else:
        l = 0
    if l > max_n:
        max_n = l
if max_n >=3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9200
A,B,Q=gets.chomp.split.map(&:to_i)
s=[]
A.times do
  s << gets.to_i
end
t=[]
B.times do
  t << gets.to_i
end

s.sort!
t.sort!

def binary_search(arr, v)
  l = 0
  r = arr.size - 1

  while l <= r
    mid = (l + r) / 2

    if arr[mid] == v
      return [v]
    elsif arr[mid] < v
      l = mid + 1
    else
      r = mid - 1
    end

  end

  if r == -1
    return [arr[0]]
  elsif l == arr.size
    return [arr[-1]]
  else
    return [arr[r], arr[l]]
  end
end

Q.times do
  x = gets.to_i
  ss = binary_search(s, x)
  tt = binary_search(t, x)

  ans = Float::INFINITY
  ss.each do |i|
    tt.each do |j|
      if i < x && j < x || i > x && j > x
        tmp = [(x-i).abs, (x-j).abs].max
      else
        tmp = [2*(x-i).abs+(x-j).abs, (x-i).abs+2*(x-j).abs].min
      end
      ans = ans < tmp ? ans : tmp
    end
  end
  puts ans
end
  


Measured memory_bytes: 5928
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N, K;
    string S;
    cin >> N >> K >> S;
    char t = S[K-1] + 32;
    S[K-1] = t;
    cout << S << endl;
}

Measured memory_bytes: 256
def find(x):
  if par[x] == x:
    return x
  else:
    par[x] = find(par[x])
    return par[x]

def union(x, y):
  par_x = find(x)
  par_y = find(y)
  if rank[par_x] < rank[par_y]:
    par[par_x] = par_y
    w[par_y]+=w[par_x]
  else:
    par[par_y] = par_x
    w[par_x]+=w[par_y]
    if rank[par_x] == rank[par_y]:
      rank[par_x] += 1

def same(x, y):
  return find(x)==find(y)

def dfs(cur, prev):
  if visited[cur] or cur!=find(cur):
    while len(path)>0:
      union(0, path.pop())
    return
  visited[cur] = 1
  path.append(cur)
  for to in graph[cur]:
    if to==prev:
      continue
    dfs(to, cur)
  visited[cur] = 0
  if len(path)>0 and path[-1]==cur:
    path.pop()

def dfs2(cur):
  visited[cur] = 1
  ret = 0
  for i in range(len(graph2[cur])):
    for ele in graph[graph2[cur][i]]:
      if visited[find(ele)] == 0:
        ret = max(ret, dfs2(find(ele)))
  return ret+w[find(cur)]

import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)
n, m = map(int, input().split())
w = [0]
w.extend(list(map(int, input().split())))
graph = defaultdict(list)
for _ in range(m):
  u, v = map(int, input().split())
  graph[u].append(v)
  graph[v].append(u)

path = []
graph2 = [[] for _ in range(n+1)]
visited = [0]*(n+1)
par = [i for i in range(n+1)]
rank = [0]*(n+1)

dfs(1, -1)
for i in range(1, n+1):
  graph2[find(i)].append(i)

print(dfs2(find(1)))


Measured memory_bytes: 158524
#include<bits/stdc++.h>
using namespace std;
int n,m;
string s[505];
int a[505];
bitset<505> b[505];
int dp[2][1<<23];
int btoi(string str){
	int res=0;
	for(int i=0;i<str.size();i++){
		res *= 2;
		res += str[i]-'0';
	}
	return res;
}
bool solve(){
	cin >> n >> m;
	if(n+m==0)return false;
	for(int i=0;i<n;i++){
		cin >> s[i];
		a[i]=btoi(s[i]);
		b[i]=bitset<505>(s[i]);
	}
	if(n<=23){
		int ans = 0;
		for(int i=0;i<(1<<n);i++){
			bitset<505> res(0);
			int cnt = 0;
			for(int j=0;j<n;j++){
				if((i>>j)&1){
					res ^= b[j];
					cnt++;
				}
			}
			if(!res.any()) ans = max(ans,cnt);
		}
		cout << ans << endl;
		return true;
	}else{ // m <=23
		memset(dp,-1,sizeof(dp));
		dp[0][0] = 0;
		int *cur = dp[0];
		int *next = dp[1];
		for(int i=0;i<n;i++){
			for(int j=0;j<(1<<m);j++)next[j]=-1;
			for(int j=0;j<(1<<m);j++){
				if(cur[j]==-1)continue;
				next[j^a[i]] = max(next[j^a[i]],cur[j]+1);
				next[j] = max(next[j],cur[j]);
			}
			swap(cur,next);
		}
		cout << cur[0] << endl;
		return true;
	}
}
int main(){
	while(solve()){}
	return 0;
}


Measured memory_bytes: 68768
import heapq

class UnionFind:
  def __init__(self, size):
    self.table = [-1 for _ in xrange(size)]

  def find(self, x):
    while self.table[x] >= 0: x = self.table[x]
    return x

  def union(self, x, y):
    s1 = self.find(x)
    s2 = self.find(y)
    if s1 != s2:
      if self.table[s1] >= self.table[s2]:
        self.table[s1] += self.table[s2]
        self.table[s2] = s1
      else:
        self.table[s2] += self.table[s1]
        self.table[s1] = s2
      return True
    return False

def hash(n, s, g):
  return n*s+g

def dehash(n, hs):
  return [(hs-hs%n)/n, hs%n]

def kruskal(n, path):
  path = sorted(path.items(), key=lambda x:x[1])
  selected = {}
  union = UnionFind(n)
  for i in xrange(len(path)):
    k,v = path[i]
    s,g = dehash(n, k)
    if union.union(s, g):
      selected[k] = v
  return selected

def prim(n, path):
  selected = {}
  paths = []
  hq = []
  selected[0] = True

  if 0 not in path:
    return []

  for s,d,w in path[0]:
    heapq.heappush(hq, (w, [0,d,w]))

  while len(hq) != 0:
    k,root = heapq.heappop(hq)
    if root[1] in selected: continue
    selected[root[1]] = True
    paths.append(root)
    for s,d,w in path[root[1]]:
      heapq.heappush(hq, (w, [s,d,w]))
  return paths

V,E = map(int, raw_input().split())
path = {}
for _ in xrange(E):
  s,t,w = map(int, raw_input().split())
  if s not in path:
    path[s] = []
  path[s].append([s,t,w])
  if t not in path:
    path[t] = []
  path[t].append([t,s,w])
result = prim(V, path)
sumcost = 0
for s,d,v in result:
  sumcost += v
print sumcost

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

#define ll long long
#define inf 100000000000

// ll frog(vector<vector<ll>> &a,ll n,ll i,ll prev)
// {
//     if(i==n)
//         return 0;
    
//     if(dp[i][prev]!=-1)
//     {
//         return dp[i][prev];
//     }


//     ll a1=-1,b1=-1,c1=-1;
//     if(prev!=1)
//     {
//         a1=a[i][1]+frog(a,n,i+1,1);
//     }
//     if(prev!=2)
//     {
//         b1=a[i][2]+frog(a,n,i+1,2);
//     }
//     if(prev!=3)
//     {
//         c1=a[i][3]+frog(a,n,i+1,3);
//     }
//     dp[i][prev]=max(a1,max(b1,c1));
//     return dp[i][prev];
    
    
// }




int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n,k;
    cin>>n>>k;
    
    vector<pair<ll,ll>> v;
    for(ll i=0;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        v.push_back({a,b});
    }
    
    ll dp[n+10][k+10];
    for(ll i=0;i<=k;i++)
        dp[0][i]=0;
    
    for(ll i=1;i<=n;i++)
    {
        ll a=v[i-1].first,b=v[i-1].second;
    
    
        for(ll j=0;j<=k;j++)
        {
            if(j==a)
            {
                dp[i][j]=max(dp[i-1][j],b);
            }
            else if(j<a)
            {
                dp[i][j]=dp[i-1][j];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j-a]+b,dp[i-1][j]);
            }
        }
        
    }
    
    // for(ll i=0;i<=n;i++)
    // {
    //     for(ll j=0;j<=k;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    
    cout<<dp[n][k]<<endl;
    
    
	return 0;
}

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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL N, A, B;
	cin >> N >> A >> B;

	LL train = N * A;
	LL tac = B;

	cout << min<>(train, tac) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int X,Y;
    cin>>X;
    Y=X%7;
    switch(Y){
        case 0:
        cout<<"thu"<<endl;
        break;
        case 1:
        cout<<"fri"<<endl;
        break;
        case 2:
        cout<<"sat"<<endl;
        break;
        case 3:
        cout<<"sun"<<endl;
        break;
        case 4:
        cout<<"mon"<<endl;
        break;
        case 5:
        cout<<"tue"<<endl;
        break;
        case 6:
        cout<<"wed"<<endl;
        break;
    }
}



Measured memory_bytes: 3096
import sys, math
from collections import defaultdict
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
A = []
for i in range(N):
	A.append(ri())

import collections, bisect
queue = collections.deque()

queue.appendleft(A[0])
for i in range(1, N):
	idx = bisect.bisect_left(queue, A[i])
	if idx == 0:
		queue.appendleft(A[i])
	else:
		queue[idx-1] = A[i]
print(len(queue))


Measured memory_bytes: 78444
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int n, m;
	while(cin >> n >> m && n)
	{
		vint p(n);
		rep(i, n)
			cin >> p[i];

		sort(ALL(p));

		int res = accumulate(ALL(p), 0);
		rep(i, n)
			res -= ((i + 1) % m== 0) * p[n - i - 1];

		cout << res << endl;
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	private static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {

		int l = scan.nextInt();
		double a = l/3.0;
		double b = (l-a)/2.0;
		double c = l-a-b;

		System.out.println(a*b*c);

	}
}

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

const int MAX = 10e9;

int main() {
  int n;
  cin >> n;
  vector<pint> v(n);
  rep(i, n) {
    int x, l;
    cin >> x >> l;
    v[i] = pint(x + l, x - l);
  }
  sort(v.begin(), v.end());

  int ans = 0;
  int now = MAX * -1;
  rep(i, n) {
    if (now > v[i].second) continue;
    ans++;
    now = v[i].first;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] data = Console.ReadLine().Split(' ');

        int r = int.Parse(data[0]);
        int c = int.Parse(data[1]);

        string[,] cell = new string[r + 1, c + 1];

        for (int i = 0; i < r; i++)
        {
            string[] row = Console.ReadLine().Split(' ');

            int sum = 0;
            for (int j = 0; j < c; j++)
            {
                cell[i, j] = row[j];
                sum += int.Parse(row[j]);
            }

            cell[i, c] = sum.ToString();
        }

        for (int j = 0; j < c + 1; j++)
        {
            int sum = 0;
            for (int i = 0; i < r; i++)
            {
                sum += int.Parse(cell[i, j]);
            }

            cell[r, j] = sum.ToString();
        }

        //??????
        for (int i = 0; i < r + 1; i++)
        {
            for (int j = 0; j < c; j++)
            {
                Console.Write(cell[i, j] + " ");
            }

            Console.WriteLine(cell[i, c]);
        }
    }
}

Measured memory_bytes: 9848
Imports System.Collections
        Imports System.Collections.Generic
        Imports System.Linq
        Imports System.xml
        Imports System.xml.Linq
         
        Module Module1
          public sub main()
            
            dim N as string = Console.ReadLine()    
        IF N.indexof("7") > -1 then
          console.writeLine("Yes")
        else 
          console.writeLine("No")
        end if
     
              
          end sub 
        End Module

Measured memory_bytes: 26144
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef pair<int,int> P;

int n,m;
int t[100002];
const P INF(-1,-1);

bool check(int idx){
  if(idx == 0) return t[1] < t[0];
  if(idx == n-1) return t[n-2] < t[n-1];
  return t[idx-1] < t[idx] && t[idx+1] < t[idx];
}

P getNext(int idx){
  if(idx < 0 || n <= idx || !check(idx)) return INF;
  return P(t[idx],idx);
}

int main(){
  while(cin>>n>>m){
    rep(i,n) cin>>t[i];

    int now = 0;
    priority_queue<P> q;
    rep(i,n) if(check(i)) q.push(P(t[i],i));

    while(!q.empty()){
      P p = q.top(); q.pop();
      int plus = m - (p.first + now);
      if(plus > 0) now += plus;
      else plus = 0;

      t[p.second] = 0;
      P left = getNext(p.second-1);
      P right = getNext(p.second+1);
      if(left != INF){
        left.first -= now;
        q.push(left);
      }
      if(right != INF){
        right.first -= now;
        q.push(right);
      }
    }

    cout<<now<<endl;
  }
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

const int INF = 1e9;
const ll LINF = 1e18;


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

    if (c - a - b >= 0) {
        if (a * b * 4 < (c - a - b) * (c - a - b))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    } else {
        if (a * b * 4 < -(c - a - b) * (c - a - b))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    long long int a,b,k;
    cin >> a >> b >> k;
    long long int temp,temp2;
    if (a > k) {
        cout << (a-k) << " " << b << endl;
        return 0;
    } else {
        cout << 0 << " ";
        temp = b - (k - a);
        if (temp <= 0) {
            cout << 0;
        } else {
            cout << temp;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>

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

ll rt[30];

int main()
{
	ll D;
	scanf("%lld",&D);
	rt[0]=1;
	for(int i=1;i<30;i++) rt[i]=rt[i-1]*10LL;
	ll ret=0;
	//2桁以上のものだけ
	for(int i=2;i<=20;i++)
	{
		int k=i/2;
		for(int S=0;S<1<<k;S++)
		{
			ll way=i%2==1?10:1,zan=D;
			for(int j=0;j<k;j++)
			{
				ll d=llabs(zan)%10LL;
				if(zan<0)
				{
					d=10-d;
					d%=10;
				}
				if(S>>j&1)
				{
					//x,x+dにする
					ll nm=10LL-d;
					if(j==0) nm--;
					way*=nm;
					zan+=d*rt[i-2*j-1];
					zan-=d;
				}
				else
				{
					//x,x+d-10にする
					ll nm=d;
					if(j==0) nm--;
					if(nm<0)
					{
						way=0;
						break;
					}
					way*=nm;
					zan-=(10LL-d)*rt[i-2*j-1];
					zan+=(10LL-d);
				}
				zan/=10LL;
			}
			if(zan==0) ret+=way;
		}
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,L,T;
    cin >> N >> L >> T;
    vec<ll> X(N),W(N);
    map<ll,ll> mp;
    vvec<ll> list(2);
    L *= 2;
    T *= 2;
    for(ll i=0;i<N;i++){
        cin >> X[i] >> W[i];
        W[i]--;
        X[i] *= 2;
        mp[X[i]] = i;
        list[W[i]].emplace_back(X[i]);
    }
    if(list[1].empty()){
        for(ll i=0;i<N;i++) cout << (X[i]+T)%L/2 << "\n";
        return 0;
    }
    if(list[0].empty()){
        for(ll i=0;i<N;i++) cout << (X[i]-T+L)%L/2 << "\n";
        return 0;
    }
    for(ll k=0;k<2;k++) sort(list[k].begin(),list[k].end());
    
    auto dist = [&](ll clock,ll counter){
        if(clock<counter) return counter-clock;
        else return L-(clock-counter);
    };

    auto next_time = [&](ll clock,ll counter,ll ti){
        ll p0 = (clock+ti)%L,p1 = (counter-ti+L)%L;
        ll d = dist(p0,p1);
        return ti+d/2;
    };

    vec<ll> id(2);
    ll ti = 0,now = 0;
    bool exist = mp[list[1][0]]==0;
    vec<ll> si = {(ll) list[0].size(),(ll) list[1].size()};
    if(exist){
        id[0] = si[0]-1;
    }
    while(true){
        ll net = next_time(list[0][id[0]],list[1][id[1]],ti);
//        cerr << ti << " " << net << "\n";
        if(net<L){
            exist ^= true;
            now = mp[list[exist][id[exist]]];
            if(exist) (id[0] += -1+si[0])%=si[0];
            else (id[1] += 1)%=si[1];;
        }else break;
        ti = net;
    }
    ll n = T/L;
    now = ((ll) now*n)%N;
    if(!W[now]){
        for(ll i=0;i<si[0];i++) if(mp[list[0][i]]==now){
            id[0] = i;
            break;
        }
        id[1] = 0;
        for(ll j=0;j<si[1];j++) if(X[now]<list[1][j]){
            id[1] = j;
            break;
        }
        exist = false;
    }else{
        for(ll i=0;i<si[1];i++) if(mp[list[1][i]]==now){
            id[1] = i;
            break;
        }
        id[0] = si[0]-1;
        for(ll j=0;j<si[0];j++){
            if(list[0][j]<X[now]){
                id[0] = j;
            }else break;
        }
        exist = true;
    }
    ti = 0;
    while(true){
        ll net = next_time(list[0][id[0]],list[1][id[1]],ti);
        if(net<(T%L)){
            exist ^= true;
            now = mp[list[exist][id[exist]]];
            if(exist) (id[0] += -1+si[0])%=si[0];
            else (id[1] += 1)%=si[1];;
        }else break;
        ti = net;
    }
    vec<ll> ans(N);
    vec<ll> v;
    ll start = -1;
    for(ll i=0;i<N;i++){
        ll l = (X[i]+(W[i]? -1:1)*T+(ll) T*L)%L;
        v.push_back(l);
        if(i==now) start = l;
    }
    sort(v.begin(),v.end());
    ll sid = 0;
    for(ll i=0;i<N;i++) if(v[i]==start){
        sid = i;
        if(!W[now]) break;
    }
    for(ll i=0;i<N;i++) cout << v[(sid+i)%N]/2 << "\n";
}

Measured memory_bytes: 13608
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(stderr,args)
#else
#define debug(args...)
#endif //ONLINE_JUDGE
template<typename T> inline T abs(T t) { return t < 0? -t : t; }
const ll modn = 1000000007;
inline ll mod(ll x) { return x % modn; }
#define IOS() ios::sync_with_stdio(0),cin.tie(0)

const int MAXN = 212345;

int n, m, k;
ll s[MAXN];
ll q[MAXN];

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

pii get(ll x){
    pii p;
}

const int MAXB = 150;
int EPS = 50;
const int INF  = MAXB - EPS - 5;
int bit[MAXB][MAXB];

void updy(int i, int j){
    while(j < MAXB){
        //printf("upd %d %d\n", i, j);
        bit[i][j]++;
        j += (j&-j);
    }
}

void upd(int i, int j){
    i += EPS;
    j += EPS;
    for(int a=i;a>=0;a--){
        for(int b=j;b>=0;b--){
            bit[a][b]++;
        }
    }
}

int qryy(int i, int j){
    int ans = 0;
    while(j > 0){
        //printf("qry %d %d\n", i, j);
        ans += bit[i][j];
        j -= (j&-j);
    }
    return ans;
}

int qry(int i, int j){
    i += EPS; 
    j += EPS;
    return bit[i][j];
}


int main (){
	scanf("%d", &n);
    ll ans = 0;
	for(int a=0;a<n;a++){
        char num[30];
        scanf(" %s", num);
        int sz = strlen(num);
        s[a] = 0;
        q[a] = 1;
        bool pass = false;
        for(int i=0;i<sz;i++){
            if(num[i] == '.')
                pass = true;
            else{
                s[a] *= 10; 
                s[a] += num[i]-'0';
                if(pass)
                    q[a] *= 10;
            }
        }
        ll gc = gcd(s[a], q[a]);
        s[a] /= gc;
        q[a] /= gc;
        //printf("s %lld q %lld\n", s[a], q[a]);
        pii bal = {0, 0};
        while(q[a]%2 == 0){
            bal.fst--;
            q[a]/=2;
        }
        while(q[a]%5 == 0){
            bal.snd--;
            q[a]/=5;
        }

        while(s[a]%2 == 0){
            bal.fst++;
            s[a]/=2;
        }
        while(s[a]%5 == 0){
            bal.snd++;
            s[a]/=5;
        }

        ans += qry(-bal.fst, -bal.snd);
        upd(bal.fst, bal.snd);
	}
    printf("%lld\n", ans);
}



Measured memory_bytes: 6872
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[]
for i in range(N):
  A.append([int(i) for i in input().split()])
ans=0
for a in A:
  asum=0
  for i in range(M):
    asum += a[i]*B[i]
  asum+=C
  if asum > 0:
    ans+=1
print(ans)

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

int main(){
  int N,M;
  int a[50],b[50],c[50],d[50];
  cin>>N>>M;
  for(int i=0;i<N;i++)
    cin>>a[i]>>b[i];
  
  for(int i=0;i<M;i++)
    cin>>c[i]>>d[i];

  for(int i=0;i<N;i++){
    int mini=1e9;
    int ans;
    for(int j=0;j<M;j++){
      int dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(mini>dist){
        mini=dist;
        ans=j;
      }
    }
    cout<<ans+1<<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++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
    int A, B;
    cin >> A >> B;
    if (A != 1 && B != 1){
        if (A < B){
            cout << "Bob" << endl;
        }
        else if (A > B){
            cout << "Alice" << endl;
        }
        else {
            cout << "Draw" << endl;
        }
    }
    else {
        if (A == 1 && B == 1){
            cout << "Draw" << endl;
        }
        else if (A == 1){
            cout << "Alice" << endl;
        }
        else{
            cout << "Bob" << endl;
        }
    }
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=2e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
ll arr[MAXN];
int main()
{
    ll n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>arr[i];
    sort(arr+1,arr+1+n);
    ll ans=0;
    for(int i=1;i<=n-k;i++)ans+=arr[i];
    cout<<ans<<endl;
    return 0;
}


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

long long n, a[200001];
long long dp[200001][2];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    memset(dp, 0, sizeof(dp));
    dp[2][0] = a[0];
    dp[2][1] = a[1];

    for (int i = 3; i <= n; i++){
        if (i % 2 == 1){
            dp[i][1] = a[i - 1] + max(max(dp[i - 2][1], dp[i - 2][0]), max(dp[i - 3][1], dp[i - 3][0]));
            dp[i][0] = dp[i - 1][1];
        }
        else {
            dp[i][1] = a[i - 1] + max(max(dp[i - 2][1], dp[i - 2][0]), dp[i - 1][0]);
            dp[i][0] = a[i - 2] + dp[i - 2][0]; // 
        }
    }

    cout << max(dp[n][1], dp[n][0]) <<"\n";
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static double ReadDouble()
        {
            return double.Parse(Console.ReadLine());
        }

        static double[] ReadDoubles()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static string[] ReadStringSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        static void A()
        {
            var N = ReadLong();
            Console.WriteLine((double)((N + 1) / 2) / (double)N);
        }

        static void B()
        {

        }

        static void C()
        {

        }

        static void D()
        {

        }

        static void Main(string[] args)
        {
            A();
            //B();
            //C();
            //D();
        }
    }
}


Measured memory_bytes: 27560
#include<stdio.h>
int main(){
	int x, y, z, k, s;
	x=0;
	scanf("%d %d", &k,&s);
	for(z=0; z<=k; z++){
		for(y=0; y<=s-z&&y<=k; y++){
			if(s-z-y<=k){
				x++;
			}
		}
	}
	printf("%d", x);
	}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    int b = sc.nextInt();
    if ((a+b)%2==1) {
      System.out.println((a+b)/2+1);
    } else {
      System.out.println((a+b)/2);
    }
  }
}

Measured memory_bytes: 21588
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] time = new int[N];
		for(int i = 0;i < N-1;i++) {
			int C = scn.nextInt();
			int S = scn.nextInt();
			int F = scn.nextInt();
			for(int j = 0;j <= i;j++) {
				if(time[j] < S) {
					time[j] = S;
				}
				if(time[j]%F!=0)time[j]+=F-time[j]%F;
				time[j]+= C;
			}
		}
		for(int i = 0;i < N;i++) {
			System.out.println(time[i]);
		}
	}

}


Measured memory_bytes: 25864
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef unsigned long long ull;
struct RollingHash2D{
  struct RollingHash{
    string S;
    ull B;
    vector<ull> hash,p;
    int len;
    RollingHash(){}
    RollingHash(string S,ull B=1000000007LL):S(S),B(B){init();};
    void init(){
      len=S.length();
      hash.resize(len+1);
      p.resize(len+1);
      hash[0]=0;p[0]=1;
      for(int i=0;i<len;i++){
	hash[i+1]=hash[i]*B+S[i];
	p[i+1]=p[i]*B;
      }
    }
  //S[l,r)
    ull find(int l,int r){
      return hash[r]-hash[l]*p[r-l];
    }
  };
  vector<string> S;
  vector<RollingHash> rh;
  vector<vector<ull> > hash;
  vector<ull> p;
  int h,w,r,c;
  ull B;
  RollingHash2D(){}
  RollingHash2D(vector<string> S,int r,int c,ull B=1000000009LL):S(S),r(r),c(c),B(B){init();};
  void init(){
    h=S.size();
    w=S[0].size();
    hash.resize(h+1,vector<ull>(w-c+1,0));
    rh.resize(h);
    for(int i=0;i<h;i++) rh[i]=RollingHash(S[i]);
    p.resize(h+1);
    p[0]=1;
    for(int i=0;i<h;i++) p[i+1]=p[i]*B;
    for(int j=0;j<w-c+1;j++){
      hash[0][j]=0;		    
      for(int i=0;i<h;i++)
	hash[i+1][j]=hash[i][j]*B+rh[i].find(j,j+c);
    }
  }
  //S[l,r)
  ull find(int i,int j){
    return hash[i+r][j]-hash[i][j]*p[r];
  }
};
signed main(){
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(int i=0;i<h;i++) cin>>s[i];
  int r,c;
  cin>>r>>c;
  vector<string> t(r);
  for(int i=0;i<r;i++) cin>>t[i];
  RollingHash2D srh(s,r,c);
  RollingHash2D trh(t,r,c);
  for(int i=0;i<h-r+1;i++){
    for(int j=0;j<w-c+1;j++){
      if(srh.find(i,j)==trh.find(0,0)) cout<<i<<" "<<j<<endl;
    }
  }
  return 0;
}

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

using namespace std;

int main() {
	int WH[30][2];
	int W, H;
	int N = 0;
	while (cin >> W >> H) {
		if (W == 0 && H == 0) break;
		WH[N][0] = W;
		WH[N][1] = H;
		N++;
	}
	for (int i = 0; i < N; i++) {
		for (int h = 0; h < WH[i][0]; h++) {
			for (int w = 0; w < WH[i][1]; w++) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int32_t main(){
  size_t h; cin>>h;
  vector<int32_t> a(h+1);
  for(size_t i=1; i<=h; ++i) cin>>a[i];
  for(size_t i=1; i<=h; ++i){
    cout<<"node "<<i<<": key = "<<a[i]<<", ";
    if(i>1) cout<<"parent key = "<<a[i/2]<<", ";
    if(i*2<=h) cout<<"left key = "<<a[i*2]<<", ";
    if(i*2+1<=h) cout<<"right key = "<<a[i*2+1]<<", ";
    cout<<'\n';
  }
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  string s;
  cin >> s;
  int n=s.size();

  rep(i,n){
    if(s[i]=='?') s[i]='D';
  }

  cout << s << endl;       
}


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

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

int main(){
  ll n; cin >> n;
  string s;
  cin >> s;
  ll ans = 0;
  rep(i,n-2){
    if(s.substr(i,3)=="ABC"){
      ans ++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0, M = 0;
  cin >> N >> M;
  string S;
  cin >> S;
  rep(i,N){
    if(S[i] == '-'){
      cout << "No";
      return 0;
    }
  }
  if(S[N] != '-'){
    cout << "No";
      return 0;
  }
  rep(i,M){
    if(S[i + N + 1] == '-'){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}

Measured memory_bytes: 3584
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;
using ull = unsigned long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}


/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	vector<pair<int, int>> p(n);
	rep(i, n) {
		int a, b;
		scanf("%d%d", &a, &b);
		p[i] = { a + b, a - b };
	}
	auto comp = [](pair<int, int> a, pair<int, int> b) {
		return a.second > b.second;
	};
	sort(all(p));
	int ans = abs(p[0].first - p[n - 1].first);
	sort(all(p), comp);
	chmax(ans, abs(p[0].second - p[n - 1].second));
	printf("%d\n", ans);

	Please AC;
}


Measured memory_bytes: 4828
nums = [int(e) for e in input().split()]
Min=nums[0]
y=nums[1]
ans = Min % y
t = True
if (ans <= Min):
    Min = ans
    while t:
        a = abs(Min - y)
        if(a<Min):
            Min = a
        elif(a>Min):
            break
    print(Min)
else:
    print(ans)

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

const int mod=1e9+7;
const int maxn=2e5+100;

int num[110],n,k;
ll dp[110][110][2];
ll f(int p,int tot,bool _0){
    //cout<<"p  :  "<<p<<"  tot  "<<tot<<"  _0 "<<_0<<endl;
    if(p==n) return tot==k;
    //if(tot>k) return 0;
    if (~dp[n-p][tot][_0]) return dp[n-p][tot][_0];
    ll res=0;int lim=!_0?num[p]:9;
    for(int i=0;i<=lim;i++)
        res+=f(p+1,tot+(i==0?0:1),_0||i!=lim);
    //if(p==1&&!tot&&_0)
    //cout<<res<<endl;
    return dp[n-p][tot][_0]=res;
}

int main()
{
    string s;
    cin>>s;
    scanf("%d",&k);
    n=s.size();
    for(int i=0;i<n;i++)
        num[i]=s[i]-'0';
    memset(dp,-1,sizeof(dp));
    ll ans=f(0,0,0);
    cout<<ans;
    return 0;
}
/*

*/


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	  public static void main(String[] args ) throws Exception {
		Scanner sc = new Scanner(System.in);
	
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		int ans = A+B;
		
		if(ans%2 == 0) {
			System.out.println(ans/2);
		}else {
			System.out.println("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

struct P {
  int x, y;
  bool operator < (const P &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
};

int N;
P r[110], b[110];
int used[110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> r[i].x >> r[i].y;
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i].x >> b[i].y;
  }
  sort(r, r + N);
  sort(b, b + N);
  for (int i = 0; i < N; i++) {
    int idx = -1;
    for (int j = 0; j < N && r[j].x < b[i].x; j++) {
      if (used[j]) continue;
      if (!(r[j].y < b[i].y)) continue;
      if (idx < 0 || r[j].y > r[idx].y) {
        idx = j;
      }
    }
    used[idx]++;
  }
  cout << accumulate(used, used + N, 0) << endl;

  return 0;
}

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

using namespace std;

int main(void) {

	int A1, A2, A3;

	int ans = 333;

	cin >> A1 >> A2 >> A3;

	ans = min(ans, abs(A1 - A2) + abs(A3 - A1));
	ans = min(ans, abs(A1 - A2) + abs(A3 - A2));
	ans = min(ans, abs(A1 - A3) + abs(A2 - A3));

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, p1, p2, x;
            var word = Console.ReadLine().Split(' ');
            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);
 
            p1 = n*a;
            p2 = b;
 
            if (p1 < p2)
                x = p1;
            else x = p2;
            Console.WriteLine(x);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 11092
n,m= map(int, input().split())

AC = [0]*(n+1)
WA = [0]*(n+1)

for i in range(m):
  p_number, p_status = input().split()
  p_number =int(p_number)
  if (p_status =='WA') & (AC[p_number]==0):
    WA[p_number]+=1
  if (p_status =='AC') & (AC[p_number]==0):
    AC[p_number] +=1

for i in range(n+1):
  if AC[i] ==0:
    WA[i]=0

print(sum(AC), sum(WA))
#print(AC,WA)

Measured memory_bytes: 4596
n, x = map(int, input().split())
alist = list(sorted(map(int, input().split())))

if sum(alist) == x:
  print(n)
else:
  suma = 0
  k = 0
  for a in alist:
    if suma <= x:
      suma += a
      k += 1
  print(k - 1)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<utility>
#include<string>
using namespace std;
int n;
typedef std::pair<std::string, int> P;
std::vector<P> play_list;
std::string nap_start;

int main(){
    std::cin >> n;
    std::string tmp_char;
    int  result=0, tmp_int;
    int itr;
    for(int i=0; i<n; i++){
        std::cin >> tmp_char;
        std::cin >> tmp_int;
        P p = P(tmp_char, tmp_int);
        play_list.push_back(p);
    }
    std::cin >> nap_start;
    itr = n;
    for(int i=0; i<n; i++){
        if(nap_start.compare(play_list[i].first) == 0){
            itr = i;
        }
    }
    if(itr<n-1){
        for(int i=itr+1; i<n; i++){
            result += play_list[i].second;
        }
    }
    std::cout << result << "\n";
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
    int n;
    unsigned long long int a, s = 1;
    long double d = 1.0L;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a);
        s *= a;
        d *= a;
    }
    if (d > 1000000000000000000) printf("-1\n");
    else printf("%lld\n", s);
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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 C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N, K; cin >> N >> K;

    i64 cnt = 0;

    REPS(b, N) {
        if (K == 0) {
            cnt += N;
            continue;
        }

        if (b - 1 < K) continue;
        i64 prop = b - K;
        i64 ndiv = (N + 1) / b;
        cnt += ndiv * prop;

        if ((N + 1) % b > 0) {
            if (N % b >= K) {
                cnt += N % b - K + 1;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

A, B, K = map(int,input().split())
a = set(make_divisors(A))
b = set(make_divisors(B))
c = sorted(list(a & b))
print(c[-1 * K])

Measured memory_bytes: 3188