akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.util.stream.*;

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int m = saori.saori_hayami();
		int num = 0;
		for(int i = 0;i < m;i++){
			num += saori.saori_hayami();
		}
		if(n < num){
			System.out.println(-1);
		} else {
			System.out.println(n-num);
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 33224
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int MAX_N = 1010;

int N, M;
int cnt[MAX_N];

int main() {
  cin >>N >>M;
  memset(cnt, 0, sizeof(cnt));
  REP(i, M){
    int s, t; cin >>s >>t;
    ++cnt[s];
    --cnt[t];
  }
  FOR(i, 1, MAX_N) cnt[i] += cnt[i - 1];
  int ans = 0;
  FOR(i, 1, N + 2) ans += (cnt[i] > 0 ? 3 : 1);
  cout <<ans <<endl;
  return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int mentu[16][3] = {
	{1,1,1},{2,2,2},{3,3,3},{4,4,4},{5,5,5},{6,6,6},{7,7,7},{8,8,8},{9,9,9},
	{1,2,3},{2,3,4},{3,4,5},{4,5,6},{5,6,7},{6,7,8},{7,8,9}
};

int main(){
	
	string str;
	
	while(true){
		
		int num[10], num_1[10], dummy[10];
		
		bool ans[10];
		
		cin >> str;
		if(cin.eof()){
			break;
		}
		
		for(int i = 0; i < 10; i++){
			num[i] = 0;
			ans[i] = false;
		}
		
		for(int i = 0; i < str.size(); i++){
			num[str[i] - '0']++;
		}
		
		for(int rest = 1; rest <= 9; rest++){
			for(int i = 0; i < 10; i++){
				num_1[i] = num[i];
			}
			
			if(num_1[rest] >= 4){
				continue;
			}else{
				num_1[rest]++;
			}
			
			for(int i = 0; i < 16; i++){
				for(int j = i; j < 16; j++){
					for(int k = j; k < 16; k++){
						for(int l = k; l < 16; l++){
							for(int m = 1; m <= 9; m++){
								
								for(int b = 1; b <= 9; b++){
									dummy[b] = 0;
								}
								
								for(int a = 0; a < 3; a++){
									dummy[mentu[i][a]]++;
									dummy[mentu[j][a]]++;
									dummy[mentu[k][a]]++;
									dummy[mentu[l][a]]++;
								}
								dummy[m] += 2;
								
								for(int b = 1; b <= 9; b++){
									if(num_1[b] != dummy[b]){
										break;
									}
									if(b == 9){
										ans[rest] = true;
									}
								}
								
							}
						}
					}
				}
			}
			/*
			cout << " ";
			
			for(int i = 1; i <= 9; i++){
				cout << dummy[i];
			}
			*/
			
		}
		
		int loop;
		
		bool found;
		
		found = false;
		
		for(loop = 1; loop <= 9; loop++){
			if(ans[loop]){
				cout << loop;
				found = true;
				break;
			}
		}
		
		for(loop = loop + 1; loop <= 9; loop++){
			if(ans[loop]){
				cout << " " << loop;
			}
		}
		
		if(!found){
			cout << "0";
		}
		cout << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin >> S;
    int n=S.size();
    rep(i,n){
        cout << 'x';
    }
    cout << endl;



}


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b)    for (int i = (a); i < (b); i++)
#define F0R(i, a)       for (int i = 0; i < (a); i++)
#define FORd(i, a, b)   for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a)      for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)      for (auto& a : x)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<typename T1, typename T2> istream& operator >>(istream& i, pair<T1, T2>& p) {
        i >> p.first >> p.second; return i;
    }
    template<typename T, size_t N> istream& operator >>(istream& i, array<T, N>& v) {
        for (auto& e : v) { i >> e; } return i;
    }
    template<typename T> istream& operator >>(istream& i, vector<T>& v) {
        for (auto& e : v) { i >> e; } return i;
    }
}
using namespace __input;

namespace __output {
    template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& t) {
        return o << "(" << t.first << ", " << t.second << ")";
    }
    template<typename T, size_t N> ostream& operator<<(ostream& o, const array<T, N>& a) {
        o << "["; for (int i = 0; i < N; i++) { if (i) o << ", "; o << a[i]; } return o << "]";
    }
    template<typename T> ostream& operator<<(ostream& o, const vector<T>& v) {
        o << "["; for (int i = 0; i < sz(v); i++) { if (i) o << ", "; o << v[i]; } return o << "]";
    }
}
using namespace __output;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    vi diff(N);
    cin >> diff;

    sort(all(diff));

    cout << diff[N/2] - diff[N/2 - 1] << endl;

    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#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 Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    int n,r;
    cin >> n >> r;
    if(n>=10){
        cout << r << endl;
    }
    else{
        int ans = r + 100*(10-n);
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    ll N, M;
    cin >> N >> M;

    ll a = 1900*M + 100*(N-M);

    ll b = 1LL<<M;

    ll ans = a*b;
    p(ans);
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair < ll, ll > PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e4+7;
ll gcd ( ll a, ll b) {
    if ( b > a ) swap(a, b);
    if ( a % b == 0 ) return b;
    return gcd(b, a % b);
};
int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) {
        int tmp_a;
        cin >> tmp_a;
        if ( tmp_a == k ) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
        a[i] = tmp_a;
    }
    if ( n == 1 ) {
        if ( a[0] != k ) {
            cout << "IMPOSSIBLE" << endl;
        }
        else {
            cout << "POSSIBLE" << endl;
        }
        return 0;
    }
    sort(a.begin(), a.end());
    ll gcd_num = a[0];
    rep(i, n-1) gcd_num = gcd(gcd_num, a[i+1]);
    if ( k % gcd_num == 0 && k <= a[n-1] ) {
        cout << "POSSIBLE" << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


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

int main() {
  LL N, K;
  cin >> N >> K;
  LL ret = 0, MOD = 1000000007;
  for(LL i=K; i<=N+1; ++i) {
    LL tmin = i * (i - 1) / 2;
    LL tmax = i * (N * 2 - i + 1) / 2;
    ret += tmax - tmin + 1;
    ret %= MOD;
  }
  cout << ret << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <vector>
using namespace std;
const int maxx = 100010;
int n, m;
int u, num, v;
int flag[maxx];
int color[maxx];
vector<int> G[maxx];

int c = 1;
void dfs(int t) {
    stack<int>s;
    s.push(t);
    color[t] = c;
    while (!s.empty()) {
        int u = s.top(); s.pop();
        int len = G[u].size();
        for (int i = 0; i < len; i++) {
            int v = G[u][i];
            if (flag[v] == 0) {
                color[v] = c;
                flag[v] = 1;
                s.push(v);
            }
        }
    }
}
int main()
{
    int q;
    memset(flag, 0, sizeof(flag));
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++) {
        scanf("%d %d", &u, &v);
        //将顶点v添加到G[u]数组中
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for (int i = 0; i < n; i++) {
        if (flag[i] == 0) {
            dfs(i);
            c++;
        }
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%d %d", &u, &v);
        if (color[u] == color[v]) {
            printf("yes\n");
        }
        else {
            printf("no\n");
        }
    }
    return 0;
}


Measured memory_bytes: 9440
#!/usr/bin/env python3
import sys


def solve(N: int, S: str):
    ans = 0
    for i in range(2, N):
        if S[i-2] == "A" and S[i-1] == "B" and S[i] == "C":
            ans += 1
    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    ll n,len = 1,sum = 26;
    string ans = "";
    cin>>n;
    while(true){
        if(sum >= n)break;
        else{
            len++;
            sum +=pow(ll(26),len); 
        }
    }
    rep(i,len){
        ll tmp = n % 26 - 1;
        if(tmp < 0)tmp = 25;
        if(n%26 == 0)n--;
        n = n / 26;
        char ch = 'a' + tmp;
        ans  = ch + ans;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+10;
int n,mod=1e9+7;
ll arr[N],arr2[N];
bool found[N]={};
ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}


int main()
{
    ll cnt[1000]= {};
    bool primes[1005];
    int n = 1000;
    memset(primes, true, sizeof primes);
    for(int i = 2; i*i <= n; i++)
    {
        if(primes[i])
        {
            for(int j = i*i; j <= n; j += i)
                primes[j] = false;
        }
    }
    vector<int>v;
    ll ans=1,aa;
    cin>>aa;
    for(int i=0; i<aa; i++)
    {
        cin>>arr[i];
        arr2[i]=arr[i];
    }

    for(int i = 2; i <= n; i++)
    {
        if(primes[i])
            v.push_back(i);
    }
//cout<<v.size();
    ll lcm=1;
    for(int i=0; i<v.size(); i++)
    {
        for(int j=0; j<aa; j++)
        {
            ll k=0;
            while(arr[j]%v[i]==0)
            {
                found[arr[j]]=1;
                k++;
                arr[j]/=v[i];
            }
            cnt[i]=max(k,cnt[i]);
        }

        lcm*=fp(v[i],cnt[i]);
        lcm%=mod;

    }
    for(int i=0;i<aa;i++){
        if(!found[arr[i]]){
            lcm*=arr[i];
            found[arr[i]]=1;
            lcm%=mod;
        }
    }
    //cout<<lcm<<endl;

    ll answer=0;

    for(int i=0; i<aa; i++)
    {
        answer+=(lcm*fp(arr2[i],mod-2))%mod;
        answer%=mod;
        //ans%=mod;
    }
    cout<<answer;
    return 0;
}


Measured memory_bytes: 3328
function main(input) {
    const args = input.split(' ');
    let a = parseInt(args[0], 10);
    let b = parseInt(args[1], 10);
    let c = parseInt(args[2], 10);
    let d = parseInt(args[3], 10);

    for (let i = 0; i <= 100; i++) {
        c -= b;
        if (c <= 0) {
            console.log('Yes');
            break
        }
        a -= d;
        if (a <= 0) {
            console.log('No');
            break
        }
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29568
#include<stdio.h>
#include<math.h>

struct Point{ double x, y; };

void koch(int n,Point a,Point b){
	if (n == 0){
		return;
	}
	Point s, t, u;
	double th = M_PI * 60 / 180;
	s.x = (2.0*a.x + 1.0*b.x) / 3.0;
	s.y = (2.0*a.y + 1.0*b.y) / 3.0;
	t.x = (1.0*a.x + 2.0*b.x) / 3.0;
	t.y = (1.0*a.y + 2.0*b.y) / 3.0;
	u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
	u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;
	koch(n - 1, a, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, b);
}

int main(){
	Point a, b;
	int n;
	scanf("%d", &n);
	a.x = 0;
	a.y = 0;
	b.x = 100.0;
	b.y = 0;
	printf("%.8f %.8f\n",a.x,a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);
	return 0;

}

Measured memory_bytes: 2724
#include<stdio.h>
int main(void){
  int a,b,k;
  int min,max;
  scanf("%d %d %d",&a,&b,&k);
  int num1=a+k-1;
  int num2=b-k+1;
  int num3=a+k;
  if(b>=num1){
    min=num1;
  }else if(b<=num1){
    min=b;
  }
  if(num2>=num3){
    max=num2;
  }else if(num2<=num3){
    max=num3;
  }
  for(int loop=a;loop<=min;loop++){
    printf("%d\n",loop);
  }
  for(int loop=max;loop<=b;loop++){
    printf("%d\n",loop);
  }
  return 0;
}

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

using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a))
#define mp make_pair
#define All(a) (a).begin(), (a).end()
template <typename T=long long>
inline T IN(){T x; cin>>x; return(x);}
inline void CIN(){}
template <class Head,class... Tail>
inline void CIN(Head&& head,Tail&&... tail){
    cin>>head;
    CIN(move(tail)...);
}
#define CINT(...) int __VA_ARGS__;CIN(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CIN(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CIN(__VA_ARGS__)
#define Yes(a) cout<<(a?"Yes":"No")<<"\n"
#define YES(a) cout<<(a?"YES":"NO")<<"\n"
 
typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int,V,greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int N;
vector<ll> A;

int main(){
	cin>>N;
	A.resize(N);
	REP(i,N) cin>>A[i];
	int r=0;
	ll sum=0,count=0;
	REP(l,N){
		while(r<N && (sum^A[r])==sum+A[r]){
			sum+=A[r++];
		}
		count+=r-l;
		if(l==r)  r++;
		sum-=A[l];
	}
	cout<<count<<"\n";
	return 0;
}

Measured memory_bytes: 1792
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
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; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main(void){
    double r;
    cin >>r;
    printf("%.4Lf\n",r*2*PI);
    return 0;
}

Measured memory_bytes: 3788
from collections import deque


def solve():
    H, W = map(int, input().split())
    p_black = 0
    maze = [[3000 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        line = input()
        for j in range(W):
            if line[j] == '#':
                maze[i][j] = -1
                p_black += 1
    maze[0][0] = 0
    
    move = [[-1, 0], [0, 1], [1, 0], [0, -1]]
    que = deque([[0, 0]])
    white = 1
    while que:
        cy, cx = que.popleft()
        if cy == H - 1 and cx == W - 1:
            white += maze[H - 1][W - 1]
            break
        
        for i in range(4):
            ny = cy + move[i][0]
            nx = cx + move[i][1]
            if 0 <= ny <= H - 1 and 0 <= nx <= W - 1:
                if maze[ny][nx] == 3000:
                    maze[ny][nx] = maze[cy][cx] + 1
                    que.append([ny, nx])
    
    if white == 1:
        print(-1)
    else:
        ans = H * W - p_black - white
        print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3316
import math

x, y, angle = 0, 0, 90

while True:

  d, a = map(int, raw_input().split(","))

  if d == 0 and a == 0:
    break

  x += math.cos(math.radians(angle)) * d
  y += math.sin(math.radians(angle)) * d

  angle -= a

print int(x)
print int(y)

Measured memory_bytes: 6624
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;



int main(){FIN

    ll x,y,z,k; cin>>x>>y>>z>>k;
    vll a(x), b(y), c(z);

    REP(i,x) cin>>a[i]; REP(i,y) cin>>b[i]; REP(i,z) cin>>c[i];
    VSORTR(a); VSORTR(b); VSORTR(c);
    using T = tuple<ll,ll,ll,ll>;
    priority_queue<T> q;
    set<T> st;
    q.emplace(a[0]+b[0]+c[0], 0,0,0);

    REP(i,k){
        T tup = q.top();
        ll val = get<0>(tup);
        ll i1 = get<1>(tup);
        ll i2 = get<2>(tup);
        ll i3 = get<3>(tup);
        cout<<val<<endl;
        q.pop();
        
        T nx1, nx2, nx3;
        if(i1+1<x) nx1 = make_tuple(a[i1+1]+b[i2]+c[i3], i1+1,i2,i3);
        if(i2+1<y) nx2 = make_tuple(a[i1]+b[i2+1]+c[i3], i1,i2+1,i3);
        if(i3+1<z) nx3 = make_tuple(a[i1]+b[i2]+c[i3+1], i1,i2,i3+1);

        if(!st.count(nx1)){
            st.insert(nx1);
            q.push(nx1);
        }

        if(!st.count(nx2)){
            st.insert(nx2);
            q.push(nx2);
        }

        if(!st.count(nx3)){
            st.insert(nx3);
            q.push(nx3);
        }
  
    }

    return 0;
}

Measured memory_bytes: 1152
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			int y = sc.nextInt();
			double max = 0;
			int ans = 0;
			
			int b, t;
			double r, temp;
			for(int i=0;i<n;i++){
				b = sc.nextInt();
				r = sc.nextDouble();
				t = sc.nextInt();
				if(t==1){
					temp = 1+(double)y*r*0.01;
				}else{
					temp = Math.pow((1+r*0.01), y);
				}
				if(temp>max){
					max = temp;
					ans = b;
				}
			}
			System.out.println(ans);
		}
	}	
}

Measured memory_bytes: 50248
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 = new int[n];
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0 ; i < n ; i++) {
			if(i == a[a[i] - 1] - 1) {
				ans++;
			}
		}
		System.out.println(ans / 2);
	}
}


Measured memory_bytes: 50924
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int W, H, N;
	cin >> W >> H >> N;
	int xl=0, xr=W, yd=0, yu=H;
	rep(i,N){
		int x, y, a;
		cin >> x >> y >> a;
		if(a==1) xl=max(xl,x);
		if(a==2) xr=min(xr,x);
		if(a==3) yd=max(yd,y);
		if(a==4) yu=min(yu,y);
	}
	int X=max(0,xr-xl), Y=max(0,yu-yd);
	cout << X*Y << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#include <assert.h>
#define FOR(i,a,n) for(i=(a);i<(n);i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
//#define LOCAL
#ifdef LOCAL
    #define DEBUG(...) printf(" "__VA_ARGS__)
#else
    #define DEBUG(...)
#endif /* LOCAL */
typedef struct{
	int t,num;
}City;
int comp(const void* a,const void* b){
	return ((City*)a)->t - ((City*)b)->t;
}
int d[51];
City city[101];
int used[51];
int n;
int check(int s){
	int now,cnt,id,diff,i,j;
	FOR(i,0,24){
		city[0].t=i,city[0].num=0;
		FOR(j,1,n+1){
			city[j*2-1].t=(i+d[j])%24; city[j*2-1].num=j;
			city[j*2].t=(i-d[j]+24)%24; city[j*2].num=j;
		}
		qsort(city,2*n+1,sizeof(City),comp);
		memset(used,0,sizeof(used));
		cnt=0; now=city[0].t+s;
		used[city[0].num]=1;
		FOR(j,1,2*n+1){
			if(city[j].t<now) continue;
			if(!used[city[j].num]){
				used[city[j].num]=1;
				cnt++; id=j;
				now=city[j].t+s;
			}
		}
		if(cnt==n){
			diff=city[id].t-city[0].t;
			if(MIN(diff,24-diff)>=s) return 1;
		}
	}
	return 0;
}
int main(void)
{
	int left,right,mid,i;
	scanf("%d",&n);
	FOR(i,1,n+1) scanf("%d",d+i);
	DEBUG("%d\n",check(4));
	left=0,right=13;
	while(right-left>1){
		mid=(left+right)/2;
		if(check(mid)) left=mid;
		else right=mid;
	}
	printf("%d\n",left);
	return 0;
}
    
    


Measured memory_bytes: 128
// C - Many Medians
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N; cin>>N;
	vi X(N), Y(N);
	rpz(i, N){ cin>>X[i]; Y[i] = X[i]; }
	sort(all(Y));
	int y1 = Y[N/2], y2 = Y[N/2-1];
	rpz(i, N) cout<< (X[i]<y1? y1: y2) <<endl;
}

Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>

using namespace std;
typedef long long ll;

int num;

void dfs(int n, vector<vector<int>> &d, vector<int> &k, vector<int> &day) {
	if (k[n] == num - 1)
		return;
	int a = d[n][k[n]];
	if (k[a] == num - 1)
		return;
	if (d[a][k[a]] == n) {
		day[n] = max(day[n], day[a]) + 1;
		day[a] = day[n];
		k[n]++;
		k[a]++;
	}
	else
		return;
	dfs(n, d, k, day);
	dfs(a, d, k, day);
	return;
}


int main(void) {
	int i, j, ans = 0;
	cin >> num;
	vector<vector<int>> d(num, vector<int>(num - 1));
	vector<int> day(num, 0), k(num, 0);
	for (i = 0; i < num; i++) {
		for (j = 0; j < num - 1; j++) {
			scanf("%d", &d[i][j]);
			d[i][j]--;
		}
	}
	for (i = 0; i < num; i++)
		dfs(i, d, k, day);
	for (i = 0; i < num; i++) {
		if (k[i] < num - 1) {
			printf("-1\n");
			return 0;
		}
		ans = max(ans, day[i]);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 27520
#include<stdio.h>
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int i;
	int p[1003];
	for (i = 0; i < n; i++)
		scanf("%d", &p[i]);
	for (i = 0; i < n - 1; i++)
	{
		if (p[i] > p[i + 1])
		{
			p[i] ^= p[i + 1];
			p[i + 1] ^= p[i];
			p[i] ^= p[i + 1];
			if (i > 0)
				i -= 2;
		}
	}
	int ans = 0;
	for (i = 0; i < k; i++)
		ans += p[i];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <type_traits>
#include <map>

using namespace std;


int main(int argc, const char * argv[]) {
  int a, b, c;
  int ar, br, cr;
  cin >> a >> b >> c;
  ar = a%2;
  br = b%2;
  cr = c%2;
  int cnt = 0;
  if(ar == 0 && br == 0 && cr == 0){}
  else if(ar == 0 && br == 0 && cr == 1){a++;b++; cnt++;}
  else if(ar == 0 && br == 1 && cr == 0){a++;c++; cnt++;}
  else if(ar == 1 && br == 0 && cr == 0){b++;c++; cnt++;}
  else if(ar == 1 && br == 1 && cr == 0){a++;b++; cnt++;}
  else if(ar == 1 && br == 0 && cr == 1){a++;c++; cnt++;}
  else if(ar == 0 && br == 1 && cr == 1){b++;c++; cnt++;}
  int m = max(a,max(b,c));
  cnt += (m - a)/2 + (m - b)/2 + (m - c)/2;
  cout << cnt << endl;
  return 0;
}


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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
    int a,b,c;cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    map<ll,ll> mp;
    for(int i = 0; i < N;i++){
        ll a; cin >> a;
        mp[a-1]++; mp[a]++; mp[a+1]++;
        res = max({res,mp[a-1],mp[a],mp[a+1]});
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 6144
# coding: utf-8
# Your code here!

s=input()
Y=int(s[0:4])
M=int(s[5:7])

if Y>2019:
    print('TBD')
    exit()
elif Y==2019:
    if M>4:
        print('TBD')
        exit()
    else:
        print('Heisei')
        exit()
    
else:
    print('Heisei')

    

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
vector<P> graph[100010];
vector<ll> dist;
void dfs(int from, int to, ll cost){
    for(auto p:graph[to]){
        int next = p.first;
        int c = p.second;
        if(from == next)continue;
        dist[next] = cost + c;
        dfs(to, next, cost + c);
    }
}
main(){
    int N;
    cin >> N;
    rep(i,0,N-1){
        int a,b,c;
        cin >> a >> b >> c;
        a--,b--;
        graph[a].emplace_back(b,c);
        graph[b].emplace_back(a,c);
    }
    int Q,K;
    cin >> Q >> K;
    dist.resize(N);
    dfs(-1,K-1,0);
    rep(i,0,Q){
        int a,b;
        cin >> a >> b;
        cout << dist[a-1] + dist[b-1] << endl;
    }
}

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

int main(){
  int N, K; cin >> N >> K;
  vector<int> h(N);
  for(int i = 0; i < N; i++) cin >> h[i];
  sort(h.begin(), h.end());
  int ans = 1e9+7;
  for(int i = 0; i <= N - K; i++){
    ans = min(ans, h[i + K - 1] - h[i]);
  } 
  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		// TODO ABC_085_C
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int Y = sc.nextInt();
		// Scannerクラスのインスタンスをクローズ
		sc.close();

		int maiX=0, maiY=0, maiZ=0;
		int kaiX=-1, kaiY=-1, kaiZ=-1;


		for(maiX = 0; maiX <= N; maiX++) {
			if(kaiX != -1) {
				break;
			}
			if(maiX * 10000 > Y) {
				break;
			}

			for(maiZ = 0; maiX + maiZ <= N; maiZ++) {

				maiY = N - (maiX + maiZ);
				if(maiX * 10000 + maiY * 5000 + maiZ * 1000 == Y) {
					kaiX = maiX;
					kaiY = maiY;
					kaiZ = maiZ;
					break;
				}
			}
		}

		System.out.println(kaiX + " " + kaiY + " " + kaiZ);
	}
}


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

int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end());
    cout << vec[N-1] - vec[0] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define cout (cout << setprecision(12))

int main() {
    ll n, k;
    cin >> n >> k;

    ll q = n / k;
    ll r = n % k;

    ll r2 = abs(k - r);

    cout << min(r, r2) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long rui(long long n, long long k, long long p) {
	if (k == 0) {
		return 1;
	}
	else {
		long long a = rui(n, k / 2, p);
		if (k % 2 == 0) {
			return (a*a) % p;
		}
		return (((a*a) % p)*n) % p;
	}
}
int main(){
	int h, w, x, y;
	cin >> h >> w >> x >> y;
	if (h*w*(x + y) % 2 == 1) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}


Measured memory_bytes: 3124
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    
    int a=sc.nextInt();
    String s=sc.next();
    int b=sc.nextInt();
    if(s.equals("+")){
      System.out.println(a+b);
    }else{
      System.out.println(a-b);
    }
    
  }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main(){
    map<char , char>ans;
	ans['A'] = 'T';
	ans['C'] = 'G';
	ans['T'] = 'A';
	ans['G'] = 'C';
	char b;
	while( cin >> b ) cout<<ans[b]<<'\n';
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

ii2(a,b);
cout << a*b << endl;

return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
using namespace std;

int main() {
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int n, m, k,a[200005],L[200001], R[200001],res=0,now=0;
	long long int sum=0;
	cin >> n >> m;
	cout << (3*n+m)/2;

}


Measured memory_bytes: 256
N=int(input())
k=2
while N>=(k-1)*k/2:
    if N==(k-1)*k/2:
        print("Yes")
        print(k)
        a=list([] for i in range(k))
        t=1
        for i in range(0,k):
            for n in range(1,k-i):
                a[i].append(t)
                a[i+n].append(t)
                t+=1
        for i in range(k):
            print(str(k-1)+" "+" ".join(map(str,a[i])))
        exit()
    else:
        k+=1
print("No")


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

int main()
{
    int n = 0, max_height = 0;
    long long sum = 0;

    cin >> n;

    vector<int> a(n);

    for(int i = 0 ; i < n; i++)
    {
        cin >> a.at(i);
    }

    for(int i = 0; i < n; i++)
    {
        max_height = max(a.at(i),max_height);
        sum += max_height - a.at(i);
    }

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

Measured memory_bytes: 3964
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#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;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
   uniform_int_distribution<int> uid(l, r);
   return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

void solve() {
  int n, k; cin >> n >> k;
  vector <int> v(n);
  for(int i = 1; i <= n; i++) cin >> v[i-1];
  sort(all(v));
  int ans = 0;
  for(int i = 0; i < k; i++) ans += v[i];
  cout << ans << '\n';
}

signed main() {   
   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
   int t = 1;  //cin >> t;
   for(int i = 1; i <= t; i++) {
      solve();
  }
}    


Measured memory_bytes: 3664
#include <iostream>

using namespace std;

int main()
{
    int N,A,B;
    scanf("%d%d%d",&N,&A,&B);

    if(N == 1)
    {
        if(A == B)
            printf("1\n");
        else
            printf("0\n");
    }
    else
    {
        if(A>B)
            printf("0\n");
        else
            printf("%lld\n",(long long)(B-A)*(N-2)+1);

    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define DP_LEN (1<<(5+7+5))
#define MOD 1000000007



typedef long long ll;

int n,x,y,z;
int mask,mask2,target;

int dpA[DP_LEN];
int dpB[DP_LEN];
int *dp1 = dpA, *dp2 = dpB;
int ans = 0;

int main(){
	cin >> n >> x >> y >> z;
	mask = (1<<(x+y+z))-1;
	mask2 = mask>>1;
	
	target   = 1;
	target <<= x-1;
	
	target <<= 1;
	target  += 1;
	target <<= y-1;
	
	target <<= 1;
	target  += 1;
	target <<= z-1;
	
	dp1[0] = 1;
	for(int i = 0;i < n;i++){
		swap(dp1, dp2);
		for(int k = 0;k <= mask2;k++){
			dp1[k] = 0;
		}
		
		ans = (((ll)ans) * 10ll) % MOD;
		for(int a = 1;a <= 10;a++){
			for(int k = 0;k <= mask2;k++){
				int kk = k;
				kk <<= 1;
				kk  += 1;
				kk <<= a-1;
				if((kk & target) == target){
					ans += dp2[k];
					ans %= MOD;
				}else{
					dp1[kk & mask2] += dp2[k];
					dp1[kk & mask2] %= MOD;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(n, k);
    vector<int> data(0);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        Int(tmp);
        if (tmp < k) {
            data.pb(tmp);
            sum += tmp;
        }
    }
    if (sum < k) {
        cout << data.size() << endl;
        return 0;
    }

    sort(all(data)); reverse(all(data));

    vb dp(k, false);
    dp[0] = true;
    rep(i, data.size()-1) {
        for (int j = dp.size()-1; j >= 0; j--) {
            if (dp[j] && j + data[i] < dp.size()) {
                dp[j + data[i]] = true;
            }
        }
    }
    bool ok = false;
    for (int i = k - data.back(); i < k; i++) {
        ok |= dp[i];
    }
    if (ok) {
        cout << 0 << endl;
        return 0;
    }

    int l = 0, r = data.size();
    while (r - l > 1) {
        int mid = (r + l) / 2;
        dp = vb(k, false);
        dp[0] = true;
        rep(i, data.size()) {
            if (i == mid) continue;
            for (int j = dp.size()-1; j >= 0; j--) {
                if (dp[j] && j + data[i] < dp.size()) {
                    dp[j + data[i]] = true;
                }
            }
        }
        bool ok = false;
        for (int i = k - data[mid]; i < k; i++) {
            ok |= dp[i];
        }
        if (ok) {
            l = mid;
        } else {
            r = mid;
        }
    }

    cout << data.size() - l - 1 << endl;

    return 0;
}



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

int main()
{
    int x,a,b,c;
    while(cin>>a>>b>>c>>x){
        x/=50;
        int sum=0;
        for(int i=0;i<=a;i++){
            for(int j=0;j<=b;j++){
                for(int k=0;k<=c;k++){
                    if(i*10+j*2+k==x) sum++;
                }
            }
        }
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 256