akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<iomanip>
#include<cmath>
#include<numeric>
#include<vector>
#include<algorithm>
#include<string>
#include<deque>
#include<stack>
#include<map>
#include<random>
#include<queue>
#include<iterator>
#include<bitset>
#include<unordered_set>
#include<set>

using namespace std;
#define ll long long
#define endl "\n"
const int dx[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1 };
const int dy[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 };
const ll integer = pow(2, 32) - 1; // 4294967295
#define N 8010000
#define TC int t;cin>>t;for(int T=1;T<=t;T++)
#define mod 1000000007
#define PI acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
void AIA() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isprime(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0)return 0;
	}
	return (n != 1);
}
ll gcd(ll x, ll y)
{
	return (y == 0 ? x : gcd(y, x % y));
}
ll lcm(ll x, ll y) {
	return (x * y) / gcd(x, y);
}

/*
 _____________              __                ___        ___       ___________________________     ____        ____
|             |            /\ \              |   |      |   |     |                           |    \   \      /   /
|   __________|           / /\ \             |   |      |   |     |      _____      _____     |     \   \    /   /
|  |                     / /  \ \            |   |      |   |     |     |     |    |     |    |      \   \  /   /
|  |                    / /    \ \           |   |      |   |     |     |     |    |     |    |       \   \/   /
|  |______             / /      \ \          |   |______|   |     |     |     |    |     |    |        \      /
|         |           / /        \ \         |              |     |     |     |    |     |    |         \    /
|   ______|          / /          \ \        |    ______    |     |     |     |    |     |    |          |  |
|  |                / /============\ \       |   |      |   |     |     |     |    |     |    |          |  |
|  |               / /==============\ \      |   |      |   |     |     |     |    |     |    |          |  |
|  |              / /                \ \     |   |      |   |     |     |     |    |     |    |          |  |
|  |             / /                  \ \    |   |      |   |     |     |     |    |     |    |          |  |
|__|            /_/                    \_\   |___|      |___|     |_____|     |____|     |____|          |__|

										  <<<<<<<<<<< NEVER GIVE UP !! >>>>>>>>>>>
										<<<<<<<< YOU CAN DO IT IF YOU WANT !! >>>>>>>>
										 <<<<<<<<< BELIEVE IN YOURSELF !! >>>>>>>>>

*/

int main() {
	//cout << fixed << setprecision(9);
	//freopen("Input.txt.txt", "r", stdin);
	//freopen("Output.txt.txt", "w", stdout);
	AIA();
	int n;
	cin >> n;
	if (n >= 30)cout << "Yes";
	else cout << "No";
	return 0;
}

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<int, int>;

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

    int n, m;
    cin >> n >> m;

    vector< P > ab(n);
    rep (i, n)
    {
        cin >> ab[i].first >> ab[i].second;
    }

    sort(ab.begin(), ab.end());

    int ans = 0;
    priority_queue<int> pq;
    int j = 0;
    for (int i = 1; i <= m; ++i)
    {
        while (j < n && ab[j].first <= i)
        {
            pq.push(ab[j].second);
            ++j;
        }
        if (!pq.empty())
        {
            ans += pq.top(); pq.pop();
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 1660
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
const int MAXN = 160;

int N, K;
ll M;

ll dp[MAXN][MAXN][MAXN]; // cloc
ll ndp[MAXN][MAXN];

ll dans (int X, int Y)
{
    // whatevs
    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
            ndp[i][j] = 0;
    ndp[0][0] = 1;
    for (int i = 0; i < X; i++)
    {
        for (int j = 0; j <= Y; j++)
        {
            ndp[i+1][j+1] += ndp[i][j];
            ndp[i+1][j+1] %= M;
            ndp[i+1][0] += ndp[i][j];
            ndp[i+1][0] %= M;
        }
    }

    ll ans = 0;
    for (int i = 0; i <= Y; i++)
        ans = (ans + ndp[X][i]) % M;
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> N >> K >> M;

    if (K % 2 == 0)
    {
        ll a1 = dans (N / 2, K / 2);
        ll a2 = dans ((N + 1) / 2, K / 2);
        cout << (a1 * a2) % M << "\n";
        return 0;
    }

    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
            for (int k = 0; k < MAXN; k++)
                dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    for (int i = 1; i <= N + 1; i++)
    {
        int cloc = 2 * i;
        int dloc = cloc - K;
        bool cgood = false;
        bool dgood = false;
        if (cloc >= 1 && cloc <= N) cgood = true;
        if (dloc >= 1 && dloc <= N) dgood = true;

        for (int j = 0; j <= N; j++)
            for (int k = 0; k <= K; k++)
            {
                if (!dp[i-1][j][k]) continue;

                dp[i][0][0] += dp[i-1][j][k];
                dp[i][0][0] %= M;
                if (cgood)
                {
                    dp[i][j+1][0] += dp[i-1][j][k];
                    dp[i][j+1][0] %= M;
                }
                if (dgood)
                {
                    if (k == 0)
                    {
                        dp[i][0][k] += dp[i-1][j][k];
                        dp[i][0][k] %= M;
                    }
                    else
                    {
                        dp[i][0][k+1] += dp[i-1][j][k];
                        dp[i][0][k+1] %= M;
                    }
                }
                if (cgood && dgood)
                {
                    dp[i][j+1][max(k+1, j+1)] += dp[i-1][j][k];
                    dp[i][j+1][max(k+1, j+1)] %= M;
                }
            }
    }
    cout << dp[N+1][0][0] << "\n";
}

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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int m = sc.nextInt();

		char[][] a = new char[n][];
		for (int i = 0; i < n; i++) {
			a[i] = sc.next().toCharArray();
		}
		char[][] b = new char[m][];
		for (int i = 0; i < m; i++) {
			b[i] = sc.next().toCharArray();
		}

		for (int i = 0; i + m - 1 < n; i++) {
			for (int j = 0; j + m - 1 < n; j++) {
				if (isOK(i, j, a, b)) {
					pr.println("Yes");
					return;
				}
			}
		}

		pr.println("No");
	}

	private static boolean isOK(int x, int y, char[][] a, char[][] b) {
		int m = b.length;

		for (int i = 0; i < m; i++) {
			for (int j = 0; j < m; j++) {
				if (a[x + i][y + j] != b[i][j]) {
					return false;
				}
			}
		}

		return true;
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 22740
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int a, b;
    cin >> a >> b;

    print(a * b);
    
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  rep(i,b){
    if(a*i%b==c){
      printf("YES");
      return 0;
    }
  }
  printf("NO");
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String a = sc.next();
        char b[] = new char[4];
        b[0] = a.charAt(0);
        b[1] = a.charAt(1);
        b[2] = a.charAt(2);
        b[3] = a.charAt(3);
        
        Arrays.sort(b);
        
        if(b[0]==b[1] && b[1]!=b[2] && b[2] == b[3]){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int gcm(int a, int b) {
	int result = a;
	int k = 0;
	int n = b;
	do {
		k = result % n;
		result = n;
		n = k;
	} while(k != 0);
	return result;
}
int lcm(int a, int b) {
	int g;
	g = gcm(a, b);
	return a*b/g;
}
int lcm_n(vector<int> &numbers) {
	int l;
	l = numbers[0];
	for (int i = 1; i < numbers.size(); i++) {
		l = lcm(l, numbers[i]);
	}
	return l;
}
int gcm_n(vector<int> &numbers) {
  int l;
	l = numbers[0];
	for (int i = 1; i < numbers.size(); i++) {
		l = gcm(l, numbers[i]);
	}
	return l;
}
int main()
{
  int K;
  cin >> K;
  ll sum = 0;
  for(int i=1; i<=K; i++) {
    for(int j=1; j<=K; j++) {
      for(int k=1; k<=K; k++) {
        vector<int> a = {i, j, k};
        ll tmp = gcm_n(a);
        // cout << i <<  j << k << endl;
        // cout << tmp << endl;
        // cout <<  "-----" << endl;
        sum += tmp;
      }
    }
  }
  cout << sum << endl;
  
}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
using namespace std;
long long N;
int S[205], cnt, curr = 1;
int B[205], A[205];
void Fill(int log)
{
    if(cnt > 0)
    {
        int pos = log + 1;
        B[pos]++;
        B[++cnt]--;
        A[cnt] = log + 1;
    }
    else
    {
        for(int i = 1; i <= log; i++)
            A[i] = i;
        cnt = log;
    }
    /*S[++cnt] = curr;
    S[++cnt] = curr;
    ++curr;*/
}
int findLog(long long x)
{
    int log = 0;
    while((1LL << log) <= x)
        ++log;
    log--;
    return log;
}
void Solve()
{
    while(N > 0)
    {
        long long log = findLog(N);
        Fill(log);
        N -= (1LL << log);
    }
}
int main()
{
    cin >> N;
    N++;
    Solve();
    for(int i = 1; i <= cnt; i++)
    {
        B[i] = B[i - 1] + B[i];
        A[i] += B[i];
    }
    cout << cnt * 2 << "\n";
    for(int i = 1; i <= cnt; i++)
        cout << A[i] << " " ;
    for(int i = 1; i <= cnt; i++)
        cout << i << " ";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
s = input()

ptr = [0] * len(s)
for i in range(1, len(s)):
  if s[i] == 'L' and s[i-1] == 'L':
    ptr[i] = ptr[i-1] - 1
  if s[-i-1] == 'R' and s[-i] == 'R':
    ptr[-i-1] = ptr[-i] + 1  

ptr2 = [0] * len(s)
children = [0] * len(s)
for i in range(len(s)):
  if ptr[i] > 0:
    ptr2[i] = - (-ptr[i] // 2) * 2
  else:
    ptr2[i] = (ptr[i] // 2) * 2
  children[i+ptr2[i]] += 1  

print(' '.join(map(str, children)))

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

public class Main {
  private static int solve(int[] abc) {
    int max = 0;
    for (int v : abc) {
      max = Math.max(max, v);
    }
    int diffSum = 0;
    for (int v : abc) {
      diffSum += max - v;
    }
    return diffSum / 2 + (diffSum % 2) * 2;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int[] abc = reader.nextInt(3);
    out.println(solve(abc));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21204
#include <stdio.h>

int main()
{
    int arr[100], n, i, j, k, key;

    scanf("%d", &n);

    for (i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
        if (i > 0)
            printf(" ");
        printf("%-d", arr[i]);
    }
    printf("\n");

    for (i = 1; i < n; i++)
    {
        key = arr[i];
        j = i - 1;

        for (k = 0; k < n; k++)
        {
            while (j >= 0 && arr[j] > key)
            {
                arr[j + 1] = arr[j];
                j--;
            }
            arr[j + 1] = key;
            if (k > 0)
                printf(" ");
            printf("%-d", arr[k]);
        }

        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 2048
def main():
    N, K = map(int, input().split())
    MOD = 10 ** 9 + 7
    x = N - K + 1
    ans = [x]
    for i in range(2, K + 1):
        x = ((x * (N - K + 2 - i) * (K - i + 1) // (i * (i - 1))))
        ans.append(x % MOD)
    print ('\n'.join(map(str, ans)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<limits.h>
#include<set>
#include<map>
#include<string.h>
#include<queue>
#include<math.h>
#include<stdio.h>
using namespace std;

vector<int> merge_sort_merge(vector<int>v1, vector<int>v2){
    vector<int>ret;
    int i=0,j=0;
    while(i<v1.size()&&j<v2.size()){
        if(v1[i]<v2[j]){
            ret.push_back(v1[i++]);
        } else {
            ret.push_back(v2[j++]);
        }
    }
    while(i<v1.size()){
        ret.push_back(v1[i++]);
    }
    while(j<v2.size()){
        ret.push_back(v2[j++]);
    }
    return ret;
}

void merge_sort(vector<int>& vec){
    if(vec.size()<2){
        return;
    }
    vector<int>v1(vec.size()/2+vec.size()%2);
    vector<int>v2(vec.size()/2);
    for(int i=0;i<vec.size();i++){
        if(i<vec.size()/2+vec.size()%2){
            v1[i]=vec[i];
        } else {
            v2[i-vec.size()/2-vec.size()%2]=vec[i];
        }
    }
    merge_sort(v1);
    merge_sort(v2);
    vec = merge_sort_merge(v1,v2);
}
int S[100000];
int n;
bool binary_search(int target, int l,int r){
    int mid=(l+r)/2;
  // cout<<target<<" "<<l<<" "<<r<<endl;
    if(S[mid]==target){
        return true;
    }
    if(S[mid]>target){
        r=mid-1;
    }
    if(S[mid]<target){
        l=mid+1;
    }
    if(l>n-1||r<0||l>r){
        return false;
    }
    return binary_search(target,l,r);;
}

int main(){
    int q;
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d",S+i);
    }
    cin>>q;
    int t;
    int ans=0;
    for(int i=0;i<q;i++){
        cin>>t;
        if(binary_search(t,0,n-1)){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 110;
int a[N];

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int n;
	cin >> n;
	forn(i, n)
		cin >> a[i];
	int ans = 1e9;
	for (int x = -100; x <= 100; ++x) {
		int res = 0;
		forn(j, n) {
			res += sqr(x - a[j]);
		}
		umn(ans, res);
	}
	cout <<ans << endl;
	return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if( A+B > C+D )  { cout << "Left" << endl; }
  if( A+B == C+D ) { cout << "Balanced" << endl; }
  if( A+B < C+D )  { cout << "Right" << endl; }
}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



ll my_gcd(ll& a, ll& b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}



// long long型 n を、base 進法での、i 桁目の数が入った vector にする。
void ll_to_vector(ll base, ll n, vector<ll>& v) {
	ll tempo = n;

	ll n_digit = floor(log10(n) / log10(base)) + 1;
	v.assign(n_digit, 0);

	//ll n_digit = v.size();

	for (ll i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}







signed main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	while (A > 0 && C > 0) {
		C -= B;
		if (C <= 0) break;
		A -= D;
	}

	if (A > 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3684
def intlist():
    k = [int(i) for i in input().split()]
    return k
def intmat(x):
    k = [[int(i) for i in input().split()] for i in range(x)]
    return k
#ここから下に書く
x = int(input())
if x==3 or x==5 or x==7:
    print("YES")
else:
    print("NO")

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int n;
    cin >> n;
    int b[101][101];
    for(int i=1;i<=n;i++) cin >> b[0][i];
    
    stack<int> ans;
    for(int m=1;m<=n;m++){
        bool flg = true;
        for(int i=n+1-m;i>=1;i--){
            if(b[m-1][i]==i){
                for(int j=1;j<=n-m;j++){
                    if(j>=i) b[m][j] = b[m-1][j+1];
                    else b[m][j] = b[m-1][j];
                }
                ans.push(i);
                flg = false;
                break;
            }
        }
        if(flg){
            cout << -1 << endl;
            return 0;
        }
    }

    while(!ans.empty()){
        cout << ans.top() << endl;
        ans.pop();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>

using namespace std;

const int N_MAX = 105;
const int W_MAX = 10005;

int dp1[W_MAX];
int dp2[W_MAX];

typedef vector<int> VI;

int main() {
  int N, W;

  cin >> N >> W;

  int *dp = dp1;
  int *dp_prev = dp2;

  memset(dp_prev, -1, sizeof(dp1));
  VI vs;
  VI ws;

  for (int i = 0; i < N; i++) {
    int v, w;
    cin >> v >> w;
    vs.push_back(v);
    ws.push_back(w);
  }

  dp_prev[0] = 0;
  for (int i = 0; i < N; i++) {
    memset(dp, -1, sizeof(dp1));
    for (int j = 0; j <= W; j++) {
      int v = vs[i];
      int w = ws[i];
      dp[j] = dp_prev[j];
      if (j - w >= 0) {
        int prev = dp[j - w];
        if (prev >= 0) {
          dp[j] = max(dp[j], prev + v);
        }
      }
    }
    swap(dp_prev, dp);
  }

  int res = 0;
  for (int j = 0; j <= W; j++) {
    if (dp_prev[j] >= 0) {
      res = max(res, dp_prev[j]);
    }
  }

  cout << res << endl;

  return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	const long long mod = 1000000007;  
	long long m, n;
	cin >> m >> n;
	long long ans = 1;
	while(n > 0) {
		if(n & 1) {
			ans = ans * m % mod;
		}
		m = m * m % mod;
		n >>= 1;
	}
	cout << ans << endl;
	return 0;	
}



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

using namespace std;
static const int INF = 1000000000;
static int dp[301][301][301];

int main(){
	ios_base::sync_with_stdio(false);
	int k;
	string s;
	cin >> s >> k;
	string t(s);
	reverse(t.begin(), t.end());
	const int n = s.size();
	for(int i = 0; i <= k; ++i){
		for(int x = 0; x <= n; ++x){
			for(int y = 0; y <= n; ++y){ dp[i][x][y] = -INF; }
		}
	}
	dp[0][0][0] = 0;
	for(int i = 0; i <= k; ++i){
		for(int x = 0; x <= n; ++x){
			for(int y = 0; y <= n; ++y){
				const int cur = dp[i][x][y];
				if(x < n && y < n){
					if(s[x] == t[y]){ dp[i][x + 1][y + 1] = max(dp[i][x + 1][y + 1], cur + 1); }
					if(i < k){ dp[i + 1][x + 1][y + 1] = max(dp[i + 1][x + 1][y + 1], cur + 1); }
					dp[i][x + 1][y + 1] = max(dp[i][x + 1][y + 1], cur);
				}
				if(x < n){ dp[i][x + 1][y] = max(dp[i][x + 1][y], cur); }
				if(y < n){ dp[i][x][y + 1] = max(dp[i][x][y + 1], cur); }
				if(i < k){ dp[i + 1][x][y] = max(dp[i + 1][x][y], cur); }
			}
		}
	}
	/*
for(int i = 0; i <= k; ++i){
	for(int x = 0; x <= n; ++x){
		for(int y = 0; y <= n; ++y){ cout << dp[i][x][y] << " " ;}
		cout << endl;
	}
	cout << endl;
}
*/
	int answer = 0;
	for(int i = 0; i <= n; ++i){
		answer = max(answer, 2 * dp[k][i][n - i]);
	}
	for(int i = 1; i <= n; ++i){
		answer = max(answer, 1 + 2 * dp[k][i - 1][n - i]);
	}
	cout << answer << endl;
	return 0;
}


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

using namespace std;

typedef long long LL;

struct node{
	LL t,k,i;
	node(LL t=0,LL k=0,LL i=0):t(t),k(k),i(i){}
	LL calc(LL x){return t+k*x;}
};
vector<node> f;

LL gcd(LL x,LL y){
	return y==0?x:gcd(y,x%y);
}

void exgcd(LL a,LL b,LL &x,LL &y){
	if (b==0){
		x=1; y=0;
		return;
	}
	exgcd(b,a%b,x,y);
	x-=a/b*y;
	swap(x,y);
}

void calc(LL n,LL m,LL p,LL q,LL now){
	if (!n||!m){
		return;
	}
	if (n<=m){
		LL t=(m-1)/n;
		f.push_back(node(now+p,n+q,t)); 
		calc(n,m%n,p+(q+n)*t,q,now);
	}
	else{
		LL t=n/m;
		calc(n%m,m,p,q+(p+m)*t,now);
	}
}

LL up(LL x,LL y){return (x+y-1)/y;}

LL down(LL x,LL y){return x/y;}

bool pd(LL u1,LL v1,LL u2,LL v2){
	return u1*v2>=u2*v1;
}

LL calc(LL u1,LL v1,LL u2,LL v2,LL u,LL v){
	LL ret=0,l=0,r=u+v;
	while (l<=r){
		LL mid=(l+r)>>1,t1=0,t2=mid;
		if (u2*mid-u>=0){
			t1=max(t1,up(u2*mid-u,u2-u1));
		}
		if (v-v2*mid<0){
			t2=-1;
		}
		else{
			t2=min(t2,down(v-v2*mid,v1-v2));
		}
		if (t1<=t2){ret=mid; l=mid+1;}
		else r=mid-1;
	}
	return ret;
}

void solve(){
	LL a,b,c,x,y;
	scanf("%lld%lld%lld%lld%lld",&a,&x,&b,&y,&c);
	LL g=gcd(a,b);
	a/=g; b/=g; c/=gcd(c,g);
	g=gcd(a,c);
	a/=g; c/=g; y/=g;
	g=gcd(b,c);
	b/=g; c/=g; x/=g;
	a%=c; b%=c;
	if (c==1){
		printf("%lld\n",x+y);
		return;
	}
	LL x0=0,y0=0;
	exgcd(b,c,x0,y0);
	a=(a*x0%c+c)%c;
	f.clear();
	f.push_back(node(0,0,1));
	calc(a,c,0,0,0);
	f.push_back(node(c*a,0,1));
	LL ans=0;
	for (size_t i=0;i<f.size();++i){
		if (f[i].i>=2){
			LL u1=f[i].calc(1)/a,v1=c-(a*u1)%c;
			LL u2=f[i].calc(f[i].i)/a,v2=c-(a*u2)%c;
			if (pd(v1,u1,y,x)&&pd(y,x,v2,u2)){
				LL l=1,r=f[i].i-1;
				while (l<=r){
					LL mid=(l+r)>>1;
					LL u1=f[i].calc(mid)/a,v1=c-(a*u1)%c;
					LL u2=f[i].calc(mid+1)/a,v2=c-(a*u2)%c;
					if (!pd(v1,u1,y,x)){
						r=mid-1;
						continue;
					}
					if (!pd(y,x,v2,u2)){
						l=mid+1;
						continue;
					}
					ans=calc(u1,v1,u2,v2,x,y);
					break;
				}
				break;
			}
		}
		if (i+1<f.size()){
			LL u1=f[i].calc(f[i].i)/a,v1=c-(a*u1)%c;
			LL u2=f[i+1].calc(1)/a,v2=(c-(a*u2)%c)%c;
			if (pd(v1,u1,y,x)&&pd(y,x,v2,u2)){
				ans=calc(u1,v1,u2,v2,x,y);
				break;
			}
		}
	}
	printf("%lld\n",ans);
}

int main(){
	LL T; scanf("%lld",&T);
	while (T--) solve();
	
	return 0;
}
			

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

int main(){
    string weather;
    cin >> weather;
    if(weather=="Sunny"){
        cout << "Cloudy";
    }else if(weather =="Cloudy"){
        cout << "Rainy";
    }else if(weather == "Rainy"){
        cout << "Sunny";
    }
    return 0;
}

Measured memory_bytes: 256
class UnionFindTree():
  def __init__(self,n):
    self.parent = []
    self.rank = []
    self.candidate = []
    for i in range(n):
      self.parent.append(i)
      self.rank.append(int(1))
      self.candidate.append(int(1))

  def find(self,n):
    if self.parent[n] == n:
      return self.parent[n]
    else:
      self.parent[n] = self.find(self.parent[n])
      return self.parent[n]

  def unite(self,n,m):
    n = self.find(n)
    m = self.find(m)

    if n == m:
      return
    else:
      if self.rank[n] < self.rank[m]:
        self.parent[n] = m
        self.candidate[m] += self.candidate[n]
      elif self.rank[n] > self.rank[m]:
        self.parent[m] = n
        self.candidate[n] += self.candidate[m]
      elif self.rank[n] == self.rank[m]:
        self.parent[m] = n
        self.candidate[n] += self.candidate[m]
        self.rank[n] += 1




N,M,K = (int(i) for i in input().split())

uft = UnionFindTree(N)

friend = [0] * N
for i in range(M):
  A,B = (int(i) for i in input().split())
  uft.unite(A-1,B-1)
  friend[A-1] += 1
  friend[B-1] += 1


# candidate = [4,3,1]
# candidate => 自分 + 友達 + 友達候補 (include ブロック関係)
candidate = []
for i in range(N):
  candidate.append(uft.candidate[uft.find(i)])

blocked = [0] * N
for i in range(K):
  C,D = (int(i) for i in input().split())
  if uft.parent[C-1] == uft.parent[D-1]:
    blocked[C-1] += 1
    blocked[D-1] += 1

for i in range(N):
  candidate[i] -= (friend[i]+blocked[i]+1)


print(*candidate)



Measured memory_bytes: 13368
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int64, n)
	cnt := 0
	var sum int64 = 0
	var min int64
	var tmp int64
	for i := 0; i < n; i++ {
		fmt.Scan(&tmp)
		if i == 0 {
			if tmp < 0 {
				min = -tmp
			} else {
				min = tmp
			}
		}
		if tmp < 0 {
			cnt++
			sum -= tmp
			if -tmp < min {
				min = -tmp
			}
		} else {
			sum += tmp
			if tmp < min {
				min = tmp
			}
		}
		a[i] = tmp
	}
	if cnt%2 == 0 {
		fmt.Println(sum)
	} else {
		fmt.Println(sum - 2*min)
	}
}


Measured memory_bytes: 7464
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Control.Monad (replicateM)
import Data.List (group, sort, length, maximum)

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main = do
  n <- cReadLn
  ss <- replicateM n C.getLine
  m <- cReadLn
  ts <- replicateM m C.getLine
  print $ maximum . uncurry diff $ f ss ts

f ss ts = (gs ss, gs ts) 

gs = group . sort

diff :: [[C.ByteString]] -> [[C.ByteString]] -> [Int]
diff [] _ = [0]
diff s [] = map length s
diff sss@(s:ss) ttt@(t:ts)
  | head s >  head t =  0 : diff sss ts
  | head s == head t = (length s - length t) : diff ss ts
  | head s <  head t = length s : diff ss ttt

Measured memory_bytes: 508
#include<stdio.h>


 int main(){
     int n,i,j;
     int R[200001],Max,Min;
     scanf("%d",&n);
     for(i=0;i<n;i++){
              scanf("%d",&R[i]);
              }
     Min=R[0];
     Max=R[1]-Min;
     for(i=1;i<n;i++){
              if(R[i]-Min>Max)Max=R[i]-Min;
              if(Min>R[i])Min=R[i];
              }
     printf("%d\n",Max);
     return 0;
     }


Measured memory_bytes: 2592
#include <iostream>
#include <math.h>

using namespace std;

int main(){
  uint64_t n;
  cin >> n;
  
  uint64_t x = (n*100)/108;
  if((n*100)%108 != 0){
    x = x+1;
    
  }
  //cout << x*1.08 << x;
  uint64_t r = x*1.08;
  if(r == n){
    cout << x;
  }else{
    cout << ":(";
  }
  
  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let a: usize = read();
    let b: usize = read();
    
    if a <= 5 {
        println!("0");
    } else if a <= 12 {
        println!("{}", b / 2);
    } else {
        println!("{}", b);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
using System;
using System.Linq;
public class Program {
  public static void Main() {
    int[] DN = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    int D = DN[0], N = DN[1];
    int first = (int)Math.Pow(100, D);
    if (N == 100) {
      N++;
    }
    Console.WriteLine(first*N);
  }
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

    long long count_w = 0;

    long long sum = 0;

    for(long long i = 0; i < s.size(); i++){
        if(s[i] == 'W'){
            sum += abs(count_w - i);
            count_w++;
        }
    }

    printf("%lld\n", sum);

    return 0;
}

Measured memory_bytes: 640
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    
    ans = 0
    ruiseki = [0]
    d = defaultdict(int)
    d[0]=1
    for i in range(n):
        if i - k + 1>= 0:
            d[ruiseki[i - k+1]]-=1
        ruiseki.append((ruiseki[i] + a[i] - 1)%k)
        ans += d[ruiseki[i+1]]
        d[ruiseki[i + 1]] += 1
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  string s;
  ll k;
  cin >> s >> k;
  ll r;
  if (k == 1) {
    r = 0;
    string t = s;
    for (int i = 0; i + 1 < t.size(); i++) {
      if (t[i] == t[i + 1]) {
        t[i + 1] = '*';
        r++;
      }
    }
  } else if (k % 2) {
    string t = s + s + s + s + s;
    for (int i = 0; i + 1 < t.size(); i++) {
      if (t[i] == t[i + 1]) t[i + 1] = '*';
    }
    vector<ll> x(5);
    for (int i = 0; i < t.size(); i++) x[i / s.size()] += t[i] != s[i % s.size()];
    r = x[0] + (k - 1) / 2 * x[1] + (k - 2) / 2 * x[2] + x[4];
  } else {
    string t = s + s + s + s;
    for (int i = 0; i + 1 < t.size(); i++) {
      if (t[i] == t[i + 1]) t[i + 1] = '*';
    }
    vector<ll> x(4);
    for (int i = 0; i < t.size(); i++) x[i / s.size()] += t[i] != s[i % s.size()];
    r = x[0] + (k - 2) / 2 * x[1] + (k - 2) / 2 * x[2] + x[3];
  }
  cout << r << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,t;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b)
	{
		t = a ;
		a = b ;
		b = t ;
	}
	if(b>c)
	{
		t = b ;
		b = c ;
		c = t ;
	}
	if(a>b)
	{
		t = a ;
		a = b ;
		b = t ;
	}
	printf("%d\n",10*c+b+a);
	return 0 ;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <vector>

#define NUM_MOD (1000000007L)

using namespace std;

void zero_mat(vector<vector<long>> &ass) {
  const long M = ass.size(), N = ass[0].size();
  for (long i = 0; i < M; i++) {
    for (long j = 0; j < N; j++) {
      ass[i][j] = 0;
    }
  }
}

void identity_mat(vector<vector<long>> &ass) {
  const long N = ass.size();
  for (long i = 0; i < N; i++) {
    for (long j = 0; j < N; j++) {
      ass[i][j] = i == j;
    }
  }
}

void copy_mat(const vector<vector<long>> &ass, vector<vector<long>> &bss) {
  const long M = ass.size(), N = ass[0].size();
  for (long i = 0; i < M; i++) {
    for (long j = 0; j < N; j++) {
      bss[i][j] = ass[i][j];
    }
  }
}

void mat_mult_mat(const vector<vector<long>> &ass,
                  const vector<vector<long>> &bss, vector<vector<long>> &css) {
  const long L = ass.size(), M = ass[0].size(), N = bss[0].size();
  // initialize
  zero_mat(css);
  // calculate
  for (long i = 0; i < L; i++) {
    for (long k = 0; k < M; k++) {
      for (long j = 0; j < N; j++) {
        css[i][j] = (css[i][j] + ass[i][k] * bss[k][j]) % NUM_MOD;
      }
    }
  }
}

void mat_pow(const vector<vector<long>> &ass, long k,
             vector<vector<long>> &bss) {
  const long N = ass.size();
  // initialize
  identity_mat(bss);
  // calculate
  vector<vector<long>> xss(N, vector<long>(N, 0)), tss(N, vector<long>(N, 0));
  copy_mat(ass, xss);
  while (k > 0) {
    if (k % 2) {
      mat_mult_mat(bss, xss, tss);
      copy_mat(tss, bss);
    }
    k /= 2;
    mat_mult_mat(xss, xss, tss);
    copy_mat(tss, xss);
  }
}

int main() {
  // read inputs
  long N, K;
  vector<vector<long>> ass;
  scanf("%ld %ld", &N, &K);
  for (long i = 0; i < N; i++) {
    ass.push_back(vector<long>(N, 0));
    for (long j = 0; j < N; j++) {
      scanf("%ld", &ass[i][j]);
    }
  }

  // solve
  vector<vector<long>> bss(N, vector<long>(N, 0));
  long ans = 0;
  mat_pow(ass, K, bss);
  for (long i = 0; i < N; i++) {
    for (long j = 0; j < N; j++) {
      ans = (ans + bss[i][j]) % NUM_MOD;
    }
  }
  printf("%ld\n", ans);
}

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

int func(int A, int B, int C) {
    if (A%2 == 1 || B%2 == 1 || C%2 == 1) {
        return 0;
    }
    if (A == B && A == C) {
        return -1;
    }
    
    return func((B+C)/2, (C+A)/2, (A+B)/2) + 1;
}

int main() {
    // input
    int A, B, C;
    cin >> A >> B >> C;
    
    int ans = func(A, B, C);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] x = new int[m];
		for(int i = 0; i < m; i++){
			x[i] = sc.nextInt();
		}
		if(m == 1){
			System.out.print(0);
		}else if(n >= m){
			System.out.print(0);
		}else{
			Arrays.sort(x);
			n--;
			int num = 0;
			int[] x2 = new int[m-1];
			for(int i = 0; i < m-1; i++){
				x2[i] = x[i+1] - x[i];
				num += x2[i];
			}
			Arrays.sort(x2);
			for(int i = 0; i < n; i++){
				num -= x2[m-2-i];
			}
			System.out.print(num);
		}
	}
}


Measured memory_bytes: 50296
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int n;
vector<pair<int,pair<int,int>>>v;
vector<pair<int,pair<int,int>>>v1;
int32_t main()
{
    IOS;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        v.push_back({a+b,{a,b}});
        v1.push_back({a-b,{a,b}});
    }
    sort(v.begin(),v.end());
    sort(v1.begin(),v1.end());
    int maxans=abs(v[n-1].second.first-v[0].second.first)+
            abs(v[n-1].second.second-v[0].second.second);
    maxans=max(maxans, abs(v1[n-1].second.first-v1[0].second.first)+
            abs(v1[n-1].second.second-v1[0].second.second)); 
    print(maxans);       
}

Measured memory_bytes: 12804
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
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 main(){
    ll n;cin >> n;
    vl x(n),y(n);
    rep(i,n)cin >> x[i] >>y[i];
    vl perm(8);
    rep(i,8)perm[i]=i;
    ll cnt=0;
    do{
        bool check=false;
        rep(i,n){
            if(perm[x[i]]!=y[i])check=true;
        }
        if(check)continue;
        rep(i,8){
            ll y=i,x=perm[i];
            while(y<7&&x>0){
                y++;x--;
                if(perm[y]==x)check=true;
            }
            y=i;x=perm[i];
            while(y<7&&x<7){
                y++;x++;
                if(perm[y]==x)check=true;
            }
        }
        if(check)continue;
        rep(i,8){
            rep(j,8){
                if(perm[i]==j)cout << 'Q';
                else cout << '.';
            }
            cout << endl;
        }
        break;
    }while(next_permutation(all(perm)));
}



Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <numeric>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <random>



using namespace std;
 

int main()
{
	string s;

	cin >> s;

	s.insert(4, " ");

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
const int INF = 1<<29;

int N;
vector<string> strs;

set<int> non_zero;
int mapped_num[26];
bool used[10];
int max_len;


int dfs(int x, int y, int s){
    if(x >= max_len){
        if(s == 0) return 1;
        else return 0;
    }
    if(y == N - 1){
        if(x >= strs[y].size()) return 0;
        int d = strs[y][strs[y].size()-1-x] - 'A';
        if(mapped_num[d] == -1){
            int i = s % 10;
            if(used[i]) return 0;
            if(i == 0 && non_zero.count(d) > 0) return 0;
            used[i] = true;
            mapped_num[d] = i;
            int ret = dfs(x+1, 0, s / 10);
            mapped_num[d] = -1;
            used[i] = false;
            return ret;
        }else{
            if(mapped_num[d] != s % 10) return 0;
            return dfs(x+1, 0, s / 10);
        }
    }else{
        if(x >= strs[y].size()) return dfs(x, y+1, s);
        int d = strs[y][strs[y].size()-1-x] - 'A';
        if(mapped_num[d] != -1) return dfs(x, y+1, s+mapped_num[d]);
        int ret = 0;
        for(int i=0;i<10;i++){
            if(used[i]) continue;
            if(i == 0 && non_zero.count(d) > 0) continue;
            used[i] = true;
            mapped_num[d] = i;
            ret += dfs(x, y+1, s+i);
            mapped_num[d] = -1;
            used[i] = false;
        }
        return ret;
    }
}


int main(){
    while(true){
        cin >> N;
        if(N == 0) break;

        strs.resize(N);
        non_zero.clear();
        max_len = 0;
        for(int i=0;i<N;i++){
            cin >> strs[i];
            if(strs[i].size() > 1) non_zero.insert(strs[i][0] - 'A');
            max_len = max(max_len, int(strs[i].size()));
        }

        memset(mapped_num, -1, sizeof(mapped_num));
        memset(used, 0, sizeof(used));
        cout << dfs(0, 0, 0) << endl;
    }

    return 0;
}

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

using namespace std;
const int mod = 1e9 + 7;
void add(int &x, long long y) {
    x += y;
    if (x >= mod) x -= mod;
}
int f[5002][5002][2];
int nf[5002][2];
int n, sz[5002];
int dp[5002];
vector<int> ed[5002];
void dfs(int u, int p) {
    sz[u] = 1;
    f[u][1][0] = 1;
    for (auto v: ed[u]) {
        if (v == p) continue;
        dfs(v, u);
        for (int j = 1; j <= sz[u]; j++)
        for (int t1 = 0; t1 <= 1; t1++)
        for (int k = 1; k <= sz[v]; k++)
        for (int t2 = 0; t2 <= 1; t2++) {
            int q = 1ll * f[u][j][t1] * f[v][k][t2] % mod;
            add(nf[j + k][t1 ^ t2], q);
            if (k % 2 == 0) add(nf[j][(t1 ^ t2) ^ 1], 1ll * q * dp[k] % mod);
        }
        sz[u] += sz[v];
        for (int j = 1; j <= sz[u]; j++)
        for (int t1 = 0; t1 <= 1; t1++) {
            f[u][j][t1] = nf[j][t1];
            nf[j][t1] = 0;
        }
    }

}
int main() {
    ios_base::sync_with_stdio(0);
    cin >> n;
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        ed[u].push_back(v);
        ed[v].push_back(u);
    }
    dp[0] = 1;
    for (int k = 2; k <= n; k += 2) dp[k] = 1ll * dp[k - 2] * (k - 1) % mod;
    dfs(1, 0);
    int ans = 0;
    for (int j = 2; j <= sz[1]; j++)
    for (int t1 = 0; t1 <= 1; t1++) {
        int t = t1;
        if (t == 0) add(ans, 1ll * f[1][j][t1] * dp[j] % mod);
        else add(ans, mod - (1ll * f[1][j][t1] * dp[j]) % mod);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 195200
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n, sum[1000010];
int prime[1000010], np[1000010], cnt, mu[1000010];
const int m = 1000000;
int inv[1000010];
int ans;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        int a;
        scanf("%d", &a);
        sum[a] = (sum[a] + a) % mod;
        ans = (ans + mod - a) % mod;
    }
    mu[1] = 1;
    for (int i = 2; i <= m; i++) {
        if (!np[i]) prime[++cnt] = i, mu[i] = -1;
        for (int j = 1; prime[j] * i <= m; j++) {
            np[i * prime[j]] = 1;
            if (i % prime[j] == 0) {
                mu[i * prime[j]] = 0;
                break;
            }
            mu[i * prime[j]] = -mu[i];
        }
    }
    for (int i = 1; i <= cnt; i++) {
        for (int j = m / prime[i]; j > 0; j--) sum[j] = (sum[j] + sum[j * prime[i]]) % mod;
    }
    for (int i = 1; i <= m; i++) sum[i] = 1ll * sum[i] * sum[i] % mod;
    inv[1] = 1;
    for (int i = 2; i <= m; i++) inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
    for (int i = 1; i <= m; i++) {
        long long tmp = 0;
        for (int j = 1; j <= m / i; j++) tmp += mu[j] * sum[i * j];
        ans = (ans + (tmp % mod + mod) * inv[i]) % mod;
    }
    assert(ans >= 0);
    return cout << 1ll * inv[2] * ans % mod << endl, 0;
}

Measured memory_bytes: 17792