akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
using namespace std;

class Adjl{
private:
	int u;
	int k;
	int *v;
public:
	Adjl(int u, int k);
	void setV(int vk);
	void printAdjm(int n);
};

Adjl::Adjl(int u, int k)
{
	this->u = u;
	this->k = 0;
	v = new int[k];
}

void Adjl::setV(int vk)
{
	v[k] = vk;
	k++;
}

void Adjl::printAdjm(int n)
{
	int j = 0;
	for (int i = 1; i <= n; i++) {
		if (j < k && v[j] == i) {
			cout << "1";
			j++;
		}
		else {
			cout << "0";
		}
		if (i < n) cout << " ";
		else cout << endl;
	}
}

int main(void)
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int u, k;
		cin >> u >> k;
		Adjl *adjl = new Adjl(u, k);
		for (int j = 0; j < k; j++) {
			int vk;
			cin >> vk;
			adjl->setV(vk);
		}
		adjl->printAdjm(n);
		delete adjl;
	}

	return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
typedef long long ll;
int main() {
	ll a = 0, b = 0, c = 0, x = 0, y = 0;
	ll honraisum = 0, toku = 0;
	ll sum = 0;
	std::cin >> a >> b >> c >> x >> y;
	honraisum = a*x + b*y;
	toku = (a + b) - (c * 2);
	if (toku >= 0) {
		sum = honraisum - (toku * std::min(x, y));
		if (x < y) {
			if (b >= c * 2) {
				sum = sum - (b - c * 2) * (std::max(x, y) - std::min(x, y));
			}
			std::cout << sum << std::endl;
			return 0;
		}else{
			if (a >= c * 2) {
				sum = sum - (a - c * 2) * (std::max(x, y) - std::min(x, y));
			}
			std::cout << sum << std::endl;
			return 0;
		}
	}
	else {
		std::cout << honraisum << std::endl;
		return 0;
	}
}

Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define ull unsigned long long
#define vi vector<int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
template <typename T>
void add(T &a, T b){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b){
	a *= b;
	if(a >= mod)a %= mod;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.txt", "r", stdin);
 //    	freopen("output.txt", "w", stdout);
	// #endif
	int n,m;
	cin>>n>>m;
	vi v(m);
	ll sum = 0;
	rep(i,m){
		cin>>v[i];
		sum += v[i];
	}	
	if(sum > n){
		cout<<-1;
	}
	else{
		cout<<n-sum;
	}
	return 0;
}

Measured memory_bytes: 3660
n = int(input())
list_int = list(map(int, input().split()))
ave0 = int(sum(list_int)/n)
ave1 = ave0 + 1
ave2 = ave0 - 1

list_cost0 = [(i-ave0)**2 for i in list_int]
list_cost1 = [(i-ave1)**2 for i in list_int]
list_cost2 = [(i-ave2)**2 for i in list_int]
print(min([sum(list_cost0), sum(list_cost1), sum(list_cost2)]))

Measured memory_bytes: 61820
# C - Lamps

n, k = map(int, input().split())
a = list(map(int, input().split()))
assert len(a) == n

b = [0] * n
for kk in range(k):
    l = [i - a[i] for i in range(n)]
    r = [i + a[i] for i in range(n)]
    l.sort()
    r.sort()
    ln = 0
    rn = 0
    for i in range(n):
        while ln < n and l[ln] <= i:
            ln += 1
        while rn < n and r[rn] <  i:
            rn += 1
        b[i] = ln - rn
    a, b = b, a
    if all(v >= n for v in a):
        break

print(' '.join(map(str, a)))


Measured memory_bytes: 226228
#include <bits/stdc++.h>
#define PI 3.14159265358979323846264338327950L
#define pb push_back
#define fr first
#define sc second
#define MOD 1000000007
#define len(s) s.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define f(i, a, n) for (int i = a; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef map<int, int> mii;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // int t;
    // cin >> t;
    // while (t--)
    int a,b,h,m; cin>>a>>b>>h>>m;
    long double mdeg=6.0*m;
    long double hdeg=h*30+ mdeg/12;
    //cout<<mdeg<<" "<<hdeg<<endl;
    long double ang=abs(hdeg-mdeg);
    //cout<<ang<<endl;
    ang=ang*(PI/180);
    double ans=a*a+ b*b - 2*a*b*cos(ang);
    printf("%0.20lf",sqrt(ans));

    return 0;
}

Measured memory_bytes: 4100
n = int(input())
a = [int(x) for x in input().split()]

a = [0] + a + [0]
d = []
for i in range(n+1):
    d.append(abs(a[i+1] - a[i]))

s = sum(d)
for i in range(n):
    ans = s - d[i] - d[i+1] + abs(a[i+2] - a[i])
    print(ans)


Measured memory_bytes: 14048
#include<bits/stdc++.h>
using namespace std;
int n;
double x, cnt, a, b;
priority_queue<double, vector<double>, greater<double> >pq;
int main(void)
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		pq.push(x);
	}
	while (pq.size() > 1)
	{
		a = pq.top();
		pq.pop();
		b = pq.top(); 
		pq.pop();
		pq.push((a + b) / 2.0);
	}
	cout << pq.top() << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(list)
n = int(input())
for i in range(n):
    mark, num = input().split()
    d[mark].append(int(num))
# print(d)

for m in "SHCD":
    m_num = d[m]
    for i in range(1,14):
        if i not in m_num:
            print(m, i)


Measured memory_bytes: 5992
#include <stdio.h>
#include<string.h>

int main()
{
  int x;
  long long ans=0;
  scanf("%d",&x);
  
    while(x>=500)
    {
      x-=500;
      ans+=1000;
    }
  
  while(x>=5)
  {
    x-=5;
    ans+=5;
  }
  
  printf("%lld\n",ans);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
long long int n, k;
long long int a2[50];
long long int one = 1;
long long int solve2(long long int a3){
	long long int ans = 0;
	for(int i = 0;i <= a3;i++){
		ans += (max(a2[i], n - a2[i]) * (one << i)); 
	}
	return ans;
}
long long int solve(long long int a3, long long int k2){
	long long int count3 = 0;
	for(long long int i = 0;;i++){
		if((k2 >> i) == 0){
			count3 = i - 1;
			break;
		}
	}
	if(a3 == 0){
		if(k2 == 1){
			return max(a2[0], n - a2[0]);
		}
		if(k2 == 0){
			return a2[0];
		}
	}
	if((k2 >> a3) == 0){
		return (one << a3) * a2[a3] + solve(a3 - 1, k2);
	}
	return max((one << a3) * a2[a3] + solve2(a3 - 1), (one << a3) * (n - a2[a3]) + solve(a3 - 1, k2 - (one << a3)));
}
int main(){
	long long int a;
	for(long long int i = 0;i < 50;i++){
		a2[i] = 0;
	}
	cin >> n >> k;
	for(int i = 0;i < n;i++){
		cin >> a;
		for(int j = 0;a >> j;j++){
			a2[j] += (a >> j) % 2;
		}
	}
	long long int count = 0;
	for(long long int i = 0;;i++){
		if((k >> i) == 0){
			count = i - 1;
			break;
		}
	}
	long long int count2;
	for(long long int i = 49;i >= 0;i--){
		if(a2[i]){
			count2 = i;
			break;
		}
	}
	cout << solve(49, k) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}





int main(void){
   int N,D,number;
   scanf("%d %d",&N,&D);
   if(N%(D*2+1)==0){
      number=N/(D*2+1);
   }else{
      number=N/(D*2+1)+1;
   }
   printf("%d",number);
   return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int dp[5001];
int dp1[5001];
int A, B;
int AA[5000];
int BB[5000];
int ans = 0;
int main()
{
	scanf("%d%d", &A, &B);
	for (int i = 0; i < A; i++)scanf("%d", &AA[i]);
	for (int i = 0; i < B; i++)scanf("%d", &BB[i]);
	for (int j = 1; j <= B; j++){
		int ma = 0;
		for (int i = 1; i <= A; i++){
			ma = max(ma, dp[i-1]);
			if (AA[i-1] == BB[j-1])dp1[i] = ma + 1;
			else dp1[i] = 0;
		}
		for (int i = 1; i <= A; i++){
			dp[i] = dp1[i];
			ans = max(ans, dp1[i]);
		}
		
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1264
#include <iostream>

void swap(int* a, int* b)
{
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

int main()
{
    int a, b;
    for (;;)
    {
        std::cin >> a >> b;
        if (a == 0 && b == 0)
            return 0;
        if (a > b)
            swap(&a, &b);
        std::cout << a << ' ' << b << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3096
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def getTime(v):
  time = 0
  total = 0
  while total <= v:
    time += 1
    total += time
  return (time - 1)

N = int(input())
result = 0
c = collections.Counter(prime_factorize(N))
for k in c.keys():
  result += getTime(c[k])
  
print(result)



Measured memory_bytes: 9468
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class RectangleSum():
    def __init__(self, N, M):
        self.N = N
        self.M = M
        self.s = [[0] * (M+1) for _ in range(N+1)]

    def add(self, i, j, v):
        self.s[i+1][j+1] += v

    def build(self):
        for i in range(self.N+1):
            for j in range(self.M):
                self.s[i][j+1] += self.s[i][j]

        for i in range(self.N):
            for j in range(self.M+1):
                self.s[i+1][j] += self.s[i][j]

    def sum(self, i, j, h, w):
        ret = self.s[i][j]
        ret += self.s[i+h][j+w]
        ret -= self.s[i+h][j]
        ret -= self.s[i][j+w]

        return ret


@mt
def slv(N, M, Q, LR, PQ):
    rs = RectangleSum(N+1, N+1)
    for l, r in LR:
        rs.add(l, r, 1)

    rs.build()

    for p, q in PQ:
        print(rs.sum(p, p, q-p+1, q-p+1))


def main():
    N, M, Q = read_int_n()
    LR = [read_int_n() for _ in range(M)]
    PQ = [read_int_n() for _ in range(Q)]
    slv(N, M, Q, LR, PQ)


if __name__ == '__main__':
    main()


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

int main()
{
	int a, b, c, d, u, v;

	cin >> a >> b >> c >> d;
	
	u = c - a;
	v = d - b;

	cout << c - v << " " << d + u << " " 
		 << a - v << " " << b + u << endl;

	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = S()
    t = S()
    s.sort()
    t.sort(reverse = True)
    if s < t:
        print("Yes")
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()


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

int main() {
    int n; cin >> n;
    n *= 2;
    vector<int> v(n, 0);
    for(int i = 0; i < n; ++i)
        cin >> v[i];
    sort(v.begin(), v.end());
    int ans = 0;
    for(int i = 0; i < n; i += 2)
        ans += v[i];
    cout << ans << "\n";
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<double> a(n);
    for(int i = 0; i < n; ++i){
        int temp;
        cin >> temp;
        a[i] = (double)1 / temp;
    }
    
    double sum = accumulate(a.begin(), a.end(), 0.0);
    cout << (double)1 / sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

vector<pair<long long, int>> factor(long long x) {
    vector<pair<long long, int>> res;
    for (long long i = 2; i*i <= x; ++i) {
        if (x % i) continue;
        res.emplace_back(i, 0);
        while (x % i == 0) {
            x /= i;
            res.back().second++;
        }
    }
    if (x != 1) res.emplace_back(x, 1);
    return res;
}

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

    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n; ++i) {
        auto f = factor(i);
        for (auto&& p : f) mp[p.first] += p.second;
    }
    vector<int> cnt(76);
    for (auto&& p : mp) cnt[min(75, p.second)]++;
    for (int i = 75; i >= 1; --i) cnt[i-1] += cnt[i];
    int ans = 0;
    ans += cnt[74];
    ans += cnt[24] * (cnt[2] - 1);
    ans += cnt[14] * (cnt[4] - 1);
    ans += cnt[4] * (cnt[4] - 1) / 2 * (cnt[2] - 2);
    cout << ans << endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll L(ll a, ll b, ll n) {
    ll ans = a - 1;
    b -= (a - 1) + 1;
    a = 1;
    ll mid = (a + b) / 2;
    return 1 + ans + mid - a;
}
ll R(ll a, ll b,ll n) {
    ll ans = n - b;
    a += (n - b) + 1;
    b = n;
    ll mid = (a + b) / 2;
    return 1 + ans + mid - a; 
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, a, b; cin >> n >> a >> b;
    ll mid = (a + b) / 2;
    if (mid - a == b - mid)
        cout << mid - a << '\n';
    else
        cout << min(L(a, b, n), R(a, b, n)) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size()
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define forn(i, n) for (int i = 1; i <= n; i++)
#define ford(i, n) for (int i = n; i >= 0; i--)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define foreach(itr, c) for (__typeof((c).begin(), (c).end()) itr = c.begin(); itr != c.end(); itr++)
#define fill(a, b) memset(a, b, sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
#define fast()                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<char> vs;
typedef vector<pi> vpi;

using namespace std;

int main()
{
    int n, x, t;
    int temp = 0;

    cin >> n >> x >> t;

    if (n % x == 0)
    {
        cout << (n / x) * t;
    }
    else
    {
        cout << (n / x + 1) * t;
    }
}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

ll n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;
#endif
  cin >> n;
  if (n&1) {
    cout << 2 * n << endl;
  } else {
    cout << n << endl;
  }
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;
template<typename T> void print(T t) {cout << t << endl;}
;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1; i <= B; i++) {
		if ((A * i) % B == C) {
			print("YES");
			return 0;
		}
	}
	print("NO");
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
    #define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #define ll long long int
    #define debug(x) cerr<<#x<<'='<<(x)<<endl;
    using namespace std;
    int main()
    {
        FLASH
        ll x,a,b,n,i;
        cin >> x;
        a = -1e18;
        b = 1e18;
        vector<ll> v;
        i = -3800;
        while(i*i*i*i*i < b)
        {
            n = i*i*i*i*i;
            v.push_back(n);
            i++;
        }
        for(i =0; i < v.size();i++)
        {
            n = v[i];
            ll nn = n - x;
           
            if(binary_search(v.begin(),v.end(),nn) == true)
            {
                if(n - nn != x)
                    continue;
                ll k1 = lower_bound(v.begin(), v.end(), n)- v.begin();
                ll k2 = lower_bound(v.begin(), v.end(), nn)- v.begin();
                k2 -= 3800;
                k1 -= 3800;
                cout << k1 << " " << k2;
                break;
            }
        }
        return 0;
    }



Measured memory_bytes: 3768
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

int main() {
	vector<int>as(4);
	for (int i = 0; i < 4; ++i)cin >> as[i];
	sort(as.begin(), as.end());
	if (as[0] == as[1] && as[2] == as[3]) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3144
N = int(input())
X, U = [], []
T = 0
for _ in range(N):
  x, u = input().split()
  X.append(x)
  U.append(u)
for x, u in zip(X, U):
  if u == "JPY":
    T += int(x)
  else:
    T += float(x)*380000.0
print(T)

Measured memory_bytes: 9060
#include <iostream>

using namespace std;

int main(){
    string s;
    cin >> s;
    char before_cha='w';
    for(int i=0;i<s.size();i++){
        if(s[i] == before_cha){
            cout << "Bad\n" ;
            return 0;
        }
        before_cha = s[i];
    }
    cout << "Good\n";
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int k = ri();
	int a[n];
	for (auto &i : a) i = ri();
	
	int64_t sum[n + 1];
	sum[0] = 0;
	for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
	
	std::vector<int64_t> all;
	for (int i = 0; i < n; i++) for (int j = i + 1; j <= n; j++) all.push_back(sum[j] - sum[i]);
	
	int64_t res = 0;
	for (int i = 60; i--; ) {
		int cnt = 0;
		for (auto j : all) if (j >> i & 1) cnt++;
		if (cnt >= k) {
			res |= 1LL << i;
			std::vector<int64_t> next;
			for (auto j : all) if (j >> i & 1) next.push_back(j);
			all = next;
		}
	}
	printf("%" PRId64 "\n", res);
	
	return 0;
}


Measured memory_bytes: 9036
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define INF 1000000007
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int n;
    cin >> n;
    map<string, ll> m;
    string ans = "YES";
    string tmp;
    while (cin >> tmp) {
        if (m.count(tmp) != 0) {
            ans = "NO";
            break;
        }
        m[tmp] = 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 24832
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.array;

int[] read_nums() {return readln.strip.chomp.split(" ").map!(to!(int)).array;}

void main() {
  int times = readln.chomp.to!(int);
  int index = -1;
  int max = -1;
  foreach(t; 0..times) {
    int[] result = read_nums;
    if (result[1] > max) {
      max = result[1];
      index = result[0];
    }
    else if (result[1] == max && result[0] < index)
      index = result[0];
  }
  writeln(index, " ", max);
}

Measured memory_bytes: 1072
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<double,double> P;
P po[55];
int N;

double dist(P x, P y)
{
	return sqrt((x.first - y.first)*(x.first - y.first) + (x.second - y.second) * (x.second - y.second));
}

bool check(double R, P c)
{
	rep(i,N)
	{
		if (dist(c,po[i]) >= R+1e-8)
		{
			return false;
		}
	}
	return true;
}

bool f(double R)
{
	rep(i,N-1)
	{
		for (int j = i+1; j < N; ++j)
		{
			if (dist(po[i],po[j]) <= 2*R)
			{
				//po[i]とpo[j]を中心とする半径mの円の交点を求める
				double h = sqrt(R*R - (dist(po[i],po[j])/2 * dist(po[i],po[j])/2));
				P M = P((po[i].first+po[j].first)/2,(po[i].second+po[j].second)/2);
				P vec = P(po[j].second-po[i].second,po[i].first-po[j].first);
				P c = P(M.first + vec.first/dist(vec,P(0,0))*h, M.second + vec.second/dist(vec,P(0,0))*h);
				if (check(R,c)) return true;
				c = P(M.first - vec.first/dist(vec,P(0,0))*h, M.second - vec.second/dist(vec,P(0,0))*h);
				if (check(R,c)) return true;
				//cout << c.first << " " << c.second << endl;
				//cout << m << endl;
			}
		}
	}
	return false;
}



int main()
{
	cin >> N;
	rep(i,N)
	{
		double x,y;
		cin >> x >> y;
		po[i] = P(x,y);
	}

	double ans = 1e5;\
	double l = 0, r = 1e4*2;
	rep(k,50)
	{
		//半径を決める
		double m = (l+r) / 2;
		if (f(m))
		{
			r = m;
		}
		else
		{
			l = m;
		}
	}
	cout << setprecision(10) << l << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long

#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second


using namespace __gnu_pbds;
using namespace std;
const int mod=1e9+7;
 // const int mod=998244353;
 // const int mod=1e9+9;
const int INF=4e18+10;
// const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i;


typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

template<typename T1,typename T2>
void set_min(T1& a, T2 b)
{
    a=min(a, (T1)b);
}


int multiply(int a, int b, int in_mod){return (a*b)%in_mod;}
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);

        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}

void solve()
{
    int a, b;
    int v, w;
    cin>>a>>v>>b>>w;
    int t;
    cin>>t;

    if(a<b)
    {
        if(a+t*v>=b+t*w)
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }
    else
    {

        if(a-t*v<=b-t*w)
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    
    }

}

signed main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen("INPUT.txt", "r", stdin);
        freopen("OUTPUT.txt", "w", stdout);
    }
#endif
    auto clk = clock();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------

    int t = 1;
    // cin>>t;
    for (int test = 1; test <= t; test++)
    {
        // cout<<"Case #"<<test<<": ";
        // cout<<endl;
        solve();
        // cout<<endl;
    }

    // -------------------------------------Code ends here------------------------------------------------------------------

    clk = clock() - clk;
    // cerr << fixed << setprecision(6) << "Time: " << ((long double)clk) / CLOCKS_PER_SEC << "\n";
    return 0;
}


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

int main()
{ 
  int n; cin >> n;
  vector<int> ns;
  for (int i = 0; i < n; i++) {
    int k; cin >> k;
    ns.push_back(k);
  }
  sort(ns.begin(), ns.end());

  int q; cin >> q;
  int ans = 0;
  while (q--) {
    int k; cin >> k;
    int lb = 0, rb = n;
    while (lb+1 != rb) {
      int m = lb + (rb-lb)/2;
      if (k < ns[m])
        rb = m;
      else
        lb = m;
    }
    if (k == ns[lb])
      ans++;
  }
  cout << ans << endl;
  return EXIT_SUCCESS;
}



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

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 305
#define MOD 1000
#define oo 1000000000000000007LL
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, m, a[maxN], b[maxN], cost[maxN][maxN], dp[maxN][maxN];
char s[maxN][maxN];

int main () {
    scanf("%d%d", &n, &m);
    fto(i, 0, n-1) scanf("%s", s[i]);

    int ans = 0;
    fto(j, 0, m-2) {
        fto(i, 1, n) {
            a[i] = s[i-1][j];
            b[i] = s[i-1][j+1];
        }
        fto(i, 1, n) {
            fto(j, 1, n) {
                cost[i][j] = cost[i-1][j-1]+(a[i] == b[j]);
            }
        }
        fto(i, 1, n) {
            fto(j, 1, n) {
                dp[i][j] = min(dp[i-1][j], dp[i][j-1])+cost[i][j];
            }
        }
        ans += dp[n][n];
    }

    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
			int X = sc.nextInt();
		sc.close();


		int a = 0;
		int count = 1;
		while(true){
			if(a < X){
				a = a+count;
				count++;
			}
			else{
				break;
			}
		}

		System.out.println(count-1);
	}
}


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

int main(){
    int N;
    cin >> N;
    int ans=0;
    int i;

    for(i=1; i<7; i++){
        if(pow(2,i)<=N) ans++;
    }

    cout << pow(2,ans) <<  endl;

    return 0;
}

Measured memory_bytes: 4072
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int a[3][3];
  cin >> a[0][0] >> a[0][1] >> a[0][2];
  cin >> a[1][0] >> a[1][1] >> a[1][2];
  cin >> a[2][0] >> a[2][1] >> a[2][2];
  int n, b;
  cin >> n;
  rep(i,n)
  {
    cin >> b;
    rep(j,3)
      rep(k,3)
        if (a[j][k] == b)
          a[j][k] = 0;
  }
  rep(j,3)
    if ((a[j][0] == 0 && a[j][1] == 0 && a[j][2] == 0)
        || (a[0][j] == 0 && a[1][j] == 0 && a[2][j] == 0)) {
      cout << "Yes";
      return 0;
    }
  if ((a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)
      || (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0)) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

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

	vi a(n);
	rep(i, 0, n) cin >> a[i];

	sort(all(a));

	int ans = 1;
	if(n%2){
		if(a[0] != 0) ans = 0;
		else{
			int t = 2;
			for(int i = 1; i < n; i+=2){
				(ans *= 2) %= mod;
				if(a[i] != a[i+1] or a[i] != t){
					ans = 0;	
				}
				t += 2;
			}
		}
	}else{
		int t = 1;
		for(int i = 0; i < n; i+=2){
			(ans *= 2) %= mod;
			if(a[i] != a[i+1] or a[i] != t){
				ans = 0;
			}
			t += 2;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var xs = new int[n];
        for (int i = 0; i < xs.Length; i++)
        {
            xs[i] = int.Parse(Console.ReadLine());
        }
        var winner = xs.Any(x => x % 2 == 1) ? "first" : "second";
        Console.WriteLine(winner);
    }
}

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

int x[50][50], cx, cy, cz, sum, sum2, chain, h, w, gx, gy, pass, line; char a; string S, T; bool y;

void WHILE();
void PASS();
void ugoku(char W);
void IF();
bool hantei();

void ugoku(char W) {
	if (W == '^') {
		if (cz == 0 && x[cy - 1][cx] == 0) { cy--; }
		if (cz == 1 && x[cy][cx + 1] == 0) { cx++; }
		if (cz == 2 && x[cy + 1][cx] == 0) { cy++; }
		if (cz == 3 && x[cy][cx - 1] == 0) { cx--; }
		sum++;
	}
	if (W == 'v') {
		if (cz == 2 && x[cy - 1][cx] == 0) { cy--; }
		if (cz == 3 && x[cy][cx + 1] == 0) { cx++; }
		if (cz == 0 && x[cy + 1][cx] == 0) { cy++; }
		if (cz == 1 && x[cy][cx - 1] == 0) { cx--; }
		sum++;
	}
	if (W == '>') {
		cz += 1; cz %= 4; sum++;
	}
	if (W == '<') {
		cz += 3; cz %= 4; sum++;
	}
	if (W == '[') {
		IF();
	}
	if (W == '}') {
		PASS();
	}
	if (W == '{') {
		WHILE();
	}
}

void IF() {
	T = ""; chain = 0;
	for (int i = line + 1; i < line + 3; i++) { T += S[i]; }
	y = hantei();
	if(y==false){
		for (int i = line; i < S.size(); i++) {
			if (S[i] == '[') { chain++; }
			if (S[i] == ']') { chain--; }
			if (chain == 0) { line = i; break; }
		}
	}
}

void WHILE () {
	T = ""; chain = 0;
	for (int i = line + 1; i < line + 3; i++) { T += S[i]; }
	y = hantei();
	if (y == false) {
		for (int i = line; i < S.size(); i++) {
			if (S[i] == '{') { chain++; }
			if (S[i] == '}') { chain--; }
			if (chain == 0) { line = i; break; }
		}
	}
}

void PASS() {
	chain = 0;
	for (int i = line; i >= 0; i--) {
		if (S[i] == '}') { chain++; }
		if (S[i] == '{') { chain--; }
		if (chain == 0) { pass = i; break; }
	}
	line = pass - 1;
}

bool hantei() {
	if (T[0] == 'N' && cz == 0) { return true; }
	if (T[0] == 'E' && cz == 1) { return true; }
	if (T[0] == 'S' && cz == 2) { return true; }
	if (T[0] == 'W' && cz == 3) { return true; }
	if (T[0] == 'C') {
		if (cz == 0 && x[cy - 1][cx] == 1) { return true; }
		if (cz == 1 && x[cy][cx + 1] == 1) { return true; }
		if (cz == 2 && x[cy + 1][cx] == 1) { return true; }
		if (cz == 3 && x[cy][cx - 1] == 1) { return true; }
	}
	if (T[0] == 'T') { return true; }
	if (T[0] == '~') {
		if (T[1] == 'N' && cz != 0) { return true; }
		if (T[1] == 'E' && cz != 1) { return true; }
		if (T[1] == 'S' && cz != 2) { return true; }
		if (T[1] == 'W' && cz != 3) { return true; }
		if (T[1] == 'C') {
			if (cz == 0 && x[cy - 1][cx] != 1) { return true; }
			if (cz == 1 && x[cy][cx + 1] != 1) { return true; }
			if (cz == 2 && x[cy + 1][cx] != 1) { return true; }
			if (cz == 3 && x[cy][cx - 1] != 1) { return true; }
		}
	}
	return false;
}

int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a;
			if (a == '#') { x[i][j] = 1; }
			if (a == 'g') { gx = j; gy = i; }
			if (a == 's') { cx = j; cy = i; }
		}
	}
	cin >> S;
	line = 0;
	while (line < S.size()) {
		ugoku(S[line]);
		line++;
		if (cx == gx && cy == gy) { goto F; }
		sum2++;
		if (sum2 > 20000000) { sum = -1; break; }
	}
	sum = -1;
F:;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;using int32=int_fast32_t;using uint32=uint_fast32_t;using int64=int_fast64_t;using uint64=uint_fast64_t;using pi=pair<int32,int32>;using pll=pair<int64,int64>;using vi=vector<int32>;using vvi=vector<vector<int32>>;using vll=vector<int64>;using ll=int64;using ull=uint64;
#define all(x) x.begin(),x.end()
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int N=read(), Q=read();
    int S[N];
    char c,b=getchar();
    S[0] = 0;
    for(int i=1;i<N;i++){
        S[i] = S[i-1];
        c=getchar();
        if(b == 'A' && c == 'C')S[i]++;
        b = c;
    }
    int l,r;
    while(Q--) {
        l=read();r=read();
        printf("%d\n",S[r-1]-S[l-1]);
    }
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 1280
N = int(input())
UVW = [list(map(int, input().split(" "))) for _ in range(N-1)]

d = dict()
for u, v, w in UVW:
    if u-1 not in d:
        d[u-1] = []
    if v-1 not in d:
        d[v-1] = []
    d[u-1] += [(v-1, w)]
    d[v-1] += [(u-1, w)]

visited = [False]*(N)
visited[0] = True
l = [0]*N
q = [0]
while q:
    # print(q, l, visited)
    len_q = len(q)
    for u in q[:]:
        for v, w in d[u]:
            if visited[v] == True:
                continue
            visited[v] = True
            if w%2 == 0:
                l[v] = l[u]
            else:
                l[v] = (l[u]+1)%2
            q.append(v)
    q = q[len_q:]
            # print(q)
    # print(q)

for m in l:
    print(m)

Measured memory_bytes: 67920
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  string s;
  cin>>s;
  int m=0;
  for(int i=1;i<s.size();i++){
      if(s.at(i-1)==s.at(i)){
          m++;
          if (m==2) {cout<<"Yes"<<endl;return 0;}
      }
      else m=0;
  } 
   cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys
x=(input())
ls = [101,102,103,104,105]
if int(x) < 100:
    print(0)
else:
    t = int(x[:-2])
    x = int(x)
    c = 0
    while True:
        if x <= 100:
            break
        x -=105
        c += 1

    if x+105 in ls:
        print(1)
    elif c == t:
        print(0)
    else:
        print(1)



Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	t := iScan()
	a := iScan()
	h := iSScan(n)
	ans := -1
	p := mod
	for i := 0; i < n; i++ {
		x := abs(a*1000 - (t*1000 - h[i]*6))
		if x < p {
			ans = i + 1
			p = x
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1784
#include <iostream>
using namespace std;
 
int main() { 
    int a, b;
    cin >> a >> b;
    if(a == 1) a = 14;
    if(b == 1) b = 14;
    if(a > b) {
        cout << "Alice" << '\n';
    } else if(a < b) {
        cout << "Bob" << '\n';
    } else {
        cout << "Draw" << '\n';
    }
}

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

#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define endl "\n"
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

int main()
{
    IOS;
    ll t,k,n,d,m,u,v;
    t=1;
    //cin >> t;
    while(t--)
    {
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        ll ans = b*d;
        ans = max(ans,b*c);
        ans = max(ans,a*c);
        ans = max(ans,a*d);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3644
/*
AtCoder Library Practice Contest - C - Floor Sum
https://atcoder.jp/contests/practice2/tasks/practice2_c
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)

long long floor_sum(long long n, long long m, long long a, long long b) {
    long long ans = 0;
    if (a >= m) {
        ans += (n - 1) * n * (a / m) / 2;
        a %= m;
    }
    if (b >= m) {
        ans += n * (b / m);
        b %= m;
    }

    long long y_max = (a * n + b) / m, x_max = (y_max * m - b);
    if (y_max == 0) return ans;
    ans += (n - (x_max + a - 1) / a) * y_max;
    ans += floor_sum(y_max, a, m, (a - x_max % a) % a);
    return ans;
}

void solve() {
	ll n, m, a, b;
	cin >> n >> m >> a >> b;
	OUT(floor_sum(n,m,a,b));
}

int main()
{
    FAST_INP;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r", stdin);
    // freopen("output.txt","w", stdout);
    // #endif

    int tc; cin >> tc;
    TC(tc) solve();

    return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>

int main(void){
  int n,i,j,a[32],b,ohajiki;

  while(scanf("%d",&n),n){
      ohajiki=32;

      for(i=0;i<n;i++){
	scanf("%d",&a[i]);
      }
      i=0;
      j=0;
      while(ohajiki>1){
	  if(i%2==0){
	      b=(ohajiki-1)%5;
	      printf("%d\n",ohajiki-b);
	      ohajiki=ohajiki-b;
	    }
	  else{
	      printf("%d\n",ohajiki-a[j]);
	      ohajiki=ohajiki-a[j];
	      j++;
	    }
	  if(j==n)j=0;
	  i++;
	}
      printf("0\n");
    }
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

long int M = 1e+9+7;

vi c(12);
vvi a(12,vi(12));
int n,m,x;

int solve(int hon, int money,vi mana){
    bool flag=true;
    //cout << hon;
    rep(i,m){
        if(mana[i] < x) flag=false;
        //cout << " " << mana[i];
    }
    //cout << endl;
    if(flag) return money;
    if(hon==n) return 100000000;
    vi mana2 = mana;
    vi mana3 = mana;
    rep(i,m){
        mana3[i]+=a[hon][i];
    }
    return min(solve(hon+1,money,mana2),solve(hon+1,money+c[hon],mana3));

}

int main(void){
    cin >> n >> m >> x;
    rep(i,n){
        cin >> c[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    vi mana(m);
    int ans = solve(0,0,mana);
    if(ans == 100000000) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

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

int main()
{
    long long int t,ans=0,i,j,k;
    cin>>t;
    for(i=1; i<=t; i++)
    {
        for(j=1; j<=t; j++)
        {
            for(k=1; k<=t; k++)
            {
                ans+=__gcd(__gcd(i,j),k);

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


Measured memory_bytes: 3544
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define eps 1e-9
#define mp make_pair

int n,tmp,tmp2,tmp3,q,k;
LL dist[100005];
vector<int> v[100005],w[100005];

void bfs(int s) {
	queue<int> Q;
	SET(dist,-1);
	dist[s]=0;
	Q.push(s);
	while (!Q.empty()) {
		tmp=Q.front();
		Q.pop();
		FOR(i,0,v[tmp].size()) {
			if (dist[v[tmp][i]]==-1) {
				dist[v[tmp][i]]=(LL)dist[tmp]+w[tmp][i];
				Q.push(v[tmp][i]);	
			}
		}
	}
}

int main () {
	scanf("%d",&n);
	FOE(i,1,n-1) {
		scanf("%d%d%d",&tmp,&tmp2,&tmp3);
		v[tmp].pb(tmp2);
		w[tmp].pb(tmp3);
		v[tmp2].pb(tmp);
		w[tmp2].pb(tmp3);
	}
	scanf("%d%d",&q,&k);
	//printf("%d\n",q);
	bfs(k);
	FOE(i,1,q) {
		scanf("%d%d",&tmp,&tmp2);
		//printf("!%d\n",i);
		printf("%lld\n",(LL)dist[tmp]+dist[tmp2]);
	}
}

Measured memory_bytes: 13908
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
 
int search(int A[], int n, int key) {
    int i = 0;
    A[n] = key;
    while (A[i] != key)i++;
    return i!=n;
}
 
int main() {
    int i, n, A[10000 + 1], q, key, sum = 0;
 
    scanf("%d", &n);
    for (i = 0; i < n; i++)scanf("%d", &A[i]);
 
    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &key);
        if (search(A, n, key))sum++;
    }
    printf("%d\n", sum);
 
    return 0;
}

Measured memory_bytes: 1768
import sys
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
import itertools

input = sys.stdin.readline


def main():
    N, M, R = [int(x) for x in input().split()]
    r = [int(x) - 1 for x in input().split()]
    ABC = [[int(x) for x in input().split()] for _ in range(M)]

    EDGE = [[10 ** 9] * N for j in range(N)]

    for a, b, c in ABC:
        EDGE[a - 1][b - 1] = c
        EDGE[b - 1][a - 1] = c

    G = csgraph_from_dense(EDGE, null_value=10 ** 9)

    d = floyd_warshall(G)

    ans = float("inf")
    for a in itertools.permutations(r):
        tmp = 0
        c = a[0]
        for n in a:
            tmp += int(d[c][n])
            c = n
        ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18168
import sys
n, m = map(int, input().split())

sc = [list(map(int, input().split())) for _ in range(m)]

result = [-1 for _ in range(n)]

for i in range(m):
    if result[sc[i][0]-1] < 0 or result[sc[i][0]-1]==sc[i][1]:
        result[sc[i][0]-1] = sc[i][1]
    else:
        print(-1)
        sys.exit()
if n != 1:
    if result[0]==0:
        print(-1)
        sys.exit()
    result = [max(0,result[i]) for i in range(n)]
    if result[0]==0:
        result[0]=1
else:
    if result[0] < 0:
        result[0] = 0
print("".join(map(str, result)))

Measured memory_bytes: 3064