akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
using namespace std;
#define int long long int

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

signed main() {
  int N, M, K; cin >> N >> M >> K;
  vector<int> A(N), B(M); cin >> A >> B;
  int La = A.size(), Lb = B.size();

  int b = 0;
  int ta = 0, tb = 0;
  for (b = 0; b < Lb; ++b) {
    if (tb + B[b] > K) break;
    tb += B[b];
  }

  int cnt_max = b;
  for (int a = 1; a <= La; ++a) {
    ta += A[a-1];
    while (ta + tb > K && b > 0) {
      tb -= B[b-1]; --b;
    }
    if (ta + tb > K) break;
    cnt_max = max(cnt_max, a + b);
  }
  cout << cnt_max << endl;
  return 0;
}


Measured memory_bytes: 6428
#include<stdio.h>

int main(){

  int i,j,l,num,u,k,v,mat[100][100]={0};
  
  scanf("%d",&num);
  
  for(i = 1; i <= num; i++){
    scanf("%d %d",&u,&k);
    for(j = 1;j <= k; j++){
      
      scanf("%d",&v);
      mat[u-1][v-1]=1;
    
    }
  }  






  
  for(i = 0; i < num; i++){
    for(j = 0;j < num-1; j++){
      printf("%d ",mat[i][j]);
      
    }
    printf("%d\n",mat[i][j]);
  }

  return 0;

}

Measured memory_bytes: 648
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
h,w = map(int,input().split())
S = [input() for _ in range(h)]


avail = [[True]*w for _ in range(h)]


def search(i,j,data):
    if S[i][j] == "#":
        data[0] += 1
    else:
        data[1] += 1
    avail[i][j] = False

    if i+1 < h and S[i+1][j] != S[i][j] and avail[i+1][j]:
        search(i+1,j,data)
    if j+1 < w and S[i][j+1] != S[i][j] and avail[i][j+1]:
        search(i,j+1,data)
    if i > 0 and S[i][j] != S[i-1][j] and avail[i-1][j]:
        search(i-1,j,data)
    if j > 0 and S[i][j] != S[i][j-1] and avail[i][j-1]:
        search(i,j-1,data)

ans = 0
for i in range(h):
    for j in range(w):
        if avail[i][j]:
            data = [0,0]
            search(i,j,data)
            ans+= data[0]*data[1]
            #print(data,i,j)

print(ans)

Measured memory_bytes: 146672
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define swap(p,q) r=(p);(p)=(q);(q)=r
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007//10^9+7
#define PI acos(-1)

using namespace std;


int main(void)
{
	//変数の宣言
	int n;
	int a[200010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	ll int temp,temp1,temp2;
	int max,min;
	int len;
	ll int sum=0;



	//データの読み込み


	scanf("%d",&n);
//	scanf_s("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
//		scanf_s("%d",&a[i]);
	}

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	for(i=0;i<n;i++){
		sum=sum+a[i];
	}

	temp=0;
	ans=INF;
	for(i=0;i<n-1;i++){
		temp=temp+a[i];
		ans=min(ans,abs(sum-temp*2));
	}

	//	printf("計算部分終了\n");

	//出力

	printf("%lld",ans);

	//	printf("結果の出力終了\n");


	return 0;
}



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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll K; cin >> K;
  ll N = 50;
  ll m = K / N;
  ll r = K % N;
  ll lev = N-1 + m;
  vector<ll> vec(N, lev);
  for (ll i = 0; i < r; i++) {
    vec.at(i) += N;
    for (ll j = 0; j < N; j++) {
      if (j == i) continue;
      vec.at(j)--;
    }
  }
  cout << N << endl;
  for (ll i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << vec.at(i);
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[105][100005];
int main(){
	ll i,j,n,we,sum=0,MAX=1e18;
	cin>>n>>we;
	ll v[n],w[n];
	for(i=0;i<n;i++){
		cin>>w[i];
		cin>>v[i];
		sum+=v[i];
	}
	ll ans=0,val=0;
	for(i=0;i<=n;i++){
		for(j=0;j<=sum;j++){
			dp[i][j]=MAX;
		}
	}
	dp[0][0]=0;
	for(i=1;i<=n;i++){
		for(j=0;j<=sum;j++){
			if(j>=v[i-1] && dp[i-1][j-v[i-1]]!=MAX){
				dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1]);
			}
			else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}
	for(i=0;i<=sum;i++){
		if(dp[n][i]<=we){
			ans=max(ans,i);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 80256
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<cstring>
using namespace std;
const int N=2e5 + 10;
int a[N];
int main(){
	int n ;
	cin >> n ;
	for(int i = 1;i<n;i++)
	{
	    int t ;
	    cin >> t;
	    a[t]++;
	    
	}
	for(int i = 1;i <= n;i++)
	 cout<<a[i]<<endl;
	 return 0 ;
}

Measured memory_bytes: 4400
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <utility>
#include <map>
#include <functional>
#include <initializer_list>
#include <string>
using namespace std;

typedef long long int ll;

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> A;
    for(int i=1 ; i*i <=M; i++){
        if(M%i==0){
            A.push_back(i);
            if(M/i != i){
                A.push_back(M/i);
                }
            }
        }
    sort(A.begin(), A.end());
    auto ite = lower_bound(A.begin(), A.end(), N);
    int n = *ite;
    cout << M/n;


}

Measured memory_bytes: 256
s = input()
n = len(s)
a = [0]*(n+1)
yama = []
tani = []

for i in range(n):
	if s[i] == '<':
		a[i+1] = a[i] + 1

for i in range(n)[::-1]:
	if s[i] == '>':
		a1 = a[i+1] + 1
		if i != 0:
			if s[i-1] == '<':
				a[i] = max(a[i], a1)
			else:
				a[i] = a1
		else:
			a[i] = a1

ans = sum(a)
print(ans)

Measured memory_bytes: 23336
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        Arrays.sort(array);
        
        long[] cumsum = new long[n];
        cumsum[0] = array[0];
        for (int i = 1; i < n; i++) {
            cumsum[i] += array[i] + cumsum[i - 1];
        }
        
        int count = 0;
        for (int i = n - 1; i >= 1; i--) {
            if (cumsum[i - 1] * 2 < array[i]) {
                count = i;
                break;
            }
        }
        
        System.out.println(n - count);
    }
}


Measured memory_bytes: 50428
#include <iostream>
#include <vector>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++) 

int main() {
    int n, m;
    cin >> m;
    n = m%10;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
        cout << "hon" << endl;
    }
    else if(n == 0 || n == 1 || n ==6 || n == 8) {
        cout << "pon" << endl;
    }
    else {
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
roman = {'I':1, 'V':5, 'X':10, 'L':50,'C':100, 'D':500,'M':1000}
while True:
    try:
        p = list(input())
    except:
        break
    ans = i = 0
    while i <len(p):
        if i+1 < len(p) and roman[p[i]] < roman[p[i+1]]:
            ans = ans + roman[p[i+1]] - roman[p[i]]
            i += 1
        else:
            ans += roman[p[i]]
        i += 1
    print(ans)

"""
roman = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M': 1000}

while True:
	try:
		p = list(input())
	except EOFError:
		break
	ans = i = 0
	while i < len(p):
		if i+1 < len(p) and roman[p[i]] < roman[p[i+1]]:
			ans += roman[p[i+1]] - roman[p[i]]
			i += 1
		else: ans += roman[p[i]]
		i += 1
	print(ans)
"""


Measured memory_bytes: 5568
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxN = 1e5 + 5;
int x[maxN], y[maxN], t[maxN], N;

int myabs(int num) {
	return (num < 0) ? -num : num;
}

int main() {
	scanf("%d", &N);
	for(int i = 1; i <= N; ++i) scanf("%d%d%d", &t[i], &x[i], &y[i]);
	bool flag = 1;
	for(int i = 1; i <= N; ++i) {
		int tmp = myabs(x[i] - x[i - 1]) + myabs(y[i] - y[i - 1]);
		int d = t[i] - t[i - 1];
		flag &= ((tmp <= d) && ((d - tmp) % 2 == 0));
	}
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

const int M = 1e6 + 1;

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

    int n;
    cin >> n;
    int occurences[M] = {}, ans = 0;

    while (n--) {
        int x;
        cin >> x;
        occurences[x]++;
    }

    for (int i = 1; i <= M; i++)
        if (occurences[i])
            for (int j = i + i; j <= M; j += i)
                occurences[j] = 0;
    for (int x : occurences)
        ans += (x == 1);

    cout << ans << '\n';
}


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

int main(void) {
    int a, b;
    string s;
    cin >>a >> b >> s;
    string ret = "Yes";
    for (int i = 0; i < a; i++ ) {if (s.at(i) == '-') {ret = "No";}}
    if (s.at(a) != '-') {ret = "No";}
    for (int i = 0; i < b; i++ ) {if (s.at(i+a+1) == '-') {ret = "No";}}
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000
#define MAX 200001
#define PI 3.141592653589793

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

struct SegmentTree{
private:
    int n;
    vector<int> node;

public:
    SegmentTree(vector<int> v){
        int sz = v.size();
        n = 1; while(n < sz) n*=2;
        node.resize(2*n-1, -INF);

        for(int i = 0; i < sz; i++) node[i+n-1] = v[i];
        for(int i = n-2; i >= 0; i--) node[i] = max(node[2*i+1], node[2*i+2]);
    }

    void update(int x, int val){
        x += (n-1);

        node[x] = val;
        while(x > 0){
            x = (x-1) / 2;
            node[x] = max(node[2*x+1], node[2*x+2]);
        }
    }
    
    int getmax(int a, int b, int k = 0, int l = 0, int r = -1){
        if(r <0) r = n;
        if(r <= a || b <= l) return -1000000000;
        if(a <= l && r <= b) return node[k];
        
        int vl = getmax(a,b,2*k+1,l,(l+r)/2);
        int vr = getmax(a,b,2*k+2,(l+r)/2,r);
        return max(vl,vr); 
    }
};

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<int> dp(300005,0);
    dp[A[0]] = 1;
    SegmentTree st(dp);
    rep(i,N-1){
        int now = A[i+1];
        int cnt = st.getmax(A[i+1]-K, A[i+1]+K+1);
        st.update(A[i+1],cnt+1);
    }
    int ans = st.getmax(0,300005);
    cout << ans << endl;
}

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

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


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
s = input()
n = len(s)

for i in range(n-1):
    if s[i]==s[i+1]:
        print(i+1,i+2)
        exit()

for i in range(n-2):
    if s[i]==s[i+1] or s[i+1]==s[i+2] or s[i]==s[i+2]:
        print(i+1, i+3)
        exit()

print(-1,-1)


Measured memory_bytes: 3188
#include <stdio.h>


  /* 配列の要素を交換する */
void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}
  /* 配列の要素を交換する */
void Swap_l(long x[ ], int i, int j)
{
    long temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}
/* クイックソートを行う */
void QSort(long x[ ], int y[], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap_l(x, i, j);             /* x[i] と x[j]を交換 */
        Swap(y, i, j);
        i++;                       /* 次のデータ */
        j--;
    }
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, y,left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, y,j + 1, right);    /* 右の配列を Q ソートする */
}



int main() {
  int n,m;
  scanf("%d %d", &n, &m);
  long a[n];
  int b[n];
  int i,j;
  long tmp,sum,money;
  for(i=0;i<n;i++){
    scanf("%ld %d", &a[i], &b[i]);
  }
  
  QSort(a, b, 0, n-1);
  sum = 0;
  money = 0;
  for (i=0; i<n; ++i) {
    if(m >= sum+b[i]){
      money += a[i]*b[i];
      sum += b[i];
    }
    else{
      money += (m-sum)*a[i];
      break;
    }
  }

  printf("%ld", money);
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int INF = 1 << 30;
const int dy[] = {-1, 0, 0, 1};
const int dx[] = {0, -1, 1, 0};
int n;
int l[55], t[55], r[55], b[55];
int f[210][210];
bool used[210][210];
int limX, limY;

bool contain(int y, int x) {
  return y > 0 && y < limY && x > 0 && x < limX;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n, n) {
    vector<int> vx, vy;
    for (int i = 0; i < n; i++) {
      cin >> l[i] >> t[i] >> r[i] >> b[i];
      vx.emplace_back(l[i]);
      vx.emplace_back(r[i]);
      vy.emplace_back(b[i]);
      vy.emplace_back(t[i]);
    }
    l[n] = -INF; t[n] = +INF;
    r[n] = +INF; b[n] = -INF;
    vx.emplace_back(-INF);
    vx.emplace_back(+INF);
    vy.emplace_back(-INF);
    vy.emplace_back(+INF);
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());
    vx.erase(unique(vx.begin(), vx.end()), vx.end());
    vy.erase(unique(vy.begin(), vy.end()), vy.end());

    map<int, int> zipx, zipy;
    for (int i = 0; i < vx.size(); i++) {
      zipx[vx[i]] = i * 2;
    }
    for (int i = 0; i < vy.size(); i++) {
      zipy[vy[i]] = i * 2;
    }
    fill_n((int*)f, 210*210, 0);
    fill_n((bool*)used, 210*210, false);
    for (int i = 0; i < n+1; i++) {
      for (int x = zipx[l[i]], y = zipy[b[i]]; x <= zipx[r[i]]; x++) f[y][x] = 1;
      for (int x = zipx[l[i]], y = zipy[t[i]]; x <= zipx[r[i]]; x++) f[y][x] = 1;
      for (int x = zipx[l[i]], y = zipy[b[i]]; y <= zipy[t[i]]; y++) f[y][x] = 1;
      for (int x = zipx[r[i]], y = zipy[b[i]]; y <= zipy[t[i]]; y++) f[y][x] = 1;
    }
    limY = zipy[INF]; limX = zipx[INF];

    int ans = 0;
    for (int i = 1; i < limY; i++) {
      for (int j = 1; j < limX; j++) {
        if (f[i][j] == 1 || used[i][j]) continue;
        ans++;
        used[i][j] = true;
        queue<pii> que;
        que.emplace(i, j);
        while (!que.empty()) {
          int y, x;
          tie(y, x) = que.front(); que.pop();
          for (int k = 0; k < 4; k++) {
            int ny = y + dy[k];
            int nx = x + dx[k];
            if (contain(ny, nx) && !used[ny][nx] && f[ny][nx] == 0) {
              used[ny][nx] = true;
              que.emplace(ny, nx);
            }
          }
        }
      }
    }
    cout << ans << endl;
  }  

  return 0;
}


Measured memory_bytes: 3340
#include <stdio.h>

int main(void)
{
	int H,W,h,w;
	while(1){
		scanf("%d %d",&H,&W);
		if (H==0 && W==0)
			break;
		for(h=0;h<H;h++){
			for(w=0;w<W;w++){	
				printf("#");
			}
			putchar('\n');
		}
		putchar('\n');
	}
	
	return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
using namespace std;
/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)

#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
//#define int long long

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1}; 

inline int in(){int x;std::cin>>x;return x;}

struct FAST {FAST(){cin.tie(0);ios::sync_with_stdio(false);}} Fast;

template <class X> void print(X hoge){ cout << hoge << '\n'; }
/*-------------------------------*/
/* }}} */ 

signed main(void)
{
  int d, a;
  int now = 90;
  double x = 0, y = 0;

  while (scanf("%d,%d", &d, &a), d || a) {
    x += d * cos(M_PI * now / 180.0);
    y += d * sin(M_PI * now / 180.0);

    now = (now - a + 360) % 360;
  }

  print((int)x);
  print((int)y);

  return (0);
}

Measured memory_bytes: 3440
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int a[]=new int[m];
        int b[]=new int[m+1];
        int fib[]=new int[n+2];
        fib[0]=0;
        fib[1]=1;
        for(int i=2;i<n+2;i++){
            fib[i]=fib[i-1]+fib[i-2];
            fib[i]%=1000000007;
        }
        int po=-1;
        for(int i=0;i<m;i++){
            a[i]=sc.nextInt();
            b[i]=a[i]-po-1;
            po=a[i];
        }
        b[m]=n-po;
        long ans=1;
        for(int i=0;i<m+1;i++){
            //System.out.println(b[i]);
            ans*=fib[b[i]];
            ans%=1000000007;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 48700
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main()
{
	int S, W;
	cin >> S >> W;
 
	if (S > W)
	{
		cout << "safe" << endl;
	}
	else
	{
		cout << "unsafe" << endl;
	}
 
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
	int a,b,d,r;
        double f;
        scanf("%d %d",&a,&b);
	r=a%b;
	d=(a-r)/b;
	f=1.0*a/b;
	printf("%d %d %f\n",d,r,f);
	return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(std::string S){
    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int c,b,a,re;
    string s,t,u;
    cin>>a>>b;
    if(a>9||a<1 ||b>9||b<1){
        cout<<-1<<endl;
    }
    else{
        cout<<a*b<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
 int N,a[100],res=5000000,cost=0;
 std::cin>>N;
 for(int i=0;i<N;i++){
	std::cin>>a[i];
	}
 for(int i=-100;i<=100;i++){
                cost = 0;
	for(int j=0;j<N;j++){
		cost = cost + (a[j]-i)*(a[j]-i);
		}
	if(cost<res){res=cost;} 
 }
	std::cout << (res) << std::endl;
}

Measured memory_bytes: 256
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if B > A:
    Dis = B - A
    VtoW = V - W
else:
    Dis = A - B
    VtoW = V -W

result = VtoW * T

if Dis <= result:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 9056
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
  
double dot(P a,P b){
  return real(b*conj(a));
}
  
double cross(P a,P b){
  return imag(b*conj(a));
}
  
double eps = 1e-8;
  
P crossPoint(L l,L m){
  double A = cross(l.second-l.first,m.second-m.first);
  double B = cross(l.second-l.first,l.second-m.first);
  if( fabs(A) < eps && fabs(B) < eps ) return m.first;
  else if(fabs(A) >= eps ) return m.first+B/A*(m.second-m.first);
  else P(0,0);
}
  
bool eq(double a,double b){
  return (-eps<a-b&&a-b<eps);
}
  
bool eq(P a,P b){
  return eq( abs(b-a) , 0 );
}
  
bool onSegment(L a,P p){
  return eq( abs(a.first-a.second) , abs(a.first-p)+abs(a.second-p) );
}
  
  
bool isParallel(L a,L b){
  if( abs(cross(a.first-a.second,b.first-b.second)) < eps ) return true;
  return false;
}
  
int n,m;
vector<P> G[100];
vector<P> t;
vector<L> u;
  
int check(P a,bool debug=false){
  
  
  
  int cnt=0;
  for(int i=0;i<m;i++){
    L v=L(a,t[i]);
    bool flg=true;
    for(int j=0;j<n;j++){
      int size=G[j].size();
      for(int k=0;k<size;k++){
        L w=L(G[j][k],G[j][(k+1)%size]);
        if(isParallel(v,w))continue;
        P p=crossPoint(v,w);
  
        if(eq(w.first,p))continue;
        if(eq(w.second,p))continue;
        if(eq(v.first,p))continue;
        if(eq(v.second,p))continue;
        if(!onSegment(w,p))continue;
     
        if(onSegment(v,p)){
          flg=false;
        }
      }
    }
    if(flg)cnt++;
  }
  return cnt;
}
  
int solve(){
  
  if(n==0)return m;
  int res=0;
  for(int i=0;i<(int)u.size();i++){
    for(int j=0;j<i;j++){
      L a=u[i];
      L b=u[j];
  
      P target=crossPoint(a,b);
  
      if( isParallel(a,b) ) continue;
      res=max(res,check(target));
    }
  }
  return res;
}
  
int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++){
    double x,y;
    int L;
    cin>>L;
    G[i].resize(L);
    for(int j=0;j<L;j++){
      cin>>x>>y;
      G[i][j]=P(x,y);
    }
  }
  for(int i=0;i<m;i++){
    double x,y;
    cin>>x>>y;
    t.push_back(P(x,y));
  }
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<(int)G[j].size();k++){
        u.push_back(L(t[i],G[j][k]));
      }
    }
  }
  
  cout<<solve()<<endl;
  return 0;
}

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  double X[8];
  double Y[8];
  cin >> N;
  REP(i, N) {
    cin >> X[i];
    cin >> Y[i];
  }

  double sum = 0.0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      sum +=
          sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]));
    }
  }
  cout << setprecision(20) << sum * 2 / N << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b; cin >> a >> b;
    if (b < a) --a;
    cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;

ll a[111111];
ll b[111111];
ll c[111111];
vector<pair<ll,ii> > vec;

bool cmp(const pair<ll,ii> &a,const pair<ll,ii> &b)
{
	if(a.se.fi-a.se.se!=b.se.fi-b.se.se) return (a.se.fi-a.se.se>b.se.fi-b.se.se);
	else return (a.fi<b.fi);
}

struct PBDS
{
	tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> t;
	int timer;
	
	PBDS(){timer = 0;}
	void insert(int x)
	{
		t.insert(mp(x, timer));
		timer++;
	}
	
	int lower(int x)
	{
		return t.order_of_key(ii(x, -1));
	}
	
	void del(int x) //make sure x exists
	{
		ii tmp = (*t.find_by_order(lower(x)));
		t.erase(tmp);
	}
	
	int higher(int x)
	{
		int tmp = lower(x+1);
		return (int(t.size()) - tmp);
	}
	
	ll get(int x) //gets x-th highest
	{
		int idx = int(t.size()) - 1 - x;
		return (*t.find_by_order(idx)).fi;
	}
};

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int x,y,z; cin>>x>>y>>z;
	int n=x+y+z;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
		vec.pb(mp(a[i],mp(b[i],c[i])));
	}
	sort(vec.begin(),vec.end(),cmp);
	PBDS L,R;
	ll suml=0; ll sumr=0;
	ll ans=0;
	for(int i=0;i<y;i++)
	{
		L.insert(vec[i].se.fi-vec[i].fi);
		suml+=vec[i].se.fi;
	}
	for(int i=y;i<n;i++)
	{
		R.insert(vec[i].se.se-vec[i].fi);
		sumr+=vec[i].fi;
	}
	for(int i=0;i<z;i++) sumr+=R.get(i);
	ans=suml+sumr;
	for(int i=y;i<n;i++)
	{
		ans=max(ans,suml+sumr);
		if(R.t.size()<=z) break; //-1 => < z to pick from
		//Remove here
		suml+=vec[i].fi;
		sumr-=vec[i].fi;
		ll tmp = L.get(y-1);
		if(vec[i].se.fi-vec[i].fi>tmp)
		{
			L.insert(vec[i].se.fi-vec[i].fi);
			suml+=vec[i].se.fi-vec[i].fi;
			suml-=tmp;
			L.del(tmp);
		}
		tmp=R.get(z-1);
		ll tmp2=vec[i].se.se-vec[i].fi;
		if(tmp2<tmp)
		{
			R.del(tmp2);
		}
		else
		{
			R.del(tmp2);
			sumr-=tmp2;
			sumr+=R.get(z-1);
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 11888
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int x, t;
    cin >> x >> t;

    int ans = max(0, x - t);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MaxN = 2e5 + 7, Pt = 1e9 + 7;

ll fac[MaxN + 5], inv[MaxN + 5];

ll qwr(ll x, int y) {
	ll res = 1;
	while(y) {
		if(y & 1) res = res * x % Pt;
		y >>= 1;
		x = x * x % Pt;
	}
	return res;
}

ll C(int n, int m) {
	return fac[n] * inv[n - m] % Pt * inv[m] % Pt;
}


int main() {
	ll res = 1;
	fac[0] = 1;
	for(ll i = 1; i <= MaxN; i++) fac[i] = fac[i - 1] * i % Pt;
	inv[MaxN] = qwr(fac[MaxN], Pt - 2);
	inv[0] = 1;
	for(ll i = MaxN - 1; i >= 1; i--) inv[i] = inv[i + 1] * (i + 1) % Pt;
	int n, m;
	scanf("%d %d", &n, &m);
	int t = m;
	for(int i = 2; i * i <= m; i++) {
		if(t % i == 0) {
			int cnt = 0;
			while(t % i == 0) t /= i, cnt++;
			res = res * C(n + cnt - 1, n - 1) % Pt;
		}
	}
	if(t > 1) res = res * C(n, n - 1) % Pt;
	printf("%lld\n", res);
    return 0;
}

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

const ll MAXN = 200000;
const ll INF = 1001001001;

ll N, ans=0, tmp=0;
vector<ll> A;
char C;

signed main(){
    cin >> C;
    if (isupper(C))
    {
        cout << "A" << endl;
    }
    else
    {
        cout << "a" << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>

#define M 500000
#define MOD 1000000007

long long f[M + 1];
long long mf[M + 1];

inline long long p0w(const long long& n, const long long& k)
{
    if (k == 0) return 1ll;
    else if (k == 1) return n;
    else if (k & 1) return p0w(n, k - 1) * n % MOD;
    else
    {
        auto h = p0w(n, k >> 1);
        return h * h % MOD;
    }
}

inline long long comb(const long long& n, const long long& k)
{
    return f[n] * mf[n - k] % MOD * mf[k] % MOD;
}

int main()
{
    long long n, m;
    scanf("%lld %lld", &n, &m);
    f[0] = mf[0] = 1;
    for (int i = 1; i <= m; i++)
    {
        f[i] = f[i - 1] * i % MOD;
        mf[i] = p0w(f[i], MOD - 2);
    }
    /*long long r = 0;
    for (long long x = n; x >= 0 && 2 * n - x <= m; x--)
    {
        long long s = comb(m, x) * comb(m - x, n - x) % MOD * comb(m - n, n - x) % MOD;
        long long t = 0;
        for (long long y = 0; y <= x; y++)
        {
            long long u = comb(n, y) * comb(x, y) % MOD * f[y] % MOD * f[n - y] % MOD * f[n - y] % MOD;
            if (y & 1) t = (t + MOD - u) % MOD;
            else t = (t + u) % MOD;
        }
        r = (r + s * t % MOD) % MOD;
    }*/

    long long r = 0;
    for (long long x = 0; x <= n; x++)
    {
        long long t =
            comb(n, x) *
            comb(m, x) % MOD *
            f[x] % MOD *
            comb(m - x, n - x) % MOD *
            f[n - x] % MOD *
            comb(m - x, n - x) % MOD *
            f[n - x] % MOD;
        if (x % 2 == 0) r = (r + t) % MOD;
        else r = (r + MOD - t) % MOD;
    }
    printf("%lld\n", r);
    return 0;
}

Measured memory_bytes: 11524
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(1,n+1):
    l[i-1]=a[i-1]-i
l.sort()
ans=0
if n%2==1:
    for i in range(n):
        ans+=abs(l[i]-(l[n//2]))
    print(ans)
else:
    ans_1=0
    ans_2=0
    for i in range(n):
        ans_1+=abs(l[i]-(l[n//2-1]))
    for i in range(n):
        ans_2+=abs(l[i]-(l[n//2]))
    print(min(ans_1,ans_2))

Measured memory_bytes: 88532
n,t = map(int,input().split())
a = list(map(int,input().split()))
mn = a[0]
l = []
for i in range(n-1):
    if a[i] < a[i+1]:
        l.append(a[i+1]-mn)        
    if a[i+1] < mn:
        mn = a[i+1]
if len(l) > 0:
    d = max(l)
ans = l.count(d)
print(ans)


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

typedef long long ll;
int main() {
  ll n;
  cin >> n;
  if (n%2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  for (ll i = 1; i <= 26; ++i) {
    ll tmp = 2*pow(5, i);
    ll tmp2 = n / tmp;
    // cout << i << " " << tmp << " " << tmp2 << endl;
    ans += tmp2;
  }
  cout << ans << endl;
}



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

const int N = 555555, A = 1111111111;
ll n, a, b, c, d;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> a >> b >> c >> d;
    ll de = b - a;
    for(ll m = 0; m <= n - 1; m++) {
        ll l = (n - 1 - m) * c - m * d;
        ll r = (n - 1 - m) * d - m * c;
        if(l <= de && de <= r) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << " "
#define dumpL(x) cout << #x << " : " << x << '\n'
#define LINE cout << "line : " << __LINE__ << " "
#define LINEL cout << "line : " << __LINE__ << '\n'
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << " "
#define dumpVL(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) 
#define dumpL(x) 
#define LINE 
#define LINEL 
#define dumpV(v) 
#define dumpVL(v) 
#define STOP assert(false)
#endif
#define mp make_pair
 
namespace std {
template<class S, class T>
ostream &operator <<(ostream& out, const pair<S, T>& a) {
    out << '(' << a.fi << ", " << a.se << ')';
    return out;
}
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    deque<char> d;
    rep(i, s.size()) d.push_back(s[i]);
    int cur = 0;
    int q;
    cin >> q;
    rep(_, q) {
        int x;
        cin >> x;
        if(x == 1) {
            cur = !cur;
        }
        else {
            int f;
            char c;
            cin >> f >> c;
            --f;
            if(cur^f) d.push_back(c);
            else d.push_front(c);
        }
        // dump(cur);dumpVL(d);
    }
    if(cur) {
        repr(i, d.size()) cout << d[i];
    }
    else {
        rep(i, d.size()) cout << d[i];
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 976
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    ba = 0
    bb = 0
    for i in range(N):
        if a[i] > b[i]:
            ba += a[i] - b[i]
        if b[i] > a[i]:
            bb += (b[i] - a[i]) // 2

    if bb >= ba:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 10304
#include<stdio.h>
#include<stdlib.h>
int cmp(const int *a, const int *b){
  return *a - *b;
}
int main(){
  int n;
  scanf("%d",&n);
  int l[n];
  for(int i=0;i<n;i++)scanf("%d",&l[i]);
  qsort(l,n,4,cmp);
  int ans=0;
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;l[i]+l[j]>l[k]&&k<n;k++)ans++;
    }
  }
  printf("%d",ans);
}


Measured memory_bytes: 128
import java.util.*;

class Main{
	public static void main(String[] args){
		Hashtable<String, String> hash = hashFormat();
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String s = sc.nextLine();
			String code = "";
			for(int i = 0; i < s.length(); i++){
				code += tobyte(s.charAt(i));
			}
			System.out.println(decode(code, hash));
		}
		sc.close();
	}
	static String tobyte(char c){
		switch(c){
			case ' ':
				c = 'Z'+1;
				break;
			case '.':
				c = 'Z'+2;
				break;
			case ',':
				c = 'Z'+3;
				break;
			case '-':
				c = 'Z'+4;
				break;
			case '\'':
				c = 'Z'+5;
				break;
			case '?':		
				c = 'Z'+6;
				break;
		}
		String s = Integer.toBinaryString(c-'A');
		return String.format("%05d", Integer.valueOf(s));
	}
	static Hashtable<String, String> hashFormat(){
		Hashtable<String, String> h = new Hashtable<String, String>();
		h.put("101", " ");
		h.put("000000","\'");
		h.put("000011", ",");
		h.put("10010001", "-");
		h.put("010001", ".");
		h.put("000001", "?");
		h.put("100101", "A");
		h.put("10011010", "B");
		h.put("0101", "C");
		h.put("0001", "D");
		h.put("110", "E");
		h.put("01001", "F");
		h.put("10011011", "G");
		h.put("010000", "H");
		h.put("0111", "I");
		h.put("10011000", "J");
		h.put("0110", "K");
		h.put("00100", "L");
		h.put("10011001", "M");
		h.put("10011110", "N");
		h.put("00101", "O");
		h.put("111", "P");
		h.put("10011111", "Q");
		h.put("1000", "R");
		h.put("00110", "S");
		h.put("00111", "T");
		h.put("10011100", "U");
		h.put("10011101", "V");
		h.put("000010", "W");
		h.put("10010010", "X");
		h.put("10010011", "Y");
		h.put("10010000", "Z");
		return h;
	}
	static String decode(String s, Hashtable<String, String> hash){
		String decoded = "";
		while(s != ""){
			String tmp = "";
			while(tmp != null && !hash.containsKey(tmp)){
				if(s == ""){
					tmp = null;
				}else{
					tmp += s.charAt(0);
					if(s.length() > 1){
						s = s.substring(1, s.length());
					}else{
						s = "";
					}
				}
			}
			if(tmp != null){
				decoded += (String)hash.get(tmp);
			}
		}
		return decoded;
	}
}

Measured memory_bytes: 13000
import java.util.*;

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

	public Main() {
		//		n 馬車券
		//		m 都市数
		//		p 都市間道路
		//		a 出発地の都市番号
		//		b 目的地の都市番号    a!=b
		while(true){
			int n = in.nextInt(),m = in.nextInt(),p = in.nextInt(),a = in.nextInt(),b = in.nextInt();
			if(n+m+a+b+p==0)break;
			new AOJ1138().doIt(n, m, p, a, b);
		}
	}

	class AOJ1138{
		double kyori[][];
		int V;//頂点数
		int INF;

		void dijkstra(int s){
			INF = Integer.MAX_VALUE;
			kyori = new double[V][1 << n];
			for(int i=0;i<V;i++)Arrays.fill(kyori[i], INF);
			int bit = 0;
			for(int i=0;i<n;i++)bit += (1 << i);
			result = -1;
			PriorityQueue<State> q = new PriorityQueue<State>();
			kyori[s][bit] = 0;
			q.add(new State(0,s,bit));
			while(q.size()>0){
				State now = q.remove();
//				System.out.println(now.v+" "+now.d+" "+Integer.toBinaryString(now.bit));
				int v = now.v;
				bit = now.bit;
				if(v == b){
					result = now.d;break;
				}
				for(int i=0;i<V;i++)if(cost[now.v][i]>0){
					for(int k=0;k<n;k++)if((bit >> k)%2 == 1){
						double ncost = now.d+(double)(cost[now.v][i]/t[k]);
						if(kyori[i][bit-(1<<k)] <= ncost)continue;
						kyori[i][bit-(1<<k)] = ncost;
						q.add(new State(ncost,i,bit-(1<<k)));
					}
				}
			}
			System.gc();
		}
		
		class State implements Comparable<State>{
			int bit,v;
			double d;
			public State(double d,int v,int bit) {
				this.v = v;
				this.d = d;
				this.bit = bit;
			}
			public int compareTo(State o) {
				if(Math.abs(this.d - o.d) < 1.0e-8) return 0;
				else if(this.d>o.d)return 1;
				else return -1;
			}
		}
		
		double[] t;
		double[][] cost;
		int n,a,b;
		double result;
		void doIt(int n,int m,int p,int a,int b){
			this.n = n;this.a = a-1;this.b = b-1;this.V = m;
			t = new double[n];
			for(int i=0;i<n;i++)t[i] = in.nextInt();
			cost = new double[m][m];
			for(int i=0;i<p;i++){
				int from = in.nextInt()-1;
				int to = in.nextInt()-1;
				cost[from][to] = cost[to][from] = in.nextInt();
			}
			dijkstra(a-1);
			if(result < 0)System.out.println("Impossible");
			else System.out.println(result);
		}
	}

}

Measured memory_bytes: 36076
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<long> data(N), sub(N);
  for(int i = 0; i < N; i++){
    cin >> data.at(i);
  }
  long a = 0;
  for(int i = 0; i < N; i++){
    sub.at(i) = max(a, sub.at(i));
    a = max(data.at(i),a);
  }
  a = 0;
  for(int i = N - 1; i >= 0; i--){
    sub.at(i) = max(a, sub.at(i));
    a = max(data.at(i),a);
  }
  for(int i = 0; i < N; i++)cout << sub.at(i) << endl;
  return 0;
}

Measured memory_bytes: 4736
/*
  Sk arman Hossain
  University of Barisal

 Problem name : 1412 - Visiting Islands
 Algorithm : BFS
*/

#include<bits/stdc++.h>
#define nl printf("\n");
#define N 200001
#define PR pair<int,int>
#define sf(n) scanf("%d", &n)
#define sff(n, m) scanf("%d %d",&n,&m)
#define sfl(n) scanf("%lld", &n)
#define sfu(n) scanf("%llu", &n)
#define sffl(n, m) scanf("%lld %lld",&n,&m)
#define pfn(n) printf("%d\n",n)
#define pf(n) printf("%d ",n)
#define pfl(n) printf("%lld ",n)
#define pfln(n) printf("%lld\n",n)
#define pfu(n) printf("%llu\n",n)
#define pfs(s) printf("%s",s)
#define YES printf("YES\n")
#define NO printf("NO\n")
#define PB push_back
#define PI 3.1415926536
#define VST(v) sort(v.begin(),v.end())
#define fori(i,n) for(;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define MP make_pair
int dx[]= {0,0,1,-1};
int dy[]= {1,-1,0,0};
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
vector<int>edge[100010];
vector<PR>V;
int main(){

    int a,b;
    cin>>a>>b;
    if(b<2){
        printf("0\n");return 0;
    }
    if(a>=b){
        printf("%d\n",1);return 0;
    }
    int cnt=1;
    for(int i=a-1;;){
        if(i+a>=b){
            printf("%d\n",cnt+1);return 0;
        }
        i+=(a-1);
        cnt++;
    }



///*****************************  ALHAMDULILLAH  *****************************/
}


Measured memory_bytes: 2560
A, B, H, M = map(int,input().split())

import numpy as np
theta_h=2*np.pi*(H/12 + M/720)#rad
theta_m=2*np.pi*M/60#rad
theta=min((max(theta_h, theta_m)-min(theta_h, theta_m)), 2*np.pi-(max(theta_h, theta_m)-min(theta_h, theta_m)))
print(np.sqrt(A**2 + B**2 - 2*np.cos(theta)*A*B))

Measured memory_bytes: 27124
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)




int main(){
    ll A[3][3];
    ll N;
    for(ll i=0;i<3;i++){
    cin>>A[i][0]>>A[i][1]>>A[i][2];
    }

    cin>>N;

    vector<ll> b(N);
     for(ll i=0;i<N;i++){
    cin>>b[i];

  
    }

     for(ll i=0;i<N;i++){
 

    for(ll j=0;j<3;j++){
        for(ll k=0;k<3;k++){
            if(b[i]==A[j][k]){
                A[j][k]=-1;
            }
        }
    }
    }
ll ooo = 0;
    if(-3==A[0][0]+A[0][1]+A[0][2]){
        ooo=1;
    }
    if(-3==A[1][0]+A[1][1]+A[1][2]){
        ooo=1;
    }
    if(-3==A[2][0]+A[2][1]+A[2][2]){
        ooo=1;
    }

       if(-3==A[0][0]+A[1][0]+A[2][0]){
        ooo=1;
    }
      if(-3==A[0][1]+A[1][1]+A[2][1]){
        ooo=1;
    }
   
     if(-3==A[0][2]+A[1][2]+A[2][2]){
        ooo=1;
    }
   
   
if(A[0][0]+A[1][1]+A[2][2]==-3){
    ooo=1;
}

   
if(A[2][0]+A[1][1]+A[0][2]==-3){
    ooo=1;
}


if(ooo==0){
    cout<<"No"<<endl;
}
else{
    cout<<"Yes"<<endl;
}






}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <cctype>

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

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int compare(const string& a, const string& b){
    if(a.length() > b.length()){
        return 1;
    }
    if(a.length() < b.length()){
        return -1;
    }
    const int len = a.length();
    for(int i = 0; i < len; i++){
        if(a[i] > b[i]){
            return 1;
        }
        if(a[i] < b[i]){
            return -1;
        }
    }
    return 0;
}

int main(void) {
    string a, b;
    cin >> a >> b;

    int comp = compare(a, b);
    if(comp > 0){
        cout << "GREATER" << endl;
    }else if(comp < 0){
        cout << "LESS" << endl;
    }else{
        cout << "EQUAL" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// Problem : F - Knapsack for All Subsets
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 998244353
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long

void solve(){
    int n,s;
    cin>>n>>s;
    vi a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    vector<vi> dp(n+1,vi(s+1,0));
    dp[0][0] = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=s;j++){
            dp[i+1][j] = (dp[i+1][j]+2*dp[i][j])%mod;
            if(j+a[i] <= s) dp[i+1][j+a[i]] = (dp[i+1][j+a[i]]+dp[i][j])%mod;
        }
    }
    cout<<dp[n][s]<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int t;
    //cin>>t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 73652
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	A, B, _, K := ReadInt(), ReadInt(), ReadInt(), ReadInt()
	if K%2 == 1 {
		fmt.Println(B - A)
	} else {
		fmt.Println(A - B)
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    ll a;
    ld b;
    cin >> a >> b;
    ll bll = (ll)std::round(b*100);
    cout << a*bll/100 << endl;
}

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

int main(){
  
  string s;
  cin >> s;
  
  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  }
  
  if(s == "Cloudy"){
    cout << "Rainy" << endl;
  }
  
  if(s == "Rainy"){
    cout << "Sunny" << endl;
  }
  
}

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    
    if(a>b)
    {
        swap(a,b);
    }
    if(b>c)
    {
        swap(b,c);
    }
    if(a>c)
    {
        swap(a,c);
    }
    
    printf("%d",a+b);
}




Measured memory_bytes: 3212
#include<stdio.h>
int main (void)
{
  int n,a[101],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=(n-1);i>0;i--){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[0]);
  return 0;
}

Measured memory_bytes: 596