akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vct vector<ll>
#define umap unordered_map<ll,ll>
#define mpp map<ll,ll>
#define stt set<ll>
#define pir pair<ll,ll>
#define vpp vector<pair<ll,ll> >
#define pb push_back
ll poww(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
void prt(vector<ll> v)
{
    for(ll i=0;i<v.size();i++)cout<<v[i]<<" ";
    cout<<"\n";
}
vct siev(ll n)
{
    vct ans;ll ar[n+1];
    memset(ar,-1,sizeof(ar));ar[0]=0;ar[1]=0;
    for(ll i=2;i<=n;i++)
    {if(ar[i]==-1){ans.push_back(i);ar[i]=1;for(ll j=2*i;j<=n;j=j+i)ar[j]=0;}}
    return ans;
}
ll isprime(ll n)
{
    if(n==1||n==0)return 0;
    for(ll i=2;i<=sqrt(n);i++)if(n%i==0)return 0;
    return 1;
}
ll etf(ll n) 
{
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)n /= i;
            result -= result / i;
        }
    }
    if(n > 1)result -= result / n;
    return result;
}
vct divsors(ll n)
{
    vct ans;//ans.push_back(1);
    for(ll i=2;i<=sqrt(n);i++)
    {if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    sort(ans.begin(),ans.end());
    return ans;
}
ll cnd(ll n){ll cnt=0;while(n){cnt++;n=n/10;}return cnt;}
ll fc(ll n){ll rs=1;for(ll i=2;i<=n;i++)rs*=i;return rs;}
void prn(ll n){cout<<n<<"\n";}
void pr(ll n){cout<<n<<" ";}
void prs(string n){cout<<n<<"\n";}
ll t,m,n,d,q,p,k;
ll t1,t2;
ll mod=1000000007;
bool issub(string str1, string str2, int m, int n) 
{ 
   int j = 0;
   for (int i=0; i<n&&j<m; i++) 
       if (str1[j] == str2[i]) 
         j++; 
    return (j==m); 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>t;
    prn(t*t);
}

Measured memory_bytes: 256
x1 , y1 ,x2 , y2 = map(int,input().split())
dx = x2 - x1
dy = y2 - y1
x3 ,y3 = x2 - dy , y2 + dx
x4 ,y4 = x1 - dy , y1 + dx
print(x3 , y3 , x4 , y4)

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

int main() {
  string s;
  cin >> s;
  i64 n = s.size();
  bool two = false;
  i64 ans = 1;
  for (i64 i = 1; i < n; ++i) {
    if (!two && s[i - 1] == s[i]) {
      ++i;
      two = true;
    } else {
      two = false;
    }
    if (i < n) ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 644
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1000000007;

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
	bool ret = true;
	if (x < 2) {
		ret = false;
	}
	for (LL i = 2; i <= sqrt(x); i++) {
		if (x%i == 0) {
			ret = false;
		}
	}
	return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

int main(int argc, char const* argv[])
{
	string s;
	cin >> s;
	for (int i = 0; i < 2; i++) {
		if (s[i] == s[i+1] && s[i] == s[i+2]) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	int N; cin >> N;
	V<ll> a(N), b(N), c(N);
	REP(i, N) cin >> a[i] >> b[i] >> c[i];

	V<V<ll>> dp(N, V<ll>(3, 0));
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];

	FOR(i,1,N){
		dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
		dp[i][1] = max(dp[i - 1][2] + b[i], dp[i - 1][0] + b[i]);
		dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
	}
	cout << *max_element(ALL(dp[N - 1])) << endl;
	return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  n=n%10;
  if(n==3)
    cout << "bon";
  else if ((n==0)||(n==1)||(n==6)||(n==8))
    cout << "pon";
  else
    cout << "hon";
  return 0;
}
  

Measured memory_bytes: 3676
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

int main(){
    int X[3];
    int cnt = 0;
    cin >> X[0] >> X[1] >> X[2];
    sort(X, X+3);
    if(X[0] == X[2]){
        cnt=0;
    }else if(X[0] == X[1]){
        cnt = X[2] - X[1];
    }else if(X[1] == X[2]){
        int tmp = X[1] - X[0];
        if(tmp % 2 == 0){
            cnt = tmp/2;
        }else{
            cnt = tmp/2 + 2;
        }
    }else{
        int tmp = X[2] - X[1];
        cnt += tmp;
        X[1] += tmp;
        X[0] += tmp;
        tmp = X[1] - X[0];
                if(tmp % 2 == 0){
            cnt += tmp/2;
        }else{
            cnt += tmp/2 + 2;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
//============================================================================
// Name        : 0078.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
	int n, x, y, a[15][15];
	while(cin >> n){
		memset(a,0,sizeof(a));
		x = n / 2;
		y = n / 2 + 1;
		a[y][x] = 1;
		for(int i = 0;i < n * n - 1;i++){
			if(a[(y + 1) % n][(x + 1) % n] == 0){
				x = (x + 1) % n;
				y = (y + 1) % n;
			}else{
				y = (y + 2) % n;
			}
			a[y][x] = i + 2;
		}
		for(int i = 0;i < n;i++){
			for(int j = 0;j < n;j++){
				printf("%4d",a[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}

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

const int N = 200050;

int n, A[N], B[N];

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &A[i]);
    B[i] = A[i];
  }
  std::sort(A, A + n);
  for (int i = 0; i < n; ++i)
    printf("%d\n", B[i] >= A[n / 2] ? A[n / 2 - 1] : A[n / 2]);
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<string> S(N);
  int ansAC = 0, ansWA = 0, ansTLE = 0, ansRE = 0;
  REP(i, N){
    cin >> S[i];
    if(S[i] == "AC") ansAC++;
    if(S[i] == "WA") ansWA++;
    if(S[i] == "TLE") ansTLE++;
    if(S[i] == "RE") ansRE++;
  }
  cout << "AC x " << ansAC << endl;
  cout << "WA x " << ansWA << endl;
  cout << "TLE x " << ansTLE << endl;
  cout << "RE x " << ansRE << endl;
}

Measured memory_bytes: 6364
n,m,x = map(int, input().split())
import numpy as np
C = np.array([0]*n)
A = np.array([[0]*m]*n)
for i in range(n):
    l = list(map(int, input().split()))
    C[i] += l[0]
    A[i] += np.array(l[1:])

def L(i):
    X = []
    for j in range(n):
        X.append(i%2)
        i = i//2
    X.reverse() 
    return np.array(X)

ans = []
for k in range(2**n):
    D = np.dot(L(k), A)
    if min(D) >= x:
        ans.append(np.dot(C, L(k)))
        
if ans == []:
    print(-1)
else:
    print(min(ans))

Measured memory_bytes: 27452
n = gets.to_i
ans = Array.new(4){Array.new(3) {Array.new(10, 0)}}
n.times do |i|
  b, f, r, v = gets.chomp.split.map(&:to_i)
  ans[b-1][f-1][r-1] += v
  ans[b-1][f-1][r-1] = [ans[b-1][f-1][r-1], 0].max
end

ans.each do |ff|
  ff.each do |rr|
    puts " " + rr.join(" ")
  end
  puts "####################" unless ff.equal?(ans.last)
end



Measured memory_bytes: 6892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N;

int main(void) {
	cin >> N;
	vector<int> a(N), b(N), c(N);
	rep(i, N) cin >> a[i];
	rep(i, N) cin >> b[i];
	rep(i, N) cin >> c[i];
	sort(all(a)), sort(all(b)), sort(all(c));
	ll ans = 0;
	rep(i, N) {
		// printf("b %d\n", b[i]);
		ll l = lower_bound(all(a), b[i]) - a.begin();
		ll r = N - (upper_bound(all(c), b[i]) - c.begin());
		// printf("%d %d %d\n", l, r, lower_bound(all(a), b[i]) - a.begin());
		ans += l * r;
	}
	printf("%lld\n", ans);
	return 0;
}

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

h = list(map(int, input().split()))

# n 番目の足場からゴールまでの最小コスト
dp = [N+1] * N

dp[N-1] = 0
dp[N-2] = abs(h[N-1] - h[N-2])
dp[N-3] = abs(h[N-1] - h[N-3])

for i in range(N-4, -1, -1):  # from N-1 to 0
    step1 = abs(h[i+1] - h[i]) + dp[i+1]
    step2 = abs(h[i+2] - h[i]) + dp[i+2]
    dp[i] = min(step1, step2)

print(dp[0])


Measured memory_bytes: 13776
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:i64, k:i64};
    let mut ans = 0.0f64;
    for i in 1..n+1 {
        let mut crt = i as i64;
        let mut p = 1.0f64;
        while crt < k {
            crt *= 2;
            p /= 2.0;
            //debug!(crt,p);
        }
        ans += p;
    }
    println!("{}", ans / n as f64);
}

Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
using namespace std;

int k, l;
char s[101];

int main() {
    scanf("%d%s", &k, s);
    l = strlen(s);
    if (l <= k) printf("%s", s);
    else {
        s[k] = 0;
        printf("%s...", s);
    }
}


Measured memory_bytes: 1684
#include "bits/stdc++.h"
using namespace std;
#include "atcoder/all"
using namespace atcoder;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;

signed main(){
	int N, D;
	cin >> N >> D;
	vector<int>x(N), y(N);
	REP(i, N) cin >> x[i] >> y[i];

	two_sat ts(N);
	// ts[i] = i-th flag is located on x[i]
	REP(i, N) {
		FOR(j, i + 1, N) {
			if(abs(x[i] - x[j]) < D) {
				ts.add_clause(i, false, j, false);
			}
			if(abs(x[i] - y[j]) < D) {
				ts.add_clause(i, false, j, true);
			}
			if(abs(y[i] - x[j]) < D) {
				ts.add_clause(i, true, j, false);
			}
			if(abs(y[i] - y[j]) < D) {
				ts.add_clause(i, true, j, true);
			}
		}
	}
	if(!ts.satisfiable()) {
		out("No");
		return 0;
	}

	out("Yes");
	auto ans = ts.answer();
	REP(i, N) {
		out((ans[i]) ? x[i] : y[i]);
	}
}

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

int main(){
  ll h, n;
  cin >> h >> n;
  ll a = 0;
  rep(i,n) {
    ll b;
    cin >> b;
    a += b;
  }
  cout << (h <= a? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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


Measured memory_bytes: 22100
n, k = map(int, raw_input().split(' '))

m = n -2
ans = 5*int(m/11)
for i in xrange(m % 11):
    i += 1
    for j in xrange(7-2):
        j += 1
        s = 9*(7*i+j+1)

        if ((s % 11) == k):
            ans +=1
print ans


Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1000000007;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K; cin >> K;
    for (;K--;) cout << "ACL";
    cout << '\n';
}

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

int main() {
  int D;
  cin >> D;

  if (D == 22) cout << "Christmas Eve Eve Eve" << endl;
  if (D == 23) cout << "Christmas Eve Eve" << endl;
  if (D == 24) cout << "Christmas Eve" << endl;
  if (D == 25) cout << "Christmas" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S ,T;
  cin >>S;
  cin >>T;
  long long ans = 0;
  for(long long i = 0; i < S.size();i++){
    if(S.at(i) != T.at(i)){
      ans ++;
    }
  }
  if(ans ==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  


      
}   
  

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std;
 
int main() {
    int i, i1, i2;
    string s;
    string ans;
    cin >> i1;
    cin >> s;
    cin >> i2;
    for (i=0;i1>i;i++) {
        if (s[i] == s[i2-1]) {
            ans += s[i2-1];
        } else {
            ans += "*";
        }
    }
    cout << ans << endl;
}

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

int main(){

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    if(A + B < 2 * C){
        int value = 0;
        value += X * A;
        value += Y * B;
        cout << value << endl;
        return 0;    
    }else{
        int value1 = 0, value2 = 0;        
        
        int diff;
        if(X > Y){
            diff = X - Y;
            value1 += 2 * C * Y;
            value1 += diff * A;
            value2 += 2 * C * X;
        }else{
            diff = Y - X;
            value1 += 2 * C * X;
            value1 += diff * B;
            value2 += 2 * C * Y;
        }
        if(value1 < value2) cout << value1 << endl;
        else cout << value2 << endl;
        return 0;
    }    
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
int dh[4]={1,0,-1,0};
int dw[4]={0,1,0,-1};
ll longinf=(1ll<<31)-1;




int main(){
      ll n;
      cin>>n;
      ll a[n];
      rep0(i,n) cin>>a[i];
      sort(a,a+n);
      ll ans=0;
      deque<ll> deq;
      deq.push_back(a[0]);
      ll cnt=0;
      ll k=1;
      ll t=n-1;
      while(1){
            deq.push_back(a[t]);
            t--;
            cnt++;
            if(cnt==(n-1))break;
            deq.push_front(a[t]);
            t--;
            cnt++;
            if(cnt==(n-1))break;
            deq.push_back(a[k]);
            k++;
            cnt++;
            if(cnt==(n-1)) break;
            deq.push_front(a[k]);
            k++;
            cnt++;
            if(cnt==(n-1)) break;
      }
      ll prev=deq.front();
      deq.pop_front();
      while(deq.size()){
            ll nex=deq.front();
            deq.pop_front();
            ans+=abs(prev-nex);
            //cout<<ans<<" ";
            prev=nex;
      }

      cnt=0;
      k=0;
      t=n-2;
      deq.push_back(a[n-1]);
      while(1){
            deq.push_back(a[k]);
            k++;
            cnt++;
            if(cnt==(n-1))break;
            deq.push_front(a[k]);
            k++;
            cnt++;
            if(cnt==(n-1))break;
            deq.push_back(a[t]);
            t--;
            cnt++;
            if(cnt==(n-1)) break;
            deq.push_front(a[t]);
            t--;
            cnt++;
            if(cnt==(n-1)) break;
      }
      prev=deq.front();
      deq.pop_front();
      ll mans=0;
      while(deq.size()){
            ll nex=deq.front();
            deq.pop_front();
            mans+=abs(prev-nex);
            //cout<<ans<<" ";
            prev=nex;
      }
      ans=max(mans,ans);

      //cout<<endl;
      cout<<ans<<endl;
      return 0;
}

Measured memory_bytes: 1792
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
 
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] prices = new int[n];
    for(int i = 0; i < n; i++){
      prices[i] = sc.nextInt();
    }
    Arrays.sort(prices);
    int ans = 0;
    for(int i = 0; i < k; i++){
      ans += prices[i];
    }

    System.out.println(ans);
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

int main(){
  int H, W; cin >> H >> W;
  
  vector<vector<int> > c(10, vector<int>(10, 0) );
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < 10; j++){
      cin >> c[i][j];
    }
  }
  
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < 10; j++){
      for(int k = 0; k < 10; k++){
        c[j][k] = min(c[j][k], c[j][i] + c[i][k]);
      }
    }
  }
  
  long long ans = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      int a; cin >> a;
      if(a == -1) continue;
      ans += c[a][1];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int W,H,N;
  cin >> W >> H >> N;
  vector<vector<int>> AXY(5);
  for(int i=0; i<N; i++) {
    int x,y,a;
    cin >> x >> y >> a;
    if( AXY.at(a).size()) {
      if(a == 1) AXY.at(1).at(0) = max(AXY.at(1).at(0), x);
      if(a == 2) AXY.at(2).at(0) = min(AXY.at(2).at(0), x);
      if(a == 3) AXY.at(3).at(1) = max(AXY.at(3).at(1), y);
      if(a == 4) AXY.at(4).at(1) = min(AXY.at(4).at(1), y);
    }
    else AXY.at(a) = { x, y };
  }
  
  int X=W,Y=H;
  for(int i=1; i<5; i++) {
    if( AXY.at(i).size()) {
      if(i == 1) X -= AXY.at(1).at(0);
      if(i == 2) X -= W - AXY.at(2).at(0);
      if(i == 3) Y -= AXY.at(3).at(1);
      if(i == 4) Y -= H - AXY.at(4).at(1);
    }
  }
  if( X <= 0 || Y <=0 )cout << 0 << endl;
  else cout << X*Y << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main() {
  int i,j,v;
  int N;
  int *A;
  scanf("%d",&N);
  if(N<1 || N>100) exit(8);
  A = (int*)malloc(N*sizeof(int));
  for(i=0;i<N;i++)
    {
      scanf("%d",&A[i]);
      if(A[i]<0 || A[i]>1000) exit(8);
    }
  for(j=0;j<N-1;j++)
    {
      printf("%d ",A[j]);
    }
  printf("%d\n",A[j]);
  for(i=1;i<=N-1;i++)
    {      
      v=A[i];
      j = i-1;
      while(j>=0 && A[j]>v)
	{
	  A[j+1] = A[j];
	  j--;
	  A[j+1] = v;
	}
      for(j=0;j<N-1;j++)
	{
	  printf("%d ",A[j]);
	}
      printf("%d\n",A[j]);
    }
  free(A);
  return 0;
}



Measured memory_bytes: 2064
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;

const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 1, 0,-1};
const int dy4[6] = {-1, 0, 1,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};
void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}

ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 3e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
/*************************************************************************/

void solve() {
    int a,b;
    int a2,b2;
    cin>>a>>b>>a2>>b2;
   
    printf("%d\n", !(a == a2));
}

int main()
{
#ifndef ONLINE_JUDGE
  //freopen("i.txt", "r", stdin);
  //freopen("o.txt", "w", stdout);
#endif
  solve();

  return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    int N;
    int i = 0;
    int ans = 0;
    vector<long long> A;
    int flg = 0;
    
    cin >> N;
    
    for ( int i = 0; i < N; i++ ) {
        long long a;
        cin >> a;
        A.push_back(a);        
    }
    
    while ( i < N-1 ) {
        
        if ( !flg ) {
            while ( A[i] == A[i+1] ) {
                i++;
            }
            flg = ( A[i] > A[i+1] ) ? 2 : 1;
            i++;
        }
        else if ( flg == 1 ) {
            if ( A[i] > A[i+1] ) {
                flg = 0;
                ans++;
            }
            i++;
        }
        else {
            if ( A[i] < A[i+1] ) {
                flg = 0;
                ans++;
            }
            i++;
        }
    }
    
    cout << ans+1 << endl;
    
    return 0;
}

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

int main(void)
{
  int a, b;
  cin >> a >> b;
  int n = b;
  if(n < 10) n += a*10;
  else if(n < 100) n += a*100;
  else n += a*1000;
  int rt = sqrt(n);
  string ans = (rt*rt == n) ? "Yes" : "No";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


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

    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    if(a == 0) print(1);
    else if(b == 0) print(2);
    else if(c == 0) print(3);
    else if(d == 0) print(4);
    else if(e == 0) print(5);

}




Measured memory_bytes: 3652
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
int cmp3(T lhs, T rhs) { return (lhs == rhs) ? 0 : (lhs > rhs) ? 1 : -1; }

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

int main() {
  lli N, K, Q;
  scanf("%lld %lld %lld", &N, &K, &Q);
  vector<lli> pts(N, 0);
  REP(i, Q) {
    lli A; scanf("%lld", &A);
    pts[--A] += 1;
  }
  REP(i, N) {
    pts[i] += (-Q) + K;
    printf("%s\n", pts[i] > 0 ? "Yes":"No");
  }
  return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
int main(){
  char num[1200];
  int sum=0, i=0, number;
 
  while(1){
    scanf("%s",num);
    if(num[0]=='0')break;
    while(1){
      if(num[i]=='\0')break;
      number=num[i]-'0';
      sum=sum+number;
      i++;
    }
    printf("%d\n",sum);
    sum=0;
    i=0;
  }
  return 0;
}

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

int main(){
  ll N,Y; cin>>N>>Y;
  
  bool OK=false;
  
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N-i;j++){
      ll sum=10000*i + 5000*j + 1000*(N-i-j);
      if(sum==Y){
        cout<<i<<" "<<j<<" "<<N-i-j<<endl;
        OK=true;
      }
      if(OK)
        break;
    }
    if(OK)
      break;
  }
  
  if(!OK)
    cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K, S, z;
    int ans = 0;
    cin >> K >> S;
    for(int i = 0; i <= K; i++) {
        for(int j = 0; j <= K; j++) {
            z = S - i - j;
            if (z >= 0 & z <= K) ans++;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
n,a,b = map(int, input().split())

disA = b - 1
disB = n - a
if (b-a) % 2 == 0:
  disC = (b-a) // 2
else:
  disC = min(n-b, a-1) + 1 + (b-a) // 2

print(min(disA, disB, disC))

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 1; i <= n; i++) {
			int x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
				continue;
			}
			print3(x, i);
		}
		System.out.println();
	}

	public static void print3(int x, int i) {
		if (x % 10 == 3) {
			System.out.print(" " + i);
		} else if (x / 10 > 0) {
			print3(x / 10, i);
		}
	}
}

Measured memory_bytes: 24400
#include <stdio.h>
#include <stdlib.h>

#define MAX 100

char s[MAX];
char p[MAX];

int search(int sx, int px)
{
    int i, j;
    int flag;

    for(i=0;i<sx;i++) {
        flag = 0;
        for(j=0;j<px;j++) {
            if(s[(i+j)%sx] != p[j]) {
                flag = 1;
                break;
            }
        }
        if(flag == 0) return 1;
    }
    return 0;
}

int main(void)
{
    int sx = 0, px = 0;
    int flag;
    char str[MAX+2];

    fgets(str, MAX+2, stdin);
    while(1) {
        if(str[sx] == '\n') break;

        s[sx] = str[sx];
        sx++;
    }

    fgets(str, MAX+2, stdin);
    while(1) {
        if(str[px] == '\n') break;

        p[px] = str[px];
        px++;
    }

    flag = search(sx, px);

    if(flag == 1) printf("Yes\n");
    else          printf("No\n");

    return 0;
}

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

int main(){
    double W,H;
    int x,y;
    cin>>W>>H>>x>>y;
    cout<<(double)W/2*(double)H<<" ";
    if(x==(double)W/2 && y==(double)H/2)cout<<1<<endl;
    else cout<<0<<endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

int v[10];

int check(int n) {
  while(n) {
    if (v[n % 10] == 1) {
      return 0;
    }
    n /= 10;
  }
  return 1;
}

int main(int argc, const char * argv[]) {
  int N, K;
  cin >> N >> K;
  
  for (int i = 0; i < K; i++) {
    int a;
    cin >> a;
    v[a] = 1;
  }
  
  int i = N;
  while(1) {
    if (check(i)) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
  return 0;
}


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

int main(){
    int n,c;
    std::cin >> n >> c;
    typedef std::pair<int, int> P;
    std::vector<std::vector<int>> d(c, std::vector<int>(c));
    for (int i = 0; i<c; i++){
        for (int j = 0; j<c; j++){
            std::cin >> d[i][j];
        }
    }
    std::vector<std::vector<int>> color(n, std::vector<int>(n));
    for (int i = 0; i<n; i++){
        for (int j = 0; j<n; j++){
            std::cin >> color[i][j];
            color[i][j]--;
        }
    }
    std::vector<int> discomfort_A(c);
    std::vector<int> discomfort_B(c);
    std::vector<int> discomfort_C(c);
    for (int i = 0; i<c; i++){
        discomfort_A[i] = 0;
        discomfort_B[i] = 0;
        discomfort_C[i] = 0;
    }
    for (int i = 0; i<3; i++){
        for (int p = 0; p < c; p++){
            for (int j = 2 + i; j <= n*2; j += 3){
                for (int k = 1; k<= j; k++){
                    if (k > n || n < j - k || j - k <1) continue;
                    if (i==0) discomfort_A[p] += d[color[k-1][j-k-1]][p];
                    if (i==1) discomfort_B[p] += d[color[k-1][j-k-1]][p];
                    if (i==2) discomfort_C[p] += d[color[k-1][j-k-1]][p];
                }
            }
        }
    }
    int ans = 1'000'000'000;
    std::vector<int> x(c);
    for (int i = 0; i<c; i++){
        for (int j = 0; j<c; j++){
            if (i!=j){
                x = discomfort_C;
                x[i] = 1'000'000'000;
                x[j] = 1'000'000'000;
                std::sort(x.begin(), x.end());
                ans = std::min(ans, discomfort_A[i] + discomfort_B[j] + x.front());
            }
        }
    }
    std::cout << ans << std::endl;
}




Measured memory_bytes: 1280
N = int(input())  #数字
S = list(input()) #スペース抜きの複数行,１文字ずつ

cou = 0

for i in range(0,N):
    j = 1
    while i + (2 * j) <= N-1:
        if S[i] != S[i + j] and S[i + j] != S[i + (2*j)] and S[i] != S[i + (2*j)]:
            cou += 1
        j += 1

print(S.count("R")*S.count("G")*S.count("B")-cou)

Measured memory_bytes: 9204
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <numeric>
#include <algorithm>
//#include <iomanip> : 表示桁数

#define pi 3.14159265358979323846
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;

//string ans = "Yes";
int ans = 0;
int N;
string S;
string Alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
	cin >> N >> S;
	for (int i = 0;i < S.length();i++) {
		rep(j, 26) {
			if (S[i] == Alp[j]) {
				cout << Alp[(j + N) % 26];
				break;
			}
		}
	}
	cout  << endl;
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int n, x;
	cin >> n >> x;

	vector<int> a(n);
	rep(i, n) cin >> a[i];

	ll ans = 0;
	rep(i, n - 1) {
		int sum = a[i] + a[i + 1];
		if (sum > x) {
			// if (a[i + 1] >= sum - x) {
			// 	a[i + 1] -= sum - x;
			// } else {
			// 	a[i] -= sum - x - a[i + 1]; 
			// 	a[i + 1] = 0;
			// }
			a[i + 1] = max(a[i + 1] - (sum - x), 0);
			ans += sum - x;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
class UnionFind
    attr_reader :set_size
    def initialize(n)
        @par = Array.new(n)
        n.times{ |i| @par[i] = i }
        @rank = Array.new(n, 0)
        @set_size = Array.new(n, 0)
    end

    def find(x)
        if @par[x] == x
            x
        else
            @par[x] = find(@par[x])
        end
    end

    def unite(x,y)
        x = find(x)
        y = find(y)
        return if x == y

        if @rank[x] < @rank[y]
            @par[x] = y
            @set_size[y] += @set_size[x]
        else
            @par[y] = x
            @set_size[x] += @set_size[y]
            @rank[x] += 1 if @rank[x] == @rank[y]
        end
    end

    def same?(x, y)
        find(x) == find(y)
    end
end

N, M = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
uf = UnionFind.new(N)
M.times do |i|
    x, y = gets.split.map(&:to_i)
    uf.unite(x, y)
end

hash = {}
N.times do |i|
    par = uf.find(i)
    hash[par] ||= []
    hash[par].push(i)
end

rows = hash.values
need = (rows.length-1) * 2
if need > N
    puts 'Impossible'
    exit
end

used = {}
ans = 0

rows.each do |row|
    break if need == 0
    min = row.min_by{|i| as[i]}
    used[min] = true
    ans += as[min]
    need -= 1
end
if need > 0
    assort = N.times.to_a.reject{|i| used[i]}.map{|i| as[i]}.sort
    ans += assort[0, need].inject(0, :+)
end
puts ans

Measured memory_bytes: 24468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;


int main(){
    ll N;
    cin >> N;
    ll a,b;
    
    cin >> a >> b;
    ll sum = a+b;
    ll ans = N/sum;
    ll ans2 = 0;
    ans2 = N-(ans*sum);
    if(ans2 >= a){
        cout << (a*ans)+a << endl;
    }else{
        cout << (a*ans)+ans2 << endl;
    }
    

    
}


Measured memory_bytes: 256