akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

using namespace std;

int operation(char op, int a, int b) {
    if (op == '0') {
        return a - b;
    } else {
        return a + b;
    }
}

char decode(char enc) {
    if (enc == '0') {
        return '-';
    } else {
        return '+';
    }
}

int main() {
    char input[5];
    for (int i = 0; i < 4; ++i) {
        cin >> input[i];
    }

    int num[4];
    for (int i = 0; i < 4; ++i) {
        num[i] = (int) input[i] - '0';
    }

    string patterns[4] = {"000", "001", "011", "111"};
    for (int i = 0; i < 4; ++i) {
        do {
            int res = num[0];
            for (int j = 0; j < 3; ++j) {
                res = operation(patterns[i][j], res, num[j + 1]);
            }

            if (res == 7) {
                cout << num[0] << decode(patterns[i][0]) << num[1] << decode(patterns[i][1]) << num[2]
                     << decode(patterns[i][2]) << num[3] << "=7" << endl;
                goto END;
            }
        } while (next_permutation(patterns[i].begin(), patterns[i].end()));
    }

    END:;
}

Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b[ohara], c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n >> m;
  rep(i, m) cin >> a[i] >> b[i];
  rep(i, 1000) {
    s = to_string(i);
    if (Size(s) != n) continue;
    int ok = 0;
    rep(j, m) {
      tmp = s[a[j] - 1] - '0';
      if (tmp != b[j]) ok = 1;
    }
    if (ok) continue;
    Cout(i);
    return 0;
  }
  Cout(-1);
  return 0;
}

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

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
    int n,i;
    std::cin >> n;
    long long int a[n];
    long long int front[n],back[n];
    for (i=0;i<n;i++){
        std::cin >>a[i];
    }
        if(n==2)std::cout << max(a[0],a[1]) << std::endl;
        if(n>=3){
    front[0]=a[0];
    back[n-1]=a[n-1];
    for (i=1;i<n;i++){
        front[i]=euclidean_gcd(front[i-1],a[i]);
    }
    for (i=n-2;i>=0;i--){
        back[i]=euclidean_gcd(back[i+1],a[i]);
    }
    int x;
    int ans = max(front[n-2],back[1]);
     for (i=1;i<n-1;i++){
         x=euclidean_gcd(front[i-1],back[i+1]);
         if (x>ans)ans=x;
     }
    std::cout << ans<< std::endl;
        
    }
   // std::cout <<ans << std::endl;
}

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

int main() {
  int a,b,c;
  int k;
  cin>>a>>b>>c>>k;

  while(k&&b<=a) {
    b=b*2;
    k--;
  }
  while(k&&c<=b) {
    c=c*2;
    k--;
  }

  if(a<b&&b<c) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3640
s=input()
a=int(s)
list=[]
list.append(1)
list.append(6)
list.append(9)
list.append(36)
list.append(81)
list.append(216)
list.append(729)
list.append(1296)
list.append(6561)
list.append(7776)
list.append(59049)
list.append(46656)
pp=[]
def money(x,y):
  for i in range(12):
    b=x//list[i]
    if b==0:
      continue
    if i%2==1:
      if 0<b<6:
        if x%list[i]==0:
          pp.append(y+b)
        else:
          if y>20:
            break
          money(x-list[i],y+1)
    elif i%2==0:
      if i!=0:
        if 0<b<9:
          if x%list[i]==0:
            pp.append(y+b)
          else:
            if y>20:
              break
            money(x-list[i],y+1)
      else:
        if 0<b<6:
          pp.append(y+b)
money(a,0)
print(min(pp))

Measured memory_bytes: 4888
#include <stdio.h>

int		is_2div(int n)
{
	int i = 1;
	int count = 0;
	while (n > 1)
	{
		if (n % 2 == 0)
		{
			n /= 2;
			count++;
		}
		else
			break ;
	}
	return (count);
}

int main(void)
{
	int n;
	scanf("%d",&n);
	int i = 0;
	int sum = 0;
	int nb;
	if (n == 1)
	{
		printf("%d", 1);
		return 0;
	}
	while (i <= n)
	{
		if (sum < is_2div(i))
		{
			sum = is_2div(i);
			nb = i;
		}
		i++;
	}
	printf("%d",nb);
	return (0);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int f[] = new int[N + 1];
		for(int x = 1 ; x <= 100 ; ++x){
			for(int y = 1 ; y <= 100 ; ++y){
				for(int z = 1 ; z <= 100 ; ++z){
					int n = x * x + y * y + z * z + x * y + y * z + z * x;
					if(n < f.length){
						f[n]++;
					}
				}	
			}			
		}
		for(int i = 1 ; i <= N ; ++i){
			System.out.println(f[i]);
		}
	}
}


Measured memory_bytes: 38804
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

public class Main {

	public static class Point {
		public Point(int p, int y) {
			this.p = p;
			this.y = y;
		}

		int p, y;
	}

	private static int N;
	private static int M;
	private static HashMap<Integer, SortedMap<Integer, Integer>> tmpMap = new HashMap<>();

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();

		List<Point> list = new ArrayList<>();
		for (int i = 0; i < M; i++) {
			int p = sc.nextInt();
			int y = sc.nextInt();
			list.add(new Point(p, y));
			SortedMap<Integer, Integer> treemap;
			if (tmpMap.containsKey(p)) {
				treemap = tmpMap.get(p);
			} else {
				treemap = new TreeMap<>();
			}
			treemap.put(y, 0);
			tmpMap.put(p, treemap);
		}

		for (Entry<Integer, SortedMap<Integer, Integer>> item : tmpMap.entrySet()) {
			int i = 0;
			Iterator<Entry<Integer, Integer>> iterator = item.getValue().entrySet().iterator();
			while (iterator.hasNext()) {
				iterator.next().setValue(++i);
			}
		}
		for (Point point : list) {
			int p = point.p;
			String string1 = "000000" + p;
			String string2 = "000000" + tmpMap.get(p).get(point.y);
			System.out.println(string1.substring(string1.length() - 6) + string2.substring(string2.length() - 6));
		}
	}
}


Measured memory_bytes: 116020
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations
from random import random

import numpy as np

sys.setrecursionlimit(200000)


class Solver:
    def __init__(self):
        pass

    def input(self):
        """
            faster input function than builtin stdin.
        """
        return sys.stdin.readline()[:-1]

    def ii(self, t: type = int):
        """
            input single value.
        """
        return t(self.input())

    def il(self, t: type = int):
        """
            input single line.
        """
        return list(map(t, self.input().split()))

    def imi(self, N: int, t: type = int):
        return [self.ii(t) for _ in range(N)]

    def iml(self, N: int, t: type = int):
        return [self.il(t) for _ in range(N)]

    def solve(self):
        N = self.ii()
        S = self.ii(t=str)
        current = S[0]
        ans = S[0]
        for s in S[1:]:
            if current == s:
                continue
            ans += s
            current = s
        return len(ans)


if __name__ == "__main__":
    solver = Solver()
    print(solver.solve())


Measured memory_bytes: 23712
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int S = scan.nextInt();
		int W = scan.nextInt();
		
		if(W >= S) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}
	}
}

Measured memory_bytes: 27068
import fractions as fra
A, B, C, D = map(int, input().split())

def lcm(x, y):
    return (x * y) // fra.gcd(x, y)
  
def wari(max, k):
  return (max // k)

lcmCD = lcm(C, D)
bot = A - (wari(A, C) + wari(A, D) - wari(A, lcmCD))
top = B - (wari(B, C) + wari(B, D) - wari(B, lcmCD))

if A % C != 0:
  if A % D != 0:
    bot -= 1
  
print(top - bot)

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

while True:
    n = int(input())
    if n == 0:
        break
    
    table = [[0 for i in range(n)] for j in range(n)]
    for l in range(n):
        line = input()
        for m in range(n):
            table[l][m] = int(line[m])

    t = 0
    ans = 0
    for i in range(n):
        for j in range(n):
            if table[i][j] > 0:
                t += 1
            else:
                ans = max(t, ans)
                t = 0
        ans = max(t, ans)
        t = 0

    for i in range(n):
        for j in range(n):
            if table[j][i] > 0:
                t += 1
            else:
                ans = max(t, ans)
                t = 0
        ans = max(t, ans)
        t = 0

    for c in range(n):
        for j in range(c+1):
            if table[c-j][j] > 0:
                t += 1
            else:
                ans = max(t, ans)
                t = 0
        ans = max(t, ans)
        t = 0
        

    for c in range(n):
        for j in range(c+1):
            if table[n-1-(c-j)][n-1-j] > 0:
                t += 1
            else:
                ans = max(t, ans)
                t = 0
        ans = max(t, ans)
        t = 0


    for c in range(n):
        for j in range(c+1):
            if table[n-1-(c-j)][j] > 0:
                t += 1
            else:
                ans = max(t, ans)
                t = 0
        ans = max(t, ans)
        t = 0


    for c in range(n):
        for j in range(c+1):
            if table[c-j][n-1-j] > 0:
                t += 1
            else:
                ans = max(t, ans)
                t = 0
        ans = max(t, ans)
        t = 0

        
    print(ans)




Measured memory_bytes: 6740
#include <iostream>
using namespace std;
int main (){
int X;
cin>>X;
X%=7;
if (X==1)cout<<"fri"<<endl;
if (X==2)cout<<"sat"<<endl;
if (X==3)cout<<"sun"<<endl;
if (X==4)cout<<"mon"<<endl;
if (X==5)cout<<"tue"<<endl;
if (X==6)cout<<"wed"<<endl;
if (X==0)cout<<"thu"<<endl;
return 0;
}



Measured memory_bytes: 3136
/// 5:22 PM 10/05/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 998244353
#define INF 1e15
typedef long long ll;

ll powmod(ll base, ll exp, ll MOD) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return (res % MOD);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> fact(n + 1);
    vector<ll> invf(n + 1);
    fact[0] = 1;
    invf[0] = 1;
    for (ll i = 1; i <= n; i++) {
        fact[i] = (i * fact[i - 1]) % M;
        invf[i] = powmod(fact[i], M - 2, M);
    }
    ll ans = 0;
    for (ll i = 0; i <= k; i++) {
        ll ncr = fact[n - 1] * invf[i];
        ncr = ncr % M;
        ncr = (ncr * invf[n - 1 - i]) % M;
        ll temp = powmod(m - 1, n - i - 1, M);
        temp = (temp * m) % M;
        temp = (temp * ncr) % M;
        ans = (ans + temp) % M;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6344
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int X = in.nextInt();
		int K = in.nextInt();
		int[] r = new int[K];
		for (int i = 0; i < K; i++) {
			r[i] = in.nextInt();
		}
		int Q = in.nextInt();
		int[] t = new int[Q];
		int[] a = new int[Q];
		for (int i = 0; i < Q; i++) {
			t[i] = in.nextInt();
			a[i] = in.nextInt();
		}
		int rp = 0;
		int tap = 0;
		
		int low = 0;
		int middle = 0;
		int high = X;
		int l_bound = 0;
		int h_bound = X;
		
		int prev_r = 0;
		while(tap<Q){
			if(rp>=K || t[tap]<=r[rp]){
				if(rp%2==0){ // now down
					if(a[tap]<=l_bound){
						System.out.println(Math.max(0,low-(t[tap]-prev_r)));
					}else if(a[tap]>=h_bound){
						System.out.println(Math.max(0, high-(t[tap]-prev_r)));
					}else{
						System.out.println(Math.max(0, a[tap]+middle-(t[tap]-prev_r)));
					}
				}else{// now up
					if(a[tap]<=l_bound){
						System.out.println(Math.min(X,low+(t[tap]-prev_r)));
					}else if(a[tap]>=h_bound){
						System.out.println(Math.min(X, high+(t[tap]-prev_r)));
					}else{
						System.out.println(Math.min(X, a[tap]+middle+(t[tap]-prev_r)));
					}
				}
				tap ++;
			}else{
				if(rp%2==0){//down
					middle -= r[rp]-prev_r;
					low = Math.max(0, low-(r[rp]-prev_r));
					high = Math.max(0, high-(r[rp]-prev_r));
				}else{// up
					middle += r[rp]-prev_r;
					low = Math.min(X, low+(r[rp]-prev_r));
					high = Math.min(X, high+(r[rp]-prev_r));
				}
				if(l_bound+middle<0){
					l_bound = -middle;
				}
				if(h_bound+middle>X){
					h_bound = X -middle;
				}
				prev_r = r[rp];
				rp ++;
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}

Measured memory_bytes: 111280
import collections

n,m=map(int,input().split())
g=[[] for _ in range(n+1)]
for _ in range(m):
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
q=collections.deque()
q.append(1)
check=[0]*(n+1)
check[1]=1
ans=[0]*(n+1)
while len(q)!=0:
 v=q.popleft()
 for u in g[v]:
   if check[u]==0: #まだ探索していない頂点について、その頂点に親の頂点に移動する道しるべを置く
     check[u]=1
     ans[u]=v
     q.append(u)
print('Yes')
for i in range(2,n+1):
 print(ans[i])

Measured memory_bytes: 34840
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pa;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;

int N;
int P[MAX];
int ord[MAX];
void input(){
	cin>>N;
	rep1(i, N){
		cin>>P[i];
		ord[P[i]]=i;
	}
}

void solve(){
	multiset<int> ms;
	ms.insert(0);
	ms.insert(0);
	ms.insert(N+1);
	ms.insert(N+1);

	ll ans=0;
	rrep1(i, N){
		ms.insert(ord[i]);
		int a, b, c, d;
		auto itr1 = ms.find(ord[i]);
		auto itr2 = ms.find(ord[i]);
		itr1--;
		b = *itr1;
		itr1--;
		a = *itr1;
		itr2++;
		c = *itr2;
		itr2++;
		d = *itr2;
		ans+= (ll)i * ((b-a)*(c-ord[i])+(ord[i]-b)*(d-c));
	}
	cout<<ans<<endl;
	
}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    ll X,sum=0;
    cin >> X;
    for(ll i=1;;i++){
        sum += i;
        if(sum>=X){
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
   int i,j,k,l;
    while(cin>>i){
   int x[i]; k=0;
   for(j=0;j<i;j++){cin>>x[j]; k+=x[j];   }
   sort(x,x+i);
   k-=(x[i-1]*2);
   if(k>0) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
    } return 0;

}


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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int n;

ll a[11];

ll t;

ll gcd(ll a,ll b) {
	return b==0?a:gcd(b,a%b);
}

int main(){
	cin.tie(0);
	
	cin>>n;
	rep(i, n)cin>>a[i];
	
	t = a[0];
	
	for_(i, 1, n)t *= a[i]/gcd(t, a[i]);
	
	cout<<t<<endl;
	
	return 0;
}



Measured memory_bytes: 3112
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)

int n;
int a[100010];

ll sum, ans, ans2;
bool flg;

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

	flg = true;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (flg) {
			if (sum >= 0) {
				ans += sum + 1;
				sum = -1;
			}
			flg = false;
		} else {
			if (sum <= 0) {
				ans += 1 - sum;
				sum = 1;
			}
			flg = true;
		}
	}
	flg = true;
	sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (flg == true) {
			if (sum <= 0) {
				ans2 += 1 - sum;
				sum = 1;
			}
			flg = false;
		} else {
			if (sum >= 0) {
				ans2 += sum + 1;
				sum = -1;
			}
			flg = true;
		}
	}

	cout<< min(ans, ans2) <<endl;
	
	return 0;
}

Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
L = []
minA = min(A)
for i, a in enumerate(A):
  if a % minA != 0:
    L.append(a % minA)
if len(L) == 0:
  print(minA)
  exit()
L.append(minA)
L = list(set(L))
while len(L) > 1:
  L.sort()
  for i, l in enumerate(L):
    if i == 0:
      continue
    L[i] = l - L[0]
  L = list(set(L))
print(L[0])

Measured memory_bytes: 79768
import java.util.*;
import java.io.*;
public class Main {
    static long mod = (long) Math.pow(10, 9) + 7;
    public static void main(String[] args) {
        FastScanner f = new FastScanner(System.in);
        long a = f.nextLong();
        long b = f.nextLong();
        long g = gcd(a , b);
        long ans = (a * b) / g;
        pn(ans);
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    // Fast Scanner Alternative of Scanner 
    // Uses Implementation of BufferedReader Class
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new
                    InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
    
    // Print in console
    static void pn(Object o){System.out.println(o);}
    static void p(Object o){System.out.print(o);}
    static void pni(Object o){System.out.println(o);System.out.flush();}

    //GCD of two integers
    static long gcd(long a, long b) {
        if(b == 0) return a;
        else {
            return gcd(b, a % b);
        }
    }

    
    // Return boolean sieve of first n prime nos.
    static boolean[] sieve(int n) {
        boolean isprime[] = new boolean[n + 1];
        for(int i = 0; i <= n;++i) {
            isprime[i] = true;
        }
        isprime[0] = false;
        isprime[1] = false;
        for(int i = 2; i * i <= n; ++i) {
             if(isprime[i] == true) {               
                 for(int j = i * i; j <= n;j += i)
                     isprime[j] = false;
            }
        }
        return isprime;
    }

    // Return HashSet of factors of a number
    static HashSet<Long> factors(long n) {
        HashSet<Long> hs = new HashSet<Long>();
        for(long i = 1; i <= (long)Math.sqrt(n); i++) {
            if(n % i == 0) {
                hs.add(i);
                hs.add(n / i);
            }
        }
        return hs;
    }

    //Is n prime ?
    static boolean isPrime(int n) {
        if(n == 1) return false;
        int i = 2;
        while((i * i) <= n) {
            if(n % i == 0) return false;
            i += 1;
        }
        return true;
    }
}

Measured memory_bytes: 21332
/*
ex 7_1
tomatokan
*/

#include <stdio.h>

typedef struct point{
    int x_elem;
    int y_elem;
}point;

point new_point(int x_elem,int y_elem){//初期化
    point new_p={x_elem,y_elem};
    return new_p;
}

point shift_point(point old,int shift_x,int shift_y){//点の移動
    return new_point(old.x_elem+shift_x,old.y_elem+shift_y);
}

point add_as_complex(point point1,point point2){//複素数として加算
    return shift_point(point1,point2.x_elem,point2.y_elem);
}

point mult_by_int_as_complex(point old,int times){
    return new_point(old.x_elem*times,old.y_elem*times);
}

point mult_as_complex(point point1,point point2){//複素数として乗算
    return new_point(point1.x_elem*point2.x_elem-point1.y_elem*point2.y_elem, point1.x_elem*point2.y_elem+point1.y_elem*point2.x_elem);
}

int main(void){
    int read1,read2;
    point vertex1,vertex2,vertex3,vertex4;
    point vector_1to2;
    point vector_2to3;
    scanf("%d",&read1);
    scanf("%d",&read2);
    vertex1=new_point(read1,read2);
    scanf("%d",&read1);
    scanf("%d",&read2);
    vertex2=new_point(read1,read2);
    vector_1to2=add_as_complex(vertex2,mult_by_int_as_complex(vertex1,-1));
    vector_2to3=mult_as_complex(vector_1to2,new_point(0,1));
    //頂点座標の決定
    vertex3=add_as_complex(vertex2,vector_2to3);
    vertex4=add_as_complex(vertex1,vector_2to3);
    printf("%d %d %d %d\n",vertex3.x_elem,vertex3.y_elem,vertex4.x_elem,vertex4.y_elem);
    return 0;
}

Measured memory_bytes: 1728
import sys

stdin = sys.stdin


def na(): return map(int, stdin.readline().split())


def ns(): return stdin.readline().strip()


n,a,b=na()
v = list(na())
v.sort()
tot = 0
last = 0
for i in range(a):
    tot += v[-(i+1)]
    last = v[-(i+1)]

com = []
q = 100
for i in range(q):
    com.append([0]*q)

for i in range(q):
    com[i][0] = 1
    for j in range(1, q):
        com[i][j] = com[i-1][j-1] + com[i-1][j]

print("{:.9f}".format(tot/a))
lct = 0
large = 0
for w in v:
    if w > last:
        large += 1
    if w == last:
        lct += 1
ret = 0
if large == 0:
    for i in range(a,b+1):
        if 0 <= i-large <= lct:
            ret += com[lct][i-large]
else:
    ret = com[lct][a-large]
print(ret)


Measured memory_bytes: 3188
n = int(input().strip())
town = [list(map(int, input().split())) for _ in range(n)]
def dist(p, q):
  return ((p[0]-q[0]) ** 2 + (p[1]-q[1]) ** 2) ** 0.5
s = sum(dist(p, q) for p in town for q in town)
avg = s / n
print ("{:.10f}".format(avg))


Measured memory_bytes: 3060
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int N = 3e5 + 7;
bool isDiv9(string num){
   int n = num.length();
   long sum = accumulate(begin(num), end(num), 0) - '0' * n;
   if(sum % 9 == 0)
      return true;
      return false;
}
int32_t main(){
    IOS;
    string s;
    cin >> s;
    if(isDiv9(s)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3768
from sys import stdin
import itertools

def main():
    n,m = [int(x) for x in stdin.readline().rstrip().split()]
    ss = []
    for x in range(m):
        ks = tuple(map(int, stdin.readline().rstrip().split()))
        ss.append(ks[1:])
    ps = [int(x) for x in stdin.readline().rstrip().split()]

    ans = 0
    for cond in itertools.product((0,1), repeat=n):
        ok = 1
        for s,p in zip(ss,ps):
            total = 0
            for c in s:
                total += cond[c-1]
            if total % 2 != p:
                ok = 0
                break
        ans += ok

    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 3064
X = int(input())

cnt = (X - X % 100) // 100
d2 = X % 100


if d2 % 5 == 0:
    if d2 // 5 <= cnt:
        result = 1
    else:
        result = 0
else:
    if d2 // 5 + 1 <= cnt:
        result = 1
    else:
        result = 0
print(result)

Measured memory_bytes: 38384
#include<iostream>
#include<ctype.h>
#include<stdio.h>
#include<string.h>

int main()
{
	char str[1000];
	fgets( str, 1000, stdin );
	
	for( int i = 0; i < strlen( str ); i++ ){
		str[i] = toupper( str[i] );
	}
	
	std::cout << str;
	
 	return 0;
}

Measured memory_bytes: 1096
from collections import defaultdict, Counter
while 1:
    N = int(input())
    if N == 0:
        break
    mp = defaultdict(list)
    for i in range(N):
        for word in input().split():
            mp[word[0]].append(word)
    k = input()
    c = Counter(mp[k])
    if len(c) == 0:
        print("NA")
    else:
        print(*sorted(c, key=lambda x: (-c[x], x))[:5])


Measured memory_bytes: 6028
import           Control.Applicative
import           Control.Monad

fromSharp :: String
fromSharp = concat $ repeat "#."

sharp :: Int -> String
sharp n = take n fromSharp

dot :: Int -> String
dot n = take n $ tail fromSharp

check :: Int -> Int -> String
check h w = unlines . fmap ($ w) $ take h fs
  where
    fs = concat $ repeat [sharp, dot]

main :: IO ()
main = do
    xss <- fmap (fmap read . words) . lines <$> getContents :: IO [[Int]]
    forM_ (takeWhile (/= [0, 0]) xss) $ \[h, w] -> do
        putStrLn $ check h w



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

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
const int mxN=2e5+5,INF=1e9;
vector<int> adj[mxN];
int dist[mxN];
int n,m,d;

void bfs(int u,int d) {
    deque<pair<int,int>> q;
    q.push_back({u,d});
    while(!q.empty()) {
        pair<int,int> cur=q.front();
        q.pop_front();
        if(dist[cur.first]!=INF)
            continue;
        dist[cur.first]=cur.second;
        for(auto v : adj[cur.first])
            q.push_back({v,cur.second+1});
    }
}

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m;
    F0R(i,m) {
        int u,v;
        cin >> u >> v;
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    F0R(i,n)
        dist[i]=INF;
    bfs(0,0);
    F0R(i,n) {
        if(dist[i]==INF) {
            cout << "No";
            return 0;
        }
    }
    vector<int> res(n);
    FOR(i,1,n) {
        int cur=INF;
        for(auto v : adj[i]) {
            if(cur>dist[v]) {
                cur=dist[v];
                res[i]=v;
            }
        }
    }
    cout << "Yes\n";
    FOR(i,1,n)
        cout << res[i]+1 << "\n";

    return 0;
}


Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
 int n;
  cin>>n;
  vll a(n);
  rep(i,0,n){
    cin>>a[i];
  }
  ll x=0;
  rep(i,0,n){
    if(i%2==0) x+=a[i];
    else x-=a[i];
  }
  vll ans(n);
  ans[0]=x;
  cout<<ans[0]<<" ";
  rep(i,1,n){
   ans[i]=(a[i-1]-ans[i-1]/2)*2;
    cout<<ans[i]<<" ";
  }
 
}

Measured memory_bytes: 4848
import java.util.*;

public class Main {
    public static void main(String args[]) {
  Scanner sc=new Scanner(System.in);
 String s=sc.next();
 char c=s.charAt(0);
 
 if(c>='A' && c<='Z')
 c='A';
 
 else
 c='a';
 
 
      System.out.println(c);
    }
}

Measured memory_bytes: 35532
package main

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

func main() {
	nextReader = newScanner()
	s := nextString()
	r := strings.Replace(s, "A", "", -1)
	if len(r) == 0 || len(r) == 3 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}

// ---------------------------------------------------------------
// I/O
// ---------------------------------------------------------------
var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

func nextInts(size int) []int {
	ns := make([]int, size)
	for i := 0; i < size; i++ {
		ns[i] = nextInt()
	}
	return ns
}


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

int main() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a == b && a != c || a == c && b != c ||b ==c && b != a) printf("Yes\n");
	else printf("No\n");
	return 0;
} 

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

using namespace std;
bool test( const string& s) {
    if (s.size() != 4) return false;
    char buffer[4];
    copy( s.begin(), s.end(), buffer);
    sort( &buffer[0], &buffer[4]);
    return buffer[0] == buffer[1] && buffer[2] == buffer[3] && buffer[0] != buffer[2];
}

int main(void) {
    string s;
    cin >> s;
    if (test(s)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll cycling(long long K, int state_size, int s, std::function<int(int)> trans){
    vector<int> seq, vis;
    vis.assign(state_size + 1, -1);
    seq.push_back(s);
    vis[s] = 0;
    int l = 0, r = 0;
    // seq[l] = seq[r]
    while(r < K){
        s = trans(s);
        seq.push_back(s);
        r++;
        if(vis[s] != -1){
            l = vis[s];
            break;
        }
        vis[s] = r;
    }
    ll ret = 0;
    FOR(i, l, r) ret += seq[i];
    ret *= (K - l) / (r - l);
    REP(i, (K - l) % (r - l)) ret += seq[l + i];
    REP(i, l) ret += seq[i];
    return ret;
}

ll N, X, M;

signed main(){
    cin >> N >> X >> M;
    ll ans = cycling(N, M, X, [&](ll x) -> ll{return x * x % M;});
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3960
#include<cctype>
#include<cstdio>

int main(){
    char ch;
    
    while (1){
        scanf("%c", &ch);
        if(isalpha(ch)){
            if(islower(ch))printf("%c", toupper(ch));
            else printf("%c", tolower(ch));
        
        }
        else printf("%c", ch);
        if(ch == '\n')break;
        
    }
    return 0;
}


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


int main() {
  int n;
  cin >> n ;
  
  if(n==1){
    cout << "Yes" << endl;
  }
  
  else if(n==2){
    cout << "Yes" << endl;
  }
  
  else if(n==3){
    cout << "Yes" << endl;
  }
  
  else if(n==4){
    cout << "Yes" << endl;
  }
  
  else if(n==5){
    cout << "Yes" << endl;
  }
  
  else if(n==6){
    cout << "Yes" << endl;
  }
  
  else if(n==7){
    cout << "Yes" << endl;
  }
  
  else if(n==8){
    cout << "Yes" << endl;
  }
  
  else if(n==9){
    cout << "Yes" << endl;
  }
  
  else if(n==10){
    cout << "Yes" << endl;
  }
  
  else if(n==12){
    cout << "Yes" << endl;
  }
  
  else if(n==14){
    cout << "Yes" << endl;
  }
  
  else if(n==15){
    cout << "Yes" << endl;
  }
  
  else if(n==16){
    cout << "Yes" << endl;
  }
  
  else if(n==18){
    cout << "Yes" << endl;
  }
  
  else if(n==20){
    cout << "Yes" << endl;
  }
  
  else if(n==21){
    cout << "Yes" << endl;
  }
  
  else if(n==24){
    cout << "Yes" << endl;
  }
  
  else if(n==25){
    cout << "Yes" << endl;
  }
  
  else if(n==27){
    cout << "Yes" << endl;
  }
  
  else if(n==28){
    cout << "Yes" << endl;
  }
  
  else if(n==30){
    cout << "Yes" << endl;
  }
  
  else if(n==32){
    cout << "Yes" << endl;
  }
  
  else if(n==35){
    cout << "Yes" << endl;
  }
  
  else if(n==36){
    cout << "Yes" << endl;
  }
  
  else if(n==40){
    cout << "Yes" << endl;
  }
  
  else if(n==42){
    cout << "Yes" << endl;
  }
  else if(n==45){
    cout << "Yes" << endl;
  }
  
  else if(n==48){
    cout << "Yes" << endl;
  }
  
  else if(n==49){
    cout << "Yes" << endl;
  }
  
  else if(n==54){
    cout << "Yes" << endl;
  }
  
  else if(n==56){
    cout << "Yes" << endl;
  }
  
  else if(n==63){
    cout << "Yes" << endl;
  }
  
  else if(n==64){
    cout << "Yes" << endl;
  }
  
  else if(n==72){
    cout << "Yes" << endl;
  }
  
  else if(n==81){
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import itertools
s = ""
while True:
	s = raw_input()
	if s == ".": break
	count = 0
	for p, q, r in itertools.product(xrange(3), repeat=3):
		f = s.replace("P", str(p)).replace("Q", str(q)).replace("R", str(r))
		while len(f) > 1:
			f = f.replace("-0", "2").replace("-1", "1").replace("-2", "0")
			for x, y in itertools.product(xrange(3), repeat=2):
				f = f.replace("(%d*%d)" % (x, y), str(min(x, y)))
				f = f.replace("(%d+%d)" % (x, y), str(max(x, y)))
		if f == "2":
			count += 1
	print count

Measured memory_bytes: 5128
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int K;
    cin >> K;

    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << a[K-1] << endl;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/panasonic2020/panasonic2020_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/panasonic2020/panasonic2020_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/panasonic2020/panasonic2020_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3596
import java.util.*;
public class Main {
    public static void main(String args []) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Long> B = new ArrayList<>();
        for(int i=0;i<N-1;i++) B.add(sc.nextLong());
        long opt = 0;
        for(int i=0;i<N;i++){
            if(i==0) opt+=B.get(0);
            else if(i==N-1) opt+=B.get(N-2);
            else{
                long before = B.get(i-1);
                long next = B.get(i);
                if(before<next) opt+=before;
                else opt+=next;
            }
        }
        System.out.println(opt);
    }
}


Measured memory_bytes: 22996
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	ll sum = 0;
	int  n;
	cin >> n;
	REP(i, n) {
		int l, r;
		cin >> l >> r;
		sum += r - l + 1;
	}
	cout << sum << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back

int A,B;
char S[100],T[100],U[100];
signed main(){
    scanf("%s %s",&S,&T);
    scanf("%lld %lld",&A,&B);
    scanf("%s",&U);
    if(strcmp(S,U)==0){
        A--;
    }else if(strcmp(T,U)==0){
        B--;
    }
    printf("%lld %lld\n",A,B);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string a,b,c;
	cin>>n;
	cin>>a>>b>>c;
	int ans=0;
	for(int i=0;i<n;i++)
	{
		char CC[3];
		CC[0]=a[i];
		CC[1]=b[i];
		CC[2]=c[i];
		sort(CC,CC+3);
		int mx=1;
		for(int j=0;j<3;j++)
		{
			int cnt=0;
			int k=j;
			while(k+1<3&&CC[k+1]==CC[j])
			{
				cnt++;k++;
			}
		//	cout<<i<<" "<<cnt<<endl;
			mx=max(mx,cnt+1);
		}
	//	cout<<mx<<endl;
		ans+=3-mx;
	}
	cout<<ans<<endl;
}

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

int main() {
	int N, M; cin >> N >> M;
	vector<int> L(M);
	vector<int> R(M);

	for (int i = 0; i < M; i++) {
		cin >> L[i] >> R[i];
	}

	sort(L.begin(), L.end());
	sort(R.begin(),R.end());

	if (R[0] >= L[M-1])cout << R[0] - L[M - 1] + 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 1024
r1, c1, r2, c2 = map(int, input().split())
mod = 10 ** 9 + 7

# dp = [[0] * (r2 + 1) for _ in range(c2 + 1)]
# for i in range(c2 + 1):
#     dp[i][0] = 1
# for i in range(r2 + 1):
#     dp[0][i] = 1

# for i in range(c2):
#     for j in range(r2):
#         dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1]

# ans = 0
# for i in range(c1, c2 + 1):
#     for j in range(r1, r2 + 1):
#         ans += dp[i][j]
# print(ans % mod)
# brute forceであり、TLEする。


MAX = 10 ** 6 * 2 + 5
def com_init(MAX, mod):
    fac = [0] * MAX
    finv = [0] * MAX
    inv = [0] * MAX
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod
    return fac, finv

fac, finv = com_init(MAX, mod)

def nCr(n,r):
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod 

def myfunc(r, c):
    return nCr(r + c + 2, r + 1) - 1


ans = myfunc(r2, c2)
ans -= myfunc(r2, c1 - 1)
ans -= myfunc(r1 - 1, c2)
ans += myfunc(r1 - 1, c1 - 1)
print(ans % mod)

# The result is the same as the below, but much faster.
# def nCr(n, r):
#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


Measured memory_bytes: 86256
int main()
{
	int N, K, ans, sum, len;

	scanf("%d%d", &N, &K);
	ans = sum = K + 1;
	if (N <= sum) {
		printf("%d\n", N);
		return 0;
	}

	len = 2; while (1) {
		while (sum > len*K) len++;
		sum += len;
		if (sum > N) break;
		ans++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
typedef long long L;
int main()
{
  L c=0,a,b,t;
  scanf("%lld%lld%lld",&a,&b,&t);
  while(t>=a){
  	c+=b;t-=a;
  }
  printf("%lld\n",c);
 	return 0; 
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int long long
int hmt() {int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';if(n) x=-x;return x;}
#define in hmt()
#define ins ({string x;char c=getchar();for(;c==' '||c=='\n';c=getchar());for(;c!=' '&&c!='\n';c=getchar()) x+=c;x;})
#define forinc(i,a,b) for(int i=a,_b=b;i<=_b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define forb(i,BS) for(int i=BS._Find_first();i< BS.size();i = BS._Find_next(i))
#define forv(a,b) for(auto &a:b)
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define onbit(x,i) (x|(1<<(i-1)))
#define offbit(x,i) (x&~(1<<(i-1)))
const int N=5010,mod=998244353;
int f[N][N];
int n,k;
int C(int n,int k)
{
    if(k<0||k>n) return 0;
    if(!k||n==k) return 1;
    if(f[n][k]!=-1) return f[n][k];
    return f[n][k]=(C(n-1,k)+C(n-1,k-1))%mod;
}
main()
{
    //freopen("GG.inp","r",stdin);
	reset(f,-1);
	k=in,n=in;
	forinc(i,2,k*2)
	{
		int ans=0,cur=1;
		int cnt=max(min(i/2,k)-max(i-k,1ll)+1,0ll);
		int p=k-cnt*2;
		forinc(j,0,cnt)
		{
			ans=(ans+C(cnt,j)*cur%mod*C(n+p-1,p+j-1))%mod;
			cur=cur*2%mod;
		}
		cout<<ans<<"\n";
	}
}


Measured memory_bytes: 196608
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

int N;
ll table[NUM];

int main(){

	scanf("%d",&N);

	ll sum = 0;

	table[0] = 0;
	for(int i = 1; i <= N; i++){

		scanf("%lld",&table[i]);
		sum += abs(table[i]-table[i-1]);
	}
	sum += abs(table[N]);
	table[N+1] = 0;

	//i == 1
	printf("%lld\n",sum-(abs(table[1])+abs(table[1]-table[2]))+abs(table[2]));

	for(int i = 2; i <= N-1; i++){

		printf("%lld\n",sum-(abs(table[i]-table[i-1])+abs(table[i+1]-table[i]))+abs(table[i+1]-table[i-1]));
	}

	//i == N
	printf("%lld\n",sum-(abs(table[N]-table[N-1])+abs(table[N]))+abs(table[N-1]));

	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//a^n mod p
ll anp(ll a, ll n, ll p) {
  ll cnt = 1, b = a;
  while (b < p && cnt < n) {
    b *= a;
    cnt++;
  }
  if (b < p) return b;
  b %= p;
  ll c = anp(b, n / cnt, p);
  for (ll i = 0; i < n % cnt; i++) {
    c *= a;
    c %= p;
  }
  return c;
}

//二項係数 mod p
ll modinv(ll n, ll p) {
  ll a = p, u = 1, v = 0;
  while (a) {
    ll t = n / a;
    n -= t * a;
    swap(n, a);
    u -= t * v;
    swap(u, v);
  }
  u %= p;
  if (u < 0) u += p;
  return u;
}

ll ncr(ll n, ll r, ll p) {
  r = min(r, n - r);
  ll ans = 1;
  for (ll i = 0; i < r; i++) {
    ans *= (n - i) % p;
    ans %= p;
  }
  for (ll i = 0; i < r; i++) {
    ans *= modinv(i + 1, p);
    ans %= p;
  }
  return ans;
}

int main() {
  ll n, a, b, p = 1000000007;
  cin >> n >> a >> b;

  ll ans = anp(2, n, p) - 1;
  ll aa = ncr(n, a, p);
  ll bb = ncr(n, b, p);
  ans -= aa;
  if (ans < 0) ans += p;
  ans -= bb;
  if (ans < 0) ans += p;
  cout << ans << endl;
}

Measured memory_bytes: 256