akhauriyash/Code-Regression huggingface dataset:
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define endl "\n"
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main()
{
// #ifndef RAHUL
//     freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
// #endif

 





string s;
cin>>s;
bool flag=0;

for (int i = 0; i <3; ++i)
{
	/* code */
	if(s[i]==s[i+1]){
		flag=1;
		cout<<"Bad"<<endl;
		break;
	}
}
if(flag==0){
	cout<<"Good"<<endl;
}

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin>>n;
  vector<tuple<string,int,int>> hoge(n);

  for(int i=0; i<n; i++){
    cin>>get<0>(hoge.at(i))>>get<1>(hoge.at(i));
    get<2>(hoge.at(i))=i+1;
    get<1>(hoge.at(i))*=-1;
  }

  sort(hoge.begin(),hoge.end());
  for(int i=0; i<n; i++){
    cout<<get<2>(hoge.at(i))<<endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A[] = new int[N+2];
        
        A[0] = 0;
        for(int i = 1; i <= N; i++) {
            A[i] = sc.nextInt();
        }
        A[N+1] = 0;
        
        int sum = 0;
        for(int i = 1; i <= N+1; i++) {
            sum += (int) Math.abs( A[i] - A[i-1] );
        }
        
        for(int i = 1; i <= N; i++) {
            int x = (int)Math.abs( A[i] - A[i-1] ) + (int)Math.abs( A[i+1] - A[i] );
            int y = (int)Math.abs( A[i+1] - A[i-1] );
            System.out.println( sum - x + y );
        }
    }
}


Measured memory_bytes: 60220
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
#include <cstring>

int main() {
  int n, ans = 0, a, b, c;
  cin >> n >> a >> b;
  for (int i = 0; i < n; i++) {
    cin >> c;
    if (c < a || c >= b) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    int A[N];
    rep(i, N) {
        cin >> A[i];
    }

    int ans = INT_MAX;
    rep(i, N) {
        int count = 0;
        while (A[i] % 2 == 0) {
            A[i] /= 2;
            count++;
        }
        if (ans > count) {
            ans = count;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define MAXN 2000005
using namespace std;
using namespace __gnu_pbds;  

double l;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	cin>>l;
	double length = l/(double)3.0;
	double breadth = l/(double)3.0;
	double height = l/(double)3.0;
	double ans = length*breadth*height;
	cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 256
//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<ctime>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define ld long double
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ll INF = (ll)1e18 + 123;
const int inf=(int)2e9 + 123; 
const int mod=1e9+7;
using namespace std;
int n;
int cnt[31];
vector<int> v[31];
string s;
vector<pair<int, int> > a;
ll t[400011];
void inc(int pos){
	for(int i = pos; i < n; i = (i | (i + 1))){
		t[i] ++;
	}
}
ll get(int pos){
	ll ans = 0;
	for(int i = pos; i >= 0; i = (i & (i + 1) ) - 1){
		ans += t[i];
	}
	return ans;
}
int pr[200011];
int main(){
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  	srand(FOR);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> s;
	n = (int)s.len();
	for(int i = 0; i < n; i ++){
		cnt[s[i] - 'a'] ++;
	}
	int col = 0;
	for(int i = 0; i < 26; i ++){
		if(cnt[i] % 2 == 1)
			col ++;
	}
	if(col > 1){
		cout << -1;
		return 0;
	}
//	int mn = inf, pos = -1;
	ll ans = 0;
	/*
	for(int i = 0; i < n; i ++){
		if(cnt[s[i] - 'a'] % 2 == 1){
			if(mn > abs(i - (n / 2))){
				mn = abs(i - (n / 2));
				pos = i;
			}
		}
	}*/
	for(int i = 0; i < n; i ++){
		v[s[i] - 'a'].pb(i);
	}	
	for(int i = 0; i < 26; i ++){
		int l = 0, r = (int)v[i].sz() - 1;
		while(l <= r){
			a.pb(mp(v[i][l], v[i][r]));
			l ++;
			r --;
		}
	}
	sort(a.beg(), a.end());
	int num = -1;
	for(int i = 0; i < a.sz(); i ++){
		if(a[i].F == a[i].S){
			pr[a[i].F] = n / 2;
			continue;
		}
		pr[a[i].F] = ++num;
		pr[a[i].S] = n - num - 1;	
	}
	for(int i = 0; i < n; i ++){
		ans += i - get(pr[i]);
		inc(pr[i]);
	} 
	cout << ans; 
	return 0;
}

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

int t[200];
double v[200];
double maxv[20000*2 + 1];

int main() {

    int n;

    cin >> n;

    t[0] = 0;

    for(int i=1; i<=n; i++){
        cin >> t[i];
        t[i] *= 2;
    }

    for(int i=1; i<=n; i++){
        t[i] += t[i-1];
    }

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

    int end = t[n];

    for(int i=0; i<n; i++){
        for(int j=t[i]+1; j<=(t[i+1]); j++){
            maxv[j] = v[i];
        }
    }

    for(int i=0; i<n-1 ;i++){
        maxv[t[i+1]] = min(v[i],v[i+1]);
    }

    maxv[0] = 0;
    maxv[end] = 0;


    for(int i=1; i<=end; i++){
        maxv[i] = min(maxv[i],maxv[i-1] + 0.5);
    }

    for(int i=end-1; i>=0; i--){
        maxv[i] = min(maxv[i],maxv[i+1] + 0.5);
    }

    double ans = 0.0;

    for(int i=1; i<=end; i++){
        ans += (maxv[i] + maxv[i-1]) * 0.5 / 2.0;
    }

    cout << fixed << setprecision(9) << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int a,b,c,d,e,k,s,i,f=0;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    scanf("%d",&k);
    s=e-a;
    if(s>k){
        f=1;
    }
       s=e-b;
    if(s>k){
        f=1;
    }
       s=e-d;
    if(s>k){
        f=1;
    }
       s=e-c;
    if(s>k){
        f=1;
    }
       s=d-a;
    if(s>k){
        f=1;
    }
       s=d-c;
    if(s>k){
        f=1;
    }
           s=d-b;
    if(s>k){
        f=1;
    }
           s=c-b;
    if(s>k){
        f=1;
    }
           s=c-a;
    if(s>k){
        f=1;
    }
           s=b-a;
    if(s>k){
        f=1;
    }

    if(f==1){
        printf(":(");
    }
    else{
        printf("Yay!");
    }
        return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
  public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final int iTemp = sc.nextInt();
    String sSwitch = "No";
      
      if(iTemp >= 30 ){
        sSwitch = "Yes";
      }
    System.out.println(sSwitch);
  }
}

Measured memory_bytes: 35692
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c, d;
	cin>>a>>b>>c>>d;
	int control = 0;
	int first =9;
	while(a>0||c>0)
    {
        if(control%2==0)    //taka s turn
        {
            c -= b;
            if(c<=0&&first==9)
            {
                first = 2;
                break;
            }
//            if(c==0&&a!=0)
  //          {
    //            cout<<"Yes"<<endl;
      //          return 0;
        //    }
        }
        else
        {
            a -= d;
            if(a<=0&&first==9)
            {
                first = 1;
                break;
            }
//
        }
        control++;
    }


    //cout<<a<<" "<<c;

    if(first==1)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

    return 0;
}


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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int A,B,T;
signed main() {
    cin>>A>>B>>T;
    cout<<T/A*B<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
		#include <iostream>
		#include <numeric>
        using namespace std;
		int main(){
          int N,L;
          cin>> N >>L;
          int S=0; 
          int m=max(L,-L); 
          int ind;
          int l=1; 
          for(int i=1; i<=N; i++){
             l= max(L+i-1, -(L+i-1));
            if(l<=m){
              ind =i; 
              m= min(m,l);
            }
            S= S+ L+ i-1;
          }
          cout<< S -(L+ ind -1) << endl; 
        }

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

n=[-1]*(N+2)
n[1]=0
i=0 #カウンター
place_now=1 #いる場所

while True:
  
  i+=1 #何回飛んだか
  place_now=A[place_now-1] #飛んだ時の場所
  
  
  if n[place_now] != -1:
    a=n[place_now] #ループの開始点
    loop=i-a #ループする長さ
    break
  
  n[place_now]=i #その場所につくのに何回飛んだか
  
if a>=K:
  print(n.index(K))
elif a<K:
  k_remain=(K-a)%loop+a
  print(n.index(k_remain))



Measured memory_bytes: 32376
def getlist():
	return list(map(int, input().split()))

L = []

N = int(input())
for i in range(N):
	A, B = getlist()
	L.append([B, A])

L = sorted(L)

judge = "Yes"
s = 0
for i in range(N):
	s += L[i][1]
	if L[i][0] < s:
		judge = "No"
		break

print(judge)

Measured memory_bytes: 38104
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	m, _ := strconv.Atoi(sc.Text())

	s := 0
	for i := 0; i < m; i++ {
		sc.Scan()
		tmp, _ := strconv.Atoi(sc.Text())
		s += tmp
	}

	if s > n {
		fmt.Println(-1)
	} else {
		fmt.Println(n - s)
	}
}

Measured memory_bytes: 1792
#include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

int main(){
	P x,y;
	double r1,r2,dis;
	int n;
	cin>>n;
	while(n--){
		cin>>x.real()>>x.imag()>>r1>>y.real()>>y.imag()>>r2;
		dis=abs(x-y);
		if(dis>r1+r2+EPS){
			cout<<"0"<<endl;
		}else if(dis>abs(r1-r2)-EPS){
			cout<<"1"<<endl;
		}else{
			if(r1>r2)
				cout<<"2"<<endl;
			else
				cout<<"-2"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 using namespace std;
int main(){
    int N;
    cin>>N;
    int ans=0;
    ans=N>=105?ans+1:ans;
    ans=N>=135?ans+1:ans;
    ans=N>=165?ans+1:ans;
    ans=N>=189?ans+1:ans;
    ans=N>=195?ans+1:ans;

    cout << ans << endl;
 }

Measured memory_bytes: 256
//
//  main.cpp
//  atcoder 009
//
//  Created by zhangdenny on 2017/7/18.
//  Copyright © 2017年 Kirito. All rights reserved.
//

#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <list>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
const int maxn=100005;
int n;
ll ans;
ll a[maxn],b[maxn];
ll g[maxn];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    for(int i=n-1;i>=0;i--)
    {
        a[i]+=ans;
        ll k=a[i]/b[i];
        while(k*b[i]<a[i])
            k++;
        ans+=k*b[i]-a[i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, k;
    cin >> h >> w >> k;
    vs s(h);
    rep(i, h) cin >> s[i];

    int cnt = 0;
    rep(i, 1<<h) rep(j, 1<<w) {
        int now = 0;
        rep(k, h) rep(l, w) if(!(i>>k&1) and !(j>>l&1) and s[k][l] == '#') {
            now++;
        }
        if(now == k) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n, x; cin >> n >> x;
    vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());

    int ans = 0;
    for(int i = 0; i < n - 1; i++) {
        if(x < a[i]) break;
        x -= a[i];
        ans++;
    }

    if(a[n - 1] == x) ans++;

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


Measured memory_bytes: 256
import bisect

N = int(input())
a_list = list(map(int, input().split()))

a_list.sort()

M = 0
commands = []
item_max = a_list.pop()
item_min = a_list.pop(0)

cur_x = item_min
while a_list and a_list[-1] > 0:
	cur_y = a_list.pop()
	commands.append((cur_x, cur_y))
	cur_x -= cur_y

commands.append((item_max, cur_x))
cur_x = item_max - cur_x
while a_list:
	cur_y = a_list.pop()
	commands.append((cur_x, cur_y))
	cur_x -= cur_y

print(cur_x)
for x, y in commands:
	print(x, y)


Measured memory_bytes: 18620
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
Int B,C,H,W;
Int X,Y,Z;
vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}

D getExpectation(D x) {
   return perform(x)/x;
}

int main()
{
        cin>>X>>N;
        
        Int ans=1;
        for(int i=0;i<X;++i) ans=ans*100;
        ans*=N;
        if(N==100&&!X) ans++;
        else if(N==100){
            if(X==1) ans+=100;
            else ans+=10000;
        }
        cout<<ans<<"\n";
    
}

Measured memory_bytes: 27024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<ll> L(87);
  L[0] = 2;
  L[1] = 1;
  for(int i=2;i<87;i++){
    L[i] = L[i-2] + L[i-1];
  }
  cout << L[N] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int h,w;
	bool f1[100] = {},f2[100] = {};
	string field[100];
	cin >> h >> w;
	for(int i = 0;i < h;i++) cin >> field[i];
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			if(field[i][j] == '#') f1[i] = true;
		}
	}
	for(int i = 0;i < w;i++){
		for(int j = 0;j < h;j++){
			if(field[j][i] == '#') f2[i] = true;
		}
	}
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			if(f1[i] && f2[j]) cout << field[i][j];
		}
		if(f1[i]) cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;


int main() {
	string a, x, c;
	cin >> a >> x >> c;
	cout << "A" << x[0] << "C" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;


class AddAB
{
public:
  AddAB(int a, int b)
  {
    ans = a+b;
  }
  int GetAB()
  {
    return ans;
  }
private:
  int ans;
};


int main()
{
  int a, b, ans;

  cin >> a >> b;

  AddAB *obj = new AddAB(a, b);

  ans = (*obj).GetAB();

  if (ans < 10) cout << ans << endl;
  else cout << "error" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int H, W, N;
    cin >> H >> W >> N;
    int a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int c[H][W]{};
    int h = 0;
    int w = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < a[i]; j++) {
            c[h][w] = i + 1;
            if (h % 2 == 0) {
                w++;
                if (w == W) {
                    h++;
                    w = W - 1;
                }
            } else {
                w--;
                if (w == -1) {
                    h++;
                    w = 0;
                }
            }
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (j == W - 1) {
                cout << c[i][j] << "\n";
            } else {
                cout << c[i][j] << " ";
            }
            
        }
    }
    
    return 0;
}

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



   int main(){
      int n;
      string s;
      int ans = 0;
      cin >> s;
      rep(i,4){
         if (s[i] == '+') ans++;
         else ans--;
      }
      cout << ans << endl;
      
      return 0;
      
   }



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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 1e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;


bool used[N];

signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);
   map <int, int> mp;
   int n, prev = 0, ans = 0;
   cin >> n;
   mp[0]++;
   for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      prev+= x;
      ans+= mp[prev];
      mp[prev]++;
   }
   cout << ans;

}

Measured memory_bytes: 12800
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)






int main()
{
	long long int n;
	cin >> n;
	long long int i;
	long long int ans = 0;
	for (i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			ans+=i;
		}

	}
	cout << ans;
}




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

using LL = long long;

int main() {
  int R, C, K;
  cin >> R >> C >> K;

  vector<vector<LL>> V(R+2, vector<LL>(C+2));
  for(auto i=0; i<K; ++i) {
    int r, c, v;
    cin >> r >> c >> v;
    V[r][c] = v;
  }

  vector<vector<vector<LL>>> dp(R+3, vector<vector<LL>>(C+3, vector<LL>(5)));
  dp[1][1][1] = V[1][1];
  for(auto i=1; i<=R; ++i) for(auto j=1; j<=C; ++j) for(auto k=0; k<4; ++k) {
    dp[i+1][j][0]   = max(dp[i+1][j][0],   dp[i][j][k]);
    dp[i][j+1][k]   = max(dp[i][j+1][k],   dp[i][j][k]);
    dp[i+1][j][1]   = max(dp[i+1][j][1],   dp[i][j][k] + V[i+1][j]);
    dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k] + V[i][j+1]);
  }
  cout << max({dp[R][C][0], dp[R][C][1], dp[R][C][2], dp[R][C][3]}) << endl;
}


Measured memory_bytes: 707864
def main():
    import sys
    input = sys.stdin.readline
    S = input().strip()
    a_cnt = 0
    state = 0
    ans = 0
    for s in S:
        if s == 'A':
            if state == 0:
                a_cnt += 1
            else:
                a_cnt = 1
                state = 0
        elif s == 'B':
            if state == 0:
                state = 1
            else:
                a_cnt = 0
        elif s == 'C':
            if state == 1:
                ans += a_cnt
                state = 0
            else:
                a_cnt = 0

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3500
import java.util.*;
class Main {
	public static void main (String[] args) throws java.lang.Exception {
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble(), y1 = sc.nextDouble(), x2 = sc.nextDouble(), y2 = sc.nextDouble();
		System.out.printf("%.9f\n", Math.hypot(x1 - x2, y1 - y2));
	}
}

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

int main()
{
   string s;
   cin >> s;
   vector<int> cnt(2, 0);
   for(int i = 0; i < s.length(); i++)
   {
      cnt[s[i] - '0']++;
   }
   int ans = min(cnt[0], cnt[1])*2;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll n, k;
    cin >> n >> k;

    vector<ll> P(n), C(n);
    REP(i, n) cin >> P[i];
    REP(i, n) P[i]--;
    REP(i, n) cin >> C[i];

    ll ans = C[0];
    REP(i, n) {
        vector<ll> c;
        vector<bool> used(n, false);

        int cur = i;
        while(!used[cur]) {
            used[cur] = true;
            cur = P[cur];
            c.pb(C[cur]);
        }

        ll sum = -INF;

        ll tmp = 0;
        REP(i, c.size()) {
            tmp += c[i];
            if (i + 1 <= k) sum = max(sum, tmp);
        }

        if (tmp > 0) {
            if (k > c.size()) {
                tmp = tmp * (k / (int)c.size() - 1);
                sum = max(tmp, sum);
                REP(j, c.size()) {
                    tmp += c[j];
                    sum = max(tmp, sum);
                }

                REP(j, k % c.size()) {
                    tmp += c[j];
                    sum = max(tmp, sum);
                }
            }
        }

        ans = max(ans, sum);
    }

    print(ans);
    
}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int g(int m){
	int ans=0;
	while(m!=0){
		ans++;
		m/=10;
	}
	return ans;
}
int n;
int main(){
	int ans=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(g(i)%2==1)ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 256
N = STDIN.gets.chomp.to_i
A = STDIN.gets.chomp.split(' ').map(&:to_i)

def gcd(x, y)
  x, y = y, x if x < y
  if y == 0 then
    return x
  end
  return gcd(x % y, y)
end

L = Array.new(N + 2)
R = Array.new(N + 2)

L[0] = R[N + 1] = 0

A.each_with_index{ |a, i|
  index = i + 1
  L[index] = gcd(L[index - 1], a)
}

A.each_with_index.reverse_each{ |a, i|
  index = i + 1
  R[index] = gcd(R[index + 1], a)
}

M = Array.new(N, 0)
for i in 1..N do
   M[i] = gcd(L[i-1], R[i+1])
end

puts M.max

Measured memory_bytes: 17036
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    vector<int> dp(n);
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            dp[i] = 0;
            continue;
        }
        int min_v = INF;
        for (int j = 1; j < k + 1; j++) {
            if (i < j) break;
            min_v = min(dp[i - j] + abs(v[i] - v[i - j]), min_v);
        }
        dp[i] = min_v;
    }
    cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 1792
import java.io.*;

public class Main{
    public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        
        try{
            String line;
            int i = 0, j = 0, k = 0, l = 0;
            int[][] data;

            data = new int[300][2];

            while(true){
                line = reader.readLine();
                String[] tmp = line.split(" ",2);
                data[i][0] = Integer.parseInt(tmp[0]);
                data[i][1] = Integer.parseInt(tmp[1]);

                if(data[i][0] == 0 && data[i][1] == 0){
                    break;
                }
                i++;
            }
            for(j = 0; j <= i-1; j++){
                for(k = 0; k < data[j][0]; k++){
                    for(l = 0; l < data[j][1]; l++){
                        System.out.print("#");
                    }
                    System.out.print("\n");
                }
                System.out.print("\n");
            }
        }catch(NumberFormatException e){
            System.out.println(e);
        }catch(IOException e){
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 36320
#include <iostream>
#include <string>
using namespace std;
int main(){
  int N;
  cin>>N;
  cout<<0<<endl;
  string s;
  cin>>s;
  int right=0;
  int left=N;
  while(s!="Vacant"){
    int mid=(right+left)/2;
    cout<<mid<<endl;
    string t;
    cin>>t;
    if((mid-right)%2==0){
      if(s==t) right=mid;
      else left=mid+1;
    }
    else{
      if(s==t) left=mid+1;
      else right=mid;
    }
    if(right==mid||t=="Vacant") s=t;
  }
  
  return 0;
}

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

int isPrime(int x);

int main(void) {
	int n, i;
	int count = 0;
	int *p;

	scanf("%d", &n);

	p = (int*)malloc(sizeof(int) * n);
	if(p == NULL) {
		printf("memory error\n");
		exit(1);
	}

	for(i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}

	for(i = 0; i < n; i++) {
		if(isPrime(p[i]) == 1) {
			count++;
		}
	}

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

	free(p);

	return 0;
}

int isPrime(int x) {
	int i;
	int k = 3;

	if(x == 2) {
		return 1;
	} else if(x < 2 || (x % 2 == 0)) {
		return 0;
	} else {
		while(k <= (int)sqrt((double)x)) {
			if (x % k == 0) {
				return 0;
			}
			k += 2;
		}
		return 1;
	}
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;
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; }

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0,};

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

// 繰り返し二乗法
ll power(ll a, ll b){
    if(a==1)return a;
    // if(a==0)re
    ll res=1;
    while(b>0){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}

const int MAX=2100000;

ll fact[MAX], fact_inv[MAX];

void init_fact(ll n){
    fact[0]=1;
    // 階乗の計算
    for(ll i=0; i<n; i++) fact[i+1]=fact[i]*(i+1)%MOD;
    fact_inv[n]=power(fact[n], MOD-2);
    // 逆元の計算
    for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}

ll comb(ll n, ll r){
    return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

ll perm(ll n, ll r){
    return (fact[n]*fact_inv[n-r])%MOD;
}

int main() {
    cout<<fixed<<setprecision(10);

    ll n,k,c; cin>>n>>k>>c;
    string s; cin>>s;

    vint r,l;

    ll cnt = 0;
    ll now = 0;
    while(cnt < k){
        while(s[now] == 'x') now++;
        l.push_back(now);
        now = now+c+1;
        cnt++;
    }

    cnt = 0;
    now = n - 1;
    while(cnt < k){
        while(s[now] == 'x') now--;
        r.push_back(now);
        now = now - c - 1;
        cnt++;
    }
    reverse(ALL(r));

    // printv(l);
    // printv(r);


    rep(i,k) if(l[i] == r[i]) cout<<l[i]+1<<endl;




    return 0;

}

Measured memory_bytes: 5108
#include<stdio.h>
#include<limits.h>
#define N 100
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
int main(void)
{
  int i, j, k, n, p[N+1], m[N][N];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &p[i], &p[i+1]);
    m[i][i] = 0;
  }
  for (k = 2; k <= n; k++) {
    for (i = 0; i < n - (k - 1); i++) {
      int t = i + k - 1;
      m[i][t] = INT_MAX;
      for (j = i; j < t; j++) {
        m[i][t] = MIN(m[i][t], m[i][j] + m[j+1][t] + p[i] * p[j+1] * p[t+1]);
      }
    }
  }
  printf("%d\n", m[0][n-1]);
}


Measured memory_bytes: 2080
num_list = [int(i) for i in (input().split())]
if num_list[0] <= num_list[1]:
    print(1)
elif num_list[0] % num_list[1] == 0:
    print(int(num_list[0] / num_list[1]))
else:
    print(int(num_list[0]/num_list[1]) +1)

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

flag = 0
i = 1
while flag == 0:
    if A[i] % A[0] != 0:
        A[i] = A[i] % A[0]
        A[i],A[0] = A[0],A[i]
        i = 1
    else:
        i += 1
        if i == N:
            flag = 1
            print(A[0])
            exit()

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ta = (c+b-1)/b;
  int ao = (a+d-1)/d;
  //cout << ta << " " << ao << endl;
  if(ta <= ao){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}



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

/* 
 * g++ -std=c++17 A.cpp -o A
 */
int main() {
  ios_base::sync_with_stdio(false);
  ll a, b, x;
  cin>>a>>b>>x;
  if (a % x != 0) {
    a += (x - a % x);
  }
  if (b % x != 0) {
    b -= b % x;
  }
  cout << max(0LL, b/x - a/x + 1) << endl;
}


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

using namespace std;

int n,m;
int FULL;
char S[12][12];
char s[12][12];

inline void cpy_r(int r, int i) {
    for (int j = 0; j < m; j++) {
        s[r][j] = S[i][j];
    }
}
bool used[12];
void ck_col() {
    memset(used, 0, sizeof used);
    bool mid_find = !(m&1);
    for (int j = 0; j < m; j++) {
        if (used[j]) continue;
        bool find=false;
        for (int k = j+1; k < m; k++) {
            if (used[k]) continue;
            bool rev=true;
            for (int i = 0; i < n; i++) {
                if (s[i][j] != s[n-1-i][k]) {rev=false;break;}
            }
            if (rev) {
                find = true;
                used[j]=used[k]=true;
                break;
            }
        }
        if (!find) {
            if (mid_find) return;
            for (int i = 0; i < n; i++) {
                if (s[i][j] != s[n-1-i][j]) return;
            }
            mid_find = true;
            used[j] = true;
        }
    }
    cout<<"YES"<<endl; exit(0);
}
void enume(int msk, int L) {
    if (msk == FULL) {
        ck_col();
    }
    int i=0;
    while (msk&(1<<i)) {
        i++;
    }
    cpy_r(L, i); msk |= 1<<i; i++;
    for (int k = i; k < n; k++) {
        if (msk & (1<<k)) continue;
        cpy_r(n-1-L, k);
        enume(msk|(1<<k), L+1);
    }
}

void solve() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }
    FULL = (1<<n)-1;
    if (n&1) {
        for (int i = 0; i < n; i++) {
            cpy_r(n/2, i);
            enume(1<<i, 0);
        }
    } else {
        enume(0, 0);
    }
    cout << "NO";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};
ll n,e;
vvl(d,20,20,inf);
ll dp[1 << 15][20];

ll rec(ll s, ll v){
  //?????????????????????????????§?????????????????????
  if(dp[s][v] >= 0){
    return dp[s][v];
  }
  //??????????????????????¨?????????????
  if(s == (1 << n) - 1 && v == 0){
    return dp[s][v] = 0;
  }
  ll res = inf;
  rep(u,n){
    //???????§???????????????????????????????????????????
    if( !(s >> u & 1) && d[v][u] != inf){
      res = min(res,rec(s | 1 << u, u) + d[v][u]);
    }
  }
  return dp[s][v] = res;
}

void solve(){
  memset(dp,-1,sizeof(dp));
  ll ans = rec(0,0);
  if(ans == inf) ans = -1;
  cout << ans<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> e;
  ll s,t,dis;
  rep(i,e){
    cin >> s >> t >> dis;
    d[s][t] = dis;
  }
  solve();
  return 0;
}

Measured memory_bytes: 8336
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S,T=ST().split()
    A,B=MI()
    U=ST()
    print(A-(U==S), B-(U==T))
if __name__ == '__main__':
    main()

Measured memory_bytes: 5968
import java.util.*
import kotlin.*

import java.io.InputStream
import java.lang.NumberFormatException
import java.lang.StringBuilder


fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = FastScanner()
        val n = sc.nextInt()
        val k = sc.nextInt()
        val a = Array(n) { sc.nextInt() }

        println((n -1 + k - 2) / (k -1))
    }
}


class FastScanner {
    companion object {
        val input: InputStream = System.`in`
        val buffer = ByteArray(1024) { 0 }
        fun isPrintableChar(c: Int): Boolean = c in 33..126
    }

    var ptr = 0
    var buflen = 0
    private fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = input.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }

    private fun readByte(): Int = if (hasNextByte()) buffer[ptr++].toInt() else -1

    private fun skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr].toInt())) ptr++
    }

    fun hasNext(): Boolean {
        skipUnprintable()
        return hasNextByte()
    }

    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b)
            b = readByte()
        }
        return sb.toString()
    }

    fun nextInt(): Int {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0
        var b = readByte()
        // '-' = 45
        val minus = b == 45
        if (minus) {
            b = readByte()
        }

        // '0' = 48 '9' = 57
        if (b !in 48..57) {
            throw NumberFormatException()
        }

        while (true) {
            if (b in 48..57) {
                n *= 10
                n += b - 48
            } else if (b == -1 || !isPrintableChar(b)) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var b = readByte()
        // '-' = 45
        val minus = b == 45
        if (minus) {
            b = readByte()
        }

        // '0' = 48 '9' = 57
        if (b !in 48..57) {
            throw NumberFormatException()
        }

        while (true) {
            if (b in 48..57) {
                n *= 10
                n += b - 48
            } else if (b == -1 || !isPrintableChar(b)) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextDouble(): Double = next().toDouble()
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n, a[202020];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	if(a[0] != 0){cout << -1 << endl; return;}
	
	i64 cnt = 0;
	for(int i = n-1; i > 0; i--){
		if(a[i] > a[i-1]+1){
			cout << -1 << endl;
			return;
		}
		cnt += a[i];
		int j = i;
		for(; j > 0; j--){
			if(a[j] != a[j-1]+1) break;
		}
		i = j;
	}
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n, p, min_p = 1e9, ans = 0;
	cin >> n;

	for(int i = 0; i < n; ++i)
	{
		cin >> p;
		if (p < min_p)
		{
			++ans;
			min_p = p;
		}
	}

	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

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

    int ans = X - A;
    ans -= (ans / B) * B;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))

ans = 0

for i in range(n-2):
    p1 = p[i]
    p2 = p[i+1]
    p3 = p[i+2]
    
    if p2 > p1 and p2 < p3:
        ans += 1
    elif p2 > p3 and p2 < p1:
        ans += 1

print(ans)

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <map>
using namespace std;
#define ll  long long int
 
int main() {
	//freopen("test.txt", "r", stdin);
	int n,m; cin>>n>>m;
	vector<int> a(n);
	for(int i=0;i<n;i++) { int t; cin>>t; a[i]=t; }
	sort(a.rbegin(),a.rend());
	int votes=accumulate(a.begin(),a.end(),0);
	int M=votes/(4*m);
	if(votes%(4*m)) M++;
	bool ok=1;
	//cout<<M<<endl;
	for(int i=0;i<m;i++){
		if(a[i]<M) { ok=0; break; }
	}
	if(ok) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
S = input()

if 1 <= int(S[:2]) <= 12 and 1 <= int(S[2:]) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(S[:2]) <= 12:
    print("MMYY")
elif 1 <= int(S[2:]) <= 12:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
n = int(input())
s = input()
ans = 10**10
s_E = [0]
s_W = [0]
e = 0
w = 0
for i in range(n):
    if s[i] == 'E':
        e += 1
    else:
        w += 1
    s_E.append(e)
    s_W.append(w)

for i in range(n):
    ans = min(ans,s_W[i]+s_E[-1]-s_E[i+1])

print(ans)

Measured memory_bytes: 17644
n, k = map(int, input().split())
A = list(map(int, input().strip().split()))

b = 0
e = max(A)
L = e // 2
while e - b > 1:
    L = (e + b) // 2
    m = sum(list(map(lambda x: (x - 1) // L, A)))
    if m <= k:
        e = L
    else:
        b = L
print(e)


Measured memory_bytes: 30800
#include <stdio.h>
#include <string.h>


int main()
{
    int x,a,b,ans;
    scanf("%d%d%d",&x,&a,&b);
    if(abs(x-a)<abs(x-b))printf("A\n");
    else printf("B\n");

  //  printf("%n\n",ans);

    return 0;
}


Measured memory_bytes: 128