akhauriyash/Code-Regression huggingface dataset:
abcd = input()
n = len(abcd) - 1
for i in range(2 ** n):
    op = ['-'] * n
    for j in range(n):
        if ((i >> j) & 1):
            op[n - j - 1] = '+'
    formula = ''
    for p_n, p_o in zip(abcd, op + ['']):
        formula += (p_n + p_o)
    if eval(formula) == 7:
        print(formula + '=7')
        break

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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;
const ll N= 1e6+55,mod = 1e9+7;
vl v[N];
int main() {
// 	freopen("Task.in","r",stdin);freopen("Task.out","w",stdout);
	ll i,n,m,x,y,f=0;
	sc(n);sc(m);
	for(i=0;i<m;i++){
		sc(x);sc(y);
		v[x].pb(y);
		v[y].pb(x);
	}
	set<ll>s;
	for(i=0;i<v[n].size();i++)s.insert(v[n][i]);
	for(i=0;i<v[1].size();i++){
		x=v[1][i];
		if(s.find(x)!=s.end()){
			f=1;
			break;
		}
	}
	if(f)cout<<"POSSIBLE\n";
	else cout<<"IMPOSSIBLE\n";
}

Measured memory_bytes: 36200
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
# ball を入れたら1
ball = [0] * (N+1)
for i in range(N, 0, -1):
    tmp = A[i-1]
    for j in range(i, N+1, i):
        if j == i:
            continue
        tmp ^= ball[j]
    # 辻褄合わせるためにはこれが必要
    ball[i] = tmp
print(sum(ball))
for i, b in enumerate(ball):
    if b == 1:
        print(i, end=" ")
    
    


Measured memory_bytes: 9252
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x<a.x;
//        return z>a.z;
    }
};

vector<int> v[55];
//bitset<4001000> b;
int a,c,i,b,k,d,n,m,e;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int l[510][515];
int o[510][515];
int dx[10]={0,1,0,-1},dy[10]={1,0,-1,0},dz[10]={0,0,0,0,1,-1};

long long x,y,z,mod=1000000007;
P u[11];
int j[55];

stack<int> s;
queue<int> q;

//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int > p;
//list<int> l;
//string r[111],r2;
char r[510][555];


bool as(P a,P b)
{
   // if(a.x!=b.x)
        return a.x<b.x;
    //return a.y>b.y;
}


int main()
{
    scanf("%d %d",&a,&b);
    for(int t=0;t<a;t++)
    {
        scanf("%s",r[t]);
        for(int w=0;w<b;w++)
            if(r[t][w]=='#') o[t][w]=l[t][w]='#';
            else if(w==0||(t%2&&w<b-1)) o[t][w]='#';
            else if(w==b-1||(t%2==0&&w>0)) l[t][w]='#';
    }
    for(int t=0;t<a;puts(""),t++)
        for(int w=0;w<b;w++)
        if(o[t][w]=='#') printf("#");
        else printf(".");
    puts("");
    for(int t=0;t<a;puts(""),t++)
        for(int w=0;w<b;w++)
        if(l[t][w]=='#') printf("#");
        else printf(".");
}


Measured memory_bytes: 3072
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n, a[2] = {};
    scanf("%d", &n);
    priority_queue<int> q;
    for (int i = 0, j; i < n; ++i)
    {
        scanf("%d", &j);
        q.push(j);
    }
    for (bool i = true; !q.empty(); i = !i)
    {
        a[i] += q.top();
        q.pop();
    }
    printf("%d\n", a[1] - a[0]);
}



Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))

ans = 0

#+2まで考慮してるから、nの数を-2にして調整しろ
for i in range(n-2):
	if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:
		ans = ans + 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod=1000000007;
int32_t main() {
  int n;
  cin>>n;
  vector<int>a(64,0);
  for(int j=0;j<n;j++){
    int x;
    cin>>x;
    bitset<64>c(x);
    for(int i=0;i<64;i++)
      if(c.test(i))
        a[i]++;
  }
  int ans=0;
  int j=1;
  for(int i=0;i<64;i++){
     if(i!=0) {
         j*=2;
         j%=mod;
     }
      ans=(ans+j*(a[i]*(n-a[i])%mod))%mod;
  }
  cout<<ans<<endl;
  
}

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

int dp[16][5][5];
bool grid[5][5];
const int px[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
const int py[] = {1, 2, 3, 1, 2, 3, 1, 2, 3};
const int dx[] = {-1, 0, 1, 0, 0};
const int dy[] = {0, -1, 0, 1, 0};

int main()
{
	int n;
	while (scanf("%d", &n), n){
		memset(dp, 0, sizeof(dp));
		memset(grid, true, sizeof(grid));
		
		char s, t, b;
		scanf(" %c %c %c", &s, &t, &b);
		s -= 'A'; t -= 'A'; b -= 'A';
		
		for (int i = 0; i < 9; i++){
			grid[px[i]][py[i]] = (b == i);
		}
		
		dp[0][px[s]][py[s]] = 1;
		for (int i = 0; i < n; i++){
			for (int x = 1; x <= 3; x++){
				for (int y = 1; y <= 3; y++){
					bool f = false;
					for (int dir = 0; dir < 4; dir++){
						int tx = x + dx[dir];
						int ty = y + dy[dir];
						if (grid[tx][ty]){
							//if (f) continue;
							dp[i + 1][x][y] += dp[i][x][y];
							//f = true;
						}
						else dp[i + 1][tx][ty] += dp[i][x][y];
					}
				}
			}
		}
		
		int sum = 0;
		int num = 0;
		for (int i = 0; i < 9; i++){
			sum += dp[n][px[i]][py[i]];
			num += dp[n][px[i]][py[i]] * (i == t);
		}
		
		double res = (double)num / sum;
		//printf("%d %d\n", num, sum);
		
		printf("%.8f\n", res);
	}
	
	return 0;
}

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

int main()
{
  set<int> s;
  for(int i=0;i<=25;i++)
  {
    for(int j=0;j<=15;j++)
    {
      if(i*4+j*7>100)
        break;
      else
        s.insert(i*4+j*7);
    }
  }
  int n;
  cin>>n;
  if(s.find(n)!=s.end())
    cout<<"Yes\n";
  else
    cout<<"No\n";
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <complex>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef unsigned long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const double EPS = 1e-6;
const int MAX = 100 * 1000 + 47;



int main()
{
    LL a, b, c, d, n;
    cin >> a >> b >> c >> d >> n;
    b = min(2 * a, b);
    c = min(2 * b, c);
    d = min(2 * c, d);
    LL res = (n/2) * d + (n % 2) * c;
    cout << res << endl;
    
    
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

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

    int ans=0,l=s.length();

    rep(i,l)if(s[i]!=t[i])ans++;

    cout<<ans<<"\n";

    return 0;

}

Measured memory_bytes: 3916
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

std::vector<int64_t> enum_div(int64_t n)
{
	std::vector<int64_t> ret;
	for(int64_t i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

bool is_prime(int64_t num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int64_t i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

void solve()
{
    int64_t A, B;
	std::cin >> A >> B;

	int64_t gcdAB = std::__gcd(A, B);
	// std::cout << gcdAB << std::endl;
	std::vector<int64_t> divisor;
	if(A > B) std::swap(A, B);
	if (is_prime(gcdAB)) {
		divisor = {1, gcdAB};
	} else {
		divisor = enum_div(gcdAB);
	}

	// for(auto i : divisor) std::cout << i << std::endl;
	int64_t cnt = 0;
	for (auto i : divisor) {
		if(is_prime(i)) cnt++;
	}
	std::cout << cnt + 1 << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>

#define max 200000

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    int n, a[max], i, b[max];
    
    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%d", &a[i]);
        b[i]=a[i];
    }
    
    qsort(a, n, sizeof(int), down_comp);
    
    for (i=0; i<n; i++) {
        //printf("%d %d, ", a[i], b[i]);
        if (a[0]==b[i]) {
            printf("%d\n", a[1]);
        } else {
            printf("%d\n", a[0]);
        }
    }
     
    return 0;
}


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

RED=[None]*N

for i in range(N):
    RED[i]=list(map(int,input().split()))

BLUE=[None]*N

for i in range(N):
    BLUE[i]=list(map(int,input().split()))


RED.sort(key=lambda x:x[0])

BLUE.sort(key=lambda x:x[1])

score=0
for i in range(N-1,-1,-1):
    for j in range(len(BLUE)):
        if RED[i][0]<BLUE[j][0] and RED[i][1]<BLUE[j][1]:
            score+=1
            del(BLUE[j])
            break

print(score)


Measured memory_bytes: 3064
NIL = -1

class Node:
    parent = NIL
    left = NIL
    right = NIL

n = int(input())
t = [Node() for i in range(n)]

for i in range(n):
    tmp = list(map(int, input().split()))
    id = tmp.pop(0)
    k = tmp.pop(0)
    c = tmp
    if k != 0:
        for j in c:
            t[j].parent = id
        t[id].left = c[0]
        for j in range(len(c)-1):
            t[c[j]].right = c[j+1]

def getdepth(u):
    d = 0
    while t[u].parent != NIL:
        u = t[u].parent
        d += 1
    return d

def getchildren(u):
    c = t[u].left
    result = []
    while c != NIL:
        result.append(c)
        c = t[c].right
    return result

for i in range(n):
    d = getdepth(i)
    c = getchildren(i)
    if d == 0:
        v = "root"
    elif c == []:
        v = "leaf"
    else:
        v = "internal node"
    print('node {}: parent = {}, depth = {}, {}, [{}]'.format(i, t[i].parent, d, v, ', '.join(map(str, c))))



Measured memory_bytes: 39280
#include<stdio.h>
int main()
{
    int k,s;
    scanf("%d%d",&k,&s);
    int i,j,sum=0;
    for(i=0;i<=k;i++)
        for(j=0;j<=k;j++)
        if(s-i-j<=k&&s-i-j>=0)
        sum++;
    printf("%d",sum);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  int n,d,x;
  cin>>n;
  cin>>d>>x;
  // int y=(d*(d+1))/2;
  int a[n]; rep(i,0,n) cin>>a[i];
  ll ans=x;
  rep(i,0,n){
    int idx=1;
    for(int j=idx;j<=d;j+= a[i]) ans++;
    // cout<<ans<<endl;
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int N,T;
    cin >> N >> T;
    
    ll t[N];
    for(int i=0;i<N;i++){
        cin >> t[i];
    }
    ll ans = 0;
    for(int i=0;i<N;i++){
        if(t[i+1]-t[i]>T){
            ans += T;
        }else{
            ans += t[i+1]-t[i];
        }
    }
    
    cout << ans << endl;
    return 0;
}




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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	while(true){
		int a,b; char op; cin>>a>>op>>b;
		int ans;
		switch(op){
			case '+':
				ans=a+b;
				break;
			case '-':
				ans=a-b;
				break;
			case '/':
				ans=a/b;
				break;
			case '*':
				ans=a*b;
				break;
			default:
				return 0;
		}
		cout<<ans<<"\n"s;
	}
}


Measured memory_bytes: 3224
import std.stdio;
import std.string;
import std.algorithm;

void main() {
	readln;
	auto a = readln.chomp.dup;

	int count;

	int left, right = cast(int)a.length - 1;
	for (;;) {
		while (left < a.length) {
			if (a[left] == 'W') {
				break;
			}
			++left;
		}
		while (right >= 0) {
			if (a[right] == 'R') {
				break;
			}
			--right;
		}

		if (right < left) {
			break;
		}

		++left;
		--right;
		++count;
	}

	writeln(count);
}


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

A, B, C = map(int,input().split())
K = int(input())

n = 0

while A >= B:
    B = 2*B
    n += 1
if n > K:
    print('No')
while B >= C:
    C = 2*C
    n += 1
if n > K:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9184
import java.util.ArrayList;
import java.util.HashMap;
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();
		if(n < a) {
			System.out.println(0);
		}else {
			System.out.println(10);
		}
	}

}


Measured memory_bytes: 24916
#include<bits/stdc++.h>
#define pb push_back
#define int long long 
#define pii pair<int,int>
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define ld long double
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int limit = 1e18;
signed main(){
    fast;
    int ans = 1;
    int n;
    cin>>n;
    int a[n+1];
    bool flag = true;
    for(int i = 1;i<=n;i++){
    	cin>>a[i];
    	if(a[i] == 0){
    		flag = false;
    	}
    }
    if(!flag){
    	cout<<0;
    	return 0;
    }
    for(int i = 1;i<=n;i++){
  		int x = a[i];
    	if((limit/x)<ans){
    		cout<<-1;
    		return 0;
    	}
    	ans*=x;
    }
    cout<<ans;
}

Measured memory_bytes: 4452
import sys

readline = sys.stdin.buffer.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import deque

    h, w, k = map(int, readline().split())

    if w == 1:
        print(1)
        sys.exit()

    que = deque("0")
    com = {i: {j: 0 for j in (-1, 0, 1)} for i in range(1, w + 1)}

    while que:
        cur = que.popleft()

        if len(cur) == w:
            cur += "0"
            for col in range(1, w + 1):
                if col >= 2 and cur[col - 1] == "1":
                    com[col][-1] += 1
                if col <= w - 1 and cur[col] == "1":
                    com[col][1] += 1
                if cur[col-1] == cur[col] == "0":
                    com[col][0] += 1
        else:
            if cur[-1] == "0":
                que.append(cur + "1")
            que.append(cur + "0")

    dp = [[0] * (w + 1) for _ in range(h + 1)]
    dp[0][1] = 1
    for row in range(h):
        for col in range(1, w + 1):
            if col >= 2:
                dp[row + 1][col - 1] += dp[row][col] * com[col][-1]
                dp[row + 1][col - 1] %= MOD
            if col <= w - 1:
                dp[row + 1][col + 1] += dp[row][col] * com[col][1]
                dp[row + 1][col + 1] %= MOD
            dp[row + 1][col] += dp[row][col] * com[col][0]
            dp[row + 1][col] %= MOD

    print(dp[-1][k] % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<stdio.h>
int main(void){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a<c)&&(b>c)){
		printf("Yes");
	}else if((a>c)&&(b<c)){
		printf("Yes");
	}else{
		printf("No");
	}
return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
   
int n, m;
 
void merge(int *u, int *net, int oldnet, int newnet){
  int i;
     
  for (i = 0; i < n; i++) {
    if (u[i] == oldnet) u[i] = newnet;
  }
   
  net[newnet] += net[oldnet];
  net[oldnet] = 0;
}
  
int main(int argc, char *argv[]){
  int i, s, t, p, q;
  int *u;
  int *net;
   
  scanf("%d", &n);
  scanf("%d", &m);
  u = (int *)malloc(sizeof(int) * n);
  net = (int *)malloc(sizeof(int) * (m + 1));
  for (i = 0; i < n; i++) u[i] = -1;
  for (i = 0; i <= m; i++) net[i] = 0;
   
  p = 1;
   
  for (i = 0; i < m; i++) {
    scanf("%d", &s);
    scanf("%d", &t);
    if (s != t) {
      if (u[s] == -1 && u[t] == -1) {
    u[s] = p;
    u[t] = p;
    net[p] += 2;
    p++;
      } else {
    if (u[s] != -1 && u[t] == -1) {
      u[t] = u[s];
      net[u[s]]++;
    } else if (u[s] == -1 && u[t] != -1) {
      u[s] = u[t];
      net[u[t]]++;
    } else {
      if (u[s] != u[t]) {
        if (net[u[s]] > net[u[t]]) merge(u, net, u[t], u[s]);
        else merge(u, net, u[s], u[t]);
      }
    }
      }
    }
  }
   
  scanf("%d", &q);
   
  for (i = 0; i < q; i++) {
    scanf("%d", &s);
    scanf("%d", &t);
   
    if (s == t) printf("yes\n");
    else {
      if (u[s] == u[t] && u[s] != -1 && u[t] != -1) printf("yes\n");
      else printf("no\n");
    }
  }
   
  return 0;
}

Measured memory_bytes: 1368
import fractions
N=int(input())
A=list(map(int,input().split()))

def gcd(x,y):
    if x==0:
        return y
    else:
        return gcd(y%x,x)

L=[0 for _ in range(N+1)]
L[0]=0
for i in range(N):
    L[i+1]=gcd(L[i],A[i])

R=[0 for i in range(N+1)]
R[N-1]=A[N-1]
for i in range(1,N)[::-1]:
    R[i-1]=gcd(R[i],A[i-1])

ans=0
for i in range(N):
    ans=max(ans,gcd(L[i],R[i+1]))
print(ans)

Measured memory_bytes: 16148
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define s(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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 dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  vector<pll> p(m);
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    p[i].F=a;
    rep(j,b){
      ll c;
      cin>>c;
      p[i].S|=(1<<c-1);
    }
  }
  vll dp((1<<n),INF);
  dp[0]=0;
  rep(i,(1<<n)){
    rep(j,m){
      ll nx=i|p[j].S;
      dp[nx]=min(dp[nx],dp[i]+p[j].F);
    }
  }
  if(dp[(1<<n)-1]==INF){
COUT(-1);
  }
  else COUT(dp[(1<<n)-1]);
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>
#include <functional>

using namespace std;

#define F first
#define S second
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << ": "; for (auto& xxxx: a) cerr << xxxx << " "; cerr << endl;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))
#define equal equalll
#define less lesss

typedef double dbl;
typedef long long ll;
const int N = -1;
const int INF = 1.01e9;
typedef vector<int> vi;



int main() {
#ifdef HOME 
    assert(freopen("in", "r", stdin));
#endif
    int n, a, b;
    cin >> n >> a >> b;   
    if ((b - a) % 2 == 0) {
        puts("Alice");
    }
    else {
        puts("Borys");
    }
     
#ifdef HOME 
    epr("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
#endif
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int h, w, k;
    cin >> h >> w >> k;

    vector<vector<char>> grid(h, vector<char>(w));
    rep(y, h) rep(x, w)cin >> grid[y][x];
    int ans = 0;
    rep(a, 1 << h) {
        rep(b, 1 << w) {
            auto tmp = grid;

            rep(y, h) {
                if (!((a >> y) & 1))continue;
                rep(x, w) tmp[y][x] = 'R';
            }

            rep(x, w) {
                if (!((b >> x) & 1))continue;
                rep(y, h) tmp[y][x] = 'R';
            }

            int c = 0;
            rep(y, h) c += count(tmp[y].begin(), tmp[y].end(), '#');
            if (c == k) ans++;

        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
constexpr auto MOD = 998244353;
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; }

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

    int n, m;
    ll p;
    cin >> n >> m >> p;
    int a, b;
    ll c;
    vector<tuple<int, int, ll>> edge;
    FOR(i, 0, m) {
        cin >> a >> b >> c;
        edge.push_back(make_tuple(--a, --b, c - p));
    }

    vector<bool> neg(n, false);
    vector<ll> ans(n, -LLINF);
    ans[0] = 0;
    eFOR(i, 1, n * 2) {
        for (auto next : edge) {
            tie(a, b, c) = next;
            if (ans[a] < -LLINF / 2)continue;
            if (chmax(ans[b], ans[a] + c)) {
                if (i > n)neg[b] = true;
            }
            if (neg[a])neg[b] = true;
        }
    }

    cout << (neg[n - 1] ? -1 : max(ans[n - 1], 0LL)) << "\n";

}


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

int main() {
  string S;
  cin>>S;
  vector<string>X={"a","b","c","d","e","f","g","h","i","j","k","l","n","m","o","p","q","r","s","t","u","v","w","x","y","z"};
  for(int i=0;i<26; i++){
    if(S==X.at(i)){
      cout<<X.at(i+1)<< endl;
    }
  }
}
  


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

using namespace std;

int main(void)
{
  int n,buff;
  cin >> n;

  vector<int> A;
  for(int i = 0;i < n;i++){
    cin >> buff;
    A.push_back(buff);
  }
  
  const auto max = max_element(A.begin(),A.end());
  const auto indent = distance(A.begin(),max);
  sort(A.rbegin(),A.rend());
  
  for(int i = 0;i < n;i++){
    if(i == indent) cout << A[1] << '\n';
    else cout << A[0] << '\n';
  }
  cout << endl;
}


Measured memory_bytes: 2548
object Main extends App {
    var get = readLine.split(" ")
    var i = 0
  for(i <- 0 to get.size-1){
	if(get(i)=="A")
      println("T")
    else if(get(i)=="T")
      println("A")
    else if(get(i)=="C")
      println("G")
    else
      println("C")
  }
}

Measured memory_bytes: 25272
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define rep(i,n) for(int i=0;i<n;i++)
#define ford(i,a,n) for(int i=a;i<n;i++)
#define fors(i,s) for(int i=0;i<s.size();i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define INF 1e9
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
int main(){
	string s;
	cin>>s;
	if(s=="Sunny"){
		cout<<"Cloudy";
	} 
	if(s=="Cloudy"){
		cout<<"Rainy";
	}
	if(s=="Rainy"){
		cout<<"Sunny";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
void printArr(int *a, int len){for(int i=0; i<len; i++){if(i)cout << " ";cout << a[i];}cout << endl;}
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

//--global--//

ll s[2000][2000];
ll hscore[2000];
ll wscore[2000];

//----------//

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//
    
    int n, m;
    ll a[MAX];
    //value, cnt
    priority_queue<pair<int, int> > q;
    cin >> n >> m;
    rep(i, n){
        cin >> a[i];
    }
    sort(a, a+n);
    ll mcnt = 0;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        q.push(make_pair(b, a));
    }
    bool ok = false;
    ll sum = 0;
    int index = 0;
    int cnt = 0;
    int value = 0;
    rep(i, n){
        if(q.size()>0 && cnt <= 0){
            pair<int, int> f = q.top(); q.pop();
            value = f.first;
            cnt = f.second;
        }
        if(q.size()<=0 && cnt == 0){
            cnt = 0;
            value = 0;
        }
        if(value > a[i]){
            cnt--;
            sum += value;
        }
        else{
            sum += a[i];
        }
    }

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


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
string name[1000];
int W[1000];

string S;

int dfs(int &cur,int r){
    if(r==1){
        int t;
        if(S[cur]=='('){
            cur++;
            t=dfs(cur,2);
            cur++;
        }
        else{
            string str;
            if(islower(S[cur+1]))str=S.substr(cur,2),cur+=2;
            else str=S.substr(cur,1),cur++;
            t=W[find(name,name+N,str)-name];
        }
        int n=0;
        while(isdigit(S[cur])){
            n=n*10+S[cur]-'0';
            cur++;
        }
        if(n==0)n=1;
        return t*n;
    }
    else{
        int ret=0;
        while(isalpha(S[cur])||S[cur]=='('){
            ret+=dfs(cur,1);
        }
        return ret;
    }
}

signed main(){
    while(cin>>S,S.size()<=2){
        name[N]=S;
        cin>>W[N];
        N++;
    }
    W[N]=INT_MIN;

    while(cin>>S,S!="0"){
        S+="=";
        int cur=0;
        int tmp=dfs(cur,2);
        if(tmp<0)cout<<"UNKNOWN"<<endl;
        else cout<<tmp<<endl;
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main(void){

    int s, w;
    cin >> s >> w;
    if(w >= s) cout << "unsafe\n";
    else cout << "safe\n";

    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
int b=0;
for(int c=0;c<a;c++){
    string d;
    cin>>d;
    if(d=="A")b++;
    else b--;
    if(b<0){cout<<"NO"<<endl;goto e;}
    }
    if(b!=0)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    e:;
}

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

int main() {
    int n, k;
    long long ans;
    cin >> n >> k;
    
    vector<int> vec(n);
    for (int i=0; i < n; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    if (k>=n) {
        cout << 0 << endl;
    } else {
        for (int i=0; i<n; i++) {
            if (i>=k) {
                ans += vec[i];
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    ll res = 0;
    ll highest = a[0];
    for(ll i = 1; i < n; i++) {
        if (a[i] < highest) {
            res += highest - a[i];
            highest = highest;
        } else {
            highest = a[i];
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4840
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{
	int to,cap,cost,rev;
};
typedef vector<edge> ve;
typedef vector<ve> vve;
class MCF{	//Minimum Cost Flow
	public:
	int n;
	vve G;
	vi h,dist,prev,pree;
	MCF(int size){
		n=size;
		G=vve(n);
		h=dist=prev=pree=vi(n);
	}
	void add_edge(int s,int t,int ca,int co){
		edge e={t,ca,co,G[t].size()};
		G[s].pb(e);
		edge ee={s,0,-co,G[s].size()-1};
		G[t].pb(ee);
	}
	int mcf(int s,int t,int f){
		int out=0;
		h=vi(n);
		while(f>0){			
			priority_queue<pii,vector<pii> >q;
			dist=vi(n,inf);
			dist[s]=0;
			q.push(pii(0,s));
			while(!q.empty()){
				pii p=q.top();q.pop();
				int v=p.second;
				if(dist[v]<-p.first)continue;
				rep(i,G[v].size()){
					edge &e=G[v][i];
					if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
						dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
						prev[e.to]=v;
						pree[e.to]=i;
						q.push(pii(-dist[e.to],e.to));
					}
				}
			}
			if(dist[t]==inf)return -1;
			rep(i,n)h[i]+=dist[i];
			int d=f;
			for(int v=t;v!=s;v=prev[v])d=min(d,G[prev[v]][pree[v]].cap);
			f-=d;
			out+=d*h[t];
			for(int v=t;v!=s;v=prev[v]){
				edge &e=G[prev[v]][pree[v]];
				e.cap-=d;
				G[v][e.rev].cap+=d;
			}
		}
		return out;	
	}
};
int main(){
	int n,t=1;
	cin>>n;
	vp in(n);
	map<int,int>ma;
	rep(i,n){
		int a,b;
		cin>>a>>b;
		if(!ma.count(a))ma[a]=t++;
		if(!ma.count(b))ma[b]=t++;
		in[i]={a,b};
	}
	int m=ma.size();
	MCF mcf(n+m+3);
	int s=n+m;t=s+1;
	int da=t+1;
	
	rep(i,n)mcf.add_edge(s,i,1,0);
	rep(i,m)mcf.add_edge(n+i,t,1,0);
	mcf.add_edge(da,t,inf,0);
	rep(i,n){
		mcf.add_edge(i,da,1,1000000);
		mcf.add_edge(i,n+ma[in[i].first]-1,1,1000000-in[i].second);
		mcf.add_edge(i,n+ma[in[i].second]-1,1,1000000-in[i].first);
	}
	cout<<1000000*n-mcf.mcf(s,t,n)<<endl;;
}

Measured memory_bytes: 3580
import java.util.*;
import java.math.*;
class Main{
public static void main(String[] args) {
  Scanner stdIn = new Scanner(System.in);
  int n = stdIn.nextInt();
  int[] p = new int[n];
  for(int i = 0;i<p.length;i++) {
    p[i] = stdIn.nextInt();
  }
  int[] unko = new int[3];
  int count = 0;
  for(int i = 0;i<p.length-2;i++) {
    int a = p[i];
    int b = p[i+1];
    int c = p[i+2];
    unko[0] = a;
    unko[1] = b;
    unko[2] = c;
    Arrays.sort(unko);
    if(unko[1]==b) {
      count += 1;
    }
  }
  System.out.println(count);
}
}


Measured memory_bytes: 23764
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N){
    ll ans = 0;
    for(ll i=1; i<=N; i+=2){
        ll cnt = 0;
        for(ll j=1; j<= i; j++){
            if(i % j == 0)
                cnt ++;
        }
        if(cnt == 8)
            ans ++;
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
/***************************************** START OF TEMPLATE *********************************************/

#include<bits/stdc++.h>

using namespace std;

#define  SPEED          ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  newl           cout<<"\n";
#define  f              first
#define  s              second
#define  pb             push_back
#define  mp             make_pair
#define  sym(s)         s="#"+s+"#";   
#define  all(x)         (x).begin(),(x).end()
#define  alll(x, n)     x+1, x+n+1
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  mset1d(a,n,v)  foo(i,0,n+5)a[i]=v;
#define  mset2d(a,n,m,v)foo(i,0,n+5)foo(j,0,m+5)a[i][j]=v;
#define  INP(a,n)       foo(i,1,n) cin>>a[i];
#define  deb1d(a,n)     foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)   foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}    
#define  debm(a)        for(auto it: a)cout<<"{"<<it.f<<","<<it.s<<"}, ";newl;
#define  debp(a,n)      foo(i,1,n)cout<<"{"<<a[i].f<<","<<a[i].s<<"}, ";newl;
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<" ";newl;
#define  deb2(a,b)      cout<<a<<" "<<b<<" ";newl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<" ";newl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d;newl;
#define  ll             long long
#define  ld             long double
#define  pll            pair<ll,ll>
#define  vll            vector<ll>
#define  vpll           vector<pll>

const ld   PI    =  3.14159265358979323846; 
const ll   MOD   =  1e+9+7;
const ll   INF   =  LLONG_MAX;
const int  INFi  =  INT_MAX;
const ll   N     =  2e+5+8;

vll adj[N]; ll vis[N];
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

ll test_cases = 1; randomINIT;

/*********************************************************************************************************/
/***************************************** VARIABLE DECLARATIONS *****************************************/



/***************************************** FUNCTION IMPLEMENTATIONS **************************************/



/***************************************** START OF MAIN FUNCTION ****************************************/ 
void MAIN(ll tc){
    ll a, v, b, w, t;
    cin>>a>>v>>b>>w>>t;
    ld d = abs(a-b);
    ld tt = d/(v-w);
    if(tt<=t && tt>0){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
    
}


int main(){
    SPEED;

    //cin>>test_cases;
    foo(i,1,test_cases){
    MAIN(i);
    }
}

Measured memory_bytes: 8340
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
       int a = scan.nextInt();

       int b = scan.nextInt();

       int c = scan.nextInt();

     if( a < b&&b < c ){
         System.out.println("Yes");
      }else{
         System.out.println("No");
        }
    }
}


Measured memory_bytes: 26252
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int n,a;
  cin >> n >> a;
  vector<int>x(n);
  rep(i,n){
    cin >> x[i];
    x[i] -= a;
  }
  map<ll,ll>dp;
  dp[0] = 1;
  rep(i,n){
    map<ll,ll>tmp;
    for(auto j : dp){
      tmp[j.first + x[i]] += j.second;
      tmp[j.first] += j.second;
    }
    dp = tmp;
  }
  cout << dp[0] - 1 << endl;
  return 0;
}


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

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  vector<int> len(N, 0);
  for(int i = 1; i <= N; i++) {
    for(int j = i; j <= N; j++) {
      int a = j - i;
      int b, c;
      if (X >= i) {
        b = X - i;
      }
      else {
        b = i - X;
      }
      if (Y >= j) {
        c = Y - j;
      }
      else {
        c = j - Y;
      }
      int d = b + c + 1;
      if (a < d) {
        len.at(a)++;
      }
      else {
        len.at(d)++;
      }
    }
  }
  for (int i = 1; i < N; i++) {
    cout << len.at(i) << endl;
  }       
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


struct cake{
  LL k;
  LL o;
  LL p;
};

int main(){
  int n, m;
  scanf("%d %d", &n, &m);

  vector<cake> v(n);
  LL a, b, c;
  REP (i, n) {
    scanf("%lld %lld %lld", &a, &b, &c);
    v[i] = {a, b, c};
  }

  LL ans = 0;
  vector<LL> s(n);
  REP (k, 8) {
    REP (i, n) {
      s[i] = pow(-1, k / 4) * v[i].k + pow(-1, (k % 4) / 2) * v[i].o + pow(-1, k % 2) * v[i].p;
    }
    sort(s.begin(), s.end(), greater<LL>() );
    LL sum = abs(accumulate(s.begin(), s.begin() + m, 0LL));
    ans = max(ans, sum);
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().strip()

i  = lambda: int(input())
li = lambda: list(map(int, input().split()))

N = i()
V = sorted(li())

count = (V[0] + V[1]) / 2

for i in range(2, N):
  count = (count + V[i]) / 2

print(count)

Measured memory_bytes: 3060
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 5e3 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	if (s1.back() == s2.front() && s2.back() == s3.front()) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,wm;
  long long n4;
  while(1){
    wm=262144;
    n4=0;
    cin >> n;
    if(n<0)break;
    for(int i=0;wm!=1;i++){
      n4*=10;
      if(n/wm!=0){
	n4+=n/wm;
	n%=wm;
      }
      wm/=4;
    }
    n4*=10;
    if(n!=0){
      n4+=n;
    }
    cout << n4 << endl;
  }
  return 0;
}

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

int main() {
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'C') {
			for (int j = i; j < S.size(); j++) {
				if (S[j] == 'F'){
				printf("Yes");
				return 0;
				}
			}
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

typedef pair<int, int> i_i;
struct edge { int v, w; };

vector<int> dijkstra(int N, vector<vector<edge> >& G, int s) {
	vector<int> d(N, INT_MAX);
	d[s] = 0;
	priority_queue<i_i, vector<i_i>, greater<i_i> > pq;
	pq.push(i_i(0, s));
	while (pq.size()) {
		i_i p = pq.top(); pq.pop();
		int u = p.second;
		if (p.first > d[u]) continue;
		for (edge e: G[u])
			if (d[e.v] > d[u] + e.w) {
				d[e.v] = d[u] + e.w;
				pq.push(i_i(d[e.v], e.v));
			}
	}
	return d;
}


int main() {
	int N, M, s; cin >> N >> M >> s;
	vector<vector<edge> > G(N);
	while (M--) {
		int u, v, w; scanf("%d%d%d", &u, &v, &w);
		G[u].push_back(edge{v, w});
	}
	vector<int> d = dijkstra(N, G, s);
	for (int u = 0; u < N; u++)
		if (d[u] < INT_MAX) printf("%d\n", d[u]);
		else printf("INF\n");
}

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

int main(){
    int n,k;
    cin >> n >> k;
    ve<int> a(n+1);
    rep(i,n) cin >> a[i];
    rep(i,k){
        ve<int> b(n+1);
        swap(a,b);
        rep(j,n){
            int l = max(0,(int)j-b[j]);
            a[l]++;
            a[min(n,(int)(b[j]+j+1))]--;
        }
        if(a[n]+n==0){
            rep(j,n)a[j+1] += a[j];
            break;
        }
        rep(j,n) a[j+1] += a[j];
    }
    rep(i,n) cout << a[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 5156
import java.util.Scanner
 
object Main extends App {
  val sc = new Scanner(System.in)
  System.currentTimeMillis
  val n = sc.nextInt()
  val a = new Array[Int](n)
  for(i <- 0 until n)
    a(i) = sc.nextInt()
 
  var cnt = 0L
  var ans = 0L
  for(i <- 0 until n){
    val now = a(i)
    cnt += now
 
    if(i % 2 == 0){
      if(cnt < 1){
        ans += 1 - cnt
        cnt = 1
      }
    }
    else{
      if(cnt > -1){
        ans += cnt - (-1)
        cnt = -1
      }
    }
  }
 
  cnt = 0L
  var ans2 = 0L
  for(i <- 0 until n){
    val now = a(i)
    cnt += now
 
    if(i % 2 != 0){
      if(cnt < 1){
        ans2 += 1 - cnt
        cnt = 1
      }
    }
    else{
      if(cnt > -1){
        ans2 += cnt - (-1)
        cnt = -1
      }
    }
  }
 
  println(Math.min(ans, ans2))
}


Measured memory_bytes: 52444
def gets_nums
    gets.split.map{|x| x.to_i}
end
a, v, _ = *gets_nums
b, w, _ = *gets_nums
t, _ = *gets_nums

sign = a < b ? +1 : -1
a1 = a+v*t*sign
b1 = b+w*t*sign
puts a < b && b1 <= a1 || b < a && a1 <= b1 ? 'YES' : 'NO'


Measured memory_bytes: 14384
#include<stdio.h>
#include<stdlib.h>
int m[101][101],n;
#define INF 100000000
int min(int a,int b){
  if(a<=b){
    return a;
  }
  else return b;
}
int matrixChainOrder(int *p){
  int i,j,k,q,l;
  n=n+1;
  for(i=1;i<n;i++){
    m[i][i] = 0;
  }
  for(l=2;l<n;l++){
    for(i=1;i<n-l+1;i++){
      j=i+l-1;
      m[i][j] = INF;
      for(k=i;k<=j-1;k++){
        q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
        m[i][j]=min(m[i][j],q);
      }
    }
  }
  return m[1][n-1];
}

int main(){
  int i,f;
  scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d%d",&p[i],&p[i+1]);
  }
  f=matrixChainOrder(p);
  printf("%d\n",f);
  return 0;
}



Measured memory_bytes: 2048