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

using namespace std;
using ll = long long;

const int K = 1000;

int main() {
    int H, W, h, w;
    scanf("%d%d%d%d", &H, &W, &h, &w);
    if (H % h == 0 && W % w == 0) {
        puts("No");
    } else {
        puts("Yes");
        if (H % h != 0) {
            for (int i = 0; i < H; ++i) {
                for (int j = 0; j < W; ++j) {
                    if (i % h == 0) {
                        printf("%d ", K * (h - 1) - 1);
                    } else {
                        printf("%d ", -K);
                    }
                }
                puts("");
            }
        } else {
            for (int i = 0; i < H; ++i) {
                for (int j = 0; j < W; ++j) {
                    if (j % w == 0) {
                        printf("%d ", K * (w - 1) - 1);
                    } else {
                        printf("%d ", -K);
                    }
                }
                puts("");
            }
        }
    }
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}


int main(void){
    string t;
    cin >> t;
    int ans = t[0] != 'P' ? 1 : 0;
    if(t[0] == '?')t[0] = 'D';
    for(int i = 1; i < t.length(); i++){
        if(t[i] == '?'){
            t[i] = 'D';
        }
        if(t[i] == 'D'){
            ans += t[i-1] == 'P' ? 2 : 1;
        }
    }
    cout << t << endl;
}

Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int H, W; 
  cin >> H >> W;

  vector<vector<string>> s(H, vector<string>(W));
  REP(i, H) REP(j, W) cin >> s[i][j];

  REP(i, H) REP(j, W){
    if(s[i][j] == "snuke"){
      cout << char(j+'A') << i+1 << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

void primeFactors(ll a, map<ll, ll> &facs) {
    ll sqrtA = sqrt(a);
    for (ll i = 2; i <= sqrtA; ++i) {
        while (a % i == 0) {
            facs[i]++;
            a /= i;
        }
    }
    if (a > sqrtA)
        facs[a]++;
}

int main() {
    int n;
    cin >> n;
    map<ll, ll> m;
    for (int i = 2; i <= n; ++i) {
        primeFactors(i, m);
    }
    int fac74 = 0;
    int fac24 = 0;
    int fac14 = 0;
    int fac4 = 0;
    int fac2 = 0;
    for (auto p : m) {
        if (p.second >= 74)
            fac74++;
        if (p.second >= 24)
            fac24++;
        if (p.second >= 14)
            fac14++;
        if (p.second >= 4)
            fac4++;
        if (p.second >= 2)
            fac2++;
    }
    int ret = 0;
    ret += fac74;
    ret += fac24 * (fac2 - 1);
    ret += fac14 * (fac4 - 1);
    ret += fac4 * (fac4 - 1) * (fac2 - 2) / 2;

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
long long a,b;
pair<long long,long long>v[100001];
int main()
{
	int m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		v[i]=make_pair(a-b,a+b);
	}
	sort(v,v+n);
	int last=0,ans=1;
	for(int i=1;i<n;i++)
	{
		if(v[last].second<=v[i].first)
		{
			last=i;
			ans++;
			continue;
		}
		if(v[last].second>=v[i].second)
		{
			last=i;
			continue;
		}
	}
	cout<<ans;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define PER(i,n,a) for(ll i=n;i>a;i--)
#define REP1(i,a,n) for(ll i=a;i<=n;i++)
#define forit(it,x) for(auto it=(x).begin();it!=(x).end();++it)
#define ull unsigned long long int
#define ld long double
#define prec(n) fixed<<setprecision(n)
#define test ll t; cin>>t; while(t--)
#define re return 0
#define pb push_back
#define PI 3.1415926535897932384626
#define MOD (ll)1000000007
#define fi first
#define se second
#define eb emplace_back
#define vll vector<ll>
#define vi  vector<int>
#define mpll map<ll,ll>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)
const ll MAXI = (ll)1e9+7;
int main(){
    IOS;
//    test{
        int n;
        cin>>n;
/*        int ar[n];
        REP(i,a,n){
           cin>>ar[i];
        }
    }
    */
    cout<<n*n<<"\n";
re;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;


ll dp[55][55][2505];

signed main(){
	int n,a;
	cin>>n>>a;
	vector<int>x(n);
	rep(i,n){
		cin>>x[i];
	}
	dp[0][0][0]=1;
	rep(i,n){
		rep(j,i+1){
			rep(k,50*j+1){
				dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
				dp[i+1][j][k]+=dp[i][j][k];
			}
		}
	}
	ll ans=0;
	for(int i=1;i<=n;++i)ans+=dp[n][i][a*i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 53504
#include <iostream>

using namespace std;

int N, D[100005];

long long int C[100005];

long long int MOD = 998244353;


int main(void) {

	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> D[i];
		C[D[i]]++;
	}

	if (D[1] != 0 || C[0]!=1) { cout << 0 << endl;  return 0; }

	//for (int i = 2; i <= N; i++) { if (D[i] == 0) { cout << 0 << endl; return 0; } }

	long long int ans = 1;

	for (int d = 1; d <= N-1; d++) {
		for (long long int j = 1; j <= C[d]; j++) {
			ans *= C[d - 1];
			ans %= MOD;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        int A =sc.nextInt();    //高橋君のモンスターの体力
        int B =sc.nextInt();    //高橋君のモンスターの攻撃力
        int C =sc.nextInt();    //青木君のモンスターの体力
        int D =sc.nextInt();    //青木君のモンスターの攻撃力
        
        while (true){  //どちらかが勝つまで
            C -= B; //高橋君の攻撃
            if (C <= 0){  //青木君のモンスターの体力が先に0になったとき
                System.out.println("Yes");
                break;
            }
                
            A -= D; //青木君の攻撃
            if (A <= 0){  //高橋君のモンスターの体力が先に0になったとき
                System.out.println("No");
                break;
            }
        }
        
    }       
}

Measured memory_bytes: 35852
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define maxN 200007
using namespace std;
int main() {
  fastio;
  ll n = 0, c = 0;
  ld d = 0;
  cin >> n >> d;
  for (ll i = 0; i < n; ++i) {
    ld x = 0, y = 0;
    cin >> x >> y;
    ld dist = sqrt(x * x + y * y);
    if (dist <= d)
      ++c;
  }
  cout << c;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vlong l(87);
  l[0]=2;
  l[1]=1;
  REP(i,2,87){
    l[i]=l[i-1]+l[i-2];
  }
  cout<<l[n]<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, count = 0; cin >> N >> M;
  vector<vector<bool>> path(N, vector<bool> (N, false));
  for(int i = 0; i < M; i++) {
    int a, b; cin >> a >> b; a--; b--;
    path.at(a).at(b) = true;
    path.at(b).at(a) = true;
  }
  vector<int> route(N);
  for(int i = 0; i < N; i++) route.at(i) = i;
  sort(route.begin(), route.end());
  do {
    bool judge = true;
    if(route.at(0) != 0) continue;
    for(int i = 1; i < N; i++) {
      if(!path.at(route.at(i - 1)).at(route.at(i))) {
        judge = false;
        break;
      }
    }
    if(judge) count++;
  } while(next_permutation(route.begin(), route.end()));
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll a, x;
  cin >> a >> x;

  ll n = 2*a-1;
  vl ans(n);
  iota(all(ans), 1);

  if (x == 1 or x == n) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
    ll mid = n/2;
    if (x != mid+1) {
      if (x > mid) {
        reverse(all(ans));
        x = n-x+1;
      }
      swap(ans[x-1], ans[mid+1]);
      swap(ans[0], ans[mid]);
    }
    rep(i, n) {
      cout << ans[i] << endl;
    }
  }
}


Measured memory_bytes: 3072
#include<stdio.h>

int main(void){
    int a,b,c,x,i,j,k,cnt=0;
    scanf("%d%d%d%d",&a,&b,&c,&x);
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            for(k=0;k<=c;k++){
                if(i*500+j*100+k*50==x){
                    ++cnt;
                }
            }
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
 
#define MOD 1000000007
void init();
void solve();

signed main()
{
	init();
	solve();
}

bool dp[5010][10010];
vector<int> A;
int N, K;

void init()
{
	cin >> N >> K;
	rep(i, N) {
		int t;
		cin >> t;
		if (t < K) A.PB(t);
	}
	N = A.size();
	sort(all(A));
}

bool isok(int pos)
{
	if (pos == -1) return false;
	if (pos == N) return true;
	bool dp[2][5010];
	rep(i, 2) rep(j, 5010) dp[i][j] = false;
	dp[0][0] = true;
	int now = 1;
	rep(i, N) {
		if (i == pos) continue;
		int pre = 1 - now;
		rep(j, K) {
			if (dp[pre][j]) {
				dp[now][j] = true;
				if (j + A[i] < K) {
					dp[now][j+A[i]] = true;
					if (j + A[i] >= K - A[pos]) return true;
				}
			}
		}
		now = pre;
	}
	return false;
}

void solve()
{
	int ok = N;
	int ng = -1;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		if (isok(mid)) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}



Measured memory_bytes: 256
input = raw_input

alphas = "abcdefghijklmnopqrs"

n = int(input())

if n == 1:
    print("a")
elif n == 2:
    for out in ["aa", "ab"]:
        print(out)

elif n >= 3:
    former_prefixs = ["aa", "ab"]
    next_i = 3
    while True:
        cur_prefixs = []
        for prefix in former_prefixs:
            prefix_nc = len(set(prefix))
            for c in alphas[:prefix_nc+1]:
                out = prefix + c
                if next_i == n:
                    print(out)
                cur_prefixs.append(out)

        if next_i == n:
            break
        next_i += 1
        former_prefixs = cur_prefixs

Measured memory_bytes: 43804
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int  i=(a); i<(b);++i)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double x;
    cin>>x;
    if(x>=30) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}




Measured memory_bytes: 3736
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long rootn = (long)Math.sqrt(n);
        
        String a = "";
        String b = "";
        for (long i = rootn; i >= 1; i--) {
            if (n % i == 0) {
                a = String.valueOf(i);
                b = String.valueOf(n / i);
                break;
            }
        }
        
        int answer = Math.max(a.length(), b.length());
        System.out.println(answer);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>

using namespace std;

long n;
long a[100005];
long b[100005];
long c[100005];
long long res;

int main()
{
	long long i, k;

	cin >> n;

	for (long i = 0; i < n; ++i)
		cin >> a[i];

	for (long i = 0; i < n; ++i)
		cin >> b[i];

	for (long i = 0; i < n; ++i)
		cin >> c[i];

	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);

	i = k = 0;
	for (long j = 0; j < n; ++j)
	{
		while (a[i] < b[j] && i < n) ++i;
		while (c[k] <= b[j] && k < n) ++k;
		if (b[j] > c[n-1]) break;
		res += i * (n - k);
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0)
        cout << "Possible";
    else
        cout << "Impossible";
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    fun <T1, T2> scan(f: (T2, T1) -> T2, init: T2, list: List<T1>): List<T2> {
        var tmp = init
        return list.map {
            tmp = f(tmp, it)
            tmp
        }
    }
    val (n, x) = readLine()!!.split(' ').map(String::toInt)
    val l = readLine()!!.split(' ').map(String::toInt)
    val po = scan({ acc, i -> acc + i}, 0, l).indexOfLast { it <= x }
    println(po + 2)
}



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

long long N;

int main(){
	cin >> N;

	long long ans = 0;
	for(long long i = 1; i <= N; i++) {
		if(i % 3 != 0 && i % 5 != 0) {
			ans += i;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
map<int, long long>cnt1, cnt2;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	set<int>s;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		s.insert(i-x);
		cnt1[i-x]++;
		cnt2[i+x]++;
	}
	long long ans=0;
	for(int i:s){
		ans+=cnt1[i]*cnt2[i];
	}
	cout<<ans;
}

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

// ============union_find_tree===============
int MAX_N = 100000;
vector<int> par(MAX_N);//MAX_N == num of node
vector<int> tree_rank(MAX_N);

void init(int n)
{
  for (int i = 0; i < n; ++i)
  {
    par.at(i) = i;
    tree_rank.at(i) = 0;
  }
}

int find(int x)
{
  if (par.at(x) == x)
  {
    return x;
  }
  else
  {
    return par.at(x) = find(par.at(x));
  }
}

void unite(int x, int y)
{
  x = find(x);
  y = find(y);
  if (x == y)
  {
    return;
  }
  if (tree_rank.at(x) < tree_rank.at(y))
  {
    par.at(x) = y;
  }
  else
  {
    par.at(y) = x;
    if (tree_rank.at(x) == tree_rank.at(y))
    {
      tree_rank.at(x)++;
    }
  }
}

bool same(int x, int y)
{
  return find(x) == find(y);
}
// =======================================

// ==============kruskal==================

struct edge {int u, v, cost;}; // 辺u, v をつなぐコストが cost
bool comp(const edge& e1, const edge& e2)
{
  return e1.cost < e2.cost;
}

const int MAX_E = 200000;
edge es[MAX_E];
int V, E; // V 頂点、E 辺　の数

long long kruskal()
{
  sort(es, es + E, comp);
  init(V);
  long long ans = 0;
  for (int i = 0; i < E; ++i)
  {
    edge e = es[i];
    if (!same(e.u, e.v))
    {
      unite(e.u, e.v);
      ans += e.cost;
    }
  }
  return ans;
}
// =======================================
bool customLess(vector<int> a, vector<int> b)
{
  return a.at(0) < b.at(0);
}

int main()
{
  int N;
  cin >> N;
  V = N;
  E = 2 * N - 2;
  vector<vector<int>> x_s(N);
  vector<vector<int>> y_s(N);
  int x, y;
  for (int i = 0; i < N; ++i)
  {
    cin >> x >> y;
    x_s.at(i) = {x, i};
    y_s.at(i) = {y, i};
  }
  sort(x_s.begin(), x_s.end(), customLess);
  sort(y_s.begin(), y_s.end(), customLess);
  for (int i = 0; i < N - 1; ++i)
  {
    edge edge_x = {x_s.at(i + 1).at(1), x_s.at(i).at(1), x_s.at(i + 1).at(0) - x_s.at(i).at(0)};
    edge edge_y = {y_s.at(i + 1).at(1), y_s.at(i).at(1), y_s.at(i + 1).at(0) - y_s.at(i).at(0)};
    es[i * 2] = edge_x;
    es[i * 2 + 1] = edge_y;
  }
  cout << kruskal() << endl;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b && a!=c)
	{
	cout<<"Yes"<<endl;
	return 0;
}
	if(a==c && a!=b)
	{
	cout<<"Yes"<<endl;
	return 0;
}
	if(b==c && b!=a)
	{
	cout<<"Yes"<<endl;
	return 0;
}
    cout<<"No"<<endl;
    return 0;
	}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int a, b, c, x, y, diff, sum = 0, min1, min2, number, max;

  scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);

  diff = c * 2 - (a + b);
  min1 = ((x - y) > 0) ? y : x;
  min2 = min1 * 2;
  max = ((x - y) > 0) ? x : y;
  number = ((x - y) > 0) ? (x - y) : (y - x);

  if (diff < 0) {
    while (min2 > 0) {
      sum += c;
      min2--;
    }
    while (number > 0) {
      if (x > y) {
        sum += a;
      }else {
        sum += b;
      }
      number--;
    }
    if (sum > (max * c * 2)) {
      sum = (max * c * 2);
    }
  }else {
    sum += (a * x);
    sum += (b * y);
  }

  printf("%d\n", sum);

  return 0;

}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}

import           Data.Functor
import           Text.Printf

main :: IO ()
main = do
  [a :: Integer, b :: Integer] <- fmap read . words <$> getLine
  let area = a*b
  let perimeter = 2*(a+b)
  printf "%d %d\n" area perimeter



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

int main(){
  int n;
  cin >> n;
  char s[n];
  for(int i = 0;i < n;i++){
    cin >> s[i];
  }
  int P_count = 0;
  int W_count = 0;
  int G_count = 0;
  int Y_count = 0;
  for(int i = 0;i < n;i++){
    if(P_count == 0 && s[i] == 'P'){
      P_count++;
    }
    else if(W_count == 0 && s[i] == 'W'){
      W_count++;
    }
    else if(G_count == 0 && s[i] == 'G'){
      G_count++;
    }
    else if(Y_count == 0 && s[i] == 'Y'){
      Y_count++;
    }
  }
  int ans = P_count+W_count+G_count+Y_count;
  if(ans == 3){
    cout << "Three" << endl;
  }
  else if(ans == 4){
    cout << "Four" << endl;
  }
  
}


Measured memory_bytes: 256
x1,y1,x2,y2 = map(float,input().split())
an = (x1 - x2)**2 + (y1 - y2)**2
dis = an/2
v = an/4
while abs(dis**2 - an) > 0.0001:
	if dis**2 > an:
		dis -= v
	else:
		dis += v
	v = v/2
print(dis)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using v  = vector<int>;
using vv = vector<v>;
//const int MOD = 1000000007;
const int MOD = 998244353;
const int INF = 1001001001;

int main(){
    int n;
    cin >> n;
    v sum(n);
    int w;
    rep(i,n){
        cin >> w;
        if(i)sum[i] += sum[i-1];
        sum[i] += w;
    }
    int ans = sum[n-1];
    
    rep(i,n){
        ans = min(ans, abs(sum[n-1] - sum[i]*2));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,min=1;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    int a,b;
    a=min+K; b=min*2;
    if(a<=b){min=a;}
    else{min=b;}
  }
  cout<<min<<endl;
}

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

using namespace std;

int main() {
  int a,b;
  while(scanf("%d %d", &a, &b)) {
    if (a == 0 && b == 0) break;
    if (a > b) swap(a, b);
    printf("%d %d\n", a, b);
  }
}

Measured memory_bytes: 1012
///who is the king ??? *** << t.mohammad >> *** ///
/*
                  00                                                                                                            00
                 00                               00                                                                           00
            0000000000                           00                                                                           00
           0000000000   000       000           00                        000       000  000       000                       00
              00       0000     0000           00         000000         0000     0000  0000     0000   000000              00
             00       00 00   00 00    000    00        00000000        00 00   00 00  00 00   00 00  00000000       00000000
            00       00  00 00  00   00000   000000    00    000       00  00 00  00  00  00 00  00  00    000     0000000000
           00       00   000   00  00   00  00000000  00    0000      00   000   00  00   000   00  00    0000    00     0000
          00       00         00  00   00  00    00  00    00 00     00         00  00         00  00    00 00   00     00 00
         00  00   00         00   00000   00    00  00000000  00    00         00  00         00  00000000  00  000000000  00
        00  00   00         00    000    00    00   000000    00   00         00  00         00   000000    00  0000000    00
*/
#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll;
typedef long double dou ;
typedef pair<ll , ll> pii;
typedef map<ll, bool> mib;
typedef pair<ll, bool> pib;
typedef map<ll , ll> mii;
#define wh while
#define str string
#define vec vector
#define fori(a1 , a2 , a3) for(ll i = a1 ; i < a2 ; i = i + a3)
#define for_i(b1 , b2 , b3) for(ll i = b1 ; i >= b2 ; i = i - b3)
#define forj(c1 , c2 , c3) for(ll j = c1 ; j < c2 ; j = j + c3)
#define for_j(d1 , d2 , d3) for(ll j = d1 ; j >= d2 ; j = j - d3)
#define fore(e1 , e2 , e3) for(ll e = e1 ; e < e2 ; e = e + e3)
#define for_e(f1 , f2 , f3) for(ll e = f1 ; e >= f2 ; e = e - f3)
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define fast ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
#define setp(t) cout << setprecision(t) << fixed ;
pii a[100000] ;
ll c[100000] ;
int main(){
	fast ;
	ll n ;
	cin >> n ;
	ll x = 0 ;
	fori(0 , n , 1)
	{
		cin >> a[i].ff >> a[i].ss ;
		x = x - a[i].ss ;
		c[i] = a[i].ff + a[i].ss ;
	}
	sort(c , c + n , greater<ll>()) ;
	fori(0 , n , 2)
	{
		x = x + c[i] ;
	}
	cout << x << "\n" ;
	
}




Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;

const int maxN = 2e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int n;
string st;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> st;

	int zers = count(st.begin(), st.end(), '.'), ans = zers, ons = 0;

	for(char el: st) {
		if(el == '.') zers--;
		else ons++;
		ans = min(ans, ons + zers);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 720
// Write your code here
#include <bits/stdc++.h>
using namespace std;
#include <iostream>

int main(){
	string s,t;
	cin>>s>>t;
	long long int n1,n2,count=0,ans=0;
	n1=s.size();
	n2=t.size();
	long long int tmp=n1-n2;
	ans=n1+2;
	for(int j=0;j<=tmp;j++){
		count=0;
		for(int k=0;k<n2;k++){
			if(s[j+k]!=t[k]){
				count++;
			}
		}
		ans=min(ans,count);
		//cout<<ans<<"\n";
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 2e5 + 5;
const int inf = 1e9 + 1;
int A , B , m;
int a[maxn],b[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    int res = 2e9;
    cin >> A >> B >> m;
    for(int i = 1 ;  i <= A ; ++i){
        cin >> a[i];
    }
    for(int i = 1 ; i <= B ; ++i){
        cin >> b[i];
    }
    while(m--){
        int x , y ,c;cin >> x >> y >> c;
        res = min(res,a[x]+b[y]-c);
    }
    res = min(res,*min_element(a+1,a+A+1)+*min_element(b+1,b+B+1));
    cout << res;
}




Measured memory_bytes: 1024
S = input()

ans = 'AC'
c_cnt = 0
c_idx = []
for i in range(2, len(S)-1):
    if(S[i] == 'C'):
        c_cnt += 1
        c_idx.append(i)

if(S[0] != 'A'):
    ans = 'WA'

if(c_cnt != 1):
    ans = 'WA'

if(c_cnt == 1):
    for i in range(1, len(S)):
        if(i == c_idx[0]):
            continue
        if(S[i].isupper() is True):
            ans = 'WA'

print(ans)


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

int main(){

	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++) cin >> a[i];

	int ave = 0;
	for(int i=0;i<n;i++){
		ave += a[i];
	}
	ave /= n;

	long long int ans = 1000000000;
	ave--;
	for(int j=0;j<3;j++){
		long long int tmp = 0;
		for(int i=0;i<n;i++){
			tmp += ( ave - a[i] ) * ( ave - a[i] );
		}
		if( ans > tmp ) ans = tmp;
		ave++;
	}
	cout << ans << endl;

	return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    if((a == b && a != c) || (a == c && a != b) || (b == c && a != b)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep (i, n) {
        cin >> a[i];
    }
    vector<int> ans(n+1, 0);
    for (int i = n; i > 0; --i) {
        int ctr = 0;
        for (int j = i; j <= n; j += i) {
            ctr += ans[j];
        }
        ctr %= 2;
        ans[i] = a[i-1] ^ ctr;
    }
    vector<int> p;
    rep (i, n+1) {
        if (ans[i]) {
            p.push_back(i);
        }
    }
    cout << p.size() << endl;
    rep (i, p.size()) {
        if (i) cout<< " ";
        cout << p[i];
    }
    cout << endl;
}

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static int getInt(){
		return Integer.parseInt(s.next());
	}
	public static void main(String[] __){
		int h=getInt(),w=getInt();
		for(int i=1;i<=h;i++)
			for(char c='A';c-'A'<w;c++)
				if(s.next().equals("snuke"))
					System.out.println(""+c+i);
	}
}


Measured memory_bytes: 22228
S = input()
F = int(S[:2])
R = int(S[2:])
FF = 0 < F and F < 13
RR = 0 < R and R < 13

if FF and RR:
    print('AMBIGUOUS')
elif FF:
    print('MMYY')
elif RR:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
using System;

namespace ARC063C{
    public class Program{
        public static void Main(string[] args){
            var S = Console.ReadLine();

            var res = 0;
            for(var i = 1; i < S.Length; i++){
                if(S[i - 1] != S[i]) res++;
            }

            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 3160
#include<stdio.h>
#include<string.h>
long long dp[55];
const long long mod=1e9+7;
char s1[100];
char s2[100];
int main(){
	int n,m,start,pp,kk;
	scanf("%d",&n);
    memset(dp,0,sizeof(dp));
	getchar();
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	dp[0]=1;
	pp=1;
	if (s1[1]==s2[1]) {dp[1]=3;
    start=2;}
    else {
    	dp[2]=6;
    	start=3;
        pp=0;
    }
	while(start<=n){
		if (s1[start]==s2[start]){
			if (pp==1) dp[start]=dp[start-1]*2%mod;
			 else dp[start]=dp[start-1]%mod;
			pp=1;
			start++;
		}
		else {
			kk=0;
			while(s1[start]==s1[start+1]&&start<=n){
				if (pp==0) dp[start+1]=dp[start-1]*3%mod;
				else 
				if (kk==0) dp[start+1]=dp[start-1]*2%mod;
				else dp[start+1]=dp[start-1]*3%mod;
				kk=1;
				start=start+2;
				pp=1;
			}
			if (start>n) break;
			dp[start]=dp[start-1]%mod;
			start++;
		}
	}
	printf("%lld\n",dp[n]);
} 

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


int main()
{
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s[k-1] += 'a' - 'A';
  cout << s << endl;
  return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> L(N);
    for (int i = 0; i < N; i++)
    {
        cin >> L.at(i);
    }
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            if (L.at(i) == L.at(j))
            {
                continue;
            }
            for (int k = j + 1; k < N; k++)
            {
                if (L.at(j) == L.at(k) || L.at(i) == L.at(k))
                {
                    continue;
                }
                if (abs(L.at(i) - L.at(j)) < L.at(k) && L.at(k) < L.at(i) + L.at(j))
                {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main(void) {
	int n, i, a, ans = 0, buf = 0;
	vector<int> d = { 1 };
	cin >> n;
	for (ans = n, i = 0; i <= n; i++) {
		buf = 0;
		a = i;
		while (a > 0) {
			buf += a % 6;
			a /= 6;
		}
		a = n - i;
		while (a > 0) {
			buf += a % 9;
			a /= 9;
		}
		ans = min(ans, buf);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
n,m = [int(i) for i in input().split()]
rang = []
lmax = 0
rmin = 10**10
for i in range(m):
    l,r = [int(i) for i in input().split()]
    lmax = max(l,lmax)
    rmin = min(r,rmin)

print(max(rmin - lmax + 1,0))


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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

divisors = make_divisors(N)

min_sum = 0

for A in divisors:
    B = N // A
    if min_sum == 0 or A+B <= min_sum:
        min_sum = A+B
print(min_sum-2)


Measured memory_bytes: 3296
# -*- coding: utf-8 -*-
# GCD
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a

# lのGCD
def gcdlist(l):
    res = l[0]
    for i in range(1,len(l)):
        res = gcd(res, l[i])
    return res


n,k = map(int, input().split())
al = list(map(int, input().split()))

m = gcdlist(al)
al.sort(reverse=True)

for a in al:
    if a>k:
        if (a-k)%m==0:
            print("POSSIBLE")
            exit()
    elif a==k:
        print("POSSIBLE")
        exit()
    else:
        break
print("IMPOSSIBLE")


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

int main() {
	// your code goes here
	int A, B;
  	cin >> A >> B;
  	int ans=0;
  	for(int i=0; i<2; i++){
    	if(A <= B){
        	ans += B;
          	B--;
        }
      	else{
        	ans += A;
          	A--;
        }
    }
  	cout << ans << endl;
  
  
  
	return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
x = gets.chomp.split.map(&:to_i)

even_number = x.select{|i| i.even?}
division = even_number.select{|i|(i % 3 == 0) || (i % 5 == 0)}
puts (even_number.length == division.length ? 'APPROVED' : 'DENIED')

Measured memory_bytes: 1788
IDENTIFICATION                    DIVISION.
PROGRAM-ID.                       PROGRAM_ID.
DATA                              DIVISION.
WORKING-STORAGE                   SECTION.
    01 LN           PIC X(13).
    01 N            PIC 9(10).
    01 K            PIC 9(2).
    01 cnt          PIC 9(2).
    01 ans          PIC Z9.
PROCEDURE                         DIVISION.
    ACCEPT LN.
    UNSTRING LN DELIMITED BY SPACE INTO N K.
    MOVE 1 TO cnt.
    PERFORM UNTIL N < K ** cnt
       ADD 1 TO cnt
    END-PERFORM.
    MOVE cnt TO ans.
    DISPLAY ans.


Measured memory_bytes: 636
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define int long long
using namespace std;
long long k=1000000007;

signed main(){
  int n;
  while(cin >> n,n){
    int s[n],p[n],q[n],r[n];
    for(int i=0;i<n;i++)cin >> s[i] >> p[i] >> q[i] >> r[i];
    int P,Q,R,C;
    cin >> P >> Q >> R  >> C;
    bool judge=true;
    for(int i=0;i<n;i++){
      if(p[i]<=P && q[i]<=Q && r[i]<=R && p[i]*4+q[i]*9+r[i]*4<=C){
      judge=false;
      cout << s[i] << endl;
      }
    }
    if(judge)
      cout << "NA" << endl;
  }
  
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> s(N), l(N), p(N);
    for (int i = 0; i < N; i++) {
        cin >> s[i] >> l[i] >> p[i];
    }

    vector<int> dp(394, -1);
    dp[0] = 0;

    int len = dp.size();
    for (int i = 0; i < 394; i++) {
        if (dp[i] < 0) continue;
        for (int j = 0; j < N; j++) {
            for (int k = s[j]; k <= l[j]; k++) {
                if (i + k < len) dp[i + k] = max(dp[i + k], dp[i] + p[j]);
            }
        }
    }

    int M;
    cin >> M;

    vector<int> m(M);
    bool flag = true;
    for (int i = 0; i < M; i++) {
        cin >> m[i];
        if (dp[m[i]] < 0) flag = false;
    }
    if (flag) {
        for (auto i : m) cout << dp[i] << endl;
    }
    else {
        cout << -1 << endl;
    }

    return 0;
}

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0; i < n; i++) a[i] = s[i] - '1';

    int ans = 0;
    if (s.find("2") != string::npos) {  
        for (int i = 0; i < n; i++) {
            int val = (a[i] & 1);
            if (((n - 1) & i) == i) ans ^= val;
        }
    } else {
        for (int i = 0; i < n; i++) {
            int val = min(a[i], 1);
           if (((n - 1) & i) == i) ans ^= val;
        }
        ans *= 2;
    }

    cout << ans << '\n';

    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;

    int n = s.size();
    vector<int> l(n + 1);
    for (int i = 0; i < n; i++) {
        if (s[i] == '<') l[i + 1] = l[i] + 1;
    }
    vector<int> r(n + 1);
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '>')r[i] = r[i + 1] + 1;
    }

    ll ret = 0;
    for (int i = 0; i <= n; i++)ret += max(l[i], r[i]);
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 4740
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(1e9+7)
#define pb push_back
#define mp make_pair
string s,t;
vector<pair<string,int> >v;
int main()
{
	cin>>s>>t;
	int l=t.length();
	for(int i=0;i<s.length()-l+1;i++)
	{
		string tmp=s.substr(i,l);
		v.pb(mp(tmp,i));
	}
	for(int i=v.size()-1;i>=0;i--)
	{
		string tmp=v[i].first;
		int beg=v[i].second;
		bool same=1;
		int k=0;
		for(int j=beg;j<beg+l;j++)
		{
			if(s[j]!='?'&&s[j]!=t[k])
			{
				same=0;
				break;
			}
			k++;
		}
		if(!same)
			continue;
		k=0;
		for(int j=beg;j<beg+l;j++)
			s[j]=t[k],k++;
		for(int j=0;j<s.size();j++)
			if(s[j]=='?')
				s[j]='a';
		cout<<s;
		return 0;
	}
	puts("UNRESTORABLE");
	return 0;
}


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


using namespace std;


void z_algorithm(string &S, vector<int>& z) {
    z.resize(S.length());
    z[0] = S.length();
    int i = 1, j = 0;
    while (i < S.length()) {
        while (i + j < S.length() && S[j] == S[i + j])
            j++;
        z[i] = j;
        if (j == 0) {
            i++;
            continue;
        }

        int k = 1;
        while (k < j && k + z[k] < j) {
            z[i + k] = z[k];
            k++;
        }
        i += k;
        j -= k;
    }
}


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

    vector<vector<int>> Z(N);
    for (int i = 0; i < N; i++) {
        string ss = S.substr(i);
        z_algorithm(ss, Z[i]);
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < Z[i].size(); j++) {
            if (j >= Z[i][j]) {
                ans = max(ans, Z[i][j]);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 49280
#include<stdio.h>
int main(void)
{
	int  d;
	scanf("%d", &d);
	if (d == 22) {
		printf("Christmas Eve Eve Eve\n");
	}
	if (d == 23) {
		printf("Christmas Eve Eve\n");
	}
	if (d == 24) {
		printf("Christmas Eve\n");
	}
	if (d == 25) {
		printf("Christmas\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  
  cin >> a >> b;
  
  if (a * b % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}  

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

#define AndIamIronMan ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
 
using namespace std;
 
typedef  long long int lli; 

int main(){
    
    lli i,x,j,k,n,y,m,t; 	
    AndIamIronMan;
//    cin>>t;
//    while(t--){
	cin>>n>>k;
	lli ar[n];
	for(i=0;i<n;i++){
		cin>>ar[i];
	}
	sort(ar,ar+n);
	x=0;
	for(i=0;i<k;i++){
		x+=ar[i];
	}
	cout<<x;
//	}
	return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

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

#define N 200010
#define MAX 1000000000000000000

#include <stdio.h>

int main (void) {
    double d, t, s;

    scanf("%lf %lf %lf", &d, &t, &s);

    if (d / s > t) {
        puts("No");
    } else {
        puts("Yes");
    }

    return 0;
}



Measured memory_bytes: 1712
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
 
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0 && c>0){
        a -= d;
        c -= b;
    }
    if(c <= 0){
        cout << "Yes\n";
    }
    else cout <<"No\n";
}

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

int main(){
    ll mod=1e9+7;
    int n,m;
    cin>>n>>m;
    ll ans=0;
    ll ak=1,bk=1;
    for(int i=1;i<=n;++i){
        ak*=i;
        ak%=mod;
    }
    for(int i=1;i<=m;++i){
        bk*=i;
        bk%=mod;
    }
    if(abs(n-m)>1){
        cout<<ans<<endl;
        return 0;
    }
    else if(abs(n-m)==1){
        ans=(ak%mod)*(bk%mod);
    }
    else ans=2*(ak%mod)*(bk%mod);
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

vector< int > vec;
vector< int > a;
vector< int > ans;
vector< vector< int > > g;
constexpr int INF = 1e9 + 6;

void dfs(int v, int p = -1) {
    int ichi = lower_bound(vec.begin(), vec.end(), a[v]) - vec.begin();
    int tmp = vec[ichi];
    vec[ichi] = a[v];
    ans[v] = lower_bound(vec.begin(), vec.end(), INF) - vec.begin();
    for (int u : g[v]) {
        if (u == p) continue;
        dfs(u, v);
    }
    vec[ichi] = tmp;
}

int main() {
    int n;
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ans.resize(n);
    g.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vec.resize(n, INF);
    dfs(0);
    for (int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 27912
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;
use superslice::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        n: usize,
        m: usize,
        k: usize,
        a: [usize; n],
        b: [usize; m],
    }
    let mut acc_a = vec![0; n + 1];
    for i in 0..n {
        acc_a[i + 1] = a[i] + acc_a[i];
    }
    let mut acc_b = vec![0; m + 1];
    for i in 0..m {
        acc_b[i + 1] = b[i] + acc_b[i];
    }
    // eprintln!("{:?}", acc_a);
    // eprintln!("{:?}", acc_b);
    let mut result = 0;
    for i in 0..=n {
        let t = acc_a[i];
        if t <= k {
            let j = acc_b.upper_bound(&(k - t)) - 1;
            // eprintln!("{} {} {} {}", i, j, acc_a[i], acc_b[j]);
            result = max(result, i + j);
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 12404
# https://atcoder.jp/contests/arc071/submissions/6325840

from itertools import accumulate

*S, = map(lambda x: 1 if x == 'A' else 2, input())
*T, = map(lambda x: 1 if x == 'A' else 2, input())
# A=1,B=2

acc_s = (0,) + tuple(accumulate(S))
acc_t = (0,) + tuple(accumulate(T))

ans = []
Q = int(input())
for _ in range(Q):
    sl, sr, tl, tr = map(int, input().split())
    sl -= 1
    tl -= 1
    diff = (acc_t[tr] - acc_t[tl]) - (acc_s[sr] - acc_s[sl])
    ans.append('YES' if diff % 3 == 0 else 'NO')

print(*ans, sep='\n')


Measured memory_bytes: 15764
#include <bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
using namespace std;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int OFF = (1 << 20);

ll rek(ll x) {
	if (x == 1) return 1;
	ll tren = rek(x/2);
	tren *= 2LL;
	tren ++;
	return tren;
}

int main () {

	ll h;
	cin >> h;
	cout << rek(h);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static boolean tapDance(String S) {
        for (int i = 1; i < S.length() + 1; i++) {
            char cur = S.charAt(i - 1);
            if (cur == 'U' || cur == 'D') continue;
            if ((i % 2 == 0 && cur != 'L') || (i % 2 == 1 && cur != 'R')) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        System.out.println(tapDance(S) ? "Yes" : "No");
    }
}


Measured memory_bytes: 23892
#include <stdio.h>

int main (){
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if ((x - r) >= 0 && (x + r) <= W && (y - r) >= 0 && (y + r) <= H)
        printf("Yes\n");
    else 
        printf("No\n");

    return 0;
}


Measured memory_bytes: 2128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    switch (S) {
      case "Sunny":
        System.out.println("Cloudy");
        break;
      case "Cloudy":
        System.out.println("Rainy");
        break;
      case "Rainy":
        System.out.println("Sunny");
        break;
    }
  }
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 200005

ll n;
ll a[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    ll ans = 0;
    ll mx = 0;
    for(ll i = 0; i < n; i++){
        if(mx < a[i])
            mx = a[i];
        ans += (mx - a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int h, w, n = 0;;
	cin >> h >> w;
	string s;
	while (1) {
		cin >> s;
		if (s == "snuke") {
			cout << (char)('A' + (n%w)) << (n / w) +1<< endl;
			return 0;
		}
		else n++;
	}
}

Measured memory_bytes: 256