akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <fstream>

#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) {
    if(b==0) return a;
    else return GCD(b, a%b);
}

ll LCM(ll a, ll b) {
    return a/GCD(a,b)*b;
}

class CRectangleCutting {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll w,h,x,y;
        in>>w>>h>>x>>y;
        double res = (double)w*(double)h/2;
        printf("%.16f %d",res,x+x==w&&y+y==h);


	}
};


int main() {
	CRectangleCutting solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

typedef long long ll;

int main(void)
{
    int n, x, y;
    cin >> n >> x >> y;
    x--;
    y--;
    int a[n];
    REP(i, n)
    {
        a[i] = 0;
    }
    // iからjまでの距離をもとめる
    REP(i, n)
    {
        for (int j = i + 1; j < n; j++)
        {
            int dist;
            if (j <= x or y <= i)
            {
                a[j - i]++;
            }
            else if (i <= x and y <= j)
            {
                dist = x - i + j - y + 1;
                a[dist]++;
            }
            else if (i <= x and j <= y)
            {
                dist = x - i + y - j + 1;
                dist = min(dist, j - i);
                a[dist]++;
            }
            else if (x <= i and y <= j)
            {
                dist = i - x + j - y + 1;
                dist = min(dist, j - i);
                a[dist]++;
            }
            else
            {
                dist = i - x + y - j + 1;
                dist = min(dist, j - i);
                a[dist]++;
            }
        }
    }
    for (int i = 1; i < n; i++)
    {
        cout << a[i] << endl;
    }
}

Measured memory_bytes: 384
<?php
$fl=array();
for($i=1;$i<=4;$i++){
  $fl[$i]=array();
  for($j=1;$j<=3;$j++){
    $fl[$i][$j]=array();
    for($k=1;$k<=10;$k++)$fl[$i][$j][$k]=0;
  }
}

$n=trim(fgets(STDIN));

for($i=0;$i<$n;$i++){
  list($b,$f,$r,$v)=explode(' ',trim(fgets(STDIN)));
  $fl[$b][$f][$r]+=$v;
}

$o='';
$sp='';for($i=0;$i<20;$i++){$sp.='#';}
for($i=1;$i<=4;$i++){
  for($j=1;$j<=3;$j++){
    for($k=1;$k<=10;$k++)$o.=' '.$fl[$i][$j][$k];
    $o.=PHP_EOL;
  }
  if($i<4){$o.=$sp.PHP_EOL;}
}
print $o;

Measured memory_bytes: 15604
n = int(input())
a_in = list(input().split())
a = list(map(int,a_in))
a.sort(reverse=True)
ans = 0
t = 0
c = 1

for i in range(n-1):
    if a[i] == a[i+1]:
        c = c + 1
        if t == 0:
            t = int(a[i])
        elif t != int(a[i]):
            ans = t * int(a[i])
            break
        elif c == 4:
            ans = t * t
            break
    else:
        c = 1

print(ans)


Measured memory_bytes: 14864
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<complex>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define rep(i,n) REP(i,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep(i,n) RREP(i,n)
#define mp make_pair
#define fi first
#define sc second

int main(){
  ll n;
  string a,b,c;

  cin >> n >> a >> b >> c;

  ll ans = 0;
  rep(i,n) {
    if (a[i] == b[i] && b[i] == c[i]) {
      ;
    }else if (a[i] == b[i] || b[i] == c[i] || a[i] == c[i]) {
      ans++;
    } else {
      ans += 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int h,w;
  cin>>h>>w;
  int n;
  cin>>n;
  if(h>w) swap(h,w);
  cout<<(n+w-1)/w<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y, Z;
  cin >> X >> Y >> Z;
  printf("%d %d %d\n", Z, X, Y);
  return 0;
}

Measured memory_bytes: 256
from math import log,floor
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
C = Counter(A)

cnt = 0
last_a = -1
for i in range(N):
  a = A[i]
  if last_a == a:
    continue
  last_a = a
  count_a = C[a]
  if count_a <= 0:
    continue
  b = pow(2,floor(log(a)/log(2))+1) - a
  count_b = C[b]
  if count_b <= 0:
    continue
  i += count_a - 1
  x = min(count_a, count_b) if a != b else count_a // 2
  cnt += x
  C[a] -= x
  C[b] -= x
  
print(cnt)

Measured memory_bytes: 33288
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    if( s[0] == s[1] && s[1] == s[2] ) cout << "No" << endl;
    else                               cout << "Yes" << endl;
    return 0;
}


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

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

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

const int N = 1000100, mod = 1000003;

int q;
ll x, d, n, f[N], rf[N];		
	
ll binpow(ll x, ll p){
	ll res = 1;
	while(p){
		if(p & 1)
			res = res * x % mod;
		x = x * x % mod;
		p >>= 1;
	}
	return res;
}
ll inv(ll x){
	return binpow(x, mod - 2);
}
ll G(ll l, ll r){
	if((l - 1) / mod != r / mod)
		return 0;			
	l %= mod;
	r %= mod;
	assert(l <= r);
	if(l == 0)
		return f[r];
	return f[r] * rf[l - 1] % mod;
}
int main()
{
	f[0] = rf[0] = 1;
	for(int i = 1; i < N; i++)
		f[i] = f[i - 1] * i % mod, rf[i] = inv(f[i]);

	scanf("%d", &q);
	while(q--){
		scanf("%lld%lld%lld", &x, &d, &n);
		if(d == 0){
			printf("%lld\n", binpow(x, n));
			continue;
		}
		ll ans = binpow(d, n);
		x = x * inv(d) % mod;     
		ans = ans * G(x, x + n - 1) % mod;
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 16512
N, C = map(int, input().split())
D = [0] + [[0]+list(map(int, input().split())) for _ in range(C)]

ct = [{}, {}, {}]

for i in range(1, N+1):
  for j, c in enumerate(list(map(int, input().split()))):
    k = (i+j+1) % 3
    ct[k][c] = ct[k].get(c, 0) + 1

ans = float('inf')
for c1 in range(1, C+1):
  d1 = 0
  for c, v in ct[0].items():
    if c != c1:
      d1 += D[c][c1] * v
  for c2 in range(1, C+1):
    if c1 == c2:
      continue
    d2 = 0
    for c, v in ct[1].items():
      if c != c2:
        d2 += D[c][c2] * v
    for c3 in range(1, C+1):
      if c1 == c3 or c2 == c3:
        continue
      d3 = 0
      for c, v in ct[2].items():
        if c != c3:
          d3 += D[c][c3] * v
      ans = min(ans, d1+d2+d3)

print(ans)

Measured memory_bytes: 3064
#include <cstdio>

using namespace std;
int h1,h2,m1,m2,k;
int mix_time(int a,int b,int c,int d){
    if(b>d){c=c-1;d=d+60;}
    return (c-a)*60+d-b;
}
int main(){
    scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
    printf("%d",mix_time(h1,m1,h2,m2)-k);
    return 0;
}

Measured memory_bytes: 1736
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	ll x, y;
	cin >> x >> y;
	cout << abs((x - 2LL)*(y - 2LL)) << endl;
	return 0;
}


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

int main()
{
	int a, b, c;
	int x = 1;
	int y = 1;
	cin >> a >> b >> c;

	while (1)
	{		
		if ((b + c)* x + c > a)
		{
			x--;
			break;
		}
		x++;
	}

	cout << x;

}	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> s(m), c(m);
  for(int i = 0; i < m; i++) cin >> s[i] >> c[i];
  
  bool flag = false;
  for(int i = 0; i < 1005; i++){
    string num = to_string(i);
    if((int)num.size() != n) continue;
    bool ok = true;
    for(int j = 0; j < m; j++){
      if((num[s[j]-1] - '0') != c[j]) ok = false;
    }
    if(ok == true){
      cout << i << endl;
      flag = true;
      break;
    }
  }
  
  if(!flag) cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main() {
    lint n, x, m;
    scanf("%lld%lld%lld", &n, &x, &m);
    vector<lint> sum = {0};
    lint bf_num = 0, bf_sum = 0;
    {
        lint tmp = x;
        set<lint> S;
        while (S.find(tmp) == S.end()) {
            S.insert(tmp);
            (tmp *= tmp) %= m;
        }
        lint cycle_start = tmp;

        tmp = x;
        while (tmp != cycle_start) {
            ++bf_num;
            bf_sum += tmp;
            (tmp *= tmp) %= m;
        }
        S.clear();
        while (S.find(tmp) == S.end()) {
            S.insert(tmp);
            sum.push_back(tmp);
            (tmp *= tmp) %= m;
        }
        partial_sum(sum.begin(), sum.end(), sum.begin());
    }
    int K = sum.size() - 1;
    if (n <= bf_num) {
        lint tmp = x, ans = 0;
        rep(_, n) {
            ans += tmp;
            (tmp *= tmp) %= m;
        }
        printf("%lld\n", ans);
    } else {
        lint ans = bf_sum;
        n -= bf_num;
        ans += sum[K] * (n / K);
        ans += sum[n % K];
        printf("%lld\n", ans);
    }
}

Measured memory_bytes: 6160
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: usize = iterator.next().unwrap().parse().unwrap();

    let mut ok: isize = 1_000_000_000;
    let mut ng: isize = 0;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if mid * mid >= s as isize {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    let w: usize = ok as usize;
    let h: usize = if w * (w - 1) >= s {
        w - 1
    } else {
        w
    };

    let mut x1: usize = w;
    let y1: usize = 0;
    let x2: usize = 0;
    let mut y2: usize = 0;
    let x3 = w;
    let y3 = h;

    let mut current = w * h;
    if current == s {
        return format!("{} {} {} {} {} {}", x1, y1, x2, y2, x3, y3);
    }

    x1 -= 1;
    current -= h;
    y2 = s - current;

    return format!("{} {} {} {} {} {}", x1, y1, x2, y2, x3, y3);
}


Measured memory_bytes: 2140
from copy import deepcopy
N,X=map(int,input().split())
A=[int(i) for i in input().split()]
B=deepcopy(A)
ans=sum(A)
for t in range(1,N):
    for i in range(N):
        if B[i]>A[i-t]:
            B[i]=A[i-t]
    ans=min(ans,sum(B)+t*X)
print(ans)



Measured memory_bytes: 43628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main() {
	int n, m;
	cin >> n >> m;
	VI k(m), p(m);
	int s[10][10];

	FOR(i, m) {
		cin >> k[i];
		FOR(j, k[i])cin >> s[i][j];
	}
	FOR(i, m)cin >> p[i];

	int ans = 0;
	for (int bit = 0; bit < (1 << n); bit++) {
		VI a(n, 0);
		FOR(j, n)if (bit & (1 << j))a[j]++;
		FOR(i, m) {
			int cnt = 0;
			FOR(j, k[i]) {
				if (a[s[i][j] - 1])cnt++;
			}
			if (cnt % 2 != p[i])break;
			if (i == m - 1)ans++;
		}
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

ll gcd(ll a, ll b) {
    return (b == 0 ? a : gcd(b, a % b));
}

ll count(ll x, ll d1, ll d2) {
    ll c1 = x / d1;
    ll c2 = x / d2;
    ll c3 = x / ((d1 * d2) / gcd(d1, d2));
    return x - c1 - c2 + c3;
}

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << count(B, C, D) - count(A - 1, C, D) << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin

input = lambda: stdin.readline()

def main():
    N, M, X, Y = map(int, input().split())
    Xn = list(map(int, input().split()))
    Ym = list(map(int, input().split()))


    if max([X] + Xn) < min([Y] + Ym):
        print('No War')
    else:
        print('War')

main()


Measured memory_bytes: 2940
// AGC020
// A - Move and Win

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

int N, A, B;

int main() {
    cin >> N >> A >> B;

    cout << ((B - A) % 2 == 0 ? "Alice" : "Borys") << endl;

    return 0;
}


Measured memory_bytes: 256
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int a[N];
int b[N];
int c[N];
ll res;


int main () {
	SpeedForce;
	int x, y;
	cin >> x >> y;
	cin >> n >> m >> k;
	For (i, 1, n) cin >> a[i];
	For (i, 1, m) cin >> b[i];
	For (i, 1, k) cin >> c[i];
	sort(a + 1, a + n + 1);
	sort(b + 1, b + m + 1);
	sort(c + 1, c + k + 1);
	reverse(a + 1, a + n + 1);
	reverse(b + 1, b + m + 1);
	reverse(c + 1, c + k + 1);
	priority_queue < ll > q;
	ll cur = 0;
	for (int i = 1; i <= x; ++i) {
		cur += a[i];
		q.push(-a[i]);
	}
	for (int i = 1; i <= y; ++i) {
		cur += b[i];
		q.push(-b[i]);
	}
	ll ans = cur;
//	cout << "now : " << cur << '\n';
	for (int i = 1; i <= x + y && i <= k; ++i) {
		cur += q.top();
		q.pop();
		q.push(-c[i]);
		cur += c[i];
		ans = max(ans, cur);
//		cout << "i : " << i << ' ' << cur << '\n';
	}
	cout << ans << '\n';

	return Accepted;
}

// B...a

Measured memory_bytes: 6900
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

import functools
print(functools.reduce(gcd, a))


Measured memory_bytes: 85060
import java.util.Scanner;

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

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0) break;

            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    boolean oddRow = (i % 2) == 1;
                    boolean oddColumn = (j % 2) == 1;

                    if ((oddRow && oddColumn) || (!oddRow && !oddColumn)) {
                        System.out.print("#");
                    } else {
                        System.out.print(".");
                    }

                }
                System.out.println("");
            }
            System.out.println("");
        }

        sc.close();
    }
}


Measured memory_bytes: 34256
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}

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

  ll N, M;
  cin >> N >> M;

  multiset<ll> s;
  rep(i, N) {
    ll A;
    cin >> A;
    s.insert(A);
  }

  rep(i, M) {
    multiset<ll>::iterator end = s.end();
    end--;
    s.erase(end);
    s.insert(*end / 2);
  }

  ll sum = 0;
  for (auto &_ : s) {
    sum += _;
  }
  out(sum);
}


Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<queue>
#include<cstring>
#include<utility>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#include<deque>
#include<cctype>
using namespace std;
int main() 
{
	int r,g,b;
	cin>>r>>g>>b;
	if((g*10+b)%4==0)
	cout<<"YES";
	else cout<<"NO";
    return 0; 
}

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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int n;
  string s;
  cin >> n >> s;

  map<char, i64> mp;
  rep(i, 0, n) {
    mp[s[i]]++;
  }

  i64 ans = 1;
  for(auto &it : mp) {
    (ans *= it.second + 1) %= mod;
  }
  cout << ans - 1 << endl;
}

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

int n, a[100010], ans = 0;

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for(int i = 1; i <= n; i++) {
        if(a[i] == i) {
            if(i == n) swap(a[i], a[i-1]), ans++;
            else swap(a[i], a[i+1]), ans++;
        }
    }
    printf("%d", ans);
}


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

int main(){
	long long a, b;
	cin >> a >> b;
	// to find a number satisfiy this equations 
	// two number must be even or two number must be odd
	if(a % 2 != b % 2)
		cout << "IMPOSSIBLE";
	else
		cout << (a + b)/2;

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>
#include <queue>

using namespace std;

#define MOD 1000000007

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

  vector<int> x;
  x.push_back(s);
  for(int i=0;;i++){
    int a=x.at(i);
    if(a%2==0)  a/=2;
    else  a=3*a+1;
    x.push_back(a);
    for(int j=0;j<x.size()-1;j++){
      if(x.at(j)==a){
        cout << i+2 << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
ll const INF = 1LL << 60;

ll min_price = INF;

void dfs2(ll i, ll S, ll D, double n, ll sum) {
    double lit = 2.0 / pow(2, (i-1));

    if (min_price < sum) {
        // cout << "END." << endl;
        return;
    }

    if (i == 2) {
        sum += n * S;
        // cout << "RESULT: " << sum << endl;
        if (min_price > sum) {
            // cout << "UPDATE: " << sum << endl;
            min_price = sum;
        }
        return;
    }

    ll max_select = n / lit;
    // cout << "max_select:" << max_select << endl;

    for (int k = 0; k <= max_select; k++) {
        if (i == 1) {
            dfs2(i+1, S, D, n-lit*k, sum + k*D);
        }
        // } else if (i == 2) {
        //     dfs(i+1, S, D, n-lit*k, sum + k*S);
        // } else if (i == 3) {
        //     dfs(i+1, Q, H, S, D, n-lit*k, sum + k*H);
        // }
    }
}

int main() {
    ll Q, H, S, D;
    cin >> Q >> H >> S >> D;

    // double N;
    ll N;
    cin >> N;

    H = min(H, 2*Q);
    S = min(S, 2*H);

    ll ans;
    if (2 * S < D) {
        ans = N * S;
    } else {
        ans = (N / 2) * D + (N % 2) * S;
    }

    cout << ans << endl;

    // dfs2(1, S, D, N, 0);
    // cout << min_price << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
  int s,w;cin>>s>>w;
  (s>w)?cout<<"safe\n":cout<<"unsafe\n";
    return 0;
}




Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int arr[1001];
int main()
{

    //  #ifndef oj
    // freopen("in", "r", stdin);
    //freopen("out.txt","w",stdout);
    //#endif
    // system("cls");
    //getchar();
   ll n,sum=0;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       if(i%3==0 || i%5==0)
        continue;
       sum+=i;

   }
   cout<<sum<<endl;
}


Measured memory_bytes: 3640
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    var input = chunk.split(" ");
    var output = "";
    var num = new Array();
    
    for(var i = 0; i < input.length; i++){
        num[i] = Number(input[i]);
    }
    
    var ans1 = Math.floor(num[0]/num[1]);
    var ans2 = num[0] % num[1];
    var ans3 = num[0] / num[1];
    
    console.log(ans1 + " " + ans2 + " " + ans3.toFixed(10));
});

Measured memory_bytes: 7904
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int d = sc.nextInt();
        int ans = 0;
        for (int i = l; i<=r;i++){
            if (i%d ==0){
                ans +=1;
            }else{
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35680
import sys

def main():
  input = sys.stdin.readline
  a, b, c, d = map(int, input().split())
  if ((abs(a-b) <= d) and (abs(b-c) <= d)) or (abs(a-c) <= d):
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}


object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(a, b, x) = in.readLine().split("\\s+").map(_.toInt)

    out.println(
      if (a <= x && x <= a + b) {
        "YES"
      } else {
        "NO"
      }
    )
    out.flush()
  }
}


Measured memory_bytes: 25412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int n, m, ans = 0;
vector<int> a, b, c;
vector<vector<int>> dist;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n >> m;
    a.resize(m);
    b.resize(m);
    c.resize(m);
    dist.resize(n);
    
    rep(i, n) {
        dist[i].resize(n, 1e9);
        dist[i][i] = 0;
    }
    
    rep(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--;
    }
    
    rep(i, m) {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }
    
    rep(i, n) {
        rep(ii, n) {
            rep(iii, n) {
                dist[ii][iii] = min(dist[ii][iii],  dist[ii][i] + dist[i][iii]);
            }
        }
    }
    
    rep(i, m) {
        if (dist[a[i]][b[i]] != c[i]) {
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
/*
 *  Created on: 22 / 4 / 2020
 *  Author:     Eslam Waheed
 */
#include <bits/stdc++.h>
using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define __USE_MINGW_ANSI_STDIO
#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n)
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)

ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }

//const ll mod = 1e9 + 7;
//__int128
const ld PI = 3.14159265358979323846;
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    stp(20);
    Eslam__Waheed
        ld r; cin >> r;
    ld ans = (2 * PI * r);
    cout << ans;
}

Measured memory_bytes: 3804
#include <iostream>

using namespace std;

int main(){
  int N, m, count = 1, check = 0;
  int a[100000] = {0};

  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> a[i];
  }

  m = 0;

  for(int i = 0;i < N;i++){
    if(a[m] == 2){
      cout << count << endl;
      check = 1;
      break;
    } else{
      m = a[m]-1;
      count++;
    }
  }

  if(check == 0){
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    ll x;
    cin >> x;

    ll sum = 0;
    ll res = 0;
    ll ind = 1;
    while(sum < x){
        sum += ind++;
        res++;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
const int w=2e5+5;
int a[w],b[w];
int dp[w];
int main()
{
    int i,j;
    int h,n;
    cin>>h>>n;
    for(i=1;i<=n;i++)
        scanf("%d %d",&a[i],&b[i]);
    for(i=0;i<h;i++)
        dp[i]=1e9;
    for(i=h;i>=1;i--)
        for(j=1;j<=n;j++)
        {
            if(i>=a[j])
                dp[i-a[j]]=min(dp[i-a[j]],dp[i]+b[j]);
            else
                dp[0]=min(dp[0],dp[i]+b[j]);
        }
    cout<<dp[0]<<endl;
    return 0;
}


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

    int main()
    {

        int a, b, c, d, e, k;
        cin>>a>>b>>c>>d>>e>>k;

        if( abs(a-e) <= k)
            cout<<"Yay!"<<endl;
        else
            cout<<":("<<endl;

        return 0;

    }


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int i,n,m;
	int num = 0;
	int a[100000];
	for(i=0;i<100000;i++) a[i] = 0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&m);
		if(a[m]==0){
			a[m] = 1;
			num++;
		}
	}
	
	if(num%2==0){
			printf("%d\n",num-1);
		}else{
			printf("%d\n",num);
		}
	
	return 0;
}	

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int x;
	cin >> x;

	if (x < 1200)
	{
		cout << "ABC";
	}
	else
	{
		cout << "ARC";
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string  str;

    cin>>str;
    int count=1;

    for(int i=1;i<4;i++){
        if(str[0]==str[i]){
            ++count;
        }
    }
    if(count==2){
        if(str[0]==str[1]){
            if(str[2]==str[3]){
                cout<<"Yes"<<endl;
            }
            else{
                cout<<"No"<<endl;
            }
        }
        else{
            if((str[1]==str[2])||(str[1]==str[3])){
                cout<<"Yes"<<endl;
            }
            else{
                cout<<"No"<<endl;
            }
        }
    }
    else{
        cout<<"No"<<endl;
    }
}



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

using namespace std;

#define f first
#define s second
#define pub push_back
#define pob pop_back

typedef vector<int> vi;
typedef vector<vi> graf;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> wgraf;

typedef vector<double> vd;
typedef pair<double,double> dd;
typedef vector<dd> vdd;

typedef uint64_t ui64;

int main(){

	int n;
	cin >> n;

	vector<double> A(n);

	for(auto &x: A)
		cin >> x;

	double res = 0;

	for(auto x: A){
		res += (double)(1.0/x);
	}

	res = 1/res;
	printf("%.10f\n",res);

	return 0;
}


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

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  int min_m;
  cin >> min_m;
  x -= min_m;
  for ( int i = 0; i < n - 1; i++ ) {
    int m;
    cin >> m;
    x -= m;
    min_m = min( min_m, m );
  }
  int cnt = 0;
  bool flag = true;
  while( flag ) {
    x -= min_m;
    if ( x >= 0 ) cnt++;
    else flag = false;
  }
  cout << n + cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=1e6+10;
int n,x;
int odd,even,four;

int main(){
	cin>>n;
	while(n--){
		cin>>x;
		if(x%4==0) four++;
		else if(x%2==0) even++;
		else odd++;
	}
	string ans;
	if(even==0){
		if(odd<=four+1) ans="Yes";
		else ans="No";
	}else{
		if(odd<=four) ans="Yes";
		else ans="No";
	}
	cout<<ans;
	return 0;
}


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

int main(){

    string S;
    cin >> S;

    string odd,even;

    bool flag1 = true,flag2=true;
    for (size_t i = 0; i < S.length(); i++)
    {
        if(i%2==0){
            if(S[i]=='L'){
                flag1=false;
            }
        }else{
            if(S[i]=='R'){
                flag2=false;
            }
        }
    }

    if(flag1 && flag2)cout << "Yes" <<endl;
    else cout << "No" << endl;

    return 0;
}

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

vector<vector<int>> g;
vector<int> cnts;
vector<int> anss;
vector<bool> seen;

void dfs(int i, int sum){
  anss[i] = sum + cnts[i];
  seen[i] = true;
  
  for(int next:g[i]){
    if(seen[next]) continue;
    dfs(next,anss[i]);
  }
}

int main(){
  int n,q;
  cin >> n >> q;
  g.assign(n,vector<int>());
  cnts.assign(n,0);
  anss.assign(n,0);
  seen.assign(n,false);

  for (int i = 0; i < n-1; i++)
  {
    int a,b;
    cin >> a >> b;
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  for (int i = 0; i < q; i++)
  {
    int p,x;
    cin >> p >> x;
    cnts[p-1] += x;
  }

  dfs(0,0);
  for (int i = 0; i < n; i++)
  {
    cout << anss[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 24320
n = int(input())
t = list(map(int,input().split()))
m = int(input())
ans = list()

for i in range(m):
    p,x = map(int,input().split())
    s = t[p-1]
    t[p-1]=x
    ans.append(sum(t))
    t[p-1] = s
    
for an in ans:
    print(an)

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())


signed main(){

	lli k;
	cin>>k;

	vector<lli> a(k);
	REP(i,0,k)cin>>a[i];

	lli small=2;
	lli large=2;

	for(lli i=k-1;i>=0;i--){
		if(small>large){
			cout<<-1<<endl;
			return 0;
		}
		lli nextLarge = (large/a[i] + 1)*a[i] -1;
		lli nextSmall = (small/a[i] + (small%a[i]!=0) )*a[i];

		large = nextLarge;
		small = nextSmall;

		if(DEBUG)cout<<"i="<<i<<" large="<<large<<" smal="<<small<<endl;
	}
	if(small>large){
		cout<<-1<<endl;
		return 0;
	}

	cout<<small<<" "<<large<<endl;

	return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main {
    public static PrintWriter out;
    public static FastScanner in;

    private void solve(){
        int[] cnt = new int[100002];
        Arrays.fill(cnt,0);

        int n = in.nextInt();
        for(int i=0;i<n;i++){
            cnt[in.nextInt()]++;
        }
        int ans =n;
        for(int i=0;i<100001;i++){
            if(cnt[i] > 1){
                ans-= (cnt[i]-1);
            }
        }

        if(ans%2 ==0) ans--;

        out.print(ans);
    }

    private void runIO() {
        in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
    }
    private static class FastScanner {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        private FastScanner() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private String nextLine() {
            String ret = "";
            try {
                ret = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return ret;
        }
    }

    public static void main(String[] args) {
        new Main().runIO();
    }
}


Measured memory_bytes: 34908
#include<iostream>
using namespace std;
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int a,b;
	cin>>a>>b;
	string s3;
	cin>>s3;
	if(s3==s1){
		a = a-1;
	}
	else
		b = b-1;
	cout<<a<<" "<<b;
}

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

int main()
{
    cin>>N>>W;
    ll dp[N+1][W+1];
    ll w[N+1],c[N+1];
    for(ll i=1;i<=N;i++)
    {
        cin>>w[i]>>c[i];
    }
    for(ll i=0;i<=N;i++)
    {
        for(ll j=0;j<=W;j++)
        {
            if(i==0 || j==0) dp[i][j]=0;
            
            else
            {
                dp[i][j]=dp[i-1][j];
                if(j-w[i]>=0)
                dp[i][j]=max(dp[i][j],c[i]+dp[i-1][j-w[i]]);
            }
        }
    }
    cout<<dp[N][W];
    
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

template <typename T>
T powmod(T n, T k, T mod) {
  if (k == 0) {
    return 1;
  } else if (k % 2 == 0) {
    return powmod(n * n % mod, k / 2, mod);
  } else {
    return n * powmod(n, k-1, mod) % mod;
  }
}

template <typename T>
T inv(T x, T mod) {
  return powmod(x, mod-2, mod);
}

template <typename T>
T comb(T n, T k, T mod) {
  assert (0 <= k && k <= n);
  T ret = 1;
  for (T i = 0; i < k; i++) {
    ret *= n - i;
    ret %= mod;
    ret *= inv(i+1);
    ret %= mod;
  }
  return ret;
}


int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, K; cin >> N >> K;

  const ll mod = 1e9 + 7;

  vector<ll> fact(N + 10, 1), fact_inv(N + 10, 1);
  FOR(i, 2, N + 10) {
    fact[i] = (fact[i-1] * i) % mod;
    fact_inv[i] = inv(fact[i], mod);
  }

  FOR(i, 1, K+1) {
    ll blue = K, red = N - K;
    if (red < i-1) {
      cout << 0 << endl;
      continue;
    }

    ll red1_P_i = fact[red + 1] * fact_inv[red + 1 - i] % mod * fact_inv[i] % mod;
    ll m = blue - i + (i - 1);
    ll m_C_i1 = fact[m] * fact_inv[i-1] % mod * fact_inv[m-(i-1)] % mod;
    //cerr << red1_P_i << ' ' << m_C_i1 << ' ' << endl;
    cout << red1_P_i * m_C_i1 % mod << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)

long long N,M;
// int B[10000001][1000000001];

// int check(int x, int y) {
//     if (x < 0 || y < 0 || x >= N || y >= M) return 0;
//     else return 1;
// }

// int count_tile(int x, int y) {
//     int count = 1;
//     count += check(x+1,y) + check(x+1,y-1) + check(x,y-1) + check(x-1,y-1) + check(x-1,y) + check(x-1,y+1) + check(x,y+1) + check(x+1,y+1);
//     // cout << x << y << ":" << count  << endl;
//     return count;
// }

// //　自分の周囲+自分自身で何ますあるか　それが偶数か奇数か

int main(void){
    // Your code here!
    cin >> N >> M;
    if (N > M) swap(N,M);
    long long ans = 0;
    if (N == 1 && M == 1) ans = 1;
    else if (N == 1 && M != 1) ans = M - 2;
    else {
        ans = (N-2)*(M-2);
    }
    
    // if (ans <  0) ans = 0;
    // REP(i,0,N) {
    //     REP(j,0,M) {
    //         if (count_tile(i,j) % 2 == 1) ans += 1;
    //     }
    // }
    cout << ans << endl;
}


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

int main() {
    int n;
    cin>>n;
    printf("%d\n",n*n*n);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=924844033,MAX=1503*1503,INF=1<<30;

struct sikaku{
    int h;
    int w;
    int len;
    
    bool operator<(const sikaku& ano) const
    {
        if(len==ano.len) return h<ano.h;
        return len<ano.len;
    };
};

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<sikaku> S;
    for(int h=1;h<=150;h++){
        for(int w=h+1;w<=150;w++){
            S.push_back({h,w,h*h+w*w});
        }
    }
    
    sort(all(S));
    
    while(1){
        int a,b;cin>>a>>b;
        if(a==0&&b==0) break;
        auto it=upper_bound(all(S),sikaku{a,b,a*a+b*b});
        
        cout<<(*it).h<<" "<<(*it).w<<endl;
    }
}






Measured memory_bytes: 3344
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
B = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
    r = []
    for j in range(l):
        c = 0
        for k in range(m):
            c += A[i][k] * B[k][j]
        r.append(c)
    print(*r) 

Measured memory_bytes: 8640
#include <iostream>
#include <vector>

int main() {
  int n, k, x;
  std::vector<int> vec;
  std::cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    std::cin >> x;
    vec.push_back(x);
  }
  for (int i = k; i < n; ++i) {
    if (vec[i] > vec[i-k]) {
      std::cout << "Yes\n";
    }
    else {
      std::cout << "No\n";
    }
  }
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
#define MOD         1000000007
#define pb          push_back
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        '\n'
#define PI          3.14159265359d
#define sz(x)       (int)x.size()
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define magic        109
#define INF         INT_MAX
using namespace std;
const int MN = 20000000;


// struct trie
// {
//     int n;
//     int nodes[MN][2];

// void clear()
// {
//     n = 1; nodes[0][0] = nodes[0][1] = -1;
// }
// void insert(int x)
// {
//     int node = 0;
//     for(int i = 31; i>=0; i--)
//     {
//         int next = (x & 1<<i )!=0;
//         if(nodes[node][next]==-1)
//         {
//             nodes[node][next] = n;
//             nodes[n][0] = nodes[n][1] = -1;
//             n++;
//         }
//         node = nodes[node][next];
//     }
// }
// int query(int x)
// {
//     int node = 0;
//     int ans = 0;
//     for(int i = 31; i>=0; i--)
//     {
//         int next = fc (x & (1<<i))!=0;
//         int cool = -1;
//         if(nodes[node][next^1]==-1)
//         {
//             next^=1;
//             cool = 0;
//         }
//         if(cool)
//             ans+=1<<i;
//         if(nodes[node][next^1]==-1)while(true){}
//             node = nodes[node][next^1];
//     }
//     return ans;
// }
// };
// trie tree;
void solve(){
    string s;
    cin>>s;
    int n = s.length();
    int ans = 0;
    vector<string> st;
    string l = "";
    rep(i,0,n)
    {
        l += s[i];
        if(st.size()==0)
            {
                st.push_back(l);
                l="";
            }
        else if(st.back()!=l)
        {
            st.push_back(l);
            l = "";
        }
    }    
    cout<<st.size();









}

signed main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int t=1;
    // cin>>t;

    while(t--)
        solve();
    
    return 0;
}

Measured memory_bytes: 11016