akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define rg register
#define LL long long
#define __space putchar(' ')
#define __endl putchar('\n')
template <typename qwq> inline void read(qwq &x)
{
	x = 0;
	rg int f = 1;
	rg char c = getchar();
	while (c < '0' || c > '9')
	{
		if (c == '-') f = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9')
	{
		x = (x << 1) + (x << 3) + (c ^ 48);
		c = getchar();
	}
	x *= f;
}
template <typename qaq> inline void print(qaq x)
{
	if (x < 0)
	{
		putchar('-');
		x = -x;
	}
	if (x > 9) print(x / 10);
	putchar(x % 10 + '0');
}
char s[233333];
int buc[233333];
int next_l, last_r;
int main()
{
	scanf("%s", s + 1);
	rg int len = strlen(s + 1);
	for (rg int i = 1; i <= len; ++i) // 先处理L 
	{
		if (s[i] == 'R') last_r = i;
		else // L 奇步走L偶步走R 
		{
			rg int delta = i - last_r;
			if (delta & 1) ++buc[last_r + 1];
			else ++buc[last_r];
		}
	}
	for (rg int i = len; i >= 1; --i) // 再处理R 
	{
		if (s[i] == 'L') next_l = i;
		else // R 奇步走R偶步走L 
		{
			rg int delta = next_l - i;
			if (delta & 1) ++buc[next_l - 1];
			else ++buc[next_l];
		}
	}
	for (rg int i = 1; i <= len; ++i) print(buc[i]), __space;
	return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	bool flag = true;

	for (auto i = 0; i < s.size() - 1; i++) {
		for (auto j = i + 1; j < s.size(); j++) {
			if (s[i] == s[j]) {
				flag = false;
				break;
			}
		}
	}
	if (flag) cout << "yes\n";
	else cout << "no\n";
}


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

typedef long long ll;

#define MOD 1000000007
#define INF LLONG_MAX
#define decimDigits(n) fixed << setprecision(n)
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(it, arr) for(auto it = begin(arr); it != end(arr); it++)

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

int main(){

    ll N, L;
    string s;
    vector<string> S;

    cin >> N >> L;

    rep(i, N){
        cin >> s;
        S.push_back(s);
    } 

    sort(all(S));

    irep(it, S)
        cout << *it;
    
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n;
    cin>>n;
    map<vector<char>,in> a;
    vector<char> s(10);
    rep(i,n){
        rep(j,10) cin>>s[j];
        sort(all(s));
        a[s] ++;
    }
    in ans=0;
    for(auto x:a){
        in y=x.second;
        ans +=y*(y-1)/2;
    }
    cout<<ans<<endl;
}
//./problem.exe

Measured memory_bytes: 11264
import java.io.*;
import java.util.*;
 
public class Main{
	int m;
	int n;
	int[] haba;
	
	public void solve(){
		while(true){
			m = nextInt();
			if(m == 0) break;
			n = nextInt();
			haba = new int[n];
			for(int i = 0; i < n; i++){
				haba[i] = nextInt();
			}
			out.println(binarySearch(new Check(), 0, 1500000 ));
		}
	}
	
	public int binarySearch(Check check, int begin, int end){
		int l = begin - 1;
		int r = end;
		while(r - l > 1){
			int m = (r + l) / 2;
			if(check.check(m)){
				r = m;
			}else{
				l = m;
			}
		}
		return r;
	}
	
	class Check{
		boolean check(int n){
			int idx = 0;
			for(int i = 0; i < m; i++){
				int sum = 0;
				while(idx < Main.this.n && sum + haba[idx] <= n){
					sum += haba[idx++];
				}
			}
			return idx == Main.this.n;
		}
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 24128
-- modules to import --

import Data.ByteString.Char8
import Data.Maybe
import Prelude

-- functions for this task --

read_Integer = fst . fromJust . Data.ByteString.Char8.readInteger
get_Integer  = read_Integer <$> Data.ByteString.Char8.getLine

calculate_digit_sum :: Integer -> Integer
calculate_digit_sum target
        | target >= 10 = (mod target 10) + (calculate_digit_sum $ div target 10)
        | target >=  0 = target  

task_B :: Integer -> Bool
task_B target
        | mod target (calculate_digit_sum target) == 0 = True
        | otherwise                                    = False

-- main process is below --

main :: IO ()
main = do

        -- STEP.01
        -- read out the given integer
        integer_given <- get_Integer

        -- STEP.02
        -- output the answer of this task
        Prelude.putStrLn $ if (task_B $ integer_given) then "Yes" else "No"

-- End of this source code --

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

using namespace std;
typedef long long ll;
#define sz size()
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
    string s; cin>>s;
    vector<ll> L(s.sz,0);
    string mem="-";
    ll tmp;
    for(int i=s.sz-1;i>=0;i--){
        if(mem[0]==s[i]){
            tmp++;
            L[i]=tmp;
        }
        else{
            tmp=1;
            L[i]=tmp;
            mem=s[i];
        }
    }

    mem="-";
    ll ans=0,i=0;
    while(i<s.sz){
        if(i+L[i]==s.sz){
            ans+=(L[i]/3)*2;
            if(L[i]%3!=0) ans++;  

            break;
        }
        else{
            if(mem[0]!=s[i]){
                mem=s[i];
                i++;
                ans++;
            }
            else{
                mem=s[i]+s[i+1];
                i+=2;
                ans++;
            }
        }
    }
    cout<<ans;
    //1start 1 3 4 6 7 9 10 12 
    //2start 2 3 5 6 8 9 11 12
    // ans   1 2 3 4 5 6  7  8
}
		
	


Measured memory_bytes: 2180
N, Q = map(int, input().split())
S = input()
lr = [list(map(int, input().split())) for _ in range(Q)]

ac = [0 for _ in range(N)]

for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        ac[i] = 1
#print(ac)

acsum = [0 for _ in range(N+1)]
for i in range(N):
    acsum[i+1] = acsum[i] + ac[i]
#print(acsum)

for i in range(Q):
    left = lr[i][0] - 1
    right = lr[i][1] - 1
    tmp = acsum[right] - acsum[left]
    print(tmp)

Measured memory_bytes: 33092
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()
N = len(S)
if S != S[::-1]:
    print('No')
    exit()
if S[0:(N-1)//2] != S[0:(N-1)//2][::-1]:
    print('No')
    exit()
if S[(N+3)//2-1:] != S[(N+3)//2-1:][::-1]:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 3064
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  int N, Y;
  cin >> N >> Y;
  Y = Y / 1000;

  REP (i, Y / 10 + 1) {
    REP (j, Y / 5 + 1) {
      int k = N - i - j;
      if (k >= 0 & (10 * i + 5 * j + k == Y)) {
        cout << i << " " << j << " " << N - i - j << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}


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

struct Process {
    string name;
    int time;
};

int main() {
    queue<int> que_t;
    queue<string> que_n;
    int n, q_time;
    Process P;

    cin >> n >> q_time;
    
    for(int i = 0; i < n; i++) {
        cin >> P.name >> P.time;
        que_t.push(P.time);
        que_n.push(P.name);
    }

    int t = 0;
    int tmp_t;
    string tmp_n;

    while (!que_t.empty()) {
        if (que_t.front() > q_time){
            t += q_time;
            tmp_t = que_t.front() - q_time;
            que_t.pop(); que_t.push(tmp_t);
            tmp_n = que_n.front();
            que_n.pop(); que_n.push(tmp_n);
        }
        else {
            t += que_t.front();
            cout << que_n.front() << ' ' << t << endl;
            que_t.pop();
            que_n.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 5704
#include<bits/stdc++.h>
#define ll  long long
#define pp pair<int,int>
#define ppn pair<pp,int>
#define F first
#define S second
#define N 200005
#define mod 1000000007
#define pi 3.14159265358979323846

using namespace std;


int main()
{


    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++){
            cin>>a[i];
           // if(i<k)x*=a[i];

    }
    //ll u = x;
    for(int i=k,j=0; i<n ; i++,j++){
        //cout<<a[i]<<" "<<a[j]<<endl;

        if(a[i]>a[j])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;

    }




}


Measured memory_bytes: 4436
import java.util.*;
import java.util.Comparator;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer [] a = new Integer[N];
    for(int i = 0;i<N;i++){
      a[i] = sc.nextInt();
    }
    Arrays.sort(a, Comparator.reverseOrder());
    long sum = a[0];

    if(N%2==0){
      for(int i = 1;i<N/2;i++){
        sum += (long)a[i]*2;
        }
    }else{
      int tmp = 0;
      for(int i = 1;i<N/2;i++){
        sum += (long)a[i]*2;
        tmp = i;
      }
        sum += (long)a[tmp+1];
    }
    System.out.println(sum);
  }
}

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

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

  if (A > X) {
    cout << "NO" << endl; 
    return 0;
  }
  if (X - A < B) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,x;
inline ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
int main()
{
    cin>>n>>x;
    cout<<3*(n-gcd(n,x));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>

using namespace std;

int main() {

	int N;
	int max = 0;
	map<string, int> memo;

	cin >> N;

	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;

		memo[s] += 1;
	}

	for (const auto& x : memo) {
		int v = x.second;
		if (v > max) max = v;
	}

	for (const auto x : memo) {
		if (x.second == max) {
			cout << x.first << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define rrep(i,m,n) for(int i = m; i >= n; i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll a[100010], b[100010], c[100010];
    cin >> N;
    rep(i,0,N){
        cin >> a[i] >> b[i] >> c[i];
    }
    ll dp[100010][3] = {};
    rep(i,0,N){
        dp[i+1][0] = max(dp[i][1] + b[i], dp[i][2] + c[i]);
        dp[i+1][1] = max(dp[i][0] + a[i], dp[i][2] + c[i]);
        dp[i+1][2] = max(dp[i][0] + a[i], dp[i][1] + b[i]);
    }
    ll ans = max(dp[N][0], max(dp[N][1], dp[N][2]));
    print(ans);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
i64 dp[100001];
i64 sm[26];

int main(){
    int N;
    string S,T;
    cin >>N>>S>>T;
    dp[0]=1;
    sm[S[0]-'a'] = 1;
    for(int i=1;i<N;i++){
        dp[i] = sm[T[i]-'a'];
        sm[S[i]-'a'] += dp[i];
        dp[i] = dp[i]%1000000007;
        sm[S[i]-'a'] = sm[S[i]-'a']%1000000007;
    }

    cout <<dp[N-1]<<endl;

    return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }

int main() {
    ll A, B;

    cin >> A >> B;

    cout << lcm(A, B) << endl;

    return (0);
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

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

int dp[1000001][5];

void solve() {
  int L;
  cin >> L;
  vi32 a(L);
  cin >> a;
  repc(i, 1000000) rep(j, 5) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(i, L) rep(j, 5) {
    int eo = a[i] & 1;
    if (j == 0) {
      amin(dp[i+1][0], dp[i][j] + a[i]);
      amin(dp[i+1][1], dp[i][j] + (eo == 1 ? 0 : 1));
      amin(dp[i+1][2], dp[i][j] + (eo == 0 ? 0 : 1) + (a[i] == 0 ? 2 : 0));
      amin(dp[i+1][3], dp[i][j] + (eo == 0 ? 0 : 1) + (a[i] == 0 ? 2 : 0));
      amin(dp[i+1][4], dp[i][j]);
    }
    if (j == 1) {
      amin(dp[i+1][1], dp[i][j] + (eo == 1 ? 0 : 1));
      amin(dp[i+1][3], dp[i][j] + (eo == 0 ? 0 : 1) + (a[i] == 0 ? 2 : 0));
      amin(dp[i+1][4], dp[i][j]);
    }
    if (j == 2) {
      amin(dp[i+1][1], dp[i][j] + (eo == 1 ? 0 : 1));
      amin(dp[i+1][2], dp[i][j] + (eo == 0 ? 0 : 1) + (a[i] == 0 ? 2 : 0));
      amin(dp[i+1][4], dp[i][j]);
    }
    if (j == 3) {
      amin(dp[i+1][3], dp[i][j] + (eo == 0 ? 0 : 1) + (a[i] == 0 ? 2 : 0));
      amin(dp[i+1][4], dp[i][j] + (eo == 0 ? 0 : 1) + (a[i] == 0 ? 2 : 0));
    }
    if (j == 4) {
      amin(dp[i+1][4], dp[i][j] + a[i]);
    }
  }
  int ans = INF;
  amin(ans, dp[L][0]);
  amin(ans, dp[L][1]);
  amin(ans, dp[L][2]);
  amin(ans, dp[L][4]);
  cout << ans << endl;
}


Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    long long A[N];
    map <long long,long long> m;
    rep(i,N) {
        cin >> A[i];
        m[A[i]]++;
    }
    long long sum=0;
    for(auto P:m){
        sum+=P.second*(P.second-1)/2;
    }
    rep(i,N){
        long long x=m[A[i]];
        cout << sum-(x-1) << endl;
    }

}


Measured memory_bytes: 12928
#include <bits/stdc++.h>
typedef long long int ll;
#define endl '\n'
using namespace std;
ll fact[2005],fact_inverse[2005];
const ll mod=1e9+7;
ll power(ll x,ll y,ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;

    return (y%2 == 0)? p : (x * p) % m;
}
ll modInverse(ll a,ll mod)
{ ll ans= power(a, mod-2, mod);
return ans;
}
ll ncr(ll n,ll r){
    if(r==0 || n==r)return 1;
ll ans=fact[n];
ans=ans*fact_inverse[r];
ans%=mod;
ans=(ans+mod)%mod;
ans=ans*fact_inverse[n-r];
ans=ans%mod;
ans=(ans+mod)%mod;
return ans;
}
bool comp(pair<ll,ll>a,pair<ll,ll>b){
return (a.first+a.second)<(b.first+b.second);
}
bool comp1(pair<ll,ll>a,pair<ll,ll>b){
return (a.first-a.second)<(b.first-b.second);
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
     ll n;
     cin>>n;
     vector<pair<ll,ll> >a,b;
     for(ll i=1;i<=n;i++){
        ll x,y;
        cin>>x>>y;
        a.push_back({x,y});
        b.push_back({y,x});
     }
     sort(a.begin(),a.end(),comp);
     sort(b.begin(),b.end(),comp1);
     ll x=abs(a[0].first-a.back().first)+abs(a[0].second-a.back().second);
     ll y=abs(b[0].first-b.back().first)+abs(b[0].second-b.back().second);
     cout<<max(x,y)<<endl;
    return 0;
}

















Measured memory_bytes: 9768
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int N;
    std::cin >> N;
    std::vector<long> A(N + 1);
    std::vector<long> B(N);
    
    for (int i = 0; i < N + 1; i++) {
        std::cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        std::cin >> B[i];
    }
    
    long result = 0;
    for (int i = N - 1; i >= 0; i--) {
        if (A[i + 1] >= B[i]) {
            result += B[i];
            A[i + 1] = A[i + 1] - B[i];
            B[i] = 0;
        } else {
            result += A[i + 1];
            B[i] = B[i] - A[i + 1];
            A[i + 1] = 0;
        }
        
        if (A[i] >= B[i]) {
            result += B[i];
            A[i] = A[i] - B[i];
            B[i] = 0;
        } else {
            result += A[i];
            B[i] = B[i] - A[i];
            A[i] = 0;
        }
    }
    
    std::cout << result << std::endl;
}


Measured memory_bytes: 4828
N = int(input())

FN = [0] * 100

# 最初の数字*10 + 最後の数字のLUTを作成
for i in range(1, N+1):
  first_num = int(str(i)[0])
  last_num = i % 10
  FN[first_num*10 + last_num] += 1

#print(FN)
cnt = 0
for i, fn in enumerate(FN):
  if i < 11:
    continue
  rev = (i // 10) + (i % 10) * 10
  cnt += FN[rev] * fn
  #print(i, fn, FN[rev], cnt)

print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
        int a;
        cin >> a;
        return a;
};

void inputArray(int * p, int a){
        rep(i, a){
                cin >> p[i];
        }
};

void inputVector(vector<int> * p, int a){
        rep(i, a){
                int input;
                cin >> input;
                p -> push_back(input);
        }
}

template <typename T>
void output(T a, int precision) {
        if(precision > 0){
                cout << setprecision(precision)  << a << "\n";
        }
        else{
                cout << a << "\n";
        }
}

int main(int argc, const char * argv[]) {

        // source code
        ll n,m;
        n=inputValue();
        m=inputValue();
        vector<pair<ll,ll>> val;
        //a.reserve(n);
        //inc.reserve(n);
        //dec.reserve(n);

        rep(i,n)
        {
                val.emplace_back(1,inputValue());
        }

        rep(i,m)
        {
                ll b = inputValue();
                ll c = inputValue();
                val.emplace_back(b,c);
        }
        sort(val.begin(),val.end(),[](auto a,auto b){return a.second > b.second;});

        ll left=n;
        ll sum=0;
        for(auto p:val)
        {
                ll b = p.first;
                ll c = p.second;
                if(left > b)
                {
                        left -=b;
                        sum += b*c;
                }else{
                        sum += c*left;
                        break;
                }

        }


        output<long long>(sum,0);


        return 0;
}

Measured memory_bytes: 6384
'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function getArray(str) {
    return str.split(' ').map(x => Number(x));
}

function getInt(str) {
    return Number(str);
}

function getStrArray(str) {
    return str.split(' ').map(x => x);
}

function create2DArray(row, col, filler = 0) {
    return Array(row)
        .fill(filler)
        .map(() => Array(col).fill(filler));
}
// ---------------------------------------



function main() {
    let s1 = readline();
    let s2 = readline();  
    let l1 = s1.length;
    let l2 = s2.length;
    
    let dp = create2DArray(l1+1, l2+1, 0);

    for(let i=1; i<= s1.length; i++) {
        for (let j=1; j <= s2.length; j++) {
            if(s1[i-1] === s2[j-1]) {
                dp[i][j] = 1 + dp[i-1][j-1];
            } else {
                dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
            }
        }    
    }

    let s  = '';
    while(l1 > 0 && l2 >0) {
        if (s1[l1 - 1] === s2[l2-1]) {
            s = s1[l1-1]+s;
            l1--;
            l2--;
        } else {
            if(dp[l1 - 1][l2] > dp[l1][l2 - 1]) {
                l1--;
            } else {
                l2--;
            }
        }
    }
    console.log(s);
}

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

using namespace std;

int main() {
    std::string S;
    cin >> S;

    if (S == "Sunny") {
        cout << "Cloudy" << endl;
        return 0;
    }

    if (S == "Cloudy") {
        cout << "Rainy" << endl;
        return 0;
    }
    if (S == "Rainy") {
        cout << "Sunny" << endl;
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 256
x,k,d = map(int,input().split())
x = abs(x)
jud = x//d
if(k<=jud):
  print(abs(abs(x)-d*k))
else:
  if((k-jud)%2 == 1):
    print(abs(abs(x)-(jud+1)*d))
  else:
    print(abs(abs(x)-(jud)*d))


Measured memory_bytes: 9020
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int n,i,sum=0;
    double z,x,y,d;
    scanf("%d %lf",&n,&d);
    for(i=1;i<=n;i++)
    {
        scanf("%lf %lf",&x,&y);
        z=sqrt((x*x+y*y));
        if(z<=d)
            sum++;
    }
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 2216
import bisect

n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0

sa = sorted(a)
sc = sorted(c)

for x in b:
  ans += bisect.bisect_left(sa, x) * (n - bisect.bisect_right(sc, x))
print(ans)

Measured memory_bytes: 23232
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>

#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  int n;
  cin>>n;
  cout<<"ABC"<<n<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define f first
#define s second
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
typedef map<int,int> mii;
typedef unordered_map<int,int> umii;
typedef queue<int> qi;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	ll n; cin >> n;
	int k; cin>> k;
	ll sum = 0;
	for (int i = 1; i <= k; i ++) {
		int x; cin >> x;
		sum += x;
	}

	if (sum > n) cout << -1 << '\n';
	else cout << n - sum << '\n';
	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int a;
    cin >> a;
    if(a<1200)pr("ABC");
    else if(a<2800) pr("ARC");
    else pr("AGC");
}

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

int main() {
  int64_t H;
  cin >> H;
  int64_t times = 1;
  while (H > 1){
    H = H / 2;
    times = times * 2;
  }
  cout << times * 2 - 1 << endl;
}


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

typedef pair<int, int> P;

const int max_x = 2000000000;

int main(){
    int n;
    int ans = 0;
    cin >> n;
    vector <P> x_l;
    for (int i = 0; i < n; i ++){
        int x, l;
        cin >> x >> l;
        x_l.push_back(P(x - l, x + l));
    }

    sort(x_l.rbegin(), x_l.rend());
    
    auto kagen = max_x;
    for (int i = 0; i < n; i ++){
        if (kagen >= x_l[i].second){
            ans += 1;
            kagen = x_l[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  String str="00";
	  String nbefore="1";
	  int N,D,n,ans;
	  D=sc.nextInt();
	  N=sc.nextInt();
	  if(N==100) {
		  N=101;
	  }
	  for(int i=0;i<D;i++) {
		  nbefore=nbefore+str;

	  }
	  n=Integer.parseInt(nbefore);
	  ans=n*N;
	  System.out.println(ans);
  }
}


Measured memory_bytes: 21972
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

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

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n, w;
    cin >> n >> w;
    vector<P> wv(n);
    rep(i, n) cin >> wv[i].first >> wv[i].second;

    vector<vector<ll> > dp(n + 1, vector<ll>(w + 1, 0));

    rep(i, n) {
        rep(j, w + 1) {
            if (j - wv[i].first >= 0) chmax(dp[i + 1][j], dp[i][j - wv[i].first] + wv[i].second);
            chmax(dp[i + 1][j], dp[i][j]);
        }
    }
    
    cout << dp[n][w] << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 83104
#include <stdio.h>

int main()
{
    long long a,b,c,k,s;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
   if(k>=a) {
       s=a;
       k=k-a;
       if(k>=b) {
           k-=b;
           if(k>=c) {
               s-=c;
               k-=c;
           }
           else { s-=k; }
       }
   }
   else { s=k; }
   printf("%lld",s);

    return 0;
}

Measured memory_bytes: 1732
#include<stdio.h>
int main(){
 int r,n;
 scanf("%d",&n);
 r=n%10;
 if(r==3){printf("bon\n");}
 else if(r==0||r==1||r==6||r==8){
        printf("pon\n");
 }
 else if(r==2||r==4||r==5||r==7||r==9){
        printf("hon\n");
 }
return 0;
 }


Measured memory_bytes: 1648
#include <stdio.h>
  
int main(void){
  
  int H,W;
  register int i,s;
  
  while(1){
    scanf("%d %d",&H,&W);
    if((H == 0) & (W == 0)){
      break;
    }
    for(i = 0;i < H;i++){
      for(s = 0;s < W;s++){
        if(((i == 0) | (i == (H - 1))) | (((s == 0) | (s == (W - 1))))){
          printf("#");
        }else{
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

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

int main() {
    const char* numberSegments[] = {
        "0111111", "0000110", "1011011", "1001111", "1100110", "1101101", "1111101", "0100111", "1111111", "1101111",
    };
    while (true) {
        int n;
        cin >> n;
        if (n == -1) {
            break;
        }
        char number[] = "0000000";
        for (int i = 0; i < n; i++) {
            int a;
            cin >> a;
            char output[9] = {};
            for (int j = 0; j < (int) (sizeof number / sizeof *number) - 1; j++) {
                if (number[j] == numberSegments[a][j]) {
                    output[j] = '0';
                } else {
                    number[j] = numberSegments[a][j];
                    output[j] = '1';
                }
            }
            cout << output << endl;
        }
    }
}

Measured memory_bytes: 0
N = int(input())
A = [int(i) for i in input().split()]

a = [20000*i+1 for i in range(N)]
b = [20000*(N-i) for i in range(N)]

for i in range(N):
  a[A[i]-1] += i

a = [str(i) for i in a]
b = [str(i) for i in b]

print(" ".join(a))
print(" ".join(b))

Measured memory_bytes: 8424
A, B, C = map(int, input().split())
K = int(input())

c = 0
while A >= B:
    B *= 2
    c += 1
    if c > K:
        print('No')
        quit()

while B >= C:
    C *= 2
    c += 1
    if c > K:
        print('No')
        quit()

print('Yes')

Measured memory_bytes: 9060
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
int r[100];
int c[100];
int dp[100][100];
int main(void){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> r[i] >> c[i];
  }

  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      dp[i][j] = INT_MAX;
    }
  }
  for(int i = 0; i < n; i++){
    dp[i][i] = 0;
  }

  for(int i = 1; i < n; i++){
    for(int j = 0; j <= n - i - 1; j++){
      for(int k = j; k < j + i; k++){
        dp[j][j + i] = min(dp[j][j + i], dp[j][k] + dp[k + 1][j + i] + r[j] * c[k] * c[j + i]);
      }
    }
  }
  cout << dp[0][n - 1] << endl;
  return 0;
}


Measured memory_bytes: 3128
building = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
x = [list(map(int,input().split())) for _ in range(n)]

for i in range(len(x)):
    b = x[i][0]-1
    f = x[i][1]-1
    r = x[i][2]-1
    v = x[i][3]
    building[b][f][r] += v

for i in range(4):
    for i2 in range(3):
        print(' '+' '.join(map(str,building[i][i2])))
    if i < 3:
        print('#'*20)


Measured memory_bytes: 5612
#include <stdio.h>
#define N 55
int n, m, q, i, j, k, ans=0, a[N], b[N], c[N], d[N], t[N];
void tai(){
	int s=0;
	for(i=1; i<=q; i++){
		if(t[b[i]]-t[a[i]] == c[i]) s += d[i];
	}
	if(s > ans) ans = s;
}
void dfs(int k){
	int i;
	if(k > n){
		tai();
		return;
	}
	for(i=t[k-1]; i<=m; i++){
		t[k] = i;
		dfs(k+1);
	}
}
int main(){
	scanf("%d%d%d", &n, &m, &q);
	for(i=1; i<=q; i++){
		scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);
	}
	dfs(t[0] = 1);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1692
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

string dat[6] = 
{"..rr....", "..rr....", "ggyybbww", "ggyybbww", "..oo....", "..oo...."};

void funcU(){
	string tmp[6];
	for(int i=0;i<6;i++) tmp[i] = dat[i];
	dat[2][0] = tmp[2][2];
	dat[2][1] = tmp[2][3];
	dat[2][2] = tmp[2][4];
	dat[2][3] = tmp[2][5];
	dat[2][4] = tmp[2][6];
	dat[2][5] = tmp[2][7];
	dat[2][6] = tmp[2][0];
	dat[2][7] = tmp[2][1];
	dat[0][2] = tmp[1][2];
	dat[1][2] = tmp[1][3];
	dat[1][3] = tmp[0][3];
	dat[0][3] = tmp[0][2];
}

void funcF(){
	string tmp[6];
	for(int i=0;i<6;i++) tmp[i] = dat[i];
	dat[1][2] = tmp[3][1];
	dat[1][3] = tmp[2][1];
	dat[2][1] = tmp[4][2];
	dat[3][1] = tmp[4][3];
	dat[4][2] = tmp[3][4];
	dat[4][3] = tmp[2][4];
	dat[2][4] = tmp[1][2];
	dat[3][4] = tmp[1][3];
	dat[2][2] = tmp[3][2];
	dat[3][2] = tmp[3][3];
	dat[3][3] = tmp[2][3];
	dat[2][3] = tmp[2][2];
}

void funcR(){
	string tmp[6];
	for(int i=0;i<6;i++) tmp[i] = dat[i];
	dat[0][3] = tmp[2][3];
	dat[1][3] = tmp[3][3];
	dat[2][3] = tmp[4][3];
	dat[3][3] = tmp[5][3];
	dat[4][3] = tmp[3][6];
	dat[5][3] = tmp[2][6];
	dat[2][6] = tmp[1][3];
	dat[3][6] = tmp[0][3];
	dat[2][4] = tmp[3][4];
	dat[3][4] = tmp[3][5];
	dat[3][5] = tmp[2][5];
	dat[2][5] = tmp[2][4];
}

void funcD(){
	string tmp[6];
	for(int i=0;i<6;i++) tmp[i] = dat[i];
	dat[3][0] = tmp[3][6];
	dat[3][1] = tmp[3][7];
	dat[3][2] = tmp[3][0];
	dat[3][3] = tmp[3][1];
	dat[3][4] = tmp[3][2];
	dat[3][5] = tmp[3][3];
	dat[3][6] = tmp[3][4];
	dat[3][7] = tmp[3][5];
	dat[4][2] = tmp[5][2];
	dat[5][2] = tmp[5][3];
	dat[5][3] = tmp[4][3];
	dat[4][3] = tmp[4][2];
}

void funcB(){
	string tmp[6];
	for(int i=0;i<6;i++) tmp[i] = dat[i];
	dat[0][2] = tmp[2][5];
	dat[0][3] = tmp[3][5];
	dat[2][5] = tmp[5][3];
	dat[3][5] = tmp[5][2];
	dat[5][2] = tmp[2][0];
	dat[5][3] = tmp[3][0];
	dat[2][0] = tmp[0][3];
	dat[3][0] = tmp[0][2];
	dat[2][6] = tmp[3][6];
	dat[3][6] = tmp[3][7];
	dat[3][7] = tmp[2][7];
	dat[2][7] = tmp[2][6];
}

void funcL(){
	string tmp[6];
	for(int i=0;i<6;i++) tmp[i] = dat[i];
	dat[0][2] = tmp[3][7];
	dat[1][2] = tmp[2][7];
	dat[2][7] = tmp[5][2];
	dat[3][7] = tmp[4][2];
	dat[4][2] = tmp[2][2];
	dat[5][2] = tmp[3][2];
	dat[2][2] = tmp[0][2];
	dat[3][2] = tmp[1][2];
	dat[2][0] = tmp[3][0];
	dat[3][0] = tmp[3][1];
	dat[3][1] = tmp[2][1];
	dat[2][1] = tmp[2][0];
}

int main(){
	string in;
	cin >> in;
	for(int i=0;i<in.size();i++){
		if(in[i] == 'U') funcU();
		else if(in[i] == 'F') funcF();
		else if(in[i] == 'R') funcR();
		else if(in[i] == 'D') funcD();
		else if(in[i] == 'B') funcB();
		else if(in[i] == 'L') funcL();
	}
	for(int i=0;i<6;i++) cout << dat[i] << endl;
	return 0;
}

Measured memory_bytes: 1192
import java.util.*;


public class Main {

  public static long cal(long S1, long S2, long S3){
    return Math.max(Math.abs(S1-S2), Math.max(Math.abs(S2-S3), Math.abs(S3-S1)));
  }

  public static long search(long H, long W){
    long min = Long.MAX_VALUE;
    for(int h = 1; h < H; h++){
      long S1 = h * W;
      long H1 = H - h;

      // case 1
      long H2 = H1/2;
      long H3 = H1 - H2;
      long S2 = H2 * W;
      long S3 = H3 * W;
      long score = cal(S1, S2, S3);
      if (score < min){
        min = score;
      }

      // case 2
      long W2 = W/2;
      long W3 = W - W2;
      S2 = H1 * W2;
      S3 = H1 * W3;
      score = cal(S1, S2, S3);
      if (score < min){
        min = score;
      }
    }
    return min;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long H = sc.nextLong();
    long W = sc.nextLong();
    System.out.println(Math.min(search(H, W), search(W, H)));
  }
}

Measured memory_bytes: 23764
import java.util.*;

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

        int num = sc.nextInt();//S(N)
        int lon = num;
        int sum = 0;  //numの各位の和

        while(num > 0){
            sum += num % 10;
            num /= 10;
        }

        if(lon % sum == 0){
            System.out.println("Yes");
        }else 
            System.out.println("No");
    }
}

Measured memory_bytes: 21844
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  var params = inputs.split('\n')[0].split(' ').map(Number);
(function(a,b,c){
    if (a < b && b < c) {
        console.log('Yes');
    }else{
        console.log('No');
    }

}(params[0],params[1],params[2])); 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7380
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
    public static String process(int K) {
        final int sum = IntStream.range(1, K + 1)
                .map(i -> ((K - i) + 1) / 2)
                .sum();

        return String.valueOf(sum);
    }

    // Util Func

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

        // process
        final String result = process(K);

        // output
        System.out.println(result);
    }
}

Measured memory_bytes: 27988
#include<bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int, int>pi;
vector<pi>vec, v;
vector<int>cnt;
int main()
{
    int t1=0, f1= 0, x= 1000000000;
    while(!(x%2))x/= 2, t1++;
    while(!(x%5))x/= 5, f1++;
    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        double d;
        scanf("%lf", &d);
        d*= 1000000000.0;
        d+= .5;
        ll x= d;
        int t= 0, f= 0;
        while(!(x%2))x/= 2, t++;
        while(!(x%5))x/= 5, f++;
        vec.push_back({t-t1, f-f1});
    }
    sort(vec.begin(), vec.end());
    for(int i=0; i<n; i++)
    {
        pi p= vec[i];
        int c= 0;
        while(i<n && vec[i]==p)i++, c++;
        i--;
        v.push_back(p);
        cnt.push_back(c);
    }
    ll res= 0;
    for(int i=0; i<v.size(); i++)
    for(int j=0; j<v.size(); j++)
    if((v[i].first+v[j].first)>=0 && (v[i].second+v[j].second)>=0)
    res+= 1ll*(cnt[i]-(i==j))*cnt[j];
    res/= 2;
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 5424
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
  int N,*a;
  int cost,MIN=10000000;
    
  scanf("%d",&N);
  a=(int*)malloc(sizeof(int)*N);
  for(int i=0;i<N;i++)
    scanf("%d",&a[i]);

  for(int i=-100;i<=100;i++){
    cost=0;
    for(int j=0;j<N;j++){
      cost+=pow(a[j]-i,2);
    }
    if(MIN>cost) MIN=cost;
  }
  printf("%d",MIN);
    
  return 0;
}

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

typedef long long ll;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a,b;
  cin>>a>>b;
  if(b%a)
  {
    cout<<b-a<<endl;
  }
  else
  {
    cout<<b+a<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
const rl = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});

rl.on('line', function (line) {
	var ary = line.split(' ');
	var a = Number(ary[0]), b = Number(ary[1]);
	console.log('%d %d', gcd(a, b), lcm(a, b));
});

function gcd(a, b) {
	while (a !== b) {
		if (a < b) {
			var tmp = a;
			a = b;
			b = tmp;
		}
		if (a % b === 0) return b;
		a -= b;
	}
	return a;
}

function lcm(a, b) {
	var g = gcd(a, b);
	return g * (a / g) * (b / g);
}

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


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

  int max,min;
  max = N;
  min = 0;

  int ans = 0;

  int L[M];
  int R[M];

  for(int i=0;i<M;i++){
    cin >> L[i] >> R[i];
  }

  for(int i=0;i<M;i++){
    if(max > R[i])max = R[i];
    if(min < L[i])min = L[i];
  }

  if(max - min < 0)ans = 0;
  else ans = max-min+1;

  cout << ans << endl;
}


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

import sys


def assign_color():
    _color = 1
    for m in range(vertices_num):
        if vertices_status_list[m] == -1:
            graph_dfs(m, _color)
            _color += 1
    return None


def graph_dfs(vertex, color):
    vertices_stack = list()
    vertices_stack.append(vertex)
    vertices_status_list[vertex] = color
    while vertices_stack:
        current_vertex = vertices_stack[-1]
        vertices_stack.pop()
        for v in adj_list[current_vertex]:
            if vertices_status_list[v] == -1:
                vertices_status_list[v] = color
                vertices_stack.append(v)
    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num, relation_num = map(int, _input[0].split())

    relation_info = _input[1:relation_num + 1]

    question_num = int(_input[relation_num + 1])
    question_list = _input[relation_num + 2:]

    adj_list = [[] for _ in range(vertices_num)]
    vertices_status_list = [-1] * vertices_num

    for relation in relation_info:
        key, value = map(int, relation.split())
        adj_list[key].append(value)
        adj_list[value].append(key)

    assign_color()

    # print(adj_list)
    for question in question_list:
        start, target = map(int, question.split())
        if vertices_status_list[start] == vertices_status_list[target]:
            print("yes")
        else:
            print("no")

Measured memory_bytes: 35764
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */


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

    int n; cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i, n) cin >> a[i] >> b[i] >> c[i];

    vector<vector<ll>> dp(n+5, vector<ll>(3, 0));
    rep(i, n){
        dp[i+1][0] = max(dp[i][1], dp[i][2])+a[i];
        dp[i+1][1] = max(dp[i][2], dp[i][0])+b[i];
        dp[i+1][2] = max(dp[i][0], dp[i][1])+c[i];
    }

    ll ans=0;
    rep(j, 3) chmax(ans, dp[n][j]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8064