akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  string S;
  cin >> N >> S;
  vvvl DP = VVVL(11, 11, 11, 0);
  REP(i, N) {
    auto DPC = DP;
    DP[S[i] - '0'][10][10] = 1;
    REP(i1, 10) {
      if (DPC[i1][10][10] == 1) {
        DP[S[i] - '0'][i1][10] = 1;
      }
    }
    REP(i1, 10) REP(i2, 10) {
      if (DPC[i1][i2][10] == 1) {
        DP[S[i] - '0'][i1][i2] = 1;
      }
    }
  }
  ll ans = 0;
  REP(i1, 10) REP(i2, 10) REP(i3, 10) {
    if (DP[i1][i2][i3])
      ans++;
    // cout << i1 << "," << i2 << "," << i3 << endl;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
l,r = map(int,input().split())
ml = l % 2019
mr = r % 2019
if mr <= ml:
    print(0)
else:
    if r-l >= 2019:
        print(0)
    else:
        ans = float('inf')
        for i in range(ml,mr+1):
            for j in range(i+1,mr+1):
                ans = min(ans,(i*j)%2019)
        print(ans)

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    ll ans = 0;
    for(ll b = k+1;b<=n;++b){
        ans += b-k;
        ll t;
        if((n-b+1)/b==(n-k)/b){
            t = ((n-b+1)/b)*(b-k);
        }else{
            ll x = ((n-b+1)/b+1)*b;
            t = ((n-b+1)/b) * (x-(n-b+1));
            t+= ((n-k)/b) * (n-k-x+1);
        }
        ans += t;
        //cout << ans << ":" << t << endl;
    }
    if(k==0){
        ans -= n;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

  static int factorial(int n) {
    if (n == 0) {
      return 1;
    }
    return n * factorial(n - 1);
  }

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

    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());

    if((n == 1 && m == 1)||(n == 0 && m == 0))  System.out.println(0);
    else if(n == 1 || n == 0) System.out.println(m * (m - 1) / 2);
    else if(m == 1 || m == 0) System.out.println(n * (n - 1) / 2);
    else 
      System.out.println(m*(m-1)/2 + n*(n-1)/2);
  }
}


Measured memory_bytes: 22480
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------



int main() {
    int h,w,k,ans=0;
    cin>>h>>w>>k;
    vvll bw(6,vll(6));
    vvll aw(6,vll(6));
    rep(i,6){
        rep(j,6)aw.at(i).at(j)=0;
    }
    rep(i,h){
        rep(j,w){
            char s;
            cin>>s;
            if(s=='#')aw.at(i).at(j)=1;
        }
    }
    
    rep(i,h){
        rep(j,w){
           bw.at(i).at(j)=aw.at(i).at(j);
        }
    }

    for (int tmp = 0; tmp < (1 << (h +w)); tmp++) {
       
        
    bitset<12> s(tmp);  // 最大20個なので20ビットのビット列として扱う
 
    // ビット列の1のビットに対応する整数を選んだとみなして総和を求める
    
    for (int i = 0; i < h+w; i++) {
        if(i<h){
          if (s.test(i)) {
            rep(j,6)bw.at(i).at(j)=0;
          }
        }else{
            if (s.test(i)) {
            rep(j,6)bw.at(j).at(i-h)=0;
          }
        }
    }
        int icchi=0;
   
    rep(i,6){
      rep(j,6){
          if(bw.at(i).at(j)==1)icchi++;
      }
  }
  
  if(icchi==k){
      ans++;
  }
  /*
  rep(i,h){
          rep(j,w)cout<<bw.at(i).at(j);
          cout<<endl;
      }cout<<endl;
      */
  
  rep(i,h){
        rep(j,w){
           bw.at(i).at(j)=aw.at(i).at(j);
        }
    }
    
  }
  

    
    cout<<ans<<endl;
}



Measured memory_bytes: 3628
from math import sqrt

N = int(input())

reds = sorted([list(map(int, input().split(' '))) for i in range(N)])
blues = sorted([list(map(int, input().split(' '))) for i in range(N)], key = lambda x: x[0])

result = 0

for i in range(N):
    max_dis = -1
    tmp_index = -1
    length = len(reds)
    for j in range(length):
        if blues[i][0] > reds[j][0] and blues[i][1] > reds[j][1]:
            dis = reds[j][1]
            if max_dis < dis:
                max_dis = dis
                tmp_index = j
    if tmp_index != -1:
        result += 1
        reds.pop(tmp_index)

print(result)

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

using namespace std;
#define ll long long
#define db long double
#define all(a) a.begin(),a.end()
#define pb push_back
#define f(i,l,u) for(ll i=l;i<u;i++)
#define lb lower_bound
#define ub upper_bound
#define pii pair<ll,ll> 

unsigned long long fac[200001]; 
void powe(ll p)
{

    fac[0] = 1; 
    for (int i = 1; i <= 200001; i++) 
        fac[i] = (fac[i - 1] * i) % p; 

}

unsigned long long power(unsigned long long x, 
                         ll y, ll p) 
{ 
    unsigned long long res = 1; // Initialize result 
  
    x = x % p; // Update x if it is more than or 
    // equal to p 
  
    while (y > 0) { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res * x) % p; 
  
        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
unsigned long long modInverse(unsigned long long n, ll p) 
{ 
    return power(n, p - 2, p); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
unsigned long long nCrModPFermat(unsigned long long n, 
                                 ll r, ll p) 
{ 
    // Base case 
    if (r == 0) 
        return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
  
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
} 
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
}


int main() {
 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll t=1;
//cin>>t;
while(t--)
{
ll te;
cin>>te;
if(te>=30)
cout<<"Yes";
else
cout<<"No";
    
    
    
}




return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1E9 + 7;
const int INF = 1 << 29;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> C(N);
  vector<vector<int>> A(N, vector<int>(M, 0));
  rep(i, N) {
    cin >> C[i];
    rep(j, M) cin >> A[i][j];
  };
  int min_cost = INF;
  int tmp_cost = 0;
  vector<int> skill(M);
  bool flag = true;
  bool isPossible = false;
  for (int bit = 0; bit < (1 << N); bit++) {
    rep(i, M) skill[i] = 0;
    tmp_cost = 0;
    flag = true;
    rep(i, N) {
      if (bit & (1 << i)) {
        rep(j, M) skill[j] += A[i][j];
        tmp_cost += C[i];
      }
    }
    rep(i, M) if (skill[i] < X) flag = false;
    if (flag) min_cost = min(min_cost, tmp_cost);
    isPossible = isPossible | flag;
  };
  if (isPossible) {
    cout << min_cost << endl;
  } else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 3580
object Main{
  def main(args: Array[String]){
      	val ct = io.StdIn.readLine.split(" ").map(_ .toInt)
    	val dots = io.StdIn.readLine.split(" ").map(_ .toInt).sorted.toList
       val diffs= dots.zip(dots.tail).map{ t => t._2 - t._1 }.sorted
    	val dist = dots(ct(1)-1) - dots(0)
        print((dist- diffs.takeRight(ct(0)-1).sum).toString)
   
  }
}

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

class Main{
  public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String[] t=br.readLine().split(" ");
      int n=Integer.parseInt(t[0]);
      int k=Integer.parseInt(t[1]);
      t=br.readLine().split(" ");
      int[] arr=new int[n];
      int minIndex=0;
      int minValue=Integer.MAX_VALUE;
      for(int i=0;i<t.length;i++){
        arr[i]=Integer.parseInt(t[i]);
        if(arr[i]<minValue){
          minIndex=i;
          minValue=arr[i];
        }
      }
    //  System.out.println(minIndex+" "+minValue);
      int operations=0;
      int i=minIndex;
      int temp=0;
      while(i>0){
        operations++;
        if((i-k+1)>=0){
        i=i-k+1;}
        else{
          temp=k-i-1;
          break;
        }
      }
      i=minIndex+temp;
      while(i<arr.length-1){
        operations++;
        i=i+k-1;
      }
      System.out.println(operations);
    }
  }


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

const int maxn = 2e6;

int n, a[1230];

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n + n; i++) cin >> a[i];
	sort(a + 1, a + n + n + 1);
	int res =0 ;
	for(int i = 1; i + 1 <= n + n; i+= 2)
		res += a[i];
	cout << res;
}

Measured memory_bytes: 256
def f(a, b):
    return max(len(str(a)), len(str(b)))


n = int(input())

ret = float('inf')
a = 0
while a * a <= n:
    a += 1
    if n % a != 0:
        continue
    b = n // a
    ret = min(ret, f(a, b))
print(ret)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ll beki3(ll x){
	if(x==0) return 1;
	return 3*beki3(x-1);
}

int main(){
	string S;
	cin >> S;
	ll N = S.size();
	
	vector<ll> X(N+1, 0), Y(N+1, 0), Z(N+1, 0), W(N+1, 0);
	X[0] = 1;
	REP(i, N){
		if(S[i]=='?'){
			X[i+1] = 3*X[i]%mod;
			Y[i+1] = (3*Y[i]%mod + X[i])%mod;
			Z[i+1] = (3*Z[i]%mod + Y[i])%mod;
			W[i+1] = (3*W[i]%mod + Z[i])%mod;
		}
		if(S[i]=='A'){
			X[i+1] = X[i];
			Y[i+1] = (X[i] + Y[i])%mod;
			Z[i+1] = Z[i];
			W[i+1] = W[i];
		}
		if(S[i]=='B'){
			X[i+1] = X[i];
			Y[i+1] = Y[i];
			Z[i+1] = (Y[i] + Z[i])%mod;
			W[i+1] = W[i];
		}
		if(S[i]=='C'){
			X[i+1] = X[i];
			Y[i+1] = Y[i];
			Z[i+1] = Z[i];
			W[i+1] = (Z[i] + W[i])%mod;
		}
	}
	cout << W[N] << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, t) for(int i = (s), mi = (t); i <= mi; i++)
#define dwn(i, s, t) for(int i = (s), mi = (t); i >= mi; i--)

int read() {
	int x = 0, f = 1; char c = getchar();
	while(!isdigit(c)){ if(c == '-') f = -1; c = getchar(); }
	while(isdigit(c)){ x = x * 10 + c - '0'; c = getchar(); }
	return x * f;
}

#define maxn 2010

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int n, A[maxn], G[maxn][maxn];

bool vis[maxn];
vector <int> dfs(int u) {
	vis[u] = 1;
	vector <vector <int> > As; As.clear();
	vector <int> Ait; Ait.clear();
	rep(v, 1, n) if(!vis[v] && G[v][u]) As.push_back(dfs(v)), Ait.push_back(0);
	vector <int> ans; ans.clear(); ans.push_back(u);
	while(1) {
		int mx = 0, mxid = -1;
		rep(i, 0, (int)Ait.size() - 1) if(Ait[i] < As[i].size()) {
			if(mx < As[i][Ait[i]]) mx = As[i][Ait[i]], mxid = i;
		}
		// printf("mx: %d %d\n", mx, mxid);
		if(mxid < 0) break;
		ans.push_back(mx); Ait[mxid]++;
	}
	return ans;
}

int main() {
	n = read();
	rep(i, 1, n) A[i] = read();
	
	sort(A + 1, A + n + 1);
	rep(i, 1, n) rep(j, i, n) if(gcd(A[i], A[j]) > 1) G[i][j] = G[j][i] = 1;
	vector <vector <int> > As; As.clear();
	vector <int> Ait; Ait.clear();
	rep(i, 1, n) if(!vis[i]) As.push_back(dfs(i)), Ait.push_back(0);
	vector <int> ans; ans.clear();
	while(1) {
		int mx = 0, mxid = -1;
		rep(i, 0, (int)Ait.size() - 1) if(Ait[i] < As[i].size()) {
			if(mx < As[i][Ait[i]]) mx = As[i][Ait[i]], mxid = i;
		}
		// printf("mx: %d %d\n", mx, mxid);
		if(mxid < 0) break;
		ans.push_back(mx); Ait[mxid]++;
	}
	
	assert(ans.size() == n);
	rep(i, 0, n - 1) printf("%d%c", A[ans[i]], i < mi ? ' ' : '\n');
	
	return 0;
}

Measured memory_bytes: 16512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	}
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	int n, x, y;
	cin >> n >> x >> y;

	vi d(n);
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			int dist = min({ abs(i - j), abs(i - x) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j) });
			d[dist]++;
		}
	}

	for (int i = 1; i < n; ++i) {
		cout << d[i] << endl;
	}
}

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


int main() {
  long double A, B, H, M;
  cin >> A >> B >> H >> M;
  long double angle;
  if (60 * H - 11 * M >= 0) {
    angle = 30 * H - 11 * M / 2;
  }
  else {
    angle = 11 * M / 2 - 30 * H;
  }
  if (angle >= 180) {
    angle = 360 - angle;
  }
  long double p = 3.14159265358979323846264338;
  angle = angle * p / 180;
  long double c = A * A + B * B - 2 * A * B * cos(angle);
  cout << fixed << setprecision(12) << sqrt(c) << endl;
}
 

Measured memory_bytes: 4064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int m;
  cin>>m;
  for(int i=0;i<m;i++){
    int money,year,n,max=0;
    cin>>money>>year>>n;
    for(int j=0;j<n;j++){
      int p,tesuu;double per; 
      cin>>p>>per>>tesuu;
      int now=money,tanri=0;
      for(int k=0;k<year;k++){
	if(p==1){
	  now+=(int)(now*per);
	  now-=tesuu;
	}else{
	  tanri+=(int)(now*per);
	  now-=tesuu;
	}

      }
      now+=tanri;
      if(now>max)
	max=now;
    }
    cout<<max<<endl;
  }
  return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;
#define MOD 1000000007

template <typename T>
ll beki(T x, ll n){
  T res = 1;
  while(n > 0){
    if(n & 1){
      res *= x%MOD;
      res %= MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

int main(){
  ll N;
  cin >> N;
  vll box1(0), box2(0);
  for(int i = 0; i < N; i++){
    ll A;
    cin >> A;
    box1.push_back(A);
  }

  sort(ALL(box1), greater<ll>());

  for(int i = N-1; i >= 0; i-=2){
    box2.push_back(i);
    if(i != 0) box2.push_back(i);
  }

  if(box1 == box2) cout << beki(2LL, N/2) << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 2548
#include<stdio.h>
int main(void){
	int score_a, score_b;
	int max_a = 0, max_b = 0;
	int i;
	for(i = 0;i < 4;i++){
		scanf("%d",&score_a);
		max_a += score_a;
	}
	for(i = 0;i < 4;i++){
		scanf("%d",&score_b);
		max_b += score_b;
	}
	if(max_a > max_b){
		printf("%d\n",max_a);
	}
	else if(max_b > max_a){
		printf("%d\n",max_b);
	}
	else{
		printf("%d\n",max_a);
	}
	return 0;
}

Measured memory_bytes: 592
from collections import deque
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
if n==1:
    print('First')
    exit()
dst = [{} for i in range(n+1)]
for i in range(n-1):
    u,v = inm()
    dst[u][v] = dst[v][u] = 1
s = 1
d1 = [-1]*(n+1)
d1[s] = 0
q = deque([s])
while len(q)>0:
    x = q.popleft()
    d = d1[x]
    for u in dst[x]:
        if d1[u]<0:
            d1[u] = d+1
            q.append(u)
mx = 0
for i in range(1,n+1):
    if d1[i]>mx:
        mx = d1[i]
        mxi = i

s = mxi
d1 = [-1]*(n+1)
d1[s] = 0
q = deque([s])
while len(q)>0:
    x = q.popleft()
    d = d1[x]
    for u in dst[x]:
        if d1[u]<0:
            d1[u] = d+1
            q.append(u)
if max(d1)%3==1:
    print('Second')
else:
    print('First')


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

int main(){
  char S[4];
  cin>>S;
  if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2])cout<<"Yes";
  else if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) cout<<"Yes";
  else if(S[0] == S[3] &&S[1] == S[2] && S[0] != S[1]) cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int t = scan.nextInt();
		int [] ar = new int[n + 1];
      	for (int i = 1 ; i <= n ; i++)
        	ar[i] = scan.nextInt();
      	Arrays.sort(ar);
      	long ans = 0;
      	for (int i = 1 ; i <= Math.max(0,n-t) ; i++)
        	ans += ar[i];
      	System.out.println(ans);
    }
}

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

int main() {
int N0, N;
cin >> N;
N0 = N;
int i = 0;
int x = 0;
while (N / 10 != 0) {
    x += N % 10;
    N /= 10;
}

if (N0 % (x + N) == 0) {
    cout << "Yes" << endl;
}
else {
    cout << "No" << endl;
}
}

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

const int INF = 10000000;

template <typename T>
struct Edge
{
    int to;
    T cap;
    int rev;
};

template <typename T>
struct Flow
{
    int n, c;
    vector<vector<Edge<T>>> g;
    vector<int> ch;
    
    Flow(int n) : n(n), c(1){
        g.resize(n);
        ch.resize(n);
    }
    
    void add_edge(int from, int to, T cap){
        g[from].push_back((Edge<T>){to, cap, (int)g[to].size()});
        g[to].push_back((Edge<T>){from, 0, (int)g[from].size() - 1});
    }
    
    T dfs(int u, T f, int t){
        if(u == t) return f;
        ch[u] = c;
        for(int i = 0; i < (int)g[u].size(); i++){
            Edge<T> &e = g[u][i];
            int v = e.to;
            if(e.cap > 0 && ch[v] != c){
                T fl = dfs(v, min(f, e.cap), t);
                if(fl > 0){
                    e.cap -= fl;
                    g[v][e.rev].cap += fl;
                    return fl;
                }
            }
        }
        return 0;
    }
    
    T max_flow(int s, int t){
        T res = 0;
        for(T f; (f = dfs(s, INF, t)) > 0; c++) res += f;
        return res;
    }
};

int main()
{
    int h, w;
    cin >> h >> w;
    string a[102];
    Flow<int> g(h + w + 2);
    for(int i = 0; i < h; i++){
        cin >> a[i];
        for(int j = 0; j < w; j++){
            if(a[i][j] == 'S'){
                g.add_edge(h + w, i, INF);
                g.add_edge(h + w, j + h, INF);
            }
            if(a[i][j] == 'T'){
                g.add_edge(i, h + w + 1, INF);
                g.add_edge(j + h, h + w + 1, INF);
            }
            if(a[i][j] == 'o'){
                g.add_edge(i, j + h, 1);
                g.add_edge(j + h, i, 1);
            }
        }
    }
    int ans = g.max_flow(h + w, h + w + 1);
    if(ans >= INF) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 896
#include <stdio.h>

void selectionSort(int *,int);

int main(){

  int N,i;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  selectionSort(A,N);

  return 0;

}

void selectionSort(int A[],int N){
  int i,j,tmp,n=0,minj;

  for(i=0;i<=N-1;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(A[j]<A[minj]) minj=j;
    }
    tmp=A[i];
    A[i]=A[minj];
    A[minj]=tmp;
    if(A[i]<A[minj]) n++;
  }


  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i<N-1) printf(" ");
  }
  printf("\n");
  printf("%d\n",n);

}

Measured memory_bytes: 604
#include<iostream>
using namespace std;
 
int main(){
int H,W;
while(1){
cin>>H>>W;
if(W==0&&H==0) break;
for(int i=0;i<W;i++) cout<<"#";
cout<<endl;
for(int i=1;i<H-1;i++){
cout<<"#";
for(int i=1;i<W-1;i++) cout<<".";
cout<<"#"<<endl;
}
for(int i=0;i<W;i++) cout<<"#";
cout<<endl<<endl;
}
}

Measured memory_bytes: 2972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
int n;
int a[N];
int mx[N];
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	ll ans = 0;
	for(int i = 1; i <= n; ++i) {
		mx[i] = max(mx[i - 1], a[i]);
		ans += ll(mx[i] - a[i]);
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
    int N,x;
    cin>>N>>x;
	if(x==1 ||x==2*N-1){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
		int ary[2*N-1];
		if(x>=N) {
				int diff=x-N;
				int counter=0;
				for(int i=1+diff; i<=2*N-1; i++) {
					ary[counter]=i;
					counter++;
				}
				for(int i=1; i<=diff; i++) {
					ary[counter]=i;
					counter++;
				}
			}
			else if(x<N) {
				int first=N+x;
				int counter=0;
				for(int i=first; i<=2*N-1; i++) {
					ary[counter]=i;
					counter++;
				}
				for(int i=1; i<first; i++){
					ary[counter]=i;
					counter++;
				}
			}
			for(int i=0; i<N*2-1; i++) {
				cout << ary[i]<<endl;
			}
	}
}

Measured memory_bytes: 2304
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>

#include <iomanip>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
// #define P pair<int, int>
// queue: first in first out
// stack: first in last out
typedef long long ll;

const long long int MOD = 1e9+7;
const ll INF = 1e17;
const ll NUM = 1e5+1;
// ll dp[100005][13];
ll dp[10005];

ll Query[NUM];

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

signed main(void) {
  ll a, b, c;
  cin >> a >> b >> c;
  ll tmp = c-a-b;
  string ans = "No";
  if (tmp >= 0) {
    if (4 * a * b < tmp * tmp) {
      ans = "Yes";
    }
  }

  cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int maxv = a[0];
    int maxi = 0;
    int minv = a[0];
    int mini = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(maxv < a[i]){
            maxv = a[i];
            maxi = i;
        }
        if(minv > a[i]){
            minv = a[i];
            mini = i;
        }
    }
    vector<pair<int, int>> p;
    if(abs(maxv) >= abs(minv)){
        for(int i = 0; i < n; i++){
            p.emplace_back(maxi, i);
        }
        for(int i = 0; i < n-1; i++){
            p.emplace_back(i, i+1);
        }
    } else {
        for(int i = 0; i < n; i++){
            p.emplace_back(mini, i);
        }
        for(int i = n-1; i > 0; i--){
            p.emplace_back(i, i-1);
        }
    }
    cout << p.size() << endl;
    for(auto x : p){
        cout << x.first+1 << " " << x.second+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3572
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐

    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌ */
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <cstring>
#include <ctime>

#define pb push_back
#define re return
#define fi first
#define se second
#define ll long long

using namespace std;

map <int, int> mx, m[10010];
set <int> sx, s[10010];
int a[10010], b[1000000];
vector <int> v;



int main()
{
    ll a, sm=0, n;
    cin >> a >> n;
    for(int i=0; i<n; i++){
        int x;
        cin >> x;
        sm+=x;
    }
    if(a<=sm)
        cout << "Yes";
    else
        cout << "No";

}


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

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

using namespace std;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int A, B;

int main() {
    cin >> A >> B;

    string a, b;
    a = string(A, '0' + B);
    b = string(B, '0' + A);

    if (a > b) {
        cout << b << endl;
    } else {
        cout << a << endl;
    }
}



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

constexpr int MAX_N = (1<<20);
constexpr int MOD = 1e9+7;
ll n,k;

ll f[MAX_N], invf[MAX_N];

ll modpow(ll x, ll y)
{
	ll res = 1;
	while(y > 0){
		if(y&1) res = (res * x)%MOD;
		x = x*x%MOD;
		y>>=1;
	}
	return res;
}

void init()
{
	f[0]=1;
	for(int i=1;i<=n;++i) f[i]=f[i-1]*i%MOD;
	invf[n]=modpow(f[n],MOD-2);
	for(int i=n-1;i>=0;--i) invf[i]=invf[i+1]*(i+1)%MOD;
}

ll nCk(int N, int K)
{
	if(K > N || K < 0) return 0;
	return (f[N]*invf[N-K])%MOD*invf[K]%MOD;
}

void solve()
{
	init();
	ll res = 0;
	const int L = min(n-1, k);
	for(int i=0;i<=L;++i){
		// distributing i into N-i rooms
		res = (res + nCk(n,i)*nCk(n-i-1+i,i)) % MOD; 
	}
	cout << res;
}

int main()
{
	cin >> n >> k;
	solve();
	return 0;
}

Measured memory_bytes: 3840
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int n = sc.nextInt();
        int l = sc.nextInt();
        int a[] = new int[n];
        boolean zero = false;
        int ans = 0;
        for(int i = 0; i < n;i++){
			a[i] = i + l;
          if(a[i] == 0){
            zero = true;
          }
            ans += a[i];
        }
        if(zero){
        }else if(l > 0){
          ans -= a[0];
        }else{
          ans -= a[n - 1];
        }
      	System.out.println(ans);
 
    }
}

Measured memory_bytes: 35640
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string s;

int main(void){
	cin >> s;
	for(int i=0;i<s.size();i++){
		printf("x");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  if(x >= r && x <= W - r && y >= r && y <= H - r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 2676
#include <iostream>
#include <map>

using namespace std;

int main(void){
  string s;
  map<string,char> table1;
  map<char,string> table2;
  for(char c='A';c<='Z';++c){
    int a = c-'A';
    string key;
    for(int j=0;j<5;++j){
      key = ((a%2)?'1':'0') + key;
      a/=2;
    }
    table1[key]=c;
  }
  table1["11010"]=' ';
  table1["11011"]='.';
  table1["11100"]=',';
  table1["11101"]='-';
  table1["11110"]='\'';
  table1["11111"]='?';
  
  table2[' ']="101";
  table2['\'']="000000";
  table2[',']="000011";
  table2['-']="10010001";
  table2['.']="010001";
  table2['?']="000001";
  table2['A']="100101";
  table2['B']="10011010";
  table2['C']="0101";
  table2['D']="0001";
  table2['E']="110";
  table2['F']="01001";
  table2['G']="10011011";
  table2['H']="010000";
  table2['I']="0111";
  table2['J']="10011000";
  table2['K']="0110";
  table2['L']="00100";
  table2['M']="10011001";
  table2['N']="10011110";
  table2['O']="00101";
  table2['P']="111";
  table2['Q']="10011111";
  table2['R']="1000";
  table2['S']="00110";
  table2['T']="00111";
  table2['U']="10011100";
  table2['V']="10011101";
  table2['W']="000010";
  table2['X']="10010010";
  table2['Y']="10010011";
  table2['Z']="10010000";
  
  while(getline(cin,s),!cin.eof()){
    string encoded,result;
    for(int i=0;i<s.size();++i){
      encoded+=table2[s[i]];
    }
    string tmp;
   while(encoded.length()%5 != 0)encoded+="0";
    //cerr<<encoded<<endl;
    for(int i=0;i<encoded.size();++i){
      tmp += encoded[i];
      if(table1.find(tmp) != table1.end()){
        result+=table1[tmp];
        tmp="";
      }
    }
    cout<<result<<endl;
  }
  return 0;
}

Measured memory_bytes: 1208
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  s = input()
  if s == 'AC': ac+=1
  elif s == 'WA': wa+=1
  elif s == 'TLE': tle+=1
  else: re+=1
print("AC"+" "+"x"+" "+str(ac))
print("WA"+" "+"x"+" "+str(wa))
print("TLE"+" "+"x"+" "+str(tle))
print("RE"+" "+"x"+" "+str(re))

Measured memory_bytes: 9152
#include <stdio.h>

int is_palindrome(char s[], int l)
{
	int i;
	for (i = 0; i < l / 2; i++) if (s[i] != s[l-1-i]) break;
	if (i < l / 2) return 0;
	else return 1;
}

int main()
{
	char S[100];
	scanf("%s", S);

	int i, l;
	for (l = 0; S[l] != 0; l++);
	if (is_palindrome(S, l) + is_palindrome(S, (l - 1) / 2) + is_palindrome(&(S[(l+1)/2]), (l - 1) / 2) == 3) printf("Yes\n");
	else printf("No\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1664
/*****************************************************/
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

#define   offcin        ios::sync_with_stdio(false)
#define   DEBUG         freopen("#.txt", "r", stdin)
#define   sigma_size    26
#define   lson          l,m,v<<1
#define   rson          m+1,r,v<<1|1
#define   slch          v<<1
#define   srch          v<<1|1
#define   ll            long long
#define   ull           unsigned long long
#define   lowbit(x)     (x&-x)

const int    INF    = 2e9;
const ll     INFF   = 1e18;
const double pi     = acos(-1.0);
const double inf    = 1e18;
const double eps    = 1e-9;
const ll     mod    = 1e9+7;
const int    maxmat = 10;
const ull    BASE   = 133333331;

/*****************************************************/
inline void RI(int &x) {
      char c;
      while((c=getchar())<'0' || c>'9');
      x=c-'0';
      while((c=getchar())>='0' && c<='9') x=(x<<3)+(x<<1)+c-'0';
}
inline ll bits(ll x) {
      return !x ? x : bits(x - lowbit(x)) + 1;
}
/*****************************************************/

const int maxn = 1e5 + 5;

int t[maxn];
int N, C, K;

bool check(int m) {
    int p = 1;
    for (int i = 1; i <= m; i ++) {
        // cout<<t[p]<<" "<<t[p] + K<<endl;
        int num = upper_bound(t + p, t + N + 2, t[p] + K) - t - p;
        num = min(num, C);
        if (p + num - 1 >= N) return true;
        p = p + num;
        // cout<<num<<" "<<p<<endl;
    }
    return false;
}

int main(int argc, char const *argv[]) {
    cin>>N>>C>>K;
    for (int i = 1; i <= N; i ++)
        scanf("%d", t + i);

    sort(t + 1, t + N + 1);
    t[N + 1] = INF;

    int lb = 1, ub = N, res = -1;
    while (lb <= ub) {
        int mid = (lb + ub) >> 1;
        if (check(mid)) {
            res = mid;
            ub = mid - 1;
        }
        else
            lb = mid + 1;
    }

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

int main(){
    int n;
    std::string S;
    std::cin >> n >> S;
    std::vector<int> a(n, 0);
    std::vector<int> sum(n, 0);
    if(S[0] == 'W'){
        a[0] = 1;
        sum[0] = 1;
    }
    for(int i = 1; i < n; i++){
        if(S[i] == 'W') a[i] = 1;
        sum[i] += sum[i - 1] + a[i];
    }


    int minNum = n;
    minNum = std::min(minNum, (n - 1) - (sum[n - 1] - sum[0])); // 左端をリーダとする
    minNum = std::min(minNum, sum[n - 2]); // 右端をリーダとする
    for(int i = 1; i < n - 1; i++){
        int turnLeft = (n - 1 - i) - (sum[n - 1] - sum[i]);
        int turnRight = sum[i - 1];
        minNum = std::min(minNum, turnLeft + turnRight);
    }

    std::cout << minNum << std::endl;
    return 0;
}


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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
 int dp[2][2020];

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

    string S;
    cin >> S;
    int ans=0;
    rep(i, S.size())
    {
        FILL0(dp[(i+1)%2]);

        dp[(i+1)%2][S[i]-'0']++;

        rep(j, 2019)
        {
            dp[(i+1)%2][(j*10+S[i]-'0')%2019]+=dp[i%2][j];
        }
        ans+=dp[(i+1)%2][0];
    }

    cout << ans << endl;

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



Measured memory_bytes: 3796
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e9+7;
const ll MAXN=1000200;
ll i,j,mask,test;
vector<ll> fact(MAXN),inv(MAXN);
ll power(ll n,ll x)
{
    ll res=1,p=n;
    while(x>0)
    {
        if(x%2==1)
        {
            res=((res%mod)*(p%mod))%mod;
        }
        x/=2;
        p=((p%mod)*(p%mod))%mod;
    }
    return res;
}
void initializer()
{
    fact[0]=1;
    F(i,1,1000001)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
    RF(i,1000000,1)
    {
        inv[i]=power(fact[i],mod-2);
    }
}
ll C(ll n,ll r)
{
    ll k=(fact[n]*inv[r])%mod;
    k=(k*inv[n-r])%mod;
    return k;
}
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
ll n;
cin>>n;
vector<pair<ll,pair<ll,ll> > > v(n),a(n);
F(i,0,n)
{
    ll x,y;
    cin>>x>>y;
    v[i]={x+y,{x,y}};
    a[i]={x-y,{x,y}};
}
sort(v.begin(),v.end());
sort(a.begin(),a.end());
cout<<max(abs(v[0].second.first-v[n-1].second.first)+abs(v[0].second.second-v[n-1].second.second),abs(a[0].second.first-a[n-1].second.first)+abs(a[0].second.second-a[n-1].second.second));
return 0;
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n; cin >> n;
    vector<int> div(101, 0);
    REP(i, 2, n+1){
        int k = i, l = 2;
        while(l*l <= k){
            if(k % l == 0){
                k /= l;
                div[l]++;
            }else{
                l++;
            }
        }
        div[k]++;
    }
    int c1 = 0, c2 = 0, c4 = 0, c14 = 0, c24 = 0, c74 = 0;
    REP(i, 2, n+1){
        if(div[i] >= 2){c2++;}
        if(div[i] >= 4){c4++;}
        if(div[i] >= 14){c14++;}
        if(div[i] >= 24){c24++;}
        if(div[i] >= 74){c74++;}
    }
    cout << ((c4*(c4-1))/2) * (c2-2) + c14*(c4-1) + c24*(c2-1) + c74  << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
        int k,n;
        cin>>k>>n;
        int a[n], x;
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
      int ans = k;
      for(int i=1;i<n-1;i++) ans = min(ans,k-(a[i+1]-a[i]));
      ans = min(ans,k-(a[0]+k-a[n-1]));
      cout << ans;
}

Measured memory_bytes: 4360
#include<stdio.h>
#include<string.h>
long long gcd(int,int);

int main(){
  long int a,b ; scanf("%ld%ld",&a,&b);
  long long g= gcd(a,b);
  printf("%lld\n",a*b/g);
  return 0;
}

long long gcd(int x,int y){
  int p;
  p=x%y;
  if(p==1) return 1;
  else if(p==0) return y;
  else  return gcd(y,p);
}

Measured memory_bytes: 128
n = int(input())
A = list(map(int,input().split()))
m = int(input())
B = list(input().split())
for i in range(m):
    B[i] = int(B[i])

def solve(x,y):
    if x==n:
        S[y] = 1
    else:
        solve(x+1,y)
        if y+A[x] < 2001:
            solve(x+1,y+A[x])
            
S = [0 for i in range(2001)]

solve(0,0)
    
for i in range(m):
    if S[B[i]] == 1:
        print("yes")
    else:
        print("no")



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

graph1 = [[] for _ in range(n*3)]

for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph1[u*3+0].append(v*3+1)
    graph1[u*3+1].append(v*3+2)
    graph1[u*3+2].append(v*3+0)

s, t = map(int, input().split())
s -= 1
t -= 1
s = s*3
t = t*3

from heapq import heappush, heappop
def dijkstra(graph:list, node:int, start:int) -> list:
    # graph[node] = [(cost, to)]
    inf = float('inf')
    dist = [inf]*node

    dist[start] = 0
    heap = [(0,start)]
    NextCost = 1
    while heap:
        cost,thisNode = heappop(heap)
        for NextNode in graph[thisNode]:
            dist_cand = dist[thisNode]+NextCost
            if dist_cand < dist[NextNode]:
                dist[NextNode] = dist_cand
                heappush(heap,(dist[NextNode],NextNode))
    return dist
    # dist = [costs to nodes]

inf = float('inf')
dist = dijkstra(graph1, n*3, s)
if dist[t] == inf:
    print(-1)
else:
    print(dist[t]//3)


Measured memory_bytes: 102896
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

template<class T>bool chmax(T &a, const T &b){
	if(a<b){
		a=b;
		return true;
	}
	return false;
}

template<class T>bool chmin(T &a, const T &b){
	if(a>b){
		a=b;
		return true;
	}
	return false;
}

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int a,b;cin>>a>>b;
	if(a<10 and b<10){
		cout<<a*b<<endl;
	}else{
		cout<<-1<<endl;
	}
	return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n; scanf("%d",&n);
    int maxx=-inf,minn=inf;
    rep(i,0,n){
        int p; scanf("%d",&p);
        chmax(maxx,p); chmin(minn,p);
    }
    printf("%d\n",(maxx-minn+1)/2);
    return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){
    int d,n;
    cin>>d>>n;
    if(n==100) printf("%.lf",pow(100,d)*101);
    else printf("%.lf",pow(100,d)*n);
    cout<<endl;
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
 
using namespace std;
 
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++) 
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair 
 
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
 
int main(void)
{
  map<string, int> m;
  string x = "", s, y = "";

  while (cin >> s){
    m[s] += 1;
    if (m[x] < m[s]) x = s;
    if (y.size() < s.size()) y = s;
  }

  cout << x << " "  << y << endl;
  
  return 0;
}

Measured memory_bytes: 3156
S = str(input())
T = str(input())
slen = len(S)
tlen = len(T)
ccount = 0
mincount = tlen
for i in range(slen - tlen + 1):
  s = S[i:i + tlen]
  ccount = 0
  for j in range(tlen):
    if T[j] != s[j]:
      ccount += 1
  if ccount <= mincount:
    mincount = ccount
print(mincount)


Measured memory_bytes: 9020
ansary = []
while True:
    n, x = map(int, input().split())
    if n+x == 0:
        break
    ans = 0
    for i in range(n):
        for j in range(n-i):
            for k in range(n-i-j):
                if i+j+k+3 < n+1 and (i+1)+(i+j+2)+(i+j+k+3) == x:
                    ans += 1
    ansary.append(ans)

for i in ansary:
    print(i)


Measured memory_bytes: 5600