akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	int R;
	cin >> R;

	if (R < 1200)
		COUT("ABC");
	else if (R < 2800)
		COUT("ARC");
	else
		COUT("AGC");

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define LINE_MAX ( 30 )

/** Application main entry point. */
int main (
  int argc,
  char *argv[ ]
  )
{
  int pos[ LINE_MAX + 1 ];
  int w, n;
  int i;

  scanf ( "%d %d", &w, &n );
  for ( i = 1; i <= w; ++i )
  {
    pos[ i ] = i;
  }

  for ( i = 0; i < n; ++i )
  {
    int c1, c2, tmp;

    scanf ( " %d,%d", &c1, &c2 );

    tmp = pos[ c1 ];
    pos[ c1 ] = pos[ c2 ];
    pos[ c2 ] = tmp;
  }

  for ( i = 1; i <= w; ++i )
  {
    printf ( "%d\n", pos[ i ] );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main() {
    
    //0
    //1
    //B

    string input;

    cin >> input;

    for(int i =0;i < input.length();i++){
        switch (input[i]) {
            case '1':
                break;
            case '0':
                break;
            case 'B':
                if(i != 0){
                    input.erase(input.begin() + i-1);
                    input.erase(input.begin() + i-1);
                    i -= 2;
                }else{
                     input.erase(input.begin() + i);
                     i -= 1;
                }
                break;
            default:
		
		    break;
        }
    }

    cout << input << endl;

    


    return 0;
}


///
//
/*
文字列のN番目の位置に文字を挿入する
文字列に末尾に文字を追加する
文字列の先頭に文字を追加する





*/

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

int main(){
    int n;
    cin>>n;
    vector<int> dp(n+1);
    dp[0]=1;
    rep(i,n){
        for(int j=0;j<=i-3;j++){
            dp[i]+=dp[j];
            dp[i]%=MOD;
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 3640
import Data.List (permutations)

main = do
    a <- readLn :: IO Integer
    b <- readLn :: IO Integer
    c <- readLn :: IO Integer
    d <- readLn :: IO Integer
    e <- readLn :: IO Integer
    print $ minimum $ map takeTimes (permutations [a, b, c, d, e])
    
takeTimes :: [Integer] -> Integer
takeTimes ls =
    sum (map ce heads) + t
    where
        heads = init ls
        t = last ls

ce :: Integer -> Integer
ce a =
    div a 10 * 10 + t
    where
        t = if mod a 10 == 0 then 0 else 10


Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	V a(n + 1);
	V sum(n + 1, 0);
	rep1(i, n) {
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	int ans = 0;
	rep1(i, n) {
		ans += a[i] * (sum[n] - sum[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[500005];
int prv[500005];
int nxt[500005];
int32_t main(){
	string s;cin>>s;int n=s.length();
	int ans=0;
	for(int i=0;i<n;i++){
		if(s[i]=='<') prv[i+1]=prv[i]+1;
	}
	ans += prv[n];
	for(int i=n-1;i>=0;i--){
		if(s[i]=='>') nxt[i]=nxt[i+1]+1;
		ans += max(prv[i],nxt[i]);
	}
	/*for(int i=0;i<=n;i++){
		cout<<prv[i]<<" ";
	}
	cout<<"\n";
	for(int i=0;i<=n;i++){
		cout<<nxt[i]<<" ";
	}
	cout<<"\n";
	*/cout<<ans;
}


Measured memory_bytes: 9092
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
T=np.zeros((H,W),dtype=int)
B=np.zeros((H,W),dtype=int)
L=np.zeros((H,W),dtype=int)
R=np.zeros((H,W),dtype=int)

for i in range(1,H):  
    T[i,:]=(T[i-1,:]+1)*S[i-1,:]

for i in reversed(range(H-1)):
    B[i,:]=(B[i+1,:]+1)*S[i+1,:]

for j in range(1,W):
    L[:,j]=(L[:,j-1]+1)*S[:,j-1]        

for j in reversed(range(W-1)):
    R[:,j]=(R[:,j+1]+1)*S[:,j+1]
        

na=((T+B+L+R)*S).max()+1

print(na)


Measured memory_bytes: 217540
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int x, a, b, c;

            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);
            Console.ReadKey();
         }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define test(a) cout << "*" << a << endl;
#define rep0(i,n) for(i=0;i<n;i++)
int main(){
  string s;
  string t;
  int i,j;
  int s0Tmp;
  bool exist = false;
  
  cin >> s >> t;
  
  rep0(j,s.size()){
    rep0(i,s.size()){   
      if(i==0){
        s0Tmp = s[i];
        s[i] = s[i+1];
      }
      else if(i==s.size()-1){
        s[i] = s0Tmp;
      }
      else{
        s[i] = s[i+1];
      }
    }
     
    if(s==t){
      exist = true;
      break;
    }
  }
  
  if(exist==true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


int main() {
	init();

	int N; cin >> N;
	vector<int>vec(N);
	rep(i, 0, N)cin >> vec[i];
	rep(i, 0, N) {
		cout << vec[i];
		if (i == N - 1)cout << "\n";
		else cout << " ";
	}
	rep(i, 1, N) {
		int v = vec[i];
		int j = i - 1;
		while (j >= 0 && vec[j] > v) {
			vec[j + 1] = vec[j];
			j--;
		}
		vec[j + 1] = v;
		rep(i, 0, N) {
			cout << vec[i];
			if (i == N - 1)cout << "\n";
			else cout << " ";
		}
	}

	return 0;
}


Measured memory_bytes: 3164
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,r,x,y;
	ll		ans = 0;
	string	s;
	cin >> r;
	ans = r*r;
	//if (ans<0) ans = 0;
	//vector<ll>	aa(n);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));

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


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

#undef false
#undef true

using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

/* [💭] [💡] [🎈] */

const ll mod = 1000000007;

ll modpow(ll a, ll n) {
    ll p = 1, x = a;
    while (n) {
        if (n & 1) {
            p *= x;
            p %= mod;
        }
        x *= x;
        x %= mod;
        n >>= 1;
    }
    return p;
}

ll binom(ll n, ll k) {
    ll p = 1, q = 1;
    for (int i = 1; i <= k; i++) {
        q *= i;
        q %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        p *= i;
        p %= mod;
    }
    return p * modpow(q, mod - 2) % mod;
}

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

    ll n, a, b;
    cin >> n >> a >> b;

    ll s = modpow(2, n) - 1;
    s -= binom(n, a);
    s -= binom(n, b);
    s %= mod;
    if (s < 0) s += mod;
    cout << s;

    return 0;
}

Measured memory_bytes: 256
using System;
class Ho{
  static void Main(){
    var b = Console.ReadLine().Split();
    var N = int.Parse(b[0]);
    var X = int.Parse(b[1]);
    var zenb = Console.ReadLine().Split();
    var L = new int[N+1];
    for(var i =0;i<N;i++){
      L[i+1]=int.Parse(zenb[i]);
    }
    var D = 0;
    var kaisuu = 0;
    for(var i =0 ;i<N+1;i++){
      D += L[i];
      if(D > X){
       
        break;
      }
      kaisuu++;
    }
    Console.WriteLine(kaisuu);
      
  }
}

Measured memory_bytes: 13140
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define MAX_DWORD				(0xFFFFFFFF)
#define	MAX_SDWORD				((SDWORD)0x7FFFFFFF)
#define	MIN_SDWORD				((SDWORD)0x80000000)
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846

typedef long					SDWORD;
typedef long long				SQWORD;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef long long ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
#define N_MAX	(200 * 1000)
#define K_MAX	(10)
#define M_MAX	(10)
#define Q_MAX	(10)
#define H_MAX	(1000)
#define W_MAX	(1000)

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

	int ans = 0, cnt = 1;
	for (int i = 100; i >= 0; i--) {
		if ((0 == (A % i)) && (0 == (B % i))) {
			if (cnt == K) {
				ans = i;
				break;
			}
			cnt++;
		}
	}
	cout << ans <<endl;

	return 0;
}


Measured memory_bytes: 256
import sys
import bisect

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return -1


#fin = open("test.txt", "r")
fin = sys.stdin

n = int(fin.readline())
S = list(map(int, fin.readline().split()))
q = int(fin.readline())
T = list(map(int, fin.readline().split()))

ret = 0

for t in T:
	if index(S, t) >= 0:
		ret += 1

print(ret)

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;







int n, m, s, t;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;


void dijkstra(int s, vector<vector<pair<int, int>>> &E, vector<ll> &D, vector<ll> &C) {
	REP(i, n) D[i] = INFL;

	min_priority_queue<pair<ll, int>> que;

	D[s] = 0;
	que.push({ 0, s });

	while (!que.empty()) {
		auto q = que.top();
		que.pop();

		ll cst = q.first;
		int cu = q.second;


		fore(p, E[cu]) {
			ll cst2 = cst + p.second;
			int to = p.first;
			if (D[to] == cst2) {
				C[to] += C[cu];
				C[to] %= mod;
			}
			
			if (chmin(D[to], cst2)) {
				que.push({ D[to], to });
				C[to] = C[cu];
			}
		}
	}
}



int main() {


	cin >> n >> m >> s >> t;
	s--; t--;

	vector<vector<pair<int, int>>> c(n), d(n);

	VLL da(n), db(n);

	vector<pair<int, pair<int, int>>> p;

	REP(i, m) {
		int u, v, a, b;
		cin >> u >> v >> a;
		u--; v--;
		p.push_back({ u,{v,a} });
		p.push_back({ v,{u,a} });
		c[u].push_back({ v,a });
		c[v].push_back({ u,a });
		d[u].push_back({ v,a });
		d[v].push_back({ u,a });
	}

	VLL pa(n, 0), pi(n, 0);
	pa[s] = 1;
	pi[t] = 1;

	dijkstra(s, c, da, pa);
	dijkstra(t, d, db, pi);
	REP(i, n) {
		pa[i] %= mod;
		pi[i] %= mod;
	}

	ll ans = pa[t] * pa[t] % mod;




	REP(i, n) {
		if (da[i] + da[i] == da[t]) {
			ans -= pa[i] * pi[i] % mod * pa[i] % mod * pi[i] % mod;
			ans += mod;
			ans %= mod;
		}
	}



	REP(i, m * 2) {
		int a = p[i].first;
		int b = p[i].second.first;
		int c = p[i].second.second;
		if (da[a] + da[a] == da[t])continue;
		if (da[a] + db[b] + c == da[t]) {
			if (da[a] + da[a] < da[t] && db[b] + db[b] < da[t]) {
				ans -= pa[a] * pi[b] % mod*pa[a] % mod*pi[b] % mod;
				ans += mod;
				ans %= mod;
			}
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 28332
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pll pair < ll , ll >
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ld long double
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
ll M = 1e9 + 7;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

int main()
{

    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector < ll > ans(n,0);
    for( int i = 0; i < n-1; i++)
    {
        int b;
        cin >> b;
        b--;
        ans[b]++;
    }
    for( auto it : ans)
    {
        cout << it << endl;
    }
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}

ll dp[100001];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  // memset(dp, INF, sizeof(dp));
  int arr[m];
  fi(0, m) {
    int x;
    cin >> x;
    dp[x - 1] = -1;
  }
  if(dp[0] != -1) dp[0] = 1;
  if(dp[1] != -1) {
    dp[1] = (dp[0] == -1 ? 1 : 2);
  }
  fi(2, n) {
    if(dp[i] == -1) continue;
    if(dp[i - 1] != -1) (dp[i] += dp[i - 1]) %= MOD;
    if(dp[i - 2] != -1) (dp[i] += dp[i - 2]) %= MOD;
  }
  cout << dp[n - 1];
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main(){
  int a;
  ll b,n;
  cin >> a >> b >> n;

  ll ans = 0;
  if(b > n){
    ans = a*n/b;
  }else{
    ans = a*(b-1)/b;
  }

  cout << ans << endl;
}


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

typedef long long int   ll;
#define int             ll
#define PI              3.1415926535897932384626433832795

#define pb              push_back
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]

#define hell            freopen("input.txt","r", stdin);freopen("output.txt", "w", stdout);freopen("error.txt", "w",stderr);
#define fastasF_boi()   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
//#define cerr            if(false)cerr

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mulmod(int a,int b){return ((a%mod)*(b%mod))%mod;}
int addmod(int a,int b){return (((a%mod)+(b%mod))+mod)%mod;}

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

signed main(){
//    hell;

    fastasF_boi();
    int t=1;
//    cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
}



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

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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)




int main(){
    int h,w;
    scanf("%d %d",&h,&w);
    int a[h][w];
    queue<pair<int,int>> Q;
    rep(i,h){
        char s[w+1];
        scanf("%s",s);
        rep(j,w){
            if(s[j]=='#'){
                a[i][j]=1;
                Q.push(make_pair(i,j));
            }
            else a[i][j]=0;
        }
    }
    int ctr=0;
    

    while(!Q.empty()){
        vector<pair<int,int>> blist;
        while(!Q.empty()){
            blist.push_back(Q.front());
            Q.pop();
        }
        for(auto au:blist){
            if(au.first+1<h&&a[au.first+1][au.second]==0){
                a[au.first+1][au.second]=1;
                Q.push(make_pair(au.first+1,au.second));
            }
            if(au.first-1>=0&&a[au.first-1][au.second]==0){
                a[au.first-1][au.second]=1;
                Q.push(make_pair(au.first-1,au.second));
            }
            if(au.second+1<w&&a[au.first][au.second+1]==0){
                a[au.first][au.second+1]=1;
                Q.push(make_pair(au.first,au.second+1));
            }
            if(au.second-1>=0&&a[au.first][au.second-1]==0){
                a[au.first][au.second-1]=1;
                Q.push(make_pair(au.first,au.second-1));
            }
        }
        ctr++;
    }
    cout<<ctr-1<<endl;
}




Measured memory_bytes: 21760
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node{
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k){
	while(u != NIL && k != u->key){
		if(k < u->key )u = u->left;
		else u = u->right;
	}
	return u;
}
void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
	
  while( x != NIL ){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if( y == NIL ){
    root = z;
  } else {
    if( z->key < y->key ){
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if ( u == NIL ) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
	int n, i, x;
	string com;
	
	scanf("%d", &n);
	
	for(i=0; i<n; i++){
		cin >> com;
		if(com[0] == 'f'){
			scanf("%d", &x);
			Node *t = find(root, x);
			if(t != NIL)printf("yes\n");
			else printf("no\n");
		}else if (com == "insert"){
			scanf("%d", &x);
			insert(x);
		}else if(com == "print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
	
	return 0;
}


Measured memory_bytes: 22056
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;

public class Main {

    private static final class FastInput {
        private final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer st;

        private int nextInt() throws Exception {
            return Integer.parseInt(nextWord());
        }

        private long nextLong() throws Exception {
            return Long.parseLong(nextWord());
        }

        private String nextWord() throws Exception {
            if (st == null || !st.hasMoreElements()) st = new StringTokenizer(br.readLine(), " ");
            return st.nextToken();
        }

        private long[] lineToIntArr(int len) throws Exception {
            long[] arr = new long[len];
            for (int i = 0; i < arr.length; i++) arr[i] = nextLong();
            return arr;
        }
    }

    public static void main(String[] args) throws Exception {
        FastInput in = new FastInput();
        int n = in.nextInt();
        int k = in.nextInt();
        long[] stones = in.lineToIntArr(n);
        long[] dp = new long[n + 1];
        for(int i =0; i <=n; ++i){
            dp[i] = 1000000007;
        }
        dp[0] = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 1; j <= k; ++j) {
                if(i + j < n){
                    dp[i+j] = Math.min(dp[i+j], dp[i] + Math.abs(stones[i] - stones[j+i]));
                }
            }
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        bw.write(String.valueOf(dp[n-1]));
        bw.flush();
    }
}


Measured memory_bytes: 34512
import math as m

k = int(input())
ans = 0

for i in range(1, k+1):
    for j in range(i, k+1):
        for n in range(j, k+1):
            g = m.gcd(i, m.gcd(j, n))
            if i == j and j == n:
                ans += g
            elif i == j or j == n or i == n:
                ans += (g * 3)
            else:
                ans += (g * 6)

print(ans)


Measured memory_bytes: 9188
X, Y = [int(_) for _ in input().split()]

if (X + Y) % 3 != 0:
    print(0)
    exit()


y = (2 * Y - X) // 3
x = (X - y) // 2
if x < 0 or y < 0:
    print(0)
    exit()

kaijo = [0] * (X + Y + 10)
gyaku = [0] * (X + Y + 10)

kaijo[0] = 1
kaijo[1] = 1
MOD = 10 ** 9 + 7
for i in range(2, len(kaijo)):
    kaijo[i] = (i * kaijo[i - 1]) % MOD
gyaku[0] = 1
gyaku[1] = 1
for i in range(2, len(gyaku)):
    gyaku[i] = pow(kaijo[i], MOD - 2, MOD)


def nCm(n, m):
    return (kaijo[n] * gyaku[n - m] * gyaku[m]) % MOD


print(nCm(x + y, x))


Measured memory_bytes: 71404
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

  int N;
  int M;
  cin>>N>>M;
  vector<int>start(M);
  vector<int>end(M);
  for(int i=0;i<=M-1;i++){
  
    cin>>start[i];
    cin>>end[i];
  }
  sort(start.begin(),start.end());
  sort(end.begin(),end.end());
  if(end[0]<start[M-1]){
  
    cout<<0;
    return 0;
  }
  cout<<end[0]-start[M-1]+1;
  return 0;
}

Measured memory_bytes: 4048
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX


using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl

llong n;


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

    int k, x, y;

    cin >> n >> k >> x >> y;
    int ans;
    if (n > k) {
        ans = k*x + (n - k)*y;
    }
    else {
        ans = n*x;
    }
    cout << ans << endl;

        return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int N;
char S[300][300];

bool check(int x, int y){
    FOR(i,1,N)REP(j,i){
        if(S[(x+i)%N][(y+j)%N] != S[(x+j)%N][(y+i)%N]) return false;
    }
    return true;
}

int main(void){
    cin >> N;
    REP(i,N)REP(j,N) cin >> S[i][j];

    int ans = 0;
    REP(i,N) if(check(i,0)) ans += N;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
s=input()
n=len(s)
arr=[]
cnt=0
mod=10**9+7
rem=[1,10,9,12,3,4]
for i in reversed(range(n)):
  if s[i]=='?':
    arr.append(rem[(n-i)%6-1])
  else:
    cnt+=rem[(n-i)%6-1]*int(s[i])
    cnt%=13
#print(arr)
#print(cnt)
if arr:
  m=len(arr)
  dp=[[0]*13 for _ in range(m)]
  for i in range(10):
    dp[0][i*arr[0]%13]+=1
  for i in range(1,m):
    for j in range(13):
      for k in range(10):
        dp[i][(k*arr[i]+j)%13]+=dp[i-1][j]
        dp[i][(k*arr[i]+j)%13]%=mod
  #print(dp)
  for i in range(13):
    if (cnt+i)%13==5:
      print(dp[m-1][i]%mod)
      exit()
else:
  if cnt==5:
    print(1)
  else:
    print(0)

Measured memory_bytes: 63392
#include<bits/stdc++.h>
using namespace std;
vector<int> edge[2010];
int ans[2010];
int main()
{
	int n,x,y;
	cin>>n>>x>>y;
	x--;
	y--;
	for(int i=0;i<n;i++)
	{
		edge[i].push_back(i+1);
		edge[i+1].push_back(i);
	}
	edge[x].push_back(y);
	edge[y].push_back(x);
	for(int st = 0;st<n;st++)
	{
		queue<int> que;
		vector<int> dist(n,1e9);
		que.push(st);
		dist[st] = 0;
		while(que.size())
		{
			int i = que.front();
			que.pop();
			for(int j=0;j<edge[i].size();j++)
			{
				if(dist[edge[i][j]] == 1e9)
				{
					dist[edge[i][j]] = dist[i]+1;
					que.push(edge[i][j]);
				}
			} 
		}
		for(int i=0;i<n;i++)ans[dist[i]]++;
	}
	for(int i=1;i<n;i++)
	{
		cout<<ans[i]/2<<endl;
	}
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,d,r ;
    cin>>n;
    d=n/500;
    d=d*1000;
    if(n%500!=0)
    {
        n=n%500;
        r=n/5;
        r=r*5;
        cout<<d+r<<endl;

    }
    else cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll mi(ll a,ll b){
	ll x=1;
	while(b){
		if(b&1) x=x*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return x;
}
int main(){
	int n;
	cin>>n;
	ll ans=(mi(10,n)-mi(9,n)-mi(9,n)+mi(8,n))%mod;
	ans=(ans+mod)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a[5], sum, cnt;
int main() {
	for(int i = 1; i <= 4; i++)scanf("%1d", &a[i]);
	for(int i = 0; i <= 1; i++)
		for(int j = 0; j <= 1; j++)
			for(int k = 0; k <= 1; k++) {
				char A, B, C;
				sum = a[1];
				if(i == 0)sum -= a[2], A = '-';
				else sum += a[2], A = '+';
				if(j == 0)sum -= a[3], B = '-';
				else sum += a[3], B = '+';
				if(k == 0)sum -= a[4], C = '-';
				else sum += a[4], C = '+';
				if(sum == 7) {
					printf("%d%c%d%c%d%c%d=7\n", a[1], A, a[2], B, a[3], C, a[4]);
					return 0;
				}
			}
}

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

for x in range(L, R + 1):
    if x % 2019 == 0:
        print(0)
        exit()

import itertools
list_ij = list(itertools.combinations(range(L, R + 1), 2))

list_mod = []
for x in list_ij:
    list_mod.append(x[0] * x[1] % 2019)

print(min(list_mod))


Measured memory_bytes: 220708
h,w = list(map(int,input().split()))
s = [list(input()) for i in range(h)]

#全部の黒のとこ見て上下左右に黒があればおk！
x = [0,0,1,-1]
y = [1,-1,0,0]

ans = "Yes"
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            flag = False
        else:
            continue
        for k in range(4):
                if 0<=i+x[k]<h and 0<=j+y[k]<w: 
                    if s[i+x[k]][j+y[k]] == "#":
                        flag = True
                    else:
                        continue
        if flag:
            continue
        else:
            print("No")
            exit()


print(ans)




Measured memory_bytes: 40816
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
  int n;cin>>n;
  n>=30?cout<<"Yes":cout<<"No";
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

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

void fnInput(int& rnNumA, int& rnNumB)
{
  cin >> rnNumA >> rnNumB;
}

int64_t fnLCMGet(int nNumA, int nNumB)
{
  int nDividend = max(nNumA, nNumB);
  int nDivisor  = min(nNumA, nNumB);

  while (nDividend % nDivisor != 0)
  {
    int nRemain = nDividend % nDivisor;
    nDividend = nDivisor;
    nDivisor  = nRemain;
  }

  int64_t nGCM = nDivisor;
  int nQuotA = nNumA / nGCM;
  int nQuotB = nNumB / nGCM;
  return (nGCM * nQuotA * nQuotB);
}

int main()
{
  int nNumA, nNumB;

  fnInput(nNumA, nNumB);
  cout << fnLCMGet(nNumA, nNumB) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
typedef long long ll;
using namespace std;


ll N,a;
vector<ll> v;
int tot;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>N;
    v.reserve(N+2);
    v.push_back(0);
    for(ll i=0;i<N;i++){
        cin>>a;
        v.push_back(a);
    }
    v.push_back(0);

    for(ll i=1;i<v.size();i++){
        tot+=abs(v[i] - v[i-1]);
    }
    //cout<<tot<<endl;


    for(ll i=1;i<v.size()-1;i++){
        cout<<tot - abs(v[i]-v[i-1]) - abs(v[i]-v[i+1]) + abs(v[i-1] - v[i+1])<<'\n';
    }


    return 0;
}


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

int main()
{
   ll N;
   cin >> N ;
   ll A[N],B[N]; 
   for(int i=0 ; i < N ;i++){
      cin >> A[i]; 
      B[A[i]-1]=i+1;
   }
   for(int i=0 ; i < N ;i++){
      cout << B[i] << endl;
   }
   return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define REP(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

int x;
int cnt=1;
void solver() {
    while(cin>>x){
        if(x!=0)
            cout<<"Case "<<(cnt++)<<": "<<x<<endl;
        else break;
    }
}

int main() {
    solver();
    return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include<algorithm>
#include<vector>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int re(int i){return (i/2)*2;}
int solve(int i,int j,int l){
    return re(i)+re(j)+re(l);
}
#define vel vector<long long>
int ret(int i,int j){
    for(int k=i;k<=j;k++){
        cout <<k<<endl;
    }
}
int rev(int i,int j){
    for(int k=j;k>=i;k--){
        cout <<k<<endl;
    }
}
signed main(void){
    int n,l;cin >>n>>l;
    vel a(n);
    rep(i,n){cin >>a[i];}
    for(int i=0;i<n-1;i++){
        if(a[i]+a[i+1]>=l){
            cout << "Possible"<<endl;
            ret(1,i);
            rev(i+2,n-1);
            ret(i+1,i+1);
            return 0;
        }
    }
    cout << "Impossible"<<endl;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

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

int main() {
  long long X, K, D;
  cin >> X >> K >> D;
  if(X < 0) {
    X = -X;
  }
  long long key = X / D;
  if(K <= key) {
    X = X - K * D;
    cout << X << endl;
    return 0;
  }

  long long p = X % D;
  long long q = D - p;

  if(key % 2 == K % 2) {
    cout << p << endl;
  } else {
    cout << q << endl;
  }

  return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <algorithm>

#define LL long long

using namespace std;
LL n, m, sol;

int main()
{
    scanf("%lld %lld", &n, &m);
    if(2*n >= m)
    {
        printf("%lld\n", m/2);
        return 0;
    }
    sol = n;
    m -= 2*n;
    sol += m/4;
    printf("%lld\n", sol);
    return 0;
}

Measured memory_bytes: 128
import itertools
from itertools import permutations
from math import factorial, hypot

n = int(input())
x, y = [], []

for i in range(n):
    x1, y1 = [int(j) for j in input().split()]
    x.append(x1)
    y.append(y1)

ans = 0

order = [i for i in range(n)]

for status in itertools.permutations(order, n):
    tmp = 0
    for i in range(n - 1):
        tmp += hypot(x[status[i]] - x[status[i + 1]], y[status[i]] - y[status[i + 1]])
    ans += tmp

print(ans / factorial(n))


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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> to[n];
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    to[a].emplace_back(b);
    to[b].emplace_back(a);
  }
  vector<int> ans(n, -1);
  ans[0] = 1;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int p = q.front();
    q.pop();
    for (auto&& e : to[p]) {
      if (ans[e] != -1) continue;
      ans[e] = p;
      q.push(e);
    }
  }
  cout << "Yes" << '\n';
  for (int i = 1; i < n; i++) {
    ans[i]++;
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 10268
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

struct SegmentTree {
  using T = int;
  static T op(const T& x, const T& y) { return min(x, y); }
  static constexpr T e() { return 2e9; }
  using U = int;
  static void ap(const U& f, T& x) { x = min(x, f); }
  static void cp(const U& g, U& f) { f = min(f, g); }
  static constexpr U id() { return 2e9; }

  const int n;
  V<T> t;
  V<U> u;
  SegmentTree(int n) : n(n), t(2 * n, e()), u(n, id()) {}
  T& operator[](int i) { return t[i + n]; }
  void build() { for (int i = n - 1; i; --i) t[i] = op(t[2 * i], t[2 * i + 1]); }
  void push() { for (int i = 1; i < n; ++i) push(i); }
  void apply(const U& f, int i) {
    ap(f, t[i]);
    if (i < n) cp(f, u[i]);
  }
  void push(int i) {
    if (u[i] == id()) return;
    apply(u[i], 2 * i);
    apply(u[i], 2 * i + 1);
    u[i] = id();
  }
  void push(int l, int r) {
    for (int hl = __lg(l + n), hr = __lg(r - 1 + n); hr > 0; --hl, --hr) {
      int al = l + n >> hl, ar = r - 1 + n >> hr;
      if (al < n) push(al);
      if (ar != al) push(ar);
    }
  }
  T acc(int l, int r) {
    push(l, r);
    T resl = e(), resr = e();
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) resl = op(resl, t[l++]);
      if (r & 1) resr = op(t[--r], resr);
    }
    return op(resl, resr);
  }
  T get(int i) { return acc(i, i + 1); }
  void act(int l, int r, const U& f) {
    push(l, r);
    for (int i = l + n, j = r + n; i < j; i >>= 1, j >>= 1) {
      if (i & 1) apply(f, i++);
      if (j & 1) apply(f, --j);
    }
    l = l + n >> __builtin_ctz(l + n);
    while (l >>= 1) t[l] = op(t[2 * l], t[2 * l + 1]);
    r = r + n >> __builtin_ctz(r + n);
    while (r >>= 1) t[r] = op(t[2 * r], t[2 * r + 1]);
  }
  void set(int i, const T& x) {
    push(i, i + 1);
    t[i += n] = x;
    while (i >>= 1) t[i] = op(t[2 * i], t[2 * i + 1]);
  }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, q; cin >> n >> q;
  V<> s(n), t(n), x(n); for (int i = 0; i < n; ++i) cin >> s[i] >> t[i] >> x[i], s[i] -= x[i], t[i] -= x[i];
  V<> d(q); for (auto&& e : d) cin >> e;
  auto xs = d;
  sort(begin(xs), end(xs));
  xs.erase(unique(begin(xs), end(xs)), end(xs));
  auto zip = [&](int e) -> int { return lower_bound(begin(xs), end(xs), e) - begin(xs); };
  int m = xs.size();
  SegmentTree st(m);
  for (int i = 0; i < n; ++i) {
    st.act(zip(s[i]), zip(t[i]), x[i]);
  }
  for (int i = 0; i < q; ++i) {
    int res = st.get(zip(d[i]));
    if (res == SegmentTree::e()) res = -1;
    cout << res << '\n';
  }
}

Measured memory_bytes: 8192
#include<stdio.h>
#define MAX 10000
#define NO -1

struct tree { int p, l, r;};
struct tree T[MAX];
int n;

void Preorder ( int u ) {
    if ( u == NO ) return;
    printf(" %d", u);
    Preorder(T[u].l);
    Preorder(T[u].r);
}

void Inorder ( int u ) {
    if ( u == NO ) return;
    Inorder(T[u].l);
    printf(" %d", u);
    Inorder(T[u].r);
}

void Postorder ( int u ) {
    if ( u == NO ) return;
    Postorder(T[u].l);
    Postorder(T[u].r);
    printf(" %d", u);
}

int main(void) {
    int i, v, l, r, f, root;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) {
        T[i].p = NO;
    }

    for ( i = 0; i < n; i++ ) {
        scanf("%d %d %d", &v, &l, &r);
        T[v].l = l;
        T[v].r = r;
        if ( l != NO ) T[l].p = v;
        if ( r != NO ) T[r].p = v;
    }

    for ( i = 0; i < n; i++ ) {
        if ( T[i].p == NO ) root = i;
    }

    printf("Preorder\n");
    Preorder(root);
    printf("\nInorder\n");
    Inorder(root);
    printf("\nPostorder\n");
    Postorder(root);
    printf("\n");

    return 0;

}


Measured memory_bytes: 2104
s = list(input())
q = int(input())

rvs = []
i = 0
j = 0
p = []
order = []
for i in range(q):
    
    order.append(input().split())
    
    if order[i][0] == "replace":
        p = []
        p = list(order[i][3])

        for j in range(int(order[i][1]), int(order[i][2]) + 1):
            s[j] = p[j - int(order[i][1])]

    elif order[i][0] == "reverse":
        ss = "".join(s[int(order[i][1]):int(order[i][2]) + 1])
        rvs = list(ss)
        rvs.reverse()
        for j in range(int(order[i][1]), int(order[i][2]) + 1):
            s[j] = rvs[j - int(order[i][1])]
        
        # temp = s[int(order[i][1])]
        # s[int(order[i][1])] = s[int(order[i][2])]
        # s[int(order[i][2])] = temp

    elif order[i][0] == "print":
        ss = "".join(s)
        print("%s" % ss[int(order[i][1]):int(order[i][2]) + 1])




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

int main()
{
    unsigned long a;
    double b;
    unsigned long long ans;
    

    cin >> a >> b;
    

    ans = a * b;
    cout << ans << endl;
}

Measured memory_bytes: 3732
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint N,P;
  cin>>N>>P;
  string S;
  cin>>S;
  int c[N];
  REP(i,N)c[i]=S[i]-'0';
  lint ans=0;
  if(P==2 or P==5){
    REP(i,N)if(c[i]%P==0)ans+=i+1;
  }else{
    lint U=0;
    lint base=1;
    map<lint,lint> m;
    m[0]=1;
    for(int i=N-1;i>=0;i--){
      U+=base*c[i];
      U%=P;
      m[U]++;
      base*=10;
      base%=P;
    }
    for(auto e:m){
      // cerr<<e.first<<":"<<e.second<<endl;
      auto M=e.second;
      ans+=M*(M-1)/2;
    }
    
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1796
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e;
    while(cin>>a>>b)
    {

      c=(b*2)+1;
      double f;
      f=(double)a/c;
      f=ceil(f);
      e=f;
      cout<<e<<endl;



    }







    return 0;
}


Measured memory_bytes: 384
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if ((i * 500 + j * 100 + k * 50) == x):
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include<stdio.h>

int main(void){
  double a;
  double sum;
  int i;
  double s[10];

  while(scanf("%lf",&a)!=EOF){
    s[0] = a;
    sum = a;
    for(i=1;i<10;i++){
      if(i%2){
	s[i] = s[i-1]*2;
      }else{
	s[i] = s[i-1]/3;
      }
      sum += s[i];
    }

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

  return 0;
}

Measured memory_bytes: 0
def main():
    s,t = list(input().split())
    a,b = map(int,input().split())
    ss = input()

    if ss == s:
        print(str(a-1) + ' ' + str(b))
        return
    else:
        print(str(a) + ' ' + str(b-1))
if __name__=='__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    double A,B,N;
    cin >> A >> B >> N;
    
    double X;
    
    if(N >= B){
        X =  B-1;
    }else if(A/B > 1){
        X = N;
    }else{
        X = N-1;
    }
    
    cout << (long long)(A*(X/B)) - A * (long long) (X/B) << endl;
}


Measured memory_bytes: 3772
#include <stdio.h>

int main(void){

    int a,b;
    char op;

    while(1){
        //input
        scanf("%d %s %d",&a, &op, &b);

        switch(op){
            case '+':
                printf("%d\n", a+b);
                break;

            case '-':
                printf("%d\n", a-b);
                break;

            case '*':
                printf("%d\n", a*b);
                break;

            case '/':
                printf("%d\n", a/b);
                break;

            case '?':
                return 0;

            default:
                break;

        }
    }
    
}

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

int main() {
    int a, b;
    cin >> a >> b;

    if(a < b) cout << 'a' << " " << "<" << " " << 'b' << endl;
    else if(a > b) cout << 'a' << " " << ">" << " " << 'b' << endl;
    else cout << 'a' << " " << "==" << " " << 'b' << endl;
}


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

int main(){
    int n,K;
    ll ans=0;
    cin >> n >> K;
    vector<ll> v(n);
    for(int i = 0;i < n;i ++){
        cin >> v[i];
    }
    for(int x= 1;x <= min(n,K);x++){
        int y = K-x;

        for(int i = 0;i <= x;i ++){
            ll s=0;
            vector<ll> neg(0);
            int j = x-i;
            for(int k = 0;k < i;k ++){
                if(v[k]>0) s += v[k];
                else {neg.push_back(v[k]);s += v[k];}
            }
            for(int k = 0;k < j;k ++){
                if(v[n-1-k]>0) s += v[n-1-k];
                else {neg.push_back(v[n-1-k]);s += v[n-1-k];}
            }
            int length = neg.size();
            if(length) sort(neg.begin(),neg.end());
            for(int k = 0;k < min(y,length);k ++){
                s -= neg[k];
            }
            ans = max(ans,s);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256