akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 1000000007
#define MAXN 200005
#define MAXH 4
#define MAXM 100
#define INF 1LL << 30
#define ll long long
#define ull unsigned long long
#define RNG mt19937
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
const int N = 100005;
int cnt[N];

int main(){
	fast_io();
	int n;cin >> n;
	cu(i,0,n){
		int x;cin >> x;
		fu(j,max(x-1,0),x+1){
			++cnt[j];
		}
	}
	int ans = 0;
	cu(i,0,N)gmax(ans, cnt[i]);
	cout << ans << '\n';
}


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

long long dfs(long long n) {
    long long ans = 0;
    if (n == 1) {
        ans++;
        return ans;
    }
    else {
        n /= 2;
        ans = dfs(n) * 2;
        ans++;
    }
    return ans;
}

int main() {
    long long n;
    cin >> n;
    cout << dfs(n) << endl;
	return 0;
}


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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

ll g[3010][3010];
ll dp[3010][3010][5]={};

int main(){
   int r,c,k; cin>>r>>c>>k;
   rep(i,0,k){
      int x,y; cin>>x>>y; x--; y--;
      int t; cin>>t;
      g[x][y]=t;
   }
   dp[0][0][0]=0;
   dp[0][0][1]=g[0][0];
   rep(i,0,r)rep(j,0,c){
      rep(ri,0,4){
         chmax(dp[i][j+1][ri],dp[i][j][ri]);
         chmax(dp[i+1][j][0],dp[i][j][ri]);
         if(g[i][j+1]!=0 and ri!=3){
            chmax(dp[i][j+1][ri+1],dp[i][j][ri]+g[i][j+1]);
         }
         if(g[i+1][j]!=0){
            chmax(dp[i+1][j][1],dp[i][j][ri]+g[i+1][j]);
         }
      }
   }
   ll res=0;
   rep(i,0,4)chmax(res,dp[r-1][c-1][i]);
   cout<<res<<endl;
   return 0;
}

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

signed main(){
    string x;cin>>x;
    int N=x.size();
    int S=0;
    REP(i,x.size()){
        if(x[i]=='S') S++;
        else if(S>0){
            N-=2;
            S--;
        }
    }
    cout<<N<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i = 0;i < (int)s.size();i++){
    if(s[i] == 'C'){
      for(int j = i + 1;j < (int)s.size();j++){
        if(s[j] == 'F'){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


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

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

	//三つの値から最大値を求める。
	int n = 1;
	if (n < a) n = a;
	if (n < b) n = b;
	if (n < c) n = c;

	cout << a + b + c - n << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

    int N = in.nextInt();

    boolean oddIncluded = false;

    for (int i = 0; i < N; i++) {
      if (in.nextInt() % 2 == 1) {
        oddIncluded = true;
      }
    }

    System.out.println(oddIncluded ? "first" : "second");

  }

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

  }

  public static long gcd(long a, long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
  }
}

Measured memory_bytes: 48584
/**
 *    author:  Mohamad Milhem
 *    created: 2020-03-23-17.40.52
**/

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)


int main(){

    FAST;


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

    long long justm = m*(m-1)/2.0;

    long long justn = n*(n-1)/2.0;

    cout << justm  + justn << endl;



    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long a = sc.nextLong();
    long b = sc.nextLong();
    long ans = (b - a) / 2;
    if(((b - a) % 2) == 1) ans = Math.min((a + (b - a - 1) / 2), (n - b + 1 + (b - a - 1) / 2)); 
    System.out.println(ans);
  }
}



Measured memory_bytes: 21844
/*****Here we go again!******/

#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

vi a(3005);
ll dp[3005][3005];

ll solve(int l, int r)
{
//    if(l > r)
//        return 0;
    if(l == r)
        return a[l];
    if(dp[l][r] != -inf64)
        return dp[l][r];
    return dp[l][r] = max(a[l] - solve(l+1,r), a[r] - solve(l,r-1));
}

int main()
{
    fast;
    int n;
    cin >> n;
    get(a,n);
    f(i,0,n)
        f(j,0,n)
            dp[i][j] = -inf64;

    cout << solve(0,n-1);
}


Measured memory_bytes: 74220
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using lint = long long;
using ldouble = long double;

void solve() {
    std::string s, t, u;
    int a, b;
    std::cin >> s >> t >> a >> b >> u;
    (u == s ? a : b)--;
    std::cout << a << " " << b << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
def to(A,B,C):
    N=len(A)
    t=B[N-1]
    for i in range(N-1):
        t+=B[i]
        if A[i+1]==A[i]+1:
            t+=C[A[i]-1]
    return t
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
print(to(A,B,C))

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

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

#define MAX_P 200005
Int fact[MAX_P],inv[MAX_P],finv[MAX_P];

void init(Int mod){
  fact[0]=1;
  for(Int i=1;i<MAX_P;i++)
    fact[i]=(fact[i-1]*i)%mod;

  inv[1]=1;
  for(Int i=2;i<MAX_P;i++)
    inv[i]=inv[mod%i]*(mod-mod/i)%mod;
  
  finv[0]=1;
  for(Int i=1;i<MAX_P;i++)
    finv[i]=finv[i-1]*inv[i]%mod;
}

//only for prime mod
Int mod_comb3(Int n,Int k,Int mod){
  if(k<0||k>n) return 0;
  return fact[n]*finv[k]%mod*finv[n-k]%mod;
}

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;

  const Int MOD=924844033;
  init(MOD);
  
  auto dp=make_v<Int>(2,n*2+1,1);
  dp[1][0][0]=1;
  
  auto cnt=make_v<Int>(n*2+1,0);
  
  for(Int i=1;i<=n*2;i++){
    Int m=i/2+1;
    dp[0][i].assign(m,0);
    dp[1][i].assign(m,0);
    cnt[i].assign(m,0);
    for(Int j=0;j<m;j++){
      if(j<(Int)dp[0][i-1].size()){
	dp[0][i][j]+=dp[0][i-1][j];
	dp[0][i][j]+=dp[1][i-1][j];
      }
      if(j) dp[1][i][j]+=dp[0][i-1][j-1];
      
      dp[0][i][j]%=MOD;
      dp[1][i][j]%=MOD;
      cnt[i][j]=(dp[0][i][j]+dp[1][i][j])%MOD;
      
      //cout<<i<<" "<<j<<":"<<dp[0][i][j]<<" "<<dp[1][i][j]<<endl;
    }
  }

  vector<Int> dp2(n+1,0);
  dp2[0]=1;
  
  for(Int i=0;i<min(n,k*2);i++){
    Int m=(n-i+k*2-1)/(k*2);
    Int j=i+(m-1)*(k*2);

    m=m*2-1;
    if(i-k>=0) m++;
    if(j+k< n) m++;

    //cout<<m<<endl;
    
    vector<Int> nxt(n+1,0);
    for(Int a=0;a<(Int)cnt[m].size();a++){
      //cout<<m<<" "<<a<<":"<<cnt[m][a]<<endl;
      for(Int b=0;a+b<=n;b++){
	nxt[a+b]+=cnt[m][a]*dp2[b]%MOD;
	nxt[a+b]%=MOD;
      }	
    }
    swap(dp2,nxt);
  }

  Int ans=0;
  for(Int i=1;i<=n;i++){
    //cout<<i<<" "<<dp2[i]<<endl;
    
    if(i&1) ans+=dp2[i]*fact[n-i]%MOD;
    else ans+=MOD-dp2[i]*fact[n-i]%MOD;
    ans%=MOD;
  }
  ans=fact[n]+MOD-ans;
  ans%=MOD;
  cout<<ans<<endl;
  return 0;
}


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

ans = 0

for i in range(n):
    if not (i+1 == n):
        tmpA = b[i]
    
        if i-1 >= 0:
            tmpB = b[i-1]
            
            if tmpA > tmpB:
                ans += tmpB
            else:
                ans += tmpA
                
        else:
            ans += tmpA
    else:
        ans += b[i-1]
    
print(ans)
    
    
    

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

int main()
{
    int k;
    cin >> k;
    int cnt = 0;
    vector<string> v;
    rep(i,9){
        v.push_back(to_string(i + 1));
    }
    vector<string> v2 = v;
    while (v.size() <= k)
    {
        vector<string> tmp;
        for (auto e : v2)
        {

            if(e[e.size()-1]=='0'){
                tmp.push_back(e + '0');
                tmp.push_back(e + '1');
            }else if(e[e.size()-1]=='9'){
                tmp.push_back(e+'8');
                tmp.push_back(e + '9');
            }else{
                tmp.push_back(e + (char)(e[e.size() - 1] - 1));
                tmp.push_back(e + (char)(e[e.size() - 1] + 0));
                tmp.push_back(e + (char)(e[e.size() - 1] + 1));
            }
        }
        v2 = tmp;
        for (auto e : tmp)
        {
            v.push_back(e);
        }
    }
    cout << v[k-1] << endl;
}

Measured memory_bytes: 16440
#include<iostream>
#include<string>
using namespace std;
int main() {
	int w; cin >> w;
	string ans;
	while (true) {
		if (w == 0) {
			cout << ans << endl;
			char ch; cin >> ch; return 0;
		}
		else if (w % 3 == 1) {
			ans = '+' + ans;
			w--;
		}
		else if (w % 3 == 2) {
			ans = '-' + ans;
			w++;
		}
		else ans = '0' + ans;
		w /= 3;
	}
}

Measured memory_bytes: 3172
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#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;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);

struct Input
{
	int n;char c;char str[1024];string s;ll l;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;

//aoj 2151
struct Edge{
	int to, cost, enemy;
	Edge(){};
	Edge(int to, int cost, int enemy): to(to), cost(cost), enemy(enemy){};
};

vector<Edge> edge[110];
int dist[110][110];

int main(){
	while(1){
		int n = in.nextInt(), m = in.nextInt(), l = in.nextInt();
		if(n == 0 && m == 0 && l == 0) break;
		rep(i, 110) edge[i].clear();
		rep(i, 110) rep(j, 110) dist[i][j] = i==0 ? 0: INF;

		rep(i, m) {
			int a = in.nextInt()-1, b = in.nextInt()-1, d = in.nextInt(), e = in.nextInt();
			edge[a].pb({b, d, e});
			edge[b].pb({a, d, e});
		}

		auto dijkstra = [&]{
			typedef pair<int, pii> P;
			priority_queue<P, vector<P>, greater<P> > q;
			q.push({0, {0, l}});
			P p;
			while(!q.empty()){
				p = q.top(); q.pop();
				int cost = p.fi, from = p.se.fi, mny = p.se.se;
				for(auto e : edge[from]){
					int to = e.to, c = e.cost, enmy = e.enemy;
					if(dist[to][mny] > cost + enmy){
						dist[to][mny] = cost + enmy;
						q.push({cost + enmy, {to, mny}});
					}
					if(mny < c) continue;
					if(dist[to][mny-c] > cost){
						dist[to][mny-c] = cost;
						q.push({cost, {to, mny - c}});
					}
				}
			}
		};
		dijkstra();

		int ans = INF;
		rep(i, l + 1) ans = min(ans, dist[n-1][i]);
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 3520
import sys
from io import StringIO
import unittest
import numpy as np

def resolve():
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = list(input())

    ans = [[-1 for _ in range(n)] for _ in range(3)]

    # 0 -> グーrを出したとき
    # 1 -> ちょきs
    # 2 -> パーp

    for i in range(k):
        for j in range(i, n, k):
            if j < k:
                if t[j] == 'r':
                    ans[0][j] = 0
                    ans[1][j] = 0
                    ans[2][j] = p
                elif t[j] == 's':
                    ans[0][j] = r
                    ans[1][j] = 0
                    ans[2][j] = 0
                elif t[j] == 'p':
                    ans[0][j] = 0
                    ans[1][j] = s
                    ans[2][j] = 0
            else:
                if t[j] == 'r':
                    ans[0][j] = max(ans[1][j - k], ans[2][j - k])
                    ans[1][j] = max(ans[0][j - k], ans[2][j - k])
                    ans[2][j] = max(ans[0][j - k], ans[1][j - k]) + p
                elif t[j] == 's':
                    ans[0][j] = max(ans[1][j - k], ans[2][j - k]) + r
                    ans[1][j] = max(ans[0][j - k], ans[2][j - k])
                    ans[2][j] = max(ans[0][j - k], ans[1][j - k])
                elif t[j] == 'p':
                    ans[0][j] = max(ans[1][j - k], ans[2][j - k])
                    ans[1][j] = max(ans[0][j - k], ans[2][j - k]) + s
                    ans[2][j] = max(ans[0][j - k], ans[1][j - k])

    ans = np.array(ans)
    print(ans[:, (-1*k):].max(axis=0).sum())


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """5 2
8 7 6
rsrpr"""
        output = """27"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """7 1
100 10 1
ssssppr"""
        output = """211"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """30 5
325 234 123
rspsspspsrpspsppprpsprpssprpsr"""
        output = """4996"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 20976
#include <iostream>

using namespace std;
using ll = long long;


int main(void)
{
    ll h, w;
    cin >> h >> w;

    if (h == 1 || w == 1)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << (h * w + 1) / 2 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i,n) for(int i = 0;  i < n ; ++i)
#define REP(i,a,b) for(int i = a ; i <= b ; ++i)
#define filei freopen("input.txt", "r", stdin);
#define fileo freopen("output.txt", "w", stdout);
#define gooi cout<<"Case #"<<i+1<<" :";
#define s(n) scanf("%d",&n)
#define rev(i,n) for(int i = n ; i >= 0 ; --i)
#define REV(i,a,b) for(int i = a ; i >= b ; --i)
#define miN(a,b) (((a)<(b))?(a):(b))
#define sc(n) scanf("%c",&n)
#define tr(c,i) for(typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define INF 1000000000
#define pii pair<long long int,long long int>
#define pb(a) push_back(a)
#define F first
#define S second
typedef long long ll;
using namespace std; 
void solve(){
    ll n;cin>>n;
    map<ll,ll>m;
    for(int i=2;i<=sqrt(n);i++){
        while(n%i==0){
            m[i]++;
            n/=i;
        }
    }
    if(n>1){
        m[n]++;
    }
    ll ans = 0;
    for(auto i:m){
        int j = 0;
        while((j+1)*(j+1)+j+1<=2*i.second){
            j++;
        }
        ans+=j;
    //    cout<<i.first<<" "<<i.second<<"\n";
    }
    cout<<ans<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int num = 1;
    //cin>>num;
    for(long long int i=0;i<num;i++){
       	solve();
    }   
}





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

int a, b;

int main () {
  cin >> a >> b;
  int n = b - a ;
  cout << n*(n+1)/2 - b << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long double a,b,h,m;
  cin >> a >> b >> h >> m;

  long double Ah = (360/12) * h + (m / 60) * (360/12);
  long double Am = (360/60) * m;
  long double Ac = fabs(Ah - Am);
  Ac/=180;
  Ac*=acos(-1);
  long double half = 2.0 * a * b * cos(Ac);
   
  long double Ans = sqrt(a * a + b * b - half);
  cout << fixed << setprecision(20) << Ans;
  
    
  
  
}

Measured memory_bytes: 4140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int a, b, t;
	cin >> a >> b >> t;
	cout << t / a * b << endl;
	return 0;
}

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

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

vector<int> subsets[100001];

int main(){

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    // if i have N subsets, then each subset will have N - 1 elements

    // let a subset represent a node. each item in there will be an edge to another node

    // using the bipartite trick, we can pair them up

    // check if 2N = x * (x - 1)

    int n; cin >> n;

    for(int i = 0; i * (i + 1) <= n + n; ++i){
        if(i * (i + 1) == n + n){
            cout << "Yes\n";
            int sub = i + 1;
            cout << sub << "\n";
            for(int jump = 1, k = 1; k <= n; ++jump){
                for(int pos = 0; pos < sub && k <= n; ++pos){
                    subsets[pos].push_back(k);
                    subsets[(pos + jump) % sub].push_back(k++);
                }
            }
            for(int j = 0; j < sub; ++j){
                cout << subsets[j].size();
                for(auto nx : subsets[j])
                    cout << " " << nx;
                cout << "\n";
            }
            return 0;
        }
    }

    cout << "No\n";

    return 0;

}


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

using namespace std;

int main() {

	int n;
	cin >> n;

	int maxp = 0;
	int p = 0;
	int total = 0;
	for (int i = 0; i < n; i++) {
		cin >> p;
		total += p;
		if (p > maxp) { maxp = p; }
	}
	cout << total - maxp / 2 << endl;

}

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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 998244353 
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;

	ll n;
	cin>>n;
	
	ll ans = n*(n-1);
	ans = ans/2;
	cout<<ans;

	return 0;
}

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

int main() {
  int A, B, C;
  vector<int> X(20, 0);
  cin >> A >> B >> C;
  X[A]++;
  X[B]++;
  X[C]++;
  
  string ans = "NO";
  if (X[5] == 2 && X[7] == 1) ans = "YES";
  cout << ans << "\n";
  return 0;
}

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

using namespace std;

typedef vector<int> V;

int merge(V &s, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    V l = V(n1);
    V r = V(n2);
    for (int i = 0; i < n1; i++) {
        l[i] = s[left + i];
    }
    for (int i = 0; i < n2; i++) {
        r[i] = s[mid + i];
    }
    int i = 0, j = 0, c = 0;
    for (int k = left; k < right; k++) {
        if (j >= r.size() || (i < l.size() && l[i] <= r[j])) {
            s[k] = l[i++];
        } else {
            s[k] = r[j++];
        }
        c++;
    }
    return c;
}

int merge_sort(V &s, int left, int right) {
    int c = 0;
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        c += merge_sort(s, left, mid);
        c += merge_sort(s, mid, right);
        c += merge(s, left, mid, right);
    }
    return c;
}

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

    int c = merge_sort(s, 0, s.size());
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << s[i];
    }
    cout << "\n" << c << "\n";
}


Measured memory_bytes: 6852
#include "bits/stdc++.h"
using namespace std;
static const int MAX = 100;
int main() {
    int n, A[MAX + 1];
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        A[i] = a;
    }


    int minv = INT_MAX;
    for (int i = -100; i <= 100; ++i) {
        int cost = 0;
        for (int j = 0; j < n; ++j) {
            cost += pow(A[j] - i, 2);
        }
        minv = min(cost, minv);
    }

    cout << minv << endl;

    return 0;
}


Measured memory_bytes: 256
s=input()
k=int(input())
f=lambda x:(123-ord(x))%26 #cost to "a"
g=lambda x:chr((ord(x)-97+k)%26+97)

b=[]
for i in s:
  cost=f(i)
  if cost<=k:
    b.append("a")
    k-=cost
  else:
    b.append(i)
if k:b[-1]=g(b[-1])
print("".join(b))

Measured memory_bytes: 4212
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	int x, y, a, b,c ;
	cin >> x >> y >> a >> b >> c;
	vi p(a), q(b), r(c);
	REP(i, a) cin >> p[i];
	REP(i, b) cin >> q[i];
	REP(i, c) cin >> r[i];
	sort(ALL(p)); reverse(ALL(p));
	sort(ALL(q)); reverse(ALL(q));
	sort(ALL(r)); reverse(ALL(r));
	int id1 = 0, id2 = 0, id3 = 0;
	int totx = 0, toty = 0;
	ll res = 0;
	while (id1 + id2 + id3 < x + y) {
		int xKand = -1, yKand= -1, cKand = -1;
		if (totx < x) {
			xKand = p[id1];
		}
		if (toty < y) {
			yKand = q[id2];
		}
		if (id3 < c) {
			cKand = r[id3];
		}
		int najw = max({xKand, yKand, cKand});
		res += najw;
		if (najw == xKand) {
			++id1;
			++totx;
		} else if (najw == yKand) {
			++id2;
			++toty;
		} else {
			++id3;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define maxn 100010
#define ll long long
#define db double
#define vi vector<int>
#define pb push_back
#define mod 998244353
vi eg[maxn];
int dep[maxn];
void dfs(int a, int fa) {
	for (int i = 0; i < eg[a].size(); i++) {
		int v = eg[a][i];
		if (v == fa) continue;
		dep[v] = dep[a] + 1, dfs(v, a);
	}
}
int u[maxn], v[maxn], mxs = 0;	
int n, k;
int cal(int num) {
	int ans = 0;
	for (int i = 1; i <= n; i++)
		if (dep[i] <= num) ans++;
	return ans;
}
int main() {

	cin >> n >> k;
	for (int i = 1; i < n; i++) {
		scanf("%d%d", &u[i], &v[i]), 
		eg[u[i]].pb(v[i]), eg[v[i]].pb(u[i]);
	}
	if (k & 1) {
		for (int i = 1; i < n; i++) {
			dep[u[i]] = dep[v[i]] = 0;
			dfs(u[i], v[i]), 
			dfs(v[i], u[i]);
			mxs = max(mxs, cal(k / 2));
		}
	}
	else {
		for (int i = 1; i <= n; i++) {
			dep[i] = 0, dfs(i, 0);
			mxs = max(mxs, cal(k / 2));
		}
	}
	cout << n - mxs << endl;
	return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K;
    cin >> N >> K;

    // a + b = b + c = c + a = 0 (mod K)
    // a + b = b + c (mod K)
    // a = c (mod K)
    // a = b = c (mod K)
    // a + b = 0 (mod K)
    // a + a = 0 (mod K)
    // 2 * a = 0 (mod K)
    // K is odd:
    // a = 0 (mod K)
    // a = b = c = 0 (mod K)
    // K is even:
    // K' = K / 2
    // 2 * a = 0 (mod 2 * K')
    // a = 0 || a = K' (mod K)
    // if a == 0: a = b = c = 0 (mod K)
    // if a == K': a = b = c = K' (mod K)
    if(K % 2) {
        int n = N / K;
        cout << 1LL * n * n * n << endl;
    } else {
        int n = N / K;
        int m = (N + K / 2) / K;
        cout << 1LL * n * n * n + 1LL * m * m * m << endl;
    }

    return 0;
}


Measured memory_bytes: 3612
using System;

class B{
  public static void Main(){
    int n,i,count = 0;
    n = int.Parse(Console.ReadLine());
    string[] str = Console.ReadLine().Split(' ');
    int[] array = new int[n];
    for(i = 0;i < n;i++){
      array[i] = int.Parse(str[i]);
    }
    for(i = 0;i < n;i++){
      int min = i;
      for(int j = i + 1;j < n;j++){
        if(array[min].CompareTo(array[j]) > 0)  min = j;
      }
        if(min != i){
          Swap(ref array[i],ref array[min]);
          count++;
        }
    }
    for(i = 0;i < n - 1;i++){
      Console.Write(array[i] + " ");
    }
    Console.Write(array[n - 1]);
    Console.WriteLine("");

    Console.WriteLine(count);
  }

  static void Swap(ref int x,ref int y){
    int temp;
    temp = x;
    x = y;
    y = temp;
  }
}


Measured memory_bytes: 9204
#include <iostream>

using namespace std;
long long dp[1010][20010],a[1010],b[1010];
int main(){
    int i,j,h,n;
    cin >> h >> n;
    for(i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    for(i=0;i<=n;i++){
        for(j=0;j<=h + 10000;j++){
            dp[i][j] = 100000000000000;
        }
    }
    dp[0][0] = 0;
    for(i=1;i<=n;i++){
        for(j=0;j<=h + 10000;j++){
            dp[i][j] = min(dp[i][j],dp[i - 1][j]);
            if(j + a[i - 1]>=h + 10000) continue;
            dp[i][j + a[i - 1]] = min(dp[i][j + a[i - 1]],dp[i][j] + b[i - 1]);
        }
    }
    long long ans = 100000000000000;
    for(i=h + 10000;i>=h;i--){
        ans = min(ans,dp[n][i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 157952
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N,M;cin >> N >> M;
    vector<vector<LL>> a(3);
    rep(i,N){
        rep(j,3){
            LL s;cin >> s;
            a[j].push_back(s);
        }
    }


    LL ans = 0;
    for(int bit = 0;bit < (1 << 3);++bit){
        vector<LL> v;
        rep(i,N){
            LL tmp = 0;
            rep(j,3){
                if(bit & (1 << j))tmp += a[j][i];
                else tmp -= a[j][i];
            }
            v.push_back(tmp);
        }
        sort(rall(v));
        LL sum = 0;
        rep(i,M){
            sum += v[i];
        }

        ans = max(ans,sum);
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

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

        Map<Long, Integer> noMap = new HashMap<>();
        for (int i=1;i<=n;i++) {
            long x = sc.nextLong();
            if (!noMap.containsKey(x)) {
                noMap.put(x,1);
            } else {
                int a = noMap.get(x);
                noMap.put(x,a+1);
            }
        }

        int q = sc.nextInt();
        long ans = 0;
        for (long key : noMap.keySet()) {
            int sub = noMap.get(key);
            ans+=key*sub;
        }
        for (int i=1;i<=q;i++) {
            long x = sc.nextLong();
            long y = sc.nextLong();
            if (noMap.containsKey(x)) {
                int a = noMap.get(x);
                int b = 0;
                if (noMap.containsKey(y)) {
                    b = noMap.get(y);
                }
                noMap.put(y,a+b);
                noMap.remove(x);
                long z = y-x;
                ans += z*a;
            }

            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 70060
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

int main() {

    int n;
    int ans = 0;
    cin >> n;

    vector<int> l;

    rep(i,n){ 
        int tmp;
        cin >> tmp;
        l.push_back(tmp);
    }
    sort(l.rbegin(), l.rend());
 #if 1
    for(int i = 0; i < n-2; i++) {
        for(int j = i+1; j < n-1; j++) {
            for(int k = j+1; k < n; k++) {
                if((l[i] < l[j] + l[k]) && (l[j] < l[i] + l[k]) && (l[k] < l[i] + l[j])) ans++;
                if(l[i] - l[j] >= l[k]) continue;
            }
        }
    }
    cout << ans;
    #endif
}


Measured memory_bytes: 256
#include <stdio.h>

int N, K;
int Dis[11];
int Divider[5] = {10000, 1000, 100, 10, 1};

int main(void) 
{
	int i, tmp, min, max, min_not_zero;
	int cnt = 1;
	int flag = 0;
	int idx = 0;
	
	scanf("%d %d", &N, &K);
	for (i = 0; i < K; i++)
	{
		scanf("%d", &tmp);
		Dis[tmp] = 1;
	}
	
	tmp = N;
	while (tmp /= 10) {
		cnt++;		
	}

	while (Dis[idx++]);
	min = idx - 1;
	
	idx = 1;
	while (Dis[idx++]);
	min_not_zero = idx - 1;

	idx = 9;
	while (Dis[idx--]);
	max = idx + 1;

	for (i = (4 - cnt) + 1; i <= 4; i++) tmp += (max * Divider[i]);

	if (tmp < N)
	{
		tmp = min_not_zero * Divider[4-cnt];
		for (i = (4 - cnt) + 1; i <= 4; i++)
		{
			tmp += min * Divider[i];
		}
		printf("%d\n", tmp);

		return 0;
	}

	for (i = (4 - cnt) + 1; i <= 4; i++)
	{
		idx = 0;
		if (flag) {printf("%d", min); continue;}
		
		tmp = (N / Divider[i]) % 10;
		
		while (Dis[tmp + idx++]);
		idx--;
	
		if (idx >= 1)
		{
			flag = 1;
			Divider[i] = tmp + idx;
		}
		else Divider[i] = tmp;

		if (Divider[i] == 10 && i != (4-cnt)) Divider[i] = 0;
		printf("%d", Divider[i]);
	}
	printf("\n");

	return 0;
}

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

int main(){
  int n, a;
  double ans, sum;
  sum = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    sum += 1.0 / a;
  }
  ans = 1.0 / sum;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

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

    map<ll,ll> mp;
    for(int i=0;i<N;i++){
        ll a,b;cin>>a>>b;
        mp[a] += b;
    }


    ll cnt = 0;
    for(auto p : mp){
        cnt += p.second;
        if(cnt >= K){
            cout << p.first << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 4224
#include<iostream>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  if(A==1 && B==2){
    cout << 3 << endl;
  }
  else if(A==2 && B==1){
    cout << 3 << endl;
  }
  else if(A==1 && B==3){
    cout << 2 << endl;
  }
  else if(A==3 && B==1){
    cout << 2 << endl;
  }
  else if(A==2 && B==3){
    cout << 1 << endl;
  }
  else if(A==3 && B==2){
    cout << 1 << endl;
  }
}


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

int main() {
    ll x; cin>>x;
    for(int i=0; i<=200; i++) {
        for(int j=-200; j<=200; j++) {
            ll ans = i*i*i*i*i - j*j*j*j*j;
            if(ans == x) {
                cout<<i<<" "<<j;
                return 0;
            }
        }
    }
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  rep(i, n) cin >> a[i], mp[a[i]]++;
  if (mp.size() >= 4) {
    cout << "No" << endl;
    return 0;
  }
  vector<int> v;
  for (auto e : mp) v.push_back(e.first);
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v.size(); j++) {
      int x = v[i];
      int y = v[j];
      auto mp2 = mp;
      mp2[x]--;
      mp2[y]--;
      rep(k, n) {
        int z = x ^ y;
        x = y;
        y = z;
        mp2[y]--;
      }
      mp2[x]++;
      mp2[y]++;
      bool all = v[i] == x && v[j] == y;
      for (auto e : mp2) {
        all &= e.second == 0;
      }
      if (all) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}



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

using namespace std;

#define FOR(x,z,n) for(int x=z;x<n;x++)
#define mp make_pair
typedef long long ll;
typedef pair<int, int> iPair;

int main() {
	string s;
	cin >> s;
	if (s == "ABC") cout << "ARC";
	else cout << "ABC";
}
 

Measured memory_bytes: 3624
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]
num = 1
dis = [[10**9]*w for _ in range(h)]
cnt = 0
for i in range(len(s)):
    cnt += s[i].count('.')
def bfs():
    queue = []
    done = []
    queue.insert(0,(0,0))
    dis[0][0] = 1

    while len(queue):
        y,x = queue.pop()
        if (y,x) in done:
            continue
        else:
            done.insert(0,(y,x))
        if x==w-1 and y==h-1:
            break

        for i in range(0,4):
            nx,ny = x+[1,0,-1,0][i], y+[0,1,0,-1][i]
            if 0<=nx<w and 0<=ny<h and s[ny][nx]!='#':
                queue.insert(0,(ny,nx))
                dis[ny][nx] = min(dis[ny][nx],dis[y][x]+1)
    return dis[h-1][w-1]
ret = bfs()
if ret==10**9:
    print(-1)
else:
    print(cnt-ret)

Measured memory_bytes: 3188
N,M = list(map(int, input().split()))
A = [int(x) for x in input().split()]
 
total = sum(A)
count = 0 
 
for i in range(N):
    if A[i] >= ((1 / (4 * M)) * total):
        count = count + 1
if count < M:
    print("No")
else:
    print("Yes")


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

using int64 = long long;

class UnionFind {
 public:
  UnionFind(int n) : parent_(n), size_(n, 1) {
    for (int i = 0; i < n; ++i) {
      parent_[i] = i;
    }
  }

  bool isSame(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return;

    if (size_[x] < size_[y]) {
      parent_[x] = y;
      size_[y] += size_[x];
    } else {
      parent_[y] = x;
      size_[x] += size_[y];
    }
  }

  int size(int x) {
    return size_[root(x)];
  }

 private:
  int root(int x) {
    if (parent_[x] == x)
      return x;
    return parent_[x] = root(parent_[x]);
  }

  vector<int> parent_;
  vector<int> size_;
};

int main() {
  int64 n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  for (int i = 0; i < m; ++i)
    cin >> a[i] >> b[i];

  UnionFind uf(n);
  int64 c = n * (n - 1) / 2;
  vector<int64> ans;
  for (int i = m - 1; i >= 0; --i) {
    ans.push_back(c);
    int ia = a[i] - 1;
    int ib = b[i] - 1;
    if (uf.isSame(ia, ib))
      continue;
    c -= uf.size(ia) * uf.size(ib);
    uf.unite(ia, ib);
  }
  reverse(ans.begin(), ans.end());

  for (int64 d : ans)
    cout << d << "\n";

  return 0;
}


Measured memory_bytes: 3828
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long int

ll n,k;
ll a[200002];
ll came[200002]; //check if came before

int main(){

  scanf("%lld%lld",&n,&k);
  for(int i=1;i<=n;i++){
    scanf("%lld",&a[i]);}

  ll loopmae;
  ll inloop;
  ll tmp=1;
  for(ll i=1;i<=n+1;i++){
    if(came[tmp]!=0){
      loopmae = came[tmp]-1;
      inloop = i-came[tmp];
      break;}
    came[tmp]=i;
    tmp = a[tmp];}

  if(k<=loopmae){
    tmp =1;
    for(int i=0;i<k;i++){
      tmp=a[tmp];}}
  else{
  k-=loopmae;
  k%=inloop;
  for(ll i=0;i<k;i++){
    tmp = a[tmp];}}

  

  printf("%lld\n",tmp);

  
  return 0;
}


Measured memory_bytes: 4856
class Dice:
    def __init__(self, face_vals):
        self.faces = dict(zip(['top', 'front', 'right',
                               'left', 'back', 'bottom'], face_vals))

    def roll(self, direction):
        if direction == 'N':
            self.faces['top'], self.faces['front'], self.faces['bottom'], \
            self.faces['back'] = self.faces['front'], self.faces['bottom'], \
            self.faces['back'], self.faces['top']
        elif direction == 'S':
            self.faces['top'], self.faces['front'], self.faces['bottom'], \
            self.faces['back'] = self.faces['back'], self.faces['top'], \
            self.faces['front'], self.faces['bottom']
        elif direction == 'E':
            self.faces['top'], self.faces['right'], self.faces['bottom'], \
            self.faces['left'] = self.faces['left'], self.faces['top'], \
            self.faces['right'], self.faces['bottom']
        else:
            self.faces['top'], self.faces['right'], self.faces['bottom'], \
            self.faces['left'] = self.faces['right'], self.faces['bottom'], \
            self.faces['left'], self.faces['top']


face_vals = input().split()

dice = Dice(face_vals)

for i in input():
    dice.roll(i)

print(dice.faces['top'])

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

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<LL> VI;
typedef unsigned long long ULL;

#define MP make_pair
#define PB push_back
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()
#define f first
#define s second
#define FILL(a, b) memset(a, b, sizeof(a))

const int MAX = 200*1000 + 7;
const int INF = 1000*1000*1000;
const LL LINF = 1LL*INF*INF;
const int MOD = INF + 7;
const double PI = acos(-1.);

int a[MAX];
int b[MAX];

int main()
{
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	LL sum = 0;
	FOR(i,0,n)
	{
		cin >> a[i] >> b[i];
		sum += a[i];
	}
	LL tmp = sum;
	FOR(i,0,n)
	{
		if(a[i] > b[i])
			tmp = min(tmp, (LL)b[i]);
	}
	cout << sum - tmp;





	return 0;
}




Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void){

  string S;
  int ans = 0;

  cin >> S;

  if(S[0]=='R'){
    ans++;
    if(S[1]=='R'){
      ans++;
      if(S[2]=='R') ans++;
    }
  }
  else if(S[1]=='R'){
    ans++;
    if(S[2]=='R') ans++;
  }
  else if(S[2]=='R') ans++;

  cout << ans;
}


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

ll N, ans, X[100], minv = 10000000;

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> X[i];
    for(int p=1;p<101;p++) {
        ans = 0;
        for(int i=0;i<N;i++) ans += (p-X[i])*(p-X[i]);
        minv = min(minv, ans);
    }
    cout << minv << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
 
bool in_range(int i, int j) {
  return 0 <= i && i < 4 && 0 <= j && j < 4; 
}
 
vector<int> x(4), y(4);
 
bool G[4][4];
 
int rec(int i, int j) {
   
  int ni = i, nj = j + 1;
     
  if(nj == 4) {
    ni ++;
    nj = 0;
  }
   
  if(ni == 4) return G[i][j];
 
  if(G[i][j]) return rec(ni, nj);
   
  int ret = 0;
 
  G[i][j] = 1;
   
  rep(k, 4) {
    int pi = i + y[k], pj = j + x[k];
    if(!in_range(pi, pj)) continue;
    if(G[pi][pj]) continue; // iranai ?
    G[pi][pj] = 1;
    ret += rec(ni, nj);
    G[pi][pj] = 0;
  }
   
  G[i][j] = 0;
   
  return ret;
}
 
int main() {
 
  while(1) {
    rep(i, 4) {
      cin >> x[i] >> y[i];
      if(cin.eof()) exit(0);
    }
     
    rep(i, 4) rep(j, 4) G[i][j] = 0;
    cout << rec(0, 0) << endl;
  }
   
  return 0;
}

Measured memory_bytes: 3076