akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define mod (ll)(1e9+7)
#define nax (ll)(1e6)
#define INFL LLONG_MAX
#define NINFL LLONG_MIN
#define INF INT_MAX
#define disp(a,n,arr) for(int i=a;i<(ll)n;i++) cout << arr[i] << " "; cout << "\n";
#define check cout << "Working\n";
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pl>
#define vpi vector<pi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

int main() {
	FIO;
	int t = 1;
	//cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll ac = 0;
		ll wa = 0;
		ll tle = 0;
		ll re = 0;
		while(n--){
			string s;
			cin >> s;
			if(s == "AC") ac++;
			else if(s == "WA") wa++;
			else if(s == "TLE") tle++;
			else re++;
		}	
		cout << "AC x " << ac << "\n";
		cout << "WA x " << wa << "\n";
		cout << "TLE x " << tle << "\n";
		cout << "RE x " << re << "\n";
	}


	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

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

using namespace std;

vector<vector<int> > G;

LL solve(){
    LL N, M;
    cin >> N >> M;
    G.assign(N,vector<int>());
    REP(i,M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    if(N<=3)return 0;
    vector<int> color(N, -1);
    stack<pair<int, int> > st;
    st.push(make_pair(0, 0));
    LL cnt[2] = {0,0};
    while(!st.empty()){
        pair<int, int> n = st.top();st.pop();
        if(color[n.first]!=-1)continue;
        color[n.first] = n.second;
        cnt[n.second]++;
        REP(i,G[n.first].size()){
            int to = G[n.first][i];
            int c = 1 - n.second;
            if(color[to]==-1){
                st.push(make_pair(to, c));
            }else if(color[to]!=c){
                return N*(N-1)/2LL - M;
            }
        }
    }
    return cnt[0]*cnt[1]-M;
}

int main(){
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 6272
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s;
int dp[1000010][2];

signed main() {
	cin >> s;
	dp[0][0] = INF;
	dp[0][1] = 0;
	int n = (int)s.size();
	for (int i = 1; i <= n; i++) {
		int x = s[i - 1] - '0';
		dp[i][0] = min(dp[i - 1][0] + 9 - x, dp[i - 1][1] + 11 - x);
		dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + x;
	}
	cout << min(dp[n][0], dp[n][1]) << endl;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int n;
    cin >> n;
    ll h[n];
    int ans = 0;
    int now = 0;
    rep(i,n) cin >> h[i];

    for(int i=0;i<n-1;i++){
        if(h[i]>=h[i+1]){
            now++;
            ans = max(ans,now);
        }else{
            now = 0;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ldb;

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define all(v) (v).begin(), (v).end()
#define dbg(a) cerr << #a << " = " << a << endl

const int N = 100100;
int t[N], x[N], y[N];

int main() {

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

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

    int n;
    cin >> n;
    x[0] = y[0] = t[0] = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> t[i] >> x[i] >> y[i];
    }
    for(int i = 1; i <= n; ++i) {
        int dx = abs(x[i] - x[i-1]);
        int dy = abs(y[i] - y[i-1]);
        int dt = t[i] - t[i-1];
        if(dx + dy > dt || (dx + dy) % 2 != dt % 2) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>

int main() {
    using namespace std;

    int A, B, C, K;
    cin >> A >> B >> C;
    cin >> K;

    int m = std::max({ A, B, C });
    int sum = A + B + C - m;
    while (0 < K) {
        m *= 2;
        K--;
    }

    sum += m;
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define SORT(x) (sort(x.begin(),x.end()))
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    int M,D,ans=0;cin >> M >> D;
    rep(i,M){
        rep(j,D){
            if((j+1)%10<2 || (j+1)/10<2){
                continue;
            }
            if(i+1==((j+1)/10)*((j+1)%10)){
                ans++;
            }
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define MOD 100000007

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;


int main() {
  int n;
  cin >> n;
  int ar[n];
  ll sum = 0;
  for (int ctr1 = 0; ctr1 < n; ctr1++)
    cin >> ar[ctr1], sum += ar[ctr1];
  ll tsum = 0;
  ll rez = 1000000000000000LL;
  for (int ctr1 = 0; ctr1 + 1 < n; ctr1++) {
    tsum += ar[ctr1];
    rez = min(rez, abs(sum - 2 * tsum));
  }
  cout << rez;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n,a,b;
int main(void){
    scanf("%d%d%d",&n,&a,&b);
    cout<<min(a,b)<<' '<<max(0,a+b-n)<<endl;
}



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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int N;
int A[105];

signed main()
{
  double SUM = 0;
  cin >> N;
  REP(i,N) {
    cin >> A[i];
    SUM += A[i];
  }

  SUM /= N;

  double diff = 1145141919;
  REP(i,N) {
    diff=min(diff,abs(A[i]-SUM));
  }

  REP(i,N) {
    if(diff==abs(A[i]-SUM)) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 896
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Program {
    static Scanner sc = new Scanner();

    internal static void Main(string[] args) {
        var N = sc.nextInt();
        var div = N / 2;
        var hoge = Math.Floor((double)div);
        WriteLine((N - hoge) * hoge);
    }
}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st;
		
		
		int[][] array = new int[3][3];
		for(int i = 0; i < 3; i++)
			for(int j = 0; j < 3; j++)
				array[i][j] = sc.nextInt();
		int[] row = new int[3], col = new int[3], d1 = new int[5], d2 = new int[5];
		int n = sc.nextInt();
		for(int u = 0; u < n; u++) {
			int x = sc.nextInt();
			for(int i = 0; i < 3; i++)
				for(int j = 0; j < 3; j++)
					if(array[i][j] == x) {
						row[i]++;
						col[j]++;
						d1[i + j]++;
						d2[i - j + 2]++;
					}
		}
		
		boolean flag = false;
		for(int i = 0; i < 3; i++) {
			if(row[i] == 3 || col[i] == 3)
				flag = true;
		}
		
		for(int i = 0; i < 5; i++) {
			if(d1[i] == 3 || d2[i] == 3)
				flag = true;
		}
		
		System.out.println(flag ? "Yes" : "No");
		
	}
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int mx=10000007;
bool mark[mx];
vector<ll>v,freq;
void seive()
{
    ll i,j;
    for(i=2;i+i<=mx;i++)
    {
        if(mark[i]==0){
            v.push_back(i);
            for(j=i;j<=mx;j+=i)mark[j]=1;
        }
    }
}
ll solv(ll x)
{
    for(ll i = 1; i <= 64; i++)
    {
        if((i*(i+1))/2 > x)return i-1;
    }
}
int main()
{
    seive();
    long long int n,ans=0;
    cin>>n;
    long long int m=n;
    for(ll i=0;v[i]*v[i]<=n;i++)
    {
        if(n%v[i]==0)
        {
            ll coun=0;
            while(n%v[i]==0)
            {
                n/=v[i];
                coun++;
            }
            freq.push_back(coun);
        }
    }
    if(n > 1)
        freq.push_back(1);
    for(ll i=0;i<freq.size(); i++)
    {
        ans +=solv(freq[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 17044
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long
#define ld                  long double
#define pb                  push_back
#define mkp                 make_pair
#define f(i,l,h)            for(ll i=l;i<h;i++)
#define fr(i,h,l)           for(ll i=h;i>=l;i--)
#define mem(a,val)          memset(a,val,sizeof(a))
#define all(v)              (v).begin(),(v).end()
#define ff                  first
#define ss                  second
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
const ld pi=3.14159265359;
const ll mod=998244353;
const ll INF=(ll)(1e9+7);
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

ll power(ll a,ll b){
    ll res=1;
	while(b){
	    if(b&1) res=(res*a);
	    a=(a*a);
	    b>>=1;
	}
	return res;
}

int main()
{
    //cout << "Hello world!" << endl;
    string s;
    string t;
    cin>>s;
    cin>>t;
    ll n=s.length();

    ll ans=0;
    f(i,0,n){
        if(s[i]!=t[i]) ans++;

    }

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


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

int main(){
	string str;
	
	cin >> str;
	
	for(int i = 0; i < str.size(); i++){
		cout << (char)((str[i] + 10) % 26 + 65);
	}
	cout << endl;
	
	return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  for(int i=0;i<N-1;i++){
    if(vec.at(i)>vec.at(i+1)+1){
      ans=1;
    }
    else if(vec.at(i)>vec.at(i+1)){
      vec.at(i+1)=vec.at(i+1)+1;
    }
  }
      
  
  if(ans==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}



Measured memory_bytes: 640
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007
#define inf 1000000000000000000ll
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x,ll y, ll md=inf){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;


#define endl '\n'
#define int ll

signed main() {
	fast;

	int h,w;
	cin>>h>>w;

	pii v[200002];
	for(int i=0;i<h;i++) cin>>v[i].f>>v[i].s;

	map<int,int> mp;
	for(int i=1;i<=w;i++) mp[i] = 0;

	map<int,int> mini = {{0,w}};

	for(int i=0;i<h;i++) {
		int l = v[i].f;
		int r = v[i].s;

		auto it = mp.lower_bound(l);
		int mn = inf;

		while(it!=mp.end() && it->f <= r) {
			mn = min(mn, r+1-(it->f)+(it->s));
			auto it1 = it++;
			mini[it1->s]--;
			if(mini[it1->s]==0) mini.erase(it1->s);
			mp.erase(it1);
		}

		if(r+1<=w && mn<inf) {
			if(mp.count(r+1)) {
				if(mp[r+1] > mn) {
					if(mini[mp[r+1]]==1) mini.erase(mp[r+1]);
					else mini[mp[r+1]]--;
					mini[mn]++;
					mp[r+1] = mn;
				}
			}
			else {
				mp[r+1] = mn;
				mini[mn]++;
			}
		}

		if(mini.size()) cout<<mini.begin()->f+i+1<<endl;
		else cout<<-1<<endl;

	}
}

Measured memory_bytes: 19280
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <cmath>
#define P 100003
#define N 100000
using namespace std;

int main(){
    string s;
    cin >> s;
    for(int i=0;i<s.length();i++){
        s[i] = 'x';
    }
    cout << s;
    return 0;
}

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

int n, nxt = 1, ans = 0;

int main() {
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i]; 
  rep(i, n) {
    if (nxt == a[i]) {
      nxt += 1;
    } else {
      ans += 1;
    }
  }
  if (ans == n) ans = -1;
  cout << ans << endl;
  return 0;
}


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

int main(){
	int N;
	cin >> N;
	long long ans=0;
	for(int i=1;i<=N;i++)if(((i%3)>0)&&((i%5)>0))ans+=i;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 used[26];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	rep(i,s.size()){
		used[(s[i]-'a')] = true;
	}
	rep(i,26){
		if(!used[i]){
			char ans = 'a' + i;
			cout << ans << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);

struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

int main() {
    int N,Q; cin >> N >> Q;
    dsu UF(N);
    REP(i,Q) {
        int t,u,v; cin >> t >> u >> v;
        if(t == 0) UF.merge(u,v);
        else cout << UF.same(u,v) << endl; 
    }
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll x;
  cin >> x;

  string ans = x < 1200 ? "ABC" : "ARC";
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    if (S.charAt(0) == 'A'){
      int countC = 0;

      for (int i = 2; i < S.length() - 1; i++){
        if (S.charAt(i) == 'C'){
          countC++;
        }
      }

      HashSet<Character> set = new HashSet<>();
      set.add('A');
      set.add('C');

      if (countC == 1){

        for (char c: S.toCharArray()){
          if (Character.isUpperCase(c) && !set.contains(c)){
            System.out.println("WA");
            return;
          }
        }

        System.out.println("AC");
        return;
      }
    }

    System.out.println("WA");
    return;
  }

  static List<Integer> primeList(int n){
    List<Integer> list = new ArrayList<>();
    boolean[] prime = new boolean[n + 1];
    Arrays.fill(prime, true);
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i < Math.sqrt(n); i++){
      if (!prime[i]){continue;}
      for (int j = 2; i * j <= n; j++){
        prime[i * j] = false;
      }
    }

    for (int i = 0; i < prime.length; i++){
      if (prime[i]){list.add(i);}
    }

    return list;
  }

}


Measured memory_bytes: 21844
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int n, m;
V< V<int> > d;
V< V<int> > dp;

int rec(int state, int v) {
    if (state == (1 << n) - 1 && v == 0) return dp[state][v] = 0;
    if (dp[state][v] >= 0) return dp[state][v];

    int ans = INF;
    for (int to = 0; to < n; to++) {
        if ((state >> to) & 1) continue;
        chmin(ans, rec(state | (1 << to), to) + d[v][to]);
    }

    return dp[state][v] = ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    d.resize(n, V<int>(n, INF));
    for (int i = 0; i < m; i++) {
        int s, t, tmpd; cin >> s >> t >> tmpd;
        d[s][t] = tmpd;
    }

    dp.resize(1 << n, V<int>(n, -1));
    int ans = rec(0, 0);
    if (ans == INF) ans = -1;
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 6304
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e8;

 
int main(){
	ll n;
	cin>>n;
	for(ll i=1; i<=100000; i++){
		if(n%i==0){
			string s=to_string(i);
			string t=to_string(n/i);
			ll flag = max(s.size(),t.size());
			mn=min(mn,flag);
		}
	}
	cout<<mn<<endl;
}


Measured memory_bytes: 256
function Calc(input) {
  if (input <= 0) {
    console.log(0);
  } else if (input >= 5 && input < 500) {
    var calcOver5 = Math.floor(input / 5);
    console.log(calcOver5 * 5);
  } else {
    var a = Math.floor(input / 500);
    var a2 = input % 500;
    var a3 = Math.floor(a2 / 5);

    console.log(a * 1000 + a3 * 5);
  }
}

Calc(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

S = list(map(int, list(input())))
#print(S)
mod = 2019
mod_list = [0]
#last = 0
ten = 1

for num in S[::-1]:
    yo = (num * ten + mod_list[-1]) % mod
    #print(yo)
    mod_list.append(yo)
    #last = yo
    ten = (ten * 10) % mod

cnt = [0]*2019

for yo in mod_list:
    cnt[yo] += 1

ans = 0
for i in range(2019):
    ans += cnt[i] * (cnt[i]-1) // 2

print(ans)

Measured memory_bytes: 19264
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int K = stdIn.nextInt();
		int X = stdIn.nextInt();
		
		for(int i = Math.max(X-K+1, -1000000); i < Math.min(X+K-1, 1000000); i++) {
			System.out.print(i+ " ");
		}
		System.out.println(Math.min(X+K-1, 1000000));

	}

}

Measured memory_bytes: 23508
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "Yes";
const string NO = "No";

void solve(ll A, ll B, ll C) {
  bool pred = (A-C) * (C-B) > 0;
  cout << (pred ? YES : NO) << endl;
}

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  ll C;
  cin >> C;
  solve(A, B, C);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
Black = [0]*(N+1)
White = [S.count('.')]*(N+1)
DispS = [S.count('.')]*(N+1)
for TN in range(0,N):
    Black[TN+1] = Black[TN]+[0,1][S[TN]=='#']
    White[TN+1] = White[TN]-[0,1][S[TN]=='.']
    DispS[TN+1] = Black[TN+1]+White[TN+1]
print(min(DispS))

Measured memory_bytes: 32916
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
struct Edge {
	int s, d; Weight w;
	Edge() {};
	Edge(int s, int d, Weight w) : s(s), d(d), w(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}


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

	static const int V = 300;
	static int wf[V][V];

	int N, M, R; cin >> N >> M >> R;

	vector<int> r(R); rep(i, 0, R) {
		cin >> r[i]; r[i]--;
	}
	sort(all(r));

	rep(i, 0, N)rep(j, 0, N)wf[i][j] = INF;
	rep(i, 0, N)wf[i][i] = 0;

	rep(i, 0, M) {
		int s, d, w; cin >> s >> d >> w; s--, d--;
		wf[d][s] = wf[s][d] = min(wf[s][d], w);
	}

	rep(k, 0, N)rep(i, 0, N)rep(j, 0, N) {
		if (wf[i][k] != INF&&wf[k][j] != INF)
			wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
	}
	int ans = INF;
	do {
		int tmp = 0;
		rep(i, 0, R - 1) {
			tmp += wf[r[i]][r[i + 1]];
		}
		chmin(ans, tmp);

	} while (next_permutation(all(r)));

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

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

const int MOD = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> wa(n + 1);
    rep(i, n)
    {
        wa[i + 1] = wa[i] + a[i];
    }
    ll ans = 0;
    rep(i, n)
    {
        ll sum = (wa[n] - wa[i + 1]) % MOD;
        ans += (ll)a[i] * sum;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5612
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cstdio>

using namespace std;

int main() {
    int t = 8, x = 3;
    cin >> t >> x;
    double div = t * 1.0 / x;
    cout << div << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());
            int n = int.Parse(Console.ReadLine());

            //
            string[] str = Console.ReadLine().Split(' ');

            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);

            if (a / n != b / n) Console.WriteLine("OK");
            else if (a % n == 0) Console.WriteLine("OK");
            else Console.WriteLine("NG");


            //ここまで
        }




    }

}


Measured memory_bytes: 27544
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<string> b(n);
    for(int i=0;i<n;i++){
        cin >> b.at(i);
    }
    int m;
    cin >> m;
    vector<string> r(m);
    for(int i=0;i<m;i++){
        cin >> r.at(i);
    }
    int ans=0;

    for(int i=0;i<n;i++){
        int sum=0;

        for(int j=0;j<n;j++){
            if(b.at(i)==b.at(j)){
                ++sum;
            }
        }
        for(int j=0;j<m;j++){
            if(r.at(j)==b.at(i)) {
                --sum;
            }
        }
        if(ans<sum) 
            ans=sum;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
ls = []
for i in range(H):
    ls.append([i for i in input().split()[0]])

dx = [0, 1, 0,-1]
dy = [1, 0,-1, 0]

def dfs(x, y):
    flg = 0
    for ii in range(4):
        nx = x + dx[ii]
        ny = y + dy[ii]
        if nx < 0 or nx >= H or ny < 0 or ny >= W:
            continue
        if ls[nx][ny] == '#':
            flg = 1
    return flg

for i in range(H):
    for j in range(W):
        if ls[i][j] == '#':
            if dfs(i, j) == 0:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,n;
    int p[105];
    int mi,minv,maxv=0,ans=0;
    int flg[105]={};
    cin>>x>>n;
    minv=105;
    for(int i=0; i<n; i++){
        cin>>p[i];
	      flg[p[i]]=1;
	      maxv=max(p[i],maxv);
        minv=min(p[i],minv);
    }
    mi=(x-(minv-1));
    ans=minv-1;
    if(n==0){
      cout<<x<<'\n';
    }else{
      for(int i=minv; i<=maxv+1; i++){
        if(mi>abs(x-i)){
	        if(flg[i]!=1){
	          mi=abs(x-i);
	          ans=i;
	        }
        }
      }
      cout<<ans<<'\n';
    }
    return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>

#define int long long

using namespace std;

signed main() {
	int n, m;
	cin >> n >> m;
	if (n > m) {
		swap(n, m);
	}
	if (n == 1 && m == 1) {
		cout << 1;
		return 0;
	}
	if (n == 1) {
		cout << m - 2 << '\n';
		return 0;
	}
	cout << (n - 2) * (m - 2) << '\n';
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

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

//�G���g�X�e�l�X���
vector<int> estora(vector<int> num) {
    int sel = 0;
    while (sel < num.size()) {
        int d = num[sel];
        for (int i = 0; i < num.size(); i++) {
            if (num[i] % d == 0 && num[i] != d && d != 1) {
                num.erase(num.begin() + i);
                i--;
            }
        }
        sel++;
    }
    return num;
}
/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
//i����ɑf���ɂ��Ă����Ȃ��Ƃ��܂��ł��Ȃ�&&�v�Z�ʃ��o�C
//�G�X�g���l�X��⿂őf����U����Ă����K�v�������肻��
vector<ll> fac(ll n, vector<ll> num) {
    ll kazu = n;
    for (int i = 2; i <= n; i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1)
        num[n]++;
    return num;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return num;
}
const int INF = 1001001001;

//mint�p�̒萔 (10��9�� + 7)
const int mod = 1000000007;

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

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    string s;
    ll k;
    cin >> s >> k;
    rep(i, k) {
        if (s[i] != '1') {
            cout << s[i];
            return 0;
        }
    }
    cout << 1;
    return 0;
}

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

using namespace std;

int main(void){
  int w;
  int i=0;

  while(cin >> w){
	while(w > 1){
	  if(w%2){
		cout << pow(2, i) << " ";
	  }
	  w /= 2;
	  i++;
	}
	if(w) cout << pow(2,i) << endl;
	i=0;
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,s[200001],a,L,cnt,ans;
map<ll,ll>mp;
int main(void){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		s[i+1]=s[i]+a;
	}
	for(ll i=0;i<=n;i++){
		s[i]-=i;
		s[i]%=k;
		s[i]=(s[i]+k)%k;
	}
	n++;
	for(int i=0;i<min(n,k);i++){
		ans+=mp[s[i]];
		mp[s[i]]++;
	}
	for(int i=0;i<n-min(n,k);i++){
		mp[s[i]]--;
		ans+=mp[s[i+min(n,k)]];
		mp[s[i+min(n,k)]]++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 14336
use std::io::{stdout, BufWriter, Write};
use std::thread;

fn run() {
    let input = read_input();
    let mut input = input.split_whitespace();
    let in_n: i64 = input.next().unwrap().parse().unwrap();
    let in_x: Vec<i64> = input.map(|s| s.parse().unwrap()).collect();

    let mut y = in_x.clone();
    y.sort();
    let x1 = y[in_n as usize / 2 - 1];
    let x2 = y[in_n as usize / 2];

    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    for x in in_x {
        writeln!(out, "{}", if x <= x1 { x2 } else { x1 }).unwrap();
    }
}

fn main() {
    thread::Builder::new()
        .stack_size(32 * 1024 * 1024) // 32MB
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

/// ローカル環境なら _in.txt から入力を受ける
fn read_input() -> String {
    use std::fs::File;
    use std::io::Read;
    let stdin = std::io::stdin();
    let mut s = String::new();
    match option_env!("LOCAL") {
        Some(_) => File::open("src/_in.txt")
            .expect("File not found")
            .read_to_string(&mut s)
            .unwrap(),
        None => stdin.lock().read_to_string(&mut s).unwrap(),
    };
    s
}


Measured memory_bytes: 17656
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))


add = 0
for i in range(len(B)):
    if B[i] > A[i]:
        add += A[i]
        B[i] -=  A[i]
        if A[i+1] > B[i]:
            add+=B[i]
            A[i+1] -= B[i]
        else:
            add += A[i+1]
            A[i+1] = 0
    else:
        add+=B[i]
print(add)
    

Measured memory_bytes: 24128
n,m = map(int,input().split())
city = [[] for i in range(n)]
def f(s):
    s = str(s)
    t  = 6 - len(s)
    s = "0"*t + s
    return s
for i in range(m):
    ken,year = map(int,input().split())
    city[ken-1].append([year,i])
newcity = []
for i in range(n):
    city[i].sort()
    for j in range(len(city[i])):
        newcity.append([city[i][j][1],f(i+1) + f(j+1)])
newcity.sort()
for i in range(m):
    print(newcity[i][1])


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

using namespace std;

int main() {
    int n;
    cin >> n;

    vector<long long> nums(n), temp;
    for(int i=0; i<n; i++) cin >> nums[i];

    temp = nums;
    sort(temp.rbegin(),temp.rend());
    for(int i=0; i<n; i++){
        if(nums[i]==temp[0]) cout << temp[1] << endl;
        else cout << temp[0] << endl;
    }

    return 0;
}

Measured memory_bytes: 4736
#include<stdio.h>
int main(){
	int a,b,c,i;
	i=1;
	while(scanf("%d %d",&a,&b)!=EOF){
		c=a+b;
		while(c>=10){
			c/=10;
			i++;
		}
		printf("%d\n",i);
		i=1;
	}
	return 0;
}

Measured memory_bytes: 0
/* 
 * Project: AtCoder Beginners Contest 137 C - Green Bin
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/09/01
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

uint32_t n;
vector<string> s;

void solve() {

    map<string, uint64_t> s_bin;
    for (int i=0;i<n;i++) {
        sort(s[i].begin(), s[i].end());
        s_bin[s[i]]++;
    }
    uint64_t cnt = 0;
    for (auto i : s_bin) {
        cnt += i.second*(i.second-1)/2;
    }
    printf("%lld\n", cnt);

}

int main() {

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

    solve();
}

Measured memory_bytes: 12824
N = int(input())
A  = [int(x) for x in input().split()]
total = 1
if 0 in A:
    print(0)
else:    
    for a in A:
        total *= a 
        if total > 10 ** 18:
            print(-1)
            break

    if total <= 10 ** 18:
        print(total)

Measured memory_bytes: 21524
N, K = map(int, input().split())

min_sum = 0
max_sum = 0
under_K = 0
ans = 0
for i in range(N+1):
    min_sum += i
    max_sum += N - i
    if i < K - 1:
        under_K += max_sum - min_sum + 1
    ans += max_sum - min_sum + 1
    
print((ans - under_K) % (10**9+7))   

Measured memory_bytes: 9084
def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

x, y = map(int,input().split())
if x > 2*y or y > 2*x or (x+y) % 3 != 0:
    print(0)
    exit()

d = (x+y)//3
MOD = 10**9+7
f, i = prepare(10**6, MOD)
nx = (2*y-x) // 3
print(f[d] * i[nx] % MOD * i[d-nx] % MOD)

Measured memory_bytes: 87988
#include<iostream>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
    int n;
    int a[100];
    float cnt1=0;
    float cnt2=0;
    float b[100];
    float min=0;
    int mini=0;
    
    cin>>n;
    
    for(int i=0;i<n;i++){
        cin>>a[i];
        cnt1+=a[i];
    }
    
    cnt2=cnt1/n;
    
    for(int i=0;i<n;i++){
        b[i]=abs(a[i]-cnt2);
        
    }

    min=b[0];
    mini=0;
    for(int i=1;i<n;i++){
        if(min>b[i]){
            min=b[i];
            mini=i;
        }
    }
    
    cout<<mini<<endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main(){
    string s;
    cin >> s;
    
    string a(s, 0, 4);
    string b(s, 5, 2);
    string c(s, 8, 2);
    
    int x, y, z;
    x = stoi(a);
    y = stoi(b);
    z = stoi(c);
    
    if(x < 2019){
        cout << "Heisei\n";
    }
    else if(x > 2019){
        cout << "TBD\n";
    }
    else{
        if(y < 4){
            cout << "Heisei\n";
        }
        else if(y > 4){
            cout << "TBD\n";
        }
        else{
            if(z <= 30){
                cout << "Heisei\n";
            }
            else{
                cout << "TBD\n";
            }
        }
    }
    
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int[] unko=new int[3];
    int sum=1;
    for(int i=0; i<3; i++){
      unko[i]=sc.nextInt();
      sum*=unko[i];
    }
    if(sum==175){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  vll A(N + 2, 0);
  REP(i, 0, N) {
    cin >> A[i + 1];
  }

  vll D(N + 1, 0);
  ll dsum = 0;
  REP(i, 0, A.size() - 1) {
    D[i] = abs(A[i + 1] - A[i]);
    dsum += D[i];
  }

  REP(i, 1, N + 1) {
    cout << dsum - (D[i - 1] + D[i]) + abs(A[i - 1] - A[i + 1]) << endl;
  }

  return 0;
}


Measured memory_bytes: 2816
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int A, B;
    cin >> A >> B;
    rep(i, 100000) {
        if(i * 8 / 100 == A && i / 10 == B) {
            cout << i << endl;
            exit(0);
        }
    }
    cout << -1 << endl;


	return 0;
}


Measured memory_bytes: 256
n = int(input())

mat = [[0]*10 for i in range(10)]

for i in range(n+1):
  if i % 10 != 0:
    str_i = str(i)
    mat[int(str_i[0])][int(str_i[-1])] += 1
c = 0
for y in range(1, 10):
  for x in range(y, 10):
    if y == x:
      c += mat[y][x] * mat[x][y]
    else:
      c += mat[y][x] * mat[x][y] * 2
print(c)


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

using namespace std;

int main()
{
	int N, flag, count = 0;
	string S;

	cin >> N ;
	cin >> S;

	for (int i = 0; i < N; i++) {
		if (S[i] == 'A')
			flag = 1;
		else if (S[i] == 'B' && flag == 1)
			flag = 2;
		else if (S[i] == 'C' && flag == 2)
			flag = 3;
		else
			flag = 0;

		if (flag == 3) {
			flag = 0;
			count++;
		}
	}

	cout << count;
}

Measured memory_bytes: 384
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    //    ifstream in("input.txt");
    //    cin.rdbuf(in.rdbuf());
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    
    int max_h = 0;
    int min_h = 1e9;
    
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    
    int min_val = 1e9;
    
    sort(h.begin(), h.end());
    for (int i = 0; i < n - (k - 1); ++i)
    {
        min_h = h[i];
        max_h = h[i + k - 1];
        min_val = min(min_val, max_h - min_h);
    }
    
    cout << min_val << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    int tmp;
    if ( a > b ) {
        tmp = a;
        a = b;
        b = tmp;
    }

    if (a <= c && c <=b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d) << endl;

    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  int ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(i <= j){
        continue;
      }
      ans++;
    }
  }
  for(int i = 0; i < m; i++){
    for(int j = 0; j < m; j++){
      if(i <= j){
        continue;
      }
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256