akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

const ll TREE_SIZE = 100100;

class Unionfind {
    public:
        vector<ll> par, siz, rank;
        Unionfind();
        ll root(ll x);
        void merge(ll x, ll y);
        bool issame(ll x, ll y);
        ll size(ll x);
};

int main() {
    ll n, m, ans = 0; cin >> n >> m;
    vector<P> edge(m);
    rep(i, m) {
        ll a, b; cin >> a >> b;
        a--; b--;
        edge[i] = make_pair(a, b);
    }
    // 各枝についてやる
    rep(i, m) {
        Unionfind t;
        bool ok = true;
        rep(j, m) {
            if(j == i) continue;
            else {
                t.merge(edge[j].first, edge[j].second);
            }
        }
        rep(j, n-1) {
            frep(k, j+1, n-1) {
                if(!t.issame(j, k)) {
                    ok = false;
                    break;
                }
            }
            if(!ok) break;
        }
        if(!ok) {
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}

Unionfind::Unionfind() {
    par.resize(TREE_SIZE);
    siz.resize(TREE_SIZE);
    rank.resize(TREE_SIZE);
    rep(i, TREE_SIZE) {
        par[i] = i;
        siz[i] = 1;
        rank[i] = 0;
    }
}
ll Unionfind::root(ll x) {
    if(par[x] == x) return x;
    else {
        return par[x] = root(par[x]);
    }
}
void Unionfind::merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if(x == y) return;
    if(rank[x] < rank[y]) {
        par[x] = y;
        siz[y] += siz[x];
    }
    else {
        par[y] = x;
        siz[x] += siz[y];
        if(rank[x] == rank[y]) rank[x]++;
    }
}
bool Unionfind::issame(ll x, ll y) {
    return root(x) == root(y);
}
ll Unionfind::size(ll x) {
    return siz[root(x)];
}

Measured memory_bytes: 5612
#include <stdio.h>
int main(){
	int i, I, ii, II;
	int m=0;
	int n;
	int a[50]={};
	while(scanf("%d", &n)!=EOF)
	{
		for(i=0;i<10;i++)
		{
			for(I=0;I<10;I++)
			{
				for(ii=0;ii<10;ii++)
				{
					for(II=0;II<10;II++)
					{
						if(i+I+ii+II==n)
						{
							a[m]++;
						}
					}
				}
			}
		}
		m++;
	}
	for(i=0;i<m;i++)
	{
		printf("%d\n", a[i]);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main() {
	string S;
	vector<unsigned char> s;

	cin >> S;

	long long int sum = 0;
	long long int b_num = 0;

	for (int i = S.length(); i != 0; i--) {
		if (S[i-1] == 'B') {
			sum += S.length() - i - b_num;
			b_num++;
		}

	}

	cout << sum << endl;

}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 200001;
void read(char a[], int &lena)
{
	char c = getchar();
	while (c < 'a' || c > 'z')
		c = getchar();
	while (c >= 'a' && c <= 'z')
		a[++lena] = c, c = getchar();
}
char a[maxn], b[maxn], x, y;
bool vis[maxn], flag = true;
int lena, lenb;
int main()
{
	read(a, lena), read(b, lenb);
	for (int i = 1; i <= lena; i++)
	{
		if (a[i] != b[i])
		{
			x = a[i], y = b[i];
			for (int j = 1; j <= lena; j++)
				if (a[j] == x)
					if (vis[j])
					{
						flag = false;
						break;
					}
					else
						a[j] = y;
				else if (a[j] == y)
					if (vis[j])
					{
						flag = false;
						break;
					}
					else
						a[j] = x;
		}
		vis[i] = true;
		if (!flag)
			break;
	}
	if (flag)
		printf("Yes");
	else
		printf("No");
	return 0;
}

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

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

  ll ans = 1e9;
  ll x1 = h/2;
  ll x2 = h - x1;
  ll y1 = w/2;
  ll y2 = w - y1;

  rep(i, w) {
    if (i == 0) continue;
    ll Smax = max(i*h, max(x1, x2) * abs(w-i));
    ll Smin = min(i*h, min(x1, x2) * abs(w-i));
    if (Smin == 0) continue;
    ans = min(ans, Smax - Smin);
  }
  rep(i, h) {
    if (i == 0) continue;
    ll Smax = max(i*w, max(y1, y2) * abs(h-i));
    ll Smin = min(i*w, min(y1, y2) * abs(h-i));
    if (Smin == 0) continue;
    ans = min(ans, Smax - Smin);
  }

  ll c1 = h/3;
  ll c2 = (h - c1)/2;
  ll c3 = h - c1 - c2;
  ll d1 = w/3;
  ll d2 = (w-d1)/2;
  ll d3 = w - d1 -d2;

  if (h >= 3) ans = min(ans, (c3 - c1)*w);
  if (w >= 3) ans = min(ans, (d3 - d1)*h);

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


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

using namespace std;

int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	if ((100 * r + 10 * g + b) % 4 == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


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

using namespace std;

int main() 
{
	int n, a = 0, b = 0, ab = 0, o = 0;
	string bld;

	while(cin >> n >> bld){
		if(bld[2] == 'B')    ab++;
		else if(bld[1] == 'A')    a++;
		else if(bld[1] == 'B')    b++;
		else if(bld[1] == 'O')    o++;
	}

	cout << a << endl << b << endl << ab << endl << o << endl;
	
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}

int main(){
  string s;
  cin >> s;
  set<char> st;
  rep(i,s.size()){
    st.insert(s[i]);
  }
  if(st.size() == s.size()) cout << "yes" << endl;
  else cout << "no" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main(){
  string ans="Yes";
  char s[4];
    for(int i=0; i<4; i++)
      cin >> s[i];
    sort(s, s+4);
    if(s[0]!=s[1] || s[2]!=s[3] || s[0]==s[3]) ans="No";
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 1000000001
using ll=long long;

ll gcd(ll x,ll y){
    if(x<y) swap(x,y);
    while(y>0){
        ll t=x%y;
        x=y;
        y=t;
    }
    return x;
}

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll gcm=(c*d)/gcd(c,d);
    ll ans=(b-b/c-b/d+b/gcm)-((a-1)-(a-1)/c-(a-1)/d+(a-1)/gcm);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
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 / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(), v.end()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };


int x, ans;
bool j;

int main() {

	cin >> x;

	ans = 1;

	REP(i, 2, x) {
		for (int j = 2; pow(i, j) <= x;j++) {
			int cnt = pow(i, j);
			ans = max(ans, cnt);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

    ll ans = min(n, m);
    if (m > n){
        ans += (m - n) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
//package com.atcoder.contest174.a;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        if(x >= 30) System.out.println("Yes");
        else System.out.println("No");
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 32756
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

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

    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    ll target = 0;
    rep(i, 64) {

        ll one = 0, zero = 0;
        for (ll l : v) {
            if ((l >> i) & 1) one++;
            else zero++;
        }
        if (zero >= one) target |= (1ll << i);
    }


    auto f = [&](ll x) {
        ll ans = 0;
        for (ll l : v) ans += (l ^ x);
        return ans;
    };

    auto check = [&](int i) -> ll {
        ll x = 0;
        rep(j, 64) {
            if (j == i) continue;
            else if (j < i) {
                ll b = (target >> j) & 1;
                x |= (b << j);
            } else if (j > i) {
//                ll b = (target >> j) & 1;
                ll c = (k >> j) & 1;
//                ll d = b & c;

                x |= (c << j);
            }
        }
//        cout << x << endl;
        return f(x);
    };

//    cout << target << endl;

    ll ans = max(f(0), f(k));

    rep(i, 64) {
        if ((k >> i) & 1) {
            ll now = check(i);
            cmax(ans, now);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4020
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define pf printf
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node

using namespace std;
///check n=1;
///check corner case;

int main()
{
    string str;
    ll n,i,j,cc=0;
    cin>>str;
    if(str[0]=='S'){
        if(str[1]=='U')cout<<7<<endl;
        else cout<<1<<endl;
    }
    else if(str[0]=='M')cout<<6<<endl;
    else if(str[0]=='T'){
        if(str[1]=='U')cout<<5<<endl;
        else cout<<3<<endl;
    }
    else if(str[0]=='W')cout<<4<<endl;
    else if(str[0]=='F')cout<<2<<endl;
    return 0;
}


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

/*int main (){
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
    }
    int s = vec.at(1);
    int count = 0;
    for(int i=0;i<N-2;i++){
        count += 1;
        if (s != 2){
            if(vec.at(s) != 2){
                s = vec.at(s);
            }else{
                break;
            }
        }else{
            break;
        }
    }
    
    if(s == 2){
        cout << count << endl;
    }else{
        cout << -1 << endl;
    }
    
}
*/
int main(){
    int N;
    cin >> N;
    vector<int> vec(N,0);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
    }
    int s = 1;
    int count = 0; 
    while(s != 2){
        s = vec.at(s-1);
        count += 1;
        if(count > N){
            break;
        }
    }
    if(count < N){
        cout << count << endl;
    }else{
        cout << -1 << endl;
    }
}

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

const int maxn(1e5 + 5);
const int mod(1e9 + 7);

int n, ans, cnt[26];
char s[maxn];

int main() {
	int i, j, u, v;
	scanf("%d %s", &n, s + 1), ans = 1;
	for (i = 1; i <= n; ++i) ++cnt[s[i] - 'a'];
	for (i = 0; i < 26; ++i) ans = (ll)ans * (cnt[i] + 1) % mod;
	ans = (ans + mod - 1) % mod, printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
//C - Sqrt Inequality

#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    long double a, b, c;

    cin >> a >> b >> c;

    long double aa = sqrtl(a);
    long double bb = sqrtl(b);
    long double cc = sqrtl(c);
    
    if (a + b + 2*aa*bb < c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}


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

struct Point{
    double x, y;
};

struct Vector{
    double x, y;
    Vector(double X = 0, double Y = 0) : x(X), y(Y) {}
    Vector(Point p1, Point p2) 
     : x(p2.x - p1.x), y(p2.y - p1.y) {}
    Vector& operator+(const Point& p)
    {
        x += p.x;
        y += p.y;
        return *this;
    }

    Vector& operator*(const double k)
    {
        x *= k;
        y *= k;
        return *this;
    };
    Vector& operator/(const double k)
    {
        if(k != 0)
        {
            x /= k;
            y /= k;
        }
        return *this;
    }
    Vector& operator=(const Vector& v)
    {
        x = v.x;
        y = v.y;
        return *this;
    }
    double dot(const Vector& v)
    {
        return x * v.x + y * v.y;
    }
};

double length(const Vector& v)
{
    return sqrt(v.x * v.x + v.y * v.y);
}

void getProjection(const Vector& v1, const Vector& v2, Vector& v)
{
    double l = length(v2);
    v = v2;
    v = v * v.dot(v1) / (l*l);
}

int main()
{
    Point p1, p2, p;
    int q;
    cin >> p1.x >> p1.y >> p2.x >> p2.y;
    cin >> q;
    Vector v(p1, p2), ans;
    for(int i=0;i<q;++i)
    {
        cin >> p.x >> p.y;
        getProjection(Vector(p1, p), v, ans);
        ans = ans + p1;
        printf("%.10lf %.10lf\n", ans.x, ans.y);
    }
}



Measured memory_bytes: 3196
#include<stdio.h>
int main()
{
	double a,b,sa;
	for(int i=0;i<7;i++){
	    scanf("%lf %lf",&a,&b);
		if(a>b)
		sa=a-b;
		else
		sa=b-a;
		printf("%.0f\n",sa);
	}
		return 0;
}



Measured memory_bytes: 2052