akhauriyash/Code-Regression huggingface dataset:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    K = I()
    A, B = MI()

    for i in range(A, B+1):
        if i % K == 0:
            print('OK')
            return

    print('NG')


if __name__ == '__main__':
    main()


Measured memory_bytes: 74476
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll n, m; cin >> n >> m;
  const ll MAX = 100000;
  map<ll, ll> map;
  rep(i, n) {
    ll ai; cin >> ai;
    if (map.find(ai) == map.end()) map.insert(make_pair(ai, 1));
    else map[ai]++;
  }
  rep(i, m) {
    ll bi, ci; cin >> bi >> ci;
    if (map.find(ci) == map.end()) map.insert(make_pair(ci, bi));
    else map[ci] += bi;
  }

  vector<ll> v(map.size());
  int vi = 0;
  for (auto it : map) v[vi++] = it.first;
  sort(v); reverse(v);

  ll ans = 0, cnt = 0;
  for (int i = 0; i < v.size() && cnt < n; i++) {
    // debug2(v[i], map[v[i]]);
    ll d = min(map[v[i]], n - cnt);
    ans += v[i] * d;
    cnt += d;
  }
  outl(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

#define MAX_STR_LEN 102

int CheckBracket(char *bracketStr, int *bracketStrIdx, char inputStr);

int main()
{
	char inputStr[MAX_STR_LEN]   = {'\0'};		// Array for input string
	int  inputStrLen = 0;						// Length of input string
	char bracketStr[MAX_STR_LEN] = {'\0'};		// Array for keep left-bracket
	int  bracketStrIdx = 0;						// Index of "bracketStr"
	char compareBracket = '\0';					// Valiable of select bracket to compare
	int  falseFlg = 0;							// Flag of sign false
	int  i = 0;									// Loop valiable
	
	do{
		// Initialize parameter.
		for(i = 0; i < MAX_STR_LEN; i++)
		{
			inputStr[i]    = '\0';
			bracketStr[i]  = '\0';
		}
		bracketStrIdx  = 0;
		compareBracket = '\0';
		falseFlg       = 0;
		
		// Input string.
//		printf("Input string >> ");
		fgets(inputStr, MAX_STR_LEN, stdin);
//		puts(inputStr);
		inputStrLen = strlen(inputStr);
		
		// If input string is '.' only, end.
		if('.' == inputStr[0])
		{
			break;
		}
		
		// Check to match bracket.
		for(i = 0; i < inputStrLen; i++)
		{
			switch(inputStr[i])
			{
			// If inputStr[i] is left-bracket, connect to "bracketStr".
			case '(':
			case '[':
				bracketStr[bracketStrIdx] = inputStr[i];
				bracketStrIdx++;
				break;
				
			// If inputStr[i] is right-bracket, Check to match bracket.
			case ')':
			case ']':
				falseFlg = CheckBracket(bracketStr, &bracketStrIdx, inputStr[i]);
				break;
				
			case '.':
				// If bracketStr is not empty, falseFlg is 1.
				if(0 != bracketStrIdx)
				{
					falseFlg = 1;
				}
				break;
			default:
				break;
			}
			
			if(1 == falseFlg)
			{
				break;
			}
		}
		
		// Disp result.
		if(0 == falseFlg)
		{
			printf("yes\n");
		}
		else
		{
			printf("no\n");
		}
	}while(1);
	
	return 0;
}

// CheckBracket
// Function  : Check to match bracket.
// Param[in] : char *bracketStr, int *bracketStrIdx, char inputStr
// Param[out]: 0(true) or 1(false)
// Global    : 
int CheckBracket(char *bracketStr, int *bracketStrIdx, char inputStr)
{
	char compareBracket = '\0';
	
	// If left-bracket is empty, falseFlg is 1.
	if(0 == *bracketStrIdx)
	{
		return 1;
	}
	
	// Select the compare bracket.
	if(')' == inputStr)
	{
		compareBracket = '(';
	}
	else
	{
		compareBracket = '[';
	}
	
	// Check to match bracket.
	if(compareBracket == bracketStr[(*bracketStrIdx) - 1])
	{
		bracketStr[(*bracketStrIdx) - 1] = '\0';
		(*bracketStrIdx)--;
	}
	else
	{
		return 1;
	}
	
	return 0;
}



Measured memory_bytes: 2520
N, M = [int(x) for x in input().split()]
XYZ = [[int(x) for x in input().split()] for _ in range(N)]

ans = -float("inf")

for i in range(2 ** 3):
    hugo = [1, 1, 1]
    for j in range(3):
        if i >> j & 1 != 1:
            hugo[j] = -1

    A = []
    for x, y, z in XYZ:
        A.append(x * hugo[0] + y * hugo[1] + z * hugo[2])

    A.sort(reverse=True)
    ans = max(ans, sum(A[:M]))

print(ans)




Measured memory_bytes: 3316
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int KCF(int x,int y,int k)
{
    int small=min(x,y);
    int cnt=0;
    for(int i=1; i<=small; i++)
    {
        if(x%i==0 && y%i==0)
            cnt++;
        if(cnt==k)
            return i;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x,y,k;
    cin>>x>>y>>k;
   int sml=min(x,y);
   vector<int>v;
   int i;
   for(i=1;i<=sml;i++)
   {
       if(x%i==0 && y%i==0)
        v.push_back(i);
   }
   sort(v.rbegin(),v.rend());
 /*  for(vector<int>::iterator it =v.begin();it!=v.end();it++)
   {
       cout<< *it<< " ";
   }
   cout<<endl;
   */
   cout<< v[k-1] << "\n";
    return 0;
}



Measured memory_bytes: 256
result = []
loop do
  a,b,c = gets.split().map(&:to_i)
  break if a == -1 && b == -1 && c == -1
  if a == -1 || b == -1
    result << "F"
  elsif a + b >= 80
    result << "A"
  elsif a + b >= 65
    result << "B"
  elsif a + b >= 50
    result << "C"
  elsif a + b >= 30
    if c >= 50
      result << "C"
    else
      result << "D"
    end
  else
    result << "F"
  end
end
  
puts result


Measured memory_bytes: 6868
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath> 
#include <queue>
#include <functional>

typedef long long ll;
using namespace std;

int main() {

    string S;
    cin >> S;
    string non_x;
    int size_S = S.size();
    int ind_non_x = 0;
    vector<int> cnt_x;
    int temp = 0;
    for (int i = 0; i < size_S; i++) {
        if (S[i] != 'x') {
            non_x.push_back(S[i]);
            cnt_x.push_back(temp);
            ind_non_x++;
            temp = 0;
        }
        else {
            temp++;
        }
    }

    cnt_x.push_back(temp);

    bool isPalindrome = true;
    int size_non_x = non_x.size();
    for (int i = 0; i < size_non_x / 2; i++) {
        if (non_x[i] != non_x[size_non_x - i - 1]) isPalindrome = false;
    }

    if (!isPalindrome) {
        cout << -1 << '\n';
        return 0;
    }
    
    int ans = 0;
    int size_cnt_x = cnt_x.size();
    for (int i = 0; i < size_cnt_x / 2; i++) {
        ans += abs(cnt_x[i] - cnt_x[size_cnt_x - 1 - i]);
    }
    cout << ans << '\n';

}


Measured memory_bytes: 1148
#include<iostream>

using namespace std;

int main() {
	int x, y, z;
	cin >> x;
	cin >> y;
	cin >> z;
	if (x < y && y < z) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ll long long
#define P pair<int ,int>
using namespace std;

struct edge{
    ll to ,cost;
};
int main(){
    int n;
    cin >> n;
    vector<vector<edge>> g(n);
    for(int i=0;i<(n-1);i++){
        ll u,v,w;
        cin >> u >> v >> w;
        u--;v--;
        g[u].push_back(edge{v ,w});
        g[v].push_back(edge{u ,w});
    }
    vector<int> color(n ,-1);
    color[0] = 0;

    queue<edge> que;
    que.push(edge{0 ,0});
    
    while(!que.empty()){
        edge e = que.front();
        que.pop();
        for(int i=0;i < (int)g[e.to].size() ;i++){
            ll nt = g[e.to][i].to ,nc = g[e.to][i].cost;
            if(color[nt] != -1) continue;
            if(nc%2 == 0) color[nt] = color[e.to];
            else {
                if(color[e.to] == 0) color[nt] = 1;
                else color[nt] = 0;
            }
            que.push(g[e.to][i]);
        }
    }

    for(int i=0;i<n;i++) cout << color[i] << endl;
}

Measured memory_bytes: 8320
import sys

S = list(input())

N = len(S)-1

#bit全探索
for i in range(2**N):
    op = ["+"]*N
    for j in range(N):
        if (i>>j)&1:
            op[j] = "-"
    ans = ""
    for j in range(N):
        ans = ans + S[j] + op[j]

    ans = ans + S[j+1]

    if eval(ans)==7:
        print(ans+"=7")
        sys.exit()


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int a[100];

int main()
{
	int N, ans = 0, avg = 0, diff = 1000000;

	cin >> N;
	rep(i, N) cin >> a[i];

	rep(i, N) {
		avg += a[i];
		a[i] *= N;
	}

	rep(i, N) {
		if (abs(a[i] - avg) < diff) {
			ans = i;
			diff = abs(a[i] - avg);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

const int N = 1e5 + 5;
int n, m, a[N], b[N];
vector<int> g[N];

int main() {
  cin >> n >> m;
  FI(i,1,n) scanf("%d%d", &a[i], &b[i]);
  FI(i,1,n) {
    if (a[i] > m) continue;
    g[m - a[i] + 1].push_back(i);
  }
  FI(i,1,m) sort(g[i].begin(), g[i].end(), [&](int x, int y) { return b[x] > b[y]; });
  int ans = 0;
  multiset<int> se;

  for (int i = 1; i <= m; i++) {
    for (auto j: g[i]) {
      se.insert(b[j]);
      ans += b[j];
      if (se.size() > i) {
        ans -= *se.begin();
        se.erase(se.begin());
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 10880
def solve(a, b, c):
    if c - a - b <= 0:
        return False
    return (4 * a * b) < ((c - a - b) ** 2)

assert solve(2, 3, 9) == False
assert solve(2, 3, 10) == True
assert solve(1, 1, 2) == False
assert solve(1, 1, 4) == False
assert solve(1, 1, 5) == True
assert solve(10 ** 9, 10 ** 9, 10 ** 9) == False
assert solve(4, 5, 16) == False

(a, b, c) = map(int, raw_input().split())
print 'Yes' if solve(a, b, c) else 'No'


Measured memory_bytes: 28396
n, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
    if a[i] <= x:
        x -= a[i]
        ans += 1
    else:
        x = 0
        break
if not x == 0:
    ans -= 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;


int main(){
  int k,t;
  cin >> k >> t;
  int mx = 0;
  rep(i,k){
    int a;
    cin >> a;
    mx = max(mx,a);
  }
  cout << max(mx-1-(k-mx),0) << endl;
 
}


Measured memory_bytes: 3612
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = ns()
a = (int(s[:2]) <= 12 and int(s[:2]) > 0)
b = (int(s[2:]) <= 12 and int(s[2:]) > 0)

if a and b:
    print('AMBIGUOUS')
elif a and not b:
    print('MMYY')
elif not a and b:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

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

int main(int argc, const char * argv[]) {
    int N, K;
    cin >> N >> K;
    int sum = 0;
    char last = 'x';
    string s;
    cin >> s;
    for (int i = 0; i < N-1; i++) {
        if (s[i] == s[i+1]) {
            sum += 1;
        }
    }
    sum += 2 * K;
    if (sum >= N) {
        sum = N - 1;
    }

    cout << sum << endl;
    return 0;
}


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

using namespace std;

const int mod = 1000000007;

string grid[1010];

int dp[1010][1010]; /// dp table

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

    int n, m;
    cin >> n >> m;

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

    dp[0][0] = 1;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            if(i == 0 && j == 0) continue;
            if(grid[i][j] == '#') continue;

            int up      = (i > 0) ? dp[i - 1][j] : 0;
            int left    = (j > 0) ? dp[i][j - 1] : 0;

            long long sum = ( (up % mod) + (left % mod) ) % mod;

            dp[i][j] = sum;
        }
    }

    cout << dp[n - 1][m - 1] << endl;
}

/*
 * H
**/


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 100010;

int main() {
    int a, b; cin >> a >> b;
    if (a % 2 == 0 || b % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int n;cin>>n;
    vi a(n);
    int sumx[n+1],sum[n+1];
    sumx[0]=0;sum[0]=0;
    rep(i,n){
        cin>>a[i];
        sumx[i+1]=sumx[i]^a[i];
        sum[i+1]=sum[i]+a[i];
    }
    int l=0,r=0;long long ans=0;
    rep(i,n){
        r=i+1;
        if((sumx[r]^sumx[l])==sum[r]-sum[l]){
            ans+=r-l;
        }
        else{
            while((sumx[r]^sumx[l])!=sum[r]-sum[l]){
                l++;
            }
            ans+=r-l;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <bits/stdtr1c++.h>
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
const int N = 100005;
const int MOD = 1000000007;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a,b;
    char c;
    cin >> a >> c >> b;
    if(c=='+') cout << a+b;
    else cout << a-b;
    
    return 0;
}


Measured memory_bytes: 3620
n = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a[i] for i in range(1, n))
ans = abs(x-y)
for i in range(1, n - 1):
    x += a[i]
    y -= a[i]
    ans = min(ans, abs(x - y))
print(ans)


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

int main(){
  int x, y, a, b, c; cin>> x >> y >> a >> b >> c;
  vector<int> p(a), q(b), r(c);
  rep(i, a) cin >> p[i];
  rep(i, b) cin >> q[i];
  rep(i, c) cin >> r[i];
  
  sort(p.begin(), p.end(), greater<int>());
  sort(q.begin(), q.end(), greater<int>());
  sort(r.begin(), r.end(), greater<int>());

  int u, v;
  u = x-1, v= y-1;
  int i = 0;
  while(r[i] > p[u] || r[i] > q[v] || i < c ){
    if(p[u] > q[v]){q[v]  = max(q[v], r[i]); v--;}
    else{p[u] = max(p[u], r[i]); u--;}
    if(u < 0) u = 0; if(v < 0) v = 0;
    i++;
  }
  
  ll ans = 0;
  rep(i, x) ans += p[i];
  rep(i, y) ans += q[i];
    
  cout << ans << endl;
  
   
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)

ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}

int main(){
    ll A,B,C; cin>>A>>B>>C;
    if(A>B) cout<<"No";
    else{
        if(mid(A,B,C)==C) cout<<"Yes";
        else cout<<"No";
    }
}

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

def test(m):
    if m <= 0:
        return False
    needed = 0
    for a in A:
        needed += (a-1)//m
        if needed > K:
            return False
    return True

lb = 1
ub = max(A)

while True:
    m = (lb + ub) // 2
    if test(m):
        if test(m-1):
            ub = m - 1
        else:
            print(m)
            exit()
    else:
        lb = m + 1

Measured memory_bytes: 30912
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for (int i = s; i < n; i++)
#define repe(i, s, n) for(int i = s;i<=n;i++)
static const ll MOD = 1e9 + 7;

ll t[200001] = {};
int main() {
	ll n, T; cin >> n >> T;
	repe(i, 1, n)cin >> t[i];

	ll sum = 0;

	rep(i, 1, n) {
		sum += ((T > t[i + 1] - t[i]) ? t[i + 1] - t[i] : T);
	}
	sum += T;
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;


int main(){
  bool flag=false;
  int N;
  char ans[110000];
  string s;
  cin>>N>>s;

  for(int i=0;i<4;i++){
    if(i==0){
      ans[0]='W'; ans[1]='S';
    }else if(i==1){
      ans[0]='W'; ans[1]='W';      
    }else if(i==2){
      ans[0]='S'; ans[1]='W';            
    }else if(i==3){
      ans[0]='S'; ans[1]='S';                  
    }

    for(int i=1;i<N-1;i++){
      if(s[i]=='o' && ans[i]=='S' || s[i]=='x' && ans[i]=='W'){
        ans[i+1]=ans[i-1];
      }else{
        if(ans[i-1]=='S') ans[i+1]='W';
        else ans[i+1]='S';
      }
    }

    if(s[N-1]=='o' && ans[N-1]=='S' || s[N-1]=='x' && ans[N-1]=='W'){
      if(ans[0]==ans[N-2]) flag=true;
      else flag=false;
    }else{
      if(ans[0]!=ans[N-2]) flag=true;
      else flag=false;
    }

    if(flag){
      if(s[0]=='o' && ans[0]=='S' || s[0]=='x' && ans[0]=='W'){
        if(ans[1]==ans[N-1]) flag=true;
        else flag=false;
      }else{
        if(ans[1]!=ans[N-1]) flag=true;
        else flag=false;
      }
    }

    if(flag){
      for(int i=0;i<N;i++) cout<<ans[i];
      cout<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 640
def cos_per_find(count, cost, skills):
    if count == N:
        if min(skills) >= X:
            return cost
        else:
            return INF
    improved_skills = [a+b for a, b in zip(skills, contents[count])]
    return min(cos_per_find(count+1, cost, skills), cos_per_find(count+1, cost+price[count], improved_skills))

INF = float('inf')
N, M, X = map(int, input().split())
price = []
contents = []
for i in range(N):
    C, *A = map(int, input().split())
    price.append(C)
    contents.append(A)
if (ans := cos_per_find(0, 0, [0]*M)) == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 28;
const long long MOD = 1000000000 + 7;



int main()
{
	string s;
	cin >> s;
	int legth=s.size();
	long long k;
	cin >>k;
	int toA=0;
	for(int i=0;i<legth;i++){
		toA=1+'z'-s[i];
		if(s[i]=='a'){
			toA=0;
		}
		if(k >=toA){
			s[i]='a';
			k-=toA;
		}
	}
	s[legth-1]+=(k%(1+'z'-'a'));
	cout <<s<< endl;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  ll N;cin>>N;vl A(N);map<ll,ll> mp;rep(i,N){cin>>A[i];mp[A[i]]++;}
  ll a=0,b=0,c=0;
  
  for(auto x:mp){
    if(x.second>=2){a=max(x.first,a);}
  }
  for(auto x:mp){
    if(x.second>=2 && x.first!=a){b=max(x.first,b);}
  }
  for(auto x:mp){
    if(x.second>=4){c=max(x.first,c);}
  }
  cout<<max(a*b,c*c)<<endl;
  
  
  
  
}







Measured memory_bytes: 7296
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

import time
def Dijkstra(num, start, s, m):
    b = time.time()
    dist = [inf for i in range(num)]
    x = 0
    dist[0] = 0
    for i in range(num):
        if x > i:
            continue
        a = dist[i]
        for k in range(1, m + 1):
            if s[i + k] == "1":
                continue
            dist[i + k] = a + 1
            x = i + k
            if i + k == num - 1:
                return dist
        if x == i:
            x = inf
    return dist


#solve
def solve():
    n, m = LI()
    s = S()
    d = Dijkstra(n + 1, 0, s, m)
    if d[-1] == inf:
        print(-1)
        return
    ans = []
    q = deque([n])
    while q:
        a = q.pop()
        x = d[a]
        for i in range(min(a, m), 0, -1):
            if x - 1 == d[a - i]:
                q.append(a - i)
                ans.append(i)
                break
    ans = ans[::-1]
    print(" ".join(map(str, ans)))
    return


#main
if __name__ == '__main__':
    solve()


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

int main() {
    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int cnt = 0;
    for(int a = 0; a <= A; a++)
    {
        for(int b = 0; b <= B; b++)
        {
            for(int c = 0; c <= C; c++)
            {
                if (500 * a + 100 * b + 50 * c == X) cnt++; 
            }   
        }   
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int math(ll a){
    int ans=0;
    while(a){
        a/=10;
        ans++;
    }
    return ans;
}

int fmath(ll a,ll b){
    int A=math(a),B=math(b);
    return max(A,B);
}

 
int main(){
    ll n;cin>>n;vector<ll> v;
    for(ll a=1;a<=sqrt(n);a++){
        if(n%a==0) v.push_back(a);
    }
    int s=v.size(),ans=11;
    for(int i=0;i<s;i++){
        ll a=v[i],b=n/a;
        ans=min(ans,fmath(a,b));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

typedef long long ll;
int q,a,b,ans;

inline ll calc_sqrt(ll n){
	ll l=0,r=sqrt(n)+100;
	while(l<r){
		ll mid=l+r+1>>1;
		if(mid*mid<=n)
			l=mid;
		else
			r=mid-1;
	}
	return l;
}

int main(){
	cin>>q;
	while(q--){
		cin>>a>>b;
		if(a==1&&b==1){
			cout<<0<<endl;
			continue;
		}
		ll n=(ll)a*b-1,x=calc_sqrt(n);
		if(n/x==x)
			ans=2*x-1;
		else
			ans=2*x;
		if(a<=x)
			--ans;
		else if(n/a&&x-n/a>=n/(n/a)-x)
			--ans;
		if(b<=x)
			--ans;
		else if(n/b&&x-n/b>=n/(n/b)-x)
			--ans;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
D = [tuple(map(int, input().split())) for _ in range(N)]

for i in range(N - 2):
    if D[i][0] == D[i][1] and D[i + 1][0] == D[i + 1][1] and D[i + 2][0] == D[i + 2][1]:
        print('Yes')
        break
else:
    print('No')

Measured memory_bytes: 62416
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
ll int dp[300009][4];
ll int solve(ll int a[][3],int n,int i,int j){
    if(i==n)return 0;
    if(dp[i][j]!=-1)return dp[i][j];
    return dp[i][j]=max(solve(a,n,i+1,(j+1)%3)+a[i][(j+1)%3],solve(a,n,i+1,(j+2)%3)+a[i][(j+2)%3]);
}
int main(){
ios_base::sync_with_stdio(0);
ll int t,n,i,j,k,m;
t=1;
while(t--){
    memset(dp,-1,sizeof dp);
        cin>>n;
       ll int a[n][3];
        fo(i,n){
            fo(j,3){
                cin>>a[i][j];
            }
             }
        cout<<max({solve(a,n,1,0)+a[0][0],solve(a,n,1,1)+a[0][1],solve(a,n,1,2)+a[0][2]});
}

}


Measured memory_bytes: 23116
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#define LL long long 
using namespace std;

const int M = 250001;
int w,n,a[M],c[M],pre[M],f[60][M],s[M];
LL m,k,b[60][M];

int main()
{
	//freopen("in.txt","r",stdin);
	cin>>n>>m;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]), w=max(w,a[i]);
	for(int i=1;i<=n;i++)
	{
		if(!c[a[i]]) c[a[i]]=i;
		if(pre[a[i]]) f[0][pre[a[i]]]=i%n+1;
		if(i==n && pre[a[i]]) f[0][pre[a[n]]]=1, b[0][pre[a[n]]]=(n!=1 ? 1 : 2);
		pre[a[i]]=i;
	}
	
	for(int i=1;i<=n;i++) if(pre[a[i]]==i)
	{
		f[0][i]=c[a[i]]%n+1;
		b[0][i]=f[0][i]==1?2:1;
	}
	for(int i=1;i<=58;i++)
		for(int j=1;j<=n;j++) f[i][j]=f[i-1][f[i-1][j]], b[i][j]=b[i-1][f[i-1][j]]+b[i-1][j];
		
	w=1;
	for(int i=58;i>=0;i--) if(b[i][w]+k<m) 
		k+=b[i][w], w=f[i][w];
	
	memset(c,0,sizeof(c));
	int tp=0;
	if(n==1 && m!=k+1)  return 0;
	for(int i=w;i<=n;i++)
	{
		if(c[a[i]])
		{
			while(s[tp]!=a[i]) c[s[tp--]]=0;
			tp--; c[a[i]]=0;
		}
		else s[++tp]=a[i], c[a[i]]=1;
	}
	for(int i=1;i<=tp;i++) printf("%d ",s[i]);
	//printf("\n");
}

Measured memory_bytes: 180608
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
  int n=0;
  int C=0;
  int a,b,c,d;

  while(scanf("%d",&n)!=EOF){
C=0;
  for(a=0;a<10;a++){
	  for(b=0;b<10;b++){
		  for(c=0;c<10;c++){
			  for(d=0;d<10;d++){
				  if(a+b+c+d==n){
					  C++;
				  }
			  }
		  }
	  }
  }
  cout<<C<<endl;
  }
  return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

vector<ll> memo_a;
vector<ll> memo_b;

int main() {
  ll n;
  cin>>n;
  if(n==2){
    cout<<1<<endl;
    return 0;
  }
  for(ll i=1;i<=sqrt(n-1);i++){
    if((n-1)%i==0) {
      if(i*i!=n-1){
        memo_a.push_back(i);
        memo_a.push_back((n-1)/i);
      }
      else{
      	memo_a.push_back(i);
      }
    }
  }
  for(ll i=1;i<=sqrt(n);i++){
    if(n%i==0) {
      if(i*i!=n){
        memo_b.push_back(i);
        memo_b.push_back(n/i);
      }
      else{
      	memo_a.push_back(i);
      }
    }
  }
  sort(memo_b.begin(),memo_b.end());
  ll ans=memo_a.size()-1;
  for(int i=1;i<=memo_b.size()-1;i++){
    ll temp=n;
    while(temp%memo_b[i]==0){
      temp/=memo_b[i];
    }
    if(temp%memo_b[i]==1) {
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
import std.algorithm;
import std.array;
import std.bigint;
import std.bitmanip;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

// 差の絶対値
@nogc @safe pure T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

// 切り上げ除算
@nogc @safe pure T divCeil(T)(const ref T a, const ref T b) {
    return (a+b-1)/b;
}

T[] readToArray(T)() {
    return readln.split.to!(T[]);
}

void readInto(T...)(ref T ts) {
    auto ss = readln.split;
    foreach(ref t; ts) {
        t = ss.front.to!(typeof(t));
        ss.popFront;
    }
}

// 冪乗をmod取りつつ計算
@nogc @safe pure ulong modPow(ulong a, ulong n, ulong m) {
    ulong r = 1;
    while (n > 0) {
        if(n % 2 != 0) r = r * a % m;
        a = a * a % m;
        n /= 2;
    }
    return r;
}

// フェルマーの小定理から乗法逆元を計算
// 定理の要請により法は素数
@nogc @safe pure ulong modInv(ulong a, ulong m) {
    return modPow(a, m-2, m);
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modPerm(ulong n, ulong k, ulong m) {
    if (n < k) return 0;

    ulong r = 1;
    for (ulong i = n-k+1; i <= n; i++) {
        r *= i;
        r %= m;
    }
    return r;
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modFact(ulong n, ulong m) {
    return modPerm(n, n, m);
}

// mod取りつつ組み合わせを計算
// modInvを使っているので法は素数
@nogc @safe pure ulong modComb(ulong n, ulong r, ulong m) {
    return modPerm(n, r, m)*modInv(modFact(r, m), m) % m;
}

immutable ulong MOD = 1000000007;

void main() {
    ulong m, d;
    readInto(m, d);
    ulong cnt = 0;

    for(ulong i = 1; i <= m; i++) {
        for (ulong j = 1; j <= d; j++) {
            ulong d1 = j%10;
            ulong d2 = j/10;
            if (d1 >= 2 && d2 >= 2 && d1*d2 == i) {
                cnt++;
            }
        }
    }
    writeln(cnt);
}


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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val % MOD + (val > 0 ? 0 : MOD)) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 1000000007>;

int main(){
	std::string str;
	cin >> str;
	if(str == "ABC"){
		std::cout << "ARC" << std::endl;
	}else{
		std::cout << "ABC" << std::endl;
	}
}


Measured memory_bytes: 3624
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
a, b, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)
for i in range(m):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x - 1] + b[y - 1] - c)
print(ans)

Measured memory_bytes: 20604
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

void darts();

void longest_dis();

void sum_of_three_integers();

int main()
{
  //darts();
  //longest_dis();
  sum_of_three_integers();
}


void darts()
{
  while (true)
  {
    int n, m;
    cin >> n >> m;

    // stop cond
    if (n == 0) break;

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

    // 2 darts combination
    // p = q, 0, p + q
    vector<int> q = p;
    q.push_back(0);
    for (int i = 0; i < n; ++i)
    {
      for (int j = 0; j <= i; ++j)
      {
        q.push_back(p[i] + p[j]);
      }
    }

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

    // q's size = 1 + n + n(n + 1) / 2
    //cout << q.size() << "\n";
    //for (auto x : q) cout << x << " ";

    int ret = 0;
    int j = q.size() - 1;
    //i:q linear scan
    for (int i = 0; i < q.size(); ++i)
    {
      if (q[i] > m) break;
      while (q[i] + q[j] > m) --j;
      ret = max(ret, q[i] + q[j]);
    }

    cout << ret << "\n";
  }
}

void longest_dis()
{
  int n;
  cin >> n;

  vector<pair<int, int>> p(n);
  for (int i = 0; i < n; ++i) cin >> p[i].first >> p[i].second;

  double v_max = 0.0;
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      if ((p[i].first - p[j].first) * (p[i].first - p[j].first)
        + (p[i].second - p[j].second) * (p[i].second - p[j].second)
        >  v_max * v_max)
      {
        v_max = sqrt((p[i].first - p[j].first) * (p[i].first - p[j].first)
          + (p[i].second - p[j].second) * (p[i].second - p[j].second));
      }
    }
  }

  cout << v_max << "\n";
}

void sum_of_three_integers()
{
  int k, s;
  cin >> k >> s;

  int cnt = 0;
  for (int i = 0; i <= k; ++i)
  {
    for (int j = 0; j <= k; ++j)
    {
      for (int m = 0; m <= k; ++m)
      {
        if (i + j + m == s) ++cnt;
      }
    }
  }

  cout << cnt << "\n";
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll H,W,M;cin>>H>>W>>M;
    ll h[M],w[M];
    ll ch[H],cw[W];
    rep(i,0,H-1)ch[i]=0;
    rep(i,0,W-1)cw[i]=0;
    vector<ll> v1[H],v2[W];
    set<l_l> st;
    rep(i,0,M-1){
        cin>>h[i]>>w[i];
        v1[h[i]-1].pb(w[i]-1);
        v2[w[i]-1].pb(h[i]-1);
        st.insert(make_pair(h[i]-1,w[i]-1));
        ch[h[i]-1]++;
        cw[w[i]-1]++;
    }
    ll mh=0,mw=0;
    vector<ll> vh,vw;
    rep(i,0,H-1){
        if(mh>ch[i])continue;
        if(mh==ch[i]){
            vh.pb(i);
        }else{
            vh.clear();
            vh.pb(i);
            mh=ch[i];
        }
    }
    rep(i,0,W-1){
        if(mw>cw[i])continue;
        if(mw==cw[i]){
            vw.pb(i);
        }else{
            vw.clear();
            vw.pb(i);
            mw=cw[i];
        }
    }
    bool bol=true;
    rep(i,0,vh.size()-1){
        rep(j,0,vw.size()-1){
            ll h=vh[i];
            ll w=vw[j];
            auto it=st.find(make_pair(h,w));
            if(it==st.end()){
                bol=false;
                break;
            }
        }
        if(!bol)break;
    }
    if(!bol){
        cout<<mh+mw<<endl;
    }else{
        cout<<mh+mw-1<<endl;
    }
    
}





Measured memory_bytes: 72524
/*C - Traveling Salesman around Lake*/
#include <bits/stdc++.h>

using namespace std;

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int dist;
	int houses;

	cin >> dist >> houses;

	vector <int> arr(houses);

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

	arr.push_back(dist + arr[0]);

	int maximo = -1;
	int tot = 0;
	int dif = 0;

	for (int i = 0; i < houses; ++i)
	{
		dif = arr[i + 1] - arr[i];	
		tot += dif;
		
		if(dif > maximo){
			maximo = dif;
		}
	}

	cout << tot - maximo;

	return 0;
}

Measured memory_bytes: 1792