akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }


const int MOD=1000000007;
const int MAXDIM=100;
int pw(int x,int n) { int ret=1; while(true) { if(n&1) ret=(ll)ret*x%MOD; if((n>>=1)==0) return ret; x=(ll)x*x%MOD; } }
void inc(int &a,ll b) { a=(a+b)%MOD; }
void dec(int &a,ll b) { a=(a+MOD-b%MOD)%MOD; }

int solve1(int x,int X) {
	int nx=X/x,ret=0;
	inc(ret,x);
	//printf("solve1(%d,%d)=%d\n",x,X,ret);
	return ret;
}
int solve2(int x,int y,int X,int Y) {
	int nx=X/x,ny=Y/y,ret=0;
	inc(ret,(ll)pw(solve1(x,X),ny)*y);
	inc(ret,(ll)pw(solve1(y,Y),nx)*x);
	dec(ret,(ll)x*y);
	//printf("solve2(%d,%d,%d,%d)=%d\n",x,y,X,Y,ret);
	return ret;
}

int C[MAXDIM+1][MAXDIM+1];
int dp[MAXDIM+1][MAXDIM+1][MAXDIM+1]; // dp[cz][cx][cy] -> #ways for cz layers to have cx shifted rows and cy shifted columns

int solve3(int x,int y,int z,int X,int Y,int Z) {
	if(X%x!=0||Y%y!=0||Z%z!=0) return 0;
	int nx=X/x,ny=Y/y,nz=Z/z,ret=0;

	// add solutions with 'cuts' using PIE
	inc(ret,(ll)pw(solve2(x,y,X,Y),nz)*z);
	inc(ret,(ll)pw(solve2(y,z,Y,Z),nx)*x);
	inc(ret,(ll)pw(solve2(z,x,Z,X),ny)*y);
	dec(ret,(ll)pw(solve1(x,X),ny*nz)*y*z);
	dec(ret,(ll)pw(solve1(y,Y),nz*nx)*z*x);
	dec(ret,(ll)pw(solve1(z,Z),nx*ny)*x*y);
	inc(ret,(ll)x*y*z);

	// add solutions with no 'cuts' -> pillars and layers
	memset(dp,0,sizeof(dp)); dp[0][0][0]=1;
	REP(cz,nz) REPE(cx,nx) REPE(cy,ny) {
		int cdp=dp[cz][cx][cy]; if(cdp==0) continue;
		inc(dp[cz+1][cx][cy],cdp); // nothing shifted in this layer
		REPE(dx,nx-cx) { // rows shifted in this layer
			int ways=pw(y,cx); if(dx==0) dec(ways,1);
			ways=(ll)ways*pw(y-1,dx)%MOD;
			ways=(ll)ways*C[nx-cx][dx]%MOD;
			inc(dp[cz+1][cx+dx][cy],(ll)cdp*ways);
		}
		REPE(dy,ny-cy) { // cols shifted in this layer
			int ways=pw(x,cy); if(dy==0) dec(ways,1);
			ways=(ll)ways*pw(x-1,dy)%MOD;
			ways=(ll)ways*C[ny-cy][dy]%MOD;
			inc(dp[cz+1][cx][cy+dy],(ll)cdp*ways);
		}
	}
	FORE(cx,1,nx-1) FORE(cy,1,ny-1) {
		int cdp=dp[nz][cx][cy]; if(cdp==0) continue;
		int npillars=(nx-cx)*(ny-cy);
		int ways=pw(z,npillars); dec(ways,1);
		ways=(ll)ways*x*y*z%MOD;
		inc(ret,(ll)cdp*ways);
	}

	return ret;
}

int x,y,z,X,Y,Z;
void run() {
	REPE(i,MAXDIM) { C[i][0]=C[i][i]=1; FOR(j,1,i) C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD; }
	scanf("%d%d%d%d%d%d",&x,&y,&z,&X,&Y,&Z);
	printf("%d\n",solve3(x,y,z,X,Y,Z));
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 4352
s = input()

if s == "SUN":
    print(7)

elif s == "MON":
    print(6)

elif s == "TUE":
    print(5)

elif s == "WED":
    print(4)

elif s == "THU":
    print(3)

elif s == "FRI":
    print(2)

elif s == "SAT":
    print(1)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }

void solve(void)
{

  int X,T;
  cin>>X>>T;
  cout<<max(0LL,X-T)<<endl;
  return; 
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}

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

int main(){

  string S;
  cin >> S;

  vector<int> cnt(2,0);

  for(int i = 0 ; i < S.size() ; i++){
    
    if(S[i] == '0') cnt[0]++;
    else cnt[1]++;

  }

  int ans = min(cnt[0], cnt[1]) * 2;

  cout << ans << endl;

}

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

#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main(){
	int n, t;

	while(cin >> t >> n, !(t == 0 && n == 0)) {
		set<pii> wall;

		for(int i = 0; i < n; ++i) {
			int x, y;
			cin >> x >> y;

			wall.insert(pii(x, y));
		}

		map<pii, int> d;
		queue<pii> q;

		int sx, sy;
		cin >> sx >> sy;

		d[pii(sx, sy)] = 0;
		q.emplace(sx, sy);

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

		while(!q.empty()) {
			auto p = q.front(); q.pop();

			if(d[p] == t) {
			  continue;
			}

			for(int k = 0; k < 6; ++k) {
			  int nx = p.first + dx[k];
			  int ny = p.second + dy[k];

			  pii np(nx, ny);
			  if(wall.count(np) || d.count(np)) {
				continue;
			  }

			  d[np] = d[p] + 1;
			  q.push(np);
			}
		}

		cout << d.size() << endl;
	}
}


Measured memory_bytes: 3288
#include<stdio.h>
#define RR 100

int main(void)
{
   int kai,kosu;
   int x[RR][RR],sumA[RR],sumB[RR];
   int sumsum = 0;
   int i,q;
   
   scanf("%d %d", &kai,&kosu);
   
   for(i=0;i<kai;i++){
      sumA[i] = 0;
      sumB[i] = 0;}
   
   for(i=0;i<kai;i++){
      for(q=0;q<kosu;q++){
         scanf("%d", &x[i][q]);
         sumA[i] += x[i][q];}}
	
	for(q=0;q<kosu;q++){
		for(i=0;i<kai;i++){
		   sumB[q] += x[i][q];}}
	
	for(i=0;i<kosu;i++){
		sumsum += sumB[i];}
         
   for(i=0;i<kai;i++){
      for(q=0;q<kosu;q++){
         printf("%d ", x[i][q]);}
         printf("%d\n", sumA[i]);}
	
	for(i=0;i<kosu;i++){
		printf("%d ", sumB[i]);}
	
	printf("%d\n", sumsum);
         
   return 0;
}


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


int main(){
  string s;
  cin >> s;
  if(s=="A")cout << "T" << endl;
  else if(s=="T") cout << "A" << endl;
  else if(s=="G") cout << "C" << endl;
  else if(s=="C") cout << "G" << endl;
}

Measured memory_bytes: 256
a = []
while True:
    m,f,r = map(int, input().split())
    if m == f == r == -1:
        break
    s = m + f
    if m == -1 or f == -1:
        print("F")
    elif s>=80:
        print("A")
    elif s>=65:
        print("B")
    elif s>=50:
        print("C")
    elif s>=30 and r >= 50:
        print("C")
    elif s>=30:
        print("D")
    else:
        print("F")


Measured memory_bytes: 5596
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLine().toInt()
    val a = sc.nextLine().split(" ").map { it.toDouble() }

    println(problem138_b(n, a))
}

fun problem138_b(n: Int, a: List<Double>): Double {


    var sum = 0.0
    for (ele in a) {
        sum += 1 / ele
    }

    return 1 / sum
}

Measured memory_bytes: 36076
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;
int main(){
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    string S;
    cin >> S;

    bool kosu = true;
    int goal = D;
    if(C > D){
        goal = C;
        if(S[D] == '#' || S[D-2] == '#'){
            kosu = false;
        }
    }
    for(int i = A; i < S.size() - 1 && i < goal; i++){

        if(S[i] == '#' && S[i] == S[i+1]){
            cout << "No\n";
            return 0;
        }
        if(i >= B-1 && i < D){
            if(S[i] == '.' && S[i] == S[i-1] && S[i] == S[i+1])kosu = true;
        }
    }
    if(kosu) cout << "Yes\n";
    else cout << "No\n";


}

Measured memory_bytes: 640
n = int(input())
csf = zip(*[list(map(int,input().split())) for i in range(n-1)])
c, s, f = [list(i) for i in csf]
ans = [0]
for i in range(n-2, -1, -1):
    for j in range(i, n-2):
        if s[j]+c[j] > s[j+1]: s[j+1] += ((s[j]+c[j] - s[j+1] + f[j+1]-1)//f[j+1])*f[j+1]
    ans.append(c[n-2] + s[n-2])
for i in ans[::-1]: print(i)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 2e5+10;

vector<int> adj[N];

bool vis[N];
int d[N];
void dfs(int u) {
  vis[u] = 1;
  for (int v : adj[u]) {
    if (!vis[v]) {
      d[v] = d[u]+1;
      dfs(v);
    }
  }
}

char dp[N];
bool solve(int x) {
  if (x < 0) return 1;
  if (!x) return 1;
  if (dp[x] != -1) return dp[x];
  if (!solve(x-1) || !solve(x-2)) return dp[x] = 1;
  return dp[x] = 0;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  //for (int i = 0; i < 15; i++) cerr << solve(i) << " "; cerr << nl; return 0;
  int n; cin >> n;
  for (int i = 0; i < n-1; i++) {
    int u, v; cin >> u >> v; u--; v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(0);
  int u = max_element(d, d + n) - d;
  d[u] = 0;
  memset(vis, 0, sizeof vis);
  dfs(u);
  int diam = *max_element(d, d + n);
  puts(solve(diam) ? "First" : "Second");
  return 0;
}


Measured memory_bytes: 18688
// Colorful Slimes 2

#include <iostream>

using namespace std;

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

	int res = 0;

	for (int i = 0; i < N-1; ++i){
		if (a[i] == a[i+1]){
			res++;
			if (i == N-2)
				a[i+1] = a[i] + 1;
			else
				a[i+1] = (a[i]+a[i+2]) % 10000;
		}
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
//ll p[1000000] = {};
ll dig(ll n) {
	//if (p[n] != 0) {
	//	return p[n];
	//}

	ll t = n;
	ll cnt = 0;
	while (t > 0) {
		t /= 10;
		cnt++;
	}
	//	p[n] = cnt;
	return cnt;
}
int main() {
	ll N; cin >> N;

	ll minV = 1 << 29;
	for (ll i = 1; i*i <= N; i++) {
		if (N % i == 0) {
			minV = min(minV, max(dig(i), dig(N / i)));
		}
	}
	cout << minV << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto& e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())

ll MOD(ll x, ll m) {
    ll r = x % m;
    if (r < 0) {
        r += m;
    }
    return r;
}

ostream& operator<<(ostream& str, const pll& p) {
    str << p.first << " " << p.second;
    return str;
}

template <typename T>
void join(T& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 9e18
#define MINF -INF

void solve() {
    ll n;
    cin >> n;
    vector<bitset<32>> a(n);
    REP(i, n) {
        ll aa;
        cin >> aa;
        bitset<32> t(aa);
        a[i] = t;
    }
    vll res(n);
    REP(j, 32) {
        ll count = 0;
        REP(i, n) {
            if (a[i][j] == a[0][j])
                count++;
        }
        if (count % 2 == 0) {
            if (a[0][j] == 0) { // i'm 0
                REP(i, n) {
                    if (a[i][j] != a[0][j])
                        res[i] |= 1 << j;
                }
            } else {
                REP(i, n) {
                    if (a[i][j] == a[0][j])
                        res[i] |= 1 << j;
                }
            }
        } else {
            if (a[0][j] == 0) { // i'm 1
                REP(i, n) {
                    if (a[i][j] == a[0][j])
                        res[i] |= 1 << j;
                }
            } else {
                REP(i, n) {
                    if (a[i][j] != a[0][j])
                        res[i] |= 1 << j;
                }
            }
        }
    }

    join(res, " ");
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }

    return 0;
}

Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main(){
    int n;
    cin >> n;
    int a[n][3];
    for(int i = 0; i < n; i++){
        cin >> a[i][0];
        cin >> a[i][1];
        cin >> a[i][2];
    }
    int res[n + 1][3];
    for(int i = 0; i < n + 1; i++){
        for(int j = 0; j < 3; j++){
            res[i][j] = 0;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k) continue;
                res[i + 1][j] = max(res[i + 1][j], res[i][k] + a[i][j]);
            }
        }
    }
    int mx = 0;
    for(int i = 0; i <3; i++) mx = max(mx , res[n][i]);
    cout << mx << endl;
}


Measured memory_bytes: 2560
open Printf
open Scanf

let id x = x

let find_index ar x =
  let rec loop i =
    if i > 8 then None
    else if ar.(i) = x then Some i
    else loop (i + 1) in
  loop 0

let solve () =
  let tbl = Array.init 9 @@ fun _ -> scanf "%d " id in
  let n = scanf "%d " id in
  let ar = Array.init n @@ fun _ -> scanf "%d " id in
  Array.iter (fun x -> match find_index tbl x with
                         Some i -> tbl.(i) <- 0
                       | None -> ()) ar;
  if tbl.(0) = 0 && tbl.(1) = 0 && tbl.(2) = 0 ||
     tbl.(3) = 0 && tbl.(4) = 0 && tbl.(5) = 0 ||
     tbl.(6) = 0 && tbl.(7) = 0 && tbl.(8) = 0 ||
     tbl.(0) = 0 && tbl.(3) = 0 && tbl.(6) = 0 ||
     tbl.(1) = 0 && tbl.(4) = 0 && tbl.(7) = 0 ||
     tbl.(2) = 0 && tbl.(5) = 0 && tbl.(8) = 0 ||
     tbl.(0) = 0 && tbl.(4) = 0 && tbl.(8) = 0 ||
     tbl.(2) = 0 && tbl.(4) = 0 && tbl.(6) = 0 then "Yes" else "No"
let () =
  solve () |> printf "%s\n"


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

int main() {
  int N;
  cin >> N;
  for(int i=0; i<=25;i++)
    for(int j=0; j<=12; j++)
      if(4*i+7*j==N) { cout << "Yes" << endl; return 0; }

  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}










int main() {

	ll n;
  cin >> n;
  ll d[n+1];
  map <ll,ll> ans;
  rep (i,n) {
    cin >> d[i];
    ans[d[i]]++;
  }
  ll m;
  cin >> m;
  ll t[m+1];
  rep (i,m){
    cin >> t[i];
  }
  bool ok = true;
  rep (i,m){
    if (ans[t[i]]==0){
      ok = false;
    }
    ans[t[i]]--;
  }

  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;



}



Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, m;

int main()
{
  cin >> n;
  cout << n * n << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <numeric>
typedef long long int ll;
using namespace std;
int main(){
	char k;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin>>k;
			if(i==j){
				cout<<k;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int n; cin >> n;
	int prev, now;
	bool f = false;
	cin >> prev;
	Rep(n-1){
		cin >> now;
		if(prev > now + 1){
			cout << "No\n";
			return 0;
		}
		if(prev == now + 1){
			if(f){
				cout << "No\n";
				return 0;
			}else{
				f = true;
			}
		}else if(prev < now){
			f = false;
		}
		prev = now;
	}
	cout << "Yes\n";
}

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

int n;
char ans[220];

char ask_range(int l){
	cout << "?";
	for(int i = 0;i < n;i++){
		cout << " " << l + i + 1;
	}cout << endl;
	string ans;
	cin >> ans;
	return ans[0];
}
char ask_vec(vector<int> vec){
	cout << "?";
	for(int i = 0;i < n;i++){
		cout << " " << vec[i] + 1;
	}cout << endl;
	string ans;
	cin >> ans;
	return ans[0];
}



int main(){
	cin >> n;
	int bottom = 0, top = n;
	
	char l = ask_range(bottom);
	char r = ask_range(top);
	while(top - bottom > 1){
		int mid = (top + bottom) / 2;
		if(ask_range(mid) == l)bottom = mid;
		else top = mid;
	}
	vector<int> same_range, same_outer;
	for(int i = 1;i < n;i++){
		same_range.push_back(bottom+i);
	}
	for(int i = 0;i < bottom;i++)same_outer.push_back(i);
	for(int i = bottom + n+1;i < 2*n;i++)same_outer.push_back(i);
	for(int i = 0;i < 2*n;i++){
		if(i == bottom)ans[i] = l;
		else if(i == bottom + n)ans[i] = r;
		else if(i < bottom  || bottom + n < i){
			same_range.push_back(i);
			ans[i] = ask_vec(same_range);
			same_range.pop_back();
		}
		else{
			same_outer.push_back(i);
			ans[i] = ask_vec(same_outer);
			same_outer.pop_back();
			
		}
	}
	cout << "! " ;
	for(int i = 0;i < 2*n;i++){
		cout << ans[i];
	}cout << endl;
	
}

Measured memory_bytes: 724
# coding: utf-8
# Your code here!

S = list(input())
Odd = set([S[i] for i in range(len(S)) if i % 2 == 0])
Even = set([S[i] for i in range(len(S)) if i % 2 != 0])
if 'L' in Odd or 'R' in Even:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int T1 = sc.nextInt();
            int T2 = sc.nextInt();
            long A1 = sc.nextLong();
            long A2 = sc.nextLong();
            long B1 = sc.nextLong();
            long B2 = sc.nextLong();

            if ((A1 * T1 + A2 * T2) == (B1 * T1 + B2 * T2)) {
                System.out.println("infinity");
                return;
            }

            if (A1 > B1) {
                A1 = A1 - B1;
                B2 = B2 - A2;
            } else {
                A1 = B1 - A1;
                B2 = A2 - B2;
            }

            long d1 = A1 * T1;
            long d2 = B2 * T2;

            if (d1 - d2 > 0) {
                System.out.println(0);
                return;
            }

            long ans = (d1 / (d2 - d1)) * 2;

            if (d1 % (d2 - d1) != 0) {
                ans++;
            }

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 22612
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    m: usize,
    p: i64,
    es: [(usize1, usize1, i64); m],
  }
  let es: Vec<_> = es.into_iter().map(|(a, b, c)| (a, b, c - p)).collect();
  let mut score = vec![-(1i64 << 60); n];
  score[0] = 0;
  let mut reach_start = vec![false; n];
  reach_start[0] = true;
  let mut reach_end = vec![false; n];
  reach_end[n-1] = true;
  for _ in 0 .. n - 1 {
    for &(a, b, c) in &es {
      score[b] = cmp::max(score[b], score[a] + c);
      reach_start[b] = reach_start[b] || reach_start[a];
      reach_end[a] = reach_end[a] || reach_end[b];
    }
  }
  let mut update = false;
  for &(a, b, c) in &es {
    if reach_start[b] && reach_end[b] && score[a] + c > score[b] {
      update = true;
      break;
    }
  }
  if update {
    puts!("-1\n");
  } else {
    puts!("{}\n", cmp::max(score[n-1], 0));
  }
}


Measured memory_bytes: 4476
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

mi = 100000
idx = 1000

for i in range(N):
    temp = T - H[i]*0.006
    diff = abs(temp-A)
    if diff < mi :
        mi = diff
        idx = i+1
        
print(idx)

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

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

    li s,w;

    cin>>s>>w;

    if(w>=s)
        cout<<"unsafe";
    else
        cout<<"safe";

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 998244353;



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

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

int N;
ll A[212345];
ll ans = mod*mod;
ll sum = 0;
ll X = 0;
ll Y = 0;

int main(){
    
    cin>>N;
    REP( i, N ){
        scanf("%lld", A+i);
        sum += A[i];
    }
    
    Y = sum;
    
    REP( i, N ){
        X += A[i];
        Y -= A[i];
        ans = min( ans, abs(X-Y));
    }
    
    
    cout<<ans<<endl;
    
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int count = 0;

ll attack(ll X) {
    if (X == 1) return 1;
    return attack(X/2)*2+1;
}

int main() {
    ll H;
    cin >> H;
    cout << attack(H) << endl;
    return 0;
}

Measured memory_bytes: 256
uses math;
var b:int64;
    a,ans,n,i:longint;
begin
  ans:=2147483647;
  readln(a);
  for a:=1 to a do
  begin
    read(b);
    n:=0;
    while b and 1=0 do
    begin
      b:=b>>1;
      inc(n);
    end;
    ans:=min(ans,n);
  end;
  writeln(ans)
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using ll = long long;


int main(){
        ll n;
        scanf("%lld", &n);

        std::vector<ll> c(n), s(n), f(n);
        c[0] = s[0] = f[0] = 0;
        for(ll i=1; i<n; i++) scanf("%lld %lld %lld", &c[i], &s[i], &f[i]);

        for(ll i=1; i<n; i++){
                ll tt = 0;
                for(ll j=i; j<n; j++){
                        tt = std::max(s[j], (tt+c[j-1])*(j!=i));
                        tt = (tt+f[j]-1)/f[j]*f[j];
                }
                printf("%lld\n", tt+c[n-1]);
        }
        puts("0");
        return 0;
}

Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    int a1, a2, a3;
    cin >> a1 >> a2>>a3;
    int min = 101;
    int max = 0;
    if(a1 <= min){
        min = a1;
    }
    if(a2 <= min){
        min = a2;
    }
    if(a3 <= min){
        min = a3;
    }
    if(a1 >= max){
        max = a1;
    }
    if(a2 >= max){
        max = a2;
    }
    if(a3 >= max){
        max = a3;
    }
    
    int ans = max - min;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#-*-coding:utf-8-*-
import numpy as np

def main():
    n,k = map(int,(input().split()))
    ashiba=np.array((input().split()),int)
    dp=np.zeros(n,dtype=int)
    for i in range(1,n):
        start=max(0,i-k)
        dp[i]=min(dp[start:i]+abs(ashiba[i]-ashiba[start:i]))
    print(dp[n-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 21992
N,M,Q = map(int,input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

ans = 0

l = [i for i in range(1,M+1)]
# print(l)

import itertools
for A in itertools.combinations_with_replacement(l, N):
    # flag = False
    point = 0
    # for i in range(1,N):
    #     if A[i] > A[i-1]:
    #         flag = True
    #         break
    # if flag:
    #     continue

    # print(A)
    for k in range(Q):
        a = abcd[k][0]
        b = abcd[k][1]
        c = abcd[k][2]
        d = abcd[k][3]
        if A[b - 1] - A[a - 1] == c:
            point += d
        if point > ans:
            ans = point

# A = [1 for i in range(N)]
#
# for i in range(N-1,-1,-1):
#     for j in range(M):
#         A[i] += 1
#         print(A)
#         point = 0
#         for k in range(Q):
#             a = abcd[k][0]
#             b = abcd[k][1]
#             c = abcd[k][2]
#             d = abcd[k][3]
#             if A[b-1]-A[a-1] == c:
#                 point += d
#         if point > ans:
#             ans = point
print(ans)

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

template<typename T> 
map<T,int> factorize(T x){
    map<T,int> mp;
    for (T i = 2; i*i <= x; i++){
        while (x%i == 0) {
            x /= i;
            mp[i]++;
        }
        if (x == 1) break;
    }
    if (x != 1) mp[x]++;
    return mp;
}

int main(void){
    ll n, p;
    cin >> n >> p;
    auto cnt = factorize(p);
    ll res = 1;
    for (auto itr : cnt) {
        res *= pow(itr.first, itr.second / n);
    }
    cout << res << endl;
    return 0;
}


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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
int A,B,C;
int main() {
    cin>>A>>B>>C;

    if(C>=A && C<=B)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    string s; cin >> s;
    int cnt = 0;

    for(int i=0; i<s.size(); i++){
        if(s[i]!=s[s.size()-i-1]){
            cnt++;
        }
    }
    cout << cnt/2 << endl;
    return 0;
}


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

int main(){
  int n;
  scanf("%d", &n);
  char s[n][11];
  int i;
  for(i=0;i<n;i++){
    scanf("%s", s[i]);
  }
  int m;
  scanf("%d", &m);
  char t[m][11];
  for(i=0;i<m;i++){
    scanf("%s", t[i]);
  }
  int ans = 0;
  int flag[n];
  for(i=0;i<n;i++){
    flag[i] = 0;
  }
  for(i=0;i<n;i++){
    if(flag[i]==0){
      flag[i] = 1;
      int tmp_ans = 1;
      int j;
      for(j=i+1;j<n;j++){
        if(strcmp(s[i],s[j]) == 0){
          flag[j] = 1;
          tmp_ans++;
        }
      }
      for(j=0;j<m;j++){
        if(strcmp(s[i],t[j]) == 0){
          tmp_ans--;
        }
      }
      if(tmp_ans > ans){
        ans = tmp_ans;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

int main()
{
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    
    if(A*2>W || B*2>H){cout << "No\n"; return 0;}

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if((i<B && j<A) || (i>=B && j>=A)) cout << 0;
            else cout << 1;
        }
        cout << "\n";
    }
}

Measured memory_bytes: 1280
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()
    A = sorted(in_nl(), reverse=True)

    ans = A[0]
    num = 1
    i = 1
    while True:
        if num < N - 1:
            ans += A[i]
            num += 1
        if num < N - 1:
            ans += A[i]
            num += 1
        if num < N - 1:
            i += 1
        else:
            break

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 29300
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)
#define ll long long
#define ld long double
#define lcm(a, b) (a * b) / __gcd(a, b)
#define flu(i, a, b) for (ll i = a; i < b; i++)
#define blu(i, a, b) for (ll i = a; i >= b; i--)
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define Unique(X) (X).erase(unique(all(X)), (X).end())
#define all(v) v.begin(), v.end()
typedef vector<ll> vl;
typedef map<ll, ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
char e = '\n';

ll MOD = 1e9 + 7;

ll i, j, le;

int sv(int x)
{
    int n = 200000;
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n + 1];
    memset(prime, true, sizeof(prime));

    for (int p = 2; p * p <= n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
    if (prime[x])
        return 1;
    else
        return 0;
}

int main()
{
    IOS;
    int t;
    // cin >> t;
    t=1;
    while (t--)
    {
        ll k,s,c=0;
        cin>>k>>s;
        flu(i,0,k+1)
        {
            flu(j,0,k+1)
            {
                if(s-i-j >=0 && s-i-j<=k)c++;
            }
        }
        cout<<c<<e;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    ll N;
    cin>>N;
    cout<<(1+(N-1))*(N-1)/2<<endl;
}


Measured memory_bytes: 256
import java.io.*;
public class Main{
  public static void main(String[] args)throws IOException{
    BufferedReader mBufferedReader=new BufferedReader(new InputStreamReader(System.in));
    String str;
    while((str=mBufferedReader.readLine())!=null){
      if(str.equals("0")){
        break;
      }
      int sum=0;
      for(int i=0;i<str.length();i++){
        sum+=str.charAt(i)-'0';
      }
      System.out.println(sum);
    }
    mBufferedReader.close();
  }
}


Measured memory_bytes: 24428
#include<cstdio>
using namespace std;
const int MAX_N = 100;
int N;
int
A[MAX_N];
int D, X;
int main()
{
    scanf("%d", &N);
    scanf("%d%d", &D, &X);
    for(int i = 0; i < N; ++i)
    {
        scanf("%d", A + i);
    }
    int ans = X;
    for(int i = 0; i < N; ++i)
    {
        int tmp = (D - 1) / A[i] + 1;
        ans += tmp;
    }
    printf("%d\n", ans);
    return 0;
}

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

int main()
{
	int N;
	string S;
	cin >> N >> S;

	vector<vector<vector<bool>>> dp( N + 1, vector<vector<bool>>( 4, vector<bool>( 10000 ) ) );
	dp[0][0][0] = true;
	for( int i = 0; i < N; i++ ) {
		for( int j = 0; j <= 3; j++ ) {
			for( int k = 0; k < 1000; k++ ) {
				if( dp[i][j][k] == false ) continue;
				dp[i + 1][j][k] = dp[i][j][k];
				if( j <= 2 ) dp[i + 1][j + 1][k * 10 + S[i] - '0'] = true;
			}
		}
	}
	int ans = 0;
	for( int k = 0; k < 1000; k++ ) {
		if( dp[N][3][k] ) ans++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 157416
using System;

namespace ConsoleApp__ITP1_4_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            var a = Int32.Parse(input[0]);
            var b = Int32.Parse(input[1]);

            var d = a / b;
            var r = a % b;
            var f = (double)a / b;

            Console.WriteLine("{0} {1} {2:F5}", d, r, f);
        }
    }
}


Measured memory_bytes: 9220
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;

int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    int A, B; cin >> A >> B;
    
    if (A != B) {
        int C = max(A, B);

        cout << (C + C - 1) << endl;
    }
    else {
        cout << (A + B) << endl;
    }

    return 0;
}

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

from collections import Counter
c = Counter(l)

num = [[] for _ in range(n+1)]

tot = 0
for i,j in c.items():
    if j >= 2:
        tmp1 = j*(j-1)//2
        tot += tmp1
    else:
        tmp1 = 0
    if j >= 3:
        tmp2 = (j-1)*(j-2)//2
    else:
        tmp2 = 0
    num[i] = [tmp1, tmp2]

for k in l:
    print(tot - num[k][0] + num[k][1])


Measured memory_bytes: 38464
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,s=1;
cin>>a>>b>>c;
if(a==b)s++;
if(a==c)s++;
if(a!=b&&b==c)s++;
if(s==2)cout<<"Yes";
else cout<<"No";
return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python

from sys import stdin, stderr

def main():
   N = int(stdin.readline())
   A = map(int, stdin.readline().split())

   res = 10000000000000
   for x in xrange(1, 101):
      cost = sum([ (a-x)**2 for a in A  ])
      res = min(res, cost)

   print(res)

   return 0

if __name__ == '__main__': main()


Measured memory_bytes: 2568
n = int(input())
p = [int(x) for x in input().split()]
count = 0
for i in range(1,n-1):
    count = count + (1 if (float(p[i]-p[i+1])+0.1) * (float(p[i]-p[i-1])+0.1) < 0 else 0 )
print(count)

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    ans=n÷2-ifelse(n%2==0,1,0)
    println(ans)
end
main()

Measured memory_bytes: 109472
import java.util.Scanner;
class Main{
	public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	String S = sc.next();
      	String T = sc.next();
      	int A = sc.nextInt();
      	int B = sc.nextInt();
      	String U = sc.next();
      
      	if(U.equals(S)){
        	A--;
        }
      	if(U.equals(T)){
        	B--;
        }
      	System.out.print(A + " " + B);
    }
}

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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

int main() {
   ll i,j,k;
    string s;
    cin >> s;
    for(i=0; i<s.length(); i++)
    {
cout << 'x' ;
    }

}


Measured memory_bytes: 256
S = list(input().split('><'))
if len(S) != 1:
    for n in range(len(S)):
        if n == 0:
            S[n] = S[n] + '>'
        elif n == len(S)-1:
            S[n] = '<' + S[n]
        else:
            S[n] = '<' + S[n] + '>'
ans = 0
for n in range(len(S)):
    a = S[n].count('<')
    b = len(S[n])-a
    if a >= b:
        ans += a*(a+1)//2
        ans += b*(b-1)//2
    else:
        ans += b*(b+1)//2
        ans += a*(a-1)//2
print(ans)


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

const int N = 1e6 + 10;
int pre[N], n, sub[N];
char s[N], t[N];

bool chkpre(int x) {
    return x % (x - pre[x]) > 0 || !pre[x];
}

bool chksub(int x) {
    return x % (x - sub[x]) > 0 || !sub[x];
}

void getfail(char *s, int *nxt) {
    nxt[0] = nxt[1] = 0;
    int j = 0;
    rep(i, 1, n - 1) {
        while(j && s[i] != s[j]) j = nxt[j];
        nxt[i + 1] = (s[i] == s[j] ? ++j : 0);
    }
}

int main() {
    scanf("%s", s);
    n = strlen(s);
    rep(i, 0, n - 1) t[i] = s[n - i - 1];
    t[n] = '\0';
    getfail(s, pre), getfail(t, sub);
    
    int flag = chkpre(n) ? 1 : 2;
    if (n - pre[n] == 1) flag = n;
    printf("%d\n", flag);
    if (flag != 2) { puts("1"); return 0; }

    int ans = 0;
    rep(i, 1, n) {
        int x = n - i;
        if (chkpre(i) && chksub(x)) ans++;
    }
    printf("%d\n", ans);
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    map<int,int> mp;
    for(auto it:a){
        mp[it]++;
    }
    int N=n+5;
    double dp[N][N][N];
    //dp[i][j][k]:1枚の皿がi枚、2枚の皿がj枚、3枚の皿がk枚あったときの期待値
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<N;k++)dp[i][j][k]=0;
        }
    }
    for(int k=0;k<N-1;k++){
        for(int j=0;j<N-1;j++){
            for(int i=0;i<N-1;i++){
                double m=double(n);
                double p1=double(i)/m,p2=double(j)/m,p3=double(k)/m;
                double sum=p1+p2+p3;
                if(i==0&&j==0&&k==0)continue;
                dp[i][j][k]=1;
                if(i!=0)dp[i][j][k]+=dp[i-1][j][k]*p1;
                if(j!=0)dp[i][j][k]+=dp[i+1][j-1][k]*p2;
                if(k!=0)dp[i][j][k]+=dp[i][j+1][k-1]*p3;
                dp[i][j][k]/=sum;
            }
        }
    }
    cout<<setprecision(20)<<dp[mp[1]][mp[2]][mp[3]]<<endl;
}


Measured memory_bytes: 221952
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(1e9+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, ans;
string s, t;
signed main() {
	cin >> n >> s >> t;
	int i;
	bool b;
	if (s[0] == t[0]) {
		ans = 3;
		b = true;
		i = 1;
	}
	else {
		ans = 6;
		b = false;
		i = 2;
	}
	for (; i < n; i++) {
		if (s[i] == t[i]) {
			if (b)ans *= 2;
			b = true;
		}
		else {
			if (b)ans *= 2;
			else ans *= 3;
			i++;
			b = false;
		}
		ans %= moder;
	}
	cout << ans << endl;
	endre;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int X,K;
int main()
{
    cin >> K >> X;
    for (int i = K - 1; i >=0; i--)
        cout << X - i << " ";
    for (int i = 1; i <=K-1; i++)
        cout << X + i << " ";
    return 0;
}


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

#define RAD(deg) (deg/180.0)*M_PI

int main(){
	int r, t;
	double x=0, y=0, direction=M_PI/2;

	for(;;){

		scanf("%d,%d", &r, &t);

		if( r==0 && t==0 ) break;

		x += r*cos( direction );
		y += r*sin( direction );

		direction -= RAD(t);//turn clockwise

	}

	printf("%d\n", (int)x);
	printf("%d\n", (int)y);

	return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int x = 2000000001;
	int V, E;
	cin >> V >> E;
	long long int A[101][101];
	for (int i = 0;i < V;i++) {
		for (int j = 0;j < V;j++) {
			if (i == j) {
				A[i][j] = 0;
			}
			else {
				A[i][j] = x;
			}
		}
	}
int s, t, d;
	for (int i = 0;i < E;i++) {
		cin >> s >> t >> d;
		A[s][t] = d;
	}
	
	for (int k = 0;k < V;k++) {
		for (int i = 0;i < V;i++) {
		    if(A[i][k]==x)continue;
			for (int j = 0;j < V;j++) {
			    if (A[k][j]==x) continue;
			    A[i][j] = min(A[i][j], A[i][k] + A[k][j]);}
		}
	}

	int flag=1;
		for (int i = 0;i < V;i++) {
			if (A[i][i]<0) {
			    flag=0;
			}
		}

	

	for (int i = 0;i < V;i++) {
	      if(flag==0){
		        cout<<"NEGATIVE CYCLE"<<endl;break;
		    }
		for (int j = 0;j < V;j++) {
			if (A[i][j] == x) {
				cout << "INF" ;
			}
			else {
				cout << A[i][j];
			}
			if(j!=V-1){cout<<" ";}
		}
			
		cout << endl;
	}

	return 0;
}




Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define optimizator ios_base::sync_with_stdio(0);
#define ll long long
using namespace std;
int main(){
	optimizator;
	int a,b;
	cin>>a>>b;
	if(a-b*2<0){
		cout<<0;
	}
	else{
		cout<<a-b*2;
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
inf=float('inf')

def main(n,m,g,uv):
    # 1<=E<=n-1
    eary=[inf]*m
    vary=[inf]*n
    vary[-1]=0
    todo=[n-1]
    def dfs(v,x):
        if vary[v]<inf:return vary[v]
        ret=0
        cnt=0
        for i,nv in g[v]:
            if i==x:continue
            tmp=dfs(nv,x)+1
            eary[i]=tmp
            ret+=tmp
            cnt+=1
        if cnt==0:
            for i in range(n):
                vary[i]=inf
            return inf
        vary[v]=ret/cnt
        return ret/cnt
    e0=dfs(0,-1)
    ary=[-1]*m
    bary=[0]*n
    bary[0]=1
    for v in range(n):
        k=len(g[v])
        e=vary[v]
        for i,nv in g[v]:
            bary[nv]+=1/k*bary[v]
            if k>1 and bary[v]:
                ary[i]=max(0,e-(e*k-eary[i])/(k-1))
                ary[i]*=bary[v]
    return e0-max(0,max(ary))

n,m=map(int,input().split())
uv=[list(map(int,input().split())) for _ in range(m)]
g=[[] for _ in range(n)]
for i,(u,v) in enumerate(uv):
    u,v=u-1,v-1
    g[u].append((i,v))
print(main(n,m,g,uv))


Measured memory_bytes: 74612
#include <stdio.h>

int main (void) {
    char s[4];
    scanf("%c%c%c%c", &s[0], &s[1], &s[2], &s[3]);
    int i;
    int result = 0;
    for (i = 0; i < 4; i++) {
        if (s[i] == '+') {
            result++;
        } else if (s[i] == '-') {
            result--;
        }
    }

    printf("%d", result);

    return 0;
}

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
    int x;  cin >> x;
    
    while(1){
        if(IsPrime(x)){
            cout << x << endl;
            break;
        }else{
            x++;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3576