akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
const int N=1009;
int n,k,a[N],f[N],dp[N][22],c[N][N];
int powm(int a,int t=mod-2){
	int x=1;
	while(t){
		if(t&1)x=x*a%mod;
		a=a*a%mod,t>>=1;
	}
	return x;
}
int solve(int i,int d){
	if(d==0 and i==0)return 1;
	if(d==0)return 0;
	if(dp[i][d]!=-1)
		return dp[i][d];
	int sum=0;
	for(int j=0;j<=i and j<=a[d];j++)
		sum=(sum+(solve(i-j,d-1)*c[n-j][a[d]-j]%mod*c[i][j]%mod))%mod;
	return dp[i][d]=sum;
}
int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	cin >> n >> k;
	for(int i=1;i<=k;i++)
		cin >> a[i];
	f[0]=1;
	for(int i=1;i<=n;i++)
		f[i]=f[i-1]*i%mod;
	memset(c,0,sizeof c);
	memset(dp,-1,sizeof dp);
	for(int i=0;i<=n;i++){
		c[i][0]=1,c[i][i]=1;
		for(int j=1;j<i;j++)
			c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
	cout << solve(n,k);
}


Measured memory_bytes: 8448
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		int a =sumDigits(n);
		if(n%a==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

	private static int sumDigits(int n) {
		int sum = 0;
		//自然数の各桁の和を計算
		while (n != 0) {
			//sumDigitsは単独ではloopしないので、while loopを使う。
			sum += n % 10;
			//再右端の桁を得るために%10を利用する。
			n /= 10;
			//再右端の桁を取り除くためにn/=10を利用する。
		}
		return sum;//合計を返す
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9+7
typedef long long int ll;
const int maxn = 200000;
ll mod = INF;
ll sum[maxn];
ll a[maxn];
ll ans=0;
int n;

int main(){
    
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    sum[0]=a[0];
    for(int i=1;i<n;i++)sum[i]=(sum[i-1]+a[i])%mod;

    for(int i=0;i<n;i++){
        ll temp=sum[n-1]-sum[i];
        while(temp<0)temp+=INF;
        ans=(ans+a[i]*temp%mod)%mod;
    }

    cout << ans<<endl;
    return 0;
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, k;
    cin >> n >> k;
    vector<ll> cnt(n, 0);
    rep(i, k) {
        ll d;
        cin >> d;
        rep(j, d) {
            ll a;
            cin >> a;
            a--;
            cnt[a]++;
        }
    }
    ll ans = 0;
    rep(i, n) {
        if (cnt[i] == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

/*Range Add Min(Max) Query*/
/*区間加算、区間Min,区間Max*/

template<typename D, int toMaxQuery = 0, int useAssert = 1>
class RMAQ{
public :
  struct T{ //遅延データ
    int type; //0 - empty, 1 - add
    D value;
    T():type(0){}
    T(int type, D value):type(type), value(value){}
  };
  int n, n_;
  D initValue;        //範囲外の時に返す値。
  vector<D> dat;
  vector<T> td;
  RMAQ(){n=-1;}
  RMAQ(int n_, D initValue):n_(n_), initValue(initValue){
    n=1;
    while(n<n_)n*=2;
    td.resize(2*n-1, T());
    dat.resize(2*n-1, 0);
  }

  //目的データのマージ
  inline D mergeD(D l, D r){return toMaxQuery? max(l, r):min(l, r);}

  //遅延データのマージ
  inline T mergeT(const T &from,const T &to){
    if(from.type == 0) return to;
    if(to.type == 0) return from;
    return T(1, from.value + to.value);
  }

  //目的データに遅延データを反映
  inline void apply(D &a, const T &b){
    if(b.type == 0) return;
    a += b.value;
  }

  D dfs(int a, int b,const T x, int k, int l, int r){
    if(r <= a || b <= l) return x.type == 0? initValue:dat[k];
    if(a <= l && r <= b){
      td[k] = mergeT(td[k], x);
      apply(dat[k], x);
      return dat[k];
    }
    int kl = k * 2 + 1, kr = k * 2 + 2;
    { //遅延を子に反映
      td[kl] = mergeT(td[kl], td[k]);
      td[kr] = mergeT(td[kr], td[k]);
      apply(dat[kl], td[k]);
      apply(dat[kr], td[k]);
      td[k] = T();
    }
    D vl = dfs(a, b, x, kl, l, (l+r)/2);
    D vr = dfs(a, b, x, kr, (l+r)/2, r);
    return x.type == 0? mergeD(vl,vr) : (dat[k] = mergeD(vl, vr));
  }

  //[l,r)の値にx加算　add(l,r,x)
  void add(int l,int r, D x){
    if(useAssert) assert(l <= r), assert(l <= n && r <= n), assert(l >= 0 && r >= 0);
    dfs(l, r,  T(1, x), 0, 0, n);
  }

  //[l,r)の最小値を得る　get(l,r);
  D get(int l,int r){
    if(useAssert) assert(l <= r), assert(l <= n && r <= n), assert(l >= 0 && r >= 0);
    return dfs(l, r, T(0, initValue), 0 , 0 ,n);
  }
};


signed main(){
  int n,q;
  cin>>n>>q;
  RMAQ <long long> rmaq(n, 1LL<<50);
  while(q--){
    int ord;
    cin>>ord;
    if(ord == 0){
      int s,t,x;
      cin>>s>>t>>x;
      rmaq.add(s,t+1,x);
    }
    if(ord == 1){
      int s,t;
      cin>>s>>t;
      cout<<rmaq.get(s,t+1)<<endl;
    }
  }

  return 0;
}



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

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


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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, m;
string s, t;
int dp[2005][2005];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    cin >> s >> t;
    int ans = 0;
    rrep2(i, n + 1, -1)rrep2(j, m + 1, -1) {
        int idxs = n - i;
        int idxt = m - j;
        if (s[idxs] == 'I' || t[idxt] == 'I') ans = max(ans, dp[i][j] + 1);
        if (s[idxs] == 'I') {
            if (s[idxs + 1] == 'O') dp[i - 2][j] = max(dp[i - 2][j], dp[i][j] + 2);
            if (t[idxt] == 'O') dp[i - 1][j - 1] = max(dp[i - 1][j - 1], dp[i][j] + 2);
        }
        if (t[idxt] == 'I') {
            if (t[idxt + 1] == 'O') dp[i][j - 2] = max(dp[i][j - 2], dp[i][j] + 2);
            if (s[idxs] == 'O') dp[i - 1][j - 1] = max(dp[i - 1][j - 1], dp[i][j] + 2);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 34548
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            if (a <= 0 && b >= 0) {
                out.println("Zero");
            } else if (a > 0 || (b - a + 1) % 2 == 0) {
                out.println("Positive");
            } else {
                out.println("Negative");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 8148
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
  uint64_t N;
  cin >> N;
  vector<uint64_t> A = vector<uint64_t>(N);
  for (uint64_t i = 0; i < N; i++) {
    cin >> A[i];
  }
  uint64_t sum1 = accumulate(A.begin(), A.end(), 0LL);
  uint64_t sum = 0;
  uint64_t i = 0;
  for (;i < N; i++) {
    uint64_t tmp = sum + A[i];
    if (tmp > sum1 - tmp) break;
    sum = tmp;
  }
  if (sum1-2*sum > 2*(sum+A[i])-sum1) {
    cout << 2*(sum+A[i]) - sum1 << endl;
    return 0;
  }
  cout << sum1 - 2*sum << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n, k; cin >> n >> k;
    ll div = n/k;
    cout << min(n-div*k, (div+1)*k-n) << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
vector<ll> num;
int main() {
	ll n;
	cin >> n;
	for (ll i = 1; i <= 5; i++) {
		num.push_back(pow(6, i));
		num.push_back(pow(9, i));
	}
	num.push_back(1);
	num.push_back(pow(6, 6));
	sort(num.begin(), num.end());
	ll dp[100010] = {};
	for (int i = 1; i <= n; i++)dp[i] = 1e9;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < num.size(); j++) {
			if (i - num[j] >= 0) {
				dp[i] = min(dp[i], dp[i - num[j]] + 1);
			}
		}
	}
	cout << dp[n] << endl;
	return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  bool ac[N];
  int w[N];
  int a[N];
  for(int i=0;i<N;i++){
    ac[i] = false;
    w[i] = 0;
  }
  int ansa=0;
  int answ=0;
  for(int i=0;i<M;i++){
    int p;
    string s;
    cin >> p >> s;
    p--;
    if (s=="WA"){
      w[p]++;
    }
    else{
      if (ac[p]==false){
	    ac[p]=true;
        ansa++;
        answ+=w[p];
      }
    }
  }
  cout << ansa << " " << answ << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  V<> a(n); for (int i = 0; i < n; ++i) cin >> a[i], --a[i];
  int res = 1e9;
  V<> c(k);
  int s = 0, r = 0;
  for (int l = 0; l < n; ++l) {
    while (s < k and r < n) {
      if (a[r] < k) s += ++c[a[r]] == 1;
      ++r;
    }
    if (s == k) res = min(res, r - l);
    if (a[l] < k) s -= !--c[a[l]];
  }
  cout << (res != 1e9 ? res : 0) << '\n';
}


Measured memory_bytes: 3560
#include <cstdio>
int n, k;
int a[100001];
long long qsa[100001], qsp[100001], ans, tp;
main()
{
    scanf("%d %d",&n,&k);
    scanf("%d",&a[0]);
    qsa[0] = a[0];
    qsp[0] = a[0];
    if(qsp[0] < 0) qsp[0] = 0;
    for(int i = 1;i < n;i++)
    {
        scanf("%d",&a[i]);
        qsa[i] = qsa[i-1] + a[i];
        qsp[i] = qsp[i-1] + (a[i]>0?a[i]:0);
    }
    for(int i = k-1;i < n;i++)
    {
        tp = qsp[n-1] - (qsp[i] - (i-k>=0?qsp[i-k]:0));
        if(tp > ans)
        {
            ans = tp;
        }
        tp += (qsa[i] - (i-k>=0?qsa[i-k]:0));
        if(tp > ans)
        {
            ans = tp;
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 2176
class UnionFind
  def initialize(n)
    @parents = Array.new(n, -1)
  end
  def find(x)
    @parents[x] < 0 ? x : @parents[x] = find(@parents[x])
  end
  def parents
    @parents
  end
  def union(x, y)
    x = find(x)
    y = find(y)
    return if x == y
    if @parents[x] > @parents[y]
      x, y = y, x
    end
    @parents[x] += @parents[y]
    @parents[y] = x
  end
end

n, m = gets.split.map(&:to_i)
u = UnionFind.new(n)
m.times do
  a, b = gets.split.map(&:to_i)
  u.union(a - 1, b - 1)
end
puts u.parents.select{ _1 < 0 }.size - 1

Measured memory_bytes: 15612
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    int a, b;
    cin >> a >> b;
    int c = (a * 100 + 7) / 8;
    int d = ((a + 1) * 100 + 7) / 8;

    int e = (b * 100 + 9) / 10;
    int f = ((b + 1) * 100 + 9) / 10;

    if (c <= e && d > e) {
        cout << e << endl;
        return 0;
    }
    else if (e <= c && f > c) {
        cout << c << endl;
    }
    else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 764
fn main() {
    let mut x = read::<i32>();
    let mut i = 0;
    while x > 0 {
        i += 1;
        x -= i;
    }
    println!("{}", i);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll n,k;
string s,ss;
char sig;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k >> s;
    for( auto v:s ) if( ss.empty() || ss[ ss.size()-1 ]!=v ) ss.pb( v );

    if( k+k>=ss.size() ){
        cout << n-1;
        return 0;
    }

    cout << n-ss.size()+k+k;

    return 0;
}


Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
typedef long long ll;
using namespace std;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<ll> count;

    UnionFind(int N) : par(N+1), count(N+1) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i, count[i] = (ll)1;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

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

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (size(rx) < size(ry)) swap(rx, ry);
        count[rx] += count[ry]; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        par[ry] = rx;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
  
};

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(M), B(M);
    vector<ll> ans;

    UnionFind tree(N);
    ll cnt = (ll)N*(N - 1)/2;

    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        A[i] = a - 1;
        B[i] = b - 1;
    }

    for(int i = M-1; i >= 0; i--) {
        int a = A[i];
        int b = B[i];
        ans.push_back(cnt);
        if (!tree.same(a, b)) {
            ll x = tree.size(a);
            ll y = tree.size(b);
            cnt -= x*y;
            tree.unite(a, b);
        }
    }
    
    for(int i = M-1; i >= 0; i--){
      cout << ans[i] << endl;
    }
    return 0;
}


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

using namespace std;

int main()
{
	string S;
	cin >> S;
	sort( S.begin(), S.end() );
	
	if( S[0] == S[1] && S[2] == S[3] && S[0] != S[2] ) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	bitset<64> b(0);
	while(n--)
	{
		int t;
		cin >> t;
		if(t == 0)
		{
			int y;
			cin >> y;
			printf("%d\n",b.test(y));
		}
		else if(t == 1)
		{
			int y;
			cin >> y;
			b.set(y);
		}
		else if(t == 2)
		{
			int y;
			cin >> y;
			b.reset(y);
		}
		else if(t == 3)
		{
			int y;
			cin >> y;
			b.flip(y);
		}
		else if(t == 4)
		{
			if(b.all()) printf("1\n");
			else printf("0\n");
		}
		else if(t == 5)
		{
			if(b.any()) printf("1\n");
			else printf("0\n");
		}
		else if(t == 6)
		{
			if(b.none()) printf("1\n");
			else printf("0\n");
		}
		else if(t == 7) printf("%d\n",b.count());
		else if(t == 8)
		{
			printf("%llu\n",b.to_ulong());
		}
	}
	return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n, t;
    cin >> n >> t;

    int ans = 0, tnow, tpush, tbfr;
    cin >> tbfr;
    for(int in=1;in<n;in++) {
        cin >> tpush;
        if(tpush-tbfr<=t) ans += tpush-tbfr;
        else ans += t;
        tbfr = tpush;
    }
    ans += t;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long LL;
#define M(a,b) memset(a,b,sizeof(a))
#define pb push_back
const int maxn = 1000+10;
const LL mod = 1000000007;
int main() {

    int n;
    scanf("%d",&n);
    puts(n<1200?"ABC":"ARC");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};



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

    int r,d,x;
    cin >> r >> d >> x;
    rep(i,10){
        cout << r*x - d << endl;
        x = r*x - d;
    }
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }

void main()
{
	auto a = RD;
	auto b = RD;

	string ans;
	foreach (i; 0..max(a, b))
		ans ~= to!string(min(a, b));

	writeln(ans);
	stdout.flush;
	debug readln;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];

    int r=0,sum=0,xorsum=0;
    int res=0;
    rep(l,n){
        while(r<n && (sum+a[r])==(xorsum^a[r])){
            xorsum=xorsum^a[r];
            sum+=a[r++];
        }
        res+=r-l;
        if(r==l) r++;
        else {sum-=a[l]; xorsum=xorsum^a[l];}
    }
    cout<<res<<endl;

}

Measured memory_bytes: 4792
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s = "yuiophjklnm";
    string in;
    while(cin >> in, in != "#"){
        vector<int> v(in.size());
        for (int i = 0; i < in.size(); ++i) {
            v[i] = (s.find(in[i]) != string::npos);
        }
        int ans = 0;
        for (int i = 0; i+1 < in.size(); ++i) {
            if(v[i] != v[i+1]) ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 3112
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(const int &s = 0, const int &d = 0, const Weight &w = 0) : src(s), dst(d), weight(w) {}
};

using Edges = std::vector<Edge>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

class Graph {
  std::vector<Edges> g;

public:
  Graph(const int &size = 0) : g(size) {}

  void addArc(const int &src, const int &dst, const Weight &w = 1) { g[src].emplace_back(src, dst, w); }

  void addEdge(const int &node1, const int &node2, const Weight &w = 1) {
    addArc(node1, node2, w);
    addArc(node2, node1, w);
  }

  const Edges &operator[](const int &i) const { return g[i]; }

  Graph toRootedTree(int r);
  std::pair<std::vector<Weight>, std::vector<int>> dijkstra(const int &src, const int &inf);
  Matrix warshallFloyd(const int &inf);
  std::pair<Weight, Edges> prim(const int &r);
  template<typename UnionFind> std::pair<Weight, Edges> kruskal();
  Weight solveTSP(const int &inf);
};

main {
  int n;
  cin >> n;
  int a = 1;
  while (a <= n) a *= 2;
  cout << a / 2 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main() {
   string S;
   cin >> S;
   int size = S.size() ;
   vector<int> alphabet(26);  // 0 tag
   for(int i=0;i<size;i++){
       int num = S[i] -'a' ;  // 各alphabet を番号管理
       alphabet.at(num) = 1;  // 1 tag
   }
   char min_char;
   bool judge = false;
   for(int i=0;i<26;i++){
       if(alphabet.at(i) ==  0){
            min_char = i + 'a';
            judge = true;
           break;
       }
       else if(i == 25){
           cout << "None" << endl;
       }
   }
   if(judge){
       cout << min_char << endl;
   }
}

Measured memory_bytes: 3768
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
import Data.Array.IO
import Data.Maybe
import Data.Bits
import Data.Ord
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import Debug.Trace
import Numeric

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)

getWords = getLine >>= return . words

readIntBS = fst . fromJust . BS.readInt

main :: IO ()
main = do

  (n,z,w) <- listToTuple3 . map readIntBS . BS.words <$>  BS.getLine :: IO (Int,Int,Int)
  as <- map readIntBS . BS.words <$> BS.getLine :: IO [Int]

  print $ if n == 1 then abs (w - last as) else max (abs $ w - last as) (abs $ last as - (last $ init as))



Measured memory_bytes: 1020
#include<stdio.h>
int main(void){
  int n,t[100000],m,d[2][100],i,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&t[i]);
  for(i=0;i<n;i++)sum+=t[i];
  scanf("%d",&m);
  for(i=0;i<m;i++)scanf("%d%d",&d[0][i],&d[1][i]);
  for(i=0;i<m;i++)printf("%d\n",sum+d[1][i]-t[d[0][i]-1]);
  return 0;
}

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

int main()
{
    ll N,a,sum=0,m=1000000,M=-1000000;
    cin>>N;

    for(int i=1;i<=N;i++){

        cin>>a;

        sum+=a;

        if(a<m)m=a;
        if(a>M)M=a;

    }

    cout<<m<<" "<<M<<" "<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <stack>
#include <queue>

typedef long long ll;

using namespace std;

const ll MOD = 1e9 + 7;
const ll INF = 1e12;

ll gcd(ll x, ll y){
  return x ? gcd(y%x,x) : y;
}

int main(){
  ll i,j,k,n,m;
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll x = c * d;
  ll retc = b / c;
  retc -= (a - 1) / c;
  ll retd = b / d;
  retd -= (a - 1) / d;
  ll retcd = b / (c * d / gcd(c, d));
  retcd -= (a - 1) / (c * d / gcd(c, d));
  /* cout << retc << endl;
  cout << retd << endl;
  cout << retcd << endl;
  cout << retc + retd - retcd << endl;*/
  cout << (b - a + 1) - (retc + retd - retcd) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#define P 1000000007ll
using namespace std;

const int N=1e5+10;
typedef long long LL;

int x[N],y[N];
int n,m;


int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&x[i]);
	for(int i=1;i<=m;i++) scanf("%d",&y[i]);
	LL S1=y[1],S2=0;
	for(int i=2;i<=m;i++)
	{
		S2=(S2+(LL)y[i]*(i-1)-S1)%P;
		S1+=y[i];
	}
	S1=x[1];
	LL Ans=0;
	for(int i=2;i<=n;i++)
	{
		LL res=((LL)x[i]*(i-1)-S1)%P;
		Ans+=res*S2%P;
		Ans%=P;
		S1+=x[i];
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=210,P=1e9+7;

int c[N][N],s[N][N];

int iscut[N]; 
int bccno[N]; 
int pre[N], dfs_clock, bcc_cnt; 
vector<int> bcc[N];  
struct E{
   int f,t,xt;
}e[N*N];
stack<E> S;

int h[N],cnt;

int fac[N],ifac[N],inv[N];

void adge(int u,int v){
    e[++cnt]=(E){u,v,h[u]};h[u]=cnt;
}

inline int ksm(int a,int n){
	int ans=1;
	for(;n;n>>=1,a=(ll)a*a%P)
		if(n&1) ans=(ll)ans*a%P;
	return ans;
}

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}

int k,n,ans=1;

inline int polya(int n){
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=(ans+ksm(k,gcd(n,i)))%P;
	}
//	printf("polya ans(%d),inv=%d %d\n",n,ans,inv[n]); 
	return (ll)ans*inv[n]%P;
}

inline int C(int n,int m){
	return (ll)fac[n]*ifac[n-m]%P*ifac[m]%P;
}


int dfs(int u,int fa){
   int lowu=pre[u]=++dfs_clock;
   int child=0;
   for(int i=h[u];~i;i=e[i].xt){
       int v=e[i].t;
       E e=(E){u,v};
       if(!pre[v]){
           S.push(e);
       //    printf("push <%d,%d>\n",e.f,e.t); 
           child++;
           int lowv=dfs(v,u);
           lowu=min(lowu,lowv);
           if(lowv>=pre[u]){
               iscut[u]=true;
               bcc_cnt++; 
               int m=0;
               for(;;){
               	   m++;
            	   E x=S.top();  
				   S.pop();
                   if(bccno[x.f]!=bcc_cnt){ bcc[bcc_cnt].push_back(x.f);bccno[x.f]=bcc_cnt; }
                   if(bccno[x.t]!=bcc_cnt){ bcc[bcc_cnt].push_back(x.t);bccno[x.t]=bcc_cnt; }
                   if(x.f==u&&x.t==v) break;
               }
               int n=bcc[bcc_cnt].size();
               if(n==m){ 
			   		ans=(ll)ans*polya(n)%P;
			   }
               else if(n>m){
			  
			  	 	ans=(ll)ans*k%P;
			  	 	
			   }
               else{
               	
			   		ans=(ll)ans*C(m+k-1,k-1)%P;
			   }
               
            //   printf("|V|=%d,|E|=%d\n",bcc[bcc_cnt].size(),m); 
               
           }
       }
       else if(pre[v]<pre[u] && v!=fa){
           S.push(e);
        //   printf("push <%d,%d>\n",e.f,e.t); 
           lowu=min(lowu,pre[v]);
       }
   }
   if(fa<0&&child==1) iscut[u]=0;
   return lowu;
}
void find_bcc(int n){   
    for(int i=1;i<=n;i++)
      if(!pre[i]) dfs(i,-1);
}



int main(){
	memset(h,cnt=-1,sizeof(h));
	int m;
	scanf("%d%d%d",&n,&m,&k);
	
	inv[0]=fac[0]=ifac[0]=inv[1]=1;
	int n2=m+k;
	for(int i=1;i<=n2;i++) fac[i]=(ll)fac[i-1]*i%P;
	for(int i=2;i<=n2;i++) inv[i]=(ll)(P-P/i)*inv[P%i]%P;
	for(int i=1;i<=n2;i++) ifac[i]=(ll)ifac[i-1]*inv[i]%P; 
	
	for(int i=1;i<=m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		adge(a,b);
		adge(b,a);
	}
//	printf("%d\n",ans); 
	
	find_bcc(n);
	
	/*for(int i=1;i<=bcc_cnt;i++){
		printf("bcc %d\n",i);
		for(int j=0;j<bcc[i].size();j++){
			printf("%d ",bcc[i][j]);
		}
		cout<<endl;
	}*/
	printf("%d\n",ans); 
	return 0;
}
/*
4 5 1
1 2
3 4
2 4
3 2
1 3

*/

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

int main () {
  string S;
  cin >> S;
  int N = S.size();
  
  vector<int>count(N,0);
  for (int i = 0; i < N; i++) {
    int A = 0;
    int B = 0;
    int C = 0;
    for (int j = 0; j < N; j++) {
      if (S.at(i) == S.at(j)){
        count.at(i) = max(count.at(i),abs(C-j)-1);
        if (A == 0){
          B = j;
          A++;
        }
        C = j;
      }
      if (j == N-1){
        count.at(i) = max(count.at(i),max(B,N-C-1));
      }
    }
  }
  sort(count.begin(), count.end());
  cout << count.at(0) << endl;
}
          
        
    

Measured memory_bytes: 3624
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
//スタート点,頂点数、辺を渡して、最短経路の配列を返す
std::vector<int> dijkstra(int s,int N,vector<Edge> E){
    std::vector<int> ans(N,INF);
    std::vector<std::vector<Edge>> Edges(N);
    FOREACH(e,E){
        Edges.at(e.from).push_back(e);
    }
    priority_queue<P, std::vector<P>, greater<P>> que;
    ans.at(s)= 0;
    que.push(make_pair(0,s));
    while(!que.empty()){
        P p = que.top();que.pop();
        if(ans.at(p.second) < p.first)continue;
        for(int i = 0;i < Edges.at(p.second).size();i++){
                if(ans.at(p.second) + Edges.at(p.second).at(i).value < ans.at(Edges.at(p.second).at(i).to)){
                ans.at(Edges.at(p.second).at(i).to) = ans.at(p.second) + Edges.at(p.second).at(i).value;
                que.push(make_pair(ans.at(Edges.at(p.second).at(i).to),Edges.at(p.second).at(i).to));
            }
        }
    }
    return ans;
}

int main(){
    CIN(H);CIN(W);
    std::vector<Edge> Edges;
    REP(a,10){
        REP(b,10){
            CIN(co);
            Edge e(a,b,co);
            Edges.pb(e);
        }
    }
    std::vector<int> moke;
    REP(a,H){
        REP(b,W){
            CIN(q);
            if(q==-1)continue;
            moke.push_back(q);
        }
    }
    std::vector<std::vector<int>> dis;
    REP(a,10){
      dis.push_back(dijkstra(a,10,Edges));
    }
    int ans = 0;

    REP(a,moke.size()){
        ans += dis.at(moke.at(a)).at(1);
    }

    COUT(ans);
    return 0;
}


Measured memory_bytes: 640
import java.io.IOException;
import java.util.Scanner;


public class Main {

	public static boolean isMT (int a, int b) {
		return b > a;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (isMT(a, b)) {
			if (isMT(b, c)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 17164
#![allow(non_snake_case)]
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let T1:i64 = sc.read();
    let T2:i64 = sc.read();
    let A1:i64 = sc.read();
    let A2:i64 = sc.read();
    let B1:i64 = sc.read();
    let B2:i64 = sc.read();
    if T1*A1 + T2*A2 == T1*B1 + T2*B2 {
        println!("infinity");
        return
    }
    let mut F = A1 - B1;
    let mut S = A2 - B2;
    if (F > 0) && ( S > 00){
        println!("0");
        return
    }
    if ( F < 0) && (S < 0){
        println!("0");
        return
    }
    if F < 0{
        F = -F;
        S = -S;
    }
    if F*T1 + S*T2 > 0{
        println!("0");
        return
    }
    let M = F*T1;
    let m = -(F*T1+S*T2);
    if M%m > 0{
        println!("{}", M/m*2+1);
    }else{
        println!("{}", M/m*2);
    }
    
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}





Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int N;
    cin>>N;
    vpii cone[N];
    rep(i,0,N-1){
        int u,v,w;
        cin>>u>>v>>w;
        u--,v--;
        pii ev=make_pair(u,w);
        pii eu=make_pair(v,w);
        cone[u].push_back(eu);
        cone[v].push_back(ev);
    }
    priority_queue<pllll,vector<pllll>,greater<pllll>> q;
    q.emplace(0,0);
    vll dist(N,INF);
    vb fixed(N,false);
    dist[0]=0;
    while(!q.empty()){
        pllll e=q.top(); q.pop();
        ll idx=e.second;
        ll d=e.first;
        fixed[idx]=true;
        for(auto nxt:cone[e.second]){
            ll nidx=nxt.first;
            ll add=nxt.second;
            if(fixed[nidx])continue;
            ll nd=add+d;
            chmin(dist[nidx],nd);
            q.emplace(nd,nidx);
        }
    }
    rep(i,0,N)cout<<dist[i]%2<<endl;
    return 0;
}




Measured memory_bytes: 7296
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main() 
{
    IOS;
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                int brr[3]={arr[i],arr[j],arr[k]};
                sort(brr,brr+3);
                if(brr[0]==brr[1] || brr[1]==brr[2])
                    continue;
                if(brr[0]+brr[1]>brr[2])
                    if(brr[1]+brr[2]>brr[0])
                        if(brr[2]+brr[0]>brr[1])
                            ans++;
            }
        }
    }
    print(ans);
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>

using namespace std;


int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b >= c)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    ll N,M;
    void solve(){
        cin>>N>>M;
        for(ll g=M/N;g>=1;g--){
            if(M%g==0){
                if(M/g>=N){
                    cout<<g;
                    return;
                }
            }
        }
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,h[100009][3],dp[100009][3];
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>h[i][0]>>h[i][1]>>h[i][2];
	for(int i=1;i<=n;i++)
		for(int j=0;j<3;j++)
			for(int k=0;k<3;k++)
				if(j!=k)
					dp[i][j]=max(dp[i][j],dp[i-1][k]+h[i][j]);
	cout<<max(max(dp[n][0],dp[n][1]),dp[n][2])<<endl;
	return 0;
}

Measured memory_bytes: 2560
h, w = map(int, input().split())
l = []
for i in range(h):
    l.append(list(input()) + ["."])
l[-1][w-1] = "g"
l.append(["."]*(w+1))

def dfs(x, y):
    if x == w or y == h or l[y][x] == ".":
        return
    elif l[y][x] == "g":
        print("Possible")
        exit()
    else:
        dfs(x+1, y)
        dfs(x, y+1)

cnt = 0
for i in l:
    for j in i:
        if j == "#":
            cnt += 1

if cnt == h + w - 2:
    dfs(0, 0)
print("Impossible")

Measured memory_bytes: 62080
n = int(input())
num_S = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
num_H = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
num_C = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
num_D = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

for i in range(n):
    K_l = input().split()
    if   K_l[0] == "S":
        num_S.remove(int(K_l[1]))
    elif K_l[0] == "H":
        num_H.remove(int(K_l[1]))
    elif K_l[0] == "C":
        num_C.remove(int(K_l[1]))
    else:
        num_D.remove(int(K_l[1]))
for i in num_S:
    print("S", i)
for i in num_H:
    print("H", i)
for i in num_C:
    print("C", i)
for i in num_D:
    print("D", i)



Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,k,i;
    cin>>n;
    ll vect[n];
    for(i=0;i<n;i++)
    {
        cin>>vect[i];
    }
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(vect[1]-vect[0]);
    for(i=2;i<n;i++)
    {
        dp[i]=min(dp[i-2]+abs(vect[i-2]-vect[i]),dp[i-1]+abs(vect[i-1]-vect[i]));
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
import numpy as np
n, k = map(int, input().split())
h_ = list(map(int, input().split()))
h = np.array(h_)
#print(h)
dp = np.array([0]*n)
#print(dp)

for i in range(1,n):
  s = max(i-k,0)
  dp[i] = np.min(dp[s:i] + (np.abs(h[s:i]-h[i])))
#print(dp)
print(dp[n-1])

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



signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

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

}

Measured memory_bytes: 256