akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
min_total = 10**9

x = []
for i in range(N):
    x.append(A[i] - (i + 1))
x.sort()
b = x[N // 2]
total = 0
for i in range(N):
    total += abs(A[i] - (b + i + 1))
print(total)

Measured memory_bytes: 25196
#include <iostream>

using namespace std;

int main()
{
    int k,b;
    cin>> k>>b;
    int a = k + b;
    int ss = k - b;
    int sss = k * b;
    if(a >= ss && a >= sss)
    {
        cout<<a<<endl;
    }
    else if ( ss >= a && ss >= sss)
    {
        cout<<ss<<endl;
    }
    else
    {
        cout <<sss<<endl;
    }

    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


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

char a,b;

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

	cin>>a>>b;
	if(a=='H') {
		if(b=='H') cout<<"H";
		else cout<<"D";
	}
	else {
		if(b=='H') cout<<"D";
		else cout<<"H";
	}
	cout<<endl;

	return 0;
}


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

int main()
{
  int n , k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  int sum = 0;
  for(int i=0;i<k;i++)
  {
    sum+=a[i];
  }
  cout<<sum<<endl;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  for(int i=0; i < s.size(); i++) {
    if((i+1)%2 == 1){
    if(!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
      cout << "No" << endl;
      return 0;
    }
    }
    if((i+1)%2 == 0){
    if(!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) {
      cout << "No" << endl;
      return 0;
    }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cassert>
#define llong long long
using namespace std;

const int N = 1e5;
int permu[N+3];
int tmp[N+3];
int aux[N+3];
llong a[N+3],d[N+3];
int n,m; llong p;

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%lld",&a[i]),d[i-1] = a[i]-a[i-1];
	for(int i=1; i<n; i++) permu[i] = i;
	scanf("%d%lld",&m,&p);
	for(int i=1; i<=m; i++)
	{
		int x; scanf("%d",&x);
		swap(permu[x-1],permu[x]);
	}
	for(int i=1; i<n; i++) tmp[i] = permu[i],permu[i] = i;
	for(int i=0; p; i++)
	{
		if(p&(1ll<<i))
		{
			for(int j=1; j<n; j++) aux[j] = permu[tmp[j]];
			for(int j=1; j<n; j++) permu[j] = aux[j];
			p-=(1ll<<i);
		}
		for(int j=1; j<n; j++) aux[j] = tmp[tmp[j]];
		for(int j=1; j<n; j++) tmp[j] = aux[j];
	}
	for(int i=1; i<n; i++) a[i+1] = a[i]+d[permu[i]];
	for(int i=1; i<=n; i++) printf("%lld.0\n",a[i]);
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N, M;
	cin >> N >> M;
	string S;
	cin >> S;

	vector<int> next(N+1);
	for(int i=0; i<N+1; i++) next[i] = i;
	int last = N;
	for(int i=N-1; i>=0; i--){
		if(S[i]=='0'){
			last = i;
		} else {
			next[i] = last;
		}
	}

	vector<int> v(N+1);
	for(int i=1; i<=min(N, M); i++){
		if(S[i]=='0') v[i] = i;
	}
	for(int i=M+1; i<=N; i++){
		int n = next[i-M];
		v[i] = i-n;
	}

	vector<int> ans;
	int k = N;
	while(k>0){
		if(v[k]==0){
			cout << -1 << endl;
			return 0;
		}
		ans.push_back(v[k]);
		k -= v[k];
	}
	reverse(ans.begin(), ans.end());

	for(int i=0; i<ans.size(); i++){
		cout << ans[i] << (i==ans.size()-1?'\n':' ');
	}

	return 0;
}


Measured memory_bytes: 1912
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#define F first
#define S second
using namespace std;

struct edge{
  int t,c;
  edge(){}
  edge(int t,int c):t(t),c(c){}
};

typedef pair<int,int> P;

int n,m;
vector<edge> g[22];
int d[22];

void djk(int s){

  fill(d,d+n+1,1<<20);
  priority_queue<P, vector<P>, greater<P> > que;
  que.push(P(0,s));
  d[s] = 0;
  while(!que.empty()){
    P p = que.top();que.pop();
    if(d[p.S] < p.F) continue;
    for(int i = 0; i < (int)g[p.S].size(); i++){
      if(d[g[p.S][i].t] > d[p.S] + g[p.S][i].c){
	d[g[p.S][i].t] = d[p.S] + g[p.S][i].c;
	que.push(P(d[p.S] + g[p.S][i].c,g[p.S][i].t));
      }
    }
  }
}

int main(void)
{
  scanf("%d %d",&n,&m);
  for(int i = 0; i < m; i++){
    int a,b,c,d;
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    g[a].push_back(edge(b,c));
    g[b].push_back(edge(a,d));
  }

  int s,g,y,b;
  scanf("%d,%d,%d,%d",&s,&g,&y,&b);
  int k = 0;
  djk(s);
  k += d[g];
  djk(g);
  k += d[s];
  printf("%d\n",y - b - k);
}

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

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

typedef long long ll;

const int INF = 1e8;

int main() {
    int A, B; cin >> A >> B;
    cout << (A-1)*(B-1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
    cin>>a>>b>>c;
    if(a == 5 && b == 5 && c == 7)
        cout<<"YES"<<endl;
    else if (a == 5 && b == 7 && c == 5)
        cout<<"YES"<<endl;
    else if(a == 7 && b == 5 && c == 5)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 3556
def readInt():
    return list(map(int, input().split()))
    
t_h,t_a,a_h,a_a = readInt()

while t_h>0 and a_h>0:
    a_h -= t_a
    t_h -= a_a
    # print(a_h, t_h)
    
if t_h <= 0 and a_h >0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 61644
#include <bits/stdc++.h>
#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 all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
const long long mod=1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    cin >> N;
    cout << N * N * N << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
 
int main(){
  int a,b;
  cin >> a >> b;
 
  int c;
  c = 6-a-b;
 
  cout << c << endl;
}

Measured memory_bytes: 256
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	char we[10];
	scanf("%s",we);

	if(strcmp(we, "Sunny") == 0){
		puts("Cloudy");
	}
	else if(strcmp(we, "Cloudy") == 0){
		puts("Rainy");
	}
	else puts("Sunny");
	return 0;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

int pena[100100];
bool solved[100100];

signed main() {
    int N, M;
    cin >> N >> M;
    int sol = 0;
    int pen = 0;
    rep(i, M) {
        int p;
        string s;
        cin >> p >> s;
        if (s == "AC") {
            if (solved[p])continue;
            solved[p] = true;
            sol++;
            pen += pena[p];
        } else {
            if (solved[p])continue;
            pena[p]++;
        }
    }
    cout << sol << " " << pen << endl;
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long int
#define rep(i, a, b) for (int i = a; i < b; i++)
#define revrep(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define pii pair<int, int>

int INF = 1e14;
signed main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        n--;
        string ans;
        while (n >= 0)
        {
            int mod = n % 26;
            ans.pb((char)('a' + mod));
            n -= mod;
            n /= 26;
            n--;
        }
        reverse(ans.begin(), ans.end());
        cout << ans << endl;
    }

    return 0;
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n - 1)
    {
        int temp;
        cin >> temp;
        mp[temp]++;
    }
    REP(i, 1, n+1)
    {
        cout << mp[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 12976
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

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

    long long sqrtNp1 = 1 + (long long)sqrt(N);
    long long ans = 10;
    for (long long i = 1; i < sqrtNp1; ++i) {
        if (N % i == 0) {
            long long A = i;
            long long B = N / i;
            long long ndigitA = 1 + (long long)log10l(A);
            long long ndigitB = 1 + (long long)log10l(B);
            long long F = max(ndigitA, ndigitB);
            if (F < ans) {
                ans = F;
            }
        }
    }

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


Measured memory_bytes: 512
n = int(input())
ary = list(map(int,input().split()))
a = []
ans = 0
for i in range(n):
    a += [ary[i] - (i+1)]
a.sort()
if n % 2 == 1:
    b = a[-(-n // 2)-1]
    for i in range(n):
        ans += abs(a[i] - b)
else:
    b = (a[n//2-1]+a[n//2])//2
    for i in range(n):
        ans += abs(a[i] - b)
print(ans)

Measured memory_bytes: 98516
fun main(args: Array<String>) = abc161d()

fun abc161d() {
    val k = readLine()!!.toInt()

    val list = mutableListOf<Long>()

    fun dfs(curr: Long) {
        if (curr.toString().length == 12) return
        list.add(curr)
        val max = Math.min(curr % 10 + 1, 9)
        val min = Math.max(curr % 10 - 1, 0)
        (min..max).map { dfs(curr * 10 + it) }
    }

    (1..9L).forEach { dfs(it) }

    val answer = list.sorted()[k - 1]

    println(answer)
}


Measured memory_bytes: 108908
#include "bits/stdc++.h"

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

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll gcd(ll a, ll b) {//最大公約数
	if (a < b)swap(a, b);
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	if (a < b)swap(a, b);
	return (a / gcd(a, b))*b;
}

int main() {

	int n;
	cin >> n;

	int F[110][20] = { 0 };
	int p[110][20] = { 0 };

	rep(i, n)rep(j, 10)cin >> F[i][j];
	rep(i, n)rep(j, 11)cin >> p[i][j];

	ll ans;
	ll trueans = -linf;


	for (int bit = 1; bit < (1 << 10); bit++) {
		ans= 0;
		bool flag = false;
		rep(i, n) {
			int cnt = 0;

			rep(j, 10) {
				if (F[i][j] & bit >> j & 1) {
					cnt++;
				}
			}
			ans += p[i][cnt];
		}
		
		chmax(trueans, ans);

	}

	pr(trueans);

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    cin>>N;
    cout<<(N + 1) / 2<<endl;
}

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

int main() {
  long long X;
  cin >> X;
  
  long long base = 100;
  int i = 1;
  while(true){
    base = base * 1.01;
    if(base >= X){
      cout << i << endl;
      break;
    }else{
      i++;
    }
  }  
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(int a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

ll INF = 10000000;
ll mod = 1000000007;//10^9+7


void change(char &i) {
    if (i == 'A') { i = 'a'; }
    if (i == 'B') { i = 'b'; }
    if (i == 'C') { i = 'c'; }
}

//番号ズレ注意！！
int main() {
    int N, K;
    string S;
    cin >> N >> K >> S;
    change(S[K - 1]);
    cout << S << endl;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	string S;
	bool flag = true;
	cin >> S;

	rep(i, S.size())
	{
		if ((i+1) % 2 == 1 && (S[i] == 'R' || S[i] == 'U' || S[i] == 'D'))
			continue;
		else if ((i + 1) % 2 == 0 && (S[i] == 'L' || S[i] == 'U' || S[i] == 'D'))
			continue;
		else
		{
			flag = false;
			break;
		}
	}

	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

long modpow(long a, long n, long mod){
	if (n == 0) {
		return 1;
	}
	long answer;
	if (n%2 == 0) {
		answer = modpow(a, n/2, mod);
		answer *= answer;
	} else {
		answer = modpow(a, n-1, mod);
		answer *= a;
	}
	answer %= mod;
	return answer;
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long mod = 1000000007;
  long all = modpow(10,n,mod);
  long wo0 = modpow(9,n,mod);
  long wo09 = modpow(8,n,mod);
  long ans = (wo0*2)%mod;
  ans = (ans+mod-wo09)%mod;
  ans = (all+mod-ans)%mod;
  printf("%ld\n", ans);

  return 0;
}

Measured memory_bytes: 1708
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

ans=[]
tmp=0
count=0
for el in a:
    if len(ans)==2: break
    if el != tmp: tmp=el; count=0
    else:
        if count%2==0: ans.append(el); tmp=el;
        count+=1

try: ans=ans[0]*ans[1]
except: ans=0
print(ans)


Measured memory_bytes: 14244
import math

k = int(input())
ans = 0
lst = []
for a in range(2, k+1):
    for b in range(2, k+1):
      lst.append(math.gcd(a, b))
for d in lst:
  for c in range(2, k+1):
    ans += math.gcd(c, d)
appe = k**3 - (k-1)**3
ans += appe
print(ans)

Measured memory_bytes: 9372
#include <bits/stdc++.h>
#define inf 100000000007
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int a,b;
long long now,t,ans=inf;
pair<long long ,long long> r;
pair<long long ,long long> calc(int a,int b)
{
	if (a>b) swap(a,b);
	if (a%2==0||b%2==0) return make_pair((1LL*a*b)/2,(1LL*a*b)/2);
	return make_pair(1LL*a*(b/2),1LL*a*(b-b/2));
}
int main()
{
	a=read(),b=read();
	for (int i=0;i<=a;i++)
	{
		now=1LL*b*i;
		r=calc(a-i,b);
		t=max(abs(now-r.first),abs(now-r.second));
		t=max(t,abs(r.first-r.second));
		ans=min(ans,t);
	}
	for (int i=0;i<=b;i++)
	{
		now=1LL*a*i;
		r=calc(b-i,a);
		t=max(abs(now-r.first),abs(now-r.second));
		t=max(t,abs(r.first-r.second));
		ans=min(ans,t);
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main(){
  string s;
  cin >> s;
  int count = 0;
  for(int i = 0; i < 3; i++){
    if(s.at(i) == 'o'){
      count++;
    }
  }
  cout << 700 + count*100 << endl;
}

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

int main() {
	int a, b; cin >> a >> b;
	if(a<=0 && 0<=b) cout << "Zero" << endl;
	else if(b<0 && (b-a)%2==0) cout << "Negative" << endl;
	else cout << "Positive" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] p=new int[n];
		for(int i=0;i<n;i++){
			p[i]=sc.nextInt();
		}
		int count=0;
		for(int i=1;i<n-1;i++){
			if((p[i]>p[i-1]&&p[i]<p[i+1])||(p[i]<p[i-1]&&p[i]>p[i+1]))
				count++;
		}
		System.out.println(count);
		
	
	}
}

Measured memory_bytes: 23764
from itertools import permutations
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
tem1 = 0
tem2 = 0
for i, v in enumerate(permutations(range(1,N+1))):
  if list(v) == P: tem1 = i
  if list(v) == Q: tem2 = i
print(abs(tem1-tem2))
    

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include <cstdio>
#include<vector>
#include<map>
#include<utility>
#include<list>
#include<algorithm>
#include <ctype.h>
#include<deque>
using namespace std;
using ll = long long int;

int x, y, z, k;
vector<ll> a, b, c;
vector<ll> input(int n) {
	vector<ll> ret;
	for (int i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		ret.push_back(tmp);
	}
	return ret;
}

int main(void) {
	cin >> x >> y >> z >> k;
	a = input(x);
	b = input(y);
	c = input(z);

	sort(a.begin(), a.end(), greater<ll>());
	sort(b.begin(), b.end(), greater<ll>());
	sort(c.begin(), c.end(), greater<ll>());
	int n = min(x, k);
	int m = min(y, k);
	int l = min(z, k);
	vector<ll> abc;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			for (int kk = 1; kk <= l; kk++) {
				if (i * j * kk <= k) {
					abc.push_back(a[i-1] + b[j-1] + c[kk-1]);
				}
			}
		}
	}
	sort(abc.begin(), abc.end(), greater<ll>());
	for (int i = 0; i < k; i++) {
		cout << abc[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  int n,k;
  cin>>n>>k;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  sort(all(v));

  int ans = v.back() - v[0];
  rep(i,n-k+1){
    ans = min(ans, v[i+k-1] - v[i]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
import java.io.*;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
        double r = 0;
        double dEnsyuritu = Math.PI;
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
         
        r = Double.parseDouble(str);
         
        double dMenseki = r * r * dEnsyuritu; 
        double dMawari = r * 2 * dEnsyuritu;
         
        String Answer1 = String.format("%.6f", dMenseki);
        String Answer2 = String.format("%.6f", dMawari);
         
        System.out.println(Answer1 + " " + Answer2);
    }
}

Measured memory_bytes: 24788
<?php
fscanf(STDIN, "%d %d", $N, $M);
$array = [];
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d", $A, $B);
    $array[] = array('A' => $A, 'B' => $B);
}

usort($array, function ($a, $b) {return $a["A"] > $b["A"]; });

$ans = 0;

foreach ($array as $v) {
    if ($M > 0) {
        $buy = min($M, $v['B']);
        $ans += $buy * $v['A'];
        $M -= $buy;
    }
}

echo $ans;


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

int main(void){
    long long N;
    long long K;
    std::cin >> N >> K;
    vector<long long> A(N,0);
    vector<long long> flags(N, 0);
    vector<long long> place(N, 0);
    for(long long i=0;i<N;i++){
        std::cin >> A.at(i);
    }
    long long j = 0;
    flags[0] = 1;
    place[0] = 1;
    for(long long i=1;i<=K;i++){
        long long s = A[j];
        if(flags[s-1] == 0){
            flags[s-1] = i+1;
            j = s-1;
            place[i] = s;
            if(i == K){
                cout << s << endl;
                break;
            }
        }
        else{
            place[i] = s;
            long long start = flags[s-1]-1;            
            long long loop = i+1-flags[s-1];
            long long col = flags[s-1]+(K-start-1)%loop;
            cout << place[col] << endl;
            break;
        }

    }
    return 0;
}

Measured memory_bytes: 8016
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
using namespace std;


int main() {
	int H, W;

	cin >> H >> W;

	vector<string> S(H+1);
	vector < vector<int >> cost(H, vector<int>(W));

	for (int i = 0; i < H; i++) {
		cin >> S[i];
		S[i] +='#';
	}
	
	S[H] = "";
	for (int i = 0; i < W; i++) {
		S[H] += '#';
	}


	
	//横の数を求める
	for (int i = 0; i < H; i++) {

		int start=0;
		int end=0;
		bool startflag = false;
		int count = 0;

		for (int j = 0; j <= W; j++) {

			if (S[i][j] == '.') {
				if (startflag == false) {//ここが始点なら
					startflag = true;
					start = j;
				}

				count++;

			}
			else {//壁だったら

				if (startflag == true) {

					end = j;

					//コストの決定
					for (int k = start; k < end; k++)
						cost[i][k] = count;

					//初期化
					count = 0;
					startflag = false;

				}
			}
		}
	}


	for (int i = 0; i < W; i++) {

		int start = 0;
		int end = 0;
		bool startflag = false;
		int count = 0;

		for (int j = 0; j <= H; j++) {

			if (S[j][i] == '.') {
				if (startflag == false) {//ここが始点なら
					startflag = true;
					start = j;
				}

				count++;

			}
			else {//壁だったら

				if (startflag == true) {

					end = j;

					//コストの決定
					for (int k = start; k < end; k++)
						cost[k][i] += count -1;

					//初期化
					count = 0;
					startflag = false;

				}
			}
		}
	}

	int max = 0;
	for (int i = 0; i < H; i++) {

		for (int j = 0; j < W; j++) {
			//cout << cost[i][j];
			if (max < cost[i][j])
				max = cost[i][j];
		}
		//cout << endl;
	}
	cout << max << endl;

}




Measured memory_bytes: 20096
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  vector<int> bell(3); REP(i, 3) cin >> bell[i];
  sort(ALL(bell));
  cout << bell[0] + bell[1] << '\n';
  return 0;
}


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

int main(){
    int N,M;
    cin >> N >> M;
    vector<pair<int,int>> ab(M);
    
    for(int i=0;i<M;i++){
        cin >> ab.at(i).first >> ab.at(i).second;
        ab.at(i).first--;
        ab.at(i).second--;
    } 

    vector<int> ans(N);
    for(int i=0;i<N;i++){
        ans.at(i)=i;
    }
    int count = 0;
    do{
        for(int i=0;i<N-1;i++){
            bool flag = false;
            for(int j=0;j<M;j++){
                if((ans.at(i)==ab.at(j).first&&ans.at(i+1)==ab.at(j).second)||(ans.at(i+1)==ab.at(j).first&&ans.at(i)==ab.at(j).second)){
                    flag =true;
                    break;
                }
            }
            if(!flag) break;
            if(i==N-2) count++;
        }
    }while(next_permutation(ans.begin()+1,ans.end()));

    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <utility>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int H,W;cin >> H >> W;
    int grid[500][500];
    vector<tuple<int, int, int, int> > ans;

    REP(i,H) REP(j,W) cin >> grid[i][j];
    REP(i,H) {
        REP(j,W) {
            if(i==H-1 && j==W-1) break;
            else if(j==W-1){
                if(grid[i][j]%2) {
                    ++grid[i+1][j];
                    ans.emplace_back(i+1, j+1, i+2, j+1);
                }
            } else {
                if(grid[i][j]%2) {
                    ++grid[i][j+1];
                    ans.emplace_back(i+1, j+1, i+1, j+2);
                }
            }
        }
    }

    cout << ans.size() << '\n';
    REP(i,ans.size()){
        int a, b, c, d;
        tie(a, b, c, d) = ans[i];
        cout << a << ' ' << b << ' ' << c << ' ' << d << '\n';
    }
    return 0;
}

Measured memory_bytes: 5232
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

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

    int all = 0;
    rep(i, N) all = all ^ a[i];

    rep(i, N) {
        cout << (all ^ a[i]) << ' ';
    }
    cout << endl;

    return 0;
}


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

int kilo_temparature(int T, int height)
{
    return T * 1000 - height * 6;
}

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

    int mini_diff = int(1e9);
    int best = 1;
    for (int i = 0; i < n; ++i){
        int h;
        cin >> h;

        int diff = abs(kilo_temparature(t, h) - a * 1000);
        if (diff < mini_diff) {
            mini_diff = diff;
            best = i + 1;
        }
    }
    cout << best << endl;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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


void solve(ll b){
  int s = 0;
  int e = 0;
  for(ll n = 1; n*n < 2*b; n++){
    if( (2 * b  - n * (n-1)) % (2*n) == 0){
      s = (2 * b  - n * (n-1)) / (2*n);
      e = n;
    }
  }
  cout << s << " " << e << endl;
  return;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll b;
  while(true){
    cin >> b;
    if(b == 0) break;
    solve(b);
  }
  return 0;
}



Measured memory_bytes: 3176
#include<iostream>
#include<complex>
#include<cstdio>
#define EPS 1.0e-10
using namespace std;
typedef complex<double> P;
P a[4];
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
int is_intersected_ls(P a1, P a2, P b1, P b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
int main(){
	double x,y;
	char c;
	while(scanf("%lf,%lf",&x,&y)!=EOF){
		a[0]=P(x,y);
		for(int i=1;i<4;i++){
			scanf(",%lf,%lf",&x,&y);;
			a[i]=P(x,y);
		}
		if(is_intersected_ls(a[0],a[2],a[1],a[3]))
		cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_ints

count = 0

A.each do |a|
  loop do
    if a % 2 == 0
      a /= 2
      count += 1
    else
      break
    end
  end
end

puts count


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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using uint=unsigned int;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}

void No(){
	cout<<"No"<<endl;
	exit(0);
}

template<class T>
void chmax(T& a,T b){
	a=max(a,b);
}

template<class T>
void chmin(T& a,T b){
	a=min(a,b);
}

template<class T>
void ResetVector(vector<T>& v,int n,const T& t){
	v.clear();
	v.resize(n,t);
}

int dp[1001][128];

int main(){
	int t=read();
	REP(i,128)
		dp[1][i]=i;
	FOR(i,2,1001)
		REP(j,128)
			REP(k,128)
				chmax(dp[i][j],dp[i-1][k]+(j^k));
	REP(i,t){
		int n=read(),d=read();
		cout<<dp[n][d]<<endl;
	}
}


Measured memory_bytes: 768
import sys
input = sys.stdin.readline
N,K = map(int,input().split())
A = list(map(int,input().split()))
class BIT:
    def __init__(self,data,op,default):
        self.op = op
        self.default = default
        N = len(data)
        self.l = 2**((N-1).bit_length())
        self.data = [default]*(self.l+1)
        for i in range(1,N+1):
            v = data[i-1]
            while i <= self.l:
                self.data[i] = self.op(self.data[i], v)
                i += i & -i
    def add(self,i,v):
        i += 1
        while i <= self.l:
            self.data[i] = self.op(self.data[i], v)
            i += i & -i

    def get(self,i):
        if i == -1:
            return 0
        res = 0
        i += 1
        while i > 0:
            res = self.op(res, self.data[i])
            i -= i & -i
        return res

B = [a if a >= 0 else 0 for a in A]

bit = BIT(B, lambda x,y : x+y, 0)

cs = [0]
t = 0
for a in A:
    t += a
    cs.append(t)

ans = -10**15
for i in range(N-K+1):
    r = bit.get(N-1) - bit.get(K+i-1) + bit.get(i-1)
    b = cs[i+K] - cs[i]
    ans = max(ans,r,r+b)
print(ans)




Measured memory_bytes: 100180
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
#define SEG_LEN (1 << 20)
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,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; }
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// cout << a * modinv(b,INF) % INF << endl;
long long Modpow(long long n,long long m,long long mod){
  if(m == 0)return 1;
  if(m % 2)return (n * (Modpow(n,m - 1,mod) % mod)) % mod;
  long long tmp = Modpow(n,m / 2,mod);
  return tmp * tmp % mod;
}
ll Comb(ll a,ll b){
  ll ret = 1;
  REP(i,a - b + 1,a + 1){
    ret *= i;
    ret %= INF;
  }
  ll tmp = 1;
  REP(i,1,b + 1){
    tmp *= i;
    tmp %= INF;
  }
  return ret * modinv(tmp,INF) % INF;
}
int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans = Modpow(2,n,INF) - 1;
  ans -= Comb(n,a);
  if(ans < 0)ans += INF;
  ans -= Comb(n,b);
  if(ans < 0)ans += INF;
  cout << ans << endl;
  return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int s;
    cin >> s;
    if(s == 25){
        cout << "Christmas" << endl;
    }else if(s == 24){
        cout << "Christmas Eve" << endl;
    }else if(s == 23){
        cout << "Christmas Eve Eve" << endl;
    }else{
        cout << "Christmas Eve Eve Eve" << endl;
    }
}



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

int main(){
    int A, B, M, minn = 1000000, mina = 1000000, minb = 1000000;
    cin >> A >> B >> M;
    int a[100005], b[100005], c[1000000];
    int x[100005], y[100005];

    for(int i = 0; i < A; i++){ 
        cin >> a[i];
        mina = min(a[i], mina);
    }
    for(int i = 0; i < B; i++){
        cin >> b[i];
        minb = min(b[i], minb);
    }
    for(int i = 0; i < M; i++){
        cin >> x[i] >> y[i] >> c[i];
        minn = min(a[x[i]-1] + b[y[i]-1] - c[i],minn);
    }

    minn = min(minn,mina + minb);
    cout << minn << endl;
    return 0;
 }

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


i64 N;
string S, T;

int main() {
    cin >> N;
    cin >> S >> T;

    REP(i, N) {
        cout << S[i] << T[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int a,b;
    cin >> a >> b;
    if (a % 2 == 1 && b % 2 == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define endl '\n'
#define ll long long int
#define N 1000 + 5
using namespace std;

ll n, t[N], a[N];

int main(){
    IOS;
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> t[i] >> a[i];
    ll T = 1, A = 1;
    for(int i=0; i<n; i++){
        // percent
        ll p = max(T / t[i], A / a[i]);
        while(p * t[i] < T || p * a[i] < A)
            p++;
        T = p * t[i];
        A = p * a[i];
    }
    cout << (T + A) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

#define MAX 500
char brd[MAX][MAX];

int main(void)
{
	int n;
	while (cin >> n, n) {
		memset(brd, '.', sizeof(brd));

		int w, h;
		cin >> w >> h;
		rep(i, n) {
			int x, y;
			cin >> x >> y;
			brd[--y][--x] = '*';
		}

		int s, t;
		cin >> s >> t;

		int ans = 0;
		rep(i, w*h) {
			int x1, y1, x2, y2;
			x1 = i%w; y1 = i/w;
			x2 = x1 + s - 1; y2 = y1 + t - 1;
			if (x2 < w && y2 < h) {
				int cnt = 0;
				REPI(y, y1, y2)
					REPI(x, x1, x2)
						if (brd[y][x] == '*')
							cnt++;
				ans = max(ans, cnt);
			}
		}
		cout << ans << endl;

/*
		rep(j, h) {
			rep(i, w) {
				printf("%c ", brd[j][i]);
			}
			puts("");
		}
		dump2(s, t);
		puts("----");
*/
	}
	return 0;
}

Measured memory_bytes: 1412
import java.util.*;

public class Main{

    Main(){
        Scanner SC = new Scanner(System.in);

        int N = Integer.parseInt(SC.next());
        int X = Integer.parseInt(SC.next());
        int Y = Integer.parseInt(SC.next());

        int[] result = new int[N];
        Arrays.fill(result,0);

        for (int i = 1; i<N; i++) {
            for (int j=i+1;j<=N;j++){
                int k = Math.min(j-i,
                        Math.min(Math.abs(X-j) + Math.abs(Y-i) +1,
                                 Math.abs(X-i) + Math.abs(Y-j) +1));
                result[k]++;
            }
        }

        for (int i = 1; i < N; i++) {
            System.out.println(result[i]);
        }


    }

    public static void main(String[] args){
        new Main();
    }
}


Measured memory_bytes: 22356
#include <stdio.h>
#define N 100000
int partition(int *A,int p,int r){
    int x,i,j,t;
    x = A[r];
    i = p-1;
    for(j = p;j < r; j++){
        if(A[j] <= x){
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    t = A[i + 1];
    A[i + 1] = A[r];
    A[r] = t;
    return i + 1;
}

int main(){
    int i,q;
    int A[N],n;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    
    q = partition(A,0,n - 1);
    
    for(i=0;i<n;i++){
      if(i > 0) printf(" ");
      if(i == q) printf("[");
      printf("%d",A[i]);
      if(i == q) printf("]");
    }
    printf("\n");
  
  return 0;
}



Measured memory_bytes: 2188
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n, k; cin >> n >> k;

	long double ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i >= k) ans += 1;
		else ans += (1.0 / pow(2, ceil(log2((long double)k / i))));
	}
	cout << fixed << setprecision(15) ;
	cout << (1.0 / n)*ans;

	return 0;
}

Measured memory_bytes: 3248
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define Rep(i,v) rep(i,0,(int)v.size()-1)
#define mp make_pair
#define fir first
#define sec second
#define pb push_back
#define gc getchar()
#define lint long long
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
typedef pair<int,int> pii;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
#define N 100010
int a[N],cnt[2][N],c[2][2],d[2];
int main()
{
	int n=inn();
	for(int i=1;i<=n;i++) a[i]=inn();
	for(int i=1;i<=n;i++) cnt[i&1][a[i]]++;
	for(int i=1;i<=100000;i++)
		for(int j=0;j<=1;j++)
		{
			int x=cnt[j][i];
			if(x>c[j][0]) c[j][1]=c[j][0],d[j]=i,c[j][0]=x;
			else if(x>c[j][1]) c[j][1]=x;
		}
	if(d[0]!=d[1]) return !printf("%d\n",n-c[0][0]-c[1][0]);
	return !printf("%d\n",n-max(c[0][1]+c[1][0],c[0][0]+c[1][1]));
}

Measured memory_bytes: 1408
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readIntPair() -> (a: Int, b: Int) {
    let x = readInts()
    return (a: x[0], b: x[1])
}

func readStrings() -> [String] {
    return Array(readLine()!.split(separator: " ").map { String($0) })
}


struct Music {
    var title: String
    var time: Int
}

var list: [Music] = []
let n = readInt()
for _ in 0..<n {
    let tokens = readStrings()
    list.append(Music(title: tokens[0], time: Int(tokens[1])!))
}
let s = readLine()!

var sleeping: Bool = false
var spend: Int = 0
for m in list {
    if sleeping {
        spend += m.time
    } else {
        if s == m.title {
            sleeping = true
        }
    }
}
print(spend)



Measured memory_bytes: 13276
#ダイクストラ
import heapq
n,m,s,t = map(int,input().split())
UVAB = [list(map(int,input().split())) for _ in [0]*m]

Ea = [{} for _ in [0]*n]
Eb = [{} for _ in [0]*n]
for u,v,a,b in UVAB:
    Ea[u-1][v-1] = a
    Ea[v-1][u-1] = a
    Eb[u-1][v-1] = b
    Eb[v-1][u-1] = b

#import heapq
def Dijkstra(N,E,start):
    """
    N: ノード数
    E: 辺(dictのlist)
    start:開始ノード番号(0-indexed)
    """
    d = [-1]*N
    q = [(0,start-1)]
    while q:
        ci,i = heapq.heappop(q)
        if d[i]!= -1:continue
        d[i] = ci
        for j,cj in E[i].items():
            if d[j]!=-1:continue
            heapq.heappush(q,(ci+cj,j))
    return d

da = Dijkstra(n,Ea,s)
db = Dijkstra(n,Eb,t)

C = [a+b for a,b in zip(da,db)]

ans = [C[-1]]
for c in C[-2::-1]:
    ans.append(min(ans[-1],c))

for out in ans[::-1]:
    print(10**15-out)

Measured memory_bytes: 126756