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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> a >> b >> c >> x;
    ans = 0;

    for (int i = 0; i <= a; ++i) {
        for (int j = 0; j <= b; ++j) {
            for (int k = 0; k <= c; ++k) {
                if (i * 500 + j * 100 + k * 50 == x) ans++;
            }
        }
    }
    MSG(ans)
}


Measured memory_bytes: 256
s = int(input())
a = [s]
i = 0

while a.count(a[i]) != 2:
    if a[i] % 2 == 0:
        a.append(a[i]//2)
    else:
        a.append(3*a[i] + 1)
    i += 1

ans = len(a)
print(ans)

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

typedef long long int ll;


int main()
{
    ll n, sum = 0;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }
    
    vector<ll> b(n), c(n);
    b[0] = a[0];
    for(ll i = 1;i < n;i++){
        b[i] = b[i - 1] + a[i];
    }
    c[n - 1] = a[n - 1];
    for(ll i = n - 2;i >= 0;i--){
        c[i] = c[i + 1] + a[i];
    }

    ll m = abs(b[0] - c[1]);
    for(ll i = 0;i < n - 1;i++){
        m = min(m, abs(b[i] - c[i + 1]));
    }

    cout << m;


    return 0;
}

Measured memory_bytes: 4992
def saiki(sumn,count)
  if (count == 3)
    if ((($s - sumn) <= $k) and (($s - sumn) >= 0))
      $ans += 1
    end
    return
  end
  (0..$k).each do |d|
    sum = sumn + d
    saiki(sum,(count+1))
  end
end
$k,$s = gets.chomp.split(" ").map(&:to_i)
$ans = 0
saiki(0,1)
puts $ans

Measured memory_bytes: 1788
N,M = map(int,input().split())

d_1=[0]*N
d_2=[0]*N

for i in range(M):
    p_i,S_i = input().split()
    p_i =int(p_i)-1
    if S_i=='WA' and d_2[p_i]==0:
        d_1[p_i]+=1
    elif S_i=='AC' and d_2[p_i]==0:
        d_2[p_i]=1

penalty=0
for j in range(N):
    if d_2[j]==1:
        penalty+=d_1[j]

print(sum(d_2),penalty)



Measured memory_bytes: 4724
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    long h = sc.nextLong();
    
    long result = 2;
    while(result<=h) {
      result *= 2;
    }
    
    result -= 1;
    System.out.println(result);
    
  }
}

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

int main(){
  int h,w;
  string a[100];
  cin >> h >> w;

  for(int i=0;i<h;i++){
    cin >> a[i];
  }
  
  for(int i=0;i<w+2;i++){
    cout << "#";
  }
  cout << endl;
  for(int i=0;i<h;i++){
    cout << "#" << a[i] << "#" << endl;;
  }
  for(int i=0;i<w+2;i++){
    cout << "#";
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())

if n < 10:
	result = n
elif n < 10**2:
	result = 9
elif n < 10**3:
	result = n -90
elif n < 10**4:
	result = 909
elif n < 10**5:
	result = n -9090
else:
	result = 90909

print(result)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A, B;
    cin >> A >> B;
    int sum = 0;

    while (A <= B) {
        int number = A;
        vector<int> num(5, 0);
        for (int i = 0; i < 5; i++) {
            num.at(i) = number % 10;
            number /= 10;
        }
        if (num.at(0) == num.at(4) && num.at(1) == num.at(3)) {
            sum++;
        }
        A++;
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		int moveCount= m-n;

		if(moveCount <= 0) {
			System.out.println("0");
			return;
		}

		List<Integer> xList = new ArrayList<Integer>();
		List<Integer> diffList = new ArrayList<Integer>();

		for(int i= 0; i < m; i++) {
			xList.add(sc.nextInt());
		}

		Collections.sort(xList);

		for(int i = 1; i < m; i++) {
			diffList.add(xList.get(i) - xList.get(i-1));
		}

		Collections.sort(diffList);

		int cost = 0;
		for(int i = 0; i < moveCount; i++) {
			cost += diffList.get(i);
		}

		System.out.println(cost);

	}

}


Measured memory_bytes: 59072
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        h: i64,
        w: i64,
    }
    if h == 1 || w == 1 {
        println!("1");
    } else {
        println!("{}", (w/2+w%2)*(h/2+h%2)+(w/2)*(h/2));
    }
}


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

#define int long long
#define fi first
#define se second
#define pb push_back

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

int n, a[100005], itr = 1, mx = 0, sum, num;
ii b[100005];
set<int> se;

signed main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		b[i].fi = a[i];
		b[i].se = i;
	}
	sort(b + 1, b + n + 1);
	for(int i = 1; i <= n; i++){
		if(a[i] <= mx){
			cout << 0 << "\n";
			se.erase(i);
			continue;
		}
		sum = 0;
		while(b[itr].fi < a[i]){
			if(b[itr].se > i){
				sum += b[itr].fi - mx;
				se.insert(b[itr].se);
			}
			itr++;
		}
		//cout << num << " " << sum << "\n";
		cout << (a[i] - mx) * (n - i + 1 - se.size()) + sum << "\n";
		mx = a[i];
	}
}


Measured memory_bytes: 7552
#include <iostream>

using namespace std;

int main(void)
{
    unsigned int height, width;
    
    while(height | width) {
        cin >> height >> width;
        if(height | width) {
            for(int i = 0; i < height; ++i) {
                if(i == 0 || i == height - 1) {
                    for(int j = 0; j < width; ++j) {
                        cout << '#' << flush;
                    }
                    cout << endl;
                } else {
                    for(int j = 0; j < width; ++j) {
                        if(j == 0 || j == width - 1) {
                            cout << '#' << flush;
                        } else {
                            cout << '.' << flush;
                        }
                    }
                    cout << endl;
                }
            }
            cout << endl;
        } else {
            continue;
        }
    }
    
    return 0;
}


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

int main(){
  string s, t;
  cin >> s >> t;
  cout << (s == t.substr(0,s.size()) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3608
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  a,b,c=pM(split(readline()))
  count=0
  while a!=b!=c
    if isodd(a) || isodd(b) || isodd(c)
      break
    end
    count+=1
    a2=div(a,2)
    b2=div(b,2)
    c2=div(c,2)
    a=b2+c2
    b=a2+c2
    c=a2+b2
  end
  if isodd(a) || isodd(b) || isodd(c)
    print(count)
  else
    print(-1)
  end
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


Measured memory_bytes: 167680
N , K = map(int,input().split())
cnt =0
get_val = [[0,0]]*N
for i in range(N):
    get_val[i] = list(map(int,input().split()))
get_val.sort()

for i in range(N):
    cnt = cnt + get_val[i][1]
    if cnt >= K:
        print(get_val[i][0])
        break

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

int sum;
int main(){
    
    int d,g;
    cin >> d >> g;

    int p[d+1], b[d+1];

    for(int i = 0;i<d;i++){
        cin >> p[i] >> b[i];
        sum+=p[i];
    }

    for(int i = 0;i<(1<<d);i++){

        int cur = 0;
        int ans = 0;
        priority_queue<int> q;

        for(int j = 0;j<d;j++){
            if((1<<j)&i){
                cur+=b[j];
                ans = ans+p[j];
                cur+=100*(j+1)*p[j];
            }
            else{
                for(int k = 1;k<=p[j];k++){
                    q.push(100*(j+1));
                }
            }
        }

        while(cur<g){
            int x  = q.top(); q.pop();
            cur+=x;
            ans++;
        }

        sum = min(ans,sum);
    }

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

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

struct Vec2d{
  double x,y;
};

double cross(Vec2d &A, Vec2d &B){
  return A.x*B.y - A.y*B.x;
}

int main(void){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
	  Vec2d AB,AP,BC,BP,CA,CP;
	  AB.x = x2-x1; AB.y = y2-y1;
	  BC.x = x3-x2; BC.y = y3-y2;
	  CA.x = x1-x3; CA.y = y1-y3;
	  AP.x = xp-x1; AP.y = yp-y1;
	  BP.x = xp-x2; BP.y = yp-y2;
	  CP.x = xp-x3; CP.y = yp-y3;
	  if(cross(AB,AP)>0.0 && cross(BC,BP)>0.0 && cross(CA,CP)>0.0)
	  	cout<<"YES"<<endl;
	  else if(cross(AB,AP)<0.0 && cross(BC,BP)<0.0 && cross(CA,CP)<0.0){
	  	cout<<"YES"<<endl;
	  }else
	  	cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

string s;
bool ap[26];
int main() {
  cin >> s;
  for (char c : s) ap[c - 'a'] = true;
  for (int i = 0; i < 26; ++i) {
    if (!ap[i]) {
      cout << char(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None\n";
  return 0;
}


Measured memory_bytes: 764
n = int(input())
works = []
flag = True
for i in range(n):
    works.append(list(map(int, input().split())))
sorts = sorted(works, key=lambda x: x[1])
time = 0
for i in range(n):
    time += sorts[i][0]
    if time > sorts[i][1]:
        print('No')
        flag = False
        break
if flag:
    print('Yes')

Measured memory_bytes: 55260
n=int(input())
a=[0]*n
max1=0
max2=0
for i in range(n):
  a[i]=int(input())
  if (max1<=a[i]):
    max2=max1
    max1=a[i]
  elif (max2<=a[i]):
    max2=a[i]

for i in range(n):
  if (a[i]==max1):
    print(max2)
  else:
    print(max1)

Measured memory_bytes: 12508
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 2e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, K, Q;
ll psum[MAX];

int main()
{
	int i, j, k;
	scanf("%d", &N);
	ll x;
	for (i = 1; i <= N; ++i) {
		scanf("%lld", &x);
		psum[i] = psum[i - 1] + x;
	}
	ll mini = LINF;
	for (i = 1; i < N; ++i) {
		mini = min(mini, abs(psum[i] - (psum[N] - psum[i])));
	}
	printf("%lld", mini);
}


Measured memory_bytes: 1792
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
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;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q, now;

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

  cin >> x;
  now = 100;
  while (1) {
    now += now / 100;
    ans++;
    // debug(now);
    if (now >= x) break;
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3660
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = 0;
		
		for (int i = 0; i < m; i++){
			sum = sum + sc.nextInt();
		}

		int free = n - sum;
		if (free < 0) free = -1;
			
		System.out.println(free);
	}
}

Measured memory_bytes: 46244
#include <iostream>
#include <iomanip>
#include <stdio.h>
using namespace std;

int main()
{
	long long int a[100000];
	long long int n, min, max, sum;
		
	cin >> n;
	
	for(int i=0; i<n; i++)
		cin >> a[i];
	
	min = max = sum =a[0];
	for(int i=1; i<n; i++){
		if(a[i] < min)
			min = a[i];
		if(a[i] > max)
			max = a[i];
		sum += a[i];
	}
	
	cout << min <<' ' << max << ' ' << sum << endl;
	
	return 0;
}



Measured memory_bytes: 3164
N = int(input())
A = [0] + list(map(int, input().split()))

S = sum(A)
X = 0
Y = 0
M = [0] * (N+1)

for i in range(2,N,2):
    Y += 2 * A[i]

for i in range(1,N+1,2):
    #print(i,X,Y)
    M[i] = S - X - Y
    if i != N:
        X += 2*A[i]
        Y -= 2*A[i+1]

for i in range(2,N,2):
    M[i] = 2*A[i] - M[i+1]

M.pop(0)
print(' '.join(map(str,M)))


Measured memory_bytes: 19116
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int x = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        if (a - b >= 0) {
            System.out.println("delicious");
        } else if (b - a <= x) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }
        
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n, sum = 1;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n - 1; ++i) if (s[i] != s[i + 1]) ++sum;
  cout << sum;
}


Measured memory_bytes: 3756
def min_dist(n, r):
    max_arg_l = (n - 1) // 2
    max_arg_r = (n + 1) // 2

    return min(abs(max_arg_l - r), abs(max_arg_r - r))

def solve():
    n = int(input())
    a = list(map(int, input().split()))

    max_a = max(a)

    a = list(filter((max_a).__ne__, a))

    arg_max_a = a[0]

    for _a in a:
        if min_dist(max_a, _a) < min_dist(max_a, arg_max_a):
            arg_max_a = _a
    
    print(max_a, arg_max_a)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 14060
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007



int main(){
  int n,m,a,b;
  cin >> n >>m;
  vector<pair<int,int> >pairs(m);
  rep(i,m){
    cin >> a >> b;
    pairs[i]=make_pair(b,a);
  }

  sort(pairs.begin(),pairs.end());
  //rep(i,m)cout << pairs[i].first << endl;
  ll ans=0,place=0;
  rep(i,m){
    if(place<pairs[i].second){
      ans++;
      place=pairs[i].first-1;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdio>
#define MAXV 100010
#define F(a,b) for(int a = 0; a < b; ++ a)
#define FF(a,b) for(int a = 1; a <= b; ++ a)
const int INF = 0x3fffffff;
using namespace std;
int dp[MAXV][3], mat[MAXV][3];
int main(){
	int N;
	scanf("%d", &N);
	F(i,N){
		F(j,3){
			scanf("%d", &mat[i][j]);
			dp[i][j] = -1;
		}
	}
	dp[0][0] = mat[0][0];
	dp[0][1] = mat[0][1];
	dp[0][2] = mat[0][2];
	for(int i = 1; i < N; ++ i){
		dp[i][0] = max(dp[i - 1][1] + mat[i][0], dp[i - 1][2] + mat[i][0]);
		dp[i][1] = max(dp[i - 1][0] + mat[i][1], dp[i - 1][2] + mat[i][1]);
		dp[i][2] = max(dp[i - 1][0] + mat[i][2], dp[i - 1][1] + mat[i][2]);
	}
	int maxn = dp[N - 1][0];
	maxn = max(maxn, max(dp[N - 1][1], dp[N - 1][2]));
	printf("%d\n", maxn);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	int x=0;
	for(int i=0;i<n;i++)x=max(x,a[i]);
	if(x<k)
	{
		puts("IMPOSSIBLE");
		return 0;
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)if(a[i]==k)
	{
		printf("POSSIBLE\n");
		return 0;
	}
	if(n==1)
	{
		puts("IMPOSSIBLE");
		return 0;
	}
	int g=a[0];
	for(int i=1;i<n;i++)g=__gcd(g,a[i]);
	if(k%g==0)
	{
		printf("POSSIBLE\n");
	}
	else
	{
		printf("IMPOSSIBLE\n");
	}
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<bits/stdc++.h>
#include<vector>

using namespace std;

int main()
{
    int input;
    for(int i=1;i<=5;i++)
    {
        cin>>input;
        if(input == 0)
        {
            cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

//struct edge{
//    int t;
//    ll y, s;
//    // define e1.cost < e2.cost : e1 < e2
////    bool operator <(const edge &e) const {
////        return cost < e.cost;
////    }
//};

struct edge {int to; ll cost;};
struct node {int pos; ll cost;};
bool operator < (const node &a, const node &b){
    return a.cost > b.cost;
}

vector<ll> dijkstra(vector<vector<edge>> &G, int root){
    vector<ll> ret(G.size(), inf);
    priority_queue<node> pq;
    pq.push({root, 0});
    while (!pq.empty()) {
        node t = pq.top();
        pq.pop();
        
        if (ret[t.pos] == inf) ret[t.pos] = t.cost;
        else continue;
        
        for (edge e : G[t.pos]) {
            pq.push({e.to, t.cost + e.cost});
        }
    }
    return ret;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    vector<vector<edge>> G(n), H(n);
    rep(i, m) {
        int u, v;
        ll a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        G[u].pb({v, a});
        G[v].pb({u, a});
        H[u].pb({v, b});
        H[v].pb({u, b});
    }
    
    auto S = dijkstra(G, s);
    auto T = dijkstra(H, t);
    
    vector<ll> ans(n);
    for(int i = n - 1; i >= 0; i--) {
        ans[i] = S[i] + T[i];
        if(i < n - 1) ans[i] = min(ans[i], ans[i + 1]);
    }
    rep(i, n) {
        ll kenkoooo = 1000000000000000;
        output(kenkoooo - ans[i]);
    }
    
    return 0;
}


Measured memory_bytes: 19556
/***** author :  C0d1ngPhenomena *****/

#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define TestCases int T; cin>>T; while(T--)
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define revrep(i,a,b) for(ll i = b-1; i >= a; i--)
#define vll vector<ll>
#define vvll vector < vll >
#define pll pair<ll, ll>
#define vpll vector <pll>
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define alld(c) c.begin(),c.end(),greater<int>()
#define mem(a,val) memset(a,val,sizeof(a))
#define f first
#define s second
#define pb push_back
using namespace std;

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}

ll maxi = 0;
bool visited[1000000];
vector<ll> G[1000000];

void dfs(int x)
{
	visited[x] = true;

	for (auto& i : G[x])
	{
		if (visited[i] == false)
		{
			dfs(i);
			maxi++;
		}
	}
}



int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	ll m;
	cin >> n >> m;

	rep(i,0,m)
	{
		ll x, y;
		cin >> x >> y;
		G[x].pb(y);
		G[y].pb(x);
	}

	ll cnt = -1;

	rep(i,1,n+1)
	{
		if(!visited[i])
		dfs(i);
		cnt = max(cnt, maxi);
		maxi = 0;
	}
	cout << cnt + 1;
	return 0;
}







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

int main() {
    int n;
    while(cin >> n, n) {
        vector<vector<int>> vs(31);
        vector<set<int>> maps(n);
        for(int i = 0; i < n; ++i) {
            maps[i].insert(i);
        }
        for(int i = 0; i < n; ++i) {
            int f; cin >> f;
            for(int j = 0; j < f; ++j) {
                int x; cin >> x;
                vs[x].push_back(i);
            }
        }
        int ans = -1;
        for(int i = 1; i <= 30; ++i) {
            set<int> ns;
            for(auto x : vs[i]) {
                ns.insert(begin(maps[x]), end(maps[x]));
            }
            for(auto x : vs[i]) {
                maps[x] = ns;
            }
            if((int)ns.size() == n) {
                ans = i;
                break;
            }
        }
        cout << ans << endl;
    }
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    ll tmp = 0;
    while (pow(K, tmp) <= N) {
        tmp++;
    }
    rep2(i, 1, tmp + 1) {
        if (pow(K, i - 1) <= N && N < pow(K, i)) {
            ans = max(ans, i);
        }
    }
    cout << ans << '\n';
}

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


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

int main()
{
    int a;

    cin >> a;

    bool isPossible = false;

    for (int i = 1; i < 10; i++)
    {
        for (int j = 1; j < 10; j++)
        {
            if (i * j == a)
            {
                isPossible = true;
                break;
            }
        }
    }

    if (isPossible)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less_equal<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

ll po[3000005][2],fac[3000005];

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;
    x = x % p; 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
ll inv(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

ll ncr(ll n, ll r) 
{ 
    ll p=A;
    if (r==0)
        return 1; 
    return (fac[n]* inv(fac[r], p) % p * inv(fac[n-r], p) % p) % p; 
} 

int main() 
{
    FAST;
    fac[0] = 1; 
    po[0][0] = 1;
    po[0][1] = 1;
    for (int i=1 ; i<3000005; i++) 
    {
        po[i][0] = (po[i-1][0]*26)%A;
        po[i][1] = (po[i-1][1]*25)%A;
        fac[i] = (fac[i-1]*i)%A; 
    }
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll k=s.length();
    ll ans=po[n+k][0];
    for(int i=0;i<k;i++)
    {
        ll x=(ncr(n+k,i)*po[n+k-i][1])%A;
        ans=(ans-x)%A;
    }
    ans+=A;
    cout<<(ans%A);
    subt;
    return 0;
}

Measured memory_bytes: 74512
// C.

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	long long x, y;
	cin >> x >> y;
	int ans = 0;
	while (x <= y) {
		++ans;
		x *= 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static long[] ReadLongArray()
    {
	return ReadLine().Split().Select(x => long.Parse(x)).ToArray();
    }
    public static void Swap<T>(ref T a, ref T b)
    {
	var t = a;
	a = b;
	b = t;
    }
}

class Program
{
    static long ModInv(long a, long m)
    {
	long b = m, u = 1, v = 0;
	while (b > 0) {
	    long t = a / b;
	    a -= t * b; Swap(ref a, ref b);
	    u -= t * v; Swap(ref u, ref v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;	
    }
    
    public static void Main()
    {
	var tmp = ReadLongArray();
	long x = tmp[0], y = tmp[1];

	//    a + 2b = x   (1)
	//   2a +  b = y   (2)
	//=> a = (2y - x) / 3, b = (2x - y) / 3

	if (2*y - x >= 0 && (2*y - x) % 3 == 0 &&
	    2*x - y >= 0 && (2*x - y) % 3 == 0)
	{
	    long a = (2*y - x) / 3;
	    long b = (2*x - y) / 3;

	    long M = 1000000007;

	    long ans = 1;
	    for (long i = 1; i <= a+b; i++)
		ans = ans * i % M;

	    for (long i = 1; i <= a; i++)
	    {
		long iv = ModInv(i, M);
		ans = ans * iv % M;
	    }

	    for (long i = 1; i <= b; i++)
	    {
		long iv = ModInv(i, M);
		ans = ans * iv % M;
	    }

	    WriteLine(ans);
	}
	else
	{
	    WriteLine(0);
	}
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
const int NMAX=2e3+5;
const int INF=1e9;
int n,x,y;
int sol[NMAX];
int main()
{
    cin>>n>>x>>y;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            int d=INF;
            d=min(d,j-i);
            d=min(d,abs(i-x)+1+abs(y-j));
            d=min(d,abs(i-y)+1+abs(x-j));
            sol[d]++;
        }
    }
    for(int i=1;i<=n-1;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


Measured memory_bytes: 256
#Nはアイテム数、Wはナップサックサイズ
N,W = map(int,input().split())
#dpテーブルを作成（初期値は0）
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

#print(dp)

#N個のアイテムのvalueとweightを入れるリストを用意する
value = []
weight = []
for i in range(N):
    v,w = map(int,input().split())
    value.append(v)
    weight.append(w)

#print(values)
#print(weights)

#アイテムは１個目からN個まで、重さのレンジは0からWまで
for i in range(1,N+1):
    for j in range(W+1):
        if j >= weight[i-1]: #iは1から始めているので、weightやvalueのリストを参照するときは添字を1つ下げる
            dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N][W])


Measured memory_bytes: 25940
#include<iostream>
using namespace std;
int tree[26][2000001];
void build_tree(string &str,int start,int end,int index)
{
	if(start==end)
	{
		int j;
		for(j=0;j<26;j++)
		{
			tree[j][index]=0;
		}
		tree[str[start]-97][index]++;
	}
	else
	{
		int mid=(start+end)/2;
		build_tree(str,start,mid,2*index);
		build_tree(str,mid+1,end,2*index+1);
		int j;
		for(j=0;j<26;j++)
		{
			tree[j][index]=tree[j][2*index]+tree[j][2*index+1];
		}
	}
}
void update(int start,int end,int removed,int added,int pos,int index)
{
	if(pos>end||pos<start)
	  return ;
	if(start==end)
	{
		tree[removed][index]--;
		tree[added][index]++;
	}
	else
	{
		int mid=(start+end)/2;
		update(start,mid,removed,added,pos,2*index);
		update(mid+1,end,removed,added,pos,2*index+1);
		tree[removed][index]=tree[removed][2*index]+tree[removed][2*index+1];
		tree[added][index]=tree[added][2*index]+tree[added][2*index+1];
	}
}
int sum_query(int start,int end,int left,int right,int index,int code)
{
	if(left>end||start>right)
	  return 0;
	else if(start>=left&&end<=right)
	  return tree[code][index];
	else
	{
		int mid=(start+end)/2;
		int x=sum_query(start,mid,left,right,2*index,code);
		int y=sum_query(mid+1,end,left,right,2*index+1,code);
		return x+y;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	string str;
	cin>>str;
	build_tree(str,0,str.size()-1,1);
	int q;
	cin>>q;
	while(q--)
	{
		int query;
		cin>>query;
		if(query==1)
		{
			int pos;
			char x;
			cin>>pos>>x;
			int removed=str[pos-1]-97;
			int added=x-97;
			str[pos-1]=x;
			update(0,n-1,removed,added,pos-1,1);
		}
		else
		{
			int answer=0;
			int l,r;
			cin>>l>>r;
			int j;
			for(j=0;j<26;j++)
			{
				int val=sum_query(0,n-1,l-1,r-1,1,j);
				if(val>0)
				{
					answer++;
				}
			}
			cout<<answer<<endl;
		}
	}
}


Measured memory_bytes: 160668
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >>N >>K;
  int sum =0;
  vector <int> x(N);
  for (int i=0; i<N; i++){
  cin >> x.at(i);
  sum += min(K - x.at(i), x.at(i));
  }
  cout << 2*sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <cctype>
#define rep(x,y,z) for(long long x=y;x<z;++x)
#define dwn(x,y,z) for(long long x=y;x>z;--x)
using namespace std;

typedef long long ll;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    ll sum_a = 0, sum_b = 0;
    rep(i,0,n) {
        cin >> a[i];
        sum_a += a[i];
    }
    rep(i,0,n) {
        cin >> b[i];
        sum_b += b[i];
    }
    if (sum_b > sum_a) {
        cout << -1 << endl;
        return 0;
    }
    vector<ll> d(n);
    ll sum = 0;
    ll cnt = 0;
    rep(i,0,n) {
        d[i] = b[i] - a[i];
        if (d[i] > 0) {
            sum += d[i];
            ++cnt;
        }
    }
    sort(begin(d), end(d));
    ll res = cnt;
    ll su = 0;
    ll i = 0;
    while(su < sum) {
        su -= d[i];
        ++i;
        ++res;
    }
    cout << res << endl;


    return 0;
}


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

int main() {
	// your code goes here
	int n;
	cin >> n;
	int arr[n+1];
	for(int i = 1 ; i <= n ; i++)
	{
		cin >> arr[i];
	}
	sort(arr+1,arr+n+1);
	int mid=n/2;
	cout << arr[mid+1]-arr[mid];
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 1e5+1;
typedef P<int, int> pii;
int n, m, c[N];
ll e[N];
bool z[N];
queue<int> q;
struct UnionFind{
  vector<int> p;
  int g;
  void init(int n){
    p.assign(n, -1);
    g = n;
  }
  int find(int a){
    return p[a] < 0 ? a : p[a] = find(p[a]);
  }
  bool merge(int a, int b){
    a = find(a);
    b = find(b);
    if(a==b) return 0;
    g--;
    if(p[a]>p[b]) swap(a, b);
    p[a] += p[b];
    p[b] = a;
    return 1;
  }
} uf;

void draw(int a, int b){
  e[a] = e[a] * modInv(b, MOD) % MOD; if(--c[a] == 1) q.push(a);
  e[b] = e[b] * modInv(a, MOD) % MOD; if(--c[b] == 1) q.push(b);
  printf("%d %d\n", a, b);
  z[a] ^= true;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  if(m%2){
    cout << -1 << endl;
    return 0;
  }
  uf.init(n+1);
  fill(e, e+n+1, 1ll);
  FOR(i, 0, m){
    int a, b;
    cin >> a >> b;
    if(uf.merge(a, b)){
      e[a] = e[a]*b%MOD; c[a]++;
      e[b] = e[b]*a%MOD; c[b]++;
    }else{
      printf("%d %d\n", a, b);
      z[a] ^= true;
    }
  }
  FOR(i, 1, n+1) if(c[i]==1) q.push(i);
  while(!q.empty()){
    int t = q.front(); q.pop();
    if(c[t] != 1) continue;
    z[t] ? draw(t, e[t]) : draw(e[t], t);
  }
}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#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 FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << a - b - c + d << endl;
}





Measured memory_bytes: 3112
#include <iostream>
#include <vector>
using namespace std;
#define REP(i,n)    for(int i = 0; i < (int)n; i++)
#define ana -1

int main(){
    int a[3][3];
    int n;
    bool ans = false;
    REP(i,3)
        REP(j,3)
            cin >> a[i][j];
    cin >> n;
    int b[n];
    REP(i,n){
        cin >> b[i];
        REP(p,3)
            REP(q,3){
                if(b[i]==a[p][q])
                    a[p][q] = ana;
            }
    }
    REP(i,3){
        if((a[i][0] == a[i][1] &&a[i][1] == a[i][2]) || (a[0][i] == a[1][i] && a[1][i] == a[2][i]))
            ans = true;
    }
    if((a[0][0] == a[1][1] && a[1][1] == a[2][2]) ||(a[2][0] == a[1][1] && a[1][1] == a[0][2]))
        ans = true;
    
    if(ans)
        cout << "Yes\n";
    else
    {
        cout << "No\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
n  = int(input())
a_to_e =[0] * 5
lowest_ride = 10 ** 15 + 1
for i in range(5):
    a_to_e[i] = int(input())
    if a_to_e[i] < lowest_ride:
        lowest_ride = a_to_e[i]

print((n + lowest_ride - 1) // lowest_ride + 4)


Measured memory_bytes: 9112
#include <stdio.h>

int main(void)
{
	char a, b;
	
	scanf("%c %c", &a, &b);
		if(a == 'H') {
		printf("%c", b);
	}
	else {
		if(b == 'H') {
			printf("D");
		}
		else {
			printf("H");
		}
	}
	return 0;
}

Measured memory_bytes: 128
//There was and will always be only one Chester. RIP legend
//--------------------Life is beautiful--------------------
#include<bits/stdc++.h>
using namespace std;
#define Nilesh ios_base::sync_with_stdio(false);
int sot(int n)
{
    int res=0;
    while(n!=0)
    {
        int t=n%10;
        n/=10;
        res+=t;
    }
    return res;
}
bool check(string a)
{
    for(int i=1;i<a.length();i++)
    {
        if(a[i]-'0'!=9)
            return false;
    }
    return true;
}
int main()
{
	Nilesh
	string a;
	cin>>a;
	int l=a.length();
	int answer;
	if(l==1)
    {
        cout<<a;
        return 0;
    }
    if(l==2)
    {
        int n=(a[0]-'0')*10+a[1]-'0';
        int mx=0,store=0;
        for(int i=n;i>0;i--)
        {
            store=sot(i);
            mx=max(mx,store);

        }
        cout<<mx;
        return 0;
    }
    if(!check(a))
    {
        a[0]-=1;
        answer=(l-1)*9+(a[0]-'0');
    }
    else
        answer=answer=(l-1)*9+(a[0]-'0');
    cout<<answer;


}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

const int N = 1e6;
const int LOG = 21;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLMOD = 998244353;
const ll LLINF = 1e18;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    ld ans = 0;
    forn(i, n) {
        ld a;
        cin >> a;
        ans += 1.0 / a;
    }
    ans = 1 / ans;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  int n,q;
  cin>>n>>q;
  vector<priority_queue<int> > Q(n);
  
  while(q--){
    int cmd;
    cin>>cmd;
    
    if(cmd == 0){
      int t, x;
      cin>>t>>x;
      Q[t].push(x);
    }
    if(cmd == 1){
      int t;
      cin>>t;
      if(!Q[t].empty()) cout<<Q[t].top()<<endl;
    }
    
    if(cmd == 2){
      int t;
      cin>>t;
      if(!Q[t].empty()) Q[t].pop();
    }
  }


  
  return 0;
}



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

int main()
{
  vector<string> s(3);
  cin >> s[0] >> s[1] >> s[2];
  int turn = 0, i = 0, j = 0, k = 0;
  while (true) {
	if (turn == 0) {
	  if (i == s[0].size()) {
		cout << "A" << endl;
		return 0;
	  }
	  if (s[turn][i] == 'a') {
		turn = 0;
	  }
	  else if (s[turn][i] == 'b') {
		turn = 1;
	  }
	  else {
		turn = 2;
	  }
	  i++;
	}
	else if (turn == 1) {
	  if (j == s[1].size()) {
		cout << "B" << endl;
		return 0;
	  }
	  if (s[turn][j] == 'a') {
		turn = 0;
	  }
	  else if (s[turn][j] == 'b') {
		turn = 1;
	  }
	  else {
		turn = 2;
	  }
	  j++;
	}
	else {
	  if (k == s[2].size()) {
		cout << "C" << endl;
		return 0;
	  }
	  if (s[turn][k] == 'a') {
		turn = 0;
	  }
	  else if (s[turn][k] == 'b') {
		turn = 1;
	  }
	  else {
		turn = 2;
	  }
	  k++;
	}
	

  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main( )
{
  int h, m, s, x;
 scanf("%d",&x);
  h=x/3600;
  m=(x-h*3600)/60;
  s=(x-h*3600)-m*60;
  printf("%d:%d:%d\n",h,m,s);
 return 0;
}

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


int main()
{
    int n,p[101];
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>p[i-1]>>p[i];
    int m[100][100];
    for(int i=0;i<n;i++)
        m[i][i]=0;
    for(int len=2;len<=n;len++)
        for(int i=0;i<n-len+1;i++)
        {
            int j=i+len-1;
            m[i][j]=1<<20;
            for(int k=i;k<i+len-1;k++)
                m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i]*p[k+1]*p[j+1]);
        }
    cout<<m[0][n-1]<<endl;
    return 0;

}


Measured memory_bytes: 3092
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main()
{
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2; 

	cout << fixed << setprecision(6);
	
	cout << sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) << endl;
	
	
	return 0;
}




Measured memory_bytes: 3280
import java.util.LinkedList;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int dx[]={2,2,2,-2,-2,-2,0,1,-1,0,1,-1};
		int dy[]={0,1,-1,0,1,-1,2,2,2,-2,-2,-2};
		int dx2[]={1,1,1,0,0,0,-1,-1,-1};
		int dy2[]={0,1,-1,1,0,-1,1,0,-1};	
		for(;;)
		{
			int w=in.nextInt();
			int h=in.nextInt();
			if((h|w)==0)
				return;
			int s=in.nextInt();
			int map[][]=new int[10][10];
			LinkedList<String>que=new LinkedList<String>();
			for(int i=1;i<=s;i++)
			{
				int sw=in.nextInt();
				int sh=in.nextInt();
				map[sh][sw]=i;
			}
			que.add(h+" "+w);
			int rincle=1;
			boolean judge=false;
			while(!que.isEmpty())
			{
				int size=que.size();
				judge=false;
				for(int i=0;i<size;i++)
				{
					String now[]=que.poll().split(" ");
					int nh=Integer.valueOf(now[0]);
					int nw=Integer.valueOf(now[1]);
					for(int j=0;j<12;j++)
					{
						int xh=dy[j]+nh;
						int xw=dx[j]+nw;
						int rh=0,rw=0;
						for(int I=0;I<10;I++)
							for(int J=0;J<10;J++)
							{
								if(map[I][J]==rincle)
								{
									rh=I;
									rw=J;
								}
							}

						if(xh>=0&&xh<10&&xw>=0&&xw<10)
						{
							for(int I=0;I<9;I++)
							{
								if((rh+dy2[I])==xh&&(rw+dx2[I])==xw)
								{
									que.add(xh+" "+xw);
									judge=true;
								}
							}
						}
					}
				}
				rincle++;
				if(rincle>s)
					break;
			}
			System.out.println(judge ? "OK":"NA");
		}
	}
}

Measured memory_bytes: 12000