akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

int n;
vi a;

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

	cin >> n;

	a.resize(3 * n);

	for (int i = 0; i < 3 * n; i++) {
		cin >> a[i];
	}
	DESCSORT(a);

	LL ans = 0;
	for (int i = 0; i < n; i++) {
		ans += a[i * 2 + 1];
	}

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

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

using namespace std;

class Solver {
};

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

	string s, t;
	cin >> s >> t;

	vector<vector<vector<long>>> dp(m + 1,
		vector<vector<long>>(n + 1,
			vector<long>(2, 0)));
	long res = 0;
	for (int i = 1; i <= m; i++) {
		if (s[i - 1] == 'I')dp[i][0][1] = dp[i - 1][0][0] + 1;
		else if (dp[i - 1][0][1] > 0) dp[i][0][0] = dp[i - 1][0][1] + 1;
		res = max(res, dp[i][0][1]);
	}
	for (int i = 1; i <= n; i++) {
		if (t[i - 1] == 'I')dp[0][i][1] = dp[0][i - 1][0] + 1;
		else if (dp[0][i - 1][1] > 0) dp[0][i][0] = dp[0][i - 1][1] + 1;
		res = max(res, dp[0][i][1]);
	}

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (s[i - 1] == 'I')dp[i][j][1] = dp[i - 1][j][0] + 1;
			else if (dp[i - 1][j][1] > 0)dp[i][j][0] = dp[i - 1][j][1] + 1;

			if (t[j - 1] == 'I')dp[i][j][1] = max(dp[i][j][1], dp[i][j-1][0] + 1);
			else if (dp[i][j - 1][1] > 0) {
				dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][1] + 1);
			}
			
			res = max(res, dp[i][j][1]);
		}
	}

	cout << res << endl;
}


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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

void solve(long long A, long long B, long long M, std::vector<long long> a,
           std::vector<long long> b, std::vector<long long> x,
           std::vector<long long> y, std::vector<long long> c) {
    long long ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());

    for (int i = 0; i < M; i++) {
        x[i]--;
        y[i]--;
        ans = min(a[x[i]] + b[y[i]] - c[i], ans);
    }
    cout << ans << endl;
}

int main() {
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> a(A);
    for (int i = 0; i < A; i++) {
        scanf("%lld", &a[i]);
    }
    std::vector<long long> b(B);
    for (int i = 0; i < B; i++) {
        scanf("%lld", &b[i]);
    }
    std::vector<long long> x(M);
    std::vector<long long> y(M);
    std::vector<long long> c(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &x[i]);
        scanf("%lld", &y[i]);
        scanf("%lld", &c[i]);
    }
    solve(A, B, M, std::move(a), std::move(b), std::move(x), std::move(y),
          std::move(c));
    return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define INF (1e9)
#define N 102
using namespace std;
int n,m;
char a,ans[N];

void UpdateA(){
  for(int i=1;i<=n;i++)
    if(ans[i]=='#'){
      ans[i]='A';
      return;
    }
}

void UpdateB(){
  for(int i=n;i>0;i--){
    if(ans[i]!='#')continue;
    if(ans[i-1]!='A'&&ans[i+1]!='A'){
      ans[i]='B';
      return;
    }
  }
  for(int i=1;i<=n;i++)
    if(ans[i]=='#'){
      ans[i]='B';
      return;
    }
}

void UpdateC(){
  for(int i=1;i<=n;i++){
    if(ans[i]=='#')continue;
    if(ans[i+1]=='#'&&i+1<=n){
      ans[i+1]='C';
      return;
    }
    if(ans[i-1]=='#'&&1<=i-1){
      ans[i-1]='C';
      return;
    }
  }
  if(n%2)ans[(n+1)/2]='C';
  else ans[n/2+1]='C';
}

void UpdateD(){
  int d[2][N],cnt=INF,maxd;
  for(int i=0;i<2;i++)
    for(int j=1;j<=n;j++)d[i][j]=INF;
  for(int i=1;i<=n;i++){
    if(ans[i]!='#')cnt=0;
    else cnt++;
    d[0][i]=cnt;
  }
  cnt=INF;
  for(int i=n;i>=1;i--){
    if(ans[i]!='#')cnt=0;
    else cnt++;
    d[1][i]=min(cnt,d[0][i]);
  }
  maxd=0;
  for(int i=1;i<=n;i++)maxd=max(maxd,d[1][i]);
  if(maxd>=INF){
    ans[1]='D';
    return; 
  }else{
    for(int i=1;i<=n;i++){
      if(d[1][i]==maxd){
	ans[i]='D';
	return;
      }
    }
  }
}

int main(){
  while(1){
    cin>>n>>m;
    if(!n&&!m)break;
    for(int i=1;i<=n;i++)ans[i]='#';
    for(int i=0;i<m;i++){
      cin>>a;
      if(a=='A')UpdateA();
      if(a=='B')UpdateB();
      if(a=='C')UpdateC();
      if(a=='D')UpdateD();
    }
    for(int i=1;i<=n;i++)cout<<ans[i];
    cout<<endl;  
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int INF = 1e9;
const int maxN = 100005;
#define ll long long
const int MOD = 998244353;

class TaskF {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n, sum;
		cin >> n >> sum;
		vector<vector<int>> dp(n+1, vector<int>(sum+1,0));
		dp[0][0] = 1;
		for(int i = 0; i < n; i++){
			int x;
			cin >> x;
			for(int s = 0; s <= sum; s++){
				dp[i+1][s] += 2*dp[i][s] % MOD;
				dp[i+1][s] %= MOD;
				if(s + x <= sum){
					dp[i+1][s+x] += dp[i][s];
					dp[i+1][s+x] %= MOD;
				}
			}
		}
		cout << dp[n][sum] << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskF solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 38632
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

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

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();

    int n;
    cin>>n;
    vector<pair<int, int>> a(n);
    for (int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        a[i]={ x, i+1 };
    }
    sort(a.begin(), a.end());
    for (auto x:a)
    {
        cout<<x.second<<" ";
    }

    return 0;
}

Measured memory_bytes: 3960
N = int(input())
v = [list(map(int, input().split())) for i in range(N)]
minx = min([v[i][0] for i in range(N)])
miny = min([v[i][1] for i in range(N)])
v.sort(key = lambda x:x[0] - minx + x[1] - miny)
d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1])
result = d
v.sort(key = lambda x:x[0] - minx - (x[1] - miny))
d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1])
print(max(d, result))

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

from collections import defaultdict
ans = defaultdict(int)
for i in range(N):
    for j in range(i + 1, N):
        idx = min(j - i, abs(j + 1 - Y) + 1 + abs(X - i - 1))
        ans[idx] += 1
        
for i in range(1, N):
    print(ans[i])


Measured memory_bytes: 49628
use proconio::input;

fn main() {
    input!(n: usize);
    input!(a: [usize; n]);
    let mut ret = 0;
    for (i, v) in a.iter().enumerate() {
        if i % 2 == 0 && v % 2 == 1
        {
            ret = ret + 1;
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 2064
#include<bits/stdc++.h>
using namespace std;
int n,maxa,vis[100005];
vector<int> v[505];
int main()
{
	int sum=1;vis[1]=2;
	for(int i=2;i;i++){if(sum+i>100000) break;sum+=i;vis[sum]=i+1;maxa=max(maxa,vis[sum]);}
	cin>>n;if(!vis[n]) return !puts("No");int m=1,gg=0;
	while(gg<n){for(int i=1;i<=m;i++) v[i].push_back(i+gg);for(int i=1;i<=m;i++) v[m+1].push_back(i+gg);gg+=m;m++;}
	puts("Yes");cout<<vis[n]<<endl;
	for(int i=1;i<=vis[n];i++)
	{
		printf("%d",v[i].size());
		for(int j=0;j<v[i].size();j++) printf(" %d",v[i][j]);puts("");
	}
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	cout << (n==3||n==5||n==7?"YES":"NO") << endl;
}


Measured memory_bytes: 256
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 = sc.nextInt();
        int B = sc.nextInt();

        int sum = 0;
        for (int i = 0; i <= N; i++) {
            String str = String.valueOf(i);
            String[] array = str.split("");
            int digit_sum = 0;
            for (int j = 0; j < array.length; j++) {
                digit_sum += Integer.parseInt(array[j]);
            }
            if (digit_sum >= A && digit_sum <= B) {
                sum += i;
            }
        }

        System.out.printf("%d\n", sum);
        sc.close();
    }
}

Measured memory_bytes: 33876
A, B, K = map(int, input().split())
num = [0 for i in range(min(A, B))]
for i in range(1, min(A, B) + 1):
    if A % i == 0 and B % i == 0:
        num[i - 1] =i
print(sorted(num, reverse = True)[K - 1])


Measured memory_bytes: 2940
//
//  CPlibrary
//
//  Created by Tanmay Singh on 3/03/2020.
// INDIAN INSTITUTE OF TECHNOLOGY (BHU) , VARANASI
//  Copyright © 2020 Tanmay Singh. All rights reserved.
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define FAST(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
typedef long long int  bigint ;
typedef std::vector< int > vi;
typedef std::vector< long long int > vll;
typedef std::vector< vi > vvi;
 
using namespace std;

int main(){
    FAST() ;
    string str1 , str2 ; cin >> str1 >> str2 ;
    if( str1 == str2 )
        cout << "EQUAL" << endl ;
    else if( str1.length() == str2.length() ){
        if( str1 > str2 )
            cout << "GREATER" << endl ;
        else
            cout << "LESS" << endl ;
    }
    else {
        if( str1.length() > str2.length() )
            cout << "GREATER" << endl ;
        else
            cout << "LESS" << endl ;
    }
    return 0 ;
}


Measured memory_bytes: 256
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
typedef pair<int, int> pr;
typedef vector<int> VI;
typedef vector<pr> VP;
typedef vector<string> VS;
typedef vector<vector<int>> VV;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
const int inf = 1e17;
int fast_pow(int x, int y, int p);
const int sz = 200001;
int n,mx;
int a[30][30];
int dp[22][2097153];
int rec(int pos,int mask){
	// trace2(pos,mask);
	if(pos==n){
		return mask ==  mx;
	}
	int& ans = dp[pos][mask];
	if(ans!=-1)return ans;
	ans=0;
	for(int i=0;i<n;i++){
		if(a[pos][i]){
			int p = (mask>>i)&1;
			if(p==0){
				ans += rec(pos+1,mask|(1<<i));
				ans%=MOD;
			}
		}
	}
	return ans;
}

void solve() {
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
		}
	}
	mx = (1<<n)-1;
	memset(dp,-1,sizeof dp);
	cout<<rec(0,0);
	
}


int32_t main() {

	IOS;
	int test = 1;
	// cin>>test;
	for (int i = 1; i <= test; i++) {
        // cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}
int fast_pow(int x, int y, int p) {
	int res = 1;
	x = x % p;
	while (y > 0) {
		if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

Measured memory_bytes: 360704
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 1000000000
#define MAX_N 150005
using namespace std;

int n,k,ans;
int d[11];

bool check(int x){
    while(x){
        int a=x%10;
        for(int i=0;i<k;i++){
            if(a==d[i])return false;
        }
        x/=10;
    }
    return true;
}

int main(){
    cin>>n>>k;
    rep(i,0,k)cin>>d[i];
    for(int i=0;;i++){
        ans=n+i;
        if(check(ans))break;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n,h=map(int,input().split())
a_m=0
b_list=[]
for i in range(n):
    a,b=map(int,input().split())
    a_m=max(a_m,a)
    b_list.append(b)
b_list.sort(reverse=True)
Sum=0
count=0
for i in range(n):
    if b_list[i]>=a_m:
        Sum=Sum+b_list[i]
        count=count+1
        if Sum>=h:
            print(count)
            import sys
            sys.exit()
    else:
        break
ans=count+((h-Sum)+a_m-1)//a_m
print(ans)


Measured memory_bytes: 55512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
    long long x,k,d;
    cin>>x>>k>>d;
    if(k<abs(x)/d) cout<<abs(x)-d*k;
    else if((k-abs(x)/d)%2==0 && k>=abs(x)/d) cout<<abs(x)%d;
    else if((k-abs(x)/d)%2==1 && k>=abs(x)/d) cout<<d-abs(x)%d;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define MAX_V 100005



int main(void){
	string s;
	ll k;
	cin>>s;
	cin>>k;
	rep(i,s.size()){
		if(i+1 == k){
			cout<<s[i]<<endl;
			return 0;
		}
		if(s[i] != '1'){
			cout<<s[i]<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
int gcd(int x, int y){
  if(y == 0)return x;
  return gcd(y, x % y);
}
     
int main(){
  int N, K;cin >> N >> K;
  vector<int> A(N);
  for(auto&&e:A){
    cin >> e;
    if(e == K){
      cout << "POSSIBLE\n";
      return 0;
    }
  }
  sort(A.begin(), A.end());
  if(K > A[N - 1]){
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  else {
    for(int i = 0; i < N - 1; ++i){
      int x = gcd(A[i], A[i + 1]);
      if(x == 1){
    	cout << "POSSIBLE\n";
    	return 0;
      }else if(K % x == 0){
	cout << "POSSIBLE\n";
	return 0;
      }
    }
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}


Measured memory_bytes: 640
import fractions
import sys
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

if(k in a):
	print("POSSIBLE")
	sys.exit()

maxa=max(a)
mindiff=a[0]
for i in range(len(a)-1):
	mindiff=fractions.gcd(mindiff,a[i])

a_more_k=[a[i] for i in range(len(a)) if a[i]>k]
for i in range(len(a_more_k)):
	if( (a_more_k[i]-k)%mindiff == 0):
		print("POSSIBLE")
		sys.exit()

print("IMPOSSIBLE")


Measured memory_bytes: 16240
#include<cstdio>
int a[111111],n;
int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++)
		scanf("%d",&a[i]);
	bool ff = false;
	int sgn = 0, res = 0;
	for(int i=0; i<n;)
		if(!ff){
			ff = true;
			++res;
			i++;
		}
		else
		if(a[i] == a[i-1]){
			i++;
			continue;
		}
		else
		if(a[i] > a[i-1]){
			if(sgn == -1){
				ff = false;
				sgn = 0;
			}else{
				sgn = 1;
				i++;
			}
		}else{
			if(sgn == 1){
				ff = false;
				sgn = 0;
			}else{
				sgn = -1;
				i++;
			}
		}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
	int a,b=0,c,i,j;
	scanf("%d %d %d",&a,&b,&c);
	if(a==1){
		if(b==0){
			printf("Close\n");
		}
		if(b==1){
			printf("Open\n");
		}
	}
	else{
		if(b==0){
			if(c==0){
				printf("Close\n");
			}
			if(c==1){
				printf("Open\n");
			}
		}
		if(b==1){
			printf("Close\n");
		}
	}
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
int x,y,an,bn,cn,a[100001],b[100001],c[100001],ans[300001],ansn;
long long anss;
bool cmp(int i,int j){return i>j;}
int main()
{
	scanf("%d%d%d%d%d",&x,&y,&an,&bn,&cn);
	for(int i=1;i<=an;i++)scanf("%d",&a[i]);
	for(int i=1;i<=bn;i++)scanf("%d",&b[i]);
	for(int i=1;i<=cn;i++)scanf("%d",&c[i]);
	sort(a+1,a+an+1);
	sort(b+1,b+bn+1);
	sort(c+1,c+cn+1);
	for(int i=1;i<=x;i++)ans[++ansn]=a[an-i+1];
	for(int i=1;i<=y;i++)ans[++ansn]=b[bn-i+1];
	for(int i=1;i<=cn;i++)ans[++ansn]=c[i];
	sort(ans+1,ans+ansn+1,cmp);
	for(int i=1;i<=x+y;i++)anss+=ans[i];
	printf("%lld",anss);
	return 0;
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

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

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

    int now=0,ans=0;

    rep(i,n-1){
        if(now==0){
            if(a[i]<a[i+1]) now=1;
            else if(a[i]>a[i+1])now=2;
        }
        else if(now==1){
            if(a[i]>a[i+1]){
                ans++;
                now=0;
            }
        }
        else if(now==2){
            if(a[i]<a[i+1]){
                ans++;
                now=0;
            }

        }
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 3712
def bubbleSort(arr)
  i = 0
  n = 0
  while arr.size >= i
    j = arr.size - 1
    while j >= i + 1
      if arr[j] < arr[j - 1] then
        x = arr[j]
        arr[j] = arr[j - 1]
        arr[j - 1] = x
        n = n + 1
      end
      j = j - 1
    end
    i = i + 1
  end
  puts arr.join(' ')
  puts n
end

n = STDIN.gets.to_i
arr = STDIN.gets.split(' ').map{|x| x.to_i}
bubbleSort(arr)

Measured memory_bytes: 8716
#include<stdio.h>

int main(void) {
	int n;
	int a;
	scanf("%d", &n);
	a = n % 10;
	if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
		printf("hon\n");
	}
	else if (a == 0 || a == 1 || a == 6 || a == 8) {
		printf("pon\n");
	}
	else {
		printf("bon\n");
	}
}

Measured memory_bytes: 1632
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a[3], minv;
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 3; i++) {
		for (int j = 2; j > i; j--) {
			if (a[j - 1] > a[j]) {
				swap(a[j - 1], a[j]);
			}
		}
	}
	for (int i = 0; i < 3; i++) {
		cout << a[i];
		if (i != 2) {
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iostream>
using namespace std;
int main(void) {
  int H,W;
  cin >> H >> W;
  char map[50][50];
  for (int i=0;i<H;++i) {
  	for (int j=0;j<W;++j) {
      cin >> map[i][j];
    }
  }
  bool done = true;
  for (int i=0;i<H;++i) {
    if (done == false) {break;}
    for (int j=0;j<W;++j) {
      if (done == false) {break;}
      if (map[i][j]=='.') {
		continue;
      }
      if (i == H-1) {
        continue;
      }
      if (j != W-1) {
        if (map[i+1][j]=='.' && map[i][j+1]=='.' && map[i+1][j+1]=='#') {
          if (map[i+1][j+2] != '#' && map[i+2][j+1] != '#') {
            done = false;
          }
        }
      }
      if (j != 0) {
        if (map[i+1][j]=='.' && map[i][j-1]=='.' && map[i+1][j-1]=='#') {
          if (map[i+1][j-2] != '#' && map[i+2][j-1] != '#') {
          done = false;
          }
        }
      }
    }
  }
  if (done) {
    cout << "Yes";
  }else {
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := map[string]int{}
	for i := 0; i < n; i++ {
		s := getNextString(scanner)
		m[s] = m[s] + 1
	}
	fmt.Fprintln(writer, len(m))
}


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

if N == 1:
    print(0)
    exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

arr = factorization(N)

count = 0
for i in arr:
    for j in range(1,10**5):
        if j*(j+1)/2 <= i[1] < (j+1)*(j+2)/2:
            count += j
            break

print(count)




Measured memory_bytes: 63400
#include <iostream>
#include <stack>

using namespace std;

void solve()
{
	int n, r;
	while(cin >> n >> r)
	{
		stack<int> stack1;
		for(int i = 0; i < n; ++i)
		{
			stack1.push(i);
		}
		stack<int> stack2;
		stack<int> stack3;
		while(r--)
		{
			int c;
			cin >> c;
			if(n % 2)
			{
				for(int i = 0; i < n / 2 + 1; ++i)
				{
					stack2.push(stack1.top());
					stack1.pop();
				}
			}
			else
			{
				for(int i = 0; i < n / 2; ++i)
				{
					stack2.push(stack1.top());
					stack1.pop();
				}
			}
			for(int i = 0; i < n / 2; ++i)
			{
				stack3.push(stack1.top());
				stack1.pop();
			}
			while(!stack2.empty())
			{
				for(int i = 0; i < c; ++i)
				{
					if(!stack2.empty())
					{
						stack1.push(stack2.top());
						stack2.pop();
					}
				}
				for(int i = 0; i < c; ++i)
				{
					if(!stack3.empty())
					{
						stack1.push(stack3.top());
						stack3.pop();
					}
				}
			}
		}
		cout << stack1.top() << endl;
	}
}

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

Measured memory_bytes: 0
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) ->
      if x < y then Node (y, doit l, r)
      else Node (y, l, doit r) in
  doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> f x; doit l; doit r in
  doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> doit l; f x; doit r in
  doit t

let print t =
  inorder (fun e -> print_string " "; print_int e) t;
  Printf.printf "\n";
  preorder (fun e -> print_string " "; print_int e) t;
  Printf.printf "\n"

let find x t =
  let rec doit = function
    | Nil -> false
    | Node (y, _, _) when x = y -> true
    | Node (y, l, _) when x < y -> doit l
    | Node (_, _, r) -> doit r in
  doit t

let () =
  let m = read_int () in
  let t = ref (create ()) in
  for _ = 0 to m - 1 do
    let op = Scanf.scanf "%s " (fun i -> i) in
    if op = "print" then print !t
    else
      let n = Scanf.scanf "%d " (fun i -> i) in
      if op = "find" then print_endline (if find n !t then "yes" else "no")
      else t := insert n !t
  done

Measured memory_bytes: 26312
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<utility>
#include<functional>
#include<algorithm>
#include<queue>
#include<map>
#include<string>
#include<numeric>


#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rep(i, n) for(int i=0; i<n; i++)
#define COUT(a) cout << a << endl;
#define PB push_back

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

ll H, W;
vector<char> answer;
vector<vector<char>> field;


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

    vector<ll> costs(N);
    vector<ll> times(N);

    ll cost = 10000;
    rep(i, N){
        cin >> costs[i] >> times[i];
        if (times[i] <= T){
            cost = min(costs[i], cost);
        }
    }

    if (cost == 10000){
        COUT("TLE");
    }else{
        COUT(cost);
    }
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
using ll = long long;
 
void max_self(ll& a, ll b) {
    a = max(a, b);
}
 
int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<ll> dp(W + 1); // 0 ... W
    // dp[i] - the maximum total value of items with total weight exactly i 
    for(int item = 0; item < n; ++item) {
        int weight, value;
        scanf("%d%d", &weight, &value);
        // dp[0] -> dp[3] -> dp[6]
        for(int weight_already = W - weight; weight_already >= 0; --weight_already) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            max_self(dp[weight_already+weight], dp[weight_already] + value);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= W; ++i) {
        max_self(answer, dp[i]);
    }
    printf("%lld\n", answer);
}

Measured memory_bytes: 1024
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
void solve(ll n , string str , char mx){
	if(n==str.length()){
		cout<<str<<endl;
		return ;
	}
	for(char ch='a' ; ch<=mx ; ch++){
		solve(n , str+ch , ch==mx ? (char)mx+1 : mx);
	}
}
int main(){
	//mahakal(),fast;
	ll n ;
	cin>> n ;
	solve(n , "" , 'a');

	return 0;
}

Measured memory_bytes: 1536
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int W = sc.nextInt();
	int[] w = new int[N+1];
	int[] v = new int[N+1];
	for(int i = 1; i<N+1; i++) {
	    w[i] = sc.nextInt();
	    v[i] = sc.nextInt();
	}
	int V = 1000*N;

	long[][] weight = new long[N+1][V+1];

	weight[0][0] = 0;
	for(int i = 0; i<N+1; i++) {
	    for(int j = 1; j<V+1; j++) {
		if(i == 0) {
		    weight[i][j] = 1000000001;
		    continue;
		}
		if(j<v[i]) {
		    weight[i][j] = weight[i-1][j];
		}else{
		    weight[i][j] = Math.min(weight[i-1][j], weight[i-1][j-v[i]] + w[i]);
		}
	    }
	}
	int result = 0;
	for(int j = 0; j<V+1; j++) {
	    if(weight[N][j]<=W) {
		if(result<j) result = j;
	    }
	}
	System.out.println(result);
    }
}

Measured memory_bytes: 127444
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;



int main(){
    int n,x; cin >> n >> x;
    vi l(n);
    cin >> l;

    int ans = 1;
    int d = 0;
    rep(i,n){
        d += l[i];
        if(d <= x) {
            ans++;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
from bisect import bisect_left

a,b,q = map(int,input().split())

inf = 10**11
s = [-inf]+[int(input()) for i in range(a)]+[inf,inf]
t = [-inf]+[int(input()) for i in range(b)]+[inf,inf]
X = [int(input()) for i in range(q)]

for x in X:
	s_idx = bisect_left(s,x)
	t_idx = bisect_left(t,x)
	sr = s[s_idx]
	sl = s[s_idx-1]
	tr = t[t_idx]
	tl = t[t_idx-1]
	# print(s_idx,t_idx)
	ans1 = max(sr-x,tr-x)
	ans2 = max(x-sl,x-tl)
	ans3 = (x-sl)*2+(tr-x)
	ans4 = (tr-x)*2+(x-sl)
	ans5 = (x-tl)*2+(sr-x)
	ans6 = (sr-x)*2+(x-tl)
	# print(ans1,ans2,ans3,ans4,ans5,ans6)
	print(min(ans1,ans2,ans3,ans4,ans5,ans6))

Measured memory_bytes: 16144
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=500006;

void solve(){
	string s;
	cin>>s;
	if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])cout<<"Bad";
	else cout<<"Good";
}
	
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
	if(a<0)a+=mod;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;	
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	s1[0] += 'A' - 'a';
	s2[0] += 'A' - 'a';
	s3[0] += 'A' - 'a';
	cout << s1[0] << s2[0] << s3[0] << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define bk back()
#define pb push_back

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(x,a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

// FILE I/O
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

int32_t main() {

    setIO();

    ll A,V,B,W,T; cin >> A >> V >> B >> W >> T;  

    if (V <= W) {
        cout << "NO";
    } else {
        ld need = ld(abs(A-B))/ld(abs(V-W));
        
        cout << (need <= ld(T) ? "YES" : "NO");
    }

}


Measured memory_bytes: 3660
n = int(input())

li_a = list(map(int, input().split()))

sm = sum(li_a)

li_ruiseki = list()

for a in li_a:
    if len(li_ruiseki) == 0:
        li_ruiseki.append(a)
    else:
        li_ruiseki.append(li_ruiseki[-1] + a)

result = -1
for x in li_ruiseki[:-1]:
    a = abs(sm - 2 * x)
    result = min(result, a) if result >= 0 else a

print(result)

Measured memory_bytes: 24832
#include <iostream>

using namespace std;

int main() {
	int x, y;
	cin >> x >> y;
	
	// x x1 + x2 = x
	// y x1*2 + x2*4 = y
	// x1*2 + (x - x1) = y
	for (int i = 0; i <= x; ++i) {
		if (i * 2 + (x - i) * 4 == y) {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}

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

int main(void){
    int a,b,c,d;
    cin >> a>>b>>c>>d;
    if (a+b>c+d)
    {
        cout << "Left" << endl;
    }else if (a+b==c+d)
    {
        cout << "Balanced" << endl;
    }else
    {
        cout << "Right" << endl;
    }
    return 0;
}

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

#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define loop(i,a,b) for(int i=a;i<b;i++)
#define inf (long long int) 1e18
#define vi vector<int> 
#define pii pair<int, int>
#define mii map<int, int> 
#define mod 1000000007

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

int palindrome(string s){
    int l = 0;
    int h = s.length() - 1;
    while (h > l){
        if (s[l++] != s[h--]){
            return 0;
        }
    }
    return 1;
}

long long modexp(long long a, long long b, long long m){
    if (b==0)
        return 1;
    long long temp = modexp(a,b/2,m);
    temp = (temp*temp)%m;
    if (b&1)
        return (temp*(a%m))%m; // if b is odd a^b = a^(b/2)*a^(b/2)*a
    return temp;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/

    int a[3];
    loop(i,0,3){
        cin>>a[i];
    }
    sort(a,a+3);
    cout<<abs(a[1]-a[0])+abs(a[2]-a[1])<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(ll, n, a);
    Cusum(ll, a, b);
    
    // Couts(a);
    // Couts(b);
    
    ll ans = 1e17;
    For(i, n){
        Mini(ans, (ll)abs(b[i] - (b[n]-b[i])));
    }
    Cout(ans);
}









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

typedef unsigned long long ull;

const int N = 1 << 14, P = 998244353;
int n, m, fac[N], ifac[N], f[2][N], coef[N];

int power(int a, int x) {
	int ans = 1;
	for (; x; x >>= 1, a = 1LL * a * a % P)
		if (x & 1) ans = 1LL * ans * a % P;
	return ans;
}

int w[N];
void init(int n) {
	w[n / 2] = 1;
	int pr = power(3, (P - 1) / n);
	for (int i = 1; i < n / 2; ++i)
		w[n / 2 + i] = 1ll * w[n / 2 + i - 1] * pr % P;
	for (int i = n / 2 - 1; i >= 1; --i)
		w[i] = w[i << 1];
}
void dft(int *_a, int n) {
	static ull a[N];
	for (int i = 0; i < n; ++i) a[i] = (_a[i] % P + P) % P;
	for (int i = 0, j = 0; i < n; ++i) {
		if (i > j) swap(a[i], a[j]);
		for (int k = n >> 1; (j ^= k) < k; k >>= 1);
	}
	for (int d = 1; d < n; d <<= 1)
		for (int i = 0; i < n; i += d << 1)
			for (int j = 0; j < d; ++j) {
				ull tmp = a[i + d + j] * w[d + j] % P;
				a[i + d + j] = a[i + j] + P - tmp, a[i + j] += tmp;
			}
	for (int i = 0; i < n; ++i)
		_a[i] = a[i] % P;
}
void idft(int *a, int n) {
	reverse(a + 1, a + n);
	dft(a, n);
	for (int i = 0, t = power(n, P - 2); i < n; ++i)
		a[i] = 1ll * a[i] * t % P;
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = fac[0] = 1; i <= n + 2; ++i) fac[i] = 1ll * fac[i - 1] * i % P;
	ifac[n + 2] = power(fac[n + 2], P - 2);
	for (int i = n + 2; i; --i) ifac[i - 1] = 1ll * ifac[i] * i % P;
	f[0][0] = 1;
	for (int j = 1; j <= n; ++j) coef[j] = ifac[j + 2];
	int len = 1;
	while (len <= n + n) len <<= 1;
	init(len);
	dft(coef, len);
	for (int i = 1; i <= m; ++i) {
		for (int j = 0; j <= n; ++j) {
			f[i & 1][j] = 1ll * f[i - 1 & 1][j] * (j * (j + 1) / 2 + 1) % P;
			f[i - 1 & 1][j] = 1ll * f[i - 1 & 1][j] * ifac[j] % P;
		}
		dft(f[i - 1 & 1], len);
		for (int j = 0; j < len; ++j)
			f[i - 1 & 1][j] = 1ll * f[i - 1 & 1][j] * coef[j] % P;
		idft(f[i - 1 & 1], len);
		for (int j = 0; j <= n; ++j)
			f[i & 1][j] = (f[i & 1][j] + 1ll * f[i - 1 & 1][j] * fac[j + 2]) % P;
		fill(f[i & 1] + n + 1, f[i & 1] + len, 0);
	}
	int ans = 0;
	for (int i = 0; i <= n; ++i)
		ans = (ans + 1ll * f[m & 1][i] * ifac[i] % P * ifac[n - i]) % P;
	ans = 1ll * ans * fac[n] % P;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 640
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    int n,m;
    cin>>n>>m;
    if(n%2!=m%2)
    {
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }
    cout<<(n+m)/2<<endl;


}
//Alhamdulillah






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

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

using namespace std;

int T,E;
double *C,C_buf[200001];

double merge(){
	double res=C[T];
	for(int i=T-1;i>=1;i--){
		// プレート i と i+1 をマージし、それを新たにプレート i と思う
		// そうすると、新たなプレート i+1 にはエネルギーをかけないと考えていい
		res=min(C[i],(C[i]+(T-i)*res)/(T-i+1));
		// min の第 1 項は ( マージする前の ) プレート i+1 にエネルギーをかけないケース (?)
		// min の第 2 項は ( マージする前の ) プレート i+1 にエネルギーをかけるケース
	}
	return res;
}

int main(){
	scanf("%d%d",&T,&E);
	C=C_buf+100000;
	for(int i=-T;i<=T;i++) scanf("%lf",C+i);

	double C0=C[0];
	double Cr=merge(); // 右 T 枚のプレートをマージしてできたプレートの比熱
	reverse(C-T,C+T+1);
	double Cl=merge(); // 左 T 枚のプレートをマージしてできたプレートの比熱

	// これで 3 枚のプレート -1, 0, 1 の問題になった
	// 解は
	// - プレート 0 で T+1 回熱せられる
	// - プレート 0 で 1 回、プレート  1 で 1 回熱せられる
	// - プレート 0 で 1 回、プレート -1 で 1 回熱せられる
	// のいずれか

	// プレートにかける熱をそれぞれ Hl, H0, Hr とする
	// 制約 Cl*Hl+C0*H0+Cr*Hr = E のもと、min{(T+1)*H0, H0+Hl, H0+Hr} を最大化する問題になる
	// Hl = Hr とするのがいいことは直感的にわかるので、
	// 制約 C0*H0+(Cl+Cr)*Hl = E のもと、min{(T+1)*H0, H0+Hl} を最大化すればいい
	double ans=0,H0,Hl;
	H0=E/C0;             Hl=(E-C0*H0)/(Cl+Cr); ans=max(ans,min((T+1)*H0,H0+Hl));
	H0=E/(C0+T*(Cl+Cr)); Hl=(E-C0*H0)/(Cl+Cr); ans=max(ans,min((T+1)*H0,H0+Hl));
	printf("%.9f\n",ans);

	return 0;
}

Measured memory_bytes: 2220