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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	int n, a;
	cin >> n >> a;
	int x[50];
	rep(i, n) cin >> x[i];
	vector<vector<vector<ll>>> dp(n + 1,
		vector<vector<ll>>(n + 1,
			vector<ll>(n * 50 + 1, 0ll)));
	dp[0][0][0] = 1ll;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j <= n; j++) {
			for(int k = 0; k <= n * 50; k++) {
				if(j >= 1 && k >= x[i])
					dp[i+1][j][k] += dp[i][j-1][k-x[i]];
				dp[i+1][j][k] += dp[i][j][k];
			}
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		ans += dp[n][i][i * a];
	}
	cout << ans << endl;
}


Measured memory_bytes: 52224
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/30 09:32:08 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	int	n, k;
	cin >> n >> k;
	vector<int>	V(n);
	vector<int>	dp(n, INT_MAX);
	dp.at(0) = 0;
	rep(i, n)
		cin >> V.at(i);
	rep2(i, 1, n)
	{
		rep2(j, max(0, i - k), i)
			dp.at(i) = min(dp.at(i), dp.at(j) + abs(V.at(i) - V.at(j)));
	}
	cout << dp.back() << endl;
}
// END

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


Measured memory_bytes: 1152
/**Author:Sagor*/

#include<bits/stdc++.h>

using namespace std;
#define pri(n)          printf("%d\n",n)
#define prll(n)         printf("%lld\n",n)
#define prd(n)          printf("%lf\n",n)
#define scll(n)         scanf("%lld",&n)
#define sci(n)          scanf("%d",&n)
#define scd(n)          scanf("%lf",&n)
#define pi              acos(-1)
#define ll              long long
#define pb              push_back
#define vsort(v)        sort(v.begin(),v.end())
#define asort(n)        sort(ar,ar+n)
#define for1(i,n)       for(i=1;i<=n;i++)
#define for0(i,n)       for(i=0;i<n;i++)
#define mod             1000000007

void SieveOfEratosthenes(ll n)
{
	bool prime[n+1];
	ll i,p;
	memset(prime, true, sizeof(prime));
	for(i=4;i<=n;i+=2) prime[i]=false;

	for (p=3; p*p<=n; p+=2)
	{
		if (prime[p] == true)
		{
			for (i=p*p; i<=n; i += (2*p))
				prime[i] = false;
		}
	}
	cout<<"2\n3\n";
	ll cnt=2;
	for (p=5; p<=n; p+=6){
        if(prime[p]){
            cnt++;
            cout<<p<<"\n";
        }
        if(prime[p+2]){
            cnt++;
            cout<<p+2<<"\n";
        }

	}
}

int main()
{
    /**ios_base::sync_with_stdio(false);
    cin.tie(NULL);/**Dont't use scanf of printf*/
    ll t,a,b,x,n,m;
    cin>>n>>m;
    n--;
    m--;
    n=(n*(n+1))/2;
    m=(m*(m+1))/2;
    cout<<n+m<<endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
 int N=int.Parse(Console.ReadLine());
  int A=int.Parse(Console.ReadLine());
      if((N%500)<=A){
        
      Console.WriteLine("Yes");
      }else{
      Console.WriteLine("No");
      }
}
  }

}


Measured memory_bytes: 27376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int H=sc.nextInt(),W=sc.nextInt();
		String[][] a = new String[H][W];
		boolean[] sharpx=new boolean[H];
		boolean[] sharpy=new boolean[W];

		for(int i=0;i<H;i++) {
			a[i]=sc.next().split("");
		}

		for(int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				if(a[i][j].equals("#")) {
					sharpx[i]=true;
					sharpy[j]=true;
				}
			}
		}

		for(int i=0;i<H;i++) {
			if(sharpx[i]) {
				for(int j=0;j<W;j++) {
					if(sharpy[j]) {
						System.out.print(a[i][j]);
					}
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 26772
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (int i = int(x); i < (int)(n); i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7
using ll = long long;

int main() {
    ll n;
    cin >> n;

    int cnt = 0;
    int c = pow(2, cnt);
    int prevCnt = c;
    bool isFind = false;
    int res;

    while(isFind == false){
        cnt++;
        c = pow(2, cnt);
        if(n >= prevCnt && n < c){
            res = prevCnt;
            isFind = true;
        }
        prevCnt = c;
    }

    cout << res << endl;
}

Measured memory_bytes: 3972
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
typedef long long ll;
const int N = 1e5+5;
ll l[N], r[N];
priority_queue<ll> q;
int x, y, z, n;
struct Node{
  int gold, silver, bronze;
  bool operator < (const Node& rh) const{
    if(gold-silver != rh.gold-rh.silver)
      return gold-silver < rh.gold-rh.silver;
    return silver > rh.silver;
  }
}node[N];

ll solve(){
  sort(node, node+n);
  ll sum = 0;
  while(!q.empty()) q.pop();
  for(int i = 0; i < y; i++){
    q.push(node[i].bronze - node[i].silver);
    sum += node[i].silver;
  }
  for(int i = y; i < y+z; i++){
    l[i] = sum;
    sum += node[i].silver;
    if(q.top() > node[i].bronze - node[i].silver){
      sum += q.top();
      q.pop();
      q.push(node[i].bronze - node[i].silver);
    }
    else sum += node[i].bronze - node[i].silver;
  }
  l[y+z] = sum;
  sum = 0;
  while(!q.empty()) q.pop();
  for(int i = n-1; i >= y+z; i--){
    q.push(node[i].bronze - node[i].gold);
    sum += node[i].gold;
  }
  r[y+z] = sum;
  for(int i = y+z-1; i >= y; i--){
    sum += node[i].gold;
    if(q.top() > node[i].bronze-node[i].gold){
      sum += q.top();
      q.pop();
      q.push(node[i].bronze-node[i].gold);
    }
    else sum += node[i].bronze-node[i].gold;
    r[i] = sum;
  }
  ll ans = 0;
  for(int i = y; i <= y+z; i++) ans = max(ans, l[i]+r[i]);
  return ans;
}

int main(){
  scanf("%d%d%d", &x, &y ,&z);
  n = x + y + z;
  for(int i = 0; i < n; i++)
  scanf("%d%d%d", &node[i].gold, &node[i].silver, &node[i].bronze);
  ll ans = solve();
  printf("%lld\n", ans);
}


Measured memory_bytes: 2808
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>

int main() {

    ll N, K;
    cin >> N >> K;

    vl H;
    ll h;
    for (int i = 0; i < N; i++) {
        cin >> h;
        H.push_back(h);
    }

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

    ll ans = 0;
    for (int i = 0; i < N-K; i++) {
        ans += H[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3444
#include <iostream>

using namespace std;

int main()
{
    string arr[7]={"SUN", "MON", "TUE", "WED","THU","FRI", "SAT"};
string s;cin>>s;
for(int i=0;i<7;i++)
{
  if(arr[i]==s)
  {
      cout<<(7-(i+1))+1;
      return 0;
  }
}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int a, b, x;
	cin >> a >> b >> x;
	if (x < a || x > a + b) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    count = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            if L[i] == L[j]:
                continue

            for k in range(j + 1, N):
                if L[j] != L[k]:
                    if L[i] + L[j] > L[k]:
                        count += 1
                    else:
                        break

    print(count)


if __name__ == "__main__":
    main()


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author OmarYasser
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner sc, PrintWriter out) {
            int n = sc.nextInt();
            boolean okT = false;
            int bad = 0, four = 0;
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                bad += !(x % 2 == 0 || x % 4 == 0) ? 1 : 0;
                okT |= (x % 2 == 0 && x % 4 != 0);
                four += (x % 4 == 0) ? 1 : 0;
            }
            if (bad == 0) out.println("Yes");
            else if (okT) out.println(bad <= four ? "Yes" : "No");
            else out.println(bad - 1 <= four ? "Yes" : "No");
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader f) {
            br = new BufferedReader(f);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 35900
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;
 
 
const int MAX_N = int(1e6) + 10;
long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()
 
 
 
 
//s.reserve(32768); //updated !
//s.max_load_factor(0.25);



int main(){
    


    int x;
    cin>>x;
    int a=1;
    if(x<=599)a=8;
    else if(x<=799)a=7;
    else if(x<=999)a=6;
    else if(x<=1199)a=5;
    else if(x<=1399)a=4;
    else if(x<=1599)a=3;
    else if(x<=1799)a=2;
    else a=1;

    cout<<a<<endl;
}
 
    
 
 
 
    
 
 
 
    
    
    
 
 
 
 
    
 
 
    
 
    
 
 
 
 
 
 
    
    
 
    
 
    
 
 
 
 
    
 


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define PER(i, a, b) for(int i = a; i >= b; i--)
#define LL long long
#define lowbit(x) x &(-x)
template<class T>inline void chkmax(T &x, const T &y) {if(x < y) x = y;}
template<class T>inline void chkmin(T &x, const T &y) {if(y < x) x = y;}
inline int read() {
    int x = 0, flag = 1;char ch = getchar();
    while(!isdigit(ch)) {
        if(ch == '-') flag = - 1;
        ch = getchar();
    }
    while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
    return x * flag;
}

const int N = 2e5 + 5;
const int mod = 1e9 + 7;
char c[N];
long long ans = 1;
int sum = 0, a[N], n;//left : 0  \\ right : 1

int main() {   
    n = read(); 
    scanf("%s", c);
    a[1] = 0; sum = 1;
    if(c[0] == 'W') {
        cout << 0 << endl;
        return 0;
    }
    REP(i, 2, 2 * n) {
        if(a[i - 1]) {
            if(c[i - 1] == c[i - 2]) a[i] = 0;
            else a[i] = 1;
        } else {
            if(c[i - 1] == c[i - 2]) a[i] = 1;
            else a[i] = 0;
        }
        if(a[i]) {
            ans = ans * sum % mod;
            sum --;
        } else sum ++;
    }
    if(sum) {
        cout << 0 << endl;
        return 0;
    }
    REP(i, 2, n) ans = ans * i % mod;
    printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1280
use std::io::prelude::*;

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

fn main() {
    let n: usize = input();
    let k: usize = input();
    let x: Vec<i64> = (0..n).map(|_| input()).collect();

    let left = x.lower_bound(&0);
    let mut ans = i64::max_value();
    if left >= k {
        ans = std::cmp::min(ans, i64::abs(x[left - k]));
    }
    if n - left >= k {
        ans = std::cmp::min(ans, x[left + k - 1]);
    }
    for i in 1..left + 1 {
        if i >= k || k - i > n - left {
            continue;
        }
        let j = k - i;
        let temp = i64::abs(x[left - i]) * 2 + x[left + j - 1];
        ans = std::cmp::min(ans, temp);
        let temp = x[left + j - 1] * 2 + i64::abs(x[left - i]);
        ans = std::cmp::min(ans, temp);
    }

    println!("{}", ans);
}

trait LowerBound<T: Ord> {
    fn lower_bound_by<F: FnMut(&T) -> std::cmp::Ordering>(&self, f: F) -> usize;
    fn lower_bound(&self, x: &T) -> usize {
        self.lower_bound_by(|e| e.cmp(x))
    }
    fn lower_bound_by_key<U: Ord, F: FnMut(&T) -> U>(&self, x: &U, mut f: F) -> usize {
        self.lower_bound_by(|e| f(e).cmp(x))
    }
}
impl<T: Ord> LowerBound<T> for [T] {
    fn lower_bound_by<F: FnMut(&T) -> std::cmp::Ordering>(&self, mut f: F) -> usize {
        let mut l = -1 as i64;
        let mut r = self.len() as i64;
        while r - l > 1 {
            let m = ((l + r) / 2) as usize;
            if f(&self[m]) == std::cmp::Ordering::Less {
                l = m as i64;
            } else {
                r = m as i64;
            }
        }
        r as usize
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    ll n,a=0,b=0;
    cin>>n;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0) {
            a=i;
            b=n/i;
        }
    }
    cout<<a+b-2<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

# import random
# N = 3 * 10 ** 5
# S = "".join(["WE"[random.randint(0, 1)] for _ in range(N)])

to_east = 0
to_west = S[1:].count("E")

min_turn = to_east + to_west
for i in range(1, N):
    if min_turn == 0:
        break
    if S[i - 1] == "W":
        to_east += 1
    if S[i] == "E":
        to_west -= 1
    min_turn = min(to_east + to_west, min_turn)

print(min_turn)


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


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

    int Sl = S.size();
    int Tl = T.size();

    vector<int> candi;

    int tmp = 0;

    for(int i=0;i<Sl - Tl + 1;i++){
        for(int j=0;j<Tl;j++){
            if(T[j] != S[i+j]) tmp++;
        }
        candi.push_back(tmp);
        tmp = 0;
    }

    //rep(i,candi.size()) cout << candi[i] << endl;

    tmp = 10000;

    rep(i,candi.size()){
        if(tmp > candi[i]) tmp = candi[i];
    }

    int ans = *std::min_element(candi.begin(), candi.end());
    cout << tmp << endl;
    return 0; 
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll x, y;
  ll ans = -LLONG_MAX;
  chmax(ans, a * c);
  chmax(ans, a * d);
  chmax(ans, b * c);
  chmax(ans, b * d);
  cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[][] A = new int[2][N];
		
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < N; j++) {
				A[i][j] = sc.nextInt();
			}
		}		
		
		int sum = 0;

		for(int i = 0; i < N; i++) {
			int temp = 0;
			for(int j = 0; j <= i; j++) {
				temp += A[0][j];
			}
			for(int j = i; j < N; j++) {
				temp += A[1][j];
			}
			sum = Math.max(sum, temp);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 23124
#include<stdio.h>

int f(int x){
	return x*x;
}

int main(void){
	
	int d,i;
	int s;
	
	while(scanf("%d",&d)!=EOF){

		s=0;
	
		for(i=1;(i*d)<=(600-d);i++){
			s=f(i*d)*d+s;
		}
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
    int n, i, j, min=100000000;
    scanf("%d", &n);
    int x[n];
    for (i=0;i<n;i++){
        scanf("%d", &x[i]);
    }
    for (j=1;j<101;j++){
        int dist=0;
        for (i=0;i<n;i++){
            dist += (x[i]-j)*(x[i]-j);
        }
        if (dist<min){
            min = dist;
        }
    }
    printf("%d", min);
    return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
k, a, b = map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字

bis = 1
m = 0
if b - a < 2:
    print(bis + k)
else:
    change = (k - (a - 1)) // 2
    bis += k - change * 2
    bis += change * (b - a)
    print(bis)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll  = long long;
#define int ll

signed main() {
#ifdef LC
    assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0), cin.tie(0);

	int a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	int dst = abs(a - b);
	int spd = v - w;
	if (spd > 0 && spd * t >= dst) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}
    return 0;
}


Measured memory_bytes: 3640
#include <cstdio>

const int maxn = 100005;
int n, m, dp[maxn], opt[maxn], d[maxn], h, t, ans[maxn], c;
char s[maxn];

int main(){
    scanf("%d %d\n%s", &n, &m, s);
    dp[0] = 1; d[t++] = 0;
    for(int i = 1; i <= n; i++){
        while(d[h] < i - m) h++;
        if(s[i] == '1') dp[i] = 1e9;
        else dp[i] = dp[d[h]] + 1; opt[i] = d[h];
        while(h < t && dp[d[t - 1]] > dp[i]) t--;
        d[t++] = i;
    }
    if(dp[n] >= 1e9) puts("-1");
    else{
        for(int i = n; i; i = opt[i]) ans[c++] = i - opt[i];
        while(c--) printf("%d ", ans[c]);
    }
    return 0;
}

Measured memory_bytes: 2048
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
-- templete

type ColorCode = (Int,Int,Int)
distC :: ColorCode -> ColorCode -> Int
distC (r,g,b) (r',g',b') = sum $ map (^2) [r-r', g-g', b-b']

type Color = (String, ColorCode)

colorList = [("black", (0,0,0)), ("blue", (0,0,255)), ("lime", (0, 255, 0)), ("aqua", (0, 255, 255)), ("red", (255,0,0)), ("fuchsia", (255,0,255)), ("yellow", (255, 255, 0)), ("white", (255, 255, 255))]

f ['#',rr,r,gg,g,bb,b] = fst $ minimumBy (comparing (distC (red, green, blue) . snd)) colorList
  where
    red = 16 * digitToInt rr + digitToInt r
    green = 16 * digitToInt gg + digitToInt g
    blue = 16 * digitToInt bb + digitToInt b
    

main = takeWhile (/="0") . lines <$> getContents >>= mapM_ (putStrLn . f)
    



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

class mint {
  int value;

public:
  static const int MOD = 1000 * 1000 * 1000 + 7;
  //static const int MOD = 29;

  mint(long long x)
      : value(x % MOD) {}

  mint operator+(mint y) const {
    return mint(value + y.value);
  }

  mint operator+=(mint a) {
    return *this = *this + a;
  }

  mint operator*(mint y) const {
    return mint(long(value) * y.value);
  }

  mint operator*=(mint a) {
    return *this = *this * a;
  }

  mint operator-() const {
    return *this * mint(-1);
  }

  mint operator-(mint y) const {
    return *this + (-y);
  }

  mint operator-=(mint a) {
    return *this = *this - a;
  }

  operator int() {
    return value;
  }

  static mint pow(mint a, int n) {
    if (n <= 0) {
      return 1;
    }
    else if (n == 1) {
      return a;
    }
    mint half = pow(a, n / 2);
    return n % 2 ? half * half * a : half * half;
  }
};

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

  vector<mint> part(K + 1, 0);

  for (int X = K; X >= 1; X--) {
    int c = floor(K / X);
    part[X] = mint::pow(c, N);
    for (int j = 2; j <= c; j++) {
      part[X] -= part[X * j];
    }
  }

  mint ans = 0;
  for (long i = 1; i <= K; i++) {
    ans += i * part[i];
  }

  cout << ans << endl;
}

Measured memory_bytes: 3796
import sys
input=sys.stdin.readline


def solve():
  N = int(input())

  A, B, C = 0, 0, 0
  for _ in range(N):
      a, b, c = map(int, input().split())
      A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c
  return max(A, B, C)
 
if __name__ == "__main__":
	print(solve())

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

int main() {
    
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    sort(vec.begin(), vec.end());

        cout << vec.at(0)+vec.at(1) << endl;
    
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    a = 100
    p = 1.01
    X = int(input().rstrip())
    i = 0
    while True:
        i += 1
        a = int(a * p)
        if a >= X:
            print(i)
            break


if __name__  == '__main__':
    main()

Measured memory_bytes: 9184
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t int64;

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

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


class D {
	int n, m, q;
	static const int MAX_M{ 200001 };
	static const int MAX_N{ 501 };

public:
	D()
	{
		cin >> n >> m >> q;
	}

	// O(n^2 + qn)
	void solve_cumulative()
	{
		int l, r;
		int x[MAX_N][MAX_N], cum[MAX_N][MAX_N];

		REP(i, m)
		{
			cin >> l >> r;
			++x[l][r];
		}

		// O(n^2)
		REP(i, n)
			REP(j, n)
		{
			cum[i + 1][j + 1] = cum[i + 1][j] + x[i + 1][j + 1];
		}

		// O(qn)
		REP(i, q) // q loops
		{
			cin >> l >> r;
			int sum{ 0 };

			for (int j{ l }; j <= q; j++) // n loops
				sum += cum[j][q] - cum[j][l - 1];

			cout << sum << endl;
		}

		// end solution solve_cumulative
	}

	// O(n^2 + q)
	void solve_2Dcumulative()
	{
		int l, r;
		int cum[MAX_N][MAX_N];
		memset(cum, 0, sizeof cum);

		REP(i, m)
		{
			cin >> l >> r;
			++cum[l][r];
		}

		// O(n^2)
		REP(i, n)
			REP(j, n)
			cum[i + 1][j + 1] += cum[i + 1][j];
		// O(n^2)
		
		REP(i, n)
			REP(j, n)
			cum[i + 1][j + 1] += cum[i][j + 1];

		// O(q)
		REP(i, q)
		{
			cin >> l >> r;

			int ans{ cum[r][r] + cum[l - 1][l - 1] - cum[l - 1][r] - cum[r][l - 1] };

			cout << ans << endl;
		}

		// end solution solve_2Dcumulative
	}

	void solve()
	{
		solve_2Dcumulative();
	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 1920
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

       while(in.hasNextInt()) {
	       int H = in.nextInt();
	       int W = in.nextInt();
	       if(H == 0 && W == 0) return;

	       for(int i=0;i<H;i++) {
		       for(int j=0;j<W;j++) {
			       System.out.printf("#");
		       }
		       System.out.println("");
	       }
	       System.out.println("");
       }
    }
}

Measured memory_bytes: 44704
import sys
 
 
def main():
  input = sys.stdin.readline
  S = str(input().strip())
  K = int(input())
  max = min(5, len(S))
  sub = []
  for i in range(len(S)):
    for j in range(1, max+1):
      if i+j > len(S):
        continue
      sub.append(S[i:i+j])
  sub = sorted(list(set(sub)))
  print(sub[K-1])
 
 
if __name__ == '__main__':
  main()

Measured memory_bytes: 5068
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// カード数・ゲート数 - 取得
	int liCCnt, liGCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &liCCnt, &liGCnt);

	// 対象カード
	int liMin = 1;
	int liMax = liCCnt;

	// ゲート - 取得
	for (i = 0; i < liGCnt; i++) {
		int liCNo1, liCNo2;
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d%d", &liCNo1, &liCNo2);

		// 対象カード - 更新
		if (liMin < liCNo1) {
			liMin = liCNo1;
		}
		if (liMax > liCNo2) {
			liMax = liCNo2;
		}
	}

	// 対象カード数
	liCCnt = liMax - liMin + 1;
	if (liCCnt < 1) {
		return 0;
	}
	else {
		return liCCnt;
	}
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOut(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 128
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int N;
const int MAX_N = 111;
char a[MAX_N];

string dp[MAX_N][MAX_N];
bool chk[MAX_N][MAX_N];

bool cmp(string &l, string &r){
    if(r.empty())return true;
    if(l.size()!=r.size())return l.size()<r.size();
    return l < r;
}

string f(int L,int R){
    if(L>R)return "";

    string& ret = dp[L][R];
    if(chk[L][R])return ret;
    chk[L][R] = 1;
    string t;
    if(a[L] == '('){
        t = "(" + f(L+1,R) + ")";
        if(cmp(t, ret)){
            ret = t;
        }
    }
    if(a[R] == ')'){
        t = "(" + f(L,R-1) + ")";
        if(cmp(t, ret)){
            ret = t;
        }
    }
    if(a[L] == '(' && a[R] == ')'){
        t = "(" + f(L+1,R-1) + ")";
        if(cmp(t, ret)){
            ret = t;
        }
    }
    for(int i=L;i<R;i++){
        t = f(L,i)+f(i+1,R);
        if(cmp(t,ret)){
            ret = t;
        }
    }
    return ret;
}

int main(){
    scanf("%d",&N);
    scanf("%s",a);

    printf("%s\n",f(0,N-1).c_str());

    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

int main() {
    string S;
    ll K;
    cin >> S >> K;
    
    // K文字目までをチェック
    for (ll i = 0; i < K; ++i) {
        if (S[i] != '1') {
            // 1以外が出たら答え
            cout << S[i] << endl;
            return 0;
        }
    }
    
    // K文字目まで全部1 -> 1が答え
    cout << 1 << endl;
    return 0;
}

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() {
  string n;
  cin >> n;
  char t;
  if(n.size()==3)t=n[2];
  else if(n.size()==2) t=n[1];
  else t=n[0];

  if(t=='3') cout << "bon" << endl;
  else if (t=='0'||t=='1'||t=='6'||t=='8') cout << "pon" << endl;
  else cout << "hon" << endl;

  return 0;
}

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

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

    for(int i=1; i<=n; i++){
        vector<bool> base;
        for(int j=1; j<=3; j++){
            base.push_back(false);
        }
        int out = 0;
        int point = 0;
        while(1){
            if(out == 3) break;
            string str;
            cin >> str;
            if(str == "HIT"){
                if(base[2] == true){
                    base[2] = false;
                    point++;
                }
                if(base[1] == true){
                    base[2] = true;
                    base[1] = false;
                }
                if(base[0] == true){
                    base[1] = true;
                }
                base[0] = true;
            }
            if(str == "HOMERUN"){
                int cnt = 0;
                for(int j=0; j<3; j++){
                    if(base[j] == true){
                        base[j] = false;
                        cnt++;
                    }
                }
                point += cnt + 1;
            }
            if(str == "OUT"){
                out++;
            }
        }
        cout << point << endl;
    }
    return 0;
}

Measured memory_bytes: 0
function Main(input) {
  input = input.split("\n");
  var D= parseInt(input[0]);
  var ans="";
  if(D==25){
    ans="Christmas";
  }else if(D==24){
    ans="Christmas Eve";
  }else if(D==23){
    ans="Christmas Eve Eve";
  }else{
    ans="Christmas Eve Eve Eve";
  }

  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

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

using namespace std;
using ll = long long int;
using ull = unsigned long long;

constexpr ull mod = 1e9+7;
constexpr int N = 13;
ull dp[100010][N];

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if (a+b+c >= 22) {
		cout << "bust" << endl;
	} else {
		cout << "win" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
r,c = [int(x) for x in input().split()]

s = [0 for x in range(c)]

for i in range(r):
    l = [int(x) for x in input().split()]
    for j in range(c):
        s[j] += l[j]
        print(l[j],end="")
        print(" ",end="")
    print(sum(l))

for j in s:
    print(j,end="")
    print(" ",end="")
print(sum(s))


Measured memory_bytes: 5672
#include <stdio.h>

int main(void)
{
	int a, b, x;
	char op;
	while (1)
	{
		scanf("%d %c %d", &a, &op, &b);
		if (op == '?')
			break;
		switch (op)
		{
			case '+':
				x = a + b;
				break;
			case '-':
				x = a - b;
				break;
			case '*':
				x = a * b;
				break;
			case '/':
				x = a / b;
				break;
		}
		printf("%d\n", x);
	}
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
//#define int long long 
#define lb lower_bound
#define mkp make_pair
//#define d double
void solve(){
	string s;
	cin>>s;
	int n=s.length();
	string r=string(n,'x');
	cout<<r<<endl;
	
 
 
 
 
 
 
}
int32_t main(){
int t=1;
//cin>>t;
while(t--){
	solve();
}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
struct State {
	int ones;
	int twos;
};
bool att(State &A, State &B, int type) {
	if (type == 0) {
		int num = A.ones + A.twos;
		int k = min(B.ones, num);
		B.ones -= k;
		num -= k;
		if (num > 0) {
			B.twos -= num / 2;
			num -= (num / 2) * 2;
			if (num == 1) {
				B.twos--;
				B.ones++;
				num--;
			}
			if (B.twos < 0) {
				B.twos = 0;
				B.ones = 0;
			}
		}
	}
	else {
		int num = A.ones + A.twos;
		int k = min(B.twos, num);
		B.twos -= k;
		B.ones += k;
		num -= k;
		k = min(B.ones, num);
		B.ones -= k;
		num -= k;

	}
	return (B.ones + B.twos <= 0);
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	State A;
	A.twos = N;
	A.ones = 0;
	State B;
	B.twos = M;
	B.ones = 0;
	int ans = 0;
	while (true) {
		if (!att(A, B, 0)) {
			ans++;
		}
		else {
			break;
		}
		//cerr << A.twos << " " << A.ones << " " << B.twos << " " << B.ones << endl;
		if (!att(B, A, 1)) {
			ans++;
		}
		else {
			break;
		}
		//cerr << A.twos << " " << A.ones << " " << B.twos << " " << B.ones << endl;
	}
	//cerr << ans << endl;
	int res = ans;
	A.twos = N;
	A.ones = 0;
	B.twos = M;
	B.ones = 0;
	ans = 0;
	while (true) {
		if (!att(A, B, 1)) {
			ans++;
		}
		else {
			break;
		}
		if (!att(B, A, 0)) {
			ans++;
		}
		else {
			break;
		}
	}
	//cerr << ans << endl;
	res = min(res, ans);

	//if (N >= 2 * M) {
	//	res = 0;
	//}
	//else if (N >= M) {
	//	res = 2;
	//}
	//else if (N * 2 <= M) {
	//	res = 1;
	//}
	//else if (N < M) {
	//	int res = 0;

	//}
	//else {

	//}
	cout << res << endl;
}


Measured memory_bytes: 3156
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

const int mod = INF+7;
int main(){
    ll x,y;cin>>x>>y;
    ll res = 0;
    while(x<=y){
        x *= 2;
        res++;
    }
    cout<<res<<endl;
}



Measured memory_bytes: 256
// AOJ 2019: Princess's Marriage
// 2017.9.30

#include <stdio.h>
#include <stdlib.h>

typedef struct { int d, p; } T;
T tbl[10003];

int cmp(T *a, T *b) { if (b->p - a->p) return b->p - a->p; return a->d - b->d; }

int main()
{
	int n, m, i, sum, ans;

	while (scanf("%d%d", &n, &m) && n > 0) {
		for (i = 0; i < n; i++) scanf("%d%d", &tbl[i].d, &tbl[i].p);
		qsort(tbl, n, sizeof(T), cmp);
		for (ans = sum = 0, i = 0; i < n ; i++) {
			sum += tbl[i].d;
			if (sum > m) { ans = (sum - m) * tbl[i++].p; break; }
		}
		for ( ; i < n; i++) ans += tbl[i].d * tbl[i].p;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1900
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int n,m; cin >> n >> m;
    cout << (n*(n-1)/2 + m*(m-1)/2) << endl;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

ll getDigit(ll x) {
    ll cnt = 0;
    while (x > 0) {
        x /= 10;
        cnt++;
    }
    return cnt;
}

int main() {
    ll N;
    cin >> N;

    ll Min = 1e13;
    for (ll i = 1; i*i <= N; i++) {
        if (N % i != 0) continue;
        ll tmp = max(getDigit(i), getDigit(N / i));
        Min = min(tmp, Min);
    }

    cout << Min << endl;

    return 0;
}

Measured memory_bytes: 256
n, *A = map(int, open(0).read().split())
mod = 10**9 + 7
ans = 0
d = 1
while any(A):
  c = 0
  for i in range(n):
    q, r = divmod(A[i], 2)
    A[i] = q
    c += r
  ans += c*(n-c) * d
  ans %= mod
  d *= 2
print(ans % mod)

Measured memory_bytes: 156044
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
n=int(input())
for i in range(n):
    p=int(input())
    for q in range(3):
        if a[q]==p:
            a[q]=0
        if b[q]==p:
            b[q]=0
        if c[q]==p:
            c[q]=0
f=0
if a[0]==a[1]==a[2] or b[0]==b[1]==b[2] or c[0]==c[1]==c[2]:
    f=1
if a[0]==b[0]==c[0] or a[1]==b[1]==c[1] or a[2]==b[2]==c[2]:
    f=1
if a[0]==b[1]==c[2] or a[2]==b[1]==c[0]:
    f=1
print("Yes" if f==1 else "No")
       

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

int main() {
  int tour[1000];
  tour[0] = 0;
  for ( int i = 1; i < 1000; i++ ) {
    tour[i] = tour[i-1] + i;
  }

  int a, b;
  cin >> a >> b;
  int ans = -1;
  for ( int i = 1; i < 999; i++ ) {
    if ( tour[i]-a == tour[i+1]-b ) {
      ans = tour[i]-a;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3612
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    mod = 10**9 + 7

    n = int(input())
    c = list(map(int, input().split()))
    c.sort()
    res = 0
    b = pow(2, n, mod)
    for i in range(n):
        l = pow(2, i, mod)
        if n-i-2 >= 0:
            r = pow(2, n-i-1, mod) + (n-i-1)*pow(2, n-i-2, mod)
        else:
            r = pow(2, n-i-1, mod)
        res += b*c[i]*l*r % mod
        res %= mod
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 78804
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        int ct = 1;

        List<Long> divisorsA = getFact(A);
        List<Long> divisorsB = getFact(B);

        for(long d: divisorsA) {
            if(divisorsB.contains(d)) {
                ct += 1;
            }
        }

        System.out.println(ct);
    }

    private static List<Long> getFact(long n) {
        List<Long> divs = new ArrayList<>();
        if(n% 2 == 0) {
            divs.add((long)2);
            while(n% 2 == 0) {
                n/= 2;
            }
        }

        for(long k = 3; k <= Math.sqrt(n); k += 2) {
            if(n% k == 0) {
                divs.add(k);
                n/= k;
                while(n% k == 0) {
                    n/= k;
                }
            }
        }

        if(n > 2) {
            divs.add(n);
        }

        return divs;
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main() {
    map<string ,int> map;
    string s;
    int n;
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> s;
        if(map.count(s)) {
            map.at(s)++;
        }else {
            map[s] = 1;
        }
    }
    int m;
    cin >> m;
    for(int i = 0;i < m;i++) {
        cin >> s;
        if(map.count(s)) {
            map.at(s)--;
        }else {
            map[s] = -1;
        }
    }
    int maxi = -m;
    for(auto p : map) {
        auto key = p.first;
        auto value = p.second;
        if(maxi < value) {
            maxi = value;
        }
    }
    cout << max(maxi,0) << endl;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  int x,ans;
  x = b-a;
  ans = 0;
  for(int i =0;i<x;i++){
    ans += i+1;
  }
  ans = ans - b;
  
  cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict

if __name__ == "__main__":
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    bc = [list(map(int, input().split())) for _ in range(m)]

    card = defaultdict(int)
    for aa in a:
        card[aa] += 1

    for task in bc:
        card[task[1]] += task[0]

    key = sorted(card.keys(), reverse=True)

    res = n
    ans = 0
    for k in key:
        if card[k] >= res:
            ans += res * k
            break
        else:
            ans += card[k] * k
            res -= card[k]

    print(ans)


Measured memory_bytes: 54088