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

using namespace std;

#define MAX 501

int M[MAX][MAX];

int main() {
  
  int n;
  int w, h;
  int x, y;
  int s, t;
  int cnt, mx;
  
  while(cin >> n && n) {
    
    cin >> w >> h;
    fill(M[0], M[0] + MAX*MAX, 0);
    
    for(int i=0; i<n; i++) {
      cin >> x >> y;
      M[y][x] = 1;
    }
    
    cin >> s >> t;
    mx = 0;
    
    for(int i=1; i<h-t+2; i++) {
      for(int j=1; j<w-s+2; j++) {
	cnt = 0;
	for(int k=0; k<t; k++) {
	  for(int l=0; l<s; l++) {
	    if(M[i+k][j+l]) cnt ++;
	  }
	}
	mx = max(mx, cnt);
      }
    }
    cout << mx << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2140
X,K,D = map(int,input().split())
if abs(X) > abs(K*D):
    print(abs(X) - abs(K*D))
else:
    X = abs(X)
    n = X // D
    cnt = 0
    ans = X - (D*n)
    cnt += n
    if abs(ans - D) > ans and cnt < D:
        ans = abs(ans - D)
        cnt += 1
    last_K = K - cnt
    if last_K % 2 == 0:
        print(ans)
    else:
        ans = min(abs(ans + D),abs(ans - D))
        print(ans)

Measured memory_bytes: 9200
import math

inp = input().split()
tansin = int(inp[0])
tyosin = int(inp[1])
hour = int(inp[2])
minuts = int(inp[3])

minPer = minuts / 60 
hoPer = (hour / 12) + (minPer / 12)

adv = 0
late = 0
if minPer > hoPer:
  adv = minPer
  late = hoPer
else:
  adv = hoPer
  late = minPer

distancelaicio = adv - late
if distancelaicio > 0.5 :
  distancelaicio = (1-distancelaicio)  

kakudo = 360 * distancelaicio

a = (tansin**2) + (tyosin**2) - (2*tansin*tyosin*math.cos(math.radians(kakudo)))
print(a**0.5)

Measured memory_bytes: 9608
class RadixHeap:
    __slots__ = ["data", "last", "siz", "used"]

    # (max_key - min_key) <= C
    def __init__(self, N, C):
        self.data = [[] for i in range(C.bit_length() + 1)]
        self.last = self.siz = 0
        self.used = [0]*N

    def push(self, x, key):
        #assert self.last <= x
        self.siz += 1
        self.data[(x ^ self.last).bit_length()].append((x, key))

    def pop(self):
        data = self.data
        used = self.used
        #assert self.siz > 0
        if not data[0]:
            i = 1
            while not data[i]:
                i += 1
            d = data[i]
            new_last, new_key = min(d)
            used[new_key] = 1
            for val in d:
                x, key = val
                if used[key]:
                    self.siz -= 1
                    continue
                data[(x ^ new_last).bit_length()].append(val)
            self.last = new_last
            data[i] = []
        else:
            new_last, new_key = data[0].pop()
            used[new_key] = 1
            self.siz -= 1
        return new_last, new_key

    def __len__(self):
        return self.siz

import sys
readline = sys.stdin.readline
write = sys.stdout.write

N, M, s = map(int, readline().split())
G = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, readline().split())
    G[a].append((b, c))

INF = 10**18
def dijkstra(N, G, s):
    que = RadixHeap(N, 10**9 + 1)

    dist = [INF]*N
    dist[s] = 0
    que.push(0, s)
    while que:
        cost, v = que.pop()
        if dist[v] < cost:
            continue
        for w, c in G[v]:
            if cost + c < dist[w]:
                dist[w] = r = cost + c
                que.push(r, w)
    return dist

dist = dijkstra(N, G, s)
for c in dist:
    write("INF\n" if c == INF else "%d\n" % c)


Measured memory_bytes: 90460
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int n;
int a[105];
int main(void){
	cin>>n;
	REP(i,n)cin>>a[i];
	REP(i,n)if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0){
		cout<<"DENIED";
		return 0;
	}
	cout<<"APPROVED";
	return 0;
}

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

using std::cin;
using std::cout;
using std::endl;

int check_ind(std::vector< std::pair< int, std::string > > v, int w) {
	int l = v.size();
	for (int i = 0; i < l; i++) {
		if ( v[l-i-1].first <= w ) {
			return (l-i-1);
		}
	}
	return -1;
}

int main(void) {
	int N,Q;
	cin >> N >> Q;

	while ( N != 0 || Q != 0 ) {
		std::vector< std::pair< int, std::string > > G(N);
		std::vector< std::pair< int, std::string > > g(N);
		int era,w,min;
		for (int i = 0; i < N; i++) {
			cin >> G[i].second;
			g[i].second = G[i].second;
			cin >> era >> w;
			g[i].first = w;
			G[i].first = w - era + 1;
			if ( i == 0 ) {
				min = G[i].first;
			}
			else {
				if ( G[i].first < min ) {
					min = G[i].first;
				}
			}
		}
		
		std::sort(G.begin(), G.end());
		std::sort(g.begin(), g.end());

		int ind;
		int ret;
		for (int i = 0; i < Q; i++) {
			cin >> w;
			ind = check_ind(G,w);
			if ( ind < 0 ) {
				cout << "Unknown" << endl;
			}
			else {
				ret = w - G[ind].first + 1;
				if ( !(w > g[ind].first) ) {
					cout << G[ind].second << " " << (w - G[ind].first + 1) << endl;
				}
				else {
					cout << "Unknown" << endl;
				}
			}
		}

		cin >> N >> Q;
	}

	return 0;
}

Measured memory_bytes: 3252
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
    int n, *buf, a;
    scanf("%d", &n);
    buf = (int*) malloc(n * sizeof(*buf));
    for(int i = 0;i < n; i++)
    {
        scanf("%d", buf+i);
        //printf("=> %d\n", buf[i]);
        if (buf[i] % 2 == 0)
        {
            if (buf[i] % 3 == 0 || buf[i] % 5 == 0)
            {
                //printf("APPROVED");
            }
            else
            {
                printf("DENIED");
                return 0;
            }
            
        }
        
    }
    printf("APPROVED");
    return 0;
}

Measured memory_bytes: 256
x = int(input())
k = 1
while True:
    if k ** 5 - (k-1) ** 5 > x:
        break
    k += 1
for a in range(k):
    amari = x - a ** 5
    for b in range(a+1):
        if amari == b ** 5:
            print(a, -b)
            break
        if amari == (-b) ** 5:
            print(a, b)
            break

Measured memory_bytes: 9112
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int N;
	cin >> N;
	map<int, int> m;
	rep(i, 0, N) {
		int tmp;
		cin >> tmp;
		m[tmp]++;
	}


	int num1 = 0, num2 = 0;
	for(map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
		if(it->second >= 4 and it->second % 2 == 0) num2++;
		else if(it->second >= 4 and it->second % 2 != 0) num1++;
		else if(it->second == 3) num1++;
		else if(it->second == 2) num2++;
		else if(it->second == 1) num1++;
	}

	if(num2 % 2 != 0) num2 -= 1;
	cout << num1 + num2 << endl;

}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
const int MAX = 15;
long long price[MAX], x;
long long learn[MAX][MAX];
long long tot[MAX];
long long previous[MAX];
long long ans;
int n, m;
void go(int index, long long wasted, vector<long long>v) {
  if(ans != -1 && ans < wasted)return;
  if(index == n) {
    for(auto xx : v)if(xx < x)return;
    if(ans == -1)ans = wasted;
    else ans = min(ans, wasted);
    return;
  }
  go(index+1, wasted, v);
  vector<long long >vv(m);
  for(int i = 0; i < m; ++i)vv[i] = v[i] + learn[index][i];
  go(index+1, wasted + price[index], vv);
}
void solve() {
  cin >> n >> m >> x;
  for(int i = 0; i < n; ++i) {
    cin >> price[i];
    for(int j = 0; j < m; ++j)cin >> learn[i][j];
  }
  ans = -1;
  vector<long long> v(m, 0);
  go(0, 0, v);
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tc = 1;
  // cin >> tc;
  for(int i = 1; i <= tc; ++i) {
    // cout << "Case #" << i <<": ";
    solve();
  }
  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

string str;
signed main(){
	cin >> str;
	int n = str.size();
	str.pb('A');str.pb('A');
	int f = 0, l, r;
	rep(i,n){
		if(str[i] == str[i+1]){f = 1;l=i;r=i+1;}
		if(str[i] == str[i+2]){f = 1;l=i;r=i+2;}
	}
	if(f == 1)printf("%lld %lld\n", l+1, r+1);
	else printf("-1 -1\n");
	return 0;
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;
using Graph = vector<vector<int>>;

int main(){
    int N;
    cin >> N;
    if(N%2==0) cout << N/2 << endl;
    else cout << N/2 +1 << endl;
}

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

int main(){
    int n,m,x;
    cin>>n>>m>>x;

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

    int cost_0=0,cost_n=0;

    for(int i=0; i<m; i++){
        if(a[i]<x){
            cost_0++;
        }else{
            cost_n++;
        }
    }

    cout<<min(cost_0,cost_n)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

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

  double r;
  cin >> r;

  cout << 2*r*3.14 << endl;
  return 0;
  }


Measured memory_bytes: 3792
function Main(input: string):void {
    const [A, B] = input.split(' ').map((num:string) => parseInt(num));
    if (A % 2 === 1 && B % 2 === 1) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}

import * as fs from 'fs';
Main(fs.readFileSync("/dev/stdin", "utf8"));


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

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif


#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1)
#define ld long double
#define prime (1000000000 + 7)

using namespace std;

#define INF 1000000000

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

    ll n, m;
	cin >> n >> m;

	map<ll, ll> mapa;

	vl vet{0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
	vll vet2;
	for(int i = 1; i <= m; ++i){
		ll  a;
		cin >> a;
		vet2.push_back({a, vet[a]});
	}
	ll o = vet2.size();
	
	vector<pair<pll, ll>> mat(n+1);
	for(int i = 0; i < o; ++i){
		mat[vet2[i].ss] = max(mat[vet2[i].ss], {{1, vet2[i].ff}, 0});
	}

	for(int i = 1; i <= n; ++i){
		for(int j = 0; j < o; ++j){
			if(i - vet2[j].ss >= 0 && mat[i - vet2[j].ss].ff.ff != 0){
				mat[i] = max(mat[i], {{mat[i - vet2[j].ss].ff.ff+1, vet2[j].ff}, i - vet2[j].ss});
			}
		}
	}

	string s;
	pair<pll, ll> u{mat.back()};
	while (u.ff.ff != 0){
		W(u.ff.ff, " | ");
		s.push_back(u.ff.ss + '0');
		u = mat[u.ss];
	}
	cerr << endl;
	W(u.ff.ss, endl);
	W(s.size(), endl);
	
	sort(s.rbegin(), s.rend());
	
	cout << s << endl;
	



	return 0;
}


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

template <typename A>
string to_string(vector<A> v) {
    bool first = true;
    string result = "[";
    for (A i : v) {
        if (!first) result += ", ";
        first = false;
        result += to_string(i); 
    }
    return result + "]";
}

template <typename A>
string to_string(set<A> v) {
    bool first = true;
    string result = "[";
    for (A i : v) {
        if (!first) result += ", ";
        first = false;
        result += to_string(i); 
    }
    return result + "]";
}

vector<ll> H;
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); 
    ll N;
    cin >> N;
    vector<ll> P (N);
    for (ll i = 0; i < N; ++i) {
        H.push_back(0);
        cin >> H[i]; 
        P[i] = i;
    }

    sort(P.begin(), P.end(), [](const ll a, const ll b) {
        return H[a] > H[b];
    });

    ll total = 0;
    set<ll> found ({-1, N});
    for (ll ind : P) {
        if (H[ind] == N) {
            found.insert(ind);
            continue;
        }

        ll l0 = *(--found.lower_bound(ind));
        ll l1 = (l0 != -1) ? *(--found.lower_bound(l0)) : -1;
        ll r0 = *found.upper_bound(ind);
        ll r1 = (r0 != N) ? *found.upper_bound(r0) : N;

        ll le = (l0 != -1) ? (l0 - l1) * (r0 - ind) : 0;
        ll ri = (r0 != N ) ? (r1 - r0) * (ind - l0) : 0;

        total += (le + ri) * H[ind];
        found.insert(ind);
    }

    cout << total << endl;
}

Measured memory_bytes: 6516
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	    ArrayList<Integer> input = getInput();

	    if (input.get(0) == input.get(1)) {
            Print("Yes");
            return;
        }

	    Print("No");
    }

    private static Scanner scanner = new Scanner(System.in);
    private static ArrayList<Integer> getInput() {
        String in = scanner.nextLine();

        ArrayList<Integer> result = new ArrayList<>();
        for (String t : in.split(" ")) {
            result.add(Integer.parseInt(t));
        }

        return result;
    }

    private static void Print(Object o) {
        System.out.println(o);
    }
}


Measured memory_bytes: 23764
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N=s.nextInt();
        String str=s.next();
        if(str.length()%2==1){
            System.out.println("No");
            System.exit(0);
        }
        for(int i=0;i<N/2;i++){
            if(str.charAt(i)!=str.charAt(i+N/2)){
                System.out.println("No");
            System.exit(0);
            }
        }
        System.out.println("Yes");
        
    }
}

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

int main(void){
    int N,x;
    cin>>N;
    vector<ll> a(N),suml(N+1),sumr(N+1);
    priority_queue<int,vector<int>,greater<int>> lq;
    priority_queue<int> rq;    
    rep(i,N)cin>>x, suml[0]+=x, lq.push(x);
    rep(i,N)cin>>a[i];
    rep(i,N)cin>>x, sumr[N]+=x, rq.push(x);
    rep(k,N){
        lq.push(a[k]);
        suml[k+1] = suml[k]+a[k]-lq.top();
        lq.pop();
        rq.push(a[N-1-k]);
        sumr[N-1-k] = sumr[N-k]+a[N-1-k]-rq.top();
        rq.pop();
    }
    ll res=LLONG_MIN;
    rep(k,N+1)res=max(res,suml[k]-sumr[k]);
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;

int main() {
    int max = 0, sum = 0;
    string S;

    cin >> S;

    for(int i = 1; i < S.size(); i++) {
        if(S[i] =='9')
        sum++;
    }

    if (sum == S.size() - 1) {
        max = S[0] -48 + 9 * (S.size() - 1);
    }
    else {
        max = S[0] -48 + 9 * (S.size() - 1) - 1;
    }

    cout << max;

}



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

int main(){

  ios_base::sync_with_stdio(false);
  cin.tie(0),cout.tie(0);
  ll a;
  cin>>a;
  
  ll ans = a+pow(a,2)+pow(a,3);
  cout<<ans<<endl;

return  0;
}


Measured memory_bytes: 4008
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

VVI GG(202, VI(202));

bool inline dfs(auto now, auto n, auto &v)
{
  static VI color(v, -1);
  if (now == 0) color[now] = 0;
  REP(next, v)
  {
    if (GG[now][next] == 1)
    {
      if (color[next] != -1)
      {
        if (abs(color[now]-color[next]) != 1 && abs(color[now]-color[next]) != n-1) return false;
        continue;
      }
      color[next] = (color[now] + 1) % n;
      if (!dfs(next, n, v)) return false;
    }
  }
  return true;
}

void warshall_floyd(auto &v)
{
  REP(i, v) GG[i][i] = 0;
  REP(k, v) REP(i, v) REP(j, v) chmin(GG[i][j], GG[i][k] + GG[k][j]);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  REP(i, n) REP(j, n)
  {
    char s;
    cin >> s;
    GG[i][j] = s - '0' ? 1 : INF;
  }
  int ans = -1;
  if (dfs(0, 2, n))
  {
    warshall_floyd(n);
    REP(i, n) chmax(ans, MAX(GG[i]));
    ans++;
  }
  cout << ans << endl;

  return 0;
}

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

using namespace std;

int main()
{
	unsigned long long int a,b,x,s,res;
	cin>>a>>b>>x;

	if(a%x!=0){
		a+=x-(a%x);
	}
	if(b%x!=0){
		b-=(b%x);
	}
	if(a>b)
	{
		cout<<0<<endl;
		return 0;
	}
    res=((b-a)/x )+1;
	cout<<res<<endl;
	return 0;

}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 75004
import java.util.*;
public class Main{
  public static void main(String []args){
  Scanner sc = new Scanner(System.in);

  String s = sc.next();
  String t = sc.next();
  int a = sc.nextInt();
  int b = sc.nextInt();
  String u = sc.next();

  if (u.equals(s)) {
    a-=1;
  }
  if (u.equals(t)) {
    b-=1;
  }
  System.out.print(a);
  System.out.print(" ");
  System.out.print(b);

}
}


Measured memory_bytes: 22100
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))

int gcd(int a, int b){
    while( b ){
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

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

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //x???n???????¨????????????????n??????2?????¨?¨???????????¨????
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//???????????????
        }
        x=(x*x)%mod;//2???
        n=n/2;
    }
    return ret;
}

struct VV{
    int x;
    int y;
    int z;
};

class LessInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        if(riLeft.x == riRight.x){
            return riLeft.y > riRight.y;
        }
        return riLeft.x > riRight.x;
        
    }
};

class indInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        return riLeft.x < riRight.x;
        
    }
};

struct XX{
    int zenbu=0;
    int kidoku=0;
};

class xxIntu {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        //?¬¬1?????¶
        if(riLeft.z != riRight.z){
            return riLeft.z > riRight.z;//<:??????(?°??????????)???>:??????(??§?????????)
        }
        //?¬¬2?????¶
        return riLeft.y < riRight.y;
    }
};
bool operator< (const VV &riLeft, const VV &riRight){
    return riLeft.z < riRight.z;
};
/*bool operator> (const XX &riLeft, const XX &riRight){
    return riLeft.a > riRight.a;
};*/



int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //????????????
    
    int N,W;
    cin >> N>> W;
    int v[100];
    int w[100];
    for(int i=0;i<N;i++){
        cin >>v[i]>> w[i];
    }
    int dp[101][10001];//i???????????§??§j?????????????????????????????§
    
    for(int i=0;i<N;i++){
        for(int j=0;j<=W;j++){
            if(j-w[i]>=0){
                dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
            }else{
                dp[i+1][j]=dp[i][j];
            }
        }
    }
    
    cout << dp[N][W] << endl;
    
    //???????????§
    //cout << "ans" << endl;????????????
    //printf("%.0f\n",ans);//?°???°?????\?????¨?????????
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Measured memory_bytes: 7004
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;

int main(void)
{
    int N, M, C;
    cin >> N >> M >> C;

    vector<int> B(M);
    for (int i = 0; i < M; i++)
    {
        cin >> B.at(i);
    }

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

    int sum;
    int counter = 0;
    for (int i = 0; i < N; i++)
    {
        sum = 0;
        for (int j = 0; j < M; j++)
        {
            sum = sum + (A.at(i).at(j) * B.at(j));
            // printf("%d * %d, sum = %d\n", A.at(i).at(j), B.at(j), sum);
        }
        sum += C;

        if (sum > 0)
            counter++;
    }

    cout << counter << endl;

    return (0);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i, j;
	
	for (i = 1; i < 10; i++) {
		for (j = 1; j < 10; j++) {
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	
	return (0);
}

Measured memory_bytes: 524
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
bool Check(int x) {
	char a[10]={};
	sprintf(a,"%d",x);
	int i=0,j=strlen(a)-1;
	while(i<j) {
		if(a[i]!=a[j])
			return false;
		i++,j--;
	}
	return true;
}
int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	int A,B,ans=0;
	scanf("%d %d",&A,&B);
	for(int i=A;i<=B;i++)
		if(Check(i))
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

int[20_0001] HS;

void main()
{
    auto nk = readln.split.to!(int[]);
    auto K = nk[1];
    auto AS = readln.split.to!(int[]);

    int cnt;
    foreach (a; AS) {
        if (!HS[a]) ++cnt;
        ++HS[a];
    }
    HS[].sort();

    int ret;
    foreach (h; HS) {
        if (!h) continue;
        if (cnt > K) {
            ret += h;
            --cnt;
        }
    }
    writeln(ret);
}

Measured memory_bytes: 11920
n = int(input())
list_b = list(map(int, input().split()))
list_a = [0]*n

list_a[0] = list_b[0]
list_a[1] = list_b[0]
for i in range(1, n-1):
  if list_b[i] < list_a[i]:
    list_a[i] = list_b[i]
    list_a[i+1] = list_b[i]
  else:
    list_a[i+1] = list_b[i]

print(sum(list_a))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;


typedef unsigned int uint;
typedef unsigned long int lu;
typedef unsigned long long llu;
typedef long int ld;
typedef long long lld;
typedef vector<int> vint;
typedef vector<unsigned int> vuint;
typedef vector<unsigned long int> vlu;
typedef vector<unsigned long long> vllu;
typedef vector<long int> vld;
typedef vector<long long> vlld;
typedef priority_queue<int> p_qd;
typedef vector<char> vchar;

#define MAX_N 100010

int main()          
{
    int n;
    cin>>n;
    vint freq(MAX_N,0);
    lld  sum=0;
    for(int i=0;i<n;i++)
    {
        int temp;
        cin>>temp;
        freq[temp]++;
        sum+=(temp);
    }
    int q;
    cin>>q;
    while(q--)
    {
        int b,c;
        cin>>b>>c;
        sum+=( freq[b]*(c-b) );
        freq[c]+=freq[b];
        freq[b]=0;
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 3784
#include<stdio.h>
#include<math.h>
int main(void){
    double v,h;
    int n;
    while(scanf("%lf",&v)!=EOF){
        h=(v*v)/19.6;
        n=(int)(h/5);
        if(n*5==h){
            printf("%d\n",n+1);
        }else{
            printf("%d\n",n+2);
        }
    }
    return 0;
}

Measured memory_bytes: 628
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <int> L(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> L[ii];
	}
	sort(L.begin(), L.end());

	int ans = 0;
	for (int ii = 0; ii < N-2; ++ii){
		for (int jj = ii+1; jj < N-1; ++jj){
			int sum = L[ii] + L[jj];
			auto itr = lower_bound(L.begin(), L.end(), sum);
			int dist = distance(L.begin(), itr);
			// printf("val %i, dist %i\n", *itr, dist);
			ans += max(0, dist - 1 - jj);
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;

const int MAX_N= 1 << 20;

int nn,dat[2*MAX_N-1];

void init(int n_){
    nn=1;
    while (nn<n_) nn*=2;
    for (int i=0;i<2*nn-1;i++) dat[i]=inf;
 }

 void update(int k,int a){
     k+=nn-1;
     dat[k]=a;
     while(k>0){
         k=(k-1)/2;
         dat[k]=min(dat[k*2+1],dat[k*2+2]);
     }
 }

 int query(int a,int b,int k,int l,int r){
     if (r<=a || b<=l) return inf;
     if (a<=l && r<=b) return dat[k];
     else {
         int vl=query(a,b,k*2+1,l,(l+r)/2);
         int vr=query(a,b,k*2+2,(l+r)/2,r);
         return min(vl,vr);
     }
 }

int main(){
    int n,q;
    cin >> n >> q;
    init (n+1);
    vector<pair<int,pp>> b(0);
    rep(i,n){
        int s,t,x;
        cin >> s >> t >> x;
        b.push_back(make_pair(s-x,make_pair(x,i+1)));
        b.push_back(make_pair(t-x,make_pair(x,-i-1)));
    }
    rep(i,q){
        int d;
        cin >> d;
        b.push_back(make_pair(d,make_pair(inf,0)));
    }
    sort(b.begin(),b.end());
    rep(i,2*n+q){
        int e=b.at(i).first,r=b.at(i).second.first,rr=b.at(i).second.second;
        // cout << e << " " << r << " " << rr << endl;
        if (r==inf){
            int qq=query(0,n+1,0,0,n+1);
            if (qq==inf) cout << -1 << endl;
            else cout << qq << endl;
        }
        else{
            if (rr>0) update(rr,r);
            else update(-rr,inf);
        }
    }
}

Measured memory_bytes: 18540
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    count = 0
    for a in range(n if n < x else x, 2, -1):
        for b in range(a-1, 1, -1):
            if a + b > x:
                continue
            for c in range(b-1, 0, -1):
                s = a + b + c
                if s == x:
                    count += 1
                    break
                elif s < x:
                    break
    print(count)

Measured memory_bytes: 6720
s=gets.chomp
n=gets.chomp
na=s.size-n.size
max=n.size
for i in 0..na
  sum=0
  for j in 0...n.size
    if s[i+j]!=n[j]
      sum+=1
    end
  end
  max=[max,sum].min
end
puts max


Measured memory_bytes: 14320
// Aizu Vol-1 0194: Delivery Company
// 2017.8.28 bal4u@uu
// 2017.11.5 retry

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX 20
#define QMAX 100000
int H, V, D;
int light[MAX+2][MAX+2];
char rc[MAX+2][MAX+2][MAX+2][MAX+2];
int jam[MAX+2][MAX+2][MAX+2][MAX+2];
int s[2], g[2];
int time[MAX+2][MAX+2][102][4];
#define E 0
#define N 1
#define W 2
#define S 3

typedef struct { int h, v, t, d; } QUE;
QUE Q[QMAX+3], *top, *end, *qmax = Q+QMAX;

int m[4][4] = { {-1,0,N,S}, {1,0,S,N}, {0,1,E,W}, {0,-1,W,E} };

int available(int t, int ha, int va, int hf, int vf)
{
	int ns, T, odd;
	if ((T = light[ha][va]) == 0) return 1;
	ns = (vf == va), odd = (t/T) & 1;
	if (ns && odd) return 0;
	if (!ns && !odd) return 0;
	return 1;
}

int getHV(char *p, int *h)
{
	int k;
	*h = *p - 'a' + 1, p += 2;
	k = *p++ & 0xf;
	if (*p >= '0') k = (k<<3) + (k<<1) + (*p & 0xf);
	return k;
}

int main()
{
	int n, k, h1, v1, h2, v2, t1, t2, d1, d2;
	char b1[10], b2[10];

	while (scanf("%d%d", &H, &V) && H > 0) {
		memset(light, 0, sizeof(light)), memset(rc, 0, sizeof(rc));
		memset(jam, 0, sizeof(jam)), memset(time, 0, sizeof(time));
		scanf("%d%d", &D, &n); while (n-- > 0) {
			scanf("%s%d", b1, &k);
			v1 = getHV(b1, &h1), light[h1][v1] = k;
		}
		scanf("%d", &n); while (n-- > 0) {
			scanf("%s%s", b1, b2);
			v1 = getHV(b1, &h1), v2 = getHV(b2, &h2);
			rc[h1][v1][h2][v2] = rc[h2][v2][h1][v1] = 1;
		}
		scanf("%d", &n); while (n-- > 0) {
			scanf("%s%s%d", b1, b2, &k);
			v1 = getHV(b1, &h1), v2 = getHV(b2, &h2);
			jam[h1][v1][h2][v2] = jam[h2][v2][h1][v1] = k;
		}
		scanf("%s%s", b1, b2);
		s[1] = getHV(b1, s), g[1] = getHV(b2, g);	// start, goal

		top = end = Q;
		end->h = s[0], end->v = s[1], end->t = 0, end->d = E, end++;
		while (top < end) {
			h1 = top->h, v1 = top->v, t1 = top->t, d1 = top->d, top++;
//			printf("(%d,%d), t %d, d %d\n", h1, v1, t1, d1);
			for (k = 0; k < 4; k++) {
				h2 = h1+m[k][0], v2 = v1+m[k][1], d2 = m[k][2];
				if (h2 <= 0 || h2 > H || v2 <= 0 || v2 > V || d1 == m[k][3]) continue;
				if (rc[h1][v1][h2][v2]) continue;
				if ((t2 = t1 + D + jam[h1][v1][h2][v2]) > 100) continue;
				if (!available(t2, h2, v2, h1, v1)) continue;
				if (time[h2][v2][t2][d2]) continue;
				time[h2][v2][t2][d2] = 1;
				end->h = h2, end->v = v2, end->t = t2, end->d = d2, end++;
			}
		}
		for (t1 = 0; t1 <= 100; t1++) for (d1 = 0; d1 < 4; d1++) {
			if (time[g[0]][g[1]][t1][d1]) { printf("%d\n", t1); t1 = 101; break; }
		}
	}
	return 0;
}

Measured memory_bytes: 4612
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


vector <vector <int> > edge;
vector <int> used, cnt;
inline void dfs (int v, int cl) {
    ++cnt[cl];
    used[v] = cl;
    for (auto &i : edge[v]) {
        if (!used[i]) dfs(i, cl);
    }
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    int a, b;
    edge.resize(n);
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        --a, --b;
        edge[a].pb(b);
        edge[b].pb(a);
    }
    used.assign(n, 0);
    cnt.assign(n, 0);
    int c = 1, ans = 0;
    for (int i = 0; i < n; i++) {
        if (!used[i]) {
            dfs(i, c);
            umax(ans, cnt[c]);
            ++c;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 21904
#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    int a[50];
    int b[50];
    int c[50] = {0};
    cin >> N;
    cin >> M;
    for(int i = 0;i < M; i++){
        cin >> a[i];
        cin >> b[i];
    }
    for(int i = 0;i < M; i++){
        for(int j = 1; j <= N;j++){
            if(a[i] == j || b[i] == j){
                c[j] += 1;
            }
        }
    }

    for(int i = 1;i <=N;i++){
        cout << c[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>   
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;
const ll inf = (ll)3e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, k;
bitset <10002> can[2002];
pii f[2][10002];
string s[2002];

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> k;
   for (int i = 1; i <= n; i ++) cin >> s[i];
   can[n + 1][0] = 1;
   for (int i = n; i >= 1; i --) can[i] = can[i + 1] | (can[i + 1] << sz (s[i]));
   int sz = 0;
   for (int i = 1; i <= n; i ++) {
      if (can[i + 1][k - sz (s[i])])
         f[1][++ sz] = {i, 0};  
   } 
   for (int i = 1; i <= k; i ++) {
      char c = 'z';
      bool ch = (i & 1);
      for (int j = 1; j <= sz; j ++)
         c = min (c, s[f[ch][j].F][f[ch][j].S]);
      cout << c;
      int id = n;
      int new_sz = 0;
      for (int j = 1; j <= sz; j ++) {
         if (s[f[ch][j].F][f[ch][j].S] != c) continue;
         if (f[ch][j].S + 1 == sz (s[f[ch][j].F])) id = min (id, f[ch][j].F);
         else f[(ch ^ 1)][++ new_sz] = {f[ch][j].F, f[ch][j].S + 1}; 
      }            
      for (int j = id + 1; j <= n; j ++) {
         if (k - sz (s[j]) - i >= 0 && can[j + 1][k - sz (s[j]) - i]) {
            f[(ch ^ 1)][++ new_sz] = {j, 0};
         }
      }
      sz = new_sz;
   }

}                                     

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
// cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}


Measured memory_bytes: 3840
#include<bits/stdc++.h> 
using namespace std;
typedef long long llong;
llong a,b,c;
llong f(llong x){
	if(x>=0) return x;
	else return -x;
}
int main()
{
	scanf("%lld%lld%lld",&a,&b,&c);
	if(a%2==0||b%2==0||c%2==0){
		printf("%lld\n",0);
	}
	else {
		llong a1=a/2,a2=a-a1;
		llong s1=a1*b*c, s2=a2*b*c;
		llong b1=b/2,b2=b-b1;
		llong s3=a*b1*c, s4=a*b2*c;
		llong c1=c/2,c2=c-c1;
		llong s5=a*b*c1, s6=a*b*c2;
		llong ans1 = f(s1-s2),ans2=f(s3-s4),ans3=f(s5-s6);
		cout<<min(min(ans1,ans2),ans3)<<"\n";
	}
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;

/* --------------------------------------------------- */

int main() {
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3552
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n,k;
    cin >> n >> k;
    int p[n];
    rep(i,n)cin >> p[i];
    sort(p,p+n);
    int ans = 0;
    rep(i,k)ans += p[i];
    cout << ans << endl;
}

Measured memory_bytes: 3192
#include<stdio.h>
int main(){
    char buf;
    scanf("%s",&buf);
    if(buf=='A'){printf("T\n");}
    if(buf=='T'){printf("A\n");}
    if(buf=='C'){printf("G\n");}
    if(buf=='G'){printf("C\n");}
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main() {
  int N,n=0;
  string S;
  cin >> N >> S;
  for(int i=0;i<S.size();i++){
      n = S[i] - 'A';
      n = (n+N)%26;
      S[i] = 'A' + n;
  }

  cout << S;
}

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#include<tgmath.h>
#include<stdlib.h>
#include<assert.h>
#include<stdio.h>



#define ll long long
#define MAX_N 300001

/*
_
_._ _..._ . - ',     _.._(`))
'-. `     ' / -._. - '    ', /
)         \            '.
/ _    _ | \
| a    a    /              |
\   . - .;
'-('' ).-', '       ;
'-;           |      .'
\           \    /
| 7.__  _. - \   \
| |  |  ``/ / `  /
/, _|  |   /, _/   /
/, _ / '`-'
*/
using namespace std;




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

	vector<vector<int> > adjList(n+1);


	int ele,i;
	for (i = 2; i <= n; ++i) {
		cin >> ele;
		adjList[ele].push_back(i);
	}

	for (i = 1; i <= n; ++i) {
		cout << adjList[i].size() << "\n";
	}
}

	

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

int main(){
    int N, maxNum=0, maxNum2=0;
    long long ans=0, tmp;
    cin >> N;
    vector<int> a(N+1), b(N+1);
	
    for(int i=0; i<N+1; i++){
	cin >> a[i];
    }
    for(int i=0; i<N; i++){
	cin >> b[i];
    }


    for(int i=0; i<N; i++){
	tmp = a[i]+a[i+1];
	if(tmp <= b[i]){
	    ans += tmp;
	    a[i+1] = 0;
	}
	else{
	    ans += b[i];
	    if(a[i+1] <=  tmp -b[i])
		a[i+1] = a[i+1];
	    else
		a[i+1] = tmp -b[i];		
	}
    }

    cout << ans << endl;
}





Measured memory_bytes: 1024
import Text.Printf

ans :: Int -> Int -> [(String,Int)] -> [(String,Int)] -> IO()
ans q t [] [] = return ()
ans q t [] tq = ans q t (reverse tq) []
ans q t iq@(i:is) tq =
  let (n,t') = i
  in
    if t' > q
    then ans q (t+q) is ((n,t'-q):tq)
    else do
      printf"%s %d\n" n (t+t')
      ans q (t+t') is tq

main = do
  l <- getLine
  c <- getContents
  let [n,q] = map read $ words l :: [Int]
      i = map (\[n, t] -> (n, read t)) $ map words $ lines c :: [(String,Int)]
  ans q 0 i []

Measured memory_bytes: 14432
#include<stdio.h>

int main() {
	int n;
	long long h[100000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", h + i);
	}
	
	int ans = 0;
	int move = 0;
	for (int i = 0; i < n - 1; i++) {
		if (h[i] >= h[i + 1]) move++;
		else move = 0;
		if (move > ans) ans = move;
	}

	printf("%d", ans);
}

Measured memory_bytes: 896
#include <stdio.h>

int main(void)
{
	int a, b;
	int sum;
	int ans;
	
	while (scanf("%d %d", &a, &b) != EOF){
		sum = a + b;
		ans = 0;
		
		while (sum){
			ans++;
			sum /= 10;
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}

Measured memory_bytes: 1028
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<sstream>
#include<math.h>
#include<iomanip>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
typedef long double ld;
int main() {
	string s;
	cin >> s;
	string a[7] = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
	int ans = 0;
	if (s == a[0])ans = 7;
	else if (s == a[1])ans = 6;
	else if (s == a[2])ans = 5;
	else if (s == a[3])ans = 4;
	else if (s == a[4])ans = 3;
	else if (s == a[5])ans = 2;
	else if (s == a[6])ans = 1;
	cout << ans << endl;
	return 0;
}

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

using namespace std;


int main(void){

    int x;
    cin >> x;
    
    int sum = 0;
    for(int i=1; i<1000000000; i++) {
        sum += i;
        if(sum>=x) {
            cout << i << endl;
            return 0;
        }
    }


    return 0;
}


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

int main(){
  int i,j,v,k,N;
  int *A;
  scanf("%d",&N);
  A = (int *)malloc(sizeof(int)*N);
  for(k=0;k<N;k++){
    scanf("%d",&A[k]);
  }
   printf("%d",A[0]);
    for(k=1;k<N;k++) printf(" %d", A[k]);
    printf("\n");
  for(i=1;i<=N-1;i++){
    v = A[i];
    j = i - 1;
    while (j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
    }
    printf("%d",A[0]);
    for(k=1;k<N;k++) printf(" %d", A[k]);
    printf("\n");
  }
  
  return 0;
}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int w,h;
string s[77];

string bigger(string s1,string s2){
	if(s1.length()>s2.length())return s1;
	else if(s1.length()<s2.length())return s2;
	else if(s1>s2)return s1;
	else return s2;
}

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>w>>h;
		if(w==0)break;
		rep(i,h)cin>>s[i];
		string res="";
		string dp[77][77];
		rep(i,h)rep(j,w){
			string ss=bigger(dp[i+1][j],dp[i][j+1]);
			if(!isdigit(s[i][j])||(s[i][j]=='0'&&ss==""))continue;
			dp[i+1][j+1]=ss+s[i][j];
			res=bigger(res,ss+s[i][j]);
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 3320