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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
int a[200005], le[200005], ri[200005];

int main() {
    scanf("%d", &n);
    forn(i, n) scanf("%d", a + i);
    forn(i, n) {
        le[i] = i;
        while (le[i] > 0 && a[le[i] - 1] >= a[i]) {
            le[i] = le[le[i] - 1];
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        ri[i] = i;
        while (ri[i] < n - 1 && a[ri[i] + 1] > a[i]) {
            ri[i] = ri[ri[i] + 1];
        }
    }
    LL ans = 0;
    forn(i, n) {
        ans += (LL)a[i] * (ri[i] - i + 1) * (i - le[i] + 1);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int K,A,B;
  cin >> K >> A >> B;
  string ans = "NG";
  for (int i = A; i < B + 1; i++) {
    if (i%K == 0) {
      ans = "OK";
    }
  }
  cout << ans <<endl;
}


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

using ll=long long;

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }

    ll res=0;
    for(ll i=(1LL<<32);i>=0;i>>=1){
        if(i==0){
            ll score=0;
            for(int j=0;j<n;j++){
                if(a[j]==0){
                    score+=b[j];
                }
            }
            res=max(score,res);
            break;
        }
        if(k&i){
            ll score=0;
            for(int j=0;j<n;j++){
                if(a[j]<i){
                    score+=b[j];
                }
                if(a[j] & i){
                    a[j]-=i;
                }
            }
            res=max(score,res);
        }
        
    }
    cout<<res<<endl;

    return 0;        
}

Measured memory_bytes: 1920
A,B,C = map(int,input().split())

if A == B:
    if A != C:
        ans = 1
    else:
        ans = 0
elif B == C:
    if B != A:
        ans = 1
    else:
        ans = 0
elif A == C:
    if B!= C:
        ans = 1
    else:
        ans = 0
else:
    ans = 0
if ans == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#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 srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  int ans=0;
  rep(i,n){
    int cnt = 0;
    while(a[i] %2 ==0){
      a[i]/=2;
      cnt++;
    }
    ans+=cnt;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 384
num_str = list(str(input()))
num = []
for i in range(4):
    num.append(int(num_str[i]))
if num[0] + num[1] + num[2] + num[3] == 7:
    print(num[0], "+", num[1], "+", num[2], "+", num[3], "=7", sep="")
    
elif num[0] - num[1] + num[2] + num[3] == 7:
    print(num[0], "-" ,num[1] ,"+", num[2] ,"+" ,num[3] ,"=7", sep="")
    
elif num[0] + num[1] - num[2] + num[3] == 7:
    print(num[0], "+" ,num[1] ,"-" ,num[2], "+", num[3] ,"=7", sep="")
    
elif num[0] + num[1] + num[2] - num[3] == 7:
    print(num[0], "+", num[1], "+" ,num[2], "-", num[3], "=7", sep="")
    
elif num[0] - num[1] - num[2] + num[3] == 7:
    print(num[0] ,"-" ,num[1], "-" ,num[2] ,"+" ,num[3] ,"=7", sep="")
    
elif num[0] - num[1] + num[2] - num[3] == 7:
    print(num[0] ,"-" ,num[1] ,"+" ,num[2] ,"-", num[3], "=7", sep="")
    
elif num[0] - num[1] - num[2] - num[3] == 7:
    print(num[0] ,"-", num[1], "-" ,num[2] ,"-", num[3],"=7", sep="")
    
elif num[0] + num[1] - num[2] - num[3] == 7:
    print(num[0], "+" ,num[1] ,"-" ,num[2], "-" ,num[3], "=7", sep="")

Measured memory_bytes: 3192
using System;

namespace ABC093_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string array = Console.ReadLine();
            char a = array[0];
            char b = array[1];
            char c = array[2];
            if((a != b) && (b != c) && (c != a))
            {
                Console.WriteLine("Yes");
            }else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 11092
N = int(input())
A = list(map(int, input().split()))

def ABC125gcd(x, y):
    if min(x, y) == 0:
        return max(x, y)
    else:
        return ABC125gcd(y, x % y)

L = [0] * N
R = [0] * N

for i in range(1, N):
    L[i] = ABC125gcd(L[i - 1], A[i - 1])
    R[N - 1 - i] = ABC125gcd(R[N - i], A[N - i])

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


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int a[220000];
signed main() {
    cin >> N;
    int x = 0;
    rep(i, N) {
        cin >> a[i];
        x ^= a[i];
    }
    rep(i, N) { cout << (a[i] ^ x) << " "; }
    cout << endl;
}


Measured memory_bytes: 5184
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repp(i,n,s) for (int i= (int)(n); i >= (int)(s); i--)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    string x;cin>>x;
    int c1 = 0;
    rep(i,0,n){
        if (x[i]=='1') c1++;
    }
    ll nxu = 0,nxm = 0;
    ll num_u = 1;
    ll num_m = 1;
    
    repp(i,n-1,0){
        if (x[i]=='1'){
            nxu = (nxu+num_u)%(c1+1);
            if (c1>1) nxm = (nxm+num_m)%(c1-1);
        }
        num_u= num_u*2%(c1+1);
        if (c1>1) num_m = num_m*2%(c1-1);
    }
    num_u=1,num_m=1;
    vector<ll> ans(n);
    repp(i,n-1,0){
        ll a;
        if (x[i]=='0') a = (nxu + num_u%(c1+1)+c1+1)%(c1+1);
        else {
            if (c1>1) a = (nxm-num_m%(c1-1)+c1-1)%(c1-1);
            if (c1==1) {ans[i] = 0;continue;}
            }
        num_u = num_u*2%(c1+1);
        if (c1>1)   num_m = num_m*2%(c1-1);
        ll cnt = 1;
        while (a>0){
            ll p = 0,b = a;
            while(b>0){
                if (1&b) p++;
                b/=2;
            }
            cnt++;
            a%=p;
        }
        ans[i] = cnt;
    }
    rep(i,0,n){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 5164
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  string S;
  cin>>S;
  
  int ans=0;
  
  
  for(int i=0;i<S.size();i++){
    if(S[i]=='2'){
      ans++;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define MAX 1000000001
#define llt long long int

int main()
{
    llt x;
    cin>>x;
    llt r,d,a,b,c;
    r=x%500;
    
    d=x/500;
    a=d*1000;
    b=r/5;
    c=b*5;
    cout<<a+c<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

N, K = map(int, input().split())
p = list(map(int, input().split()))

mx = 0
s = 0
q = deque()

for i in range(N):
    p[i] += 1

for i in range(N):
    s += p[i]
    q.append(p[i])
    if len(q) > K:
        s -= q.popleft()
    if len(q) == K:
        mx = max(mx, s)

print(mx / 2)



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

using namespace std;

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

using int64 = long long;
const int64 INF = 1LL << 60;

int main()
{
  int N;
  cin >> N;
  string s = to_string(N);
  int sum = 0;
  for(auto &p : s) sum += p - '0';
  if(N % sum == 0) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 256
#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;
	cin >> n;
	
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	
	vector<int> ans(n);
	
	int s = 0;
	rep(i,n) s += a[i];
	
	ans[0] = s;
	for(int i = 0; 1+i*2 < n; i++){
		ans[0] -= 2*a[1+i*2];
	}
	
	for(int i = 1; i < n; i++){
		ans[i] = 2*a[i-1] - ans[i-1];
	}
	
	rep(i,n) printf("%d%c", ans[i], i==n-1? '\n' : ' ');
	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <set>

using namespace std;

#define mp make_pair
#define int long long

const int N = 100001;

int p[N];

int get_p(int u)
{
	if (u == p[u])
		return u;
	return p[u] = get_p(p[u]);
}

void unite(int a, int b)
{
	a = get_p(a);
	b = get_p(b);
	p[a] = b;
}


signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	for (int i = 0; i < N; i++)
		p[i] = i;

	int n;
	cin >> n;
	vector<pair<int, int>> v(n);

	vector<pair<int, int>> fx, fy;

	for (int i = 0; i < n; i++)
	{
		cin >> v[i].first >> v[i].second;
		fx.push_back(mp(v[i].first, i));
		fy.push_back(mp(v[i].second, i));
	}

	sort(fx.begin(), fx.end());
	sort(fy.begin(), fy.end());

	set<pair<pair<int, int>, pair<pair<int, int>, pair<int, int>>>> st;

	for (int i = 0; i + 1 < n; i++)
	{
		st.insert(mp(mp(abs(fx[i].first - fx[i + 1].first), 0), mp(mp(i, i + 1), mp(fx[i].second, fx[i + 1].second))));
		st.insert(mp(mp(abs(fy[i].first - fy[i + 1].first), 1), mp(mp(i, i + 1), mp(fy[i].second, fy[i + 1].second))));
	}

	int ans = 0;

	while (!st.empty())
	{
		auto it = (*(st.begin()));
		st.erase(st.begin());
		//cout << it.second.second.first << " " << it.second.second.second << " " << it.first.first << endl;
		if (get_p(it.second.second.first) != get_p(it.second.second.second))
		{
			unite(it.second.second.first, it.second.second.second), ans += it.first.first;
		}

	}

	cout << ans;

}

Measured memory_bytes: 26084
//--- pE ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		int n = reader.ni();
		int[] cnt = new int[n];
		long ans = 0;
		for (int i=0; i<n; i++) {
			int t = reader.ni();
			if (i + t < n) {
				cnt[i + t] ++;
			}
			if (i - t >= 0) {
				ans += cnt[i-t];
			}
		}
		out.println(ans);
		return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


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

int main(){
  int n,k,x,y;
  int result;

  cin >> n >> k >> x >> y;

  if(n <= k){
    result = x*n;
  } else {
    result = x*k + y*(n-k);
  }

  cout << result << endl;
  
  return 0;
}


Measured memory_bytes: 256
import math
import sys


if __name__ == '__main__':
    n = int(input())
    a_list = list(map(int, input().split()))

    max_a = max(a_list)
    a_list.remove(max_a)

    min_diff = sys.maxsize
    answer1 = max_a
    answer2 = -1
    for i in range(n-1):
        diff = math.fabs(max_a/2 - a_list[i])
        if min_diff > diff:
            min_diff = diff
            answer2 = a_list[i]

    print(str(answer1) + " " + str(answer2))



Measured memory_bytes: 14180
from itertools import zip_longest

s = list(input())

for i in range(2**3) :
    lis = []
    c = ""
    for j in range(3) :
        if (i >> j) & 1 :
            lis.append("+")
        else:
            lis.append("-")
        
    for a, b in zip_longest(s, lis, fillvalue = "") :
        c += a + b
    
    if eval(c) == 7 :
        print(f"{c}=7")
        break

Measured memory_bytes: 79668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n;
    cin >> n;
    cout <<pow(n,3)<<endl;
    return 0;
}

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

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

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

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main(void)
{
    int n, k;
    std::cin >> n >> k;

    std::vector<long long> x(n);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i];
    }

    long long ans = std::numeric_limits<long long>::max();

    for (int i = 0; i < n - k + 1; i++) {
        ans = std::min(ans, std::abs(x[i]) + std::abs(x[i + k - 1] - x[i]));
    }

    for (int i = n - 1; i >= k - 1; i--) {
        ans = std::min(ans, std::abs(x[i]) + std::abs(x[i - k + 1] - x[i]));
    }

    std::cout << ans << std::endl;
}


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

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

const int N = 2e5 + 5;
const int MOD = 998244353;
int n, m, K;
ll fac[N];
ll inv[N];

ll power(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) {
      res = res * a % MOD;
    }
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

void init() {
  fac[0] = 1;
  for (int i = 1; i < N; ++i) {
    fac[i] = fac[i - 1] * i % MOD;
  }
  inv[N - 1] = power(fac[N - 1], MOD - 2);
  for (int i = N - 2; i >= 0; --i) {
    inv[i] = inv[i + 1] * (i + 1) % MOD;
  }
}

ll C(ll a, ll b) {
  return fac[a] * inv[a - b] % MOD * inv[b] % MOD;
}

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

  cin >> n >> m >> K;

  ll res = 0;
  for (int k = 0; k <= K; ++k) {
    res = (res + m * C(n - 1, k) % MOD * power(m - 1, n - 1 - k) % MOD) % MOD;
  }

  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 6740
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	
	int a,b,c,d;
	
	cin>>a>>b>>c>>d;
	
	bool turn=true;
	
	while (a>0 && c>0){
		if (turn){
			c-=b;
		}
		else{
			a-=d;
		}
		turn^=true;
	}
	
	if (a>0) cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3640
import numpy as np

N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))

from numba import jit

@jit
def imos(x):
  global N
  B = np.zeros_like(x)
  for i in range(N):
    p = x[i]
    L = max(i-p, 0)
    R = min(i+p, N-1)
    B[L] += 1
    if R < N-1:
      B[R+1] -= 1
  B = np.cumsum(B)
  return B

for i in range(K):
  if i >= 50:
    break
  A = imos(A)

print(*A)

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  ll n, k;
  cin >> n >> k;
  const ll MOD = 1e9 + 7;
  vector <ll> arr(n);
  const int MX = 2010;
  vector <int> cnt(MX, 0);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    cnt[arr[i]]++;
  }
  vector <int> vis(MX, 0);
  ll ans = 0;
  for (int j = 0; j < n; j++) {
    ll x = 0;
    ll gt = 0;
    for (int i = arr[j] + 1; i < MX; i++) {
      x += vis[i];
      gt += cnt[i];
    }
    ll add1 = (k * x) % MOD;
    ll add2 = ((k - 1) * k / 2) % MOD;
    ll add = (add1 + gt * add2) % MOD;
    ans = (ans + add) % MOD;
    vis[arr[j]]++;
  }
  cout << ans << '\n';
  return (0);
}


Measured memory_bytes: 256
<?php

$sc = new Scanner();
$out = new Out();

$input = [];

for($i = 0; $i < 4; $i++) {
    $input[$i] = $sc->nextInt();
}

$a = min($input[0], $input[1]);
$b = min($input[2], $input[3]);

$out->println($a + $b);

class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}
class Out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}

Measured memory_bytes: 4856
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                if (input[0] == 0) break;

                int sum = 0;
                bool flg = false;

                foreach (var n in input)
                {
                    if (n == 1) flg = true;

                    if (n > 10) sum += 10;
                    else sum += n;
                }

                if (flg && sum + 10 <= 21) sum += 10;
                sb.AppendLine(sum > 21 ? "0" : sum.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9264
import math
import sys
N = int(input())

min = sys.maxsize
for i in range(1,int(math.sqrt(N))+1):
    if N%i==0:
        A = str(i)
        B = str(N//i)
        
        ans = max(len(A),len(B))

        if ans < min:
            min = ans

print(min)


Measured memory_bytes: 3060
list_a = [1, 3, 5, 7, 8, 10, 12]
list_b = [4, 6, 9, 11]
list_c = [2]

x, y = map(int, input().split())
if (x in list_a and y in list_a) or (x in list_b and y in list_b) or (x in list_c and y in list_c):
  print('Yes')
else:
  print('No')

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

int main() {
  unsigned long long int a=100,x;
  cin >> x;
  for (int i=1; i<3761; i++){
    a += a/100;
    if (a >= x) {
    cout << i << endl;
      break;
    }
  }
}



Measured memory_bytes: 3636
#include <stdio.h>

int main(void){
    int i,n,x,t;
    scanf("%d %d %d",&n,&x,&t);

    if(n % x == 0){
        i = n / x;
    }else{
        i = (n / x) + 1;
    }

    printf("%d\n",i*t);


    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int a, b;
  cin >> a >> b;
  if(a >= 10 || b >= 10) cout << -1 << endl;
  else cout << a*b << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>
 
 
int main (void){
    
   int r,g,b;
   
   scanf("%d %d %d", &r, &g, &b);
   
   if((10*g+b)%4 == 0)
     printf("YES");
   else
     printf("NO");
    
    
    return 0;
    
}

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

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

void maxHeapify(int *h, int i, int n){
	int l,r,largest;
	
	l = i*2;
	r = i*2+1;
	
	if(l<=n && h[l-1] > h[i-1]){
		largest = l;
	}else{
		largest = i;
	}
	if(r<=n && h[r-1] > h[largest-1]){
		largest = r;
	}
	if(largest != i){
		swap(h+i-1,h+largest-1);
		maxHeapify(h,largest,n);
	}
}

void buildMaxHeap(int *h, int n){
	for(int i = n/2;i>=1;--i){
		maxHeapify(h,i,n);
	}
}

int main() {
	int n,*h;
	cin>>n;
	h = new int[n];
	for(int i=0;i<n;++i){
		cin>>h[i];
	}
	buildMaxHeap(h,n);
	for(int i=0;i<n;++i)cout<<" "<<h[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3132
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>

#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e10
#define EPS 1e-10
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

const int N = 1000000;

int a[N], b[N];

void gen() {
  memset(a, 37, sizeof(a));
  memset(b, 37, sizeof(b));
  a[0] = b[0] = 0;

  for (int i = 1, d = 1; d < N; ++i, d += i * (i + 1) / 2) {
    for (int j = d; j < N; ++j) {
      a[j] = min(a[j], a[j - d] + 1);
      if (d & 1)
	b[j] = min(b[j], b[j - d] + 1);
    }
  }
}

int main() {
  gen();

  int n;
  while (cin >> n && n)
    cout << a[n] << ' ' << b[n] << endl;

  return 0;
}

Measured memory_bytes: 8980
#include <bits/stdc++.h>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(int &f){
	f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
char s[DMAX];
int n,q;
int pre[DMAX];
int cnt=0;
int main(){
    read(n),read(q);
    scanf("%s",s+1);
    int ls=strlen(s+1);
    for(int i=2;i<=ls;i++){
        pre[i]=pre[i-1];
        if(s[i]=='C' && s[i-1]=='A'){
            pre[i]++;
        }
    }
//    for(int i=1;i<=ls;i++){
//        cout<<pre[i]<<" ";
//    }
//    cout<<endl;
    int x,y;
    for(int i=1;i<=q;i++){
        read(x),read(y);
        cout<<pre[y]-pre[x]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a + b - n) << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
S=input()

mojiretsu = []
for moji in S:
    ord_moji = ord(moji) + N
    # print("ord(moji):", ord(moji))

    # 65, 90
    # 90を超えるものは、65に90を超えた分を足していく。
    # ord_moji = ord(moji)
    while ord_moji > 90:
        ord_moji = 64 + (ord_moji - 90)
    
    mojiretsu.append(chr(ord_moji))

ans = ''.join(mojiretsu)

print(ans)

Measured memory_bytes: 3060
solveImpl :: [Int] -> Int -> Int
solveImpl arr number
    | arr == []           = number
    | tmpNumber == number = solveImpl (tail arr) (number+1)
    | otherwise           = solveImpl (tail arr) number
    where tmpNumber = head arr

solve :: [Int] -> Int
solve arr
    | ans == 1  = -1
    | otherwise = length arr - ans + 1
    where ans = solveImpl arr 1

main = do
    n <- getLine
    arr <- map read . words <$> getLine
    let ans = solve arr
    print ans


Measured memory_bytes: 68988
#include <stdio.h>

int main(void)
{
	int c[3], i, prob;
	
	while (scanf("%d%d%d", &c[0], &c[1], &c[2]) != EOF){
		prob = 0;
		
		for (i = 1; i <= 10; i++){
			if (i != c[0] && i != c[1] && i != c[2] && c[0] + c[1] + i <= 20){
				prob++;
			}
		}
		
		if (prob >= 4){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 580
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
//using namespace atcoder;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

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

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

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


// edit

void solve() {
    string s;
    cin >> s;
    if(s.back() == 's'){
        s += 'e';
    }
    s += 's';
    cout << s << endl;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 3136
// AOJ 2798: Taking a Seat
// 2017.10.8 bal4u@uu

#include <stdio.h>

char map[102][102];
char mk[102][102];
int mv[8][2] = {{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1}};

int main()
{
	int m, n, i, r, c, r2, c2, ans;

	scanf("%d%d", &m, &n);
	for (r = 0; r < m; r++) scanf("%s", map[r]);
	for (r = 0; r < m; r++) for (c = 0; c < n; c++) {
		if (map[r][c] == 'o') {
			mk[r][c] = 1;
			if (c > 0) mk[r][c-1] = 1;
			if (c < n-1) mk[r][c+1] = 1;
		} else if (map[r][c] == 'x') {
			mk[r][c] = 1;
			for (i = 0; i < 8; i++) {
				r2 = r + mv[i][0], c2 = c + mv[i][1];
				if (r2 >= 0 && r2 < m && c2 >= 0 && c2 < n) mk[r2][c2] = 1;
			}
		}
	}
	for (ans = 0, r = 1; r < m; r++) for (c = 0; c < n; c++) if (!mk[r][c]) ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1840
#include<bits/stdc++.h>
using namespace std;
int n;
int f(long long s, bool se, bool panj, bool haft){
	if(s > n)
		return 0;
	int ans = 0;
	if(se && panj && haft)
		ans ++;
	ans += f(s * 10 + 3, true, panj, haft);
	ans += f(s * 10 + 7, se, panj, true);
	ans += f(s * 10 + 5, se, true, haft);
	return ans;
}
int main(){
	cin >> n;
	cout << f(0, 0, 0, 0);
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    int all = 0;
    for(int i=1; i<=n; i++) {
    	if(i < 10) {
    		if(a<=i && i<=b) {
    			all += i;
    		}
    	}else if(i < 100) {
    		if(a <= i/10 + i%10	&&	i/10 + i%10	<=b) {				
    			all += i;
    		}
        }else if(i < 1000) {
        		if(a <= i/100 + (i%100)/10 + (i%10)	&& i/100 + (i%100)/10 + (i%10) <= b) {				
        			all += i;
        		}
        }else if(i < 10000) {
            	if(a <=	i/1000 + (i%1000)/100 + ((i%1000)%100)/10 +(i%10) && i/1000 + (i%1000)/100 + ((i%1000)%100)/10 +(i%10) <= b) {
            		all += i;
            	}
        }else {
        		if(a <= i/10000 + (i%10000)/1000 + (i%1000)/100 + ((i%1000)%100)/10  + i%10 && i/10000 + (i%10000)/1000 + (i%1000)/100 + ((i%1000)%100)/10  + i%10 <= b) {
        			all += i;
        	}
    }
    }
    	System.out.println(all);
      }
}

Measured memory_bytes: 35808
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
  unsigned long long a,c;
   long double b;
   cin>>a>>b;
   b=round(b*100);
   c=a*b;
   cout<<c/100<<endl;

    return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;
	cin >> n ;

	vector<ll>v;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			v.pb(i);
			if(i!=n/i)
				v.pb(n/i);
		}
	}
	v.pb(n);
	ll ans=0;
	for(auto it:v)
	{
		x=n;
		while(x%it==0)
			x/=it;
		if(x%it==1)
			ans++;		
	}

	n--;
	v.clear();
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			v.pb(i);
			if(i!=n/i)
				v.pb(n/i);
		}
	}
	if(n!=1)
		v.pb(n);
	ans+=sz(v);
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(){
    cin>>s>>t;
    string ans="";
    for(int i=0;i<s.size();i++){
        bool valid=1;
        for(int j=i,k=0;k<t.size();j++,k++){
            if(j>=s.size()||(s[j]!='?'&&s[j]!=t[k])){
                valid=0;
                break;
            }
        }
        if(valid){
            string cand=s;
            for(int j=i,k=0;k<t.size();j++,k++){
                cand[j]=t[k];
            }
            for(int j=0;j<cand.size();j++){
                if(cand[j]=='?')cand[j]='a';
            }
            if(ans==""||cand<ans)ans=cand;
        }
    }
    if(ans=="")cout<<"UNRESTORABLE\n";
    else cout<<ans<<"\n";
    return 0;
}

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

#define ll long long
#define rep(i,n) for(int i = 0;i < (n); i++)
#define mod 1000000007

int main() {
	ll n;
	cin >> n;
	ll x, y;
	ll ans;
	vector<ll> a(n);
	vector<ll> b(n);
	rep(i, n) {
		cin >> x >> y;
		a[i] = x + y;
		b[i] = x - y;
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	ans = max(a[n - 1] - a[0], b[n - 1] - b[0]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6412
a=input().split()
A=int(a[0])
B=int(a[1])
K=int(a[2])
ans=A
ans1=B-K+1
X0=A
X1=A+K-1
Y0=B
Y1=B-K+1

if(Y1<=X1):
  for i in range(B-A+1):
    if(i>0):
     ans=ans+1
    print(ans)
else:
  for i in range(K):
    if(i>0):
     ans=ans+1
    print(ans)
  for i in range(K):
    if(i>0):
     ans1=ans1+1
    print(ans1)
    

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
 int n,k,i,cnt=0;
  scanf("%d %d",&n,&k);
  if(n%2==0){
    n/=2;
  }else{
    n = n/2+1;
  }
  if(n>=k){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}

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


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

  for (int i = 0; i < N; i++) {
    for (int j = N-1; j > i; j--) {
      if (l[j-1] < l[j]) {
        int tmp = l[j];
        l[j] = l[j-1];
        l[j-1] = tmp;
      }
    }
  }

  int sum = 0;

  for (int i = 0; i < K; i++) {
    sum += l[i];
  }

  cout << sum << endl;

  return 0;
}

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

ll dlp(int i){
  ll k=1;
  for(int j=0;j<i;j++)
    k*=2;
  return k;
}

ll bg[50];
ll p=0;

void bgw(ll x,int n){
  x--; if(!x) return;
  if(x<bg[n-1]*2-1){
    bgw(x,n-1);
    return;
  }
  x-=(bg[n-1]*2-1); p+=bg[n-1]; if(!x) return;
  x--; p++; if(!x) return;
  if(x<bg[n-1]*2-1){
    bgw(x,n-1);
    return;
  }
  x-=(bg[n-1]*2-1); p+=bg[n-1]; if(!x) return;
  x--; return;
}

int main(){
  int X; cin>>X;
  for(int i=0;i<X;i++){
    bg[i]=dlp(i+1)-1; //バンズも含める時はbg[i]*2-1
  }
  ll N; cin>>N;
  bgw(N,X);
  cout<<p<<endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    a, b = inm()
    return "Even" if (a * b % 2 == 0) else "Odd"


print(solve())


Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define br                "\n"
#define ss                second
#define int               long long
#define pb                push_back
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type *arr=new type(n);
#define w(x)              int x; cin>>x; while(x--)
#define FOR(i,a,b)        for(int i=(a);i<(b);i++)
#define ROF(i,a,b)        for(int i=(a);i>=(b);i--)
#define so(a,n)           sort(a,a+n)
#define rso(a,n)          sort(a,a+n),reverse(a,a+n)
const                     int maxn=100010;
#define s(l)              s.length()

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input1.txt", "r", stdin);
  freopen("outp1.txt", "w", stdout);
#endif
}
void solve()
{

  int n;cin>>n;
  int a[n];
  //so(a,n);
  FOR(i,0,n)cin>>a[i];
  int counter=0;
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
    {
      for(int k=0;k<n;k++)
      {
         if((a[i]+a[j]>a[k] and (a[i]+a[k]>a[j] and a[j]+a[k]>a[i])) and (a[i]!=a[j] and (a[j]!=a[k] and a[i]!=a[k])))
          {
            if(i<j and (j<k and i<k))counter++;
            //cout<<i+1<<" "<<j+1<<" "<<k+1<<br;}
          }
      }
    }
  }
  cout<<counter;

}
int32_t main()
{
  c_p_c();
  //w(t)
  solve();

}




Measured memory_bytes: 3624
def kaibun(text):
	mid = len(text) // 2
	for i in range(mid):
		if text[i] != text[-1 * (i + 1)]:
			return False

	return True


if __name__ == '__main__':
	text = input()
	t_len = len(text)
	if kaibun(text) and kaibun(text[0:t_len // 2]):
		print('Yes')
	else:
		print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c,d;
ll gcd(ll x,ll y){
    return y==0?x:gcd(y,x%y);
}
int main(){
    int t,flag; cin>>t;
    while(t--){
	flag=0;
	cin>>a>>b>>c>>d;
	if (d<b) flag=1;
	if (a<b) flag=1;
	a-=a/b*b;
	if (a>c) flag=1;
	d-=(d/b-1)*b;
	if (gcd(d,b)<b-c) flag=1;
	if (flag) puts("No");
	else puts("Yes");
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = Sarray();Array.Sort(Ai);
            var Bi = Sarray();Array.Sort(Bi);
            var Ci = Sarray();Array.Sort(Ci);
            var ar = 0L;
            var cl = 0L;
            var sel = 0L;
            foreach (var b in Bi)
            {
                for (var i = ar; i < N && Ai[i] < b; ++i)
                    ++ar;
                for (var i = cl; cl < N && Ci[i] <= b; ++i)
                    ++cl;
                sel += ar * (N - cl);
            }
            WriteLine(sel);
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 47784
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<=b;++i)
#define repb(i,a,b) for(LL i=a;i>=b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL n, ans[10005];

int main()
{
	FIO;
	rep(i,1,10004) {
		if(i*i > 10001) break;
		rep(j,1,10004) {
			if(i*i + j*j > 10001) break;
			rep(k,1,10004) {
				LL val = i*i + j*j + k*k + i*j + j*k + k*i;
				if(val > 10001) break;
				ans[val]++;
			}
		}
	}
	cin >> n;
	rep(i,1,n) cout << ans[i] << "\n";
}

Measured memory_bytes: 3728
#include<cstdio>
#define int long long 
#define max(a,b)((a)>(b)?(a):(b))
const int N=3003;
int f[N][N],n,a[N];
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",a+i),f[i][0]=a[i];
	for(int k=1;k<n;k++)
	  for(int i=1;i+k<=n;i++)
		f[i][k]=max(a[i]-f[i+1][k-1],a[i+k]-f[i][k-1]);
	printf("%lld",f[1][n-1]);
	return 0;
}

Measured memory_bytes: 69888
#include<bits/stdc++.h>
using namespace std;
string s;
int main() {
	cin>>s;
	int n = s.size();
	int len = n - 7;
	for(int i = 0; i <= 7; i++) {
		string t = "";
		for(int j = 0; j < i; j++) {
			t += s[j];
		}
		for(int j = i + len; j < n; j++) {
			t += s[j];
		}
//		cout<<t<<endl;
		if(t == "keyence") {
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}
/*
keyofscience
Output:YES

mpyszsbznf
Output:NO

ashlfyha
Output:NO

keyence
Output:YES

keyencejerrydream
Output:YES

jerrydreamkeyence
Output:YES
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <cmath>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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 a[51] = {0};
ll p[51] = {0};

ll get_ans(int N, ll X){
    if(N == 0 && X == 1) return 1;
    if(X == 1) return 0;
    if(1 < X && X <= (1 + a[N-1])) return get_ans(N-1, X-1);
    if(X == (2 + a[N-1])) return p[N-1] + 1;
    if(X > (2 + a[N-1]) && X <= (2 + 2 * a[N-1])){
        return p[N-1] + 1 + get_ans(N-1, X-2-a[N-1]);
    }
    else{
        return 2 * p[N-1] + 1;
    }
}

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

    cin >> N >> X;

    a[0] = 1;
    p[0] = 1;
    for(int i = 1; i < 51; i++){
        a[i] = 2 * a[i-1] + 3;
        p[i] = 2 * p[i-1] + 1;
    }

    cout << get_ans(N, X) << endl;

    return 0;
}


Measured memory_bytes: 256
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

int n, k, mp[555], mpp[555];
vi v, q;
string s, t;

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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);


cin >> s >> t;

n = s.size()-1;
k = t.size()-1;

rep(i, 0, n){
    mp[s[i]]++;
}

rep(i, 0, k){
    mpp[t[i]]++;
}

rep(i, 96, 125){
    v.pb(mp[i]);
    q.pb(mpp[i]);
}

sort(all(v));
sort(all(q));

k = v.size()-1;

rep(i, 0, k){
    if(v[i]==q[i])continue;
    else {
        cout << "No" << endl;
        return 0;
    }
}

cout << "Yes" << endl;




return 0;}
///....


Measured memory_bytes: 916