akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main() {
    int x;
    int i;
    scanf("%d", &x);
    if (x>=400&&x<=599) {
        printf("8\n");
    } else if (x>=600&&x<=799) {
        printf("7\n");
    } else if (x>=800&&x<=999) {
        printf("6\n");
    } else if (x>=1000&&x<=1199) {
        printf("5\n");
    } else if (x>=1200&&x<=1399) {
        printf("4\n");
    } else if (x>=1400&&x<=1599) {
        printf("3\n");
    } else if (x>=1600&&x<=1799) {
        printf("2\n");
    } else if (x>=1800&&x<=1999) {
        printf("1\n");
    } else {
        printf("error\n");
    }
    return 0;
}

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

int main(){
    string s1,s2,s3,s[55]={""};
    cin>>s1>>s2;
    int len1=s1.size(),len2=s2.size(),n=0;
    for(int i=0;i<len1-len2+1;i++){
        int f=0;
        s3=s1.substr(0,i)+s2+s1.substr(i+len2);
        for(int j=0;j<len1;j++){
            if(s1[j]=='?'||s1[j]==s3[j]){
                continue;
            }
            f=1;
        }
        if(f==0){
            n++;
            s[n]=s3;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=0;j<s[i].size();j++){
            if(s[i][j]=='?'){
                s[i][j]='a';
            }
        }
    }
    sort(s+1,s+n+1);
    if(s[1]!="")cout<<s[1]<<endl;
    else cout<<"UNRESTORABLE"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    
    int x, y = 0;
    int money = 0;

    scanf("%d", &x);
    scanf("%d", &y);

    switch(x){
        case 1:
            money += 300000;
            break;

        case 2:
            money += 200000;
            break;

        case 3:
            money += 100000;
            break;
        
        default:
            money += 0;
            break;
    }

    switch(y){
        case 1:
            money += 300000;
            break;

        case 2:
            money += 200000;
            break;

        case 3:
            money += 100000;
            break;
        
        default:
            money += 0;
            break;
    }

    if(money == 600000){
        money += 400000;
    }

    printf("%d", money);

    return 0;
}

Measured memory_bytes: 128
Public Class Program
  Shared Sub Main()
    Dim s As String = Console.ReadLine()
    Dim t As String = Console.ReadLine()
    Dim ans As Integer = 0
    For i As Integer = 0 To 2
      If s(i) = t(i) Then ans += 1
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class

Measured memory_bytes: 13140
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<stack>
#include<array>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<numeric>
#include<random>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
using namespace std;

//MODが素数であることを前提として実装してあるが、その判定はしていない。
//あまりが出るような除算をしてはいけない。
template<int MOD = 1000000007>class modint {
public:
	modint() {
		this->number = 0;
	}
	modint(int src) {
		this->number = src;
	}
	modint<MOD> operator + (modint<MOD> obj) {
		modint re((this->number + obj.number) % MOD);
		return re;
	}
	modint<MOD> operator + (int n) {
		modint re((this->number + opposit(n)) % MOD);
		return re;
	}
	modint<MOD> operator - (modint<MOD> obj) {
		modint re((this->number - obj.number + MOD) % MOD);
		return re;
	}
	modint<MOD> operator - (int n) {
		modint re((this->number - opposit(n) + MOD) % MOD);
		return re;
	}
	modint<MOD> operator * (modint<MOD> obj) {
		modint re((this->number * obj.number) % MOD);
		return re;
	}
	modint<MOD> operator * (int n) {
		modint re((this->number * opposit(n)) % MOD);
		return re;
	}
	modint<MOD> operator / (modint<MOD> obj) {
		modint re((this->number * inverse(obj.number)) % MOD);
		return re;
	}
	modint<MOD> operator / (int n) {
		modint re((this->number * inverse(n)) % MOD);
		return re;
	}
	modint operator = (int n) {
		this->number = opposit(n) % MOD;
		return *this;
	}
	int get() {
		return number;
	}

private:
	int number;

	int opposit(int n) {
		if (n < 0)n = MOD - ((-n) % MOD);
		return n % MOD;
	}
	int inverse(int n) {
		n = opposit(n);
		int result = 1;
		for (int i = MOD - 2; i; i /= 2) {
			if (i % 2)result = (result * n) % MOD;
			n = (n * n) % MOD;
		}
		return result;
	}
};

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

	int H, W, A, B;
	cin >> H >> W >> A >> B;

	vector<modint<>>facto(H + W + 1);
	facto[0] = 1;
	REP(i, 1, facto.size())facto[i] = facto[i - 1] * i;





	int edgeh = H - A - 1;
	int edgew = B;
	modint<> result(0);
	while (0 <= edgeh && edgew < W) {
		//初期位置からedgeまでのパターン
		modint<>ans1 = facto[edgeh + edgew] / (facto[edgeh] * facto[edgew]);

		//edgeからゴールまでのパターン
		int eh2 = H - edgeh - 1;
		int ew2 = W - edgew - 1;
		modint<>ans2 = facto[eh2 + ew2] / (facto[eh2] * facto[ew2]);

		result = result + (ans1 * ans2);

		edgeh--;
		edgew++;
	}

	cout << result.get() << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<SZ(s);i++)
    {
        if(s[i]=='o')
        {
            cnt++;
        }
    }
    cout<<700+(cnt*100)<<NL;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;


template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int  S;
long long mod= 1000000007;
long long arr[2001];
int func(int x){

    if(x==3 || x==4 || x==5){
        return 1;
    }
    else if(x < 3){
        return 0;
    }
    else if(x == 6){
        return 2;
    }
    else if(x == 7){
        return 3;
    }/*
    else if(x == 8){
        return 4;
    }
    else if(x == 9){
        return 6;
    }
    else if(x == 10){
        return 9;
    }
    else if (x == 11){
        return 13;
    }
    else if (x == 12){
        return 18;
    }
    */
    long long ans = 0;
    /*
    for(int i = 3; i <= x-3; ++i){
        //ans += func(i)%mod * func(x-i)%mod;
        ans += func(i)%mod;
    }
    */
   //ans = func(x-1)%mod + func(x-3)%mod; 
    ans = arr[x-1]%mod + arr[x-3]%mod; 
    //ans *=2;
    //return ans+1;
    return ans%mod;
}

int main(){
    cin >> S;

    long long ans = 0;
    if (S <=2){
        cout << 0 << endl;
        return 0;
    }
    //ans  = func(S);
    
    /*
    for(int i = 3; i < S-3; ++i){

        ans += func(i)%mod * func(S-i)%mod;

    }
    */

   

   for (int i=1; i <= S; ++i){
       arr[i] = func(i);
   }
    cout << arr[S] << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n; double t, a; cin >> n >> t >> a;
  vector<double> h(n);
  for (int i = 0; i < n; i++) cin >> h[i];
  int ans = -1; double diff = 1e9;
  for (int i = 0; i < n; i++) {
    double tmp = (t - h[i] * 0.006);
    if (diff > abs(tmp - a)) {
      diff = abs(tmp-a);
      ans = i+1;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    
    if(a < b){
        cout << "a < b" << endl;
    }else if(a > b){
        cout << "a > b" << endl;
    }else{
        cout << "a == b" << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>

int main () {
	int n , i , j;
	while ( scanf("%d",&n),n ) {
		int data[16][16];
		int sumx[15] = {0} , sumy[15] = {0};
		for ( i = 0; i < n; i++ )
			for ( j = 0; j < n; j++ )
				scanf("%d",&data[i][j]);
		for ( i = 0; i < n; i++ ) {
			for ( j = 0; j < n; j++ ) {
				sumx[i] += data[i][j];
				sumy[i] += data[j][i];
			}
			sumy[j] += sumy[i];
		}
		for ( i = 0; i <= n; i++ ) {
			for ( j = 0; j < n; j++ ) {
				if ( i == n )
					printf("%5d",sumy[j]);
				else
					printf("%5d",data[i][j]);
			}
			if ( i == n ) printf("%5d\n",sumy[j]);
			else printf("%5d\n",sumx[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<ll,P> PP;
int main() {
	int n, k; cin >> n >> k;
	if (n%k)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/


vector<vector<int> > gg;

void add(vector<int> vv) {
	sort(vv.begin(), vv.end());
	for (int i: vv)
		cout << i << " ";
	cout << "\n";
	/*for (int i = 0; i < gg.size(); ++i) {
		int cnt = 0;
		for (int j: vv) {
			if (binary_search(gg[i].begin(), gg[i].end(), j))
				++cnt;
		}
		assert(cnt == 1);
	}
	gg.push_back(vv);*/
}

int main() {
	int k = 38;
	int n = k * (k - 1) + 1;
	cout << n << " " << k << "\n";
	vector<int> vv;
	for (int i = 1; i <= k; ++i)
		vv.push_back(i);
	add(vv);
	for (int i = 1; i <= k - 1; ++i) {
		vv.clear();
		vv.push_back(1);
		for (int j = 0; j < k - 1; ++j) {
			vv.push_back(2 + i * (k - 1) + j);
		}
		add(vv);
	}
	for (int i = 2; i <= k; ++i) {
		for (int j = 1; j <= k - 1; ++j) {
			vv.clear();
			vv.push_back(i);
			for (int l = 0; l < k - 1; ++l) {
				int sh = j - 1 + (i - 2) * l;
				sh %= (k - 1);
				vv.push_back(k + 1 + l * (k - 1) + sh);
			}
			add(vv);
		}
	}
	return 0;
}




Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <assert.h>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for (auto &&i : A) scanf("%d", &i);
    for (auto &&i : B) scanf("%d", &i);
    vector<int> cnt(n+1);
    for (int i = 0; i < n; ++i) {
        cnt[A[i]]++;
        cnt[B[i]]++;
    }
    for (int i = 0; i <= n; ++i) {
        if(cnt[i] > n){
            puts("No");
            return 0;
        }
    }
    auto X = A;
    vector<vector<int>> AA(n+1);
    for (int i = 0; i < n; ++i) {
        AA[A[i]].emplace_back(i);
    }
    puts("Yes");
    vector<int> ord(n+1);
    iota(ord.begin(),ord.end(), 0);
    sort(ord.begin(),ord.end(), [&](int x, int y){ return cnt[x] > cnt[y]; });
    vector<int> ordinv(n+1);
    for (int i = 0; i <= n; ++i) {
        ordinv[ord[i]] = i;
    }
    sort(A.begin(),A.end(), [&](int x, int y){ return ordinv[x] > ordinv[y]; });
    sort(B.begin(),B.end(), [&](int x, int y){ return ordinv[x] > ordinv[y]; });

    deque<int> Q1, Q2, Q3, Q4;
    int mode = 0;
    for (auto &&i : ord) {
        if(!cnt[i]) break;
        while(Q1.size()+Q2.size() < 2*n){
            if(!mode){
                if(!B.empty() && B.back() == i && Q1.size()+Q2.size() < n){
                    B.pop_back();
                    Q2.emplace_back(i);
                }else if(!A.empty() && A.back() == i && Q1.size()+Q2.size() < n){
                    A.pop_back();
                    Q1.emplace_back(i);
                }else if(Q1.size()+Q2.size() == n) {
                    mode = 1;
                }else break;
            }else {
                if(!A.empty() && A.back() == i){
                    A.pop_back();
                    Q3.emplace_front(i);
                }else if(!B.empty() && B.back() == i){
                    B.pop_back();
                    Q4.emplace_front(i);
                }else break;
            }
        }
    }
    while(!Q3.empty()){
        Q1.emplace_back(Q3.front());
        Q3.pop_front();
    }
    while(!Q4.empty()){
        Q2.emplace_back(Q4.front());
        Q4.pop_front();
    }
    vector<int> ans(n);
    for (int i = 0; i < n; ++i) {
        int a = AA[Q1.front()].back(); AA[Q1.front()].pop_back();
        ans[a] = Q2.back();
        Q1.pop_front(); Q2.pop_back();
    }
    for (int i = 0; i < n; ++i) {
        if(X[i] == ans[i]){
            for (int j = 0; j < n; ++j) {
                if(X[j] != ans[i] && X[i] != ans[j]){
                    swap(ans[i], ans[j]);
                    break;
                }
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        if(i) printf(" ");
        printf("%d", ans[i]);
    }
    puts("");
    return 0;
}

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

int main(){
  int n; cin >> n;
  if(n%1000 == 0){
    cout << 0 << endl;
    return 0;
  }
  cout << min(1000 , 1000-n%1000) << endl;


  return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>

using namespace std;

namespace {

const int G[14] = {
  1,
  4,
  13,
  40,
  121,
  364,
  1093,
  3280,
  9841,
  29524,
  88573,
  265720,
  797161,
  2391484,
};

inline int InsertionSort(int* a, int n, int g) {
  int cnt = 0;
  for (int i = g; i < n; ++i) {
    const int v = a[i];
    int j = i - g;
    while (j >= 0 && a[j] > v) {
      a[j + g] = a[j];
      j -= g;
      cnt++;
    }
    a[j + g] = v;
  }
  return cnt;
}

int ShellSort(int* a, int n) {
  int cnt = 0;
  int m = 0;
  for (int i = 0; i < 100; ++i) {
    ++m;
    if (G[i + 1] >= n) {
      break;
    }
  }

  printf("%d\n", m);
  for (int i = m - 1; i >= 0; --i) {
    if (i < m - 1) printf(" ");
    printf("%d", G[i]);
  }
  printf("\n");

  for (int i = 0; i < m; ++i) {
    cnt += InsertionSort(a, n, G[m - i - 1]);
  }

  return cnt;
}

}  // namespace

int main() {
  int n;
  int a[1000000];

  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  const int cnt = ShellSort(a, n);
  printf("%d\n", cnt);
  for (int i = 0; i < n; ++i) {
    printf("%d\n", a[i]);
  }
  return 0;
}

Measured memory_bytes: 5136
#include<bits/stdc++.h>
using namespace std;
const int MAX =1e5+5;
long long dp1[MAX],dp2[MAX],n;
bool vis[MAX];
vector<int>g[MAX];
const int MOD =1e9+7;
void dfs(int u,int p){

    for(v : g[u]){
        if(v != p)
                dfs(v,u);
    }
    int prod1=1;
    int prod2=1;
    for(v : g[u]){

        if(v!=p){
            prod1=(prod1*(dp1[v]+dp2[v])%MOD)%MOD;
            prod2 = (prod2*dp1[v])%MOD;

        }
    }
    dp1[u]=prod1;
    dp2[u]=prod2;
}


int main(){
    cin>>n;
    for(int i=1,u,v;i<n;i++){
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);

    }
    dfs(1,-1);
    cout<<(dp1[1]+dp2[1])%MOD;
    return 0;

}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std; 
    
int main(){
  int N,count=0;
  string A,B,C;
  cin >> N >> A >> B >> C;
  for(int i=0;i<N;i++){
    if(A.at(i)==B.at(i) && B.at(i)==C.at(i)){
      continue;
    }
    if(A.at(i)!=B.at(i) && B.at(i)!=C.at(i) && C.at(i)!=A.at(i)){
      count+=2;
    }
    else{
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3512
#line 1 "test/algebra/eratosthenes.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1276"

#include <bits/stdc++.h>
using namespace std;
using lint = long long;

#line 1 "test/algebra/../../library/algebra/eratosthenes.cpp"
// Eratosthenes's sieve
// create list of prime numbers in O(N)
// check if the given number is prime in O(1)
struct Sieve {
    vector<bool> isPrime;
    Sieve(size_t max) : isPrime(max + 1, true) {
        isPrime[0] = false;
        isPrime[1] = false;

        for (size_t i = 2; i * i <= max; ++i)
            if (isPrime[i])
                for (size_t j = 2; i * j <= max; ++j)
                    isPrime[i * j] = false;
    }
    bool operator()(size_t n) { return isPrime[n]; }
};
#line 8 "test/algebra/eratosthenes.test.cpp"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Sieve isPrime(2000000);
    int n;
    while (cin >> n) {
        if (n == 0)
            break;
        int l = n, r = n;
        while (!isPrime(l))
            l--;
        while (!isPrime(r))
            r++;
        cout << r - l << "\n";
    }
    return 0;
}



Measured memory_bytes: 3084
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    int entr[6], i, count, menor = INT_MAX;
    for(i = 0; i < 5; i++)cin >> entr[i];
    sort(entr, entr+5);
    do{
        count = 0;
        for(i = 0; i < 5; i++){
            while(count%10 != 0)count++;
            count += entr[i];
        }
        menor = min(menor, count);
    }while(next_permutation(entr, entr+5));
    cout << menor;
	return 0;
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
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 (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) { for (auto& e : t) fill_v(e, v); }

template<int MOD>
struct ModInt {
	static const int kMod = MOD;
	unsigned x;
	ModInt() :x(0) {}
	ModInt(signed x_) { x_ %= MOD; if (x_ < 0)x_ += MOD; x = x_; }
	ModInt(signed long long x_) { x_ %= MOD; if (x_ < 0)x_ += MOD; x = x_; }
	int get()const { return (int)x; }
	ModInt& operator+=(ModInt m) { if ((x += m.x) >= MOD)x -= MOD; return *this; }
	ModInt& operator-=(ModInt m) { if ((x += MOD - m.x) >= MOD)x -= MOD; return *this; }
	ModInt& operator*=(ModInt m) { x = (unsigned long long)x * m.x % MOD; return *this; }
	ModInt& operator/=(ModInt m) { return *this *= m.inverse(); }
	ModInt operator+(ModInt m)const { return ModInt(*this) += m; }
	ModInt operator-(ModInt m)const { return ModInt(*this) -= m; }
	ModInt operator*(ModInt m)const { return ModInt(*this) *= m; }
	ModInt operator/(ModInt m)const { return ModInt(*this) /= m; }
	ModInt operator-()const { return ModInt(MOD - (signed)x); }
	bool operator==(ModInt m)const { return x == m.x; }
	bool operator!=(ModInt m)const { return x != m.x; }
	ModInt inverse()const {
		signed a = x, b = MOD, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		if (u < 0)u += MOD;
		return ModInt(u);
	}
};
template<int MOD>
ostream& operator<<(ostream& os, const ModInt<MOD>& m) { return os << m.x; }
template<int MOD>
istream& operator>>(istream& is, ModInt<MOD>& m) { signed long long s; is >> s; m = ModInt<MOD>(s); return is; };

template<int MOD>
ModInt<MOD> pow(ModInt<MOD> a, unsigned long long k) {
	ModInt<MOD> r = 1;
	while (k) {
		if (k & 1)r *= a;
		a *= a;
		k >>= 1;
	}
	return r;
}

using mint = ModInt<MOD>;



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K; cin >> N >> K;
	vector<int> A(N); rep(i, 0, N) {
		cin >> A[i];
	}
	int cnt = 0;
	int cnt2 = 0;
	rep(i, 0, N)rep(j, i + 1, N) {
		if (A[i] > A[j])
			cnt++;
		else if (A[i] < A[j]) {
			cnt2++;
		}
	}
	dump(cnt, cnt2);
	mint k = mint(1 + K) * K / 2;
	mint k2 = mint(K - 1) * K / 2;

	dump(k);
	cout << k * cnt + k2 * cnt2 << endl;
	return 0;
}

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

int main() {
    double a, b;
    cin >> a >> b;
    if (b == 1){
        cout << 0 << endl;
        return 0;
    }
    for(int i=1; i<21; i++){
        int sum = 1 + (a-1)*(i);
        if (sum >= b){
            cout << i << endl;
            return 0;
        }
    }
}

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

long long int n,a,b;

int main() {
cin>>n>>a>>b;

if(n%(a+b)==0){
cout << (n/(a+b))*a<<endl;
}else{
if(n%(a+b)<a){
cout << (n/(a+b))*a + n%(a+b)<<endl;
}else{
cout << (n/(a+b))*a + a<<endl;
}


}



}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

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

  int n;
  cin >> n;

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

  for (int i = 0; i < n; i++) {
    int num = b[i];

    for (int y = 0; y < 3; y++) {
      for (int x = 0; x < 3; x++) {
        if (a[y][x] == num) {
          a[y][x] = 0;
        }
      }
    }
  }

  string ans = "No";

  for (int y = 0; y < 3; y++) {
    bool tok = true;
    bool yok = true;
    for (int x = 0; x < 3; x++) {
      if (a[y][x] != 0) {
        tok = false;
      }

      if (a[x][y] != 0) {
        yok = false;
      }
    }

    if (tok || yok) {
      ans = "Yes";
      break;
    }
  }

  if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) {
    ans = "Yes";
  }

  if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) {
    ans = "Yes";
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int top, S[1000];
 
void push(int x) {
  S[++top] = x;
}
 
int pop() {
  top--;
  return S[top+1];
}
 
int main() {
  int a, b;
  top = 0;
  char s[100];
 
  while( scanf("%s", s) != EOF ) {
    if ( s[0] == '+' ) {
      b = pop();
      a = pop();
      push(a + b);
    } else if ( s[0] == '-' ) {
      b = pop();
      a = pop();
      push(a - b);
    } else if ( s[0] == '*' ) {
      b = pop();
      a = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
 
  printf("%d\n", pop());
 
  return 0;
}


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

using namespace std;
using Graph = vector<vector<int>>;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 

const ll large_P = 1e9 + 7;

int char_to_int(char c){
  switch(c){
    case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
  }
}

// base を底としたときの、n の i桁目を、v.at(i) に入れる。(桁数は n に応じて自動で設定する。
void ll_to_vector(ll base, ll n, vector<int>& v){
  ll tempo = n;
  ll n_digit = floor(log10(n)/log10(base)) + 1;
  v.assign (n_digit, 0);
  for(ll i = 0; i < n_digit; i++){
    v.at(i) = tempo/pow(base, n_digit - 1 - i);
    tempo -= v.at(i) * pow(base, n_digit - 1 - i);
  }
}


void dfs(vector<ll> v, ll i, ll& sum_all, ll sum, ll now_digit){
  if(i < 0){
    sum_all += sum;
    //cout << "i " << i << " sum " << sum << endl;
  }
  
  if(i >= 0){
    sum += pow(10, now_digit)*v.at(i); 
    //cout << pow(10, now_digit)*v.at(i) << endl;
    dfs(v, i-1, sum_all, sum, now_digit+1);
    if(i>0) dfs(v, i-1, sum_all, sum, 0);
  } 
}



int main(){
  string S;
  cin >> S;
  ll N = S.size();
  
  vector<ll> vec_S(N);
  rep(i, N) vec_S.at(i) = char_to_int(S.at(i));
  
  ll sum_all = 0;
  ll sum = 0;
  dfs(vec_S, N-1, sum_all, sum, 0);
  
  cout << sum_all;
}

Measured memory_bytes: 256
n = int(input())
max_num = 0
s_dic = {}
for i in range(n):
    input_line = input()
    if input_line in s_dic:
        s_dic[input_line] = s_dic[input_line] + 1
    else:
        s_dic[input_line] = 1
    if s_dic[input_line] > max_num:
        max_num = s_dic[input_line]

anser_list = []
for key,value in s_dic.items():
    if value == max_num:
        anser_list.append(key)

anser_list.sort()
for key in anser_list:
    print(key)


Measured memory_bytes: 32096
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
s1 = [a1[0]]
s2 = [a2[-1]]
for i in range(n-1):
  s1 += [s1[i]+a1[i+1]]
  s2 += [s2[i]+a2[n-i-2]]
 
ans = 0
for i in range(n):
  ans = max(ans, s1[i] + s2[n-1-i])
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	
	int n, l;
	cin >> n >> l;
	
	string s[n];
	
	for(int i = 0; i < n; i ++){
		cin >> s[i];
	}
	
	sort(s, s+n);
	
	for(int i = 0; i < n; i ++){
		cout << s[i];
	}
	
	return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>

using namespace std;
const int mod = 1e9+7;
void ad(int &x,int y) { x+=y; if(x>=mod)x-=mod; }
int mu(int x,int y) { return 1ll*x*y%mod; }
int n;

int f[605][605][605],cc1,cc2;
int a[605],tp;
bool yd[605];
bool vis[605];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=2*n;i+=2) {
		int x,y; scanf("%d%d",&x,&y);
		if(x==-1&&y==-1) {
			cc2++;
		} else if(x==-1||y==-1) {
			a[++tp] = (x==-1)?y:x;
			cc1++;
			vis[a[tp]] = 1;
			yd[a[tp]] = 1;
		} else vis[x] = vis[y] = 1;
	}
	for(int i=1;i<=2*n;i++) if(!vis[i]) a[++tp] = i;
	sort(a+1,a+1+tp,greater<int>());
	f[0][0][0] = 1;
	for(int nm=0;nm<tp;nm++) {
		for(int j=0;j<=cc1+cc2;j++) {
			for(int k=0;k<=cc1;k++) {
				if(!f[nm][j][k]) continue;
				if(yd[a[nm+1] ]) {
					ad(f[nm+1][j][k+1],f[nm][j][k]);
					if(j>0) ad(f[nm+1][j-1][k],f[nm][j][k]);
				} else {
					ad(f[nm+1][j+1][k],f[nm][j][k]);
					if(j) ad(f[nm+1][j-1][k],f[nm][j][k]);
					if(k) ad(f[nm+1][j][k-1],mu(k,f[nm][j][k]));
				}
			}
		}
	}
	int tmp = f[tp][0][0];
	for(int i=2;i<=cc2;i++) tmp = mu(tmp,i);
	printf("%d",tmp);
}

Measured memory_bytes: 858368
import fractions

A, B, C, D = map(int, input().split())

cntC = B // C - A // C + int(A % C == 0)
cntD = B // D - A // D + int(A % D == 0)

lcm = C * D // fractions.gcd(C, D)
cntCD = B // lcm - A // lcm + int(A % lcm == 0)

print((B - A + 1) - (cntC + cntD - cntCD))


Measured memory_bytes: 5048
#include<iostream>
using namespace std;
int main()
{
	int n,m;
	int a[2002];
	cin>>n>>m;
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	int num=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]*4*m>=sum) num++;
	}
	if(num>=m) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var D = input[0];
            var X = input[1];
            for(var i = 0; i < N; i++)
            {
                X++;
                var A = int.Parse(Console.ReadLine());
                for(var j = A + 1; j <= D; j += A)
                {
                    X++;
                }
            }

            Console.WriteLine(X);
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>

using namespace std;

int main()
{
    string inp;
    bool flag = false, fst = false;
    int len = 0;
    int idx = 0;

    getline(cin, inp);
    inp += '.';
    for (int i = 0; i < inp.size(); i++) {
        if (inp[i] == ' ' || inp[i] == ',' || inp[i] == '.') {
            if (flag && len >= 3 && len <= 6) {
                if (fst)
                    cout << " ";
                else
                    fst = true;
                cout << inp.substr(idx, len);
                flag = false;
            }
            else 
                flag = false;
        }
        else {
            if (flag) 
                len++;
            else {
                idx = i;
                len = 1;
                flag = true;
            }
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
	cin>>str;
	for(register int i=0;i<str.length();i++)
	{
		if(str[i]==',')
		{
			cout<<" ";
		}
		else
		{
			cout<<str[i];
		}
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    int Q = scan.nextInt();
    long[] T = new long[Q];
    long[] F = new long[Q];
    String[] C = new String[Q];

    StringBuffer before = new StringBuffer();
    StringBuffer after = new StringBuffer();
    int reverse = 0;
    for(int i=0; i<Q; i++) {
      T[i] = scan.nextLong();
      if(T[i] == 1) {
        reverse = reverse == 1 ? 0 : 1;
      }
      else {
        F[i] = scan.nextLong();
        C[i] = scan.next();
        if((reverse + F[i]) % 2 == 1) {
          before.append(C[i]);
        }
        else {
          after.append(C[i]);
        }
      }
    }
    scan.close();

    if(reverse == 1) {
      StringBuffer SReverse = new StringBuffer(S);
      System.out.print(after.reverse());
      System.out.print(SReverse.reverse());
      System.out.println(before);
    }
    else {
      System.out.print(before.reverse());
      System.out.print(S);
      System.out.println(after);
    }
  }
}

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

int N, K, S;

int main()
{
    scanf("%d %d %d", &N, &K, &S);
    if (S < 1e9)
    {
        if (N == K)
        {
            for (int i = 1; i < K; i++)
            {
                printf("%d ", S);
            }
            printf("%d\n", S);
        }
        else
        {
            for (int i = 1; i <= K; i++)
            {
                printf("%d ", S);
            }
            for (int i = 1; i < N-K; i++)
            {
                printf("%d ", S+1);
            }
            printf("%d\n", S+1);
        }
    }
    else
    {
        if (N == K)
        {
            for (int i = 1; i < K; i++)
            {
                printf("%d ", S);
            }
            printf("%d\n", S);
        }
        else
        {
            for (int i = 1; i <= K; i++)
            {
                printf("%d ", S);
            }
            for (int i = 1; i < N-K; i++)
            {
                printf("1 ");
            }
            printf("1\n");
        }
    }
    return 0;
}


Measured memory_bytes: 1280
import math
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr

n = int(input())
pl = factorization(n)
if len(pl) == 0: exit(print(0))
count = 0
for a,b in pl:
    if a==1 and b==1: exit(print(0))
    t=1
    while True:
        if b < t: break
        count += 1
        b-=t
        t+=1
print(count)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
 
int n;
vector<int> a;
vector<int> s;
int main(){
  int i,j,min=10000000;
  while(1){
    cin >> n;
    if(n==0)break;
    min =10000000;
    for(i=0;i<n;i++){
      cin >> j;
      a.push_back(j);
    }
    sort(a.begin(),a.end());
    for(i=0;i<n-1;i++)if(min>a[i+1]-a[i])min = a[i+1]-a[i];
    cout << min << endl;
    while(a.size())a.pop_back();
  }
  return 0;
}


Measured memory_bytes: 3128
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
ans=[]
for i in range(N):
    n=N-i
    syou=N//n
    c=0
    for l in range(1,syou):
        aa=n*(l+1)-1
        c=(c+b[aa])%2
    if a[n-1]==0:
        if c==0:
            b[n-1]=0
        else:
            b[n-1]=1
            ans.append(str(n))
    if a[n-1]==1:
        if c==0:
            b[n-1]=1
            ans.append(str(n))
        else:
            b[n-1]=0
print(len(ans))
if len(ans)>1:
    print(' '.join(ans))
if len(ans)==1:
    print(1)


Measured memory_bytes: 17204
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}

#define P (1'000'000'007)

signed main() {
    capi(n);

    vi v(n, -1);

    rep(i, n) {
        capi(a); --a;
        v[a] = i + 1;
    }

    rep(i, n) {
        cout << v[i];
        if (i != n - 1) cout << " ";
    }

    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define pb push_back

using namespace std;
using ll = long long int;
const int MOD = 998244353;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int h, w, k; cin >> h >> w >> k;
	vector<string> grid(h);
	for (int i = 0; i < h; ++i)
	{
		cin >> grid[i];
	}
	int ans = h*w;
	for (int mask = 0; mask < (1 << (h-1)); ++mask)
	{
		int dp[w+1]; memset(dp, -1, sizeof dp);
		int id[11] = {0};
		int ptr = 0;
		for (int bit = 0; bit < h; ++bit)
		{
			id[bit] = ptr;
			if (1 & (mask >> bit)) ++ptr;
		}
		bool poss = 1; ++ptr;
		int pref[ptr][w]; memset(pref, 0, sizeof pref);
		for (int col = 0; col < w; ++col)
		{
			for (int x = 0; x < h; ++x)
				pref[id[x]][col] += grid[x][col] == '1';
			for (int x = 0; x < ptr; ++x) if (col)
				pref[x][col] += pref[x][col-1];
		}
		for (int col = 0; col < w; ++col)
		{
			bool zero = 1;
			for (int x = 0; x < ptr; ++x)
				zero &= pref[x][col] <= k;
			if (zero) {dp[col] = 0; continue;}
			if (col == 0) {poss = 0; break;}
			for (int x = 0; x < ptr; ++x)
				if (pref[x][col] - pref[x][col-1] > k)
					poss = 0;
			if (!poss) break;

			int l = 0, r = col-1;
			while (l < r)
			{
				int m = (l+r)/2;
				bool good = 1;
				for (int x = 0; x < ptr; ++x)
					good &= pref[x][col] - pref[x][m] <= k;
				if (!good) l = m+1;
				else r = m;
			}
			dp[col] = 1 + dp[l];
		}
		if (!poss) continue;
		ans = min(ans, dp[w-1] + __builtin_popcount(mask));
	}
	cout << ans;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T & a, const T & b) { if (a > b) { a = b; return 1; } return 0; }

ll calc(ll a, ll b) {
	return (a + b - 1) / b;
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	cin >> N;
	vll T(5);
	REP(i, 5)cin >> T[i];
	ll pre = LINF;
	ll ans = 0;
	REP(i, 5) {
		if (pre > T[i]) {
			ans = i +  calc(N, T[i]);
			chmin(pre,T[i]);
		}
		else {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main()
{
  INT(N);
  VEC(ll,A,N);
  ll cnt = 0;
  ll ans1 = 0;
  ll ans2 = 0;
  ll sum = 0;
  REP(i,N){
    sum+=A[i];
    A[i]=sum;
  }
  vll B=A;

  REP(i,N){
    A[i]+=cnt;
    if(i%2==0){
      if(A[i]>=0){
        ans1+=abs(-1-A[i]);
        cnt+=-1-A[i];
        A[i]=-1;
      }
    }else{
      if(A[i]<=0){
        ans1+=abs(1-A[i]);
        cnt+=1-A[i];
        A[i]=1;
      }
    }
  }
  cnt=0;
  REP(i,N){
    B[i]+=cnt;
    if(i%2==1){
      if(B[i]>=0){
        ans2+=abs(-1-B[i]);
        cnt+=-1-B[i];
        B[i]=-1;
      }
    }else{
      if(B[i]<=0){
        ans2+=abs(1-B[i]);
        cnt+=1-B[i];
        B[i]=1;
      }
    }
  }

  cout << min(ans1,ans2) << endl;
}

Measured memory_bytes: 4840
//#pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#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 sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define un(x) x.erase(unique(ALL(x)),x.end())
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)for(int i=0;i<v;i++)
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int MOD=1e9+7;//998244353;

	
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);
	string s[2];
	cin>>s[0]>>s[1];
	int a,b;cin>>a>>b;
	string t;cin>>t;
	if (t==s[0]) a--;
	else b--;
	cout<<a<<" "<<b<<endl;


    return 0;
}










Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
  int N ;
  cin >> N ;
  string S ;
  cin >> S ;
  rep(i,S.size()){
    int  A =  S.at(i) ;
    //cout << A << ""  ;
    A += N ;
    if( A>90 ) A -= 26;
    char B = A ;
    cout << B  ;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);

    if (a >= 1 && a <= 100 && b >= 1 && b <= 100) {
        printf("%d %d\n", a*b, 2*(a+b));
    }

    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main (){
	vector<int> v(3);
	cinv(3,v);
	sort(all(v));
	cout << v[0] + v[1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,ai,d;
  cin>>n>>k;
  vector<bool> a(n+1); 
  for(int i=0;i<k;i++)
  {
    cin>>d;
    for(int i=0;i<d;i++)
    {
     cin>>ai;
     a[ai]=true;
    }
  }
  int cnt=0;
  for(int i=1;i<=n;i++)
  if(a[i]==false)
  cnt++;
  
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;
const ll INF = -4e18;
ll n, m;
bool flag;
ll a[2005], b[2005], c[2005];
ll d[1005];

int main()
{
    scanf("%lld%lld", &n, &m);
    for(ll i = 1; i <= m; i++)
    {
        scanf("%lld%lld%lld", &a[i], &b[i], &c[i]);
    }
    for(int i = 2; i <= n; i++)
    {
        d[i] = INF;
    }
    int i;
    for(i = 1; i < n; i++)
    {
        flag = false;
        for(int j = 1; j <= m; j++)
        {
            if(d[b[j]] < d[a[j]] + c[j] && d[a[j]] > INF)
            {
                flag = true;
                d[b[j]] = d[a[j]] + c[j];
            }
        }
        if(!flag) break;
    }
    if(!flag && i < n)
    {
        printf("%lld", d[n]);
        return 0;
    }
    int mem = d[n];
    for(int j = 1; j <= m; j++)
    {
        if(d[b[j]] < d[a[j]] + c[j] && d[a[j]] > INF)
        {
            flag = true;
            d[b[j]] = d[a[j]] + c[j];
        }
    }
    if(d[n] != mem) printf("inf");
    else printf("%lld", d[n]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1<<26;
string s;
int x, m[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  fill(m, m+N, IINF);
  m[0] = 0;
  FOR(i, 0, sz(s)-1){
    x ^= 1<<(s[i]-'a');
    FOR(j, 0, 26){
      int _x = x^(1<<j);
      mins(m[x], m[_x]+1);
    }
  }
  x ^= 1<<(s[sz(s)-1]-'a');
  int ans = IINF;
  FOR(j, 0, 27){
    int _x = (j==26 ? x : x^(1<<j));
    mins(ans, m[_x]+1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 262736