akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int a[300000];
ll l[200001], r[200001];

int main() {
  int n, n2, n3;
  scanf("%d", &n);
  n2 = 2*n;
  n3 = 3*n;
  for (int i = 0; i < n3; ++i) scanf("%d", a+i);

  ll sum = 0;

  {
    priority_queue<int, vector<int>, greater<int>> pq;
    for (int i = 0; i < n; ++i) {
      sum += a[i];
      pq.push(a[i]);
    }

    l[n-1] = sum;
    for (int i = n; i < n2; ++i) {
      pq.push(a[i]);
      sum += a[i] - pq.top();
      pq.pop();
      l[i] = sum;
    }
  }
  
  {
    priority_queue<int> pq;
    sum = 0;
    for (int i = n3-1; i >= n2; --i) {
      sum += a[i];
      pq.push(a[i]);
    }

    r[n2] = sum;
    for (int i = n2-1; i >= n; --i) {
      pq.push(a[i]);
      sum += a[i] - pq.top();
      pq.pop();
      r[i] = sum;
    }
  }

  ll ans = -(1ll<<62);
  for (int i = n; i <= n2; ++i) {
    ll tmp = l[i-1] - r[i];
    if (tmp > ans) ans = tmp;
  } 
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 4212
#include <iostream>
#include <cstring>

using namespace std;

int N, t[10001];
int dp[2][10001][2];

int main() {
    ios::sync_with_stdio(false);

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

    memset(dp, 0x01, sizeof(dp));
    dp[0][1][0] = dp[0][0][1] = 0;

    for (int i=0; i<N; i++) {
        for (int j=0; j<=N/2; j++) {
            dp[(i+1)&1][j+1][0] = min(dp[i&1][j][0], dp[i&1][j][1]+t[i]);
            dp[(i+1)&1][j][1] = min(dp[i&1][j][0]+t[i], dp[i&1][j][1]);
        }
    }

    cout << min(dp[(N-1)&1][N/2][0], dp[(N-1)&1][N/2][1]) << endl;
    return 0;
}

Measured memory_bytes: 3380
#include<iostream>
#include<cmath>

int main(){
  int w, a, b, d;
  std::cin >> w >> a >> b;
  if(abs(a - b) > w)
    d = abs(a - b) - w;
  else
    d = 0;
  std::cout << d << std::endl;
  return 0;
}


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

int n;
int h,k;
bool ok=1;

int main(){
	cin>>n;n--;
	cin>>h;h--;
	while(n--){
		cin>>k;
		if(k<h){cout<<"No";return 0;}
		if(k>=h+1)h=k-1;
	}
	cout<<"Yes"<<endl;
}

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

int main() {
  int L, R;
  cin >> L >> R;
  
  int x = L % 2019;
  int y = R % 2019;
  if (y <= x || R >= L + 2019) {
    cout << 0 << endl;
    return 0;
  }
  
  vector<vector<int>> mod(2019, vector<int>(2019, -1));
  for (int i = x; i < y; i++) {
    for (int j = x + 1; j <= y; j++) {
      if (mod.at(i).at(j) == -1) {
        mod.at(i).at(j) = i * j % 2019;
      }
    }
  }
  
  int ans = 2019;
  for (int i = 0; i < 2019; i++) {
    for (int j = 0; j < 2019; j++) {
      if (mod.at(i).at(j) != -1) {
        ans = min(ans, mod.at(i).at(j));
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 16256
#include <iostream>

int main()
{
    int n,m,c;
    std::cin >> n >> m >> c;
    int b[m];
    for (int i = 0; i < m; i++)
    {
        std::cin >> b[i];
    }
    int a[n][m];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            std::cin >> a[i][j];
        }
    }

    int count = 0;

    for (int i = 0; i < n; i++)
    {
        int sum = c;
        for (int j = 0; j < m; j++)
        {
            sum += a[i][j] * b[j];
        }
        if (sum > 0)
        {
            count++;
        }
    }
    std::cout << count << std::endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
int n,x,i,j,p,q,s,a[101][101],ans=-99999;
int main(void){
	scanf("%d",&n);
	for(i=0;i<=n;i++){a[0][i]=0;a[i][0]=0;}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&x);
			if(x>ans)ans=x;
			a[i][j]=x+a[i-1][j];
		}
	}
	for(i=1;i<=n;i++){
		for(p=i;p<=n;p++){
			s=-1;

			for(j=1;j<=n;j++){
				x=a[p][j]-a[i-1][j];
				if(s*x<0){
					s*=-1;
					if(s>0){
						for(q=j;q<=n;q++){
							if(q>j)x+=a[p][q]-a[i-1][q];
							if(x>ans)ans=x;
						}
					}
				}
			}

		}
	}
	//for(i=0;i<=n;i++){for(j=0;j<=n;j++){printf("%3d",a[i][j]);}printf("\n");}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if (s == "ABC")
        cout << "ARC"
             << "\n";
    else
        cout << "ABC"
             << "\n";
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {
	int A, B, C, D;
	scanf("%d%d%d%d", &A, &B, &C, &D);

	printf("%d", min(A, B) + min(C, D));


}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main() {
	long long h, w;
	cin >> h >> w;
	if (h!=1&&w!=1&&h*w % 2 == 0) {
		cout << h * w / 2 << endl;
	}
	else if ((h == 1||w == 1)) {
		cout << "1" << endl;
	}
	else {
		cout << (h * w / 2) + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;



int main(){

    int N,M,dy=0; cin >> N >> M;
    char A[N][N],B[M][M];
    if(N < M){
      cout <<"No"<<endl;
      return 0;
    }

//画像A,Bの入力
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    for(int i=0; i<M; i++){
      //for(int j=0; j<N; j++){
        cin >> B[i];
      //}
    }
/*
    for(int k=0; k<N; k++){
      for(int l=0; l<N; l++){
          cout << A[k][l];
      }
         cout << endl;

    }


        for(int k=0; k<M; k++){
          for(int l=0; l<M; l++){
              cout << B[k][l];
          }
             cout << endl;

        }
        */
  for(int i=M; i<=N; i++){
    int dx = 0;
    for(int j=M; j<=N; j++){
      int Tcon = 0;
      //Bに合致するか比較
      for(int k=0; k<M; k++){
        for(int l=0; l<M; l++){

            if(A[k+dx][l+dy] == B[k][l]){
              Tcon += 1;
              /*cout << "Tcon " << Tcon << endl;
              cout << "K " << k << "l"<< l<< endl;
              cout << A[k+dx][l+dy] <<B[k][l] <<endl;*/
              if(Tcon == M*M){
                cout << "Yes" << endl;
                return 0;
              }
            }
        }

      }

      dx +=1;
    }

    dy += 1;
  }

  cout <<"No" << endl;


}


Measured memory_bytes: 256
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
from functools import reduce as R

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def _Ss(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Ss(): return _Ss(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

N, K = I()
xs = sorted(Is())
print(np.sum(xs[:K]))

Measured memory_bytes: 27360
#include<stdio.h>
int main()
{
    int i,j,n;
    scanf("%d",&n);
    int flag=0;
    for(i=1;i<=9;i++){
        for(j=9;j>=1;j--){
            if(i*j==n){
                flag++;
                printf("Yes\n");
                break;
            }
            if(flag>0)
                break;
        }
    }
    if(flag==0)
        printf("No\n");
return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
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; }
const ll MOD = 1e9+7;

ll ans;
ll N;
vector<ll> D;

//約数列挙 O(n**1/2)
vector<ll> divisor(ll n){
    vector<ll> res;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n/i) res.push_back(n/i);
        }
    }
    return res;
}

void dfs(int v, ll q){
    if(v == D.size()){
        chmin(ans, (ll)(q + N/q - 2));
        return;
    }

    dfs(v+1, q);
    if(q*D[v] <= N/2){
        if(q*D[v] == 0){
            cout << "no" << endl;
        }
        dfs(v+1, q*D[v]);
    }
}

int main(){
    cin >> N;
    //N = (1ULL << 40);

    D = divisor(N);

    //sort(div.begin(), div.end());

    ans = LLONG_MAX;

    //dfs(0,1);
    for(auto&& x : D){
        chmin(ans, x + N/x -2);
    }

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


Measured memory_bytes: 384
//
//  sqrt_hold.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <math.h>
typedef long long ll;
int main(int argc, const char* argv[]) {
  ll a, b, c;
  std::cin >> a >> b >> c;

  ll l = 4*a*b;
  ll r = (c-a-b)*(c-a-b);
  if (c-a-b < 0) {
    r = -(c-a-b)*(c-a-b);
  }
    if (l < r) {
      std::cout << "Yes" << std::endl;
    }
    else {
      std::cout << "No" << std::endl;
    }

}

Measured memory_bytes: 256
while str = STDIN.gets
    n = str.to_i
    exit 0 if n == 0

    array = Array.new(n+1)
    for i in 0..n do
        array[i] = Array.new(n+1)
    end

    for i in 0..n-1 do
        str = STDIN.gets.chomp
        l = str.split
        for j in 0..n-1 do
            array[i][j] = l[j].to_i
        end
    end

    for i in 0..n-1 do
        sum_col = 0
        sum_row = 0
        for j in 0..n-1 do
            sum_col = sum_col + array[i][j]
            sum_row = sum_row + array[j][i]
        end
        array[i][n] = sum_col
        array[n][i] = sum_row
    end

    sum_total = 0
    for i in 0..n-1 do
        sum_total = sum_total + array[i][n]
    end
    array[n][n] = sum_total

    for i in 0..n do
        for j in 0..n do
            printf "%5d", array[i][j]
        end
        print "\n"
    end
end

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

int main(){
    int N, K; cin >> N >> K;
    int R, S, P; cin >> R >> S >> P;
    string t; cin >> t;
    vector<vector<int>> te(K);
    for (int i = 0; i < t.size(); i++)
    {
        int mod = i%K;
        te[mod].push_back(t[i]);
    }
    long ans = 0;
    for(auto i : te){
        vector<vector<int>> dp(i.size()+1, vector<int>(3, 0));
        for (int j = 0; j < i.size(); j++)
        {
            dp[j+1][0] = max(dp[j][1], dp[j][2]) + R*(i[j]=='s');
            dp[j+1][1] = max(dp[j][0], dp[j][2]) + S*(i[j]=='p');
            dp[j+1][2] = max(dp[j][0], dp[j][1]) + P*(i[j]=='r');
        }
        ans += *max_element(dp[i.size()].begin(), dp[i.size()].end());
    }
    cout << ans << endl;
}

Measured memory_bytes: 6520
import sys
input = sys.stdin.readline

N, Q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]

class Tree:
  C = {}
  N, D = None, None
  def __init__(s, num):
    s.N = num
  def setC(s, a, b):
    if a in s.C: s.C[a].append(b)
    else: s.C[a] = [b]
    if b in s.C: s.C[b].append(a)
    else: s.C[b] = [a]
  def exe(s):
    L = [-1] * N
    A = [0] * N
    for p, x in px:
      p -= 1
      A[p] += x
    S = [0]
    while S != []:
      t = S.pop()
      L[t] = 1
      for i in s.C[t]:
        if L[i] == -1:
          A[i] += A[t]
          S.append(i)
    for i in range(N):
      print(A[i], end = " ")

T = Tree(N)
for a, b in ab:
  a -= 1
  b -= 1
  T.setC(a, b)

T.exe()



Measured memory_bytes: 136404
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIGN(x) (((x)>0)?1:(((x)<0)?-1:0))
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; }
typedef long long ll;
#define vv(t) vector< t > 
#define CHC(mp, x) if(mp.end() != mp.find(x))
#define CHCV(mp, x) if(mp.end() != find(ALL(mp), x))
template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long N, long long K, std::vector<long long> a);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D;
    A--;B--;C--;D--;
    cin >> S;
    bool no_flg=false, yes_flg=C<D;
    FOR(i, max(C, D)+1, A+1){
        if(S[i-1]=='.' && S[i]=='.' && S[i+1]=='.' && i>=B && i<=min(C, D)){
            yes_flg = true;
        }
        if(S[i-1]=='#' && S[i]=='#'){
            no_flg = true;
        }
    }
    if(!no_flg && yes_flg){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

Measured memory_bytes: 640
letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
L = len(letters)

n = int(input())
n %= L
word = input()
result = ''

for letter in word:
  idx = letters.index(letter)
  moves = n
  diff = L - idx
  f_index = idx
    
  if moves + idx >= L:
    f_index = moves - diff
  else:
    f_index = idx + moves
    
  result += letters[f_index]
  
print(result)

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int N;
    std::cin >> N;

    vector<int> H(N);
    REP(i, N) {
        std::cin >> H[i];
    }

    int ans = 0;
    int tmp_ans = 0;
    for(int i = 1; i < N; i++) {
        if(H[i] <= H[i - 1]) {
            tmp_ans++;
        }
        else {
            ans     = max(ans, tmp_ans);
            tmp_ans = 0;
        }
    }

    ans = max(ans, tmp_ans);
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<long long, long long>> v;
  for(int i = 0; i < n; i++){
    long long a, b;
    cin >> a >> b;
    v.emplace_back(b, a);
  }
  sort(v.begin(), v.end());
  long long t = 0;
  string ans = "Yes";
  for(auto p: v){
    if(t+p.second <= p.first) t += p.second;
    else ans = "No";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6384
N = int(input())
a = list(map(int, input().split()))

count1 = 0
count2 = 0
count4 = 0
for i in range(N):
    value = a[i] % 4
    if value == 0:
        count4 += 1
    elif value == 2:
        count2 += 1
    else:
        count1 += 1

if count1 <= count4 or (count1 - count4 == 1 and count2 == 0):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int main(){
        ll S,i,j;
        cin >> S;
        vector<ll> v(S+1);
        v.at(0) = 1;
        for(i=1;i<S+1;++i){
                for(j=0;j<=i-3;++j){
                        v.at(i) += v.at(j);
                        v.at(i) %= MOD;
                }
        }
        cout << v.at(S) << endl;
        return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
const int MAX_V=10;
int d[MAX_V][MAX_V];

int V=10;
void warshall_floyd(){
  for(int k=0;k<V;k++){
    for(int i=0;i<V;i++){
      for(int j=0;j<V;j++){
	d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
}
int main(){
  int h,w;
  cin>>h>>w;
  int Map[12][12]={};
  int Map2[h+2][w+2]={};
  for(int i=0;i<MAX_V;i++)
    for(int j=0;j<MAX_V;j++)
      d[i][j]=1e8;
  for(int i=0;i<=9;i++){
    for(int j=0;j<=9;j++){
      int ss;cin>>ss;
      d[i][j]=ss;
    }
  }
  warshall_floyd();
  ll ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int sss;
      cin>>sss;
      if(sss!=1&&sss!=-1){
	int mi=INF;
	    mi=min(mi,d[sss][1]);
	 

	ans+=mi;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int H,W;
        int i,j;
        while(true){
            H=sc.nextInt();
            W=sc.nextInt();
            if(H==0&&W==0) break;
            for(i=0;i<H;i++){
                for(j=0;j<W;j++){
                    System.out.print("#");
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 34384
n,m = map(int,input().split())
ans = 10 ** 9
lis = [list(map(int,input().split())) for i in range(n)]
for i in range(m):
  num = [0 for i in range(m)]
  for j in range(n):num[lis[j][0]-1] += 1
  ans = min(max(num),ans)
  for k in range(n):lis[k].remove(num.index(max(num))+1)
print(ans)

Measured memory_bytes: 4212
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))

typedef long long ll;

int main(void){
    int N, X, minv = 10000;
    
    scnd2( N, X);
    
    int v;
    for ( int i = 0; i < N; i++ ) {
        scnd1(v);
        X -= v;
        minv = min( minv, v);
    }
    
    prtd1( N + X/minv);
}


Measured memory_bytes: 256
N = int(raw_input())
#ball[t] = [f,a,x,y]
ball = [[0,0,0,0],[0,0,0,0]]
#ans[t] = [dist,flame]
ans = [[-1,-1],[-1,-1]]
bt = -1
for loop in xrange(N):
    f,a,t,x,y = map(int,raw_input().split())
    if bt == t and ball[t][0] != a :
        bf,bx,by = ball[t][1:]
        dist = (x-bx)**2+(y-by)**2
        if   dist  > ans[t][0]:
            ans[t] = [dist,f-bf]
        elif dist == ans[t][0]:
            ans[t][1] = min(ans[t][1], f-bf)
            
    ball[t] = [a,f,x,y]
    bt = t

if ans[0][0] == -1:
    print -1,-1
else:
    print "%.6f %.6f"%(ans[0][0]**0.5,ans[0][1]/60.0)
if ans[1][0] == -1:
    print -1,-1
else:
    print "%.6f %.6f"%(ans[1][0]**0.5,ans[1][1]/60.0)

Measured memory_bytes: 4368
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int main() {
    int n; cin >> n;
    vector<int> a(n), sorted(n);
    map<int, int> mp;
    REP(i, n) {
        scanf("%d", &a[i]);
        sorted[i] = a[i];
        mp[a[i]] = i % 2;
    }
    sort(sorted.begin(), sorted.end());
    int cnt = 0;
    REP(i, n) {
        if (mp[sorted[i]] != i % 2) cnt++;
    }
    cout << cnt / 2 << endl;
    return 0;
}

Measured memory_bytes: 5760
N = gets.to_i
F = (1..N).map { gets.gsub(' ', '').to_i(2) }
P = (1..N).map { gets.split.map &:to_i }

ss = []
for i in 1...2**10
  c = {}

  s = 0
  for j in 0...N
    c = (i & F[j]).to_s(2).count('1')
    s += P[j][c]
  end
 
  ss << s
end
puts ss.max


Measured memory_bytes: 3836
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
	int N, res = 0;
	string target;

	cin>>target>>N;
	
	for(int i = 0; i < N; i++){
		string str;
		cin>>str;
		str += str.substr(0, target.size()-1);

		if(str.find(target) != string::npos) res++;
	}

	cout<<res<<endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=998244353;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int N=1e5+50;
ll s[N];
ll a[N];
int main()
{
	bool fl=false;
	int k,a,b; cin>>k>>a>>b;
	for(int i=a; i<=b; i++)
	{
		if(i%k==0) {
			fl=true;
			break;
		}
	}
	if(fl) 	puts("OK");
	else puts("NG");
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    ll h;
    cin>>h;
    ll k=0;
    ll hh=h;
    while(true){
        if(hh==1)break;
        else{
            hh/=2;
            k++;
        }
    }
    k++;
   // cout<<k<<endl;



   ll ans = pow(2,k)-1;
    cout<<ans<<endl;


    
return 0;
}


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

using namespace std;

int main() {
    unsigned int n;
    cin >> n;

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

    unsigned int m;
    cin >> m;

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

    cout << includes(a.begin(), a.end(), b.begin(), b.end()) << endl;
    return 0;
}


Measured memory_bytes: 4424
def calc(n,num):
  ret=0
  while n>0:
    ret+=n%num
    n//=num
  return ret

N=int(input())
ans=N

for i in range(N+1):
  cnt=0
  cnt+=calc(i,6)
  cnt+=calc(N-i,9)
  ans=min(ans,cnt)
print(ans)

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

vector<int> childs[1005];
vector<string> msg(1005);

void dfs(int x, int d) {
    rep(i, 0, d) cout << '.';
    cout << msg[x] << endl;
    for (int h : childs[x]) dfs(h, d + 1);
}

const int D = 0, L = 1;
ll lst[105][2];

int main() {
    lst[0][L] = 1;
    
    int l, k; cin >> l >> k;
    ll ans = 0;
    for (int i = 1; i <= l; i++) {
        lst[i][L] += lst[i - 1][D];
        lst[i][D] += lst[i - 1][L];
        if (i - k >= 0) {
            lst[i][D] += lst[i - k][L];
        }
        ans += lst[i][D];
    }
    cout << ans << endl;

}


Measured memory_bytes: 3144
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

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

    vector<int > p;
    for(int i=1; i<=sqrt(X); i++){
        if(X % i == 0){
            p.push_back(i);
        }
    }

    for(auto num : p){
        for(ll a=num; a>=0; a--){
            ll b = a - num;
            if(a <= b) break;
            ll t = a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b;
            if(X / num == t){
                cout << a << " " << b <<  endl;
                return 0;
            }
        }
        ll b = 0;
        ll a = num;
        ll t = a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b;
        while(t <= X){
            if(X / num == t){
                cout << a << " " << b <<  endl;
                return 0;
            }
            b++;
            a = num + b;
            t = a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b;
        }
    }

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) REP(i,(vec).size()) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    string S;
    cin >> S;
    S[5] = ' ';
    S[13] = ' ';
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
use std::collections::VecDeque;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let mut que = VecDeque::new();
    for i in 0..n {
        let x:usize = read();
        if n % 2 == 0 {
            if (i+1) % 2 == 0 {
                que.push_front(x);
            } else {
                que.push_back(x);
            }
        } else {
            if (i+1) % 2 == 0 {
                que.push_back(x);
            } else {
                que.push_front(x);
            }
        }
    }
    for i in que {
        print!("{} ", i);
    }
    println!("");
}


Measured memory_bytes: 4240
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n/2){
        if(s[i]!=s[n-i-1]){
            cout << "No" << endl;
            return 0;
        }
    }
    int m = n/2;
    rep(i,m/2){
        if(s[i]!=s[m-1-i]){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = m+1; i<=m+m/2; i++){
        if(s[i]!=s[n-1-(i-m-1)]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
    char s[5];
    int c=0;
    scanf("%s",s);
    for(int i=1;i<3;i++){
        if(s[i]!=s[i-1])c++;
    }
    if(c) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using lint=long long;
using namespace std;

int main()
{
	int N,K;
	int h[100010];
	int dp[100010];
	
	cin >> N >> K;
	for(lint i=0;i<N;i++)
		cin >> h[i];
	
	dp[0]=0;
	for(int i=1;i<N;i++)
	{
		dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
		for(int j=2;j<=K;j++)
		{
			if(i-j<0)break;
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	
	cout << dp[N-1] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    cout<<min(b / a ,c)<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
 
public class Main {
    static Scanner in;
    static PrintWriter out;
    static String INPUT = "";
     
    static void solve()
    {
        while (true){
            int n = ni();
            if(n == 0)
                break;
            int[][] a = new int[n][n];
            for(int i = 0;i < n;i++){
                for(int j = 0;j < n;j++){
                    a[i][j] = ni();
                }
            }
            int[][] x = new int[n][n];
             
            for(int i = 0;i < n;i++){
                int min = Integer.MAX_VALUE, minj = -1;
                for(int j = 0;j < n;j++){
                    if(min > a[i][j]){
                        min = a[i][j];
                        minj = j;
                    }
                }
                for(int j = 0;j < n;j++){
                    if(a[i][minj] == min){
                        x[i][minj] |= 1;
                    }
                }
            }
             
            for(int i = 0;i < n;i++){
                int max = -1, maxj = -1;
                for(int j = 0;j < n;j++){
                    if(max < a[j][i]){
                        max = a[j][i];
                        maxj = j;
                    }
                }
                for(int j = 0;j < n;j++){
                    if(a[j][i] == max){
                        x[j][i] |= 2;
                    }
                }
            }
             
            Set<Integer> both = new HashSet<Integer>();
            for(int i = 0;i < n;i++){
                for(int j = 0;j < n;j++){
                    if(x[i][j] == 3){
                        both.add(a[i][j]);
                    }
                }
            }
            if(both.size() == 1){
                StringBuilder sb = new StringBuilder();
                for(int v : both){
                    sb.append(v + " ");
                }
                sb.deleteCharAt(sb.length() - 1);
                out.println(sb);
            }else{
                out.println(0);
            }
        }
    }
     
    public static void main(String[] args) throws Exception
    {
        in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
        out = new PrintWriter(System.out);
         
        solve();
        out.flush();
    }
     
    static int ni() { return Integer.parseInt(in.next()); }
    static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); }
}

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

int main(){
  int A,B;
  cin>>A>>B;
  int sum=0;
  if(A>=B){
    sum+=A;
    A=A-1;
    if(A>=B){
      sum+=A;
    }

    else if(A<B){
      sum+=B;
    }
  }

  else if(A<=B){
    sum+=B;
    B=B-1;
    if(A<=B){
      sum+=B;
    }

    else if(A>B){
      sum+=A;
    }
    
  }

  cout<<sum<<endl;
  
}

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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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 main(void) {

    int n, k;
    cin >> n >> k;
    vector<int> A(n);
    for (auto& a : A) {
        cin >> a;
    }

    vector<bool> dp_win(k+1);
	for(int i = k-1; i >= 0; i--) {
		for (auto& a : A) {
			if (i + a > k) continue;
			if (!dp_win[i + a]) {
				dp_win[i] = true;
				break;
			}
		}
	}

	cout << (dp_win[0] ? "First" : "Second") << endl;

	return 0;
}

Measured memory_bytes: 256
S = raw_input()

def solve(S):
    i = 0
    j = len(S) - 1
    ans = 0
    while i < j:
        if S[i] == S[j]:
            i += 1
            j -= 1
        elif S[i] == 'x':
            ans += 1
            i += 1
        elif S[j] == 'x':
            ans += 1
            j -= 1
        else:
            return -1
    return ans
            

print solve(S)


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

int main() {
    int n , m;
    cin >> n >> m;
    vector <int> count(n + 1 , 0);
    for(int i = 0; i < m; i++){
        int a , b;
        cin >> a >> b;
        count[a]++;
        count[b]++;
    }
    for(int i = 1; i <= n; i++){
        cout << count[i] << endl;
    }
}


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

using namespace std;

int k[15];
int s[15][15];
bool p[15];
bool cs[15];

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M,ans = 0;
	cin >> N >> M;
	rep(i,M){
		cin >> k[i];
		rep(j,k[i])cin >> s[i][j];
	}
	rep(i,M)cin >> p[i];
	//各スイッチを 2^N通り試す
	for(int i=0;i<(1<<N);i++){
		for(int j=0;j<N;j++){ 
			if((i>>j)&1)cs[j] = 1;//スイッチのj番目はon
			else cs[j] = 0;//スイッチのj番目はoff
		}
		int tmp = 0;
		for(int j=0;j<M;j++){ //各電球について
			int cnt = 0;
			for(int a=0;a<k[j];a++){
				if(cs[s[j][a]-1])cnt++;
			}
			if(cnt%2 == p[j])tmp++;
		}
		if(tmp==M)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
const int maxn=200010;
using namespace std;

struct node{
	string s;
}a[maxn];

bool cmp(node x,node y){
	return x.s<y.s;
}

struct note{
	string c;
	int num;
}ans[maxn];

bool cmp2(note x,note y){
	if(x.num==y.num) return x.c<y.c;
	return x.num>y.num;
}

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
	    cin>>a[i].s;
	}
	sort(a,a+n,cmp);
	/*cout<<endl;
	for(int i=0;i<n;i++){
		cout<<a[i].s<<endl;
	}*/
	ans[0].num=1;
	ans[0].c=a[0].s;
	int inde=0;
	for(int i=1;i<n;i++){
		//cout<<i<<" "<<a[i].s<<endl;
		if(a[i].s==a[i-1].s){
			ans[inde].num++;
		}
		else{
			inde++;
			ans[inde].num=1;
			ans[inde].c=a[i].s;
		}
	}
	sort(ans,ans+inde+1,cmp2);
	/*cout<<endl;
	for(int i=0;i<=inde;i++){
		cout<<ans[i].c<<" "<<ans[i].num<<endl;
	}*/
	
	int maxx=ans[0].num;
	for(int i=0;i<=inde;i++){
		if(ans[i].num==maxx) cout<<ans[i].c<<endl;
	}
}

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

int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  ll c = N%(A+B);
  ll d = N/(A+B);
  if(c>A) c = A;
  cout << d*A+c;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

int main(){
	dhoom;
	string s , t;
	string ss;
	int x , y;
	cin >> s >> t;
	cin >> x >> y;
	cin >> ss;
	if(ss == s)
		x--;
	else if(ss == t)
		y--;
	cout << x << " " << y << endl;
		
	//cout << ans << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
const ll nmax = 1e9 + 7;
const ll MOD = 998244353;
const double PI = 2 * asin(1);

int main(){
  int H, W; cin >> H >> W;
  char S[H][W];
  vector < pair<int, int> > start;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> S[i][j];
      if (S[i][j] == '.') start.push_back(make_pair(i, j));
    }
  }

  int di[4] = {-1, 0, 1, 0}, dj[4] = {0, -1, 0, 1};

  int ans = 0;
  for (int i = 0; i < start.size(); i++){
    for (int j = i + 1; j < start.size(); j++){

      pair<int, int> P = start[i], Q = start[j];

      int now[H][W]; bool visited[H][W];
      for (int i1 = 0; i1 < H; i1++){
        for (int i2 = 0; i2 < W; i2++){
          now[i1][i2] = 0;
          visited[i1][i2] = false;
        }
      }
      
      queue < pair<int, int> > que; que.push(P);
      visited[P.first][P.second] = true;
      while (!que.empty()){
        pair <int, int> F = que.front(); que.pop();
        for (int k = 0; k < 4; k++){
          int I = F.first + di[k], J = F.second + dj[k];
          if (0 <= I && I < H && 0 <= J && J < W){
            if (S[I][J] == '.' && visited[I][J] == false){
              que.push(make_pair(I, J));
              visited[I][J] = true;
              now[I][J] = now[F.first][F.second] + 1;
            }
          }
        }
      }
      ans = max(ans, now[Q.first][Q.second]);
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int,n);
	VEC(int,a,n);

	int _2=0,_4=0,other=0;
	REP(i,n){
		if(a[i]%4==0) ++_4;
		else if(a[i]%2==0) ++_2;
		else ++other;
	}

	bool ok;
	if(_2==0) {
		ok = other<=_4+1;
	}else{
		ok = other<=_4;
	}
	OUT(ok?"Yes":"No")BR;
  
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b:i--)

int main() {
    // your code goes here
    ll n,r;
    cin >> n >> r;
    if(n>=10) cout << r << endl;
    else cout << r+100*(10-n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
   
  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  }
  else if (S == "Cloudy") {
    cout << "Rainy" << endl; 
  }  
  else if (S == "Rainy") {
    cout << "Sunny" << endl;
  }
}

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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

using point = complex<double>;
vector<point> A;
int  n;

double solve() {
    // cout << "A: " << A << endl;
    vector<int> sa(n);
    int cnt = 0;
    double total = 0.0;
    for (int i = 0; i < n; i++)
        sa[i] = i;
    do {
        // cout << "sa: " << sa << endl;
        for (int i =  1; i < n; i++) {
            int s = sa[i-1];
            int t = sa[i];
            double val = abs(A[s] - A[t]);
            total += val;
        }
        cnt++;
        // cout << "total: " << total << endl;
        // cout << "cnt: " << cnt << endl;
    } while (next_permutation(sa.begin(), sa.end()));
    return total / cnt;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        double a, b;
        cin >> a >> b;
        A.emplace_back(a, b);
    }
    double ans = solve();
    cout << fixed << setprecision(9) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()
def judge(s):
  for i in range(len(s)-1):
    if s[i] == s[i+1]:
      return print("Bad")
  return print("Good")

def judge2(s):
    if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
        return print("Good")
    else:
        return print("Bad")

judge2(s)


Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;
//
// int main() {
//     cout << 100000 << endl;
//     for (int i=0; i<100000; ++i) {
//         cout << 0 << endl;
//     }
// }

int a[101010], A[101010];

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    //vector<int> A(N);
    rep(i, N) cin >> A[i];

    //vector<int> a(N, 0);

    multiset<int> st;
    int cur = 1;

    st.insert(A[0]);
    int mi = A[0];

    for (int i=1; i<N; ++i) {
        int ma = -1, idx = 0;
        //if (mi < A[i]) {
        auto it = st.lower_bound(A[i]);
        if (it != st.begin()) {
            it--;
            st.erase(it);
            st.insert(A[i]);
            //mi = min(mi, A[i]);
        }
        else {
            st.insert(A[i]);
        }
        // }
        // else {
        //     st.insert(A[i]);
        // }
    }

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


Measured memory_bytes: 5376
#include <stdio.h>
#define ll long long int
ll MIN(ll x,ll y){return x<y?x:y;}
ll ABS(ll x){return x>0?x:-x;}
int main(void){
	int n;
	scanf("%d",&n);
	ll a,ans=0,min=1e9,m=0;
	for(int i=0;i<n;i++){
		scanf("%lld",&a);
		if(a<0)m++;
		a = ABS(a);
		ans += a;
		min = MIN(min,a);
	}
	if(m%2==0)printf("%lld",ans);
	else printf("%lld",ans-2*min);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <ctype.h>
int main(void){
    // Your code here!
    char ch;
    
    while(1){
        scanf("%c",&ch);
        if(ch=='\n'){
            printf("\n");
            break;
        }
        else if(islower(ch)){
            printf("%c",toupper(ch));
        }
        else if(isupper(ch)){
            printf("%c",tolower(ch));
        }
        else{
            printf("%c",ch);
        }
    }
    return 0;
}



Measured memory_bytes: 2100