akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String str=sc.nextLine();
		char[] s=str.toCharArray();
		for(int i=0;i<str.length();i++){
			if('A'<=s[i]&&s[i]<='Z'){
				s[i]+=32;
			}
			else if('a'<=s[i]&&s[i]<='z'){
				s[i]-=32;
			}
		}
		System.out.println(s);
	}
}	


Measured memory_bytes: 26280
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    int ans = (1000 - (n % 1000)) % 1000;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    string s; cin >> s;
    cout << s.substr(0,3) << endl;
    return 0;
}


Measured memory_bytes: 3616
/***********************************************************************************
*           Falling down is an accident, Staying down is a choice.                 *
***********************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define ios std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) //Fast IO
#define _USE_MATH_DEFINES
#define PI acos(-1.0) //3.14159265358
#define EPS 1e-9 //epsilon, 10^-9, checking for equality 
#define pb push_back
#define fi first
#define se second
#define isort(x) sort(x.begin(),x.end())
#define dsort(x) sort(x.rbegin(),x.rend())
const int inf=1e9+7; //10^9 +7
const int modc=998244353;
void solve();int main(){ios;solve();return 0;}
/***********************************************************************************/
typedef unsigned long long int ll;
void solve()
{
	ll l,r;cin>>l>>r;
	if(r-l+1>=2019)
	{
		cout<<0<<endl;
	}
	else
	{
		vector<ll> vals;
		for(int i=l;i<=r;i++)
		{
			for(int j=i+1;j<=r;j++)
			{
				ll tval=( (i%2019)*(j%2019))%2019;
				vals.pb(tval);
			}
		}
		isort(vals);
		cout<<(vals[0])<<endl;
	}
}

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

int main() {
	int n;cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;++i) cin>>a[i];
	a.push_back(1e9+1);
	
	int q;cin>>q;
	while(q--){
		int k;cin>>k;
		cout<<(lower_bound(a.begin(),a.end(),k) - a.begin())<<" "<<(upper_bound(a.begin(),a.end(),k) - a.begin())<<endl;
	}
  return 0;
}



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

int main(){
  long long W,H;
  int X,Y;
  cin >> W >> H >> X >> Y;
  long long S = W*H;
  double a=0;
  if(S%2==1){
    a=0.5;
  }
  cout << S/2+a << " ";
  if(X*2==W && Y*2==H){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a < b && b < c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

int N, W;
vector<int> weight;
vector<int> value;

int dp[100][100][300];

int pack(int now, int packed, int weight_now){
    if(now == N){
        return 0;
    }else if(dp[now][packed][weight_now - packed * weight[0]] != -1){
        return dp[now][packed][weight_now - packed * weight[0]];
    }else if(weight_now + weight[now] > W){
        return dp[now][packed][weight_now - packed * weight[0]] = pack(now + 1, packed, weight_now);
    }else{
        return dp[now][packed][weight_now - packed * weight[0]] = max(pack(now + 1, packed, weight_now), value[now] + pack(now + 1, packed + 1, weight_now + weight[now]));
    }
}

int main(){
    cin >> N >> W;
    weight.resize(N);
    value.resize(N);
    for(int i = 0; i < N; i++){
        cin >> weight[i] >> value[i];
    }
    for(int i = 0; i < 100; i++){
        for(int j = 0; j < 100; j++){
            for(int k = 0; k < 300; k++){
                dp[i][j][k] = -1;
            }
        }
    }
    cout << pack(0, 0, 0) << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    ii p[n];
    FOR(i,0,n-1){
        cin>>p[i].fi>>p[i].sc;
    }

    sort(p, p+n);
    vector<ii> pq;
    FOR(i,0,n-1) FOR(j,0,n-1) if (i != j) {
        pq.push_back(ii(p[i].fi-p[j].fi, p[i].sc-p[j].sc));
    }

    sort(ALL(pq));
    pq.resize(unique(ALL(pq)) - pq.begin());

    int ans = n;
    for (auto x : pq) {
        int cur = 0;
        set<ii> s;
        FOR(i,0,n-1){
            if (s.find(ii(p[i].fi-x.fi, p[i].sc-x.sc)) == s.end()) {
                ++cur;
            }
            s.insert(ii(p[i].fi, p[i].sc));
        }
        ans = min(ans, cur);
    }
    cout << ans << '\n';
}



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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 x;
  cin >> x;
  ANS(1-x);
  return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

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

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    long double L;
    cin >> L;
    L /= 3.0;
    printf("%.10Lf\n", L * L * L);
    return 0;
}

Measured memory_bytes: 256
h,w = gets.split(" ").map!{|a| a.to_i}
mat = []
h.times do |d|
  s = gets.split("").map!{|b| b.to_s}
  mat[d] = s
end
h.times do |i|
  w.times do |j|
    if mat[i][j] == "."
      sum = 0
     (i-1).upto(i+1) do |f|
       (j-1).upto(j+1) do |g|
         if f >= 0 and f < h and g >= 0 and g < w and mat[f][g] == "#"
             sum += 1
         end
       end
     end
     mat[i][j] = "#{sum}"
    end
  end
end
h.times do |c|
  puts mat[c].join
end


Measured memory_bytes: 2172
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
count = 0
sum = 0
for i in range(N):
    sum += A[i]
    if sum < x and i < N-1:
        count += 1
    elif sum == x:
        count += 1
    else:
        break

print(count)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        List<Point> list = koch(Arrays.asList(new Point(0, 0), new Point(100, 0)), n);
        
        for (Point p : list) System.out.println(p);
    }
    
    private List<Point> koch(List<Point> list, int n) {
        if (n == 0) return list;
        List<Point> newList = new ArrayList<Point>();
        newList.add(list.get(0));
        for (int i = 0; i < list.size() - 1; i++) {
            Point p1 = list.get(i), p2 = list.get(i+1);
            double x = (p2.getX() - p1.getX()) / 3;
            double y = (p2.getY() - p1.getY()) / 3;
            Point s = new Point(p1.getX() + x, p1.getY() + y);
            Point t = new Point(s.getX() + x, s.getY() + y);
            double ux = s.getX() + x * Math.cos(Math.PI/3) - y * Math.sin(Math.PI/3);
            double uy = s.getY() + x * Math.sin(Math.PI/3) + y * Math.cos(Math.PI/3);
            Point u = new Point(ux, uy);
            newList.add(s);
            newList.add(u);
            newList.add(t);
            newList.add(p2);
        }
        return koch(newList, n - 1);
    }
    
    private static class Point {
        private double x, y;
        Point (double x, double y) {
            this.x = x;
            this.y = y;
        }
        public double getX() { return x; }
        public double getY() { return y; }
        @Override public String toString() {
            return new StringBuilder().append(x).append(' ').append(y).toString();
        }
    }
    
    private void print(Object[] xs) {
        StringBuilder sb = new StringBuilder();
        for (Object x : xs) sb.append(x.toString()).append(' ');
        System.out.println(sb.toString().trim());
    }
    
    private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    }
    
    private static class Scanner {
        BufferedReader r;
        StreamTokenizer st;
        
        public Scanner(InputStream in) {
            r = new BufferedReader(new InputStreamReader(in));
            st = new StreamTokenizer(r);
        }
        
        public String next() {
            nextToken();
            return st.sval;
        }
        
        public Integer nextInt() {
            nextToken();
            return (int)st.nval;
        }
        
        private int nextToken() {
            int token = st.TT_EOF;
            try {
                token = st.nextToken();
            } catch (IOException e) {
            }
            return token;
        }
    }
}

Measured memory_bytes: 29188
N, K = map(int, input().split())
vals = list(map(int, input().split()))
costs = [0] * 100010
for i in range(len(vals)):
    costs[i] = vals[i]

dp = [float('inf')] * 100010
dp[0] = 0
for i in range(1, N):
    for j in range(1, K+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(costs[i] - costs[i-j]))

# print(dp)
print(dp[N-1])

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

using namespace std;

int fun (int x, int y, int a, int b) {
    return abs(x - a) + abs(y - b);
}

main() {
    int n; scanf("%d", &n);
    int x, y;
    x = y = 0;
    bool fl = 1;
    int prevt = 0;
    for (int i = 1; i <= n; i++) {
        int t, a, b; scanf("%d %d %d", &t, &a, &b);
        if (fun(a, b, x, y) <= t - prevt) {
            if (fun(a, b, x, y) % 2 != (t - prevt) % 2) {
                puts("No");
                return 0;
            }
        } else {
            puts("No");
            return 0;
        }
        x = a; y = b;
        prevt = t;
    }
    puts("Yes");
}


Measured memory_bytes: 256
#coding: utf-8
D = 1
N = int(input())
K = int(input())
array =[1]

for i in  range(N):
	X = array[i]*2
	Z = array[i]+K
	if X >= Z:
		array.append(Z)
	else:
		array.append(X)

print(array[N])

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> L(M), R(M);
  for(int i = 0; i < M; i++){
    cin >> L.at(i) >> R.at(i);
  }
  
  int l_max, r_min;
  sort(L.begin(), L.end());
  sort(R.begin(), R.end());
  l_max = L.at(M-1);
  r_min = R.at(0);
  
  if ((r_min - l_max) >= 0)
    cout << r_min + 1 - l_max << endl;
  else
    cout << "0" << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
#define MOD 1000000007
using namespace std;
using ll=int64_t;
using pii=pair<int,int>;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
//最大公約数
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
//最小公倍数
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
bool prime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)
        return false;
    }
    return true;
}
int main(){
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(e-a>k){
        cout<<":("<<endl;
        return 0;
    }
    else cout<<"Yay!"<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

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

    ll x = 100, y;
    cin >> y;

    ll ans = 0;

    while (x < y) {
        x += x / 100;
        ans++;
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int swap(int &a,int &b){
    int t;
    t=a;
    a=b;
    b=t;
    return 0;
}

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c;

}


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


class Program {

	static long mod = 1000000007;
	static int[] ans;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		string res = "No";


		int n = int.Parse(Console.ReadLine());
		int[] vals = parseAry(Console.ReadLine().Split(cs));
		Dictionary<int, int> dic = new Dictionary<int, int>();
		for ( int i = 0; i < n; i++ ) {
			if ( !dic.ContainsKey(vals[i]) ) { dic.Add(vals[i], 1); } else { dic[vals[i]]++; }
		}
		if ( dic.Count == 1 ) {
			foreach ( KeyValuePair<int, int> x in dic ) {
				if ( x.Key == 0 ) { res = "Yes"; }
			}
		}
		if ( dic.Count == 2 ) {
			int[] key = new int[2];
			int[] cnt = new int[2];
			int c = 0;
			foreach ( KeyValuePair<int, int> x in dic ) {
				key[c] = x.Key;
				cnt[c] = x.Value;
				c++;
			}
			if ( cnt[0] == cnt[1] * 2 ) {
				if ( key[1] == ( key[0] ^ key[0] ) && key[0] == ( key[0] ^ key[1] ) ) { res = "Yes"; }
			}
			if ( cnt[1] == cnt[0] * 2 ) {
				if ( key[0] == ( key[1] ^ key[1] ) && key[1] == ( key[0] ^ key[1] ) ) { res = "Yes"; }
			}
		}
		if ( dic.Count == 3 ) {
			int[] key = new int[3];
			int[] cnt=new int[3];
			int c = 0;
			foreach( KeyValuePair<int,int> x in dic){
				key[c] = x.Key;
				cnt[c] = x.Value;
				c++;
			}
			if ( cnt[0] == cnt[1] && cnt[1] == cnt[2] ) {
				if ( key[0] == ( key[1] ^ key[2] ) && key[1] == ( key[0] ^ key[2] ) && key[2] == ( key[0] ^ key[1] ) ) {
					res = "Yes";
				}
			}
		}


			Console.WriteLine(res);
			return;

	}



	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}


}

Measured memory_bytes: 22240
x, y = [int(i) for i in input().split()]

if x < y:
    a = x
    x = y
    y = a

def kouyakusu(x,y):
    yakusu = x % y
    if yakusu == 0:
        print(y)
        return y
    else:
        kouyakusu(y,yakusu)

max_kouyakusu = kouyakusu(x,y)

Measured memory_bytes: 7748
from sys import stdin
from itertools import product

def main():

    input = stdin.readline

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

    s = [] * H

    for _ in range(H):
        s.append(str(input())[:-1])

    ans = 0

    for h in list(product([0,1], repeat=H)):
        for w in list(product([0,1], repeat=W)):
            tmp_s = s.copy()
            count_num = 0

            for w_num in range(W):
                if w[w_num] == 1:
                    for w_s in range(H):
                        tmp_s[w_s] = tmp_s[w_s][:w_num] + "x" + tmp_s[w_s][w_num+1:]
        
            for h_num in range(H):
                if h[h_num] == 1:
                    tmp_s[h_num] = ""


            for i in tmp_s:
                count_num += i.count("#")

            if count_num == K:
                ans += 1


    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9248
N = int(input())
A = list(map(str, input().split()))
unsorted_A = A[:]
bub_A = A[:]
sel_A = A[:]

def BubbleSort(bub_A):
    for i in range(N):
        for j in range(1, N):
            if bub_A[j][1] < bub_A[j-1][1]:
                swp = bub_A[j]
                bub_A[j], bub_A[j-1] = bub_A[j-1], swp

    print(' '.join(bub_A))
    print('Stable')

def SelectionSort(sel_A):
    for i in range(N):
        min = i
        for j in range(i, N):
            if sel_A[j][1] < sel_A[min][1]:
                min = j
        if sel_A[i][1] > sel_A[min][1]:
            sel_A[i], sel_A[min] = sel_A[min], sel_A[i]

    print(' '.join(sel_A))
    if bub_A == sel_A:
        print('Stable')
    else:
        print('Not stable')

BubbleSort(bub_A)
SelectionSort(sel_A)


Measured memory_bytes: 5608
#include<stdio.h>
#include<stdlib.h>
#define N 2000001
#define G 10000

int main(){

  unsigned short *A,*B;
  int i,j,x,C[G+1];

  scanf("%d",&x);
  A = malloc(sizeof(short) * x+1);
  B = malloc(sizeof(short) * x+1);
  
  
  for(i=0;i<=G;i++){
    C[i]=0;
  }
  
  for(j=0;j<x;j++){
    scanf("%hu",&A[j+1]);
    C[A[j+1]]++;
  }
  
  for(i=1;i<=G;i++){
    C[i] = C[i] + C[i-1];
  }
  
  for(j =1;j<=x;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
  
  
  for(i=1;i<=x;i++){
    if(i>1)  printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 8464
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <time.h>

#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n;
    scanf("%d", &n);
    vector<int> x(n), y(n);
    vector<ll> v0, v1;
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d%d", &x[i], &y[i]);
        v0.push_back(x[i] + y[i]);
        v1.push_back(x[i] - y[i]);
    }
    sort(v0.begin(), v0.end());
    sort(v1.begin(), v1.end());

    ll ans0 = v0[n - 1] - v0[0];
    ll ans1 = v1[n - 1] - v1[0];
    printf("%lld\n", MAX(ans0, ans1));

    return;
}

int main()
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for (t = 0; t < T; t++) {
        //printf("Case #%d: ", t + 1);
        solve();
    }
#endif
    return 0;
}



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

using namespace std;

int a, b, c, k;
int ans = 0;
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    cin >> a >> b >> c >> k;

    if (k>=a)
    {
        ans += a;
        k-=a;
    }
    else
    {
        ans += k;
        cout << ans << endl;
        return 0;
    }
    if (k > 0)
        if (k>=b)
        {
            k-=b;
        }
        else
        {
            cout << ans << endl;
            return 0;
        }
    if (k > 0)
        if (k >= c)
        {
            ans -= c;
            cout << ans << endl;
            return 0;
        }
        else
        {
            ans -= k;
            cout << ans << endl;
            return 0;
        }
        
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <cassert>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

struct P{
    P(){}
    P(ll _r, ll _i):r(_r), i(_i){}
    void real(const ll& v){r = v;}
    void imag(const ll& v){i = v;}
    ll r, i;
};

ll real(const P& p){return p.r;}
ll imag(const P& p){return p.i;}
ll norm(const P& p){ll r = real(p), i = imag(p); return r * r + i * i;}

P operator+(const P& lhs, const P& rhs){
    return P(real(lhs)+real(rhs), imag(lhs)+imag(rhs));
}
P operator-(const P& lhs, const P& rhs){
    return P(real(lhs)-real(rhs), imag(lhs)-imag(rhs));
}
P operator-(const P& p){
    return P(-real(p), -imag(p));
}

ll cross(const P& lhs, const P& rhs){
    return real(lhs)*imag(rhs) - imag(lhs)*real(rhs);
}

ll dot(const P& lhs, const P& rhs){
    return real(lhs)*real(rhs) + imag(lhs)*imag(rhs);
}

ll distance(const P& a, const P& b, const P& p){
    ll c = cross(p-a, b-a);
    return c * c;
}

bool doesLineCrossCircle(const P& a, const P& b, const P& cc, const ll& radius){
    if(distance(a, b, cc) > radius * radius * norm(b-a)){return false;}
    if(norm(a-cc) > radius * radius && norm(b-cc) > radius * radius){
        return dot(cc-a, b-a) * dot(cc-b, b-a) <= 0;
    }
    return (norm(a-cc) < radius * radius) ^ (norm(b-cc) < radius * radius);
}

int N, M;
P wps[100100]; ll wrs[100100];

int main(){
    while(std::cin >> N, N){
        assert(N < 100100);
        REP(i, N){
            ll re, im;
            std::cin >> re >> im >> wrs[i];

            wps[i].real(re); wps[i].imag(im);
        }

        std::cin >> M;
    
        REP(i, M){
            P taro, oni;
            ll re, im;
            std::cin >> re >> im;
            taro.real(re); taro.imag(im);
            std::cin >> re >> im;
            oni.real(re); oni.imag(im);

            bool f = false;
            REP(j, N){
                // assert(norm(taro-wps[j]) != wrs[j] * wrs[j] &&
                //       norm(oni-wps[j]) != wrs[j] * wrs[j]);
                if(real(taro) == real(oni) &&
                   imag(taro) == imag(oni)){
                    continue;
                }
                if(doesLineCrossCircle(taro, oni, wps[j], wrs[j])){
                    f = true;
                }
            }

            if(f){
                puts("Safe");
            }else{
                puts("Danger");
            }
        }
    }
}

Measured memory_bytes: 1136
#include<stdio.h>
main(){
  int c[3]={1,0,0};
  int temp,ch1,ch2,i;
  char c1,c2;
  while(scanf(" %c , %c",&c1,&c2)!=EOF){
    if(c1=='A'){
      ch1=0;
    }
    else if(c1=='B'){
      ch1=1;
    }
    else{
      ch1=2;
    }
    if(c2=='A'){
      ch2=0;
    }
    else if(c2=='B'){
      ch2=1;
    }
    else{
      ch2=2;
    }
    temp=c[ch1];
    c[ch1]=c[ch2];
    c[ch2]=temp;
  }
  for(i=0;i<3;i++){
    if(c[i]==1){
      if(i==0){
	printf("A\n");
      }
      else if(i==1){
	printf("B\n");
      }
      else{
	printf("C\n");
      }
    }
  }
  return 0;
}

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

struct node{  
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

struct Tree{
  struct node *root;
};

typedef struct node Node;

void insert(Node**,int);
void preorder(Node*);
void inorder(Node*);

Node *NIL;

  
int main(){

  int n,i,num;
  char order[7];
  Node *root;

  //root=NIL;

  //root=(Node*)malloc(sizeof(Node));

  //NIL->right=NULL;
  //printf("wa-i30\n");
  //NIL->left=NULL;
  //NIL->parent=NULL;
  //NIL->key=-1;

  //printf("wa-i20\n");
  
  root=NIL;
 
  scanf("%d",&n);

  for(i=0;i<n;i++){

    scanf("%s %d",order,&num);
    
    //printf("%s\n",order);

    // root->key=3;

    if(strcmp(order,"insert")==0){
      
      //printf("wa-i\n");
      //printf("%d\n",root->key);
      insert(&root,num);
      //printf("Main : address of root;%p\n",root);
      // printf("%d\n",root->key);

    }
    
    else if(strcmp(order,"print")==0){
      //printf("%d\n",root->key);

      
      inorder(root);
      
      printf("\n");
	     
      preorder(root);

      printf("\n");

    }

  }

  return 0;
}

void insert(Node** root,int num){

  Node *x,*y,*z;

  y=NIL;
  x=*root;

  //printf("address of root;%p\n",root);

  z=(Node*)malloc(sizeof(Node));

  z->left=NIL;
  z->right=NIL;
  z->key=num;

  //printf("%d\n",z->key);  

  while(x!=NIL){
    y=x;
    if( z->key < x->key )x=x->left;
    else x=x->right;
    //printf("wa-i200\n");
  }
    
  z->parent=y;
  
  if(y==NIL){
    *root=z;
    //printf("wa-i100\n");
  }
  else if( z->key < y->key ) y->left=z;
  else y->right=z;

  //printf("%d\n",(*root)->key);
  //printf("%d\n",z->key);
  // printf("address of root;%p\n",root);
  
}

void preorder(Node *u){
  
  if(u==NIL) return;

  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
  
}

void inorder(Node *u){

  if(u==NIL) return;
  
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

}

Measured memory_bytes: 24040
#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0; i<n ; ++i)
#define all(v) v.begin() , v.end()
#define sz(v) (int(v.size()))
typedef unsigned long long ul;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<char, int> pci;
typedef vector<pii> vp;
typedef vector<pci> vpc;
typedef pair<int,pii> piii;

int OO = 2e9;
const double eps = 1e-9 ;
const int N = 500000;
int mx = -1e9 , mn = 1e9 ;
int arr[N] ;
pii pir[N];


int main()
{   int mn = 1e9 , mx = 0;
    lp(i,5){
        int x ;cin >> x;
        if(x > mx)mx = x;
        if(x < mn)mn = x;
    }
    int  k;cin >> k;
    cout << (mx-mn > k ? ":(\n" :"Yay!\n");


    return 0;
}


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

#define DeltaCube23 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define minimum(a) *min_element(a.begin(), a.end())
#define maximum(a) *max_element(a.begin(), a.end())
#define MOD 1000000007
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i >= (b); i--)

typedef long long int lli;

using namespace std;

const int mx=2e6+5;

int main()
{
    DeltaCube23
	int t=1;
	//cin>>t;
	while(t--)
	{
	    lli n,d,ans=0;
	    cin>>n>>d;
	    d=d*d;
	    forf(i,0,n)
	    {
	       lli x,y,res;
	       cin>>x>>y;
	       res=x*x+y*y;
	       if(res<=d)
	       ans++;
	    }
	    cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
  return 0;
}



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

constexpr ll MOD = 998244353;
int N, K;
vector<ll> kaijo;
vector<ll> kaijoInv;


template <typename T>
T power(T x, T n, T mod)
{
    T ans = 1;
    while (n>0)
    {
        if (n & 1) ans = ans * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ans;
}

ll C(int x, int y)
{
    if (y<0 || y>x) return 0;
    return (kaijo[x] * kaijoInv[y] % MOD) * kaijoInv[x-y] % MOD;
}

int main()
{
    cin >> N >> K;
    ll ans = 0;
    kaijo.resize(K+1, 1);
    kaijoInv.resize(K+1, 1);
    for (int i=1; i<=K; i++)
    {
        kaijo[i] = kaijo[i-1] * i % MOD;
        kaijoInv[i] = power(kaijo[i], MOD-2, MOD);
    }

    for (int R=max(N, (K+1)/2); R<=K; R++)
    {
        int B = K - R;
        if (R > B)
        {
            ans += C(K, R);
            if (R-N < B) ans -= C(K, B+N-R-1);
            ans = (ans + MOD) % MOD;
            // cout << R << " " << C(K, R) << " " << -C(K, B+N-R) << endl;
        }
        if (R == B)
        {
            // r = b = K/2のとき
            ans += C(K-1, R);
            ans -= C(K-1, N-2);
            ans = (ans + MOD) % MOD;
            // cout << R << " " << C(K-1, R) << " " << -C(K-1, N-1) << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8064
using System;
using System.Collections;
using System.Linq;

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            string head = input.Substring(0, (input.Length - 1) / 2);
          //Console.WriteLine("+LKJ+LKJ");
            string tale = input.Substring(((input.Length + 3) / 2) -1, (input.Length - 1)/2);

            if (kaibun(head) && kaibun(tale) && kaibun(input)) Console.WriteLine(("Yes"));
            else Console.WriteLine("No");
        }

        static bool kaibun(string input)
        {
            if((double)(input.Length /2) == ((double)input.Length / 2)){
                //偶数
                for(int i = 0;i < input.Length/2;i++)
                {
                  //Console.WriteLine(i);
                    if (input[i] == input[input.Length - 1 - i]) continue;
                    else return false;
                }
            }
            else
            {
                for (int i = 0; i < (input.Length - 1) / 2; i++)
                {
                  //Console.WriteLine(i);
                    if (input[i] == input[input.Length - 1 - i]) continue;
                    else return false;
                }
            }

            return true;
        }
    }
}


Measured memory_bytes: 13140
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//227
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max(a*10+b+c,max(b*10+a+c,c*10+a+b));
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int a[310][310];
int main(){
	int n,m;
	cin >> n >> m;
	vector<int> id(n);
	vector<bool> used(m+1);
	int res = n;
	rep(i,n){
		rep(j,m)cin >> a[i][j];
	}
	rep(i,m){
		vector<int> p(m+1);
		for(int j=0;j<n;j++){
			while(used[a[j][id[j]]]){
				id[j]++;
				if(id[j]>=m){
					goto yeah;
				}
			}
			p[a[j][id[j]]]++;
		}
		int nid = -1;
		int mx = 0;
		rep(j,m+1){
			if(mx<p[j]){
				mx = p[j];
				nid = j;
			}
		}
		res = min(res,mx);
		used[nid] = 1;
	}
yeah:
	cout << res << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(10e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

ll a[100010];

map<ll, ll> mp;

int main(void)
{
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> a[i];
        mp[a[i]]++;
        mp[a[i]+1]++;
        mp[a[i]-1]++;
    }
    ll m = 0;
    for(auto itr = mp.begin(); itr != mp.end(); itr++) {
        m = max(m, itr->second);
    }
    cout << m << endl;

}


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

int main(){
  int n,q;
  cin>>n>>q;
  ll s[n],t[n],x[n];
  rep(i,0,n) cin>>s[i]>>t[i]>>x[i];
  ll d[q];
  rep(i,0,q) cin>>d[i];
  
  set<P> st;
  rep(i,0,q){
    st.insert(P(d[i],i));
  }
  
  ll ans[q];
  rep(i,0,q) ans[i]=-1;
  
  vector<ll> a[n];
  rep(i,0,n) a[i]={x[i],s[i],t[i]};
  sort(a,a+n);
  
  rep(i,0,n){
    auto it=st.lower_bound(P(a[i][1]-a[i][0],-1));
    while(it!=st.end()){
      if(it->first>=a[i][2]-a[i][0]) break;
      ans[it->second]=a[i][0];
      st.erase(it++);
    }
  }
  rep(i,0,q) cout<<ans[i]<<endl;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 333;

int A[MAX][MAX];
int C[MAX];
int P[MAX];
bool U[MAX];

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n, m;
	scanf("%d%d", &n, &m);
	FOR (i, 0, n)
	{
		FOR (j, 0, m)
		{
			scanf("%d", &A[i][j]);
			A[i][j]--;
		}
	}

	int L = 0, R = n + 1;
	while(R - L > 1)
	{
		int M = (L + R) / 2;

		//M = 1;
		FILL(C, 0);
		FILL(U, 0);
		FOR (i, 0, n)
		{
			P[i] = 0;
			C[A[i][0]]++;
		}

		bool ok = false;

		while(true)
		{
			int ind = -1;
			FOR (i, 0, m)
			{
				if (C[i] > M)
				{
					ind = i;
					break;
				}
			}


			if (ind == -1)
			{
				ok = true;
				break;
			}

			U[ind] = true;

			bool okk = true;

			FOR (i, 0, n)
			{
				while(P[i] < m && U[A[i][P[i]]])
				{
					C[A[i][P[i]]]--;
					P[i]++;
					if (P[i] >= m)
					{
						okk = false;
						break;
					}
					C[A[i][P[i]]]++;
				}
				if (!okk || P[i] >= m)
				{
					okk = false;
					break;
				}
			}

			if (!okk)
			{
				ok = false;
				break;
			}
		}

		if (ok) R = M;
		else L = M;
	}

	cout<<R<<endl;
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextInt();
        }
        int count_even = 0;
        for (int i = 0; i < N; i++) {
            if (A[i] % 2 == 0) {
                count_even += 1;
            }
        }
        if (count_even == N) {
            System.out.println("second");
        } else {
            System.out.println("first");
        }
    }
}


Measured memory_bytes: 49976
import math
N = int(input())
Nlist = list(map(int, input().split()))
Nlist.sort(reverse=True)
x = math.ceil(N/2)
ans = sum(Nlist[0:x])*2-Nlist[0]
if N % 2 != 0:
    ans -= Nlist[x-1]
print(ans)


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

signed main()
{
  cout << fixed << setprecision(10);
  cin.tie(0);
  ios::sync_with_stdio(false);

  long double l;
  cin >> l;

  l /= 3.0;
  cout << l * l * l << '\n';

  return (0);
}


Measured memory_bytes: 3808
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;

unsigned nChoosek( unsigned n, unsigned k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}

int main()
{
    int n;
    ll sum = 0;
    cin >> n;
    string s;
    map <string, ll> m;
    ll res = 0;
    rep(i, n)
    {
        cin >> s;
        sort(s.begin(), s.end());
        res += m[s];
        m[s]++;
    }
    for (const auto& kv : m)
    {
        sum += nChoosek(kv.second, 2);
    }
//    cout << sum;
    cout << res;
    return 0;
}


Measured memory_bytes: 11136
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()

    val ans = (1..n)
            .asSequence()
            .map { it.toLong() }
            .filterNot { it % 15 == 0L }
            .filterNot { it % 5 == 0L }
            .filterNot { it % 3 == 0L }
            .sum()
    println(ans)
}

Measured memory_bytes: 55296
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int count = scan.nextInt();

		int[] before = {0, 0, 0};
		boolean judge = true;
		for (int i=0; i<count; i++) {
			boolean temp = check(scan, before);
			if (judge) {
				judge = temp;
			}
		}

		if (judge) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

	protected static boolean check(Scanner scan, int[] before) {
		int t = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();

		int dif = Math.abs(x - before[1]) + Math.abs(y - before[2]);
		int before_bak = before[0];
		before[0] = t;
		before[1] = x;
		before[2] = y;

		t = t - before_bak;
		while(t > 0) {
			if (dif == t) {
				return true;
			}
			t -= 2;
		}
		return false;
	}
}

Measured memory_bytes: 89716
import math

def main():
    INF = 10**9+7
    N,M = map(int,input().split())
    if abs(N-M) > 1:
        print(0)
    else:
        if N != M:
            print((math.factorial(N)%INF)*(math.factorial(M)%INF)%INF)
        else:
            print((2*(math.factorial(N)%INF)*(math.factorial(M))%INF)%INF)

if __name__ == "__main__":
    main()

Measured memory_bytes: 4108
#include <stdio.h>

int main(void)
{
    int S;
    int h = 0 , m = 0 , s;

    do {
        scanf("%d" , &S);
    } while ( S < 0 || S > 86400 );

   if ( (S / 3600) >= 1) {
        h = S / 3600;

        /*S = S - (h*3600) の意味*/
        S -= h * 3600;
    }
    if ( (S / 60) >= 1) {
        m = S / 60;
        S -= m * 60;
    }

    s = S;

    printf("%d:%d:%d\n" , h , m , s);

    return 0;

}


Measured memory_bytes: 2080
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <set>
#include <cmath>

using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>> v(h, vector<char>(w, '0'));
    int i,j;
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin>>v[i][j];
        }
    }
    
    
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
             char c='0';
            if(i-1>=0 && j-1>=0){
                if(v[i-1][j-1]=='#'){
                    c++;
                }   
            }
            if(i-1>=0){
                if(v[i-1][j]=='#'){
                    c++;
                }
            }
            if(i-1>=0&&j+1<w){
                if(v[i-1][j+1]=='#'){
                    c++;
                }
            }
            if(j-1>=0){
                if(v[i][j-1]=='#'){
                    c++;
                }
            }
            if(j+1<w){
                if(v[i][j+1]=='#'){
                    c++;
                }
            }
            if(i+1<h&&j-1>=0){
                if(v[i+1][j-1]=='#'){
                    c++;
                }
            }
            if(i+1<h){
                if(v[i+1][j]=='#'){
                    c++;
                }
            }
            if(i+1<h&&j+1<w){
                if(v[i+1][j+1]=='#'){
                    c++;
                }
            }
            if(v[i][j]!='#'){
                v[i][j]=c;
            }
        }
    }
    
     for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cout<<v[i][j];
        }
        cout<<endl;
     }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int count = 0, L, R, d;
    
    scanf("%d %d %d", &L, &R, &d);
    
    for(int i = L; i <= R; i++)
        if(i % d == 0) count ++;
        
        
    printf("%d\n",count);
}


Measured memory_bytes: 3820
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main(){
	int K, S;
	int cnt = 0;
	cin >> K >> S;
	for(int i = 0; i <= K; i++){
		for(int j = 0; j <= K; j++){
			if(0 <= S-i-j && S-i-j <= K){
				cnt++;
			}
		}
	}
	cout << cnt << "\n";
}


Measured memory_bytes: 256
H, W, K = map(int, input().split())
c = [input() for _ in range(H)]
from itertools import product

ans = 0
for h_mask in product([False, True], repeat=H):
    for w_mask in product([False, True], repeat=W):
        count = 0
        for h in range(H):
            for w in range(W):
                # 赤く塗られた=False
                if h_mask[h] and w_mask[w] and c[h][w] == "#":
                    count += 1
        if count == K:
            ans += 1
print(ans)


Measured memory_bytes: 68384
#![allow(non_snake_case)]
#![allow(unused_imports)]
use ascii::AsciiChar;
use ascii::AsciiStr;
use itertools::Itertools as _;
use permutohedron::LexicalPermutation as _;
use petgraph::algo::dijkstra;
use petgraph::algo::min_spanning_tree;
use petgraph::data::FromElements;
use petgraph::graph::NodeIndex;
use petgraph::graph::UnGraph;
use petgraph::unionfind::UnionFind;
use proconio::fastout;
use proconio::input;
use proconio::marker::Chars;
use proconio::marker::Usize1;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use superslice::Ext as _;

#[fastout]
fn main() {
    input! {
        N: usize,
        Names: [Chars; N],
    }

    let chars = vec!['M', 'A', 'R', 'C', 'H'];

    let mut counts = [0i64; 5];

    for (i, &c) in chars.iter().enumerate() {
        let cnt: i64 = Names.iter().filter(|name| name[0] == c).count() as i64;
        counts[i] = cnt;
    }

    let mut ans: i64 = 0;
    // ビット全探索、2^5
    for i in 0..1 << chars.len() {
        let mut cand: i64 = 1;
        let hits: Vec<usize> = (0..chars.len()).filter(|j| (1 << j) & i != 0).collect();

        if hits.len() == 3 {
            for &j in hits.iter() {
                // eprintln!("{}, {}", j, counts[j]);
                cand *= counts[j];
            }

            ans += cand;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 10544
def main():
    n = int(input())
    in1 = [int(a) for a in input().split()]
    m = int(input())
    in2 = [int(a) for a in input().split()]

    a = set(in1)
    b = set(in2)

    if a >= b:
        print("1")
    else:
        print("0")

main()



Measured memory_bytes: 45416
#include <cstdio>

//為替レート計算
int main()
{
    int N;
    int input_num;
    int max_value = -1000000000;
    int min_num = 2000000000;

    scanf("%d", &N);

    for (int i = 0; i < N; i++) {
        scanf("%d", &input_num);

        if (input_num - min_num > max_value) { max_value = input_num - min_num; }

        if (input_num < min_num) {
            min_num = input_num;
        }
    }

    printf("%d\n", max_value);
    return 0;
}


Measured memory_bytes: 2760
w=list(input())
alpha=[0 for i in range(26)]
ans="Yes"
for i in range(len(w)):
    alpha[ord(w[i])-97]+=1
#print(alpha)
for i in range(26):
    num=alpha[i]
    if num!=0 and num%2!=0:
        ans="No"
        break
print(ans)

Measured memory_bytes: 3060