akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var s = br.readLine().split(" ");
      final var n = Integer.parseInt(s[0]);
      final var m = Integer.parseInt(s[1]);

      System.out.println(n == m ? "Yes" : "No");
    }
  }
}


Measured memory_bytes: 32776
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String [] S = new String[N];
        int [] C = new int[4];
        
        for(int i=0; i<N; i++){
            S[i] = sc.next();
        }
        
        for(int i=0; i<N; i++){
            if(S[i].equals("AC")){
                C[0]++;
            }else if(S[i].equals("WA")){
                C[1]++;
            }else if(S[i].equals("TLE")){
                C[2]++;
            }else if(S[i].equals("RE")){
                C[3]++;
            }
        }
        
        System.out.println("AC x "+C[0]);
        System.out.println("WA x "+C[1]);
        System.out.println("TLE x "+C[2]);
        System.out.println("RE x "+C[3]);
    }
}


Measured memory_bytes: 65940
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    Arrays.sort(A);

    System.out.println(A[A.length - 1] - A[0]);
  }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll, ll>
#define pb push_back
#define ll long long
#define ld long double	
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e18
ll power(ll num, ll g, ll mod) {
	if (g == 0)return 1;
	if (g % 2 == 1)return (num * power((num * num) % mod, g / 2, mod)) % mod;
	return power( (num * num) % mod, g / 2, mod);
}
int main(){
	string s1, s2;
	cin >> s1 >> s2;
	if (s1.size() + 1 == s2.size() && s2.substr(0, s1.size()) == s1){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;


int main(void){
   int N;
   cin>>N;
   vector<int> A(N);
   for(int i=0;i<N;i++){
      cin>>A[i];
   }
   map<int,long long> count;
   for(int i=0;i<N;i++){
      count[A[i]]++;
   }
   long long sum=0;
   for(auto c:count){
      sum+=c.second*(c.second-1)/2;
   }
   for(int i=0;i<N;i++){
      cout<<sum-count[A[i]]+1<<endl;
   }
   return 0;
}

Measured memory_bytes: 10240
# -*- coding: utf-8 -*-
H, W, M = map(int, input().split())

h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
m_dic = {}
for i in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    m_dic["{}_{}".format(h, w)] = 1

max_h_list = []
max_h = -1
for i in range(H + 1):
    if max_h == h_list[i]:
        max_h_list.append(i)
    elif max_h < h_list[i]:
        max_h = h_list[i]
        max_h_list = [i]

max_w_list = []
max_w = -1
for i in range(W + 1):
    if max_w == w_list[i]:
        max_w_list.append(i)
    elif max_w < w_list[i]:
        max_w = w_list[i]
        max_w_list = [i]

adjust_dupl = 1
for i in range(len(max_h_list)):
    for j in range(len(max_w_list)):
        if "{}_{}".format(max_h_list[i], max_w_list[j]) not in m_dic:
            adjust_dupl = 0
            break
    if adjust_dupl == 0:
        break
print(max_h + max_w - adjust_dupl)

Measured memory_bytes: 66908
#include<stdio.h>
int main() {
  int n;scanf("%d",&n);
  long long a[200000];
  for(int i=0;i<n;i++){
  	scanf("%lld",&a[i]);
    if(!a[i]){printf("0\n");return 0;}
  }
  long long ans = a[0], tmp = a[0];
  for(int i=1;i<n;i++){
    ans*=a[i];
    if(ans < tmp){
      printf("-1\n");
      return 0;
    }
    tmp=ans;
  }
  printf("%lld\n",ans>(long long)1e18?-1:ans);
}


Measured memory_bytes: 2500
#include <iostream>
#include <stdio.h>
using namespace std;
int ar[200], n;
long long findTotal(int val) {
	long long int ans = 0;

	for(int i = 0; i < n; i++){
	   // cout << ar[i] << " *\n";
		ans += (val - ar[i]) * (val - ar[i]);
	}
    // cout << ans << " ^ " << val << endl;
	return ans;
}

int main() {
    
	cin >> n;
	
	int lo = 1e9, hi = -1;
	
	for(int i = 0; i < n; i++) {
		cin >> ar[i];

		lo = ar[i] < lo ? ar[i] : lo;
		hi = ar[i] > hi ? ar[i] : hi;
	}
    
    long long ans = (int)1e9;
    
    for(int i = lo ; i <= hi; i++) {
        long long sol = findTotal(i);
        ans = ans > sol ? sol : ans;
    }

	
	printf("%lld\n", ans == (int) 1e9 ? 0 : ans);
}

Measured memory_bytes: 3744
#include <iostream>
#include <vector>
#include <algorithm>

int main(void) {
	// in
	int x, y, z, k;
	std::cin >> x >> y >> z >> k;
	std::vector<long long> a(x), b(y), c(z);
	for(int i = 0; i < x; ++i) std::cin >> a[i];
	for(int i = 0; i < y; ++i) std::cin >> b[i];
	for(int i = 0; i < z; ++i) std::cin >> c[i];

	// make pairs
	std::vector<long long> v;
	v.reserve(x*y);
	for(int i_a = 0; i_a < x; ++i_a) {
		for(int i_b = 0; i_b < y; ++i_b) {
			v.push_back(a[i_a] + b[i_b]);
		}
	}

	// sort
	std::sort(v.begin(), v.end(), [](long long &lhs, long long &rhs) { return lhs > rhs; });

	// resize
	v.resize(k);

	// make pairs
	std::vector<long long> w;
	w.reserve(k*z);
	for(int i_v = 0; i_v < k; ++i_v) {
		for(int i_c = 0; i_c < z; ++i_c) {
			w.push_back(v[i_v] + c[i_c]);
		}
	}

	// sort
	std::sort(w.begin(), w.end(), [](long long &lhs, long long &rhs) { return lhs > rhs; });
	
	// out
	for(int i = 0; i < k; ++i) {
		std::cout << w[i] << std::endl;
	}

	return 0;
}


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

template <class Z> vector<Z> divisor(Z n) {
  vector<Z> res;
  Z i;
  for (i = 1; i * i < n; ++i) if (n % i == 0) res.push_back(i), res.push_back(n / i);
  if (i * i == n) res.push_back(i);
  sort(begin(res), end(res));
  return res;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long res = 0;
  for (auto d : divisor(n)) {
    if (d == 1) {
      continue;
    }
    auto x = n;
    while (x % d == 0) {
      x /= d;
    }
    res += x % d == 1;
  }
  res += divisor(n - 1).size() - 1;
  cout << res << '\n';
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        int res = -1;
        char t = 'x';
        for(char c : S) {
            if(c == t) continue;
            t = c;
            res++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 26196
#include <iostream>


int main()
{
	int max=0, a[100000], n, m;
	std::cin >> n;

	m = 0;
	for(int i = 0; i<n; i++)
	{
		std::cin>> a[i];
		if(i!=0)
		{
			if(a[i]<=a[i-1])
				m++;
			else{
				m= 0;
			}
		}
		if(m>max)
			max = m;
	}
	std::cout << max << std::endl; 		


	return 0;
}

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

int main () {
  int a, b, c, d, ab, cd;
  cin >> a >> b >> c >> d;
  ab = a * b;
  cd = c * d;
  if(ab >= cd){
    cout << ab << endl;
  } else {
    cout << cd << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
*a, = map(int, input().split())

# dp[i]=石の数がi個の場合の手番の人の勝ち負け
dp = [False]*(K+1)

for i in range(1, K+1):
    for j in range(N):
        # 遷移先にFalseがあればTrueにする
        # TrueになったらFalseにはならないため、orで入れる
        if i >= a[j]:
            dp[i] |= not dp[i-a[j]]

print("First" if dp[K] else "Second")


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

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

  string s;
  cin >> s;

  if (s.length() == 2) {
    cout << s << endl;
  } else {
    swap(s[0], s[2]);
    cout << s << endl;
  }
}

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

int main() {
	int n;
	vector<int> a(31);
	a[1] = 1;
	a[2] = 2;
	a[3] = 4;
	for (int i = 4; i < 31; ++i) a[i] = a[i - 3] + a[i - 2] + a[i - 1];
	while (cin >> n, n) cout << (364 + (9 + a[n]) / 10) / 365 << endl;
}


Measured memory_bytes: 3076
#include <stdio.h>
#include <ctype.h>
#define limitstr 201

int main(void){
    char pile[limitstr]={0}, buffer[limitstr]={0}, cutbuffer[limitstr]={0};
    int num=0, shuffle=0, index=0;
    
    
    for(;scanf("%s", pile) && strcmp("-", pile);){
        for(index=0, scanf("%d", &num); num > index && scanf("%d", &shuffle); index++){
            strncpy(buffer, pile, shuffle);
            strncpy(cutbuffer, &(pile[shuffle]), strlen(pile)-shuffle);
            strncpy(pile, cutbuffer, limitstr);
            strncat(pile, buffer, shuffle);
            
            strncpy(buffer, "\0", limitstr);
            strncpy(cutbuffer, "\0", limitstr);
        }
        
        printf("%s\n", pile);
    }
    
    return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX_V = 10010;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
	int N; ll W;
	cin >> N >> W;

	vec vs(N); vecll ws(N);
	rep(N, i)
	{
		cin >> vs[i] >> ws[i];
	}

	matll dp(N+1, vecll(MAX_V, INFL));

	dp[0][0] = 0;

	rep(N, i) rep(MAX_V, j)
	{
		dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
		dp[i+1][j+vs[i]] = min(dp[i+1][j+vs[i]], dp[i][j] + ws[i]);
	}

	int ans = 0;

	rep(MAX_V, i)
	{
		if (dp[N][i] <= W)
		{
			ans = i;
		}
	}

	cout << ans << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



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

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

    vector<int> A(5);
    for(int i = 0; i < 5; i++){
        A[i] = i;
    }
    sort(A.begin(), A.end());

    vector<int> B(5);
    for(int i = 0; i < 5; i++){
        cin >> B[i];
    }

    int ans = 1e9;
    do {
        int now;
        for(int i = 0; i < 5; i++){
            if(i == 0) now = B[A[i]];
            else{
                now = (now + 9) / 10 * 10 + B[A[i]];
            }
        }
        ans = min(ans, now);
    }while(next_permutation(A.begin(), A.end()));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bitset>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

int main()
{

    int h, w, n;
    cin >> w >> h >> n;

    assert(h >= 1 && h <= 200000);
    assert(w >= 1 && w <= 200000);
    assert(n >= 0 && n <= 200000);

    vector<vector<int>> cols(200001);

    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;

        // assert(x >= 1 && x <= w);
        // assert(y >= 1 && y <= h);

        x--;
        y--;

        cols[x].push_back(y);
    }

    int ans = w;

    static bitset<200001> tbl;
    tbl[0] = true;

    bool done = false;

    for (int x = 1; x < w; x++) {
        // cout << x << ": " << tbl << endl;

        for (auto y : cols[x]) {
            if (tbl[y]) {
                ans = x;
                done = true;
            }
        }
        if (done) {
            break;
        }

        tbl |= (tbl << 1);
        for (auto y : cols[x]) {
            tbl[y] = false;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#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
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

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

//vector<ll> g[202020];
//fill(score, score+202020, 0);
//vector<ll> v;

int main(){
  string s;
  cin >> s;
  
  ll keta = s.length();
  ll dp1[keta];
  ll dp2[keta];
  
  dp1[0] = 1;
  dp2[0] = 2;
  for (int i=1;i<keta;i++){
    if (s[i] == '1'){
      dp1[i] = (dp1[i-1]*3 + dp2[i-1])%MOD;
      dp2[i] = (dp2[i-1]*2)%MOD;
    }
    if (s[i] == '0'){
      dp1[i] = (dp1[i-1]*3)%MOD;
      dp2[i] = dp2[i-1]%MOD;
    }
  }
  
  cout << (dp1[keta-1]+dp2[keta-1])%MOD << endl;
}

Measured memory_bytes: 2048
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int n;
    cin >> n;
    vector<int> idx(n + 1);
    rep(i, n) {
        int a;
        cin >> a;
        idx[a] = i;
    }
    
    ll ans = 0;
    set<int> st = {-2, -1, n, n + 1};
    revrepr(a, 1, n + 1) {
        st.insert(idx[a]);
        auto ite = st.find(idx[a]);
        int l1 = max(-1, *prev(ite, 2)), l2 = max(-1, *prev(ite));
        int r1 = min(n, *next(ite)), r2 = min(n, *next(ite, 2));
        ans += ll(l2 - l1) * (r1 - idx[a]) * a;
        ans += ll(idx[a] - l2) * (r2 - r1) * a;
        
        //printf("%d %d %d %d\n", l1, l2, r1, r2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5376
use std::collections::HashSet;
use std::fs;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let n: usize = parse!(it);
    let m: usize = 100010;
    let mut g = vec![vec![]; 2 * m];
    for _ in 0..n {
        let (x, y): (usize, usize) = parse!(it, 2);
        g[x - 1].push(y - 1 + m);
        g[y - 1 + m].push(x - 1);
    }
    let mut ret = 0;
    let mut seen: HashSet<usize> = HashSet::new();
    for i in 0..(2 * m) {
        if !seen.contains(&i) {
            let mut part = HashSet::new();
            dfs(&g, i, &mut part);
            ret += get_cap(&g, &part, m);
            seen.extend(part.iter());
        }
    }
    println!("{}", ret);
}

fn get_cap(g: &Vec<Vec<usize>>, vs: &HashSet<usize>, n: usize) -> usize {
    let nx = vs.iter().filter(|&&i| i < n).count();
    let ny = vs.len() - nx;
    let ne = vs.iter().map(|&i| g[i].len()).sum::<usize>() / 2;
    nx * ny - ne
}

fn dfs(g: &Vec<Vec<usize>>, u: usize, seen: &mut HashSet<usize>) {
    seen.insert(u);
    for &v in &g[u] {
        if !seen.contains(&v) {
            dfs(g, v, seen);
        }
    }
}

fn test() {
    let mut f = fs::File::open("foo.txt").unwrap();
    let mut s = String::new();
    f.read_to_string(&mut s).unwrap();
    solve(&s);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_main() {
        test();
    }
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 24612
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		// ?????£?????????????????????????????????????????????
		//String shuffle_strings = "";

		while (true) {

			// ??????????????°??¢??????????????????????????\???
			String alphabet_cards = input.readLine();

			//-?????\?????§??????
			if (alphabet_cards.equals("-")) {

				break;
			}

			String shuffle_num = input.readLine();

			// ?????£?????????????????°
			int shuffle_times = Integer.parseInt(shuffle_num);

			StringBuilder shuffle_before_cards = new StringBuilder(alphabet_cards);

			// ?????£?????????????????°????????????????????£?????????
			for (int cards_spot = 0; cards_spot < shuffle_times; cards_spot++) {

				//??????????????§????????£??????????????????
				String shuffle_spot = input.readLine();

				int shuffle_cards = Integer.parseInt(shuffle_spot);

				// ??\??????????????¢???????????????????????????????????????shuffle_cards???????????§?????????
				String extracted_cards = shuffle_before_cards.substring(0, shuffle_cards);

				//???????????\???????????????????????\????????????alphabet_cards??????extracted_cards????¶????
				shuffle_before_cards.delete(0, shuffle_cards);

				//???????????\??????????????????,????°????extracted_cards????¶????
				shuffle_before_cards = shuffle_before_cards.append(extracted_cards);

			}

			System.out.println(shuffle_before_cards.toString());

		}

	}//StringBuilder ?????° = new StringBuilder(????????????????????°);
}

Measured memory_bytes: 24364
#include <stdio.h>
 
int main() {
    long long int n;
    scanf("%lld", &n);
	if (n == 1) {
		printf("0");
		return 0;
	}
	int count2 = 0;
    int ans=0;
	while (n % 2 == 0) {
		//printf("2 ");
		n /= 2;
		count2++;
	}
    int aa=1;
    while(count2>=1){
        //printf("--%d\n",count2);
        count2-=aa;
        aa++;
        if(count2>=0){ans++;}
    }
    //printf("--%d\n",ans);
    int count;
	for (int i = 3; i <= 1000000; i++) { 
	    count=0;
		while (n % i == 0) {
			//printf("%d ", i);
			n /= i;
			count++;
		}
		aa=1;
		
		while(count>=1){
		//printf("--%d\n",count);
        count-=aa;
        aa++;
        if(count>=0){ans++;}
        //printf("--ans %d\n",ans);
		}
		count=0;
	}
	if (n > 100000) {
		ans++;
	}
    printf("%d", ans);
	return 0;
}

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

int eul_v[100010], eul_w[200010], par[100010][20], depth[100010], ans[100010];
int parmx;
bool looked[200010];
vector<vector<int>> G, col, wei, num_c;

struct BitIT{
	int bit[200010];
	void reset(){
		for(int i=0; i<200010; ++i){
			bit[i]=0;
		}
	}
	void add(int n, int a){
		for(int i=n; i<200010; i += i&(-i)){
			bit[i] += a;
		}
	}
	int sum(int n){
		int res=0;
		for(int i=n; i>0; i -= i&(-i)){
			res += bit[i];
		}
		return res;
	}
	int sum(int l, int r){
		return sum(r)-sum(l);
	}
};

BitIT bit_w, bit_c;

int dfs(int key, int now){
	int res=now;
	looked[key]=true;
	eul_v[key]=res;
	for(int i=0; i<G[key].size(); ++i){
		if(!looked[G[key][i]]){
			par[G[key][i]][0]=key;
			depth[G[key][i]]=depth[key]+1;
			++res;
			eul_w[res]=wei[key][i];
			num_c[col[key][i]].emplace_back(res);
			res=dfs(G[key][i], res)+1;
			eul_w[res]=-wei[key][i];
			num_c[col[key][i]].emplace_back(res);
		}
	}
	return res;
}

struct query{
	int x, y, u, v, num;
	bool operator<(const query &ano) const{
		return x < ano.x;
	}
	int solve(){
		int s=u, t=v;
		if(depth[s]<depth[t]) swap(s, t);
		while(depth[s]>depth[t]){
			int dist=depth[s]-depth[t], cnt=0;
			while(dist%2==0){
				++cnt;
				dist /= 2;
			}
			s=par[s][cnt];
		}
		for(int i=parmx; i>=0; --i){
			if(par[s][i]!=par[t][i]){
				s=par[s][i], t=par[t][i];
			}
		}
		int lcs;
		if(s==t) lcs=t;
		else lcs=par[s][0];
		int res=bit_w.sum(eul_v[lcs], eul_v[u])+bit_w.sum(eul_v[lcs], eul_v[v]);
		res += y*(bit_c.sum(eul_v[lcs], eul_v[u])+bit_c.sum(eul_v[lcs], eul_v[v]));
		return res;
	}
};

query qlist[100010];

int main() {
	int N, Q;
	cin >> N >> Q;
	G.assign(N+1, {});
	col.assign(N+1, {});
	wei.assign(N+1, {});
	for(int i=1; i<N; ++i){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		G[a].emplace_back(b);
		col[a].emplace_back(c);
		wei[a].emplace_back(d);
		G[b].emplace_back(a);
		col[b].emplace_back(c);
		wei[b].emplace_back(d);
	}
	num_c.assign(N+1, {});
	depth[1]=0;
	int euler_end=dfs(1, 1);
	bit_w.reset();
	bit_c.reset();
	for(int i=1; i<=euler_end; ++i){
		bit_w.add(i, eul_w[i]);
	}
	parmx=0;
	while(1){
		bool flag=true;
		for(int i=1; i<=N; ++i) flag=(flag&&(par[i][parmx]==0));
		if(flag) break;
		++parmx;
		for(int i=1; i<=N; ++i) par[i][parmx]=par[par[i][parmx-1]][parmx-1];
	}
	for(int i=0; i<Q; ++i){
		cin >> qlist[i].x >> qlist[i].y >> qlist[i].u >> qlist[i].v;
		qlist[i].num=i;
	}
	sort(qlist, qlist+Q);
	int del=0;
	for(int i=0; i<Q; ++i){
		if(del!=qlist[i].x){
			for(int j=0; j<num_c[del].size(); ++j){
				int choku=eul_w[num_c[del][j]];
				bit_w.add(num_c[del][j], choku);
				bit_c.add(num_c[del][j], -(abs(choku)/choku));
			}
			del=qlist[i].x;
			for(int j=0; j<num_c[del].size(); ++j){
				int choku=eul_w[num_c[del][j]];
				bit_w.add(num_c[del][j], -choku);
				bit_c.add(num_c[del][j], abs(choku)/choku);
			}
		}
		ans[qlist[i].num]=qlist[i].solve();
	}
	for(int i=0; i<Q; ++i) cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 39288
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
const int mod=1000000007;
const int INF=1e18;


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d) {
        cout<<"Yes\n";
    }
    else
        cout<<"No\n";
    
    return 0;
}

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

using namespace std;

int main()
{
    int a=0,y=0,t;
    string x;
    cin>>x;
    t=x.length();
    for (int i=0;i<t;i++)
    {
        if (x[i]=='A')
        {
            for (int j=i;j<t;j++)
            {
                a++;
                if (a>y && x[j]=='Z')
                {
                    y=a;
                }
            }
            cout<<y<<endl;
            return 0;
        }
    }
    cout<<y<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<numeric>

int main() {
	int n;
	std::cin >> n;

	std::vector<int>v;
	v.resize(n);
	
	for (auto&e : v)
		std::cin >> e;

	(*std::max_element(std::begin(v), std::end(v)) )/=2;
	/*
	for (auto&e : v)
		std::cout << e<<"\n";
	*/
	auto x = std::accumulate(std::begin(v), std::end(v), 0);
	std::cout << x << "\n";
	return 0;
}

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

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}


fn main() {
    let (s, w) = input_tuple();
    if w >= s {
        println!("unsafe");
    } else {
        println!("safe");
    }
}


Measured memory_bytes: 2156
using System;
using System.Linq;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var count = int.MinValue;
            var ans = 0;
            for(var i = 1; i <= n; i++){
                var x = i;
                var c = 0;
                while(x % 2 == 0){
                    x /= 2;
                    c++;
                }
                if(c > count){
                    count = c;
                    ans = i;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


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


int main()
{
	int H, W;
	cin >> H >> W;

	while (H != 0 || W != 0){
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				if (i == 0){
					cout << "#";
				}
				else if (i == H - 1){
					cout << "#";
				}
				else{
					if (j == 0){
						cout << "#";
					}
					else if (j == W - 1){
						cout << "#";
					}
					else{
						cout << ".";
					}
				}
			}
			cout << endl;
		}
		cout << endl;
		cin >> H >> W;
	}
	
	return 0;
}


Measured memory_bytes: 3084
/*
PROG: apc001f
LANG: C++11
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
 */
#include <bits/stdc++.h>

using namespace std;

long long readi()
{
	long long input = 0;
	bool negative = false;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
int sgn(long long x)
{
	if (x < 0) 
	{
		return -1;
	}
	if (x > 0) 
	{
		return 1;
	}
	return 0;
}
long long randomize(long long mod)
{
	return ((1 << 30) * rand() + (1 << 15) * rand() + rand()) % mod;
}

#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-20;

#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
#define MAXN 100010

long long normalize(long long x, long long mod = INF)
{
	return (((x % mod) + mod) % mod);
}

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int N;
int arr[MAXN];
int mask;
int ans;
bool good[MAXN];
int dp[MAXN];

int32_t main()
{
	ios_base::sync_with_stdio(0); 
	srand(time(0));
	//	cout << fixed << setprecision(12);	
	//	cerr << fixed << setprecision(12);
	if (fopen("apc001f.in", "r"))
	{	
		freopen ("apc001f.in", "r", stdin);
		freopen ("apc001f.out", "w", stdout);
	}
	cin >> N;
	for (int i = 1; i < N; i++)
	{
		int u, v, a;
		cin >> u >> v >> a;
		arr[u] ^= a;
		arr[v] ^= a;
	}
	//answer is N - # of cc's
	//maximize # of cc's
	for (int i = 0; i < N; i++)
	{
		if (arr[i] == 0)
		{
			ans++;
			continue;
		}
		if (mask & (1 << arr[i]))
		{
			ans++;
		}
		mask ^= (1 << arr[i]);
	}
	for (int i = 0; i < (1 << 16); i++)
	{
		int val = 0;
		for (int j = 0; j < 16; j++)
		{
			if (i & (1 << j))
			{
				val ^= j;
			}
		}
		if (val == 0)
		{
			good[i] = true;
		}
	}
	for (int i = 0; i < (1 << 16); i++)
	{
		for (int j = i; j > 0; j = (j - 1) & i)
		{
			if (good[i ^ j])
			{
				dp[i] = max(dp[i], dp[j] + 1);
			}
		}
	}
	ans += dp[mask];
	cout << N - ans << '\n';
	//	cerr << "time elapsed = " << (clock() / (CLOCKS_PER_SEC / 1000)) << " ms" << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
    int a,b;
    while(true){
        int sum,digit;
        a=-1;
        digit = 0;
        
        cin >> a >> b;
        
        if(a == -1){
            break;
        }
        
        sum = a + b;
        
        while(true){
            if(sum != 0){
                sum /= 10;
                digit++;
            }
            else{
                break;
            }
        }
        
        cout << digit << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <set>
using namespace std;
typedef long long ll;

int x;

int main(int argc, char const *argv[]) {
	cin >> x;
	cout << x*x*x << endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int res = n;
    for(int i=0;i<=n;++i){
        int cc=0;
        int t=i;
        while(t>0){
            cc += t%6;
            t /= 6;
        }
        t=n-i;
        while(t>0){
            cc+=t%9;
            t /= 9;
        }
        if(res>cc)res=cc;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool Check(long int N,long int pos){return (bool)(N & (1<<pos));}
long int Set(long int N,long int pos){	return N=N | (1<<pos);}
long int cnt=1,nk=0,k=1;
long int N=1000000005,prime[100000000],e[100000000],p[100000000];
long int status[(4000000005/32)];
/*void sieve()
{
    //int N,prime[60000],e[60000],p[60000];
     N=num;
     //int status[num/32];
     long int i, j, sqrtN;
     sqrtN=( sqrt((double) N ) );
     //int status[(N/32)+sqrtN];
     for( i = 3; i <= sqrtN; i += 2 )
     {
		 if( Check(status[i/32],i%32)==0)
		 {
	 		 for( j = i*i; j <= N; j += 2*i )
			 {
				 status[j/32]=Set(status[j/32],j % 32)   ;
	 		 }
		 }
	 }
	 //int cnt=1;
	 prime[0]=2;
	 //puts("2");
	 for(i=3;i<=N;i+=2)
		 if( Check(status[i/32],i%32)==0)
         {
             prime[cnt++]=i;
         }
   /* for(i=0;i<cnt;i++)
    {
        printf("%ld\n",prime[i]);
    }
    printf("%ld\n",cnt);
	 	 //printf("%d\n",i);
 
}*/
 
void decomp(long int n)
{
    long int sqrtn=sqrt(n);
    long int i;
    while(n%2==0)
    {
        printf(" 2");
        n=n/2;
    }
    //for(i=0;i<cnt && prime[i]<=sqrtn;i++)
    for(i=3;i<=sqrtn;i+=2)
    {
        //if(Check(prime[]))
        long int cnt2=0;
        //if(n%prime[i]!=0)
             while(n%i==0)
            {
                cnt2++;
                printf(" %ld",i);
                n=n/i;
            }
            sqrtn=sqrt(n);
            /*if(cnt2>0)
            {
                p[nk]=prime[i];
                e[nk]=cnt2;
                nk++;
            }*/
 
    }
    if(n!=1)
    {
        /*p[nk]=n;
        e[nk]=1;
        nk++;*/
        printf(" %ld",n);
    }
    /*printf("%ld: ",num);
    for(int m=0;m<nk;m++)
    {
    for(i=0;i<e[m];i++)
    {
        printf("%ld",p[i]);
        if(i+1<nk)
          printf(" ");*/
       // printf("%d\n",e[i]);
    }
    //}
    //printf("\n");
    //nk=0;
//}
int main()
{
    //int c,k=1;
    long int num;
    scanf("%ld",&num);
    printf("%ld:",num);
//    sieve();
    //printf("Case %d: ",k);
   decomp(num);
   printf("\n");
    /*int i,n=12;
    int s=sqrt(n);
    for(i=1;i<=s;i++){
        if(n%i==0){
         cout<<i<<endl;
         cout<<n/i<<endl;
    }
    }*/
    return 0;
}


Measured memory_bytes: 3212
s = input()
n = len(s) + 1
lis = [0] * n
if s[0] == "<":
  lis[0] = 0
p = 1
while p < n - 1:
  if s[p - 1] == ">" and s[p] == "<":
    lis[p] = 0
  elif s[p - 1] == "<" and s[p] == "<":
    lis[p] = max(lis[p - 1] + 1, lis[p])
  elif s[p] == ">":
    pass
  p += 1
    
if s[-1] == ">":
  lis[-2] = 1
  lis[-1] = 0
  
p = n - 3
while p >= 0:
  if s[p] == ">" and s[p + 1] == "<":
    if p - 1 >= 0:
      lis[p] = max(lis[p + 1] + 1, lis[p], lis[p - 1] + 1)
    else:
      lis[p] = 1
  elif s[p] == ">" and s[p + 1] == ">":
    if p - 1 >= 0:
      lis[p] = max(lis[p + 1] + 1, lis[p], lis[p - 1] + 1)
    else:
      lis[p] = max(lis[p + 1] + 1, lis[p])
  elif s[p] == "<":
    pass
  p -= 1

if s[-1] == "<":
  lis[-1] = lis[-2] + 1
  
print(sum(lis))

Measured memory_bytes: 23336
N, Y = map(int, input().split())

max_10k = int(Y / 10000)
max_5k = int(Y / 5000)

for num_10k in range(max_10k, -1, -1):
    for num_5k in range(max_5k - num_10k, -1, -1):
        num_1k = N - num_10k - num_5k
        if num_1k >= 0 and num_10k * 10000 + num_5k * 5000 + num_1k * 1000 == Y:
            print(num_10k, num_5k, num_1k)
            quit()

print("-1 -1 -1")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N, Y;
	cin >> N >> Y;

	cout << (N * 500 < Y ? "No" : "Yes") << endl;
	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

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

using namespace std;

#define ll long long
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef set<int> si;
typedef set<vi> svi;
typedef set<ll> sll;
typedef set<vll> svll;
typedef set<pii> spii;
typedef set<vpii> svpii;
typedef set<pll> spll;
typedef set<vpll> svpll;
typedef vector<si> vsi;
typedef vector<sll> vsll;
typedef vector<spii> vspii;
typedef vector<spll> vspll;
#define ft first
#define sc second
#define pb push_back
#define ins insert
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define sortarr(a,n) sort(a,a+n)
#define tt ll tc; cin >> tc; while(tc--)
#define rep(var,start,end,interval) for(ll var=start;(interval>0 and var<end) or (interval<0 and var>end);var+=interval)
#define each(x,v) for(auto x : v)
#define takearr0(a,n) rep(z,0,n,1) cin >> a[z];
#define takearr1(a,n) rep(z,1,n+1,1) cin >> a[z];

const ll max_n = 3;

int main()
{
	io;
	string s;
	cin >> s;
	ll ans = 0;
	if(s[0] == 'R' or s[1] == 'R' or s[2] == 'R')
		ans = 1;
	if((s[0] == 'R' and s[1] == 'R') or (s[1] == 'R' and s[2] == 'R'))
		ans = 2;
	if(s[0] == 'R' and s[1] == 'R' and s[2] == 'R')
		ans = 3;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

const int N = 101001;
long long a[N];
long long memo[2][N];

int n;

long long value_of(int index, int sig) {
	return sig ? -a[index]: a[index];
}

inline int flip(int val) {
	return val ^ 1;
}
// sig == 1: sign has been modified
// sig == 0: sign is the same
long long dp(int cur, int sig) {
	if(cur == n - 1) {
		return value_of(cur, sig);
	}
	if(memo[sig][cur] != -1) return memo[sig][cur];

	long long ans = dp(cur + 1, 0) + value_of(cur, sig);
	ans = max(ans, dp(cur + 1, 1) + value_of(cur, flip(sig)));
	return memo[sig][cur] = ans;
}

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

	cin >> n;
	for(int i = 0; i < n; ++i) cin >> a[i];
	memset(memo, -1, sizeof memo);
	cout << dp(0, 0) << endl;
}


Measured memory_bytes: 7296
using System;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine();
			for (int i = 0; i < 3; i++)
			{
				if (input[i] == input[i + 1])
				{
					Console.WriteLine("Bad");
					return;
				}
			}
			Console.WriteLine("Good");
		}
	}
}


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

using ll = long long;

int main(){
    ll a, v, b, w, t;
    scanf("%lld%lld%lld%lld%lld", &a, &v, &b, &w, &t);
    if (w >= v){
        puts("NO");
        return 0;
    }
    ll dis = std::abs(v - w) * t;
    if (dis < std::abs(a - b)){
        puts("NO");
    }
    else{
        puts("YES");
    }
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repr(i, n) for (int i=n; i > 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x);
using namespace std;
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 ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int a,b,k;
    cin >> a >> b >> k;
    rep(i, k) {
        if (i%2 == 0) {
            if (a%2 == 1) {
                a--;
            }
            a /= 2;
            b += a;
        } else {
            if (b%2 == 1) {
                b--;
            }
            b /= 2;
            a += b;
        }
    }
    cout << a << ' ' << b << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int p1,p2,v1,v2,t;
	cin>>p1>>v1>>p2>>v2>>t; 
	if(v1<=v2)
	{
		cout<<"NO";
		return 0;
	}
	int k=v1-v2,dis=max(p1,p2)-min(p1,p2);
	if(dis/k<t||(dis/k==t&&dis%k==0))
		cout<<"YES";
	else
		cout<<"NO";
	return 0;
}


Measured memory_bytes: 3620
n = int(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
answer = ""
tmp = 0
while n > 0:
    tmp = n % 26
    answer += alphabet[tmp - 1]
    n = n // 26
    if tmp == 0:
        n -= 1

print(answer[::-1])


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

const int INF = 1001001001;

int x[110];
int y[110];

int func(int y){
  int sum=0;
  int x=y;
  while(x!=0){
    sum+=x%10;
    x/=10;
  }
  return sum;
}
int main() {
 int N;
 cin>>N;
 int ans=INF;
 for(int i=1;i<N;i++){
   int A=i;
   int B=N-A;
   ans=min(ans,func(A)+func(B));
 }
 cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <vector>
using namespace std;
vector<int> p;
bool check(int n){
	for(int i=0;i<p.size();i++){
		if(p[i]==n)
		return true;
		else if(n%p[i]==0)
		return false;
		else if(p[i]*p[i]>n)
		return true;
	}
	return true;
}
int main() {
	// your code goes here
	int N;

		p.push_back(2);
		for(int i=3;i<=10000;i++){
			for(int j=0;j<p.size();j++){
				if(i%p[j]==0)
					break;
				if(p[j]*p[j]>i){
					p.push_back(i);
					break;
				}
			}
		}	
	while(cin >> N && N!=0){
		int maxim=0;
		while(N%6!=1)
		N--;
		for(int i=N;i>=13;i-=6)
			if(check(i) && check(i-2) && check(i-6) && check(i-8)){
			maxim=i;
			break;
			}
		cout << maxim << endl;
	}
	return 0;
}

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

struct xy{
    int x;
    int y;
};

int manhattan(int x1, int y1, int x2, int y2)
{
    int ret = abs(x1 - x2) + abs(y1 - y2);
    return ret;
}

vector<int> solve(vector<xy> person, vector<xy> point)
{
    vector<int> ret;
    for (auto p: person)
    {
        int nowmin = INT_MAX;
        int nowminind = 0;
        for (int i = 0; i < point.size(); i++)
        {
            xy cp = point[i];
            int dist = manhattan(p.x, p.y, cp.x, cp.y);
            if (dist < nowmin)
            {
                nowmin = dist;
                nowminind = i + 1;
            }
        }
        ret.push_back(nowminind);
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;

    vector<xy> person;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        xy t = {a, b};
        person.push_back(t);
    }

    vector<xy> point;
    for (int i = 0; i < m; i++)
    {
        int c, d;
        cin >> c >> d;
        xy t = {c, d};
        point.push_back(t);
    }

    vector<int> ans = solve(person, point);
    for (auto p: ans)
    {
        cout << p << endl;
    }

    return 0;
}

Measured memory_bytes: 256
L, R = map(int, input().split())

D = R - L
Ans = {2018}
J_Set = {2018}


for i in range(min(D, 2019)):
    A = L+i
    for j in range(D-i):
        B = L+i+j+1
        Ans.add((A*B)%2019)
        if j > 2019:
            break

print(min(Ans))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int ans = min(n*a, b);
  cout << ans << endl;

  return 0;
}

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

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

ll gcd(ll a,ll b){
  if(a < b) return gcd(b, a);
    int r;
    while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){

  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll lcd = c/gcd(c,d) * d;
  ll n;
  if(a%c==0)n=(b-a)/c+1;
  else n=b/c-a/c;

  ll m;
  if(a%d==0)m=(b-a)/d+1;
  else m=b/d-a/d;

  ll k;
  if(a%lcd==0)k=(b-a)/lcd+1;
  else k=b/lcd-a/lcd;

  cout << (b-a+1)-n-m+k << endl;



}

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

using namespace std;
typedef unsigned long long int ll;

int main()
{
    ll i,n,sum=1000,z;
    cin>>n;
    vector<ll>v(n);
    for(i=0;i<n;i++)
    {
        cin>>v[i];
    }
    for(i=0;i<n-1;i++)
    {
        if(v[i]<v[i+1])
        {
            z = sum/v[i];
            sum += z*(v[i+1]-v[i]);
        }
    }
    cout<<sum;

}


Measured memory_bytes: 3604
from collections import deque
N,K = (int(x) for x in input().split())
R,S,P = (int(x) for x in input().split())
T = input()
count = 0
prog = 0
checker = ""
l = list(T)
d = deque(l[0:K])
for hand in l:
    if prog >= K:
        if hand == "r" and hand != checker:
            count += P
            d.append(hand)
            checker = d.popleft()
        elif hand == "s" and hand != checker:
            count += R
            d.append(hand)
            checker = d.popleft()
        elif hand == "p" and hand != checker:
            count += S
            d.append(hand)
            checker = d.popleft()
        else:
            d.append(hand+" ")
            checker = d.popleft()
    else:
        prog += 1
        if hand == "r":
            count += P
        elif hand == "s":
            count += R
        else:
            count += S
        if prog >= K:
            checker = d.popleft()
print(count)

Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef pair<long, long> P;

int main(){
  int n, K; cin >> n >> K;
  P p[n];
  rep(i, n){
    long x, y; cin >> x >> y;
    p[i] = P(x, y);
  }
  int cnt[n][n][4]; rep(i, n)rep(j, n)rep(k, 4) cnt[i][j][k] = 0;
  rep(i, n)rep(j, n)rep(k, n){
    if(p[k].first>p[i].first && p[k].second>p[j].second) cnt[i][j][0]++;
    if(p[k].first<p[i].first && p[k].second>p[j].second) cnt[i][j][1]++;
    if(p[k].first<p[i].first && p[k].second<p[j].second) cnt[i][j][2]++;
    if(p[k].first>p[i].first && p[k].second<p[j].second) cnt[i][j][3]++;
  }
  long ans = LONG_MAX;
  rep(i, n)rep(j, n)rep(k, n)rep(l, n){
    if(p[i].second>p[j].second && p[k].first<p[l].first){
      int c = n - cnt[l][j][0] - cnt[l][i][1] - cnt[k][i][2] - cnt[k][j][3];
      if(p[i].first<p[k].first || p[i].first>p[l].first) c--;
      if(p[j].first<p[k].first || p[j].first>p[l].first) c--;
      if(p[k].second>p[i].second || p[k].second<p[j].second) c--;
      if(p[l].second>p[i].second || p[l].second<p[j].second) c--;
      if(c >= K) ans = min(ans, (p[i].second-p[j].second)*(p[l].first-p[k].first));
    }
  }
  cout << ans << endl;
}

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

int main() {

  int n,t;
  cin >> n >> t;
  
  vector<int> ans;
  
  rep(i,n) {
    int a,b;
    cin >> a >> b;
    if(b <= t) ans.push_back(a);
  }
  
  sort(ans.begin(), ans.end());
  
  if(ans.size() > 0) cout << ans[0] << endl;
  else cout << "TLE" << endl;
  
  
}


Measured memory_bytes: 256