akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 1e5 + 5;
int n, m;
int cnt[maxn];

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < maxn; i++) {
    cnt[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  return true;
}

vector<int> g[maxn][2];
int res;

void solve() {
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < 2; j++) {
      g[i][j].clear();
    }
  }
  for (int i = 0; i < maxn; i++) {
    if (cnt[i]) {
      g[i % m][cnt[i] % 2].push_back(cnt[i]);
    }
  }
  res = 0;
  for (int i = 0; i < m; i++) {
    if (2 * i % m == 0) {
      int sum = 0;
      for (int j = 0; j < 2; j++) {
        for (int k = 0; k < sz(g[i][j]); k++) {
          sum += g[i][j][k];
        }
      }
      res += sum / 2;
      g[i][0].clear();
      g[i][1].clear();
      continue;
    }
    int j = m - i;
    while (!g[i][1].empty()) {
      if (!g[j][1].empty()) {
        if (g[i][1].back() > 1) {
          g[i][0].push_back(g[i][1].back() - 1);
        }
        g[i][1].pop_back();
        if (g[j][1].back() > 1) {
          g[j][0].push_back(g[j][1].back() - 1);
        }
        g[j][1].pop_back();
        res++;
      } else if (!g[j][0].empty()) {
        if (g[i][1].back() > 1) {
          g[i][0].push_back(g[i][1].back() - 1);
        }
        g[i][1].pop_back();
        g[j][1].push_back(g[j][0].back() - 1);
        g[j][0].pop_back();
        res++;
      } else {
        break;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < sz(g[i][j]); k++) {
        res += g[i][j][k] / 2;
      }
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#include<cstdio>
using namespace std;
#define MAX 10001

int main(){
    int a,b,c;
    int count =0;
    cin >> a >> b >> c;
    for (int i = a; i<=b;i++){
        if(c % i == 0){
            count++;
        }

    }
    printf("%d\n", count);
    return 0;
}



Measured memory_bytes: 3212
// @prefix atcoder
// @description atcoder template

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'
#define INF (1ll << 60)

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
const int MOD = 1e9 + 7;

int n, a, b;
string s;
signed main() {
  cin >> n >> a >> b >> s;

  int cnt = 0;
  int cntb = 0;
  REP(i, n) {
    char ch = s[i];
    if (ch == 'a') {
      if (a + b > cnt) {
        cnt++;
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    } else if (ch == 'b') {
      if (a + b > cnt && b > cntb) {
        cnt++;
        cntb++;
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define TEST(...)                                                              \
    { printf("! "), printf(__VA_ARGS__); }
#else
#define TEST(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    void solve() {
        i64 n, k;
        cin >> n >> k;
        n %= k;
        cout << min(k - n, n) << '\n';
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 256
#include <cstdio>
#define mod 998244353

long long res = 1;

int n; 
char s[300005];

int R , G , B , RG , RB , GR , GB , BR , BG;

void r()
{
	if(BG || GB)
	{
		res = res * (BG + GB) % mod;
		if(BG) BG-- ; else GB -- ;
		return ; 
	}
	if(B || G)
	{
		res = res * (B + G) % mod;
		if(B) B-- , BR ++; else G-- , GR ++;
		return ;
	}
	R ++;
}

void g()
{
	if(RB || BR)
	{
		res = res * (RB + BR) % mod;
		if(RB) RB -- ; else BR --;
		return ;
	}
	if(B || R)
	{
		res = res * (B + R) % mod;
		if(B) B-- , BG ++ ; else R-- , RG ++;
		return;
	}
	G++;
}

void b()
{
	if(RG || GR)
	{
		res = res * (RG + GR) % mod;
		if(RG) RG-- ; else GR --;
		return ;
	}
	if(R || G)
	{
		res = res * (R + G) % mod;
		if(R) R-- , RB ++ ; else G-- , GB ++;
		return; 
	}
	B++;
}

int main()
{
	scanf("%d\n%s" , &n , s + 1);
	for(int i = 1 ; i <= n*3 ; i ++)
	{
		switch(s[i])
		{
			case 'R':r() ; break;
			case 'B':b() ; break;
			case 'G':g() ; break;		
		}
	}
	for(int i = 1 ; i <= n ; i ++)
		res = res * i % mod;
	printf("%ld\n" , res);
}

Measured memory_bytes: 512
#ABC150_D

from fractions import gcd
N,M=map(int,input().split())
A=list(map(int,input().split()))
lcm=A[0]//2

for x in A:
    x//=2
    g=gcd(lcm,x)
    
    if (lcm//g)%2!=(x//g)%2:
        print(0)
        exit()
    
    lcm=lcm*x//g
print((M//lcm+1)//2)

Measured memory_bytes: 16320
n=int(input())
def search(k,m):
    count=0
    while 0<k:
        count+=k%m
        k=k//m
    return count
ans=10**6
for i in range(n+1):
    
    ans=min(ans,search(i,9)+search(n-i,6))
    #print(search(i,6),search(n-i,9))
    #print(ans)
print(ans)


Measured memory_bytes: 2940
k = int(input())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

s3=0
for a in range(3,k+1):
    for b in range(2,k):
        for c in range(1,k-1):
            if c<b<a:
                s3+=gcd(gcd(b,c),a)
s2 = 0
for a in range(2,k+1):
    for b in range(1,k):
        if b<a:
            s2+=gcd(a,b)
s = s3*6 + s2*6 +k*(k+1)/2
print(int(s))

Measured memory_bytes: 68400
X, num = [int(i) for i in input().split(" ")]

 
if num == 0:
  print(X)
else:
  l = [int(i) for i in input().split(" ")]
  for i in range(num):
    if X-i not in l:
      print(X-i)
      exit()
    elif X+i not in l:
      print(X+i)
      exit()
  print(X-num)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if ( C-A+B >= 0){
  cout << C-A+B << endl;
  }
  if ( C-A+B<0){
    cout << 0 << endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define F first
#define S second
void YES(bool che){
    if(che)cout<<"YES\n";
    else cout<<"NO\n";
}
void Yes(bool che){
    if(che)cout<<"Yes\n";
    else cout<<"No\n";
}
ll h,w,d,q;
P x[90005];
vector<ll>m[90005];
int main(void){
   cin>>h>>w>>d;
   for(int i=0;i<h;i++){
       for(int j=0;j<w;j++){
           int a;
           cin>>a;
           a--;
           x[a]=(P(ll(i),ll(j)));
       }
   }
   for(int i=0;i<d;i++){
       m[i].push_back(0);
       ll px=x[i].S,py=x[i].F;
       for(int j=i;j<h*w;j+=d){
           m[i].push_back(m[i].back()+abs(px-x[j].S)+abs(py-x[j].F));
           px=x[j].S;
           py=x[j].F;
       }
   }
   cin>>q;
   for(int i=0;i<q;i++){
       ll l,r;
       cin>>l>>r;
       l--;
       r--;
       cout<<m[l%d][r/d+1]-m[l%d][l/d+1]<<endl;
   }
}


Measured memory_bytes: 8576
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 40000005
using namespace std;
typedef long long ll;
int n,a[MN];
const int mod=1e9+7;
inline void add(ll &x,int y){(x+=y)>=mod?x-=mod:0;}
ll ans;
ll pow(int y){
	ll tmp=1,x=10;
	while(y){
		if(y&1)tmp=tmp*x%mod;
		y>>=1,x=x*x%mod;
	}return tmp;
}
int main(){
	scanf("%d",&n);for(int i=1;i<=4e7;i++)a[i]=a[i/10]+1;int r=1,ss=0;
   	for(int i=1;i<1e7;i++){
   		while(ss<n)ss+=a[r],++r;if(ss==n)add(ans,1);ss-=a[i];
	}
	for(int i=1;i<=n/8;i++){
		if(n%i!=0)add(ans,1);
		else add(ans,((pow(n/i)-pow(n/i-1)-i+1)%mod+mod)%mod);
    }printf("%lld\n",(ans%mod+mod)%mod);
}

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

int main(){
    string S, T;  cin >> S >> T;

    map<char, vector<ll>> charmap;
    for(int i=0; i<S.length(); i++){
        if(charmap.find(S[i]) == charmap.end()){
            charmap[S[i]] = vector<ll>(1, i);
        }else{
            charmap[S[i]].push_back(i);
        }
    }
    for(int i=0; i<T.length(); i++){
        if(charmap.find(T[i]) == charmap.end()){
            cout << -1 << endl;
            return 0;
        }
    }

    ll added = 0;
    ll N = T.length();
    ll last = -1;
    for(int i=0; i<N; i++){
        int idx = upper_bound(charmap[T[i]].begin(), charmap[T[i]].end(), last) - charmap[T[i]].begin();
        if(idx == charmap[T[i]].size()){
            added++;
            last = charmap[T[i]][0];
        }else{
            last = charmap[T[i]][idx];
        }
    }

    cout << (ll)S.length() * added + last + 1 << endl;
}

Measured memory_bytes: 1728
n = int(input())
a = list(map(int,input().split()))
x = 0
for i in range(2,n):
    x ^= a[i]
s = a[0]+a[1]
if s < x or (s-x) % 2 == 1:
    print(-1)
    exit()
d = (s-x)//2
if d & x != 0 or d > a[0]:
    print(-1)
    exit()
i = 50
ans = d
while i >= 0:
    if x >> i & 1:
        if (1 << i) + ans <= a[0]:
            ans += 1 << i
    i -= 1
if ans == 0:
    print(-1)
    exit()
print(a[0]-ans)

Measured memory_bytes: 62032
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var A = vals[0];
            var B = vals[1];
            var C = vals[2];

            if(B>=C-1)
            {
                Console.WriteLine(B + C);
            }
            else
            {
                var remain = C - B;
                var eatable = Math.Min(remain, A + 1);
                Console.WriteLine(2 * B + eatable);
            }
        }
    }
}


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

int main(){
  string S, T;
  cin >> S >> T;
  for(int i=0; i<S.size(); i++){
    string Sp="";
    for(int j=S.size()-1-i; j<S.size(); j++){
      Sp += S[j];
    }
    for(int j=0; j<S.size()-1-i; j++){
      Sp += S[j];
    }
    if(Sp==T){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static final int PLAYER_SELF = 1;
    public static final int PLAYER_ENEMY = 2;

    public static int[][] rep;
    public static int[] num;
    public static int[] minNum;
    public static int[] repindexes;
    public static int repCurrent = 0;

    public static void main(String[] args) {
        new Main().run();
    }

    public static boolean checkDigit(int num, int digit){
        int result = (num & (int)Math.pow(2, digit));
        return (result > 0);
    }

    public static long subtotal(String base, boolean[] digi){
        long total = 0;
        int from = 0;
        for (int i=0; i<digi.length; i++){
            if (!digi[i]) continue;;
            total += Long.parseLong(base.substring(from, i+1));
//            System.out.print(base.substring(from, i+1)+" + ");
            from = i+1;
        }
        total += Long.parseLong(base.substring(from, base.length()));
//        System.out.print(base.substring(from, base.length())+" = " + total);
//        System.out.println();
        return total;
    }


    public void run(){
        BufferedReader br = null;
        try {
            Scanner s = new Scanner(System.in);
//            Scanner s = new Scanner(new FileInputStream("./testdat"));

            String val = s.next();

            int trycount = (int)Math.pow(2, val.length()-1);
            long total = 0;
            for (int i=0; i<trycount; i++){
                boolean[] digit = new boolean[val.length()-1];
                for (int t =0; t<val.length()-1; t++){
                    boolean res = checkDigit(i, t);
                    digit[t] = res;
                }
                total += subtotal(val, digit);
            }
            System.out.println(total);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 10452
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

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

    vector<int> d(N);
    for (int i=0; i<N; i++) {
        cin >> d[i];
    }

    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size() << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int x[5];
    for(int i=0;i<5;i++){
        cin>>x[i];
    }
    for(int i=0;i<5;i++){
        if(x[i]==0){
            cout<<i+1;
            break;
        }
    }
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

  
signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);

  int n,k;
  string s;
  cin >> n >> k >> s;

  int score = 0;
  FOR(i, 1, n){
    if(s[i - 1] == s[i]) score++;
  }

  cout << min(score + 2 * k, n - 1) << endl;
  
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	ULL GCD(ULL a, ULL b) { return (b == 0) ? a : GCD(b, a % b); }

	void Solve() {
		/*
		ULL n, m; cin >> n >> m;
		ULL A[100000]; rep(i, n) cin >> A[i];
		ULL d = 1;
		while (A[0] % (d * 2) == 0) d *= 2;
		rep(i, n) {
			if (A[i] % d != 0) { cout << 0 << endl; return; }
			A[i] /= d;
			if (A[i] % 2 == 0) { cout << 0 << endl; return; }
		}
		ULL lcm = 1;
		rep(i, n) {
			lcm = lcm * A[i] / GCD(lcm, A[i]);
			if (lcm > m) { cout << 0 << endl; return; }
		}
		cout << (m + lcm) / (lcm * 2) << endl;
		*/
		UL N; cin >> N;
		UL A[10]; rep(i, N) cin >> A[i];
		ULL ans = 1;
		rep(i, N) ans = ans * A[i] / GCD(ans, A[i]);
		cout << ans << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}



Measured memory_bytes: 3116