akhauriyash/Code-Regression huggingface dataset:
// Problem : D - Chat in a Circle
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
} 
ll factorial[1000007];
void fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ll i;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}
void bfs(vector<int> v[],int o,int n,int dp[]){
	queue<int> q;
	q.push(o);
	dp[o]=0;
	bool visited[n+1]={0};
	visited[o]=true;
	while(q.empty()==false){
		int a=q.front();
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(visited[v[a][i]]==false){
				visited[v[a][i]]=true;
				q.push(v[a][i]);
				dp[v[a][i]]=dp[a]+1;
			}
		}
	}
}
int nov[1000001];
bool visited[1000001];
int dp[1000001];
int dfs(vector<int> v[],int o)
{
    if(visited[o]==0)
    {
        visited[o]=1;
        for(int i=0;i<v[o].size();i++)
        {
            if(visited[v[o][i]]==0)
            {
            dp[v[o][i]]=dp[o]+1;
            nov[o]+=dfs(v,v[o][i]);
            }
        }
        return nov[o]+1;
    }
    else
    return 0;
}
// string s=bitset<64>(n).to_string();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll n;
	cin>>n;
	ll a[n];
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
    int k=n-2;
    sum+=a[n-1];
    int j=n-2;
    while(k>0)
    {
    	if(k>=2)
    	{
    		sum+=2*a[j];
    		j--;
    		k-=2;
    	}
    	else
    	{
    		sum+=a[j];
    		k--;
    	}
    }
    cout<<sum;
	
	return 0;
}


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

#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;

// /////////////////////////////////////////////

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// ////////////////////////////////

#define int long long
const int mod = 998244353;
void solve(){

	int x , y;
	int a , b , c;
	cin>>x>>y>>a>>b>>c;

	int ans = 0;

	priority_queue<int> red , green , color;

	for(int i = 0 ; i < a ; ++i){

		int x;
		cin>>x;
		red.push(x);
	}

	for(int i = 0 ; i < b ; ++i){

		int x;
		cin>>x;
		green.push(x);
	}

	for(int i = 0 ; i < c ; ++i){

		int x;
		cin>>x;
		color.push(x);
	}
	multiset<int> fred , fgreen;

	while(x--){

		ans += red.top();
		fred.insert(red.top());
		red.pop();
	}
	while(y--){

		ans += green.top();
		fgreen.insert(green.top());
		green.pop();
	}

	while(1){

		int x = INT_MAX;

		if(!fred.empty()){

			x = *fred.begin();
		}

		int y = INT_MAX;
		if(!fgreen.empty())
			y = *fgreen.begin();

		if(x < y){

			if(!color.empty() && color.top() > x){

				ans-=x;
				ans += color.top();
				color.pop();
				fred.erase(fred.begin());
			}
			else break;
		}
		else {

			if(!color.empty() && color.top() > y){

				ans-=y;
				ans += color.top();
				color.pop();
				fgreen.erase(fgreen.begin());
			}
			else break;
		}
	}

	cout<<ans<<endl;
}

signed main(){

    //fast;
    int t = 1;
    //cin>>t;
    for(int i = 1 ; i <= t; ++i){

    	solve();
    }
}




Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
main(){
	string s,t;
	cin>>s;
	cin>>t;
	string p = s + s;
	if (p.find(t) != std::string::npos) {
    	std::cout << "Yes" << '\n';
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
let d x1 y1 x2 y2 = (x1 -. x2) ** 2. |> (+.) ((y1 -. y2) ** 2.) |> sqrt ;;
let () =
  let f = float_of_string in
  let x1, y1, x2, y2 = Scanf.scanf "%s %s %s %s\n" (fun x y z w -> f x, f y, f z, f w) in
  Printf.printf "%.10f\n" (d x1 y1 x2 y2) ;;


Measured memory_bytes: 2456
import math

N = int(input())

MOD = 10 ** 9 + 7

# 試し割り法(2以外の偶数は捨てる方法を追加)
def check_prime(n):
    flag = True

    # n:evenかつ2でないならば素数でない
    # n=1は素数でない,n=0も実装しやすいように入れておく
    if (n % 2 == 0 and n != 2) or n == 0 or n == 1:
        flag = False
        return(flag)

    # n:oddまたは2のときは考える
    else:
        # 2からrootnまでに約数は存在しうる
        for i in range(2, math.floor(math.sqrt(n))+1):
            if n % i == 0:
                flag = False
                break
        return(flag)

# N以下の素数を格納
prime = []
for i in range(N+1):
    if check_prime(i):
        prime.append(i)

M = len(prime)
cnt = [0]*M # primeで割れる個数を格納
for i in range(1, N+1):
    for j in range(M):
        p = prime[j]
        if p > i:
            break
        else:
            while i % p == 0:
                i //= p
                cnt[j] += 1

ans = 1
for i in range(M):
    ans *= cnt[i] + 1
    ans %= MOD
print(ans)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
	int n, a, x, y;

	float z=0;

	scanf("%d", &n);

	for (x = 0; x < n; x++) {
		scanf("%d", &a);
		z = z + 1.0 / a;
	}

	z = 1.0 / z;

	printf("%f", z);

	return 0;

}

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

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

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

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

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

int main()
{

  int n;
  cin >> n;
  int l[20];
  int sum = 0;
  int ma = 0;
  rep(i, n)
  {
    cin >> l[i];
    sum += l[i];
    ma = max(ma, l[i]);
  }
  if(sum-ma>ma)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;

string to_string(string s) { return s; }

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  cin.tie(0);
	int A,B;
	cin>>A>>B;
	if(A>=10||B>=10){
		print(-1);
	}else{
		print(A*B);
	}
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<vector<int>>V(2,vector<int>(N));
  
  for(int i=0;i<=1;i++){
    for(int j=0;j<N;j++){
      cin>>V.at(i).at(j);
    }
  }
  
  int ans=0;
  
  for(int i=0;i<N;i++){
    int sum=0;
    
    for(int j=0;j<=i;j++){
      sum+=V.at(0).at(j);
    }
    for(int j=i;j<N;j++){
      sum+=V.at(1).at(j);
    }
    
    ans=max(ans,sum);
    
    
  }
  
  
  
  
  
  
  
  cout<<ans<<endl;
  
  
}

Measured memory_bytes: 256
using System;
class Program {
    static void Main(string[] args) {
        string[] input = Console.ReadLine().Split();
        long x = long.Parse(input[0]);
        long y = long.Parse(input[1]);
        long mod = 1000000007;

        if ((x + y) % 3 != 0) {
            Console.WriteLine("0");
            return;
        }

        long a = (2 * x - y) / 3;
        long b = (2 * y - x) / 3;

        //片方でも負の数があれば、答えはゼロとなる
        if (a < 0 || b < 0) {
            Console.WriteLine("0");
            return;
        }
        //片方でも0があれば、答えは1となる
        if (a == 0 || b == 0) {
            Console.WriteLine("1");
            return;
        }

        //a >= bとなるように順番を操作する（順番は関係ないため）
        if (a < b) {
            long temp = b;
            b = a;
            a = temp;
        }

        //逆元の配列を作る
        long[] inv = new long[a];


        //まずは分子のmodを計算する
        long ans = FactorialMod(a + b, mod);

        //分母の逆元modをかける
        ans = ans * FactoricalModInv(a, mod) % mod * FactoricalModInv(b, mod) % mod;

        Console.WriteLine(ans);
    }

    //mod付き階乗の計算
    static long FactorialMod(long n, long m) {
        if (n == 1) {
            return 1;
        }
        return n * FactorialMod(n - 1, m) % m;
    }

    //aの逆元を求める
    static long ModInv(long a, long M) {
        if (a == 1) {
            return 1;
        }

        long m = (-(ModInv(M % a, M) * (M / a))) % M;
        if (m < 0) {
            m += M;
        }

        return m;
    }

    //分母の階乗をしながら逆元を求めていく
    static long FactoricalModInv(long a, long M) {
        if (a == 1) {
            return 1;
        }
        return FactoricalModInv(a - 1, M) * ModInv(a, M) % M;
    }
}

Measured memory_bytes: 34000
// Aizu Vol0 0054: Sum of Nth decimal places
// 2017.7.30

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int a, b, n;
	int i, s;

	while (scanf("%d%d%d", &a, &b, &n) == 3) {
		s = 0;
		a %= b;
		for (i = 0; a > 0 && i < n; i++) {
			a *= 10;
			s += a / b;
			a %= b;
		}
		printf("%d\n", s);
	}
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
#define INF 200000000
using ll = long long;

vector<int> coutdp(100001);

int main(){
    fill(coutdp.begin(),coutdp.begin()+100000,INF);
    int n;
    cin >> n;
    vector<int> h(n+1);
    for(int i=1;i<=n;i++)    cin >> h[i];
    coutdp[1] = 0;
    coutdp[2] = abs(h[1]-h[2]);
    for(int i=3;i<=n;i++){
        coutdp[i] = min(coutdp[i-2]+abs(h[i-2]-h[i]),coutdp[i-1]+abs(h[i-1]-h[i]));
    }
    cout << coutdp[n] << endl;
    return 0;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val MOD = (1e9).toLong() + 7
    val (H, W, K) = readLine()!!.split(" ").map {it.toInt() }

    val dp1 = Array(W + 1) { ModInt(0, MOD) }

    dp1[0] = ModInt(1, MOD)

    for (i in 1..W) {
        dp1[i] += dp1[i - 1]
        if (i > 1) {
            dp1[i] += dp1[i - 2]
        }
    }

    val dp = Array(H + 1) { Array(W) { ModInt(0, MOD)} }

    dp[0][0] = ModInt(1, MOD)

    fun f(x: Int, n: Int): ModInt {
        if (x == 0 || x + n == W - 1) {
            return dp1[W - 1 - n]
        }

        return dp1[x] * dp1[W - n - x - 1]
    }

    for (i in 1..H) {
        for (j in 0 until W) {
            dp[i][j] += dp[i - 1][j] * f(j, 0)

            if (j > 0) {
                dp[i][j] += dp[i - 1][j - 1] * f(j - 1, 1)
            }

            if (j < W - 1) {
                dp[i][j] += dp[i - 1][j + 1] * f(j, 1)
            }
        }
    }

    println(dp[H][K - 1].value)
}

class ModInt (value: Long, val mod: Long) {
    init {
        if (mod <= 0) {
            throw IllegalArgumentException("ModInt cannot be created for non-positive modulus: $mod")
        }
    }

    val value = (value % mod + mod) % mod

    private fun assertSameMod(other: ModInt) {
        if (mod != other.mod) {
            throw IllegalArgumentException(
                "You cannot operate summation, subtraction and multiplication for ModInts with different moduli: $mod, ${other.mod}"
            )
        }
    }

    operator fun unaryMinus() = ModInt(mod - value, mod)

    operator fun plus(other: ModInt): ModInt {
        assertSameMod(other)

        return ModInt((value + other.value) % mod, mod)
    }

    operator fun plus(other: Long) = plus(ModInt(other, mod))

    operator fun minus(other: ModInt): ModInt {
        assertSameMod(other)

        return plus(-other)
    }

    operator fun minus(other: Long) = minus(ModInt(other, mod))

    operator fun times(other: ModInt): ModInt {
        assertSameMod(other)

        return ModInt((value * other.value) % mod, mod)
    }

    operator fun times(other: Long) = times(ModInt(other, mod))

    fun pow(k: Long): ModInt {
        var res = 1L
        var a = value
        var l = k

        while (l > 0) {
            if ((l and 1L) == 1L) {
                res = (res * a) % mod
            }

            a = a * a % mod
            l /= 2L
        }

        return ModInt(res, mod)
    }

    /**
     * Returns an inverse element of the value.
     * To ensure `m * m.inv() = 1`, the modulus should be prime, since it uses Fermat's little theorem.
     */
    fun inv() = pow(mod - 2)

    operator fun div(other: ModInt): ModInt {
        assertSameMod(other)
        if (other.value == 0L) {
            throw ArithmeticException()
        }

        return times(other.inv())
    }

    operator fun div(other: Long) = div(ModInt(other, mod))
}


Measured memory_bytes: 37680
N=int(input())
A=list(map(int,input().split()))

r,S,R=0,0,0

for l in range(N):
  while r<N:
    if S&A[r]==0:
      S|=A[r]
      r+=1
    else:
      break
  R+=r-l
  S&=~A[l]

print(R)


Measured memory_bytes: 24424
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(long long h) {
        map<long long, long long> memo;
        memo[0] = 0;
        memo[1] = 1;

        function<long long(long long)> calc = [&](long long x) {
            auto it = memo.find(x);
            if (it != memo.end()) {
                return it->second;
            }
            auto& res = memo[x];
            res = 1 + calc(x / 2) * 2;
            return res;
        };

        return calc(h);
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    Solution sol;
    long long h;
    cin >> h;
    cout << sol.solve(h) << "\n";

    return 0;
}

Measured memory_bytes: 256
# N = int(input())
# D = list(map(int, input().split()))
# count = [0] * N
# ans = 1
# if (D[0] != 0 or count[0] >= 2):
#     print(0)
#     exit()
# for d in D:
#     count[d] += 1
# for i in range(N):
#     if (i > 0):
#         ans *= (count[i - 1] ** count[i]) % 998244353
#         ans %= 998244353

# print(ans)


# from collections import Counter
N = int(input())
D = list(map(int, input().split()))
MOD = 998244353

# 厳密にはmax(D)+1の長さがあれば正常系は通るが、余分に取っておく
count = [0] * N
for d in D:
    count[d] += 1

def calc():
    if D[0] != 0 or count[0] >= 2:
        return 0
    ret = 1
    for i in range(N):
        if i > 0:
            ret *= (count[i-1] ** count[i]) % MOD
            ret %= MOD
    return ret


print(calc())


Measured memory_bytes: 14396
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int n,k;
    cin>>n>>k;
    int a[n+4];
    f(i,1,n)cin>>a[i];
    int yo[n+4];
    clr(yo);
    int tym=0;
    int cur=1;
    int ok;
    while(1)
    {
        if(yo[cur]==0)
        {
            yo[cur]=tym;
            cur=a[cur];
            tym++;
            k--;
            if(k==0)
            {
                cout<<cur<<endl;
                return 0;
            }
        }
        else
        {
            int prv=yo[cur];
            int now=tym;
            int len=now-prv;
            k=k%len;
            ok=cur;
            break;
        }
    }
    while(k--)
    {
        ok=a[ok];
    }
    cout<<ok<<endl;
    return 0;

}





































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

using namespace std;

int r(char s){
	if(s=='I')return 1;
	if(s=='V')return 5;
	if(s=='X')return 10;
	if(s=='L')return 50;
	if(s=='C')return 100;
	if(s=='D')return 500;
	if(s=='M')return 1000;
}

int main()
{
	string str;
	while(cin>>str){
		int s=str.size(),i=0,sum=0;
		for(i=0;i<s-1;i++){
			if(r(str[i])>=r(str[i+1]))sum+=r(str[i]);
			else{
				sum+=r(str[i+1])-r(str[i]);
				i++;
			}
		}
		if(i<s)sum+=r(str[i]);
		cout<<sum<<endl;
		str.clear();
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  ll r = min(b - 1, n);
  cout << (a * r) / b << endl;
}

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

int main() {
  
  vector<char> t(10);
  rep(i,10) cin >> t[i];
  
  t[3] = '8';
  
  rep(i,10) cout << t[i];
  cout << endl; 
  
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>

#include <utility>
#include <vector>
#include <limits>
#include <algorithm>
#include <map>
using namespace std;

#define rep_init(i, init, n) for(int i = (init); i < n; ++i)
#define rep(i, n) rep_init(i, 0, n)

constexpr int64_t INF = numeric_limits<int64_t>::max();

void Main()
{
	int H, N;
	cin >> H >> N;

	vector<int> A(N), B(N);
	rep(i, N)
	{
		cin >> A[i] >> B[i];
	}
	
	vector<vector<int64_t>> dp(N, vector<int64_t>(H+1, INF));
	rep(i, N)
	{
		dp[i][0] = 0;
	}

	rep_init(i, 1, H+1)
	{
		if (i - A[0] < 0) dp[0][i] = dp[0][0] + B[0];
		else dp[0][i] = dp[0][i - A[0]] + B[0];
	}

	rep_init(i, 1, N)
	{
		rep_init(j, 1, H+1)
		{
			if (j - A[i] < 0) dp[i][j] = dp[i][0] + B[i];
			else dp[i][j] = min(dp[i][j - A[i]], dp[i-1][j - A[i]]) + B[i];

			dp[i][j] = min(dp[i][j], dp[i-1][j]);
		}
	}

	cout << dp[N-1][H] << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 78464
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int n,i;
    cin>>n>>i;
    cout<<n-i+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>  
#include <unordered_set>
#define _USE_MATH_DEFINES
#include <cmath>
#define ll long long

using namespace std;

const double pi = 3.14159265358979323846;

vector<int> g[100005];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll A, B, C, K;

	cin >> A >> B >> C >> K;

	if (A >= K) {
		cout << K << endl;
	}
	else {

		ll left = K - A;

		if (B > left) {
			cout << left << endl;
		}
		else {

			ll evenMoreLeft = left - B;
			cout << evenMoreLeft * -1 + 0 + A << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 5964
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int num[31];

int main()
{
	int n,c;
	cin >> n >> c;
	
	vector<pair<pair<int,int>,int> > v;
	
	REP(i,n)
	{
		int ss,tt,cc;
		cin >> ss >> tt >> cc;
		
		ss = ss * 2 - 1;
		tt = 2 * tt;
		
		v.PB(MP(MP(ss,cc),1));
		v.PB(MP(MP(tt,cc),-1));
	}
	
	sort(ALL(v));
	
	int ans = 0;
	int now = 0;
	REP(i,v.size())
	{
		int tmp = v[i].FI.SE;
		num[tmp] += v[i].SE;
		if(v[i].SE > 0 && num[tmp] == 1)
		{
			now++;
		}
		if(num[tmp] == 0)
		{
			now--;
		}
		ans = max(ans,now);
	}
	
	cout << ans << endl;
		
	
	return 0;
}

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

int main(){
	int m,d;
	cin >> m >> d;
	int num=0;
	for(int i=10;i<=d;i++){
		if(i%10 >=2 && i/10 >=2){
			if(i%10 * (i/10) <= m){
				num++;
			}
		}
	}
	cout << num << endl;2 ;
}

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

using namespace std;

const int maxn = 1e5 + 20;
int n, a[maxn], o;

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (a[i] % 2 == 1)
		{
			o++;	
		}	
	}	
	if (o % 2 == 1)
	{
		cout << "NO";
		return 0;
	}
	cout << "YES";
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
  string s;
  cin >> s;
  vec(a,26);
  REP(i,s.size()){
    int t = s[i] - 'a';
    a[t]++;
  }
  bool ans = true;
  REP(i,26){
    if(a[i]%2 != 0){
      ans = false;
    }
  }
  (ans)? cout << "Yes" : print("No");
  return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int monsterHealth, attacksDone, attacksAmount;
	scanf("%d""%d",&monsterHealth, &attacksDone);

	attacksAmount = round(monsterHealth / attacksDone);

	if (attacksAmount * attacksDone < monsterHealth)
	{
		attacksAmount++;
	}

	printf("%d \n", attacksAmount);

	return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(float, input().split()))
b = list(map(float, input().split()))

c = [abs(a[i] - b[i]) for i in range(n)]

for k in range(1, 4):
    ans = 0
    for d in c:
        ans += d ** k
    print("{:.6f}".format(ans ** (1/k)))
    
print("{:.6f}".format(max(c)))


Measured memory_bytes: 5672
from copy import copy


def main():
    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    tmp_list = copy(A_list)
    tmp_list.sort()
    max_num = tmp_list[-1]
    second_max_num = tmp_list[-2]
    max_index = A_list.index(max_num)
    for i in range(N):
        if i is max_index:
            print(second_max_num)
            continue
        print(max_num)


if __name__ == '__main__':
    main()


Measured memory_bytes: 70232
s = input()
s += "R"
cntr = 1
cntl = 0
flag = True
ans = [0 for n in range(len(s))]
for i in range(1,len(s)):
    if flag:
        if s[i] == "R":
            cntr += 1
        else:
            ans[i-1] = (cntr+1)//2
            ans[i] = cntr - ans[i-1]
            flag = False
            cntl = 1
            start = i
    else:
        if s[i] == "L":
            cntl += 1
        else:
            k = (cntl+1)//2
            ans[start] += k
            ans[start-1] += cntl-k
            flag = True
            cntr = 1
ans.pop()
print(" ".join(map(str,ans)))

Measured memory_bytes: 10492
#include<iostream>
#include<stdio.h>
using namespace std;
int main() {
	int a, b, t;
	cin >> a;
	cin >> b;
	cin >> t;
	int sum = 0;
	int i;
	for (i = 0; i < t; i++) {
		if ((i + 1) % a == 0) sum = sum + b;
	}
	cout << sum << "\n";
}

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

using namespace std;

int main()
{
  long long X, Y;
  cin >> X >> Y;
  long long ans = 0;
  while (X <= Y)
  {
    X *= 2;
    ans++;
  }
  cout << ans << endl;

  return 0;
}


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

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }


int main(){
    ll N , X;
    cin >> N >> X;
    vector<ll> x(N + 1 , 0);
    vector<ll> num(N , 0);

    x[0] = X;
    for(int i = 1; i <= N; i++) cin >> x[i];

    for(int i = 0; i < N; i++)   num[i] = abs(x[i] - x[i + 1]);

    ll ans = 0;
    ll a = num[0];
    for (int i = 1; i < N; i++) {
        a = gcd(a, num[i]);
    }
    cout << a << endl;

}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, A: "List[int]"):
    total = sum(A)
    x = [0]*N
    x[0] = sum([2*A[i] for i in range(0, N, 2)])-total
    for i in range(N-1):
        x[i+1] = 2*A[i]-x[i]
    print(*x, sep=" ")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


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

vector<pair<int, int>> edge[100100];
vector<int> graph(100100);

int dfs(int n, int p, int c){
  graph[n] = c;
  for(auto to: edge[n]){
    if(to.first==p) continue;
    if(to.second%2==1) dfs(to.first, n, not c);
    else dfs(to.first, n, c);
  }
}

int main() {
  int n;
  cin >> n;
  rep(i, n){
    int u, v, w;
    cin >> u >> v >> w;
    edge[u].emplace_back(v, w);
    edge[v].emplace_back(u, w);
  }
  dfs(1, -1, 0);
  REP(i, 1, n+1){
    cout << graph[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 8448
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll ans = 0;
  ll tmp;
  ll num = 0;
  for(int i = 0; i < n; i++) {
    cin >> tmp;
    ans += tmp / 2;
    if(tmp > 0) {
      num += tmp % 2;
      if(num >= 2) {
        ans += num / 2;
        num = 0;
      }
    } else {
      num = 0;
    }
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

const double PI = acos(-1.0);

int main() {
  vector<int> a(2), b(2);
  scanf("%d %d %d %d", &a[0], &a[1], &b[0], &b[1]);
  if (a[0] > b[0]) {
    swap(a, b);
  }
  int n;
  vector<vector<int>> var;
  scanf("%d", &n);
  int flag = a[1] <= b[1] ? 1 : -1;
  while (n--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x >= a[0] && x <= b[0] && y >= min(a[1], b[1]) && y <= max(a[1], b[1])) {
      var.push_back({x, flag * y});
    }
  }
  sort(var.begin(), var.end());
  vector<int> t;
  for (auto &v : var) {
    if (t.empty() || t.back() < v[1]) {
      t.push_back(v[1]);
    }
    else {
      int low = 0, high = t.size() - 1;
      while (low < high) {
        int mid = (low + high) >> 1;
        if (t[mid] < v[1]) {
          low = mid + 1;
        }
        else {
          high = mid;
        }
      }
      t[low] = v[1];
    }
  }
  double res = 100.00 * (abs(a[0] - b[0]) + abs(a[1] - b[1]));
  if (t.size() == min(abs(a[0] - b[0]), abs(a[1] - b[1])) + 1) {
    res -= (t.size() - 1) * (20.0 - PI * 5.0) - (10.0 * PI - 20);
  }
  else {
    res -= t.size()* (20.0 - PI * 5.0);
  }
  printf("%.15f\n", res);
  return 0;
}


Measured memory_bytes: 14380
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n, W = map(int, input().split())
    dp = [INF] * (n * 1001 + 1)
    dp[0] = 0
    for _ in range(n):
        w, v = map(int, input().split())
        for v0 in range(n * 1001, -1, -1):
            if dp[v0] == INF:
                continue
            if v + v0 <= n * 1001:
                dp[v + v0] = min(dp[v + v0], dp[v0] + w)
    for v in range(n * 1001, -1, -1):
        if dp[v] <= W:
            print(v)
            return
resolve()

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<30;
const ll LLINF = 1LL<<62;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << max(0, min(d,b)-max(a,c)) << endl;
}


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

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int k = 1, i = 1;
	string s, tmp;
	cin >> s;
	tmp = s[0];
	while (i < s.size()) {
		if (tmp.size() == 1 and tmp[0] == s[i]) {
			if (i < s.size() - 1) {
				tmp = s.substr(i, 2);
				k++;
			}
			i += 2;
		} else {
			tmp = s[i];
			i++; k++;
		}
	}
	cout << k << endl;
	return 0;
}

Measured memory_bytes: 720
import java.util.*;
import java.io.*;
class Main{

     public static void main(String []args) throws Exception{
        //System.out.println("Hello World");
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        int N,k;
        String s;
        s=br.readLine();
        String ss[]=s.split(" ");
     N=Integer.parseInt(ss[0]);
     k=Integer.parseInt(ss[1]);
     
     int arr[]=new int[N];
     s=br.readLine();
     ss=s.split(" ");
     
     for(int i=0;i<N;i++)
     {
     arr[i]=Integer.parseInt(ss[i]);
     }
     if(N==2)
     {
         System.out.println(Math.abs(arr[0]-arr[1]));
     }
     else{
     long dp[]=new long[N];
     dp[0]=0l;
     dp[1]=Math.abs(arr[1]-arr[0])*1l;
     long temp=10000000009l;
     for (int i=2;i<N;i++)
     {
         temp=1000000009l;
         for(int j=1;j<=k;j++)
         {
             if(i-j<0)
             {
                 continue;
             }
             long var=(dp[i-j]+Math.abs(arr[i]-arr[i-j]))*1l;
             temp=Math.min(var,temp);
             
         }
         dp[i]=temp;
         
     }
         
         
         
       
System.out.println(dp[N-1]);         
     }
     }
         
         
         
         
         
     }


Measured memory_bytes: 35852
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define rg register
#define ll long long 
#define inf 0x3f3f3f3f
inline int read()
{
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
int n,k,l,r,res=inf;
int a[100005];
int main(){

    n=read();k=read();
    for(int i=1;i<=n;i++)
        a[i]=read();
    
    sort(a+1,a+1+n);

    l=1;r=k;
    while(r<=n)
    {
        res=min(res,a[r]-a[l]);
        l++;r++;
    }
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

#define reps(i,f,n) for(ll i=f; i<ll(n); ++i)
#define rep(i,n) reps(i,0,n)

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

signed main()
{
    string s;
    cin >> s;
    cout << ((s.size() >= 4 && s.substr(0, 4) == "YAKI") ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import itertools
n,k=map(int,input().split())
List=[]
for i in range(k):
    s=input()
    List.append(list(map(int,input().split())))
List=list(itertools.chain.from_iterable(List))
cnt=0
for i in range(1,n+1):
    if i not in List:
        cnt+=1
print(cnt)

Measured memory_bytes: 9228
def answerA():
    a, b = map(int, input().split())
    if a < 10 and b < 10:
        result = a * b
    else:
        result = -1

    print(result)


def answer():
    def can_be_devided_by_1d(n):
        result = 'No'
        for i in range(1,10):
            floor, mod = divmod(n, i)
            if mod == 0 and floor < 10:
                result = 'Yes'
        return result

    n = int(input())
    print(can_be_devided_by_1d(n))


if __name__ == '__main__':
    answer()


Measured memory_bytes: 3064
#include<stdio.h>
int main(){
  int n,A[100],i,j,x,flag;
  int count;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  count=0;
    flag=1;
    i=0;
    while(flag){
      flag=0;
      for(j=n-1;j>=i+1;j--){
	if(A[j]<A[j-1]){
	  x=A[j];
	  A[j]=A[j-1];
	  A[j-1]=x;
	  flag=1;
	count++;
	}
      }
    }
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",count);
  return 0;
}



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

int a[21][11][156];

int f(int n, int k, int s){
	if(n <= 0 || k <= 0 || s <= 0)
		return 0;
	if(a[n][k][s] == -1){
		if(k == 1){
			if(n >= s) a[n][k][s] = 1;
			else a[n][k][s] = 0;
		}else{
			a[n][k][s] = 0;
			for(int i=2; i<=n; ++i)
				a[n][k][s] += f(i-1, k-1, s-i);
		}
	}
/*	if(a[n][k][s] != 0){
		cout << n << " " << k << " " << s << "\n";
		cout << a[n][k][s] << "\n";
	}
*/	return a[n][k][s];
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	memset(a, -1, sizeof(a));
	while(1){
		int n, k, s;
		cin >> n >> k >> s;
		if(n+k+s==0) return 0;
		cout << f(n, k, s) << "\n";
	}
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio (false);
	cout << fixed;
	cout.precision(10);
	if(fopen("joke.in", "r")){
		freopen ("joke.in","r",stdin);
		freopen ("joke.out","w",stdout);
	}

	int n;
	cin >> n;
	vector<int> h(n);
	for(int i = 0; i < n; ++i){
		cin >> h[i];
	}

	int best = 0;
	int cur = 0;
	for(int i = 0; i < n - 1; ++i){
		if(h[i] >= h[i + 1]){
			cur++;
		}else{
			best = max(best, cur);
			cur = 0;
		}
	}

	best = max(best, cur);
	cout << best;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pair<int,int> a, pair<int,int> b) {
	return a < b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
	}
	vint b(n, -1);
	drep(i, n) {
		if (i > n / 2) {
			b[i] = a[i];
		}
		else {
			int tmp = (i + 1) * (n / (i + 1));
			int cnt = 0;
			for (int j = tmp; 1 <= j; j -= i + 1) {
				if (b[j - 1] != -1) {
					cnt += b[j - 1];
					cnt %= 2;
				}
				else {
					if (cnt == a[i]) {
						b[j - 1] = 0;
					}
					else {
						b[j - 1] = 1;
					}
				}
			}
		}
	}
	int cnt = 0;
	rep(i, n) {
		cnt += b[i];
	}
	cout << cnt << endl;
	rep(i, n) {
		if (b[i] == 1) {
			cout << i + 1 << " ";
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 2432
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class C {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        long K, N;
        Input(out K, out N);
        long[] A;
        Inputs(out A);
        Array.Sort(A);
        long[] P = new long[N];
        P[0] = K - A[N - 1] + A[0];
        for(long i = 1; i < N; i++) {
            P[i] = A[i] - A[i - 1];
        }
        Array.Sort(P);
        Array.Reverse(P);
        Print(K - P[0]);
        Out.Flush();
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void Inputs<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

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

int main(){
  string S, T; cin >> S >> T;
  int A, B; cin >> A >> B;
  string U; cin >> U;
  
  if (S==U){
    cout << A - 1 <<  " " << B << endl;
  }
  else {
    cout << A << " " <<  B - 1 << endl;
  }
}


Measured memory_bytes: 256