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

using namespace std;

struct Item {
    friend istream& operator>>(istream& inp, Item& item)
    {
        return inp >> item.w >> item.v;
    }
    int w, v;
};

template<typename T>
struct Matrix {
    Matrix(int rows, int columns) : _rows(rows), _columns(columns), a(rows * columns) {}
    T* operator[](int row) { return row * _columns + a.data(); }
    vector<T> a;
    int _rows, _columns;
};

int main()
{
    int n, maxw;
    cin >> n >> maxw;
    vector<Item> items(n);
    for (auto& item : items) cin >> item;
    Matrix<long long> dp(n, maxw + 1);
    for (int i = 0; i < n; ++i) {
        int w = items[i].w, v = items[i].v;
        for (int j = 0; j <= maxw; ++j) {
            if (i > 0) dp[i][j] = dp[i - 1][j];
            if (j >= w)
                dp[i][j] = max(dp[i][j], (i > 0 ? dp[i - 1][j - w] : 0) + v);
        }
    }
    cout << *max_element(dp[n - 1], dp[n - 1] + 1 + maxw);
    return 0;
}


Measured memory_bytes: 78336
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

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); }

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> p(n);
    REP(i, n) cin >> p[i];
    int ans = 0;
    FOR(i, 1, n - 1)
    {
        if(max({p[i-1], p[i], p[i+1]}) != p[i] && min({p[i-1], p[i], p[i+1]}) != p[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		if(N == 0) {
			System.out.println(1);
		}else {
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 27064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		
		int res = 0;
		for(int i=1; i<=N; i++){
			res += i;
		}
		
		System.out.println(res);
		
	}	
}

Measured memory_bytes: 8148
package main

import "fmt"

func main() {
	var t, p string
	fmt.Scan(&t)
	fmt.Scan(&p)

	runes := []rune(t)
	psize := len([]rune(p))
	for i := 0; i < len(runes); i++ {
		l := len(runes)
		if i + psize > l {
			continue
		}
		if string(runes[i:i+psize]) == p {
			fmt.Println(i)
		}
	}
}


Measured memory_bytes: 1304
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

const int MOD = 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	int n, k;
	cin >> n >> k;

	vector<int>	V(200010);
	bitset<200010> bs;
	rep(i, n)
	{
		int x;
		cin >> x;
		bs.set(x);
		V.at(x)++;
	}
	int bsn;
	bsn = bs.count();
	int cnt;
	cnt = 0;
	sort(V.begin(), V.end());
	int j;
	j = 0;
	while (V.at(j) == 0)
		j++;
	for (int i = bsn; i > k; i--)
	{
		cnt += V.at(j);
		j++;
	}
	cout << cnt << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
// using namespace atcoder;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define _GLIBCXX_DEBUG
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())       // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))    //最大値を求める
#define MIN(x) *min_element(ALL(x))    //最小値を求める
//定数
#define INF 1000000000000  // 10^12:極めて大きい値,∞
#define inf 2147483647     // int値の最大値
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back                             // vectorヘの挿入
#define MP make_pair                             // pairのコンストラクタ
#define F first                                  // pairの一つ目の要素
#define S second                                 // pairの二つ目の要素
#define CST(x) cout << fixed << setprecision(x)  //小数点以下の桁数指定
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;
}
int gcd(int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
//各桁の和
int sumDight(int x) {
    int sum = 0;
    while (x > 0) {
        sum += (x % 10);
        x /= 10;
    }
    return sum;
}
//回文数
int divideReverse(int x) {
    int reverse = 0;
    int r;
    while (x > 0) {
        r = x % 10;
        reverse = reverse * 10 + r;
        x /= 10;
    }
    return reverse;
}

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

    string s;
    cin >> s;
    string t="";
    int a = s.size();
    bool b = false;
    rep(i, a) {
        t += s[i];
        if (t == "dream") {
            if (s[i + 1] == 'e' && i + 2 < a&&s[i+2]=='r') {
               if(s[i+3]=='a'&&i+3<a){
                   i += 3;
                   t = "era";
               }
               else{
                   i += 2;
                   t = "";
               }
            }
            else
                t = "";

        }
         else if (t == "erase") {
            if (s[i + 1] == 'r' && i + 1 < a) {
                i++;
                t = "";
            } else
                t = "";
        }
    }
    if (t == "") cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const long long INF = 1LL << 60;
const int MOD = 1e9 + 7;

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

bool isGuMojiretsu(string S){
	int n = S.size();
	if(n %2 == 0){
		rep(i,n/2){
			if(S[i]!=S[n/2+i]){
				return false;
			}
		}
		return true;
	}else{
		return false;
	}
}

int main() {
	int H,W;
	cin >> H >> W;

	std::vector<string> S(H);
	S.insert(S.begin(),string(W+2,'.'));
	S.push_back(string(W+2,'.'));
	
	rep(i,H){
		cin >> S.at(i+1);
		S.at(i+1) = "."+S.at(i+1)+".";
	}

	int cnt = 0;
	rep2(i,1,H+1){
		rep2(j,1,W+1){
			cnt = 0;
			rep2(qq,-1,1+1){
				rep2(pp,-1,1+1){
					cnt += (S.at(i+pp)[j+qq]=='#' && !(pp==qq && pp == 0))?1:0;
				}
			}
			S.at(i)[j] = (S.at(i)[j]=='#')?'#':cnt+'0';
		}
		cout << S.at(i).substr(1,W) << endl;
	}
	return 0;

}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
const int N=500005,M=(1<<20)+5;
const int MOD=1000000007;
int n;
int a[N],s[N];
vector<int>pos[M];
long long dp[N];
long long f[M],g[M];
int sum[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sum[0]=1;
	for(int i=1;i<=n;i++)
	{
		s[i]=s[i-1]^a[i];
		pos[s[i]].push_back(i);
		sum[i]=sum[i-1];
		if(s[i]==0) sum[i]++;
	}
	for(int i=1;i<=n;i++)
		if(s[i])
		{
			dp[i]=1;
			dp[i]=(dp[i]+f[s[i]]*sum[i]%MOD-g[s[i]]+MOD)%MOD;
			f[s[i]]=(f[s[i]]+dp[i])%MOD,g[s[i]]=(g[s[i]]+dp[i]*sum[i]%MOD)%MOD;
		}
		else
		{
			dp[i]=1;
			dp[i]=(dp[i]+f[s[i]])%MOD;
			f[s[i]]=(f[s[i]]+dp[i])%MOD,g[s[i]]=(g[s[i]]+dp[i]*sum[i]%MOD)%MOD;
		}
	long long ans=dp[n];
	if(!s[n]) 
	{
		for(int i=1;i<=n;i++)
			if(s[i]) ans=(ans+dp[i])%MOD;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 63516
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int t,n;
	cin >> t;
	if(t == 0) break;
        cin >> n;
	REP(i,n){
	    int s,e;
	    cin >> s >> e;
	    t -= e-s;
	}
	if(t <= 0) cout << "OK" << endl;
	else cout << t << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            var s = ReadLine().Split(' ').Select(int.Parse).ToArray();

            int a = s[0];
            int b = s[1];

            int now = a;
            int ans = 1;
            while (now < b)
            {
                now -= 1;
                now += a;
                ans++;
            }
            WriteLine(b == 1 ? 0:ans);
        }
    }
}


Measured memory_bytes: 13396
a=(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)
b=int(input())-1
print(a[b])

Measured memory_bytes: 3060
N, K = map(int, input().split())
Ss = list(input())

if Ss[K-1] == 'A':
    Ss[K-1] = 'a'
elif Ss[K-1] == 'B':
    Ss[K-1] = 'b'
else:
    Ss[K-1] = 'c'

print(''.join(Ss))


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

#define MAX 100001

int main(){
    int n;cin >> n;
    int a[n], b[MAX];
    int p = INT_MIN;
    for(int i = 0; i < MAX; i++) b[i] = 0;
    for(int i = 0; i < n; i++){
         cin >> a[i];
         b[a[i]]++;
         p = max(p, a[i]);
    }

    int ma = INT_MIN;
    for(int i = 1; i < MAX; i++){
        int sum = b[i-1] + b[i] + b[i+1];
        ma = max(ma, sum);
    }
    cout << ma << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;


/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {

    static int IleRazy(int i) {
        int licznik = 0;
        while (i % 2 == 0) {
            i /= 2;
            ++licznik;
        }
        return licznik;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int wynik = 0, res = 0;
        for (int i = 1; i <= n; i++) {
            int ilosc = IleRazy(i);
            if (ilosc >= wynik) {
                wynik = ilosc;
                res = i;
            }
        }
        System.out.println(res);
    }
}


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

using namespace std;
typedef long long ll;

ll dp[(1 << 16) + 1][20];
ll G[20][20];
int main() {
    int n, m, i, j, k;
    cin >> n >> m;
    for(i = 0; i <= n; i++) {
        for(j = 0; j <= n; j++) {
            G[i][j] = 1e9;
        }
    }
    for(i = 0; i < m; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        G[s][t] = d;
    }

    for(i = 0; i < 1 << n; i++) {
        for(j = 0; j < n; j++) {
            dp[i][j] = 1e9;
        }
    }
    dp[1][0] = 0; //始点は0に固定
    for(i = 0; i < 1 << n; i++) {
        for(j = 0; j < n; j++) {
            if(i >> j & 1) {
                for(k = 0; k < n; k++) {
                    if(j != k && (i >> k & 1)) dp[i][j] = min(dp[i][j], dp[i ^ (1 << j)][k] + G[k][j]);
                }
            }
        }
    }
    ll ret = 1e9;
    for(i = 0; i < n; i++) {
        ret = min(dp[(1 << n) - 1][i] + G[i][0], ret);
    }
    cout << (ret != 1e9 ? ret : -1) << endl;
    return 0;
}


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

int main() {
  char c[4];
  for (int i = 0; i < 4; i++)
  {
      cin >> c[i];
  }
  if ((c[0] == c[1] && c[1] == c[2]) || (c[1] == c[2] && c[2] == c[3]))
    cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";cout<<endl;}
void solve(){
  vector<int> v(4);
  for(auto &it:v)cin>>it;
  if(abs(v[0]-v[1])<=v[3] and abs(v[1]-v[2])<=v[3])cout<<"Yes"<<endl;
  else if(abs(v[0]-v[2])<=v[3])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
int32_t main(){
  IOS;
  solve();
  #ifdef LOCAL_DEFINE
  cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif
}

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

using namespace std;

int main() {
	int N, D;
	cin >> N >> D;
	int X[10][10];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			cin >> X[i][j];
		}
	}
	int ans = 0;
	double sum;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			sum = 0;
			for (int k = 0; k < D; k++) {
				sum += abs(X[i][k] - X[j][k]) * abs(X[i][k] - X[j][k]);
			}
			sum = sqrt(sum);
			if (floor(sum) == sum) ans++;
		}
	}
	cout << ans << endl;
	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }


string str;

int main() {
    while (cin >> str) {
        int joi = 0, ioi = 0;
        for (int i = 0; i < str.size()-2; ++i) {
            if (str.substr(i, 3) == "JOI") ++joi;
            if (str.substr(i, 3) == "IOI") ++ioi;
        }
        cout << joi << endl << ioi << endl;
    }
    return 0;
}


Measured memory_bytes: 1216
n=int(input())
x,y,h=map(int,input().split())
d=set([(x,y,h)])
t=[x,y,h]
for i in range(n-1):
    x,y,h=map(int,input().split())
    d.add((x,y,h))
    if t[2]==0: t=[x,y,h]

for i in range(101):
    for j in range(101):
        f=0
        p=abs(t[0]-i)+abs(t[1]-j)+t[2]
        for k in d:
            if k[2]!=0 and abs(k[0]-i)+abs(k[1]-j)+k[2]!=p: f=1
            if k[2]==0 and abs(k[0]-i)+abs(k[1]-j)+k[2]<p: f=1
        if f==0:
            print(i,j,p)
            exit()

Measured memory_bytes: 3188
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	hh := make([]int, n)
	aa := make([]int64, n)
	for i := 0; i < n; i++ {
		hh[i] = getNextInt(scanner)
	}

	for i := 0; i < n; i++ {
		aa[i] = getNextInt64(scanner)
	}

	seg := Segment{}

	seg.init(n + 1)

	for i := 0; i < n; i++ {
		mx := seg.max(0, hh[i])
		seg.maximize(hh[i], mx+aa[i])
	}

	fmt.Fprintln(writer, seg.bucket[seg.h-1][0])
	writer.Flush()
}

// Segment ...
type Segment struct {
	n, h, i, chunk int
	unit           []int
	bucket         [][]int64
}

func (seg *Segment) init(n int) {
	seg.n = n
	seg.unit = make([]int, 1)
	seg.unit[0] = 1
	seg.bucket = make([][]int64, 1)
	seg.bucket[0] = make([]int64, n)

	chunk := 8
	for i := 0; n > 1; i++ {
		n = (n-1)/chunk + 1
		seg.bucket = append(seg.bucket, make([]int64, n))
		seg.unit = append(seg.unit, seg.unit[i]*chunk)
	}
	seg.h = len(seg.unit)
	seg.chunk = chunk
}

func (seg *Segment) maximize(index int, value int64) {
	seg.bucket[0][index] = value
	for seg.i = 0; seg.i < seg.h-1; seg.i++ {
		parent := index / seg.chunk
		if seg.bucket[seg.i+1][parent] < value {
			seg.bucket[seg.i+1][parent] = value
		}
		index /= seg.chunk
	}
}

func (seg *Segment) max(l, r int) int64 {
	var max int64
	var i int
	for index := l; index < r; index += seg.unit[i] {
		for i < seg.h-1 && index%seg.unit[i+1] == 0 {
			i++
		}
		for i > 0 && index+seg.unit[i] >= r {
			i--
		}
		ii := index / seg.unit[i]
		if max < seg.bucket[i][ii] {
			max = seg.bucket[i][ii]
		}
	}

	return max
}


Measured memory_bytes: 10368
while True:
  N = input()
  if not N:
    break
  m = dict()
  o = []
  for i in range(N):
    a, b, c = map(int, raw_input().split())
    o.append(a)
    m[a] = (m[a] if a in m else 0) + b * c
  oo = []
  for x in o:
    if x not in oo:
      oo.append(x)
  for i in oo:
    if m[i] >= 1000000:
      print(i)
  if max(m.values()) < 1000000:
    print('NA')

Measured memory_bytes: 4348
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
using ld = long double;

const ld PI = acos(-1);

struct point {
    ld x, y;
};

int main() {
    int N;
    cin >> N;
    vector<point> coo(N);
    for (auto& p : coo) cin >> p.x >> p.y;

    for (int i = 0; i < N; ++i) {
        vector<ld> degs;
        for (int j = 0; j < N; ++j) {
            if (i == j) continue;
            degs.push_back(atan2(coo[i].y - coo[j].y, coo[i].x - coo[j].x));
        }
        sort(degs.begin(), degs.end());
        degs.push_back(degs.front() + PI * 2);

        ld ans = 0;
        for (int j = 0; j < N; ++j) {
            ans = max(ans, degs[j + 1] - degs[j] - PI);
        }
        cout << fixed << setprecision(10) << ans / (PI * 2) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int n,m,bs[SZ]; pii g[SZ];
bool cmp(pii a,pii b) {return a.se-a.fi<b.se-b.fi;}
void edt(int x,int y)
{for(;x<=m;x+=x&-x) bs[x]+=y;}
void add(int l,int r) {edt(l,1); edt(r+1,-1);}
int sum(int g)
{
	int s=0;
	for(;g>=1;g-=g&-g) s+=bs[g];
	return s;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
		scanf("%d%d",&g[i].fi,&g[i].se);
	sort(g+1,g+1+n,cmp);
	int p=1;
	for(int i=1;i<=m;++i)
	{
		while(p<=n&&g[p].se-g[p].fi+1<=i)
			add(g[p].fi,g[p].se),++p;
		int ans=n-p+1;
		for(int j=i;j<=m;j+=i) ans+=sum(j);
		printf("%d\n",ans);
	}
}


Measured memory_bytes: 7040
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = (x-a)/b;
    System.out.println(x - (a + b*n));
  }
}

Measured memory_bytes: 23764
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// #define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define vvv64 vector<vv32>
#define vvvv64 vector<vvv32>
ll exp(ll n, ll e)
{
    if (e==0)
        return 1;
    ll temp=exp((n*n)%MOD,e/2);
    return e%2==0 ? temp : (temp*n)%MOD;
}
void solve()
{
//Read Comments below main
	 int r,c;
	 cin>>r>>c;
	 vector<string> arr(r+1);

	 for (int i=1; i<=r; i++)
	 {
	 	cin>>arr[i];
	 	arr[i]="a"+arr[i];
	 }
	 arr[0]=arr[1];
	 vv64 dp(r+1,v64(c+1,1e9));
	 dp[1][1]=(arr[1][1]=='#');
	 for (int i=1; i<=r; i++)
	 {
	 	for (int j=1; j<=c; j++)
	 	{
	 		if (i==1 && j==1)
	 			continue;
	 		if (arr[i][j]=='.')
	 		{
	 			dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
	 		}
	 		else
	 		{
	 			if (arr[i][j-1]==arr[i][j])
	 				dp[i][j]=min(dp[i][j],dp[i][j-1]);
	 			else
	 				dp[i][j]=min(dp[i][j],dp[i][j-1]+1);	 				

	 			if (arr[i-1][j]==arr[i][j])
	 				dp[i][j]=min(dp[i][j],dp[i-1][j]);
	 			else
	 				dp[i][j]=min(dp[i][j],dp[i-1][j]+1);	 				
	 		}
	 	}
	 }
	 cout<<dp[r][c]<<endl;
}
 
int main() {
    fast_cin();
    ll t=1;
    // cin>>t;
    while (t--)
    {
        solve();
    }
    return 0;
}
// BITMASK:
// 1)When some constraint is of the order of 15-20, think of bitmask DP.
// 2)When some constraint is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algo

Measured memory_bytes: 384
#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;

int main(){
  string s;
  cin >> s;
  set<char> se;
  rep(i, s.size()) se.insert(s.at(i));
  bool f = false;
  if(auto itr = se.find('N') != se.end()){
    if(se.find('S') == se.end()) f = true;
  }
  if(auto itr = se.find('S') != se.end()){
    if(se.find('N') == se.end()) f = true;
  }
  if(auto itr = se.find('W') != se.end()){
    if(se.find('E') == se.end()) f = true;
  }
  if(auto itr = se.find('E') != se.end()){
    if(se.find('W') == se.end()) f = true;
  }
  if(f == false) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    if (a + b + c >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long LL;

const int N=2e5+10,Inf=1e9+10,Mod=1e9+7;

int n,X,Y,c[N],w[N],fact[N],inv[N],Mn[N],cnt[N];

void Init()
{
	scanf("%d%d%d",&n,&X,&Y);
	for (int i=1;i<=n;++i)
		scanf("%d%d",&c[i],&w[i]);
}

LL Calc(int n,int m) { return 1ll*fact[n]*inv[m]%Mod*inv[n-m]%Mod; }

void Solve()
{
	inv[0]=inv[1]=1; for (int i=2;i<=n;++i) inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
	fact[0]=fact[1]=1; for (int i=2;i<=n;++i) fact[i]=1ll*fact[i-1]*i%Mod,inv[i]=1ll*inv[i-1]*inv[i]%Mod;
	
	for (int i=1;i<=n;++i) Mn[i]=Inf;
	int Min=Inf,col=0,Min2=Inf,col2=0;
	for (int i=1;i<=n;++i)
		Mn[c[i]]=min(Mn[c[i]],w[i]);
	for (int i=1;i<=n;++i)
		if (Mn[i]!=Inf)
		{
			if (Mn[i]<Min)
			{
				Min2=Min; col2=col;
				Min=Mn[i]; col=i;
			}else if (Mn[i]<Min2) Min2=Mn[i],col2=i;
		}	
	for (int i=1;i<=n;++i)
	{
		if (Mn[c[i]]+w[i]<=X) cnt[c[i]]++;
		else if (c[i]!=col && w[i]+Min<=Y) cnt[c[i]]++;
		else if (c[i]!=col2 && w[i]+Min2<=Y) cnt[c[i]]++;
	}
	LL sum=0,ans=1;
	for (int i=1;i<=n;++i) if (Mn[i]!=Inf && (Mn[i]+Min<=Y || i==col)) sum+=cnt[i];
	for (int i=1;i<=n;++i)
		if (Mn[i]!=Inf && (i==col || Mn[i]+Min<=Y))
		{
			ans=ans*Calc(sum,cnt[i])%Mod;
			sum-=cnt[i];			
		}
	printf("%lld\n",ans);
}

int main()
{
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 4864
MAX_A = 10**6 + 1
MAX_P = MAX_A // 2
is_prim = [i%2==1 for i in range(MAX_P)]
is_prim[1] = False; is_prim[2] = True
for i in range(3, MAX_P):
    if not is_prim[i]: continue
    for j in range(i+i, MAX_P, i): is_prim[j] = False

def solve():
    C = [0] * MAX_A
    for a in A: C[a] += 1
    pairwise = True
    for p in [i for i in range(MAX_P) if is_prim[i]]:
        if sum(C[p::p]) > 1: pairwise = False
    if pairwise: return 'pairwise'
    from math import gcd
    g = 0
    for a in A: g = gcd(g, a)
    if g == 1: return 'setwise'
    return 'not'

n = int(input())
A = [*map(int, input().split())]
print(solve(), 'coprime')


Measured memory_bytes: 130984
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll dp[1005][1005];
char arr[1005][1005];

const int mod = pow(10, 9) + 7;
ll check(ll r, ll c)
{
	if (r < 0 || c < 0)
	{
		return 0;
	}
	else if (arr[r][c] == '#')
	{
		return 0;
	}
	else
	{
		return dp[r][c];
	}
}
int main()
{

	ll h, w;
	cin >> h >> w;
//	char arr[h][w];
	for (ll i = 0; i < h; i++)
	{
		for (ll j = 0; j < w; j++)
		{
			cin >> arr[i][j];
		}
	}
	dp[0][0] = 1;
	for (ll i = 0; i < h; i++)
	{
		for (ll j = 0; j < w; j++)
		{
			if (!(i == 0 && j == 0))
			{
				dp[i][j] = (check(i - 1, j) + check(i, j - 1)) % mod;
			}
		}
	}

	cout << dp[h - 1][w - 1] << endl;
}

Measured memory_bytes: 9088
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> s = new List<int>();
      static List<int> v = new List<int>();
      static List<int> w = new List<int>();
    static decimal result;
static Hashtable ht=new Hashtable();
static StringBuilder sb = new StringBuilder();
static int N,M,K;
static long[,] table;
    static void Main()
    {
Read4();
      Read5();
decimal[,] check=new decimal[N,K];
  check[0,w[0]]=v[0];
      for(int i=1;i<N;i++){
      for(int j=0;j<K-w[i];j++){
        if(check[i-1,j]+v[i]>check[i-1,j+w[i]]){check[i,j+w[i]]=check[i-1,j]+v[i];}
      else{check[i,j+w[i]]=check[i-1,j+w[i]];}
      }
        for(int j=0;j<w[i];j++){check[i,j]=check[i-1,j];}
      }
      for(int i=0;i<K;i++){result=Math.Max(result,check[N-1,i]);} 
                    Console.WriteLine(result.ToString());
    }


    static void Read1()//1項
    {
        string tmp = Console.ReadLine();
        N = int.Parse(tmp);
    }
 
    static void Read2()//複数項（項目数Ｎ）
    {
        string[] tmp = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read3()//1行複数項
   {
       string[] tmp = Console.ReadLine().Split(' ');
       for (int i = 0; i < tmp.Length; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read4()//NK１行
    {
        string[] tmp = Console.ReadLine().Split(' ');
       N = int.Parse(tmp[0]);
       K = int.Parse(tmp[1])+1;
    }
    static void Read5()//N行K項
    {
for(int i=0;i<N;i++){
       string[] tmp = Console.ReadLine().Split(' ');
       w.Add(int.Parse(tmp[0]));
       v.Add(int.Parse(tmp[1]));
}
 
    }


}

Measured memory_bytes: 166624
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define all(v) v.begin(),v.end()
#define boost ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#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 << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int gcd(int a,int b){
	if(b==0)return a;
	
	return gcd(b,a%b);
	}
void solve() {
	string s;cin>>s;
	if(s.back()=='s')s+="es";
	else if(s.back()!='s')s+="s";
	
	cout<<s<<endl;
}
int main()
{boost;
int t;t= 1;//cin>>t;
while(t--){solve();}
}


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

#define F first
#define S second

using namespace std;

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

const int N = 1000010, M = 25;

double n;

int main()
{
	scanf("%lf", &n);
	printf("%.12f\n", (n / 3) * (n / 3) * (n / 3));
	return 0;
}

Measured memory_bytes: 256
def l(): return list(map(int, input().split()))
def m(): return map(int, input().split())

def sieve(n): # エラトステネスの篩ですよ
  num = [True]*n
  num[0] = num[1] = False
  for i in range(2,int(n**0.5)+1):
    if num[i]:
      for j in range(i**2, n, i):
        num[j] = False
  return num

def main():
  q = int(input())
  l , r = [0]*q, [0]*q
  for i in range(q):
    l[i], r[i] = m()
  rr = 101010
  prime = sieve(rr+1)
  # print(prime)
  likp = [0]*rr
  for i in range(rr):
    if i % 2 == 0: continue
    if prime[i] and prime[(i+2)//2]: likp[i] = 1
  # print(likp)
  sm = [0]*(rr+1)
  for i in range(rr):
    sm[i+1] = sm[i] + likp[i]
  # print(sm)
  for i in range(q):
    print(sm[r[i]+1] - sm[l[i]])

if __name__ == '__main__':
  main()


Measured memory_bytes: 16376
N = int(input())
A = list(map(int, input().split()))
total = sum(A)
costs = [0 for x in range(N-1)]
mem = [0 for x in range(N-1)]

for i in range(1, N):
  if i == 1:
    mem[i-1] = A[i-1] * 2
  else:
    mem[i-1] = mem[i-2] + A[i-1] * 2
  costs[i-1] = abs(total - mem[i-1])
  
print(min(costs))


Measured memory_bytes: 29312
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<tuple>
#include<ctime>
#include<functional>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p; 
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))

int main(){
    string N;
    int ans=0;
    cin>>N;
    for(int i=0;i<N.size();i++){
        ans+=N[i]-'0';
    }
    if(ans%9==0) p("Yes");
    else p("No");
}

Measured memory_bytes: 3672
s = input()

a = []
ans = ""

for i in range(len(s)):
    if s[i] == '0':
        a.append('0')

    elif s[i] == '1':
        a.append('1')

    else:
        if len(a) != 0:
            a.pop()

#print(a)

ans = "".join(a)

print(ans)


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
//#include <bits/stdc++.h>

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <fstream>
#include <array>
#include <string>
#include <cstring>
#include <functional>
#include <ctime>
#include <iostream>
#include <unordered_set>
#include <complex>

#include <nmmintrin.h>
#include <mmintrin.h>
#include <emmintrin.h>


using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
//#define printe(...) void();
#define printE(...) fprintf(stderr, __VA_ARGS__);
//#define printE(...) void();


#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,P) scanf("%d %d %d %d",&n,&m,&o,&P)
#define SINT5(n,m,o,P,q) scanf("%d %d %d %d %d",&n,&m,&o,&P,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


// const int INF = 1'010'000'000; // 0x3C33'6080
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863


int main() {
	string a;
	cin >> a;
	cout << (a == "ABC" ? "ARC" : "ABC") << endl;
}



Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  typedef long long ll;
  ll l,r;
  int ans=2018;
  cin >> l >> r;
    r=min(r,l+2019);
    for(ll i=l;i<r;i++){
for(ll j=l+1;j<=r;j++) {
  int x=i*j%2019;
  ans=min(x,ans);
    }
    }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>=22)cout<<"bust";
  else cout<<"win";
  

}


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

using namespace std;
using ll = long long;

ll cost(ll x, ll y) {
    return (x - y) * (x - y);
}

int main() {
    int n; scanf("%d", &n);
    ll a[n];
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }

    ll ans = 2e9;
    for (ll y = -100; y <= 100; y++) {
        ll temp = 0;
        for (int i = 0; i < n; i++) {
            temp += cost(a[i], y);
        }

        ans = min(ans, temp);
    }

    printf("%lld\n", ans);
}


Measured memory_bytes: 3792
b[5<<17],S[2<<17],q;char*p=S;main(t){for(scanf("%*d%s%*d ",S);*p;)b[++q]=1<<*p++-97;for(;~scanf(~getchar()&1?t=0,"%d%d ":"%d%s ",&q,S);)if(t)b[q]=1<<*S-97;else{for(int i=q;i<=*S;)t|=b[i++];printf("%d ",__builtin_popcount(t));}}

Measured memory_bytes: 4604
#include <iostream>
using namespace std;
int main(void){
int x,y,D,L;
cin>>D>>L;
x=D%L;
y=D/L;
if(D>L){
    cout<<y+x<<endl;
}
else if (D<L){
    cout<<x<<endl;
}
else {
    cout<<y<<endl;
    
}
}



Measured memory_bytes: 3100
//再帰関数 ABC_029_C
/*
void f(int rest , string s){
  if(rest == 0){
    cout << s << endl;
  }
  else{
    for(char moji = 'a' ;moji <='c' ; moji++){
      f(rest-1,s+moji);
    } 
  }
}
 
int main() {
  int n;
  cin >> n;
  f(n, "");
}
*/
  //連想配列 ARC_081_Cの解答 //ABC073でも復習できます。
/*
int main() {
  ll n;
  cin >> n;
  vector<ll>a(n);
  rep(i,n) cin>>a.at(i);
  map<ll,ll>mp;
  rep(i,n){
    mp[a.at(i)]++;
  }
  ll one  = 0;
  ll two = 0;
  for(auto p:mp){
//    cout << p.first << " " << p.second << endl;
    if(p.second >= 2){
      if(one <= p.first){
        two = one;
        one = p.first;
      }
    }
    if(p.second >= 4){
      if(one <= p.first){
        two = p.first;
        one = p.first;
      }
    }
  }
//  cout << one << endl;
//  cout << two << endl;
//  cout << endl;
  cout << one * two << endl;
}
*/

//#define pi 3.14159265359
//桁数を指定して出力する方法
//#include <iomanip>//これをincludeしておかないといけない
//cout << fixed << setprecision(20)<< ans << endl;

//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//getline(cin, s); //空白文字を含むものをまとめて入力できる。
//s配列に格納した単語を、辞書順にソートする
//  sort(s.begin(), s.end());
//  string t = "keyence";//で文字列を格納できる
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s; cin >> s;
  int n; cin >> n;
  vector<int>a(n); vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*/
//vector<vector<int>> a(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//10のi乗pow(10, i);//ただしdouble型のため注意
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int gcd(ll a, ll b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

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

int kan_hyaku(int n){
  int kurai = 0;
  for(int i=0;i<3;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ju(int n){
  int kurai = 0;
  for(int i=0;i<2;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ichi(int n){
  int kurai = 0;
  for(int i=0;i<1;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}

int keta(int n){
  int wa = 1;
  while(n>0){
    wa *=10;
    n--;
  }
  return wa;
}

int main() {
  int a,b,c,n;
  cin >> a >> b >> c >> n;
  int count = 0;
  for(int i=0;i<=3000;i++){
    for(int j=0;j<=3000;j++){
      int num = n - a * i - b * j;
      if(num >= 0){
        if(num % c == 0 ) count++;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3552
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int main(void){
    ll N, M, X, A[105], c=0;
    scanf("%lld %lld %lld", &N, &M, &X);
    rep(i, 0, M) scanf("%lld", A+i);
    rep(i, 0, M){
        if(A[i]<X) c++;
    }
    printf("%lld\n", min(c, M-c));
    return 0;
}


Measured memory_bytes: 128
from __future__ import division, print_function
from sys import stdin
ROW = '#.' * 151
for line in stdin:
    h, w = (int(s) for s in line.split())
    if h == 0 and w == 0:
        break
    b = [ROW[:w], ROW[1:w+1]]
    print('\n'.join(b[y % 2] for y in range(h)), end='\n\n')

Measured memory_bytes: 4248
//#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

using namespace std;
using ll=long long;

void solve(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b)cout << c << endl;
  if(b==c)cout << a << endl;
  if(a==c)cout << b << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define int long long
signed main(){
  int N;
  std::cin>>N;
  int temp_ans=0,count=0,past,now;
  for (int i=0;i<N;i++){
    if(i==0){
      std::cin>>now;
      past=now;
    }else{
      std::cin>>now;
      if(past>=now){
        count++;
      }else{
        temp_ans=std::max(temp_ans,count);
        count=0;
      }
      past=now;
    }
  }
  temp_ans=std::max(temp_ans,count);
  std::cout<<temp_ans<<std::endl;
}


Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
        int a,b,c,x,y;cin>>a>>b>>c>>x>>y;
        int res = 0;
        int mn = min(x,y);
        res = min(a+b,2*c)*mn;
        x-=mn;y-=mn;
        if(x)res += min(a*x,2*c*x);
        if(y)res += min(b*y,2*c*y);
        cout<<res;
    }
    


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    scanf("%d %d" , &n , &m);
    vector < int > v(n);

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

    sort(v.begin() , v.end() , [&](int a , int b){return a > b;});

    ll sum = 0;
    for(int i = m ; i < n ; i ++){
            sum += 1ll * v[i];
    }

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

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        long number = Long.parseLong(str);
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            sum += Character.getNumericValue(str.charAt(i));
        }
        System.out.println(number % sum == 0 ? "Yes" : "No");
    }
}

Measured memory_bytes: 22740
package main

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

func main() {
	A := ReadInts(5)
	min := 10
	for i := 0; i < 5; i++ {
		if A[i]%10 > 0 {
			min = Min(min, A[i]%10)
		}
	}
	sum := 0
	for i := 0; i < 5; i++ {
		sum += (A[i] + 9) / 10 * 10
	}
	fmt.Println(sum - (10 - min))
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

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


Measured memory_bytes: 1840