akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = 0;
            string S = "";
            string T = "";

            N = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().Split(' ');
            S = s[0];
            T = s[1];

            string result = "";
            for(int i = 0; i < N; i++)
            {
                result += S[i].ToString() + T[i].ToString();
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 11092
from fractions import gcd

def read():
    N = int(input().strip())
    return N,


def list_multiple_of_5(n):
    base = []
    mul = 5
    while mul <= n:
        base.append(mul)
        mul *= 5
    return base

def solve(N):
    if N % 2 == 1:
        return 0
    count = 0
    base10 = N // 10
    count += base10
    m5s = list_multiple_of_5(base10)
    for m5 in m5s:
        count += (base10 // m5)
    return count


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))


Measured memory_bytes: 5076
#include <iostream>
using namespace std;
constexpr auto mod = 1'000'000'007LL;
using large = long long;

static large memo[2'010][2'010];

static large solve(const large num_free, const large num_place) {
    if (memo[num_free][num_place] >= 0)
        return memo[num_free][num_place];

    large sum = 0;

    if (!num_free) {
        sum = 1;
    } else if (num_place) {
        for (large i = 0; i <= num_free; i++) {
            sum += solve(num_free - i, num_place - 1);
            sum %= mod;
        }
    }

    memo[num_free][num_place] = sum;
    return sum;
}

int main() {
    for (auto &row : memo)
        for (auto &elem : row)
            elem = -1;

    large n, k;
    cin >> n >> k;
    const auto nblue = k;
    const auto nred = n - k;

    for (auto i = 1; i <= k; i++) {
        auto ans = 0LL;
        const auto red_fixed = i - 1;
        const auto red_free = nred - red_fixed;
        const auto red_place = i + 1;
        const auto blue_fixed = i;
        const auto blue_free = nblue - blue_fixed;
        const auto blue_place = i;

        if (red_free >= 0 && blue_free >= 0) {
            const auto r = solve(red_free, red_place);
            const auto b = solve(blue_free, blue_place);

            auto tmp = r * b % mod;
            ans += tmp;
            if (ans >= mod)
                ans -= mod;
        }

        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 31872
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
   int z=s.find("7");
   if(z<200&&z>=0)
   {
       cout<<"Yes"<<endl;
   }
   else
    cout<<"No"<<endl;

    return 0;
}






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

int main() {
    ll k, n;
    cin >> k >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n-1) {
        ans = max(ans, a[i+1]-a[i]);
    }
    ans = max(ans, k-a[n-1]+a[0]);

    cout << k - ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <bits/stdc++.h>
#include <stack>
#include <algorithm>
typedef std::stack<int> IntStack;
using namespace std;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
  
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

int main() {
    int n;
    int counter;
    IntStack s;
    cin >> n;
  
    counter = 0;
  
    for(int i = 0; i < 11112; i++){
      if(s.size() < n + 1){
        if( IsPrime(5 * i + 2) ){
           counter = counter + 1;
           s.push(5 * i + 2);
        }
      }else{
        break;
      }
    }
 
  for(int i = 0; i < n; i++){
    cout << s.top() << " ";
    s.pop();
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll x[110];
int main() {
  ll n,k,ans=0;
  cin>>n>>k;

  rep(i,k,n+2){
    ll m1=(2*n+1-i)*i/2;
   ll m2=((i-1)*i)/2;
   ans=(ans+m1-m2+1)%mod;
  }
  cout<<ans;
}



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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  ll a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  ll dis = abs(a-b);
  ll moves = (v-w)*t;
  bool ok = false;
  if(moves >= dis)
  {
    ok = true;
  }
  if(ok) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
   int i,n,k;
   char s[11];
    
   scanf("%d",&n);
   scanf("%s",s);
   scanf("%d",&k);
   for (i=0;i<n;i++)
      if (s[i]!=s[k-1]) s[i]='*';
   puts(s);
   return 0;
}


Measured memory_bytes: 128
a, b = map(int, input().split())
s = input()

for i in range(a):
    if s[i] == '-':
        print("No")
        exit()

if s[a] != "-":
    print("No")
    exit()

for i in range(a+1, a+b+1):
    if s[i] == '-':
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 9184
from itertools import product


def solve(string):
    d, g, *pc = map(int, string.split())
    g //= 100
    p = [_p for _p in pc[::2]]
    c = [_c // 100 for _c in pc[1::2]]
    ans = 1000
    for f in product([True, False], repeat=d):
        sums = sum([(i + 1) * _p + _c for i, (_f, _p, _c) in enumerate(zip(f, p, c)) if _f])
        counts = sum([_p for _f, _p in zip(f, p) if _f])
        if g <= sums:
            ans = min(ans, counts)
            continue
        indices = [i + 1 for i, _f in enumerate(f) if not _f]
        for i in range(1, p[indices[-1]-1]):
            if sums + indices[-1] * i >= g:
                ans = min(ans, counts + i)
                break
    return str(ans)


if __name__ == '__main__':
    n, g = map(int, input().split())
    print(solve('{} {}\n'.format(n, g) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 45916
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    map<string, ll> mp;
    REP(i, n) {
        string s; cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    ll ans = 0;
    for(auto itr : mp) {
        if(itr.second >= 2) {
            ll x = itr.second;
            ans += x * (x-1) / 2;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11136
N,A,B = map(int, input().split())
S = ["*"]+list(input())

finalist = 0
foreigner_student_finalist = 0

for i in range(1,N+1):
    if S[i] == "a":
        if finalist < A+B:
            print("Yes")
            finalist += 1
        else:
            print("No")
    elif S[i] == "b":
        if finalist < A+B and foreigner_student_finalist < B:
            print("Yes")
            finalist += 1
            foreigner_student_finalist += 1
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 10516
#include <stdio.h>

int main(void) {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a < b){
		if(b < c){
			printf("%d %d %d\n", a, b, c);
		}else if(c < a){
			printf("%d %d %d\n", c, a, b);
		}else{
			printf("%d %d %d\n", a, c, b);
		}
	}else if(b < a){
		if(c < b){
			printf("%d %d %d\n", c, b ,a);
		}else if(c > a){
			printf("%d %d %d\n", b, a, c);
		}else{
			printf("%d %d %d\n", b, c, a);
		}
	}
	return 0;
}


Measured memory_bytes: 2072
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 1e5+5;

vector<int > g[N];
int dp[N];

int solve (int n) {
	if (dp[n]) return dp[n];
	for (auto i: g[n]) {
		dp[n] = max(dp[n], 1 + solve(i));
	}
	return dp[n];
}

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif  
    IOS;

    int n, m;
    cin >> n >> m;
	for (int j = 0; j < m; j++) {
		int a, b;
		cin >> a >> b;
		g[a].pb(b);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
    	ans = max(ans, solve(i));
    cout << ans;
    return 0;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

int main(){

    ll n; cin >> n;
    ll in;
    vector<bool> a(n+1, false);
    rep2(i, 1, n+1){
        cin >> in;
        a[i] = !!in;
    }

    ll sum = 0;
    vector<bool> ans(n+1);
    for(ll i=n;i>0;i--){
        bool b = a[i];
        for(ll j=1;j<n+1;j++){
            if(i*j>n) break;
            b ^= ans[i*j];
        }
        ans[i] = b;
        if(b) sum++;
    }

    cout << sum << endl;
    rep2(i, 1, n+1){
        if(ans[i]) cout << i << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define NDEBUG

// for DEBUG {{{
#ifdef NDEBUG
#define DEBUG_PRINT(fmt, ...) ((void)0)
#else
#define DEBUG_PRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
#endif
#define ASSERT_RANGE(min,x,max) assert(((x)>=(min)) && ((x)<=(max)))
// }}}

#define N_MIN 1
#define N_MAX 100

int sort_int(int *a, int N) {// {{{
	int i;
	for (i = 0; i < N-1; i++) {
		int j;
		for (j = i + 1; j < N; j++) {
			if (a[i] > a[j]) {
				int tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
	return 0;
}// }}}
void merge_int(int *a, int *b, int lower, int sep, int upper) {// {{{
	int i_lower = lower;
	int i_upper = sep;
	int i_b = 0;
	while ((i_lower < sep) && (i_upper < upper)) {
		if (a[i_lower] < a[i_upper]) {
			b[i_b++] = a[i_lower++];
		} else {
			b[i_b++] = a[i_upper++];
		}
	}
	if (i_lower >= sep) {
		while (i_upper < upper) {
			b[i_b++] = a[i_upper++];
		}
	} else {
		while (i_lower < sep) {
			b[i_b++] = a[i_lower++];
		}
	}
	for (i_lower = 0; i_lower < i_b; i_lower++) {
		a[i_lower+lower] = b[i_lower];
	}
}// }}}
void merge_sort_int(int *a, int *b, int lower, int upper) {// {{{
	int sep;
	if ((lower == upper) || (lower + 1 == upper)) {
		return;
	}
	sep = (lower + upper) / 2;
	merge_sort_int(a,b,lower,sep);
	merge_sort_int(a,b,sep,upper);
	merge_int(a,b,lower,sep,upper);
}// }}}

int main(int argc, char **argv) {
	int A,B;
	fscanf(stdin,"%d%d",&A,&B);
	ASSERT_RANGE(N_MIN,A,N_MAX);
	ASSERT_RANGE(N_MIN,B,N_MAX);
	int ret = A - B * 2;
	if (ret < 0) {
		fprintf(stdout,"0\n");
	} else {
		fprintf(stdout,"%d\n",ret);
	}
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    int ans = 0;
    for (int l = 0; l < N;) {
        int r = l;
        for (; r < N && A[l] == A[r]; r++) {};
        if (r == N) {
            ans++;
            break;
        }
        if (A[l] > A[r]) {
            for (; r < N - 1 && A[r] >= A[r + 1]; r++) {};
            ans++;
            l = r + 1;
        } else {
            for (; r < N - 1 && A[r] <= A[r + 1]; r++) {};
            ans++;
            l = r + 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();

        int gcd = gcd(a, b);
        List<Integer> divisors = new ArrayList<>();

        for (int i = 1; i <= gcd; i++) {
            if (a % i == 0 && b % i == 0) {
                divisors.add(i);
            }
        }

        if (n == 3) {
            int c = in.nextInt();
            Iterator<Integer> iter = divisors.iterator();
            while (iter.hasNext()) {
                int div = iter.next();
                if (c % div != 0) {
                    iter.remove();
                }
            }
        }

        for (int x : divisors) {
            System.out.println(x);
        }
    }

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

Measured memory_bytes: 26196
(W,H,x,y,r) = input().rstrip().split(' ')
W = int(W)
H = int(H)
x = int(x)
y = int(y)
r = int(r)

if x - r >= 0 and y - r >= 0 and x + r <= W and y + r<= H:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 6724
#include<cstdio>
#define MAX 500000
#define NIL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void Merge(int A[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j])
      A[k]=L[i++];
    else
      A[k]=R[j++];
  }
}


void Sort(int A[],int n,int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    Sort(A,n,left,mid);
    Sort(A,n,mid,right);
    Merge(A,n,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d", &A[i]);
  Sort(A,n,0,n);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");;
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 6608
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long N;

long long solve(long long a, long long b) {
	long long cnt = 0;
	while (a >= 1) {
		cnt += (a / b);
		a /= b;
	}
	return cnt;
}

int main() {
	cin >> N;
	if (N % 2 == 1) {
		cout << "0" << endl;
	}
	else {
		long long A2 = (N / 2) + solve(N / 2, 2);
		long long A5 = solve(N / 2, 5);
		cout << min(A2, A5) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import deque


def solve(h, w, field):
    s = int(field[0][0] == '#')
    q = deque([(s, s, 0, 0)])
    visited = [[[False] * 2 for _ in range(w)] for _ in range(h)]
    while q:
        cost, state, i, j = q.popleft()
        if visited[i][j][state]:
            continue
        visited[i][j][state] = True
        if i == h - 1 and j == w - 1:
            return cost

        for ni, nj in [(i, j + 1), (i + 1, j)]:
            if ni == h or nj == w:
                continue
            nc = int(field[ni][nj] == '#')
            if state == 0 and nc == 1:
                q.append((cost + 1, nc, ni, nj))
            else:
                q.appendleft((cost, nc, ni, nj))


h, w = list(map(int, input().split()))
field = [input() for _ in range(h)]
print(solve(h, w, field))


Measured memory_bytes: 4332
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef long double            ld;
typedef pair<int, int>         pi;
typedef vector<int>            vi;
typedef vector<pair<int, int>> vpi;

#define pb       push_back
#define all(x)   begin(x), end(x)
#define sz(x)    (int)(x).size()
#define ff       first
#define ss       second
#define mp       make_pair
#define lb       lower_bound
#define ub       upper_bound
#define tcase()  int t; cin >> t; while(t--)

const int MOD = 1e9 + 7; // 998244353;
const int MX  = 2e5 + 5;
const ll  INF = 1e18;
const ld  PI  = acos((ld) -1);

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main(){

    setIO();

    ll n, k;
    cin >> n >> k;

    ll Ans = 0LL;

    for(ll i = k; i < n + 2LL; i++){

        Ans += (n * i) - (i * i) + i + 1;
        Ans %= MOD;
        Ans = (Ans + MOD) % MOD;
    }

    cout << Ans;
}


Measured memory_bytes: 3608
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main() {
    int n,k;
    while(cin>>n>>k){
        if(n==0 && k==0)break;
        
        int s[200]={};
        rep(i,k){
            cin>>s[i];
        }
        rep(i,n){
            rep(j,k){
                int a;
                cin>>a;
                s[j]-=a;
            }
        }
        rep(i,k){
            if(s[i]<0){
                cout<<"No"<<endl;
                goto next;
            }
        }
        cout<<"Yes"<<endl;
        next:;
        
    }
    return 0;
}

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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define ll long long
#define in freopen(".in", "r", stdin)
#define out freopen(".out", "r", stdout)

using namespace std;

const long long INF = (int)1e17 + 7;

int ar[100009];
int main()
{
    int n, a, mx = -1;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (a != 0)
        ar[a - 1]++;
        ar[a + 1]++;
        ar[a]++;
    }
    for (int i = 0; i < ((int)1e5 + 2); i++)
    {
        mx = max(mx, ar[i]);
    }
    cout << mx;
}




Measured memory_bytes: 640
num = list(map(int,input().split()))

count = 0

if num[0] == num[1]:
  count = count + 1

if num[1] == num[2]:
  count = count + 1

if num[2] == num[0]:
  count = count + 1

if count == 1:
  ans = "Yes"
elif count == 0 or count == 3:
  ans = "No"

print(ans)

Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


int main(){
  ll A, B; cin >> A >> B;
  ll now = B / A, cnt = 0;

  while (now >= 1){
    now /= 2;
    cnt++;
  }
  cout << cnt << endl;
  
  return 0;
}


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

struct A{
    int a,b,c,d;
}a[50];

int n,m,q;
int value,m_value;

vector <int> v;

void go(int x){
    if(v.size()  == n){
        value = 0;

        for(int i = 0;i < q;i ++){
            if(v[a[i].b - 1] - v[a[i].a - 1] == a[i].c){
                value += a[i].d;
            }
        }
        if(value > m_value){
            m_value = value;
        }


    }else{
        for(int i = x;i <= m;i ++){
        v.push_back(i);
        go(i);
        v.pop_back();
        }
    }
}


int main()
{
    cin >> n >> m >> q;

    m_value = 0;

    for(int i = 0;i < q;i ++){
        cin >> a[i].a >> a[i].b >> a[i].c >> a[i].d ;
    }

    go(1);

    cout << m_value << endl;




    



    return 0;
    

}

Measured memory_bytes: 3172
fn main(){
    let n:i32 = getline().trim().parse().unwrap();
    let mut best = 1;
    for x in 2..n {
        for y in 2..n {
            let z = x.pow(y as u32);
            if z > n { break; }
            if best < z { best = z; }
        }
    }
    println!("{}", best);
}

fn getline() -> String{
    let mut r = String::new();
    std::io::stdin().read_line(&mut r).ok();
    return r;
}


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

void fnInput(llong& rnNumber)
{
  cin >> rnNumber;
}

llong fnMinStepGet(llong nNumber)
{
  int nSqrtInt = sqrt(nNumber);
  int nMultpler;
  llong nMultplcand;

  for (int n = 1; n <= nSqrtInt; n++)
    if (nNumber % n == 0)
    {
      nMultpler = n;
      nMultplcand = nNumber / n;
    }

  return (nMultplcand + nMultpler - 2);
}

int main()
{
  llong nNumber;

  fnInput(nNumber);
  cout << fnMinStepGet(nNumber) << endl;

  return 0;
}

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

using namespace std;


int p, q, a, n;
double EPS = 1e-9;

int solve(double sum, int mul, int prev, int num) {
	if (num > n) return 0;
	
	if (fabs(sum - (double)p/(double)q) < EPS) return 1;
	if (sum > (double)p/(double)q) return 0;
	
	int ret = 0;
	for (int i=prev; mul*i<=a; i++) {
		ret += solve(sum + 1.0/(double)i, mul * i, i, num + 1);
	}
	return ret;
}

int main() {
	while (1) {
		cin >> p >> q >> a >> n; if (p==0 && q==0 && a==0 && n==0) break;
		
		cout << solve(0.0, 1, 1, 0) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;


//超解説AC

int main(){
    while(1){

    int n, m, p, a, b;
    cin >> n >> m >> p >> a >> b;
    if(n == 0 && m == 0 && p == 0 && a == 0 && b == 0) return 0;
    a--; b--;

    vector<int> t(n); rep(i,n) cin >> t[i];
    vector<vector<int>> g(m, vector<int> (m,1002003004));

    rep(i,p){
        int x, y, z; cin >> x >> y >> z;
        x--; y--;

        g[x][y] = z;
        g[y][x] = z;
    }

    sort(all(t));
    //(距離, {今いる頂点, 使った切符の状態})
    using Q = pair<double, pair< int, int>>;   
    priority_queue<Q ,vector<Q>,greater<Q>> que;

    vector<vector<double>> dp(m, vector<double>((1 << n), 100000.0));

    que.push (Q(0, { a, 0}));

    dp[a][0] = 0.0;
    //Dijkstra
    while(!que.empty()){
        //まずはヒープの先頭の要素をとる
        auto e = que.top(); que.pop();

        //それぞれのパラメータを取得
        double dist = e.first;
        int v = e.second.first;
        int kip = e.second.second;

        //次に行く頂点の距離が最小じゃなかったら論の外
        if(dist > dp[v][kip]) continue;


        for(int i=0; i<n; i++){
            if((kip >> i) & 1) continue;

            int nextkip = (kip | (1 << i));
            for(int j = 0; j < m; j++){

                if(g[v][j] == 1002003004) continue;

                if(dist + g[v][j]/(double)t[i] < dp[j][nextkip]){
                dp[j][nextkip] = dist + g[v][j]/(double)t[i];
                que.push(Q((dist + (g[v][j]/(double)t[i]) ) , {j, nextkip}));
                }
            }
        }
    }

    double ans = 100000.0;

    rep(i,(1<<n)){
        ans = min(ans,dp[b][i]);
    }

    if(ans/1 > 90000.0) cout << "Impossible" << endl;
    else cout << ans << endl;
    }

}






Measured memory_bytes: 4580
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define For(i,x,y) for(int i = x; i <= y; ++i)
#define FOR For
#define rev_For(i,x,y) for(int i = x; i >= y; --i)
#define REV_FOR rev_For
#define ll long long
#define Size(v) ((int)v.size())
#define _section "\n--------------------\n"
#define fi first
#define se second
#define pb push_back
using namespace std;
// using namespace __gnu_pbds;


int n, m;
vector<vector<int>> adjlist;
const int nax= 1e5 + 5;
int dp[nax];

void input() {
	cin >> n >> m;
	adjlist.resize(n + 1);
	FOR (i, 1, m) {
		int u, v;
		cin >> u >> v;
		adjlist[v].pb(u);
	}

	FOR (i, 1, n) dp[i] = -1;
}

int calc(int i) {
	if (dp[i] != -1) return dp[i];

	int ret = 0;

	for (auto & c : adjlist[i]) {
		ret = max(ret, calc(c) + 1);
	}

	return (dp[i] = ret);
}

void solve() {
	int ans = 0;
	
	FOR (i, 1, n) ans = max(ans, calc(i));

	cout << ans;
}

signed main() {
#ifdef _DEBUG
	// freopen("INPUT.inp", "r", stdin);
	//freopen("OUTPUT.out", "w", stdout);
	clock_t start, end;
	start = clock();
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------------------------------------------
//----------------------------------MAIN PROGRAM--------------------------------------
	int t = 1;
	while (t--) {
		input();
		solve();
	}
//--------------------------------------END-------------------------------------------
//------------------------------------------------------------------------------------
#ifdef _DEBUG
	end = clock();
	cerr << "\n----------\nTime Elapsed: " << fixed << double(end - start) / double(CLOCKS_PER_SEC) << setprecision(6) << '\n';
#endif
	return 0;
}

Measured memory_bytes: 10624
#include <iostream>
#include <cstdlib>
#include <cstring>

using namespace std;

char s[101],ch;
int n,tested[100],minn=0x7f7f7f7f,a,b,c,m;

int main() {
	int i,j;
    cin>>s;
    n=strlen(s);
    for (i=0;s[i];++i) {
    	if (tested[i]) continue;
    	ch=s[i];
    	tested[i]=1;
    	m=-0x7f7f7f7f;
    	a=0;
    	b=i;
    	while (b<n) {
    		for (c=b+1;s[c]==s[b];++c) tested[c]=1;
    		if (c<n) {
    			m=max(m,b-a);
    			if (max(m,n-c)<minn) minn=max(m,n-c);
    		}
    		for (b=c+1;b<n&&s[b]!=ch;++b);
    		if (b<n) {
    			tested[b]=1;
    			a=c;
    		}
    	}
    }
    if (minn==0x7f7f7f7f) minn=0;
    cout<<minn;
    return 0;
}

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


Measured memory_bytes: 1728
def solve():
    from sys import stdin
    f_i = stdin
    
    N = int(f_i.readline())
    
    points = []
    for i in range(N):
        x, y = map(int, f_i.readline().split())
        points.append(x + y * 1j)
    
    from itertools import combinations
    radiuses = []
    
    for p1, p2 in combinations(points, 2):
        c = (p1 + p2) / 2
        r = abs(p1 - c)
        for p in points:
            if abs(p - c) > r:
                break
        else:
            radiuses.append(r)
    
    if radiuses:
        return min(radiuses)
    
    def circumcircle(a, b, c):
        n = (a - b) * abs(c) ** 2 + (b - c) * abs(a) ** 2 + (c - a) * abs(b) ** 2
        d = (a - b) * c.conjugate() + (b - c) * a.conjugate() + (c - a) * b.conjugate()
        return n / d # center of circumcircle
    
    err = 10 ** -7
    for p1, p2, p3 in combinations(points, 3):
        z1 = p3 - p1
        z2 = p2 - p1
        if z1.real * z2.imag == z1.imag * z2.real:
            continue
        
        c = circumcircle(p1, p2, p3)
        r = abs(p1 - c)
        for p in points:
            #if abs(p - c) > r:
            if abs(p - c) - r > err:
                break
        else:
            radiuses.append(r)
    
    return min(radiuses)

print(solve())

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

int main() {
  string S;
  get(S);
  int N = S.size();
  ll dp[13] = {}, newdp[13] = {};
  dp[0] = 1;
  ll bias = 1;
  for (int i = N - 1; i >= 0; --i) {
    FOR(j, 13) newdp[j] = 0;
    if (S[i] == '?') {
      for (int j = 0; j <= 9; ++j) {
        for (int m = 0; m < 13; ++m) {
          newdp[(m + j * bias + 13000) % 13] =
              (newdp[(m + j * bias + 13000) % 13] + dp[m]) % MOD;
        }
      }
    } else {
      for (int m = 0; m < 13; ++m) {
        newdp[(m + (S[i] - '0') * bias + 13000) % 13] =
            (newdp[(m + (S[i] - '0') * bias + 13000) % 13] + dp[m]) % MOD;
      }
    }
    bias *= 10;
    if (bias == 1000) {
      bias = -1;
    } else if (bias == -1000) {
      bias = 1;
    }
    FOR(j, 13) {
      dp[j] = newdp[j];
      // debug(j, dp[j]);
    }
    // debug(dp, newdp, bias);
  }
  print(dp[5]);
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstdlib>
#include<cctype> 
#include<deque>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>P;
const int INF=0x3f3f3f3f;
const int len=1e5+4;
const ll mod=1e9+7;
const ull seed=131;
int n,arr[len];
int num1[len],num2[len];
int main()
{
	cin>>n;
	int t;
	for(int i=0;i<n;++i)
	{
		scanf("%d",&t);
		if(i%2==0)num1[t]++;
		else num2[t]++;
	}
	int a=0,a1,b=0,b1;
	int c=0,c1,d=0,d1;
	for(int i=1;i<=1e5;++i)
	{
		if(num1[i]>a)
		{
			a1=i;
			a=num1[i];
		}
		if(num2[i]>b)
		{
			b1=i;
			b=num2[i];
		}
	}
	num1[a1]=0;num2[b1]=0;
	for(int i=1;i<=1e5;++i)
	{
		if(num1[i]>c)
		{
			c1=i;
			c=num1[i];
		}
		if(num2[i]>d)
		{
			d1=i;
			d=num2[i];
		}
	}
	if(a1!=b1)cout<<n-a-b<<endl;
	else cout<<min(n-a-d,n-b-c)<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int n;
int main(){
	int n;cin>>n;
	int i;
	for(i=0;i*i<=n;++i);
	cout<<(i-1)*(i-1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long n,m;
    cin>>n>>m;
    if (n==1&&m==1)
        cout<<"1"<<endl;
    else if ((n==1&&m==3)||(n==3&&m==1))
        cout<<"1"<<endl;
    else if (n==1)
        cout<<m-2<<endl;
    else if (m==1)
        cout<<n-2<<endl;
    else
    {
        long long sum=0;
        sum=(n-2)*(m-2);
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	
	string s;
	cin >> s;
	vector<int> cnt(4);

	rep(i, s.size()){
		if(s[i] == 'K') cnt[0]++;
		if(s[i] == 'U') cnt[1]++;
		if(s[i] == 'P') cnt[2]++;
		if(s[i] == 'C') cnt[3]++;
	}
	
	cout << *min_element(cnt.begin(), cnt.end()) << endl;
	

	return 0;
}

Measured memory_bytes: 3172
class UnionFind:
    parent = []
    def __init__(self, n = 1):
        self.parent = [-1] * n

    def root(self, x):
        if self.parent[x] < 0:
            return x
        return self.root(self.parent[x])

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)

        if rx == ry:
            return

        if self.parent[rx] > self.parent[ry]:
            rx, ry = ry, rx
        self.parent[rx] += self.parent[ry]
        self.parent[ry] = rx
    
    def same(self, x, y):
        return self.root(x) == self.root(y)
    
    def size(self, x):
        return -self.parent[self.root(x)]

n, m = map(int, input().split())

uf = UnionFind(n)

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.unite(a,b)

ans = -1
for i in range(n):
    ans = max(ans, uf.size(i))

print(ans)

Measured memory_bytes: 14740
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
vvv = list(sorted(get_nums_l()))

ans = reduce(lambda a,b:(a+b)/2, vvv)
print(ans)

Measured memory_bytes: 38256
import collections
import sys
input=sys.stdin.readline

def calc():
  h,w,k=map(int,input().split())
  sy,sx,gy,gx=map(int,input().split())
  sy,sx,gy,gx=sy-1,sx-1,gy-1,gx-1
  board=[input() for _ in range(h)]
  q=collections.deque()
  q.append((sx,sy))
  cost=[[10**18]*w for _ in range(h)]
  cost[sy][sx]=0
  while len(q)!=0:
    x,y=q.popleft()
    c=cost[y][x]
    for i in range(1,k+1):
      if x+i<w and board[y][x+i]=='.' and c<cost[y][x+i]:
        if cost[y][x+i]>c+1:
          cost[y][x+i]=c+1
          q.append((x+i,y))
      else:
        break
    for i in range(1,k+1):
      if x-i>=0 and board[y][x-i]=='.' and c<cost[y][x-i]:
        if cost[y][x-i]>c+1:
          cost[y][x-i]=c+1
          q.append((x-i,y))
      else:
        break
    for i in range(1,k+1):
      if y+i<h and board[y+i][x]=='.' and c<cost[y+i][x]:
        if cost[y+i][x]>c+1:
          cost[y+i][x]=c+1
          q.append((x,y+i))
      else:
        break
    for i in range(1,k+1):
      if y-i>=0 and board[y-i][x]=='.' and c<cost[y-i][x]:
        if cost[y-i][x]>c+1:
          cost[y-i][x]=c+1
          q.append((x,y-i))
      else:
        break
  if cost[gy][gx]==10**18:
    print(-1)
  else:
    print(cost[gy][gx])
calc()

Measured memory_bytes: 98968
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = 0
for i in range(n):
  norma = a[i] + a[i + 1]
  if b[i] > norma:
    cnt += norma
    a[i] = a[i + 1] = 0
  else:
    cnt += b[i]
    if a[i] > b[i]:
      a[i] -= b[i]
    else:
      a[i + 1] -= b[i] - a[i]
      a[i] = 0

print(cnt)

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

int n;
long double prob[3002];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	prob[0] = 1;
	cin>>n;
	for(int i=1;i<=n;i++){
		long double p;
		cin>>p;
		for(int j=n;j>0;j--){
			prob[j] = prob[j]*(1-p) + prob[j-1]*p;
		}
		prob[0] *= (1-p);
	}
	long double ans = 0.0;
	for(int i=n/2+1;i<=n;i++){
		ans += prob[i];
	}
	cout<<setprecision(12);
	cout<<ans;
	return 0;
}


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


int calc_sat(int D, int N, vector<int> c, vector<vector<int>> s, vector<int> t) {
	vector<int> last(N,-1);
	int sat = 0;  // 満足度
	rep(d,D) {
		last[t[d]] = d;
		sat += s[d][t[d]];
		rep(i,N) {
			sat -= c[i] * (d-last[i]);
		}
		//printf("%d\n", sat);
	}
	return sat;
}

int main() {
	int D;
	cin >> D;
	const int N = 26; // コンテストの種類
	vector<int> c(N);
	rep(i,N) cin >> c[i];
	vector<vector<int>> s(D, vector<int>(N));
	rep(i,D) rep(j,N) cin >> s[i][j];
	vector<int> t(D);
	rep(i,D) {
		cin >> t[i];
		t[i]--;
	}

	int M;
	cin >> M;
	vector<int> d(M), q(M);
	rep(i,M) {
		cin >> d[i] >> q[i];
		d[i]--;
		q[i]--;
	}

	rep(i,M) {
		t[d[i]] = q[i];
		int sat = calc_sat(D, N, c, s, t);
		printf("%d\n", sat);
	}

	return 0;
}


Measured memory_bytes: 3920
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
       Scanner scan = new Scanner(System.in);
       int N = scan.nextInt();
       int count = 0;
       String m = "A";
       String str = scan.next();
       for(int i = 0;i<N-2;i++){
           if(str.substring(i,i+3).equals("ABC")){
               ++count;
           }
       }
       System.out.println(count);
    }
    
}

Measured memory_bytes: 22868
n = int(input())
s = input()
cnt_l, cnt_r = 0, 0

for x in s:
	if x == "(":
		cnt_l += 1
	elif cnt_l > 0:
		cnt_l -= 1

for x in s[::-1]:
	if x == ")":
		cnt_r += 1
	elif cnt_r > 0:
		cnt_r -= 1

print(cnt_r * "(" + s + cnt_l * ")")


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

struct Problem {

    void Solve() {

        ULL X; cin >> X;
        ULL N = 100;
        UL ans = 0;
        while (N < X) {
            ans++;
            N += N / 100;
        }
        cout << ans << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    p->Solve();
    return 0;
}


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


int main(void){
    string s;
    cin >> s;
    int mn=10000;
    rep(i,s.length()-2){
        int num = stoi(s.substr(i, 3));
        mn = min(mn,abs(753-num));
    }
    cout << mn <<endl;
    
    return 0;
}











































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

int main(){
int n,m,res1=0,res2=0;
cin>>n>>m;
if(n>=2)
    res1=(n-1)*n/2;
if(m>=2)
    res2=(m-1)*m/2;
cout<<res1+res2<<endl;
return 0;
}


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

int n, q;

int LinerSearch(int a[], int b[]) {
	int cnt = 0;
	for (int i = 0;i < q;i++) {
		for (int j = 0;j < n;j++) {
			if (b[i] == a[j]) {
				cnt++;
				break;
			}
		}
	}
	return cnt;
}

int main() {
	int S[10004], T[502];
	cin >> n;
	for (int i = 0;i <= n - 1;i++) {
		cin >> S[i];
	}

	cin >> q;
	for (int i = 0;i <= q - 1;i++) {
		cin >> T[i];
	}

	cout << LinerSearch(S, T) << endl;

	return 0;
}

Measured memory_bytes: 3088
import fractions
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

a,b = MAP()

print(a*b//fractions.gcd(a,b))

Measured memory_bytes: 5076
k=int(input())
a,b,c=['1','2','3','4','5','6','7','8','9'],[],[]
for i in range(10):
    c.extend(a)
    for j in range(len(a)):
        if int(a[j])>323456666:
            continue
        if a[j][-1]!='0':
            b.append(a[j]+str(int(a[j][-1])-1))
        b.append(a[j]+a[j][-1])
        if a[j][-1]!='9':
            b.append(a[j]+str(int(a[j][-1])+1))
    a=b
    b=[]
c.extend(a)
print(sorted(list(map(int,c)))[k-1])

Measured memory_bytes: 15484
#include<iostream>
#include<cstdio> 
#include<map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int maxn = 40;
const int magic = 12311;



int n ;;
bool col[maxn];
char str[maxn];
ull pow[maxn], a[maxn] ;
ll ans;


map<ull,int> mid;

void calc(){
	ull x = 0,y = 0;
	int p = n,q = 1;
	for(int i = n * 2;i > n;i--){
		if(col[i]){
			y += a[i] * pow[q],q++;	
		} else {
			x += a[i] * pow[p],p--;
		}
	}
	ans += mid[y - x];
}

void check(){
	ull x = 0,y = 0;
	int p = 1,q = n;
	for(int i = 1;i <= n;i++){
		if(!col[i]) {
			x += a[i] * pow[p],p++; 
		}	else {
			y += a[i] * pow[q],q--;
		}
	}
	mid[x - y]++;
}

void dfs1(int x){ 
	if(x > n) {
		check();
		return ;
	}
	col[x] = 0;
	dfs1(x + 1);
	col[x] = 1;
	dfs1(x + 1);
}

void dfs2(int x){
	if(x > n * 2){
		calc();
		return ;
	}
	col[x] = 0;
	dfs2(x + 1);
	col[x] = 1;
	dfs2(x + 1);
}

int main(){
	scanf("%d%s",&n,str + 1);
	for(int i = 1;i <= n * 2;i++) a[i] = str[i] - 'a' + 1;
	pow[0] = 1;
	for(int i = 1;i <= n * 2;i++) pow[i] = pow[i - 1] * magic;
	dfs1(1);
	dfs2(n + 1);
	return !printf("%lld\n",ans);
}


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

int main(){
    int n, l, i;
    cin >> n >> l;
    string s[n];
    for(i=0; i<n; i++){
        cin >> s[i];
    }
    sort(s, s+n);
    for(i=0; i<n; i++){
        cout << s[i];
    }
    return 0;
}

Measured memory_bytes: 256
INF = 10000000000


def merge(A, left, mid, right):
    global count
    L = A[left:mid] + [INF]
    R = A[mid:right] + [INF]
    i, j = 0, 0
    for k in range(left, right):
        count += 1
        if L[i] < R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1


def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)


if __name__ == "__main__":
    global count
    count = 0
    input()
    A = [int(x) for x in input().split()]
    mergeSort(A, 0, len(A))
    print(' '.join(map(str, A)))
    print(count)



Measured memory_bytes: 66776
#include<iostream>
using namespace std;
int main(){
	int i,j,H,W;
	for(;;){
		cin>>H>>W;
		if(H==0&&W==0){
		break;
		}
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			cout<<"#";
		}
		cout<<endl;
	}
	cout<<endl;
	}
return 0;
}

Measured memory_bytes: 3084
# -*- coding: utf-8 -*-

n, m = map(int, input().split())

stairs = [i for i in range(1, n+1)]
a = [0 for _ in range(m)]
for i in range(m):
  a[i] = int(input())
a = set(a)
  
mod = 10**9+7
dp = [0] * (n+1)
dp[0] = 1

#print(test_a)
for i in range(1, n+1):
    if i in a:
        continue
    dp[i] = dp[i] + dp[i-1]
    if i > 1:
        dp[i] = dp[i] + dp[i-2]

#print(dp)
print(dp[-1]%mod)


Measured memory_bytes: 469580
#include<iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>

using namespace std;

int main(void)
{
	int H, W;
	cin >> H >> W;
	vector<vector<char>> s(H, vector<char>(W));
	int white = 0;
	int black = 0;
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			cin >> s[i][j];
			if (s[i][j] == '.')	white++;
			else black++;
		}
	}

	queue<pair<int, int>> qp;
	queue<int> qcnt;
	vector<vector<bool>> arrmap(H, vector<bool>(W, true));
	int i = 0, j = 0;
	int cnt = 0;

	
	while (1){
		if (i == H - 1 && j == W - 1){
			break;
		}
		
		if (i > 0 && s[i - 1][j] == '.' && arrmap[i - 1][j]){
			pair<int, int> p;
			p.first = i - 1;
			p.second = j;
			qp.push(p);
			arrmap[i - 1][j] = false;
			qcnt.push(cnt + 1);
		}
		if (i < H - 1 && s[i + 1][j] == '.' && arrmap[i + 1][j]){
			pair<int, int> p;
			p.first = i + 1;
			p.second = j;
			qp.push(p);
			arrmap[i + 1][j] = false;
			qcnt.push(cnt + 1);
		}
		if (j < W - 1 && s[i][j + 1] == '.' && arrmap[i][j + 1]){
			pair<int, int> p;
			p.first = i;
			p.second = j + 1;
			qp.push(p);
			arrmap[i][j + 1] = false;
			qcnt.push(cnt + 1);
		}
		if (j > 0 && s[i][j - 1] == '.' && arrmap[i][j - 1]){
			pair<int, int> p;
			p.first = i;
			p.second = j - 1;
			qp.push(p);
			arrmap[i][j - 1] = false;
			qcnt.push(cnt + 1);
		}
		if (qp.empty()){
			cout << -1 << endl;
			return 0;
		}
		pair<int, int> ij;
		ij = qp.front();
		qp.pop();
		i = ij.first;
		j = ij.second;
		cnt = qcnt.front();
		qcnt.pop();
	}

	cout << white - cnt - 1 << endl;
	return 0;
}

Measured memory_bytes: 256
num_list=int(input())
a=[0,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Measured memory_bytes: 3064
from itertools import product
n = int(input())
ans = 0
for i in range(1, len(str(n))+1):
    for x in product('357', repeat=i):
        flag = True
        for p in '357':
            if not p in x:
                flag = False
                break
        if flag:
            if int("".join(x)) <= n:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define MOD 1000000007
#define md 998244353
#define INF LLONG_MAX
#define F first
#define S second
#define sz(x) (long long)x.size()
#define vi vector<int>
#define vll vector<long long>
#define vpl vector<pair<long long,long long> >
#define vpi vector<pair<int,int> >
#define pb push_back
#define debug(x) cerr<<#x<<"= "<<x<<endl
#define all(v) v.begin(),v.end()
#define TT ll test;cin>>test; while(test--)
#define rep(i,a,n) for(ll i=a;i<(long long)n;++i)
#define repr(i,n,a) for(ll i=n;i>(long long)a;--i)
#define endl '\n'
#define MAXN 200005
typedef long long ll;
typedef long double ld;
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll m,n;
    cin>>m>>n;
    vll a(n);
    ll sum=0;
    rep(i,0,n){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>m){
        cout<<-1;
    }else{
        cout<<m-sum;
    }



    return 0;
}

Measured memory_bytes: 3724