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

typedef double lf;
typedef long long ll;

ll sum(ll val) {
    ll ret = 0;
    while(val) ret += val % 10, val /= 10;
    return ret;
}

int K;

int main() {
    cin >> K;

    ll cur = 1;
    ll p = 1;
    lf mx = 0;
    while(K) {
        ll s = sum(cur);
        ll r = (cur + s - 1) / s;
        if(r > p) {
            while(r > p) p *= 10;
            cur = (cur + p) / p * p - 1;
        }

        printf("%lld\n", cur);
        K--;
        cur += p;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using B = bitset<4000>;
using ll = long long;
string str; 
ll N, ans, dp[4000];
constexpr ll M{ 998244353 };
B bit_gcd(B a, B b) {
    if(a == B{}) return b;
    int msb_a{}, msb_b{};
    for(int i{}; i < 4000; ++i) {
        if(a.test(i)) msb_a = i;
        if(b.test(i)) msb_b = i;
    }
    b ^= a << (msb_b - msb_a);
    return bit_gcd(b, a);
}
int main() {
    dp[0] = 1;
    for(int i{ 1 }; i < 4000; ++i) dp[i] = dp[i - 1] * 2 % M;
    cin >> N >> str;
    B X(str), x, a;
    vector<B> v;
    for(int i{}; i < N; ++i) {
        cin >> str;
        v.emplace_back(str);
    }
    a = v.front();
    for(auto& b : v) {
        if(a == b) continue;
        for(int i{ 3999 }; i >= 0; --i) {
            if(a.test(i) && !b.test(i)) {
                swap(a, b);
                break;
            }
            if(!a.test(i) && b.test(i)) break;
        }
        a = bit_gcd(a, b);
    }
    int msb_X{}, msb_a{};
    for(int i{}; i < 4000; ++i) {
        if(X.test(i)) msb_X = i;
        if(a.test(i)) msb_a = i;
    }
    for(int i{ msb_X }; i >= msb_a; --i) {
        if(X.test(i)) ans = (ans + dp[i - msb_a]) % M;
        if(X.test(i) ^ x.test(i)) x ^= a << (i - msb_a);
    }
    ans = (ans + 1) % M;
    for(int i{ msb_a }; i >= 0; --i) {
        if(X.test(i) && !x.test(i)) break;
        if(!X.test(i) && x.test(i)) { --ans; break; }
    }
    cout << ans << endl;
}


Measured memory_bytes: 16128
import sys
num = input()
 
hon_num_list = ["2", "4", "5", "7", "9"]
pon_num_list = ["0", "1", "6", "8"]
bon_num_list = ["3"]
 

if num[-1] in hon_num_list:
  print("hon")
elif num[-1] in pon_num_list:
  print("pon")
elif num[-1] in bon_num_list:
  print("bon")

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

int main() {
	static long long N, W, w, v, DP[110][100010] = {}, ans = 100000;
	cin >> N >> W;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= 100000; j++) {
			DP[i][j] = 1000000000000000000;
		}
	}
	DP[0][0] = 0;
	for (int i = 1; i <= N; i++) {
		cin >> w >> v;
		for (int j = 0; j <= 100000; j++) {
			if (j >= v) DP[i][j] = min(DP[i - 1][j], DP[i - 1][j - v] + w);
			else DP[i][j] = DP[i - 1][j];
		}
	}
	while (DP[N][ans] > W) ans--;
	cout << ans;
}

Measured memory_bytes: 80128
def dfs(i,step,remain):
    if remain<0 or step<0 or i<-1:return 0
    if remain==0 and step==0:return 1
    return dfs(i-1,step-1,remain-i)+dfs(i-1,step,remain)
while True:
    n,s=map(int,raw_input().split())
    if(n==0 and s==0):break
    print dfs(9,n,s)
    

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

int main()
{
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  
  int a, b, c, res=0;
  for (a = 0; a <= A; a++) {
    for (b = 0; b <= B; b++) {
      for (c = 0; c <= C; c++) {
        if (X == a*500 + b*100 + c*50) res++;
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  bool j;
  j = 0;
  for (int i=0; i< 3; i++){
    if (N % 10 == 7) {
      j = 1;
    }
    N /= 10;
  }
  if (j == 1){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3620
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int x = Integer.parseInt(in.next());
            int n = Integer.parseInt(in.next());

            if (n == 0) {
                out.println(x);
                return;
            }
            int[] p = new int[n];
            for (int i = 0; i < n; i++) {
                p[i] = Integer.parseInt(in.next());
            }
            Arrays.sort(p);
            int ans = Integer.MAX_VALUE;
            boolean ng = false;
            Map<Integer, Integer> mp = new TreeMap<>();
            for (int i = 101; i >= 0; i--) {
                for (int j = 0; j < n; j++) {
                    if (i == p[j]) {
                        ng = true;
                        break;
                    }
                }
                if (!ng) {
                    int tmp = Math.abs(x - i);
                    mp.put(tmp, i);
                }
                ng = false;

            }

            // 出力
            for (Integer val : mp.values()) {
                out.println(val.toString());
                return;
            }
        }

    }
}



Measured memory_bytes: 35936
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())
coords = []
for i in range(N):
    x, y = map(int, input().split())
    coords.append((x, y))
coords.sort()


def solve():
    minarea = 1 << 62
    for t in range(N):
        _, yt = coords[t]
        for b in range(N):
            _, yb = coords[b]
            if yb < yt:
                continue
            h = yb - yt
            xs = []
            for i in range(N):
                xi, yi = coords[i]
                if yi < yt or yi > yb:
                    continue
                xs.append(xi)
            for i in range(K - 1, len(xs)):
                w = xs[i] - xs[i - K + 1]
                a = w * h
                minarea = min(minarea, a)
    return minarea


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 41840
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  t,x = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  print(t/x)

if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}

int main(void){
    vector<int> cnt(4);
    for (int i = 0; i < 3; i++) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        cnt[a]++;
        cnt[b]++;
    }
    sort(cnt.begin(), cnt.end());
    if (cnt[0] == 1 && cnt[2] == 2 && cnt[0] == cnt[1] && cnt[2] == cnt[3]) {
        puts("YES");
    }
    else {
        puts("NO");
    }
    return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
 
 
ll mod = 1000000007;
ll fact[101010];
ll sum[101010];
ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
 
	ll N;
	cin >> N;
	vector<ll>x(N);
	for (ll i = 0; i < N; i++)cin >> x[i];
	for (int i = 0; i < N; i++) {
		sum[i + 1] = sum[i] + x[i];
		sum[i + 1] %= mod;
	}
	fact[0] = 1;
	for (ll i = 1; i < 101010; i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= mod;
	}
 
 
	ll ans = 0;
	for (ll k = 2; k < N; k++) {
		ll temp = modpow((k*(k-1LL)%mod),mod-2);
		temp %= mod;
		temp *= (((sum[N-1] - sum[k-1]) - (sum[N-k]-sum[0]) + 20LL * mod))%mod;
		temp %= mod;
		ans += temp;
		ans %= mod;
	}
	for (ll k = 2; k <= N; k++) {
		ll temp = modpow(k-1,mod-2);
		temp %= mod;
		temp *= (x[N-1]-x[N-k]);
		temp %= mod;
		ans += temp;
		ans %= mod;
	}
	puts((fact[N-1]*ans)%mod);
 
	return 0;
}

Measured memory_bytes: 2560
#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>

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

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


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


int main() {
    int x,y,z;
    cin >> x >> y >> z;
    rep(i,0,10000000){
        if(x < y * (i-1) + z * i){
            cout << i - 2 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC131C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            long A = long.Parse(input[0]);
            long B = long.Parse(input[1]);
            long C = long.Parse(input[2]);
            long D = long.Parse(input[3]);

            long lcm = LCM(C, D);

            long AC = (A-1) / C;
            long AD = (A-1) / D;
            long A_lcm = (A-1) / lcm;
            long BC = B / C;
            long BD = B / D;
            long B_lcm = B / lcm;

            long ans =  B-(BC + BD - B_lcm)-(A-1-(AC + AD - A_lcm));
            Console.WriteLine(ans);
        }
        // Least Common Multiple　最小公倍数
        static long LCM(long a, long b)
        {
            return a * b / GCD(a, b);
        }
        // Greatest Common Divisor 最大公約数
        // ユークリッドの互除法
        static long GCD(long a, long b)
        {
            if (b == 0)
            {
                return a;
            }
            else
            {
                return GCD(b, a % b);
            }
        }
    }
}


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

int main(){
	int n, a, ans, eqCount;
	vector<int> foo1, foo2;

	while( cin >> n , n ){
		ans = 0;
		foo1.clear();
		for(int i=0 ; i<n ; i++){
			cin >> a;
			foo1.push_back(a);
		}
		while( foo1 != foo2 ){
			ans++;
			foo2.clear();
			for(int i=0 ; i<foo1.size() ; i++){
				a = count( foo1.begin() , foo1.end() , foo1.at(i) );
				foo2.push_back(a);
			}
			swap( foo1 , foo2 );
		}
		cout << (ans-1) << endl;
		for(int i=0 ; i<foo2.size() ; i++){
			cout << foo2[i];
			( i == foo2.size()-1 )? cout << endl : cout << " " ;
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

ll n, k;
ll a[5005];
ll dp[5005][5005];
ll ans = 0;

int main() {

    cin >> n >> k;
    for (ll i = 1; i <= n; i++) {
        cin >> a[i];
    }

    sort(a + 1, a + n + 1);
    ll valid = 0, invalid = n + 1;

    while (invalid - valid > 1) {

        ll mid = (invalid + valid) / 2;
    
        for (ll i = 0; i <= n; i++) {
            for (ll j = 0; j <= k; j++) {
                dp[i][j] = 0;
            }
        }
        
        dp[0][0] = 1;
        for (ll i = 1; i <= n; i++) {
            for (ll j = 0; j <= k; j++) {
                dp[i][j] = dp[i - 1][j];

                if (j >= a[i] && i != mid) {
                    dp[i][j] += dp[i - 1][j - a[i]];
                }
            }
        }

        bool f = a[mid] < k;
        for (ll i = max(0ll, k - a[mid]); f && i < k; i++) {
            if (dp[n][i]) f = false;
        }

        if (f) {
            valid = mid;
        }
        else {
            invalid = mid;
        }
    }

    cout << valid << endl;

    return 0;
}


Measured memory_bytes: 195840
#include<bits/stdc++.h>
using namespace std;
int A[250+1], h;

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}

int main(void){
  int i;
  
  scanf("%d", &h);
  for(i=1; i<=h; i++) scanf("%d", &A[i]);

  for(i=1; i<=h; i++){
    printf("node %d: key = %d, ", i, A[i]);

    if(i != 1) printf("parent key = %d, ", A[parent(i)]);
    
    if(left(i)  <= h) printf("left key = %d, ", A[left(i)]);
    if(right(i) <= h) printf("right key = %d, ", A[right(i)]);

    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 3224
#include <stdio.h>
int main () {
    char S[100];
    scanf("%s", S);
    for (int i = 1; S[i] != '\0'; i++) {
        if (S[i-1] == 'A' && S[i] == 'C') {puts("Yes"); return 0;}
    }
    puts("No");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> A(N+1);  // 1-indexed
    rep(i, N) cin >> A[i+1];
    vector<int> ans;
    for (int i = N; i >= 1; i--) {
        int temp = 0;
        for (int j = i; j <= N; j += i) {
            temp ^= A[j];
        }
        if (A[i] ^ temp) A[i] ^= 1;
        if (A[i]) ans.push_back(i);
    }
    cout << sz(ans) << '\n';
    rep(i, sz(ans)) printf("%d%c", ans[i], i+1==sz(ans) ? '\n' : ' ');
    return 0;
}

Measured memory_bytes: 4636
#pragma GCC diagnostic ignored "-Wunused-result"
#define NDEBUG

#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cstdio>
#include <tuple>
#include <vector>

#ifdef NDEBUG
#  define debug(...)
#else
#  define debug(...)                                \
  do {                                              \
    fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
    fprintf(stderr, __VA_ARGS__);                   \
    fputc('\n', stderr);                            \
  } while (false)
#endif

using namespace std;
using tii = tuple<int, int>;

int main() {
  int A, B;
  scanf("%d %d", &A, &B);
  puts(A%2 != 0 && B%2 != 0 ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 128
def XorSum2():
    n = int(input())
    a = list(map(int, input().split()))
    ans, tmp0, tmp1 = 0, 0, 0
    
    # 尺取法インデックス
    right = 0

    # 尺取法
    for left in range(n):
        while right < n and tmp0^a[right] == tmp1+a[right]:
            tmp0 ^= a[right]
            tmp1 += a[right]
            right += 1
        ans += right-left
        if right == left:
            right += 1
            tmp0, tmp1 = 0, 0
        else:
            tmp0 ^= a[left]
            tmp1 -= a[left]
    print(ans)


if __name__ == '__main__':
    XorSum2()
    


Measured memory_bytes: 92056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
//recode
	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
        String[] Aa = line.split(" ");
        long A = Long.parseLong(Aa[0]);
        long B = Long.parseLong(Aa[1]);
        long C = Long.parseLong(Aa[2]);
        long K = Long.parseLong(Aa[3]);
        long var = 1000000000000000000L;
        if(Math.abs(A-B)>var){
        	System.out.println("Unfair");
        }
        else{
        	if(K%2==0){
        		System.out.println(A-B);
        	}
        	else{
        		System.out.println(B-A);
        	}
        }
        
    }
		
		

}




Measured memory_bytes: 21204
#include <stdio.h>
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) {
        cin >> h[i];
    }
    vector<int> dp(n + k + 2,1e9);
    dp[0] = 0;

    rep(i,n){
        for (int j = 1; j<=k;j++){
            dp[i + j] = min(dp[i + j] ,dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[n-1];

    return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    if(a + b == 15){
        cout << '+' << endl;
    } else if(a * b == 15){
            cout << '*' << endl;
    } else {
      cout << 'x' << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n, atual, gray = 0, brown = 0, green = 0, cyan = 0, blue = 0, yellow = 0, orange = 0, red = 0, any = 0;
 
    cin >> n;
 
    for(int i = 0; i < n; i++){
        cin >> atual;
        if((atual < 400) && (gray == 0)){
            gray++;
        }
        else if(((atual < 800) &&  (atual >= 400)) && (brown == 0)){
            brown++;
        }
        else if(((atual < 1200) &&  (atual >= 800)) && (green == 0)){
            green++;
        }
        else if(((atual < 1600) &&  (atual >= 1200)) && (cyan == 0)){
            cyan++;
        }
        else if(((atual < 2000) &&  (atual >= 1600)) && (blue == 0)){
            blue++;
        }
        else if(((atual < 2400) &&  (atual >= 2000)) && (yellow == 0)){
            yellow++;
        }
        else if(((atual < 2800) &&  (atual >= 2400)) && (orange == 0)){
            orange++;
        }
        else if(((atual < 3200) &&  (atual >= 2800)) && (red == 0)){
            red++;
        }
        else if(atual >= 3200){
            any++;
        }
    }
 
    int min = gray + brown + green + cyan + blue + yellow + orange + red;
    int max = gray + brown + green + cyan + blue + yellow + orange + red + any;
    
    if(min == 0){
        min = 1;
    }

    cout << min << " " << max;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    ll n,m;
    cin>>n>>m;
    cout<<pow(2,m)*(1900*m+100*(n-m))<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#define N 10000

int sch(int H[],int n,int k){
  int i=0;
  H[n]=k;
  while(H[i]!=k){
    i++;
  }
    return i!=n;
  }
int main(){
  int i,H[N+1],k,n,p,s=0;
  scanf("%d",&n);
  for(i=0;i<=n-1;i++)
    scanf("%d",&H[i]);
    scanf("%d",&p);
    for(i=0;i<=p-1;i++){
      scanf("%d",&k);
      if(sch(H,n,k))
	s++;
  }
  printf("%d\n",s);
  return 0;
}



Measured memory_bytes: 2140
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int n = sc.nextInt();

        int[] cum = new int[n+1];

        for (int i=0; i < n; i++) {
            cum[i+1] = cum[i] + sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        for (int i=0; i < n; i++) {
            min = Math.min(min, Math.abs((cum[n] - cum[i]) - (cum[i] - cum[0])));
        }

        System.out.println(min);
    }

}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> A;
    int sub;
    for(int i = 0; i < N; ++i){
        cin >> sub;
        A.push_back(sub);
    }
    
    sort(A.begin(), A.end());

    int x, y;
    x = A[0];
    for(int i = 1; i < A.size(); ++i){
        y = A[i];
        if(y % x == 0)      continue;
        
        while(x > 0 && y > 0){
           if(x == y){
                break;
            }
            else if(x > y){
                x -= y;
            }
            else{
                y -= x;
            }
        }
        
        x = max(x, y);
    }
    
    cout << x << "\n";
}

Measured memory_bytes: 892
#include <iostream>

using namespace std;
int main() {
    int a,b,c,d; cin >> a >> b >> c >> d;
    while (a >0 && c >0) {
        c -= b;
        if (c<= 0) {
            cout << "Yes";
            return 0;
        }
        a -= d;
    }
    cout << "No";
    return 0;
}

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

int main() {
  vector<int> N(3);
  for(int i=0;i<3;i++){
  	cin >> N.at(i);
  }sort(N.begin(), N.end());
  if(N[0]==5 && N[1]==5 && N[2]==7){
    cout << "YES" << endl;
  }
  else{ cout << "NO" << endl;
  }
} 


Measured memory_bytes: 256
from sys import stdin
import math

a, b, x = (int(i) for i in stdin.readline().rstrip().split())

if a*a*b < 2*x:
    c = math.atan(2 * b/a - 2 * x/a ** 3)
    print(math.degrees(c))
else:
    c = math.atan(a * b * b/(2 * x))
    print(math.degrees(c))


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

int main(){
    int n;
    cin>>n;
    vector<ll> A(n+1);
    vector<ll> B(n+1);

    REP(i,n){
        cin>>A[i]>>B[i];
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());

    if(n%2==0){
        cout<<(B[n/2+1]+B[n/2])-(A[n/2]+A[n/2+1])+1<<endl;
    }else{
        cout<<B[(n+1)/2]-A[(n+1)/2]+1<<endl;
    }
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int x, y;
    cin >> x >> y;
    if(y > 4 * x || y < 2 * x) {
        cout << "No" << "\n";
        return 0;
    }
    if(y % 2 != 0){
        cout << "No" << "\n";
        return 0;
    }
    cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 3600
import itertools
k = int(input())
Q = []
for i in range(k):
    r,c = map(int, input().split( ))
    Q.append([r,c])
Q.sort()
#print(Q)
for p in itertools.permutations(range(8)):
    flag = True
    Qall = [[i,p[i]] for i in range(8)]
    for q in Q:
        if q[1] != p[q[0]]:
            flag = False
            break
    for j in range(8):
        for l in range(j+1,8):
            if abs(j-l) == abs(p[j]-p[l]):
                flag = False
                break
    if flag:
        break
#print(flag,Qall)    
for i in range(8):
    for j in range(8):
        if [i,j] not in Qall:
            print(".", end = "")
        else:
            print("Q",end="")
    print()
        
                
    




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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI p(n+3), pos(n+3);
  multiset<int> s;
  FOR(i, 1, n + 1) {
    cin >> p[i];
    pos[p[i]] = i;
  }
  s.insert(0);
  s.insert(0);
  s.insert(n+1);
  s.insert(n+1);

  ll ans = 0;
  for(int i = n; i >= 1; --i) {
    auto it = s.lower_bound(pos[i]);
    int a = *(++it);
    int b = *(--it);
    int c = *(--it);
    int d = *(--it);
    ans += 1LL * ((a - b) * (pos[i] - c) + (c - d) * (b - pos[i])) * i;
    s.insert(pos[i]);
  }

  out(ans);

  return 0;
}


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

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

  priority_queue<float, vector<float>, greater<float>> que;
  for (int i = 0; i < N; i++) {
    float v = 0;
    scanf("%f", &v);
    que.push(v);
  }

  float v1, v2;
  for (int i = 0; i < N - 1; i++) {
    v1 = que.top();
    que.pop();
    v2 = que.top();
    que.pop();
    que.push((v1 + v2) / 2);
  }

  printf("%.16f", que.top());
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 10000000

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

void solve(void){
    ll n, m;
    scanf("%lld %lld\n", &n, &m);
    bool start[n], goal[n];
    fill(start, start+n, false);
    fill(goal, goal+n, false);
    rep(m, i) {
        ll a, b;
        scanf("%lld%lld\n", &a, &b);
        if (a == 1) start[b-1] = true;
        if (b == n) goal[a-1] = true;
    }

    bool flag = false;
    rep(n, i){
        if (start[i-1] and goal[i-1]) {
            flag = true; break;
        }
    }
    string s = flag ? "POSSIBLE" : "IMPOSSIBLE";
    cout << s << '\n';

}

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


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

int main()
{
    string s;
    cin >> s;
    int x = atoi(s.c_str());
    int sum = 0;
    for (int i = 0; i < s.size(); i++)
    {
        sum += (int)s[i] - '0';
    }
    if (x % sum == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

long long A;
string B;
int main() {
	cin >> A >> B;
	long long temp = (B[0] - '0')*100 + (B[2] - '0')*10 + (B[3] - '0');
	cout << A*temp/100 << endl;
	return 0;
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	int num1, num2, area,outside;
	scanf("%d%d", &num1, &num2);
	area = num1 * num2;
	outside = num1 * 2 + num2 * 2;

	printf("%d %d\n", area, outside );
	return 0;
}

Measured memory_bytes: 2684
#include <stdio.h>
#include <stdint.h>

int main(void) {
  int64_t N;
  scanf("%ld", &N);

  // q = N / r
  // m = N % r
  // N = q * r + m
  // -> N = q(r + 1)
  int64_t sum = 0;
  for(int64_t i = 1; i*i <= N; i++) {
    if((N % i) == 0) {
      int64_t r = (N / i) - 1;
      if(r != 0) {
	int64_t q = N / r;
	int64_t m = N % r;
	//printf("N=%ld, q=%ld, m=%ld, f=%ld, i=%ld\n", N, q, m, r, i);
	//if(r > i)// ??
	if(q == m)
	  sum += r;
      }
    }
  }
  printf("%ld\n", sum);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	int ans = INT_MAX;
	for(int x=a[0];x<=a[n-1];x++){
		//transform everyone to x 
		int c = 0;
		for(int i=0;i<n;i++){
			c+=(pow(a[i]-x,2));
		}
		ans=min(ans,c);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>

int main()
{
  std::string s, t;
  std::cin >> s;
  std::cin >> t;

  int n = 3;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == t[i])
      res += 1;
  }
  std::cout << res << std::endl;

  return 0;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  sort(all(a));
  int ans = 2e9;
  for (int i = 0; i < n - k + 1; i++) {
    ans = min(ans, a[i + k - 1] - a[i]);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3988
(defun split (string &key (delimiterp #'(lambda (c) (char= c #\Space))))
  (loop :for beg = (position-if-not delimiterp string)
        :then (position-if-not delimiterp string :start (1+ end))
        :for end = (and beg (position-if delimiterp string :start beg))
        :when beg :collect (subseq string beg end)
        :while end))

(destructuring-bind (s1 s2 s3) (split (read-line))
  (format t "~a~a~a~%"
          (char-upcase (aref s1 0))
          (char-upcase (aref s2 0))
          (char-upcase (aref s3 0))))


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

typedef long long ll;

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

    string s; cin >> s;
    for(int i=0;i<2;i++){
        if(s[i]=='A'&&s[i+1]=='B' || s[i]=='B'&&s[i+1]=='A'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<long long>
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define mp make_pair
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e18+1;
const ll N = 2e5;

int n, k, a, ans=0;
int ar[200001];
vector<int> v;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    cin >> n >> k;
    for(int i=0; i<n; i++)
    {
        cin >> a;
        ar[a]++;
    }
    for(int i=1; i<=n; i++)
    {
        if(ar[i])
        {
            v.pb({ar[i]});
        }
    }
    sort(all(v));
    for(int i=0; i<sz(v)-k; i++)
    {
        ans += v[i];
    }
    cout << ans;
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  int H,W;
  cin>>H>>W;
  vector<vector<char>>a(H+1,vector<char>(W+1));
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin>>a[i][j];
    }
  }
  vector<vector<int>>dp(H+1,vector<int>(W+1));
  dp[1][1]=1;
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      if(!(i==1&&j==1)){
        if(a[i][j]=='#'){dp[i][j]=0;}
        else{dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;}
      }
    }
  }

  cout<<dp[H][W]<<endl;
  return 0;  
}

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

#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr);
#define int long long
#define ld long double
#define pb emplace_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)1e15
#define pii pair<int,int>
#define ff first
#define ss second
// #define N --

using namespace std;

struct query {
	int a, b, c, d;
};

int n, m, q, ans = -inf;
vector<query> v;
deque<int> s;

int maxAns() {
	int ans = 0;
	for (query &q : v)
		if (s[q.b - 1] - s[q.a - 1] == q.c)
			ans += q.d;
	return ans;
}

void require(int i = 1) {
	if (s.size() == n) {
		ans = max(ans, maxAns());
		return;
	}

	if (i > m) return;

	require(i + 1);
	s.pb(i);
	require(i);
	s.pop_back();
}

int32_t main() {
	fast
	int t_c = 1;
//	cin >> t_c;
	while (t_c--) {
//		cout << "#: ";
		cin >> n >> m >> q;
		v.resize(q);
		for (query &q : v)
			cin >> q.a >> q.b >> q.c >> q.d;
		require();
		cout << ans << endl;
	}
}

Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int n,s;
int h[200],m[200];
int num[200];
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>h[i]>>m[i];
        num[i]=h[i]*100+m[i];
    }
    cin>>s;
    for(int i=n;i<n+s;i++){
        cin>>h[i]>>m[i];
        num[i]=h[i]*100+m[i];
    }
    sort(num,num+n+s);
    int a,b;
    for(int i=0;i<n+s;i++){
        a=num[i]/100;
        b=num[i]%100;
        if(i!=0)if(num[i]==num[i-1])continue;
        if(i!=0)cout<<" ";
        if(b<10)cout<<a<<":0"<<b;
        else cout<<a<<":"<<b;
    }
    cout<<endl;
return 0;
}

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

using namespace std;

#define int long long

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

#define MAX_N 500005

using vint = vector<int>;
using Graph = vector<vint>;

int n;
Graph graph;

int dp1[MAX_N];
void dfs1(int u) {
  dp1[u] = 2-graph[u].size();
  for(int v : graph[u]) {
    dfs1(v);
    dp1[u] += dp1[v];
  }
}

int dp2[MAX_N];
int depth[MAX_N];
void dfs2(int u) {
  dp2[u] = dp1[u];
  for(int v : graph[u]) {
    //dp2[v] += dp2[u] + dp1[v];
    depth[v] = depth[u] + 1;
    dfs2(v);
    dp2[u] += dp2[v];
  }
}

int dp3[MAX_N];
void dfs3(int u) {
  for(int v : graph[u]) {
    dfs3(v);
  }
  if(graph[u].size() == 2) {
    int l = graph[u][0], r = graph[u][1];
    //dp3[u] = max({dp3[l]+dp3[r], dp3[l]+dp2[u]-depth[u], dp3[r]+dp2[u]-depth[u]});
    dp3[u] = min({dp3[l]+1+dp3[r]+1+depth[u], dp3[l]+1+dp2[r]+dp1[r], dp2[l]+dp1[l]+dp3[r]+1});
  } else if(graph[u].size() == 1) {
    int ch = graph[u][0];
    //dp3[u] = max({dp3[ch], dp2[u]-depth[u]});
    dp3[u] = min({dp3[ch]+1+1+depth[u], dp3[ch]+1+1, 1+dp2[ch]+dp1[ch]});
  } else {
    dp3[u] = dp1[u];//dp2[u]-depth[u];
  }
}

signed main() {
  cin >> n;
  graph.resize(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    if(a != n-1) graph[i].push_back(a);
    if(b != n-1) graph[i].push_back(b);
  }
  dfs1(0);
  dfs2(0);
  dfs3(0);
  int leaf = 0;
  rep(i, n-1) leaf += 2-graph[i].size();
  /*
  int sum = leaf;
  reps(i, 1, n-1) sum += dp1[i];
  int ans = 0;
  rep(i, n-1) ans = max(ans, dp3[i]);
  //cout << sum << " " << ans << endl;
  cout << sum - ans << endl;
  */
  cout << dp3[0] << endl;

  return 0;
}



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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    unordered_map<int, int> m;
    REP(i, N) {
        if (m.count(A[i])) {
            m[A[i]]++;
        } else {
            m[A[i]] = 1;
        }
    }
    vector<int> vec;
    for (auto item : m) {
        vec.push_back(item.second);
    }
    sort(vec.begin(), vec.end());
    if (vec.size() <= K) {
        print(0);
    } else {
        int d = vec.size() - K;
        int ans = 0;
        REP(i, d) {
            ans += vec[i];
        }
        print(ans);
    }
}

signed main() {
    solve();
}


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

int main(){
    long long N,n,sum=0;
    cin >> N;
    n=N;
    while(n){
        sum+=n%10;
        n/=10;
    }
    if(N%sum==0)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int ans[n+1];
    fill(ans, ans+n+1, 0);
    for (int i = 1; i <= 100; i++)
        for (int j = 1; j <= 100; j++)
            for (int k = 1; k <= 100; k++) {
                int x = i * i + j * j + k * k + i * j + j * k + k * i;
                if (x <= n) ans[x]++;
            }
    for (int i = 1; i <= n; i++) cout << ans[i] << endl;
}


Measured memory_bytes: 3200
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1144&lang=jp
// WA
// Sampleは通るのですが

#include <stdio.h>

int ban[20][20];
struct bstat {
	bool s[400];
};
int banw, banh;
int maxdepth;

int move(int *w, int *h, int dx, int dy, bstat *stat) {
	
	int times = 0;
	
	while(true) {
		int neww = *w+dx;
		int newh = *h+dy;
		
		if ( neww < 0 || neww >= banw || newh < 0 || newh >= banh ) { return 1; }
		if ( ban[neww][newh] == -4 ) { //ゴール
			*w = neww;
			*h = newh;
			return 2;
		}
		if ( ban[neww][newh] >= 0 ) { //障害物
			if ( stat->s[ ban[neww][newh] ] == true ) { //生きてる
				if ( times == 0 ) { //障害物の方向に動き出すことは出来ない
					return 4;
				}
				
				stat->s[ ban[neww][newh] ] = false; //壊す
				return 3;
			}
		}
		
		*w = neww;
		*h = newh;
		times++;
	}
	
}

const int cdx[]={1,0,-1,0}, cdy[]={0,-1,0,1};

bool dfs(int argw, int argh, bstat *stat, int depth) {
	int w, h;
	
	if ( depth > maxdepth ) { return false; }
	
	bool ok = false;
	
	for (int i=0; i<4; i++) {
		w = argw;
		h = argh;
		bstat nstat = *stat; //Copy
		int res = move(&w, &h, cdx[i], cdy[i], &nstat);
		if ( res == 2 ) {
			maxdepth = depth;
			return true;
		} else if ( res == 1 ) { //盤外
			continue;
		}
		
		if ( w != argw || h != argh ) { //動いてたら掘り下げる
			if ( dfs(w, h, &nstat, depth+1) ) {
				ok = true;
			}
		}
	}
	
	return ok;
	
}

int main(void) {
	
	while(true) {
		scanf("%d %d", &banw, &banh);
		if ( banw == 0 ) { break; }
		
		int startw, starth;
		bstat startstat;
		
		int bid = 0;
		for(int i=0; i<banh; i++) {
			for(int j=0; j<banw; j++) {
				int c;
				scanf("%d", &c);
				if ( c==1 ) {
					ban[j][i] = bid;
					startstat.s[bid] = true;
					bid++;
				} else if ( c==2 ) {
					ban[j][i] = -1; //何もないマスと同じ
					startw = j;
					starth = i;
				} else {
					ban[j][i] = -c-1; //ゴールは-4
				}
			}
		}
		
		maxdepth = 10;
		if ( dfs(startw, starth, &startstat, 1) ) {
			printf("%d\n", maxdepth);
		} else {
			printf("-1\n");
		}
	}
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int n, k;
    cin >> n >> k;
    int ans = 1;
    for(int i = 0; i < n; i++){
        if(ans*2 < ans+k) ans *= 2;
        else ans += k;
    }
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	double a,b;
	cin >> a >> b;
	double c = (a+b)/2;
	if ((int)c == c){
		cout << (int)c;
	}
	else{
		cout << "IMPOSSIBLE";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
 
void rotate(mat &x){
  int h = x.size(), w = x[0].size();
  mat y(w, vec(h));
  rep(i,h)rep(j,w){
    y[j][h-1-i] = x[i][j];
  }
  x = y;
}
 
int rect(mat &a, int u, int l, int d, int r){
  return a[d][r] - a[d][l] - a[u][r] + a[u][l];
}
 
bool calc(mat a, int n, int m){
  if(a.size() == 0) return false;
 
  if(n == 1){
    int h = a.size(), w = a[0].size();
    int sum = 0;
    rep(i,h)rep(j,w) sum += a[i][j];
    if(sum>=m) return true;
  }
  if(n == 2 || n == 3 || n == 4){
    rep(d,4){
      int h = a.size(), w = a[0].size();
      int sum = 0;
      rep(i,h){
	rep(j,w) sum += a[i][j];
	if(sum >= m){
	  mat sub;
	  for(int k=i+1;k<h;k++) sub.push_back(a[k]);
	  if( calc(sub, n-1, m) ) return true;
 
	  break;
	}
      }
      rotate(a);
    }
  }
  if(n == 4){
    int h = a.size(), w = a[0].size();
    mat sums( h+1, vec(w+1,0) );
    rep(i,h){
      rep(j,w) sums[i+1][j+1] = sums[i+1][j] + a[i][j];
    }
 
    rep(j,w){
      rep(i,h) sums[i+1][j+1] += sums[i][j+1];
    }
 
    rep(ay,h){
      rep(ax,w){
	int suma = rect(sums,0,0,ay+1,ax+1);
	if(suma<m)continue;
	rep(bx,w){
	  int sumb = rect(sums,ay+1,0,h,bx+1);
	  if(sumb<m)continue;
	  rep(cy,h){
	    if(cy <= ay){
	      int sumc = rect(sums,0,ax+1,cy+1,w);
	      if(sumc<m)continue;
	      int sumd1 = rect(sums,cy+1,max(ax,bx)+1,h,w);
	      int sumd2 = rect(sums,ay+1,bx+1,h,w);
	      int sumd = max(sumd1, sumd2);
	      if(sumd<m) break;
 
	      return true;
	    }else{
	      int sumc = rect(sums,0,max(ax,bx)+1,cy+1,w);
	      if(sumc<m)continue;
	      int sumd = rect(sums,cy+1,bx+1,h,w);
	      if(sumd<m)break;
 
	      return true;
	    }
	  }
	  break;
	}
	break;
      }
    }
  }
  return false;
}
 
 
int main(){
  int h,w,n;
  cin >> h >> w >> n;
  mat a(h, vec(w));
  rep(i,h)rep(j,w) cin >> a[i][j];
 
  int l = 0, r = 1e9;
  while(r-l>1){
    int m = (l+r)/2;
    if( calc(a, n, m) ) l = m;
    else r = m;
  }
 
  cout << l << endl;
 
}

Measured memory_bytes: 4188
N,X,Y=map(int,input().split())
l=[0]*(N-1)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        ans=min(abs(i-j),abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))
        l[ans-1]+=1
for t in l:
    print(t)


Measured memory_bytes: 3444
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp;

fn main() {
    let _n: u32 = read();
    let m: u32 = read();
    let mut l = 0;
    let mut r = 1 << 20;
    for _ in 0..m {
        l = cmp::max(l, read::<u32>());
        r = cmp::min(r, read::<u32>());
    }
    println!("{}", if r < l { 0 } else { r - l + 1 });
}


Measured memory_bytes: 4352