akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD NUM000007
#define EPS 0.0000001
#define NUM 30000
using namespace std;

struct Info{
	double x,r;
};

double calc_dist(double left_x,double left_y,double right_x,double right_y){
	return sqrt((left_x-right_x)*(left_x-right_x)+(left_y-right_y)*(left_y-right_y));
}

int main(){

	int N;
	double tmp_r,tmp,maximum;
	double left,right,m,dist,tmp_loc;
	Info info[501];

	scanf("%d",&N);
	scanf("%lf",&tmp_r);
	info[0].x = tmp_r;
	info[0].r = tmp_r;


	for(int i = 1; i <= N-1; i++){

		scanf("%lf",&tmp_r);

		info[i].r = tmp_r;
		maximum = 0;
		for(int k = 0; k < i; k++){

			left = info[k].x;
			right = info[k].x+info[k].r+tmp_r;
			m = (left+right)/2;

			dist = info[k].r+tmp_r;

			while(left<=right){
				tmp = calc_dist(info[k].x,info[k].r,m,tmp_r);

				if(abs(dist-tmp) < EPS){ //OK
					tmp_loc = m;
					if(tmp_loc < tmp_r)tmp_loc = tmp_r;
					break;
				}else{
					if(tmp > dist){
						right = m-EPS;
					}else{
						left = m+EPS;
					}
				}
				m = (left+right)/2;
			}
			maximum = max(maximum,tmp_loc);
		}
		info[i].x = maximum;
	}

	maximum = 0.0;
	for(int i = 0; i < N; i++)maximum = max(maximum,info[i].x+info[i].r);

	printf("%.8lf\n",maximum);

	return 0;
}

Measured memory_bytes: 2756
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String S = in.next();
			for(int i = S.length() - 2;  i >= 0; i -= 2) {
				if(S.substring(0, i / 2).equals((S.substring(i / 2, i)))){
					out.println(i);
					break;
				}
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,n;cin>>a>>b>>n;
    ll k = min(n, b-1);
    cout<< a*k/b - a*(k/b) <<endl;

}

Measured memory_bytes: 3660
import math
import collections
import sys

input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

n=I()
s=input()
r=[]
g=[]
t=[]
for i in range(n):
    if s[i:i+1]=="R":
        r.append(i)
    elif s[i:i+1]=="G":
        g.append(i)
    else:
        t.append(i)
R=len(r)
G=len(g)
T=n-R-G
ans=R*G*T
for i in range(n-1):
    for j in range(i+1,n):
        if s[i]!=s[j]:
            if j<2*i-j<=n-1:
                if s[i]!=s[2*i-j] and s[j]!=s[2*i-j]:
                    ans-=1
            if j<2*j-i<=n-1:
                if s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
                    ans-=1
            if (i+j)%2==0 and j<(i+j)//2 and s[i]!=s[(i+j)//2] and s[j]!=s[(i+j)//2]:
                ans-=1
print(ans)

Measured memory_bytes: 68872
#include <iostream>
#include <string>

using namespace std;

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

  for (int i = 0; i < S.length(); i++) {
    if (i % 2 == 0) {
      // 奇数の場合
      switch (S[i]) {
        case 'R':
        case 'U':
        case 'D':
          break;
        default:
          cout << "No" << endl;
          return 0;
      }
    } else {
      switch (S[i]) {
        case 'L':
        case 'U':
        case 'D':
          break;
        default:
          cout << "No" << endl;
          return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define mp make_pair

#define F first
#define S second

using ll = long long;
using namespace std;

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

const int mod = 1000000007;
const int INF = 1e+9;

int main() {
    int n; cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }

    sort(d.begin(), d.end());
    int l = d[(n/2)-1];
    int r = d[(n/2)];
	cerr << l << r << endl;
    if (l == r) cout << 0 << endl;
    else cout << r - l  << endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define mod 1000000007
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
typedef long long ll;

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


int a,b,c;
main()
{
        cin>>a>>b>>c;
        for(int i=a;i<=a*b;i+=a)
        {
                if(i%b==c)
                {
                        cout<<"YES"<<endl;
                        return 0;
                }
        }
        cout<<"NO"<<endl;
}

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

typedef unsigned long long int li;

void sort( int *a )
{
    for( int i = 0; i < 2; i++ )
        for( int j = 0; j < 3; j++ )
            if( a[i] > a[j] )
            {
                int temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
}

li factorial( int a )
{
    if( a <= 1 )
        return 1;
    return a * factorial( a - 1 );
}

int main()
{
    int n, m[3];
    
    while( cin >> n )
    {
        if( n == 0 )
            break;

        li sum = 0;
        int a = n / 3, b = n / 2, c = n;

        for( int i = 0; i <= a; i++ )
            for( int j = 0; j <= b; j++ )
                for( int k = 0; k <= c; k++ )
                    if( 3 * i + 2 * j + k == n )
                    {
                        m[0] = i;
                        m[1] = j;
                        m[2] = k;
                        sort(m);
                        li r = 1;
                        for( int p = 0; p < i + j + k - m[2]; p++ )
                            r *= i + j + k - p;
                        sum += r / ( factorial(m[0]) * factorial(m[1]) );
                    }
                        
    
        //cout << sum << endl;

        if( sum % 10 == 0 )
            sum /= 10;
        else
            sum = sum / 10 + 1;
        
        if( sum % 365 == 0 )
            sum /= 365;
        else
            sum = sum / 365 + 1;

        cout << sum << endl;
    }
    return 0;
}


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

int imp_A(int);
int imp_B(int, int);

/*
「各ステップに対して次に書かれる数をできるだけ小さくするようにする」ことを繰り返す。

貪欲法(Greedy Algorithm)
・・・次の状態の値を最適にすることだけを考えるという方法
*/


int main(void) {
    int N, K;
    cin >> N >> K;
    int num = 1;  // 初期値

    // N が1以上、Kが正の数
    for (int i = 0; i < N; i++) {
        if (imp_A(num) < imp_B(num, K)) {
            num = imp_A(num);
        } else {
            num = imp_B(num, K);
        }
    }
    cout << num << endl;
    
    return 0;
}

int imp_A(int num) {
    return num * 2;
}

int imp_B(int num, int K) {
    return num + K;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int K;
	string S;
	cin >> K >> S;

	if (K >= S.length()) {
		cout << S << endl;
	}
	else {
		for (int i = 0; i < K; i++) {
			cout << S.at(i);
		}
		cout << "..." << endl;
	}
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	double l;
	cin>>l;
	printf("%.7f",(l*l*l)/27.0);
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n,k;
    cin >> n >> k;

    int a,b;
    a = n % k;
    b = abs(a - k);

    cout << min(a,b) << endl;
}


Measured memory_bytes: 256
// finish date: 2019/07/21

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N;
    ll K;
    cin >> N >> K;
    vi A(N);
    map<int, vi> mp;
    rep(i, N) {
        cin >> A[i];
        mp[A[i]].emplace_back(i);
    }
    int cnt = 0;
    int idx = 0;
    do {
        auto Iter = upper_bound(mp[A[idx]].begin(), mp[A[idx]].end(), idx);
        if (Iter == mp[A[idx]].end()) {
            cnt++;
            idx = mp[A[idx]][0];
        } else {
            idx = *Iter;
        }
        idx++;
        idx = idx % N;
    } while (idx != 0);
    cnt++;

    ll res = K % (ll) cnt;
    if (res == 0) return 0;
    cnt = 0;
    while (cnt != res - 1) {
        auto Iter = upper_bound(mp[A[idx]].begin(), mp[A[idx]].end(), idx);
        if (Iter == mp[A[idx]].end()) {
            cnt++;
            idx = mp[A[idx]][0];
        } else {
            idx = *Iter;
        }
        idx++;
//        idx = idx % N;
    }

    vi s(N, INF);
    map<int, int> idx_mp;
    int temp = 0;
    FOR(a, idx, N) idx_mp[A[a]] = INF;
    FOR(a, idx, N) {
        if (temp <= idx_mp[A[a]]) {
            s[temp] = A[a];
            idx_mp[A[a]] = temp;
            temp++;
        } else {
            int place = idx_mp[A[a]];
            FOR(i, idx_mp[A[a]], temp) idx_mp[s[i]] = INF;
            temp = place;

//            idx_mp.erase(A[a]);
        }
    }
    rep(i, temp) {
        cout << s[i] << " ";
    }
    cout << endl;


    return 0;
}


Measured memory_bytes: 34304
def getlist():
	return list(map(int, input().split()))

N, M = getlist()
xyz = []
for i in range(N):
	xyz.append(getlist())

ans = -float("inf")
for i in range(8):
	L = []
	for k in range(N):
		x = 0
		for j in range(3):
			if ((i >> j) & 1) == 1:
				x += xyz[k][j]
			else:
				x -= xyz[k][j]
		L.append(x)
	L = sorted(L)
	v = 0
	for n in range(M):
		v += L[-1 - n]
	if v > ans:
		ans = v

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    rep(i, 0, (ll)s.size()) {
        if (i % 2 == 0 && s[i] == 'p') ans--;
        if (i % 2 == 1 && s[i] == 'g') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
# frozen_string_literal: true

class Dice
  def initialize(params)
    @v = Array.new(6)
    (0..5).each do |i|
      @v[i] = params[i]
    end
    @phases = []
  end

  def faces
    @v
  end

  def slide(side_a, side_b, side_c, side_d)
    tmp = @v[side_a]
    @v[side_a] = @v[side_b]
    @v[side_b] = @v[side_c]
    @v[side_c] = @v[side_d]
    @v[side_d] = tmp
  end

  def rotate_atom(char)
    case char
    when 'N' then slide(0, 1, 5, 4)
    when 'E' then slide(0, 3, 5, 2)
    when 'W' then slide(0, 2, 5, 3)
    when 'S' then slide(0, 4, 5, 1)
    when 'D' then slide(1, 3, 4, 2)
    when 'U' then slide(1, 2, 4, 3)
    end
  end

  def rotate(string)
    string.chars.each do |c|
      rotate_atom(c)
    end
  end

  def top
    @v[0]
  end

  def register_phase
    4.times do
      @phases << Marshal.load(Marshal.dump(@v))
      rotate_atom('D')
    end
  end

  def register
    4.times do
      register_phase
      rotate_atom('S')
    end
    rotate_atom('W')
    register_phase
    rotate_atom('E')
    rotate_atom('E')
    register_phase
    rotate_atom('W')
  end

  def same_dice?(dice_y)
    register if @phases.empty?
    if dice_y.is_a?(Array)
      @phases.include?(dice_y)
    elsif dice_y.is_a?(Dice)
      @phases.include?(dice_y.faces)
    end
  end
end

n = gets.to_i
dices = n.times.map { Dice.new(readline.split(' ')) }
unique = (1...n).all? do |i|
  (0...i).all? { |j| !dices[i].same_dice?(dices[j]) }
end
puts unique ? 'Yes' : 'No'



Measured memory_bytes: 8940
A, B, K = map(int, input().split())
s = set()

for i in range(A, min(A+K, B+1)):
    s.add(i)
for i in range(max(B-K+1,A), B+1):
    s.add(i)
S=list(sorted(s))
for i in range(len(S)):
    print(S[i])

Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <queue>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int main() {
  int X, Y, A, B, C;
  std::cin >> X >> Y >> A >> B >> C;
  std::vector<int> P(A), Q(B), R(C);
  for (int &x: P) {
    std::cin >> x;
  }
  for (int &x: Q) {
    std::cin >> x;
  }
  for (int &x: R) {
    std::cin >> x;
  }
  std::sort(P.rbegin(), P.rend());
  std::sort(Q.rbegin(), Q.rend());
  std::sort(R.rbegin(), R.rend());
  long long ans = 0;
  for (int i: range(0, X)) {
    ans += P[i];
  }
  for (int i: range(0, Y)) {
    ans += Q[i];
  }
  int p = X - 1, q = Y - 1;
  for (int i: range(0, C)) {
    if (p == -1) {
      if (q >= 0 && R[i] > Q[q]) {
        ans += R[i];
        ans -= Q[q];
        --q;
      }
    }
    else if (q == -1) {
      if (p >= 0 && R[i] > P[p]) {
        ans += R[i];
        ans -= P[p];
        --p;
      }
    }
    else {
      if (P[p] < Q[q]) {
        if (R[i] > P[p]) {
          ans += R[i];
          ans -= P[p];
          --p;
        }
      }
      else {
        if (R[i] > Q[q]) {
          ans += R[i];
          ans -= Q[q];
          --q;
        }
      }
    }
  }
  std::cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 1408
N, K = map(int, input().split())
P = 10 ** 9 + 7
X = [0] * (K + 1)
ans = 0
for i in range(1, K + 1):
    s = i
    X[i] += i
    for j in range(i * 2, K+1, i):
        X[j] -= X[i]
    ans += X[i] * pow(K//i, N, P)
print(ans % P)

Measured memory_bytes: 12680
#include <bits/stdc++.h>
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
 
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
 
void solve(){
 
    lli ans = 0;
    priority_queue<pair<lli,lli>> q;
    priority_queue<pair<lli,lli>,vector<pair<lli,lli>>,greater<pair<lli,lli>>> qq;
 
    lli n;
    cin>>n;
    REP(i,0,n){
        lli k,l,r;
        cin>>k>>l>>r;
        if(l-r>0){
            q.push({k,l-r});
            ans += r;
        }
        else{
            qq.push({k,r-l});
            ans += l;
        }
    }
 
    lli now = 0;
 
    multiset<lli,greater<lli>> s;
    lli cnt = 0;
    for(lli i=n;i>=1;i--){
        while(q.size() && q.top().first >= i){
            s.insert(q.top().second);
            q.pop();
        }
        if(s.size()==0)continue;
        ans += (*s.begin());
        s.erase(s.begin());
    }
 
    s.clear();
    for(lli i=cnt+1;i<=n;i++){
        while(qq.size() && qq.top().first < i){
            s.insert(qq.top().second);
            qq.pop();
        }
        if(s.size()==0)continue;
        ans += (*s.begin());
        s.erase(s.begin());
    }
    cout<<ans<<endl;
 
}
 
 
int main(){
 
    lli t;
    cin>>t;
    while(t--)solve();
 
    return 0;
}

Measured memory_bytes: 7228
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
  long long int n,a,b,i,ans;
  scanf("%lld %lld %lld",&n,&a,&b);
  vector <int>x(n);
  ans=0;
  for (i=0;i<n;i++){
    scanf("%d",&x[i]);
    if (i>0){
      ans+=min(a*(x[i]-x[i-1]),b);
    }
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[100100], b[100100];

ll solve() {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) vec[i] = i;
    sort(ALL(vec), [](int v, int u){ return a[v]+b[v]>a[u]+b[u]; });

    ll s = 0, t = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            s += a[vec[i]];
        } else {
            t += b[vec[i]];
        }
    }
    return s - t;
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
}

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

    input();
    cout << solve() << endl;
}


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

using namespace std;

#define int long long

const int N = 2e5 + 100;

int a[N], b[N], arr[N];
int n, t;

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
	cin >> a[i] >> b[i];
	arr[i] = i;
    }
    sort(arr, arr + n, [&] (int i, int j) {return b[i] < b[j];});
    for (int o = 0; o < n; o++) {
	int i = arr[o];
	if (t + a[i] > b[i])
	    return cout << "No", 0;
	t += a[i];
    }
    return cout << "Yes", 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int Q;
const int MAX_LR = 100100;
bool prime[MAX_LR];
void sieve() {

  for (int i = 2; i < MAX_LR; i++) {
    prime[i] = true;
  }
  for (int i = 2; i < MAX_LR; i++) {
    if (prime[i]) {
      for (int j = 2 * i; j < MAX_LR; j += i) {

        prime[j] = false;
      }
    }
  }
}
int res[MAX_LR];
int main() {
  sieve();
  // cerr << "hoge" << endl;
  cin >> Q;
  for (int i = 2; i < MAX_LR; i++) {
    res[i] += res[i-1];
    if (not prime[i] or i % 2 == 0) {
      continue;
    }
    if (prime[i] and prime[(i + 1) / 2]) {
      res[i]++;
    }

  }
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    cout << res[r] - res[l - 1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1152
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int MOD=998244353;

ll qexp(ll b,ll p,int m){
    ll res=1;
    while (p){
        if (p&1) res=(res*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return res;
}

ll inv(ll i){
	return qexp(i,MOD-2,MOD);
}

ll fac[2000005];
ll ifac[2000005];

ll nCk(int i,int j){
	if (i<j) return 0; //big bruh	
	
	return fac[i]*ifac[j]%MOD*ifac[i-j]%MOD;
}

ll fix(ll i){
	i%=MOD;
	
	if (i<0) i+=MOD;
	
	return i;
}

ll dist(int i,int j){ //distribute j things among i ppl
	return nCk(i+j-1,i-1);
}

int n,m;

ll comp[1000005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	fac[0]=1;
	rep(x,1,2000005) fac[x]=fac[x-1]*x%MOD;
	rep(x,0,2000005) ifac[x]=inv(fac[x]);
	
	cin>>n>>m;
	
	comp[0]=n*dist(n-1,0)%MOD;
	rep(x,1,1000005) comp[x]=(comp[x-1]+n*dist(n-1,x))%MOD;
	
	ll ans=0;
	for (int x=m;x>=0;x-=2) if (x<=n){
		int k=(3*m-x)/2;
		//cout<<k<<" "<<x<<endl;
		
		//each number is form 2A+B
		
		//case 1: there exists a number with A=m
		ans=fix(ans+n*dist(n-1,k-m)%MOD*nCk(n-1,x));
		
		//case 2: bigest number <2m
		ans=fix(ans+(dist(n,k)-comp[k-m])*nCk(n,x));
	
		//cout<<ans<<endl;
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 42720
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> p;
typedef unsigned long long int ull;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
ll MOD=1e9+7;

ll power(ll a,ll x){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%13;
        a=a*a%13;
        x>>=1;
    }
    return res;
}
int n;
ll f(ll x,int c3,int c5,int c7){
    if(x>=n) return 0;
    ll res=0;
    if(c3>0&&c5>0&&c7>0) res+=1;
    res+=f(x*10+3,c3+1,c5,c7);
    res+=f(x*10+5,c3,c5+1,c7);
    res+=f(x*10+7,3,c5,c7+1);
    return res;
}

vector<int> calc(vector<int> a){
    int n=(int)a.size();
    vector<int> sum(n+1,0);
    for(int i=0;i<n;i++){
        int l=max(0,i-a[i]);
        int r=min(n-1,i+a[i]);
        sum[l]++;
        sum[r+1]--;
    }
    for(int i=0;i<n;i++){
        sum[i+1]+=sum[i];
    }
    vector<int> res(n);
    for(int i=0;i<n;i++) res[i]=sum[i];
    return res;
    
}

int main(){
    int n,k;cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int q=0;q<min(k,100);q++){
        a=calc(a);
    }
    for(int i=0;i<n;i++){
        cout<<a[i];
        if(i<n-1) cout<<' ';
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 6368
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

const int maxn = 5005;
const lli inf = 1e18 + 1;

int n, k;
int p[maxn], c[maxn];

int deg[maxn];
bool vis[maxn];
int cnt = 0;
int lab[maxn];
lli sum[maxn];
vector<int> vtx[maxn];

void read_input()
{
    cin >> n >> k;
    for(int i = 1; i <= n; ++i)
        cin >> p[i];
    for(int i = 1; i <= n; ++i)
        cin >> c[i];
}

void init()
{
    for(int i = 1; i <= n; ++i)
        ++deg[p[i]];
    queue<int> q;
    for(int i = 1; i <= n; ++i)
        if(deg[i] == 0) q.push(i);
    while(!q.empty())
    {
        int u = q.front(); q.pop();
        vis[u] = true;
        int v = p[u];
        --deg[v];
        if(deg[v] == 0) q.push(v);
    }
    for(int i = 1; i <= n; ++i)
    {
        if(vis[i]) continue;
        int cur = i;
        ++cnt;
        sum[cnt] = 0;
        while(!vis[cur])
        {
            vtx[cnt].push_back(cur);
            vis[cur] = true;
            lab[cur] = cnt;
            cur = p[cur];
            sum[cnt] += c[cur];
        }
    }
}

void solve()
{
    lli ans = -inf;
    for(int i = 1; i <= n; ++i)
    {
        int cur = p[i], lft = k - 1;
        lli tot = c[cur], mx = c[cur];
        while(lab[cur] == 0 && lft > 0)
        {
            int nxt = p[cur];
            tot += c[nxt];
            mx = max(mx, tot);
            cur = nxt;
        }
        if(lft == 0)
        {
            ans = max(ans, mx);
            continue;
        }
        if(sum[lab[cur]] <= 0)
        {
            lli now = 0, tot2 = 0;
            int temp = min(lft, sz(vtx[lab[cur]]));
            while(temp--)
            {
                int nxt = p[cur];
                tot2 += c[nxt];
                now = max(now, tot2);
                cur = nxt;
            }
            ans = max(ans, mx + now);
        }
        else
        {
            mx += sum[lab[cur]] * (lft / sz(vtx[lab[cur]]));
            lft %= sz(vtx[lab[cur]]);
            int temp = min(lft, sz(vtx[lab[cur]]));
            lli now = 0, tot2 = 0;
            while(temp--)
            {
                int nxt = p[cur];
                tot2 += c[nxt];
                now = max(now, tot2);
                cur = nxt;
            }
            ans = max(ans, mx + now);
        }
    }
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    init();
    solve();
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int x;
    cin>>x;
    int ma=0;
    REP(i,1,32){
        int a=i;
        REP(j,10){
            a*=i;
            if(a>x)break;
            if(a<=x){
                chmax(ma,a);
            }
        }
    }
    cout<<ma<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int W, H, N;
    cin >> W >> H >> N;
    vector<int> x(N), y(N), a(N);
    for (int i =0; i < N; i++)
    {
        cin >> x.at(i);
        cin >> y.at(i);
        cin >> a.at(i);
    }
    vector<int> P(2), Q(2);
    P[0] = 0; 
    P[1] = 0;
    Q[0] = W; 
    Q[1] = H;
    for(int i = 0; i < N; i++)
    {
        if(a[i] == 1 && P[0] <= x[i])
        {
            P[0] = x[i];
        }
        else if(a[i] == 2 && Q[0] >= x[i])
        {
            Q[0] = x[i];
        }
        else if(a[i] == 3 && P[1] <= y[i])
        {
            P[1] = y[i];
        }
        else if(a[i] == 4 && Q[1] >= y[i])
        {
            Q[1] = y[i];
        }
    }
    if(P[0] >= Q[0] || P[1] >= Q[1])
    {
        cout << 0 << endl;
    }
    else
    {
        cout << (Q[0] - P[0]) * (Q[1] - P[1]) << endl;
    }

}

Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


# --------------------------------------------

dp = None


def main():
    a, b, c = li_input()

    print(sum([a, b, c]) - max(a, b, c))


main()


Measured memory_bytes: 4688
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = long.Parse(Console.ReadLine());
            var answer = "";
            while (N > 0)
            {
                var div = (N - 1) / 26L;
                var mod = (N - 1) % 26L;
                answer += GetCharString(mod);
                N = div;
            }
            Console.WriteLine(string.Join("", answer.Reverse()));
        }

        public static string GetCharString(long num)
        {
            var ret = "";
            switch (num)
            {
                case 0: ret = "a"; break;
                case 1: ret = "b"; break;
                case 2: ret = "c"; break;
                case 3: ret = "d"; break;
                case 4: ret = "e"; break;
                case 5: ret = "f"; break;
                case 6: ret = "g"; break;
                case 7: ret = "h"; break;
                case 8: ret = "i"; break;
                case 9: ret = "j"; break;
                case 10: ret = "k"; break;
                case 11: ret = "l"; break;
                case 12: ret = "m"; break;
                case 13: ret = "n"; break;
                case 14: ret = "o"; break;
                case 15: ret = "p"; break;
                case 16: ret = "q"; break;
                case 17: ret = "r"; break;
                case 18: ret = "s"; break;
                case 19: ret = "t"; break;
                case 20: ret = "u"; break;
                case 21: ret = "v"; break;
                case 22: ret = "w"; break;
                case 23: ret = "x"; break;
                case 24: ret = "y"; break;
                case 25: ret = "z"; break;
            }
            return ret;
        }
    }
}


Measured memory_bytes: 28300
import bisect
n=int(input())
lis=list(map(int, input().split())) 
lis.sort()
out=0
for i in range(n):
    for j in range(1+i,n):
        out+=bisect.bisect_left(lis,lis[i]+lis[j])-j-1
print(out)

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

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

using namespace std;

typedef long long ll;

int a[3];

int main(){
	rep(i, 3){
		cin >> a[i];
	}
	sort(a, a + 3);
	cout << (a[0] & 1 && a[1] & 1 && a[2] & 1 ? ll(a[0]) * a[1] : 0) << endl;
	return 0;
}

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

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll c=n/(a+b)*a, d=n%(a+b);
  if(d<a)cout << c+d << endl;
  else cout << c+a << endl;

  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N,P;
    string S;
    cin >> N >> P >> S;
    if(P != 2 && P != 5) {
        int ans = 0;
        vector<int>cnt(P);
        int now = 0;
        int res2 = 1;
        cnt[0] = 1;
        for(int i = N-1; i >= 0; i--) {
            now = (now+(S[i]-'0')*res2)%P;
            cnt[now]++;
            res2 = res2*10%P;
        }
        for(int i = 0; i < P; i++) {
            ans+=cnt[i]*(cnt[i]-1)/2;
        }
        cout << ans << endl;
        return 0;
    }
    int res = 0;
    for(int i = 0; i < N; i++) {
        if((S[N-1-i]-'0')%P == 0) {
            res+=N-i;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
#define test ll t;cin>>t;while(t--)
#define f first
#define s second
#define pb push_back
#define pop pop_back
#define int long long int

vector<int> graph[100005];
int dp[100005];

int solve(int src)
{
    if(dp[src]!=-1)
        return dp[src];
        
    bool leaf =1;
    int bestchild =0;
    
    for(int child : graph[src])
    {
        leaf = 0;

        bestchild = max(bestchild,solve(child));
       
    }
    
    return dp[src] = leaf?0:1+bestchild;
    
}


int32_t main()
{
	fast;
	int n,m;
	    cin>>n>>m;
	    memset(dp,-1,sizeof dp);
	    for(int i=0;i<m;i++)
        {
            int u,v;
            cin>>u>>v;
            graph[u].pb(v);
        }
        int ans=0;

        for(int i=1;i<=n;i++)
        {
            ans = max(ans,solve(i));
        }
         cout<<ans<<"\n";

	return 0;
}



Measured memory_bytes: 8576
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
 
 
 
 
 
int main() {
 
	double N, T, A,m=9999999999;
	ll an;
	cin >> N >> T >> A;
	rep(i, N) {
		double H;
		cin >> H;
		if (m > abs(T - 0.006 * H - A)) {
			m = abs(T - 0.006 * H - A);
			an = i + 1;
		}
	}
	cout << an << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S; cin >> S;
  int result = 0; rep(i, 3) if (S[i]=='1') result++;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 384
package main

import (
	. "fmt"
)

// func init() { Println("----------------------------------------") }

func main() {
    var a, b, c, d int
    Scanf("%d", &a)
    Scanf("%d", &b)
    Scanf("%d", &c)
    Scanf("%d", &d)

    var ans int
    if a > b {
        ans += b
    } else {
        ans += a
    }
    if c > d {
        ans += d
    } else {
        ans += c
    }
    Println(ans)
}


Measured memory_bytes: 512
// Problem : A - Don't be late
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define nl              "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)           (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)        cout << #x << " = " << x << endl
#define trace(x)        cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; //for storing unique elements
typedef tree<int , null_type , less_equal<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set; //for repeating elements
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void babuBhaiya()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	int d,t,s; cin>>d>>t>>s;
	int time = ceil((double)d/s);
	if(t>=time) cout<<"Yes";
	else cout<<"No";
	
}

 
int32_t main()
{
    babuBhaiya();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define int long long

using namespace std;
typedef pair <int, int> ii;

string s, t;
int psums[100001], psumt[100001], q;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("INP.INP", "r", stdin);
//    freopen("OUT.OUT", "w", stdout);
    cin >> s >> t >> q;
    for (int i = 0; i < (int) s.size(); i++) {
        if (s[i] == 'A') psums[i + 1] = 1;
        else psums[i + 1] = -1;
        psums[i + 1] += psums[i];
    }
    for (int i = 0; i < (int) t.size(); i++) {
        if (t[i] == 'A') psumt[i + 1] = 1;
        else psumt[i + 1] = -1;
        if (i == 0) continue;
        psumt[i + 1] += psumt[i];
    }
    while (q--) {
        int x, y, z, t;
        cin >> x >> y >> z >> t;
        int S, T;
        S = psums[y] - psums[x - 1];
        T = psumt[t] - psumt[z - 1];
        S %= 3;
        T %= 3;
        if (S < 0) S+=3;
        if (T < 0) T+=3;
//        cerr << "S, T: " << S << " " << T << '\n';
        if (S == T) cout << "YES" << '\n';
        else cout << "NO" << '\n';
    }
    return 0;
}


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

int main() {
    int N; cin >> N;
    vector<long long> A(N), B(N), C(N);
    for(int i = 0; i < N; ++i) cin >> A[i];
    for(int i = 0; i < N; ++i) cin >> B[i];
    for(int i = 0; i < N; ++i) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    
    long long res = 0;
    for(int i = 0; i < N; ++i) {
        long long a = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        long long c = upper_bound(C.begin(), C.end(), B[i]) - C.begin();
        res += a * (N - c);
    }
    
    cout << res << endl;
}


Measured memory_bytes: 2560