akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(long long a, long long b){
  if(a>b){
    rep(i,a){
      cout<<b;
    }
    cout<<endl;
    return;
  }
  rep(i,b){
      cout<<a;
    }
    cout<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);


int main()
{
	char c;
	cin >> c;
	if(c>='A' && c<='Z')cout << "A";
	else cout << "a";
    return 0;
}


Measured memory_bytes: 3592
#! /usr/bin/env python
import sys

def main ():
    line = sys.stdin.readline()
    numbers = [int(x) for x in line.split(' ')]
    numbers.sort()

    # Check the result
    inputStr = ''.join(str(x) for x in numbers)
    if inputStr == '1479':
        print('YES')
    else:
        print('NO')

main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  string s;
  cin>>s;
  int count=0;
  int countb=1;
  for(int i=0;i<n;i++){
    if(s[i]=='a'){
      if(count<a+b){
        cout<<"Yes"<<endl;
        count++;
      }else{
        cout<<"No"<<endl;
      }
    }else if(s[i]=='b'){
      if(count<a+b && b>=countb){
        cout<<"Yes"<<endl;
        count++;
        countb++;
      }else{
        cout<<"No"<<endl;
      }
    }else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>x(n);
  for(int i = 0;i < n;i++)cin >> x.at(i);
  int ans = 1000000;
  for(int i = 1;i < 101;i++){
    int sum = 0;
    for(int j = 0;j < n;j++){
      sum += (x.at(j)-i)*(x.at(j)-i);
    }
    ans = min(ans,sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var firstLine = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToList();
			var n = firstLine[0];
			var m = firstLine[1];

			var pictureA = new List<string>();
			var pictureB = new List<string>();

			for(int i = 0; i < n; i++)
			{
				pictureA.Add(Console.ReadLine());
			}

			for(int i = 0; i < m; i++)
			{
				pictureB.Add(Console.ReadLine());
			}

			var isMatched = true;

			for(int i = 0; i <= n - m; i++)
			{
				for(int j = 0; j <= n - m; j++)
				{
					isMatched = true;

					for(int k = 0; k < m; k++)
					{
						for(int l = 0; l < m; l++)
						{
							if(pictureA[i + k][j + l] != pictureB[k][l])
							{
								isMatched = false;
								break;
							}
						}

						if(!isMatched)
						{
							break;
						}
					}

					if(isMatched)
					{
						Console.WriteLine("Yes");
						return;
					}
				}
			}

			Console.WriteLine("No");
        }
	}
}


Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF   = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)

long long mod_cum[pow10(6)];

void solve()
{
    int N, P;
    cin >> N >> P;
    string S;
    cin >> S;
    reverse(S.begin(), S.end());

    if (10 % P == 0)
    {
        LL ans = 0;
        REP0 (L, N)
        {
            if ((S[L] - '0') % P == 0)
                ans += N - L;
        }
        cout << ans << endl;
        return;
    }

    map<int, long long> modcum_mp;

    int p10 = 1;
    REP0 (i, N)
    {
        mod_cum[i] += (S[i] - '0') * p10;
        mod_cum[i] %= P;
        mod_cum[i + 1] += mod_cum[i];
        modcum_mp[mod_cum[i]]++;

        p10 = (p10 * 10) % P;
    }
    modcum_mp[0]++;

    LL ans = 0;
    for (auto p : modcum_mp)
    {
        ans += p.second * (p.second - 1) / 2;
    }
    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 2580
#include<stdio.h> 

#define MAXLEN 10000    
     
int main( void ) 
{
	int n,q;
	int S[ MAXLEN+1 ], t;
	int i,j;
	int cnt;    
	
	scanf( "%d", &n ); 
	for( i=0; i<n; i++ ) {
		scanf( "%d", &S[i] ); 
	}
	
	cnt=0;
	scanf( "%d", &q ); 
	for( i=0; i<q; i++ ) {
		scanf( "%d", &t );
		for( j=0; j<n; j++ ) {
			if( t == S[j] ) {
				cnt++;
				break;
			}
		}
	}
	
	printf( "%d\n", cnt );

	return 0;
}

Measured memory_bytes: 636
N, M = map(int, input().split())
sides = []
def dfs(now):
    history[now] = 1
    for i in List[now]:
        if history[i] == 0:
            dfs(i)
    flag = 0
    for i in range(1, N+1):
        if history[i] == 0:
            flag = 1
    if flag == 0:
        return 0
    else:
        return 1
for i in range(M):
    sides.append(list(map(int, input().split())))

ans = 0
for k in range(M):
    side = sides[:]
    del side[k]
    List = [[] for i in range(N+1)]
    for i in range(M-1):
        List[side[i][0]].append(side[i][1])
        List[side[i][1]].append(side[i][0])

    history = [0 for i in range(N+1)]
    ans += dfs(1)



print(ans)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
  int a,b,sum;
  while(1){
    sum=0;
    cin>>a;
    if(a==0)break;
    for(int i=0;i<(a*(a-1)/2);i++){
      cin>>b;
      sum+=b;
    }
    cout<<sum/(a-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

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

        long sum = 0;

        for(int i = 1; i<=N; i++){
            if(i%3 != 0 && i%5 != 0){
                sum+=i;
            }
        }
        System.out.print(sum);
    }
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

struct UnionFind
{
  vector<int> par;
  vector<int> siz;
  UnionFind(int N) : par(N), siz(N, 1) {for (int i = 0; i < N; i++) par[i] = i;}
  void init(int N) {
    siz.assign(N, 1);
    par.resize(N);
    for(int i = 0; i < N; ++i) par[i] = i;
  }
  int root(int x) {
    while(par[x] != x) {x = par[x] = par[par[x]];}
    return x;
  }
  bool unite(int x, int y)
  {
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  bool isSame(int x, int y) {return root(x) == root(y); }
  int size(int x) { return siz[root(x)]; }
};

int main()
{
  int n, q;
  cin >> n >> q;
  UnionFind uf(n);
  vector<int> ans;
  rep(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if(com == 0) uf.unite(x, y);
    else ans.push_back(uf.isSame(x, y));
  }
  for(auto x : ans) cout << x << endl;
}


Measured memory_bytes: 3360
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> h(n+k,0);
  int s;
  cin>>s;
  for(int i=0;i<=k;i++)
    h.at(i)=s;
  for(int i=k+1;i<n+k;i++)
    cin>>h.at(i);
  vector<int> dp(n+k,0);
  for(int i=k;i<n+k;i++){
    dp[i]=dp[i-1]+abs(h.at(i-1)-h.at(i));
    for(int j=1;j<=k;j++)
      dp[i]=min(dp[i],dp[i-j]+abs(h.at(i-j)-h.at(i)));
  }
  cout<<dp.at(n-1+k)<<endl;
}

Measured memory_bytes: 1024
///////////////////////////////////////////
//root@NULLCT$(☝ ՞ਊ ՞)☝  << "Be accept!!"//
///////////////////////////////////////////
//#define BOOST
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int66_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   //setfill(char)
#include <ios>       //left,right
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
#ifdef BOOST
#include <boost/multiprecision/cpp_int.hpp> // cpp_int
using namespace boost::multiprecision;
#endif
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
int setup(void) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return 0; }
int lenght(char* str) { int i = 0; while (str[i])i++; return i; }
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int iinput(void) { int a = 0; cin >> a; return a; }
int dinput(void) { double a = 0; cin >> a; return a; }
string sinput(void) { string a = ""; cin >> a; return a; }
int kuriup(double a) { int b = int(a); if (a != b) { return b + 1; } else { return b; } }
int kuridown(double a) { int b = int(a); return b; }
int run(void);
int main() { setup(); run(); return 0; }
/////////////////////////////////////////////////////////////////////////////////////////
int run(void) {

  int list[32]= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int a=iinput();
  cout<<list[a-1]<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int A[3];
    int max = 0;
    int min = 100;
    scanf("%d%d%d", &A[0], &A[1], &A[2]);

    for(int i = 0; i < 3; i++){
        if(max < A[i]){
            max = A[i];
        }
    }

    for(int i = 0; i < 3; i++){
        if(min > A[i]){
            min = A[i];
        }
    }
    printf("%d\n", max - min);
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(){
	int cnt;
	cin >> cnt;
	double x1, y1, x2, y2, x3, y3;
	double a1, a2, b1, b2, c1, c2;
	double a, b, c;
	double A;
	double xp, yp, r;
	while (cnt > 0 && cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
		// ?????\??????????????§?¨?????±???????
		a1 = 2 * (x2 - x1);
		b1 = 2 * (y2 - y1);
		c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
		a2 = 2 * (x3 - x1);
		b2 = 2 * (y3 - y1);
		c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		xp = (double)((b1*c2 - b2*c1) / (a1*b2 - a2*b1) * 1000) / 1000.0;
		yp = (double)((c1*a2 - c2*a1) / (a1*b2 - a2*b1) * 1000) / 1000.0;

		// ?????\????????????????±???????
		r = hypot(xp - x1, yp - y1);

		cout << fixed << setprecision(3);
		cout << xp << " " << yp << " " << r << endl;
		cnt -= 1;
	}
	return 0;
}

Measured memory_bytes: 1300
import sys
import statistics
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] -= i + 1
A = sorted(A)
med = A[N // 2]

ans = 0
for i in range(N):
    ans += abs(A[i] - med)
print(ans)

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

using ll = long long;
static const ll MOD = 998244353;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, s;
  cin >> n >> s;
  
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  vector<vector<ll>> dp(n + 1, vector<ll>(s + 1));
  dp.at(0).at(0) = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      dp.at(i + 1).at(j) += dp.at(i).at(j);
      if (j + a.at(i) <= s) {
        if (j == 0) dp.at(i + 1).at(j + a.at(i)) += dp.at(i).at(j) + i;
        else dp.at(i + 1).at(j + a.at(i)) += dp.at(i).at(j);
      }
    }
    for (int j = 0; j <= s; j++) dp.at(i + 1).at(j) %= MOD;
  }
  
  ll ans = 0;
  for (int i = 0; i <= n; i++) ans += dp.at(i).at(s);
  ans %= MOD;
  
  cout << ans << '\n';
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


ll N, W;
ll w[101];
ll v[101];
ll dp[101][100010];

int main(){
    cin >> N >> W;
    for(ll i = 0; i < N; i++) cin >> w[i] >> v[i];
    // 価値をインデックスに持つDP、この価値を達成するのに最も少ない容量を求める
    for(ll i = N; i>= 0; i--){
        for(ll j = 0; j <= 100000; j++){
            ll res = 0;
            if(i == N){
                if(j == 0){
                    res = 0;
                }
                else{
                    res = W + 1;
                }
            }
            else{
                res = dp[i + 1][j];
                if(j - v[i] >= 0)
                    res = min(res, dp[i + 1][j - v[i]] + w[i]);
            }
            dp[i][j] = res;
        }
    }

    for(int j = 100000; j >= 0; j--){
        if(dp[0][j] <= W){
            cout << j << endl;
            break;
        }
    }


    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

struct UnionFind{
  vector<int> d;
  UnionFind(int n) : d(n, -1){}
  int find(int x){
    if(d.at(x) < 0) return x;
    return d.at(x) = find(d.at(x));
  }
  bool unite(int x, int y){
    x = find(x); y = find(y);
    if(x == y) return false;
    if(d.at(x) > d.at(y)) swap(x, y);
    d.at(x) += d.at(y);
    d.at(y)= x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d.at(find(x)); }
};

int main(){
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
  }
  int ans = 0;
  rep(i, n){
    if(uf.d.at(i) < 0){
      ans = max(ans, uf.d.at(i)*-1);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4048
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << x << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

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

    OUT(t / a * b);
    return 0;
}



Measured memory_bytes: 256
import math

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  a[i] -= i+1
a = sorted(a)
b1 = math.floor(sum(a)/n)
b2 = math.ceil(sum(a)/n)
b3 = b1-1
b4 = b2+1
b5 = a[n//2]
b6 = a[n//2-1]

ans1 = 0
ans2 = 0
ans3 = 0
ans4 = 0
ans5 = 0
ans6 = 0
for i in range(n):
  ans1 += abs(a[i]-b1)
  ans2 += abs(a[i]-b2)
  ans3 += abs(a[i]-b3)
  ans4 += abs(a[i]-b4)
  ans5 += abs(a[i]-b5)
  ans6 += abs(a[i]-b6)
print(min(int(ans1), int(ans2), int(ans3), int(ans4), ans5, ans6))


Measured memory_bytes: 26608
#include<bits/stdc++.h>
typedef long long ll;
const int MAXN=3e2+7;
ll n,ans,k;
ll dis[MAXN][MAXN];
bool flag[MAXN][MAXN];
void pre(void) {
	std::cin>>n;
	long long int a[n+1][n+1];
	for(ll i=1; i<=n; i++)
		for(ll j=1; j<=n; j++)
			std::cin>>dis[i][j];
}
void Floyd(void) {
	for(ll k=1; k<=n; k++) {
		for(ll i=1; i<=n; i++) {
			for(ll j=1; j<=n; j++) {
				if(i==k||j==k||i==j)
					continue;
				if(dis[i][j]==dis[i][k]+dis[k][j])
					flag[i][j]=true;
				if(dis[i][j]>dis[i][k]+dis[k][j]) {
					std::cout<<"-1"<<std::endl;
					exit(0);
				}
			}
		}
	}
}
int main(void) {
	pre();
	Floyd();
	for(ll i=1; i<=n; i++)
		for(ll j=1; j<=n; j++)
			if(!flag[i][j])
				ans+=dis[i][j];
	std::cout<<(ans>>1)<<std::endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#define inf 40000000
using namespace std;

int main(){
    int n, m, k;
    while(cin >> n >> m){
        if(n == 0 && m == 0) break;
        vector<vector<int>> cost(m+1,vector<int>(m+1,inf));
        vector<vector<int>> tim(m+1,vector<int>(m+1,inf));
        for(int i = 0;i<m+1;i++){
            cost[i][i] = 0;
            tim[i][i] = 0;
        }
        for(int i = 0;i<n;i++){
            int a, b;
            cin >> a >> b;
            cin >> cost[a][b] >> tim[a][b];
            cost[b][a] = cost[a][b];
            tim[b][a] = tim[a][b];
        }
        cin >> k;
        for(int i = 0;i<k;i++){
            vector<long long int> dkt(m+1,inf);
            vector<bool> checked(m+1,false);
            // priority_queue<pair<int,int>,greater<int>> pque;
            int p, q, r;
            cin >> p >> q >> r;
            dkt[p] = 0;
            // pque.push(pair<int,int>(0,p));
            while(!checked[q]){
                int top = inf, min = inf;
                for(int j = 1;j<m+1;j++){
                    if(!checked[j] && min > dkt[j]){
                        top = j;
                        min = dkt[j];
                    }
                }
                checked[top] = true;
                for(int j = 1;j<m+1;j++){
                    if(checked[j] || top == j) continue;
                    if(r == 0){
                        dkt[j] = std::min(dkt[j],(dkt[top]+cost[top][j]));
                    }
                    else{
                        dkt[j] = std::min(dkt[j],dkt[top]+tim[top][j]);
                    }
                }
            }
            cout << dkt[q] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

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

    if (n >= 10)
    {
        cout << m << endl;
    }
    else
    {
        m += 100 * (10 - n);
        cout << m << endl;
    }
}

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

int main(){
  ll h;
  cin >> h;
  
  ll ans = 1;
  ll a = 1;
  while(h > 1){
    h /= 2; 
    a *= 2; 
    ans += a;  
  }
  cout << ans << endl;
}

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

#define dump(...) DUMPOUT<<"  ";DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<std::endl;DUMPOUT<<"    ";dump_func(__VA_ARGS__)
#define PI 3.14159265358979323846
#define EPS 1e-10
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(j) (j).begin(), (j).end()
#define SZ(j) ((int)(j).size())

int D = 365;
const int T = 26;

vector<int> c(T);
vector<vector<int>> s(D, vector<int>(T)); 

long long compute_score(vector<int> out) {
    long long score = 0;
    vector<int> last(T, 0);
    REP(d, (int)out.size()) {
        last[out[d]-1] = d+1;
        REP(i, T) {
            score -= (long long)(d+1 - last[i]) * c[i];
        }
        score += s[d][out[d]-1];

        cout << score << endl;
    }

    return score;
}

int main(int argc, char const *argv[])
{
    int d_;
    cin >> d_;
    D = d_;
    
    REP(i, T) cin >> c[i];
    REP(i, D) REP(j, T) cin >> s[i][j];

    vector<int> t(D);
    REP(i, D) cin >> t[i];

    compute_score(t);

    return 0;
}


Measured memory_bytes: 3564
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		Integer[] A = {1, 3, 5, 7, 8, 10, 12};
		Integer[] B = {4, 6, 9, 11};
		Integer[] C = {2};
		
		if(Arrays.asList(A).contains(a) && Arrays.asList(A).contains(b)
				|| Arrays.asList(B).contains(a) && Arrays.asList(B).contains(b)
				|| Arrays.asList(C).contains(a) && Arrays.asList(C).contains(b)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35712
use strict;
use warnings;

my $n = <STDIN>;
my @L;

$L[0] = 2;
$L[1] = 1;

for (my $i = 2; $i <= $n; $i++) {
    $L[$i] = $L[$i-1] + $L[$i-2];
}

print $L[$n], "\n";


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;

int main(){
	int n;
	int l,r;
	int tot;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>l>>r;
		tot+=r-l+1;
	}
	cout<<tot<<endl;
	




    return 0;
}


Measured memory_bytes: 256
package main

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

var (
	hs   []int
	memo []int
)

func rec(n int) int {
	if memo[n] < inf {
		return memo[n]
	}

	ret := inf
	for i := 1; i <= 2; i++ {
		if n-i < 0 {
			continue
		}

		ret = min(ret, rec(n-i)+abs(hs[n]-hs[n-i]))
	}

	memo[n] = ret
	return ret
}

func solve() {
	n := getInt()
	hs = getIntSlice(n)
	memo = make([]int, n)
	for i := range memo {
		memo[i] = inf
	}
	memo[0] = 0

	ans := rec(n - 1)
	fmt.Fprintln(wr, ans)
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
#include<iostream>
#include <math.h>//pow(x,y)=x^y 99999とかの場合+1するif文
#include <algorithm>//sort(a.begin(), a.end());reverse(a.begin(), a.end());
#define rep(init,i,n) for (int i=init; i <(n);i++)
#define ll long long
#define rev(s) reverse(s.begin(),s.end())
#define sor(v) sort(v.begin(),v.end())
#define PI 3.14159265358979323846264338327950L
//コード自動整形 Shift + Option + F @vscode
using namespace std;


/////main/////
int main() {
ll a,b,c,d,ac,ad,bc,bd;
cin>>a>>b>>c>>d;
ac = a*c;
ad=a*d;
bc=b*c;
bd=b*d;
cout<<max(ac,max(ad,max(bc,bd)))<<endl;

}
/////main/////

/////function/////

Measured memory_bytes: 3624
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    l = list(map(int, input().split()))

    cnt = [n] * 3001
    l2 = sorted(l)
    t = 1
    for i in range(n):
        cnt[l2[i]] -= t
        t+=1
    for i in range(1,3001):
        if cnt[i] > cnt[i-1]:
            cnt[i] = cnt[i-1]


    ans = 0
    for i in range(n):
        a = l2[i]
        for j in range(i + 1, n):
            b = l2[j]
            t = bisect_left(l2, a + b)
            ans += (t - (j+1))
    print(ans)


        
    



    
            
    

    

    

if __name__ == '__main__':
    main()


Measured memory_bytes: 5488
h, w, kk = map(int, input().split())

c = []
for i in range(h):
  c.append(input())

cnt = 0
for i in range(2**(h+w)):
  total = 0
  for j in range(h):
    if ((i >> j) & 1):
      for k in range(w):
        if ((i >> (h+k)) & 1) and c[j][k] == '#':
          total += 1
  if total == kk:
    cnt += 1

print(cnt)

Measured memory_bytes: 68552
#include<iostream>
#include<stdio.h>

using namespace std;

int main() {
	int m, n;
	int a[999][999], b[999], c[999], d[999];

	for (int i = 0; i < 999; i++) {
		c[i] = 0;
	}

	cin >> n >> m;

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

	for (int k = 0; k < m; k++) {
		cin >> b[k];
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++) {
			d[j] = a[i][j] * b[j];
			c[i] = c[i] + d[j];
		}
	}
	for (int i = 0; i < n; i++) {
		cout << c[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3468
n=int(input())
a=list(map(int,input().split()))
s=sorted([i for i in a if i<0])
t=sorted([i for i in a if i>=0])
if len(s)==0:
    print(t[-1]-t[0]+sum(t[1:-1]))
    k=t[0]
    if n!=2:
        for i in range(1,n-1):
            print(k,t[i])
            k-=t[i]
    print(t[-1],k)
elif len(t)==0:
    d=s[-1]
    print(s[-1]-sum(s[:-1]))
    for i in range(n-1):
        print(d,s[i])
        d-=s[i]
else:
    print(t[-1]-sum(s)+sum(t[:-1]))
    p=t[-1]
    for i in range(1,len(s)):
        print(p,s[i])
        p-=s[i]
    g=s[0]
    for i in range(len(t)-1):
        print(g,t[i])
        g-=t[i]
    print(p,g)

Measured memory_bytes: 14004
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

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

    if(n == 1 && m == 1){
        cout << 1 << endl;
        return 0;
    }else if(n == 1){
        cout << m-2 << endl;
        return 0;
    }else if(m == 1){
        cout << n-2 << endl;
        return 0;
    }

    cout << (n-2) * (m-2) << endl;
    return 0;


}

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

#define MAX_N 200000

#define xx first
#define yy second

using namespace std;

pair <int, int> v[MAX_N + 1];

int rez[MAX_N + 1];

int aib[MAX_N + 1];
int poz[MAX_N + 1];

int n;

void add(int i)
{
    while(i <= n)
    {
        aib[i] ++;

        i += i & (-i);
    }
}

int getSum(int i)
{
    int rez = 0;
    while(i > 0)
    {
        rez += aib[i];

        i -= i & (-i);
    }

    return rez;
}

set <pair<int, int>> s;

int comp[MAX_N + 1];
int dim[MAX_N + 1];
int mn[MAX_N + 1];
int h[MAX_N + 1];

int getComp(int a)
{
    return comp[a] = (comp[a] == a ? a : getComp(comp[a]));
}

void uneste(int a, int b)
{
    a = getComp(a);
    b = getComp(b);

    if(a == b)
        return;


    if(h[a] < h[b])
        swap(a, b);

    h[a] += (h[a] == h[b]);

    comp[b] = a;
    dim[a] += dim[b];

    s.erase({mn[b], b});
    s.erase({mn[a], a});
    mn[a] = min(mn[a], mn[b]);
    s.insert({mn[a], a});
}

int tmp[MAX_N + 1];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        cin >> v[i].xx >> v[i].yy;
        poz[v[i].xx] = i;
    }

    sort(v + 1, v + n + 1);

    for(int i = 1; i <= n; i ++)
    {
        set<pair<int,int>> :: iterator it = s.begin();

        int ok = 0;
        int k = 0;
        while(it != s.end() && (*it).xx < v[i].yy)
        {
            ok = 1;
            tmp[++ k] = (*it).yy;

            it ++;
        }

       // cout << " OK " << ok << "\n";

        comp[i] = i;
        dim[i] = 1;
        mn[i] = v[i].yy;

        if(ok == 0)
        {
            s.insert({mn[i], i});
        }

        else
        {
            for(int j = 1; j <= k; j ++)
            {
                uneste(tmp[j], i);
            }
        }
    }

    for(int i = 1; i <= n; i ++)
    {
        int x = getComp(i);
        rez[poz[v[i].xx]] = dim[x];
    }

    for(int i = 1; i<= n; i ++)
        cout << rez[i] << "\n";

    return 0;
}


Measured memory_bytes: 13644
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MAX=1e5+5;


int main()
{
       int n;
        cin>>n;
        double a[n];
        for(int i=0;i<n;i++)
        {
                cin>>a[i];
        }
        double DP[n+1][n];
        DP[0][0]=1-a[0];
        DP[1][0]=a[0];
        for(int i=2;i<=n;i++)
        {
                DP[i][0]=0;
        }
        for(int i=1;i<n;i++)
        {
                DP[0][i]=DP[0][i-1]*(1-a[i]);
                for(int j=1;j<=n;j++)
                {
                        if(j>i+1)
                        {
                                DP[j][i]=0;
                                continue;
                        }
                        //double temp=(DP[j-1][i-1]*a[i]+DP[j][i-1]*(1-a[i]));
                        //cout<<DP[j-1][i-1]<<" "<<a[i]<<" "<<DP[j][i-1]<<" "<<(1-a[i])<<" "<<temp<<endl;
                        DP[j][i]=(DP[j-1][i-1]*a[i]+DP[j][i-1]*(1-a[i]));
                }
        }
        // for(int i=0;i<=n;i++)
        // {
        //         for(int j=0;j<n;j++)
        //         {
        //                 cout<<DP[i][j]<<" ";
        //         }
        //         cout<<endl;
        // }
        double ans=0;
        for(int i=n;i>n/2;i--)
        {
                ans+=DP[i][n-1];
        }
        printf("%.10f",ans);
}

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

using namespace std;

int main() {
  int N, L;
  vector<string> strs(L, "");
  cin >> N >> L;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    strs[i] = s;
  }

  sort(strs.begin(), strs.end());
  string ret = "";
  for (auto &s : strs) {
    ret.append(s);
  }
  cout << ret << endl;
  return 0;
}


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

int main() {
    string S; cin >> S;
    int n = S.length();
    int idxOdd0 = 0, idxOdd1 = 0, idxEvn0 = 0, idxEvn1 = 0;
    for(int i = 0; i < n; i++) {
        if(i % 2 == 0) {
            if(S[i] == '0') {
                idxEvn0++;
            } else {
                idxEvn1++;
            }
        } else {
            if(S[i] == '1') {
                idxOdd1++;
            } else {
                idxOdd0++;
            }
        }
    }
    int startWZero = idxEvn0 + idxOdd1;
    int startWOne = idxEvn1 + idxOdd0;
    int nOfEven = idxEvn0 + idxEvn1;
    int nOfOdd = idxOdd0 + idxOdd1;

    if(startWZero >= startWOne) {
        cout << (nOfEven - idxEvn0) + idxOdd0 << endl;
    } else {
        cout << (nOfEven - idxEvn1) + idxOdd1 << endl;
    }
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
# S=numpp.assaray(S)=="#"
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LLS(): return [list(sys.stdin.readline().rstrip()) for _ in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()



def main():
    s = S()
    if s.count(s[0])==2 and s.count(s[1])==2 and s.count(s[2])==2:
        print("Yes")
    else:
        print("No")

    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 23400
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())

num = [4,4,4,4,4,4,4,4,3,4,4,4,3,4,3,4,1,1,1]

for i in range(N - 3):
	num2 = [0]*19
	num2[0] = num[0] + num[1] + num[2] + num[3]
	num2[4] = num2[0]
	num2[5] = num2[0] - num[17]
	num2[6] = num2[0]
	num2[1] = num[4] + num[7] + num[10] + num[13]
	num2[7] = num2[1]
	num2[8] = num2[1] - num[13]
	num2[9] = num2[1]
	num2[2] = num[5] + num[8] + num[11] + num[14]
	num2[10] = num2[2]
	num2[11] = num2[2]
	num2[12] = num2[2] - num[8]
	num2[3] = num[6] + num[9] + num[12] + num[15]
	num2[13] = num2[3]
	num2[14] = num2[3] - num[9] - num[16] - num[18]
	num2[15] = num2[3]
	num2[16] = num[9]
	num2[17] = num[9]
	num2[18] = num[1]
	for i in range(19):
		num2[i] = num2[i] % 1000000007
	num = copy.deepcopy(num2)

print(sum(num[0:16]) % 1000000007)

Measured memory_bytes: 39664
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: chars
    }
    let d = 998244353;
    let n = s.len();
    let mut dp: Vec<Vec<usize>> = vec![vec![0; n + 1]; n + 1];
    dp[0][0] = 1;
    for (i, &b) in s.iter().enumerate() {
        if b == '0' {
            dp[i + 1][0] = dp[i][0];
            for j in 1..i + 1 {
                dp[i + 1][j - 1] = (dp[i + 1][j - 1] + dp[i][j]) % d;
                dp[i + 1][j] = dp[i][j];
            }
        } else if b == '1' {
            for j in 0..i + 1 {
                dp[i + 1][j + 1] = dp[i][j];
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % d;
            }
        } else {
            for j in 0..i {
                dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % d;
                dp[i + 1][j + 2] = dp[i][j];
            }
            dp[i + 1][i + 1] = (dp[i + 1][i + 1] + dp[i][i]) % d;
        }
    }
    let mut ans = 0;
    for i in 0..n + 1 {
        ans += dp[n][i] * comb_m(n, i, d) % d;
    }
    println!("{}", ans % d);
}

fn prod_m(n: usize, m: usize, d: usize) -> usize {
    (n..m+1).fold(1, |ac, x| ac * x % d)
}

fn stair_m(n: usize, d: usize) -> usize {
    (1..n+1).fold(1, |ac, x| ac * x % d)
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}

fn inv_m(n: usize, d: usize) -> usize {
    pow_m(n, d - 2, d)
}

fn comb_m(n: usize, r: usize, d: usize) -> usize {
    prod_m(n - r + 1, n, d) * inv_m(stair_m(r, d), d) % d
}


Measured memory_bytes: 45308
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 2147483647
#define dinf 0x3f3f3f3f
#define llinf 0x7f7f7f7f7f7f7f7f

#define ll long long
#define rei register int
#define inv inline void
#define ull unsigned long long
#define il inline

#define bl putchar(' ')
#define ed putchar('\n')
#define test cout<<"this:" 

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x){
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
#define MAXN 1000005
int n,k;
struct node
{
	int id;
	int val;
}a[MAXN];
int cmp(node a,node b)
{
	return a.val<b.val;
}
int main(){
	read(n);
	for(rei i=1;i<=n;++i) read(a[i].val),a[i].id=i;
	sort(a+1,a+n+1,cmp);
	for(rei i=1;i<=n;++i) write(a[i].id),bl;
	return 0;
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

clock_t time_p = clock();

void rtime() {
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float) 1000 * (time_p) / CLOCKS_PER_SEC << "\n";
}

#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int INF=1e15;
const int MOD=1e9+7;
const int N=2e5+10;

void solve() {
    string str;
    cin>>str;
    if(str=="ARC") cout<<"ABC";
    else cout<<"ARC";
}

signed main() {
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif
    IOS;
    int t = 1;
//    cin >> t;
    for(int i=1;i<=t;i++) {
//        cout<<"Case #"<<tc<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3680
#include <iostream>
#include <string>
#include <cstring>
#define maxn 200009
using namespace std;
char s[maxn];
int cnt[maxn][26];
int main(){
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	for(int i = n; i >= 1; i--){
		for(int j = 0; j < 26; j++)
			cnt[i][j] = cnt[i + 1][j];
		cnt[i][s[i] - 'a']++;
	}
	long long ans = 0;
	for(int i = 1; i <= n; i++){
		long long sum = 0;
		for(int j = 0; j < 26; j++){
			if(s[i] - 'a' != j)
				sum += cnt[i][j];
		}
		ans += sum;
	}
	cout << ans + 1 << endl;
	return 0;
}

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

int dp[100][100];
int main() {
	int n, k;
	while (scanf("%d%d", &n, &k), n) {
		memset(dp, 0x3f, sizeof(dp));
		rep(i, n)dp[i][i] = 0;
		rep(i, k) {
			int a, b, c, d; scanf("%d%d%d", &a, &b, &c); b--; c--;
			if (!a) {
				if (dp[b][c] == INF)puts("-1");
				else printf("%d\n", dp[b][c]);
				continue;
			}
			scanf("%d", &d);
			if (dp[b][c] <= d)continue;
			dp[b][c] = dp[c][b] = d;
			rep(j, n)for (int k = j + 1; k < n; k++)
				dp[j][k] = dp[k][j] = min(dp[j][k], min(dp[j][b] + dp[c][k], dp[j][c] + dp[b][k]) + d);
		}
	}
}

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


int* a;
int cnt;
int n;


void search(int elem, int offset){

	// 偶数なら終了
	if((a[elem] + offset) % 2 == 0){
		return;
	}
	
	if(elem + 1 >= n){
		cnt--;
		return;
	}

	for(int i = -1; i <= 1; i++){
		search(elem + 1, i);
	}
}


int main(void){

	std::cin >> n;

	a = new int[n];
	for(int i = 0; i < n; i++){
		std::cin >> a[i];
	}

	cnt = (int)std::pow(3, n);
	for(int i = -1; i <= 1; i++){
		search(0, i);
	}

	std::cout << cnt << std::endl;

	delete[] a;

	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>

using namespace std;

int main(){
    int n;
    cin>>n;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for(int i=0;i<n;i++){
        string input;
        cin>>input;
        if(input == "AC")
            ++ac;
        else if(input == "WA")
            ++wa;
        else if(input == "TLE")
            ++tle;
        else if(input == "RE")
            ++re;
        else
            cout<<" Invalid input " << endl;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define MAX_H 50
#define MAX_W 50
#define INF 10000000
typedef pair<int, int> p; //firstは縦, secondは横

char grid[MAX_H][MAX_W];
int H, W;
int flag[MAX_H][MAX_W];
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, 1, 0, -1 };
int num = 0; // 黒マスの個数

void solve() {
	
	REP(i, H) {
		REP(j, W) flag[i][j] = INF;
	}

	queue<p> q;
	q.push(p(0, 0));
	flag[0][0] = 0;

	while (!q.empty()) {
		p que = q.front(); q.pop();

		REP(i, 4) {
			if (que.first == H && que.second == W) break;
			int ny = que.first + dy[i], nx = que.second + dx[i];
			if (0 <= ny && ny < H && 0 <= nx && nx < W && grid[ny][nx] == '.' && flag[que.first][que.second] + 1 < flag[ny][nx]) {
				q.push(p(ny, nx));
				flag[ny][nx] = flag[que.first][que.second] + 1;
			}
		}
	}

	if (flag[H - 1][W - 1] == INF) {
		cout << -1 << "\n";
		return;
	}
	else cout << H * W - num - flag[H - 1][W - 1] - 1 << "\n";
	return;

}

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

	cin >> H >> W;
	REP(i, H) {
		REP(j, W) {
			cin >> grid[i][j];
			if (grid[i][j] == '#') num++;
		}
	}
	solve();

	return 0;
}


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

N,M = map(int,input().split())
Al=list(map(int,input().split()))

Al_s = sorted(Al,reverse=True)
SUM=sum(Al)
trig=1/(4*M)*SUM
Bool=False

for i in range(M):
	if Al_s[i] >= trig:
		Bool=True
		continue
	else:
		Bool=False
		break

if Bool==True:
	print("Yes")
else:
	print("No")




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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;
const int INF = 1 << 30;

void solve()
{
  int d, g, p_input, c_input;
  cin >> d >> g;
  g /= 100;
  vector<int> point(d);
  vector<int> comp(d);

  for(int i = 0; i < d; ++i)
  {
    cin >> p_input >> c_input;
    c_input /= 100;
    point[i] = p_input;
    comp[i] = p_input * (i + 1) + c_input;
  }

  int mask = 1 << d;
  int ans = INF;
  while(mask--, mask >= 0)
  {
    int score = 0;
    int cost = 0;
    for(int i = 0; i < d; ++i)
    {
      if ((mask & (1 << i)) == 0) continue;
      score += comp[i];
      cost += point[i];
    }

    if (score >= g) 
    {
      ans = min(ans, cost);
      continue;
    }

    for(int i = d - 1; i >= 0; --i)
    {
      if(mask & (1 << i)) continue;

      int rest = (g - score) / (i + 1);
      score += min(rest, point[i] - 1) * (i + 1);
      cost += min(rest, point[i] - 1);

      if (score >= g) 
      {
        ans = min(ans, cost);
        break;
      }
    }
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;



int main() {
	speed;
	cout << fixed << setprecision(6);
	/*start*/
	int n, k;
	cin >> n >> k;
	vector<int>h(n);
	rep(i, n) {
		cin >> h[i];
	}
	int sum = 0;
	rep(i, n) {
		if (h[i] >= k)sum++;
	}
	c(sum);
	return 0;
}



Measured memory_bytes: 640