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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e5 + 5;
int mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
ll infll = 1e18 + 7;



signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s; cin >> s;
    Fora(&v, s){
        if (v == '?') v = 'D';
    }
    cout << s;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 3772
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;

int ls[3], cnt, don, cho, ei;

void solve(void){
    while (1) {
        scanf("%d %d %d\n", &ls[0], &ls[1], &ls[2]);
        sort(ls, ls+3);
        if (ls[0] + ls[1] <= ls[2]) {
            printf("%d %d %d %d\n", cnt, cho, ei, don);
            break;
        }
        cnt++;
        if (ls[0]*ls[0] + ls[1]*ls[1] == ls[2]*ls[2]) cho++;
        else if (ls[0]*ls[0] + ls[1]*ls[1] > ls[2]*ls[2]) ei++;
        else don++;
    }
}

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



Measured memory_bytes: 3224
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

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


ull E = 1000000007;

int main() {
    int K, S;
    cin >> K >> S;
    int ans = 0;
    for (int X = 0; X <= K; ++X) {
        if (X > S) break;
        for (int Y = 0; Y <= K; ++Y) {
            if (X + Y > S) break;
            if (S - (X + Y) <= K) ++ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
    for(int i=0; i<=1; i++)
        for(int j=0; j<=1; j++)
            for(int k=0; k<=1; k++)
            {
                int ans=0;
                if(!i) ans+=a+b;
                else ans+=a-b;
                if(!j) ans+=c;
                else ans-=c;
                if(!k) ans+=d;
                else ans-=d;
                if(ans==7)
                {
                    printf("%d%c%d%c%d%c%d=7\n",a,i==0?'+':'-',b,j==0?'+':'-',c,k==0?'+':'-',d);
                    return 0;
                }
            }

}


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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define EPS (1e-7)
#define INF ((ll)1e9+7)
#define PI (acos(-1))
#define c(a) cout<<a<<"\n";
using namespace std;

int main() {
	speed;
	int n;
	cin >> n;
	vector<int>a;
	vector<int>x;
	rep(i, n) {
		int b;
		cin >> b;
		a.push_back(b);
	}
	ll sum = 0;
	ll ini = 0;
	rep(i, n) {
		sum += a.at(i);
		if ((i+1) % 2 == 0 && i != 0)ini += 2 * a.at(i);
	}
	x.push_back(sum - ini);
	rep(i, n) {
		int b = 2 * a.at(i) - x.at(i);
		x.push_back(b);
	}
	rep(i, n) {
		cout << x.at(i)<<" ";
	}
	ed;
	return 0; 
}



Measured memory_bytes: 2296
#include <iostream>
#include <vector>
#include <iostream>
#include <cstdio>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
 
#define ll long long
#define pb push_back
#define vi vector<int>
#define sz(a) (int((a).size()))
#define mp make_pair
#define f first
#define s second
#define pii pair<int, int>
 
using namespace std;
 
const int mod = 998244353;
const int inf = (int)2e9;
const ll INF = (ll)2e18;
const int N = 100100;

int a[5];

int main() {
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
		cout << "YES\n";
	} else cout << "NO\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 5
int main(void){
	char s[N];
  	scanf("%s",&s);
  	
  	switch(s[1]){
    	case 'B':
        	printf("ARC\n");
        	break;
     	case 'R':
        	printf("ABC\n");
        	break;
    }
  	
  	return 0;
}

Measured memory_bytes: 1608
#include <stdio.h>

int main(void){

  int N,A[1000];
  scanf("%d",&N);
  int k;
  for(k=0;k<N;k++) {
    scanf("%d",&A[k]);
  }
  int i;
  for(i=0;i<N;i++){
    int v=A[i];
    int j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1] = A[j];
      A[j]=v;
      j--;
    }
    for(k=0;k<N;k++) {
      printf("%d",A[k]);
      if(k != N-1){
	printf(" ");
      }
    }
    printf("\n");
  }
  return 0;

}


Measured memory_bytes: 1928
def insertion_sort(A, N):
  for i in range(1,N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
      A[j+1] = A[j]
      j -= 1
    A[j+1] = v
    print(*A)

N = int(input())
A = list(map(int,input().split()))

print(*A)
insertion_sort(A,N)


Measured memory_bytes: 5984
#include <iostream>
#include <vector>
#include <string>

int main () {

    int K;
    std::cin >> K;

    std::vector<std::string> lunlun_nums{"1", "2", "3", "4", "5", "6", "7", "8", "9"};
    
    int left = 0, right = lunlun_nums.size() - 1;
    while (lunlun_nums.size() <= K) {
        for(int i = left; i <= right && lunlun_nums.size() <= K; i++) {
            if (lunlun_nums.at(i).back() == '0') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "0");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "1");
            } else if (lunlun_nums.at(i).back() == '1') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "0");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "1");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "2");
            } else if (lunlun_nums.at(i).back() == '2') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "1");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "2");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "3");
            } else if (lunlun_nums.at(i).back() == '3') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "2");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "3");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "4");
            } else if (lunlun_nums.at(i).back() == '4') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "3");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "4");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "5");
            } else if (lunlun_nums.at(i).back() == '5') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "4");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "5");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "6");
            } else if (lunlun_nums.at(i).back() == '6') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "5");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "6");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "7");
            } else if (lunlun_nums.at(i).back() == '7') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "6");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "7");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "8");
            } else if (lunlun_nums.at(i).back() == '8') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "7");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "8");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "9");
            } else if (lunlun_nums.at(i).back() == '9') {
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "8");
                lunlun_nums.emplace_back(lunlun_nums.at(i) + "9");
            }
        }
        left = right + 1;
        right = lunlun_nums.size() - 1;
    }

    std::cout << lunlun_nums.at(K - 1) << std::endl;

    return 0;
}

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

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

  vector<ll> toFive(10000);
  map<ll, ll> toOne;
  rep(i, 10000) {
    ll num = i;
    rep(j, 4) {
      num *= i;
    }
    toFive[i] = num;
    toOne[num] = i;
  }

  ll ansA, ansB;
  if(x%2 == 0) {
    if(toOne[x/2]){
      ansA = toOne[x/2];
      ansB = -ansA;
      cout << ansA << " " << ansB << endl;
      return 0;
    }
  }


  rep(i, 10000) {
    ansA = i;
    rep(j, i) {
      if (toFive[ansA] < x) break;
      ll num = toFive[ansA] - toFive[j];
      if (num == x) {
        cout << ansA << " " << j << endl;
        return 0;
      }
    }

    rep(j, 10000) {
      ll num = toFive[ansA] + toFive[j];
      if (x == num) {
        cout << ansA << " " << -j << endl;
        return 0;
      } else if (x < num) {
        break;
      }
    }

  }

  // ll startTarget = 0;
  // while(true) {
  //   ll num = toFive[startTarget];
  //   if (x <= num) {
  //     startTarget--;
  //     break;
  //   }
  //   startTarget++;
  // }

  // rep(i, startTarget+1) {
  //   ll num = toFive[startTarget] + toFive[i];
  //   if (num == x) {
  //     cout << startTarget << " " << -i << endl;
  //     return 0;
  //   }
  // }

  // startTarget++;

  // rep(i, startTarget+1) {
  //   ll num = toFive[startTarget] - toFive[i];
  //   if (num == x) {
  //     cout << startTarget << " " << i << endl;
  //     return 0;
  //   }
  // }

  return 0;
}


Measured memory_bytes: 4312
//ALDS1_5_A_ExhaustiveSearch

#include<bits/stdc++.h>
using namespace std;
const int INF=2E9;
typedef pair<int,int> Pair;
typedef long long LL;

int solve(int A[],int m,int n){
    if(m<0) return 0;
    else if(m==0) return 1;
    else if(n==0) return 0;
    else return (solve(A,m-A[n-1],n-1) || solve(A,m,n-1));
}

int main(){
    int n,q;
    int A[100];
    cin >> n;
    for(int i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    cin >> q;
    for(int i=0;i<q;i++){
        int m;
        scanf("%d",&m);
        if(solve(A,m,n)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;

struct edge {
  int to, cost;
};

vector<int> dijkstra(vector<vector<edge>> g, int start, int v_count, int e_count) {
  vector<int> d(v_count);
  rep(i, v_count) d[i] = 1 << 30;
  d[start] = 0;
  priority_queue<Pii, vector<Pii>, greater<Pii>> que;
  que.emplace(d[start], start);
  while (!que.empty()) {
    Pii p = que.top();
    que.pop();
    int v = p.second;
    if (p.first > d[v]) continue;
    rep(i, g[v].size()) {
      edge e = g[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(Pii(d[e.to], e.to));
      }
    }
  }
  return d;
}

int main() {
  int vc,ec,r; cin>>vc>>ec>>r;
  vector<vector<edge>> g(500000);
  rep(i,ec) {
    int s,t,d; cin>>s>>t>>d;
    g[s].push_back({t, d});
  }

  vector<int> d = dijkstra(g, r, vc, ec);

  rep(i, vc) {
    if (d[i] == 1 << 30) cout << "INF" << endl;
    else cout << d[i] << endl;
  }
}



Measured memory_bytes: 39024
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using namespace atcoder;
using LL = long long;
using P = pair<int,int>;
const LL INF = 1e18;

LL extGCD(LL a, LL b, LL &x, LL &y){
	if(b==0){
		x=1;
		y=0;
		return a;
	}
	LL d=extGCD(b,a%b,y,x);
	y-=a/b*x;
	return d;
}

int main(){
	LL N;
	cin >> N;
	N*=2;
	LL Nc=N;
	vector<LL> div;
	for(LL d=2; d*d<=Nc; d++){
		LL res=1;
		while(N%d==0){
			N/=d;
			res*=d;
		}
		if(res>1) div.emplace_back(res);
	}
	if(N>1) div.emplace_back(N); 
	int S=div.size();
	LL ans=INF;
	rep(bit,1<<S){
		LL a=1, b=1;
		rep(i,S){
			if(bit&(1<<i)) a*=div[i];
			else b*=div[i];
		}
		LL x, y, res;
		if(a==1 or b==1) res=a*b-1;
		else{
			extGCD(a,-b,x,y);
			res=min(a*x,b*y);
			extGCD(-a,b,x,y);
			res=min(a*x,b*y);
		}
		ans=min(ans,res);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
int main(){
  int count = 0;
  char S[3];
  cin >> S;
  for(int i = 0; i < 3; i++){
    if(S[i] - '0'){
      count += 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) v.begin(),v.end()
#define fi first
#define se second
const int inf = 1e9;
int mod = 1e9+7;

signed main(){
	int n;
	scanf("%lld", &n);
	int ans = 2*(n/11);
	n = n%11;
	if(n > 0)ans++;
	if(n > 6)ans++;
	printf("%lld\n", ans);
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   string s,t; cin>>s>>t;
   t.pop_back();
   if(s==t)puts("Yes"); else puts("No");
   return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
int main()
{
  int N, l;
  cin >> N;
  string w, x, y, ans = "Yes", W[N];
  cin >> w;
  W[0] = w;
  for (int i = 1; i < N; ++i) {
    cin >> x;
    if (w[ w.size() - 1] == x[0]) {
      ;
    }else {
      ans = "No";
    }
    for (int j = 0; j < i; ++j) {
      if (x == W[j]) {
        ans = "No";
      }
    }
    W[i] = x;
    w = x;
    }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include                        <bits/stdc++.h>
#define   lli                   unsigned long long int
#define   ll                    long long int
#define   PI                    acos(-1.0)
#define   UNIQUE(V)             (V).erase(unique(ALL(V), (V).end()) //vector/string etc must need to be sorted
#define   timesave              ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define   ALL(V)                (V).begin(), (V).end()
#define   MEMSET(a, val)        memset(a, val, sizeof(a))
using     namespace             std;


template  <class T> T GCD(T a, T b) { return (b != 0 ? GCD <T> (b, a%b) : a); }
template  <class T> T LCM(T a, T b) { return ((a*b)  / GCD <T> (a, b)); }


int main()
{
//  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

    timesave;

    //while(1){

    ll r, d, x, val, last;

    cin >> r >> d >> x;

    for(int i = 1; i <= 10; i++){
        val = (r*x) - d;
        x = val;
        cout << val << 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 Rep(i, s, n) for (int i = (int)s; i < (int)n; i++)
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    double a[n];
    double sum = 0;
    rep (i, n) {
        cin >> a[i];
        sum += 1/a[i];
    }
    printf("%f", 1/sum);
}

Measured memory_bytes: 3784
//#include <bits/stdc++.h>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  long int N;
  cin >> N;
  long int sum = 0;
  rep(i, N)
  {
    if (((i + 1) % 3 == 0) && ((i + 1) % 5 == 0))
    {
    }
    else if((i+1) % 3 == 0){

    }
    else if((i+1) % 5 == 0){
    }
    else{
      sum += i + 1;
    }
     // cout << i + 1 << endl;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;

//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
	ll n,m;
	cin>>n>>m;
	if(n==m)cout<<"Yes";
	else cout<<"No";
}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

}

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

int main() {
 int N, M;
 cin >> N >> M;
 
 vector <vector<char>> A(N,vector<char>(N));
 vector <vector<char>> B(M,vector<char>(M));
  
 for (int i = 0; i < N; i++){
   for (int j = 0; j < N; j++)
     cin >> A.at(i).at(j);
 }
 for (int i = 0; i < M; i++){
   for (int j = 0; j < M; j++)
     cin >> B.at(i).at(j);
 }
 bool answer = false;
 for(int x = 0; x <= N-M;x++){
   for(int y = 0; y <= N-M;y++){
     bool match = true;
 		for (int i = 0; i < M; i++){
    	  for (int j = 0; j < M; j++){
    		if (A.at(i+x).at(j+y) != B.at(i).at(j))
          	match = false;
          }
      }
     if(match) answer = true;
    }
 }
 if(answer) cout << "Yes" << endl;
 else cout << "No" << endl;
}

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

ans = 0
k = K + 1
for i in range(1, N-K+1):
    ans += i * (N // k) + max(N % k - (K - 1), 0)
    k += 1

if K == 0:
    ans = N ** 2
print(ans)

Measured memory_bytes: 3060
import java.util.*;

class Main {
   public static void main(String[] args)
   {
      Scanner scan = new Scanner(System.in);
      int     n    = scan.nextInt();
      int     m    = scan.nextInt();
      int     N    = scan.nextInt();
      int     M    = scan.nextInt();

      System.out.println(Math.min(n, m) + Math.min(N, M));
   }
}


Measured memory_bytes: 21588
#include<iostream>
#include<iomanip>

using namespace std;

int main(){
    int a,b,c,d,e,f;
    double X[6] = {};
    
    while( cin >> X[0]) {
    	for(int i=1;i<6;i++) 
    	cin >> X[i];
   
    double y = ( X[2] * X[3] - X[0] * X[5]) / ( X[1] * X[3] - X[0] * X[4] );

    if( X[0] !=0 )
    cout << fixed << setprecision(3) << (X[2] - X[1] * y) / X[0] << " " << y << "\n";
    
    else
    cout << fixed << setprecision(3) << (X[5] - X[4] * y) / X[3] << " " << y << "\n";
}
	return 0;
}


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

using namespace std;

const int N = 1e5 + 2;
int a[N], n, f[N], g[N];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	f[1] = a[1];
	for (int i = 2; i <= n; ++i)
		f[i] = __gcd(f[i - 1], a[i]);
	g[n] = a[n];
	for (int i = n - 1; i >= 1; --i)
		g[i] = __gcd(g[i + 1], a[i]);
	f[0] = g[n + 1] = -1;
	int res = f[n];
	for (int i = 1; i <= n; ++i) {
		int prev = i - 1;
		int next = i + 1;
		res = max(res, __gcd(f[prev] < 0 ? g[next] : f[prev], g[next] < 0 ? f[prev] : g[next]));
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_str(char *str, int size)
{
    char format[100];
    if (size == 0)
        return 0;
    snprintf(format, sizeof(format), "%%%ds", size);
    scanf(format, str);
    return 0;
}

#define BUF_SIZE 100

int asc(const void *a, const void *b) {
    return *(char*)a - *(char*)b;
}

int desc(const void *a, const void *b) {
    return *(char*)b - *(char*)a;
}

int main(void) {
    static char str1[BUF_SIZE];
    static char str2[BUF_SIZE];
    // we hope that str1 < str2;
    get_str(str1, BUF_SIZE);
    get_str(str2, BUF_SIZE);
    int len1 = strlen(str1);
    int len2 = strlen(str2);
    qsort(str1, len1, sizeof(char), asc);
    qsort(str2, len2, sizeof(char), desc);
#ifdef DEBUG
    printf("%s vs %s\n", str1, str2);
#endif

    printf("%s\n", strncmp(str1, str2, BUF_SIZE)<0 ? "Yes" : "No");
    return 0;
}

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

int main(void){
    string s;
    cin >> s;
    int zct=0;
    int oct=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='0'){
            zct++;
        }else{
            oct++;
        }
    }
    cout << min(oct,zct)*2 << endl;
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	FIO();
	int n, k; cin >> n >> k;
	vector<int> a(n + 1);

	for (int i = 1; i < n + 1; i++)
		cin >> a[i];

	vector<vector<int> > dp(n + 1, vector<int> (k + 1, 1));

	for (int i = 1; i < k + 1; i++)
	{
		dp[0][i] = 0;
	}

	dp[0][0] = 1;

	for (int i = 1; i < n + 1; i++)
	{
		vector<int> prefix_sum(k + 1);
		prefix_sum[0] = dp[i - 1][0];

		for (int j = 1; j < k + 1; j++)
		{
			prefix_sum[j] = (prefix_sum[j - 1] + dp[i - 1][j]) % mod;
		}

		for (int j = 0; j < k + 1; j++)
		{
			if (j <= a[i])
				dp[i][j] = prefix_sum[j];
			else
			{
				int exclude_index = j - a[i] - 1;
				dp[i][j] = (prefix_sum[j] - prefix_sum[exclude_index] + mod) % mod;
			}
		}

		prefix_sum.clear();
	}
	cout << dp[n][k] << '\n';
	return 0;
}

Measured memory_bytes: 83120
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, char> Q;
const ll mod = 1000000007;
const ll INF = 1000000000000000;

ll N, a[300000], sum, H, ans;

int main(void)
{
	cin >> N;

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

	for (int i = 0; i < N; i++)
	{
		H += a[i];
		if (H > sum / 2)
		{
			ans = abs(H - (sum - H));
			H -= a[i];
			ans = min(ans, (sum - H) - H);
			break;
		}
		
	}

	cout << ans << endl;

	int xxx;
	cin >> xxx;
}



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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
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; }

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

struct BIT {
  private:
   vector<ll> bit;
   ll N;
 
  public:
   BIT(ll size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(ll a, ll w) {
     for (ll x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(ll a) {
     ll ret = 0;
     for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };
 
ll fff(ll n, vector<ll>& v, ll i, ll j, ll rl){
  ll can = 0;
  ll can_i = 0;

  cout << v[0]<<endl;
  
  // right
  if(rl == 0){
    rep(k, n){
      if(v[k]*(j-k)>can){
	can = v[k]*(j-k);
	can_i = k;
      }
      //cout << can<<endl;
    }
    v[can_i] = 0;
    return can;
  }
  // left
  else{
    rep(k, n){
      if(v[k]*(k-i)>can){
	can = v[k]*(k-i);
	can_i = k;
      }
      //cout << can<<endl;

    }
    v[can_i] = 0;
    return can;
  }
  
}


int main(){
  ll n,t;

  cin>>n>>t;

  ll ans = 0;
  ll tmp, pre;
  cin>>pre;
  rep(i, n-1){
    cin>> tmp;
    if((pre+t)<tmp) ans += t;
    else ans += -pre+tmp;
    pre = tmp;
  }
  
  cout << ans + t <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
const ll inf = (1LL << 60LL);
bool prime[200001];
int prefSum[100006];
class node{
public:
    int val, lb, rb;
    node *left, *right;
    node(int levo, int desno){
        lb = levo;
        rb = desno;
        if(levo == desno){
            val = prefSum[levo];
        }
        else{
            int mid = (levo + desno) / 2;
            left = new node(levo, mid);
            right = new node(mid + 1, desno);
            val = left->val + right -> val;
        }
    }
    int query(int i, int j){
        if(i <= lb && rb <= j){
            return val;
        }
        if(rb < i || j < lb)return 0;
        return left->query(i, j) + right->query(i, j);
    }
};
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    memset(prime, true, sizeof prime);
    prime[0] = prime[1] = false;
    for(ll i = 2; i <= 200000; i ++){
        if(prime[i]){
            for(ll j = i * i; j <= 200000; j += i){
                prime[j] = false;
            }
        }
    }
    memset(prefSum, 0, sizeof prefSum);
    for(int i = 1; i <= 100000; i ++){
        if(i % 2 == 1){
            if(prime[i] && prime[(i + 1) / 2]){
                prefSum[i] = 1;
            }
        }
    }
    node tree(0, 100000);
    int q;
    cin >> q;
    int l, r;
    for(int i = 0; i < q; i ++){
        cin >> l >> r;
        cout << tree.query(l, r) << endl;
    }
    return 0;
}



Measured memory_bytes: 12544
n,m,x=map(int,input().split())
a=list(map(int,input().split()))

l=[]

for i in range(n):
    if i in a:
        l.append(1)
    else:
        l.append(0)
l.append(0)
        
ans=min(sum(l[:x+1]),sum(l[x:]))
print(ans)

Measured memory_bytes: 3064
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();
    println!(
        "{}",
        if s[0] != s[1] && s[1] != s[2] && s[2] != s[3] {
            "Good"
        } else {
            "Bad"
        }
    );
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std; 
#define int long long int 
const int MAX = 1e5 + 5 ; 

vector<int> dp(MAX,0);
vector<int> edges[MAX];
vector<int> vis(MAX,0);

void calc ( int a ) {
	vis[a] = 1 ; 
	if ( edges[a].size() == 0 ) {
		dp[a] = 0 ; 
		return ;
	}
	for ( int i=0; i<edges[a].size(); ++i ) {
		if ( !vis[edges[a][i]] ) {
			calc(edges[a][i]) ;
			dp[a] = max(dp[a],dp[edges[a][i]] + 1) ; 
		}
		else {
			dp[a] = max(dp[a],dp[edges[a][i]] + 1) ; 
		}
	}
}

signed main() {
	int n, m ; cin >> n >> m ; 
	for (int i = 0; i < m; ++i) {
		int a, b ; cin >> a >> b ; 
		edges[a].push_back(b) ; 
	}
	for (int i = 1; i < n+1; ++i) {
		if ( !vis[i] ) {
			calc(i) ;
		}
	}
	int ans = 0 ; 
	for (int i = 1; i < n+1; ++i)
	{

		ans = max(ans, dp[i]) ; 
	}
	cout << ans << endl ; 
	return 0 ; 
}

Measured memory_bytes: 9344
#include<iostream>
using namespace std;
  int N,M;
  int C[1000010];
int main(){
  ios_base::sync_with_stdio(false);
  cin>>N>>M;
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    C[a]++;
    C[b]++;
  }
  for(int i=0;i<N;i++){
    if(C[i]%2==1){
      cout<<"NO";
      break;
    }
    if(i==N-1)cout<<"YES";
  }
  return 0;
}


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

using namespace std;

int n;
string s, t;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            n++;
        }
    }
    cout << n << endl;
    return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  int N = read();
  string str = readString();
  int r = 0, b = 0;
  REP(i, N) {
    if (str[i] == 'R')
      r++;
    else
      b++;
  }
  if (r > b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 2304
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),d=sc.nextInt(),x=sc.nextInt();
		int chocolate=0;
		for(int i=0; i<n; i++) {
			int interval=sc.nextInt();
			for(int j=1; j<=d; j+=interval) {
				chocolate++;
			}
		}
		System.out.println(chocolate+x);
	}
}

Measured memory_bytes: 27208
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>
#include <math.h>

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  string s;
  cin >> s;
  if (s=="ABC") {
    cout << "ARC" << endl; 
  } else {
    cout << "ABC" << endl; 

  }
  return 0;
}

Measured memory_bytes: 3624
package main

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

var (
	rdr   = bufio.NewReaderSize(os.Stdin, 1000000)
	reply string
)

func main() {
	in := make([]string, 6)
	fmt.Scan(&in[0], &in[1], &in[2], &in[3], &in[4], &in[5])
	solve(in)
}

func solve(buf []string) {
	var (
		n, _ = strconv.Atoi(buf[0])
		k, _ = strconv.Atoi(buf[1])
		r, _ = strconv.Atoi(buf[2])
		s, _ = strconv.Atoi(buf[3])
		p, _ = strconv.Atoi(buf[4])
		t    = strings.Split(buf[5], "")

		ans int
		i   int
	)

	points := []int{r, s, p}

	for i = 0; i < k; i++ {
		ans += point(points, string(t[i]))
	}
	for ; i < n; i++ {
		if t[i] == t[i-k] {
			t[i] = ""
		}
		ans += point(points, string(t[i]))
	}
	reply = strconv.Itoa(ans)
	fmt.Println(reply)
}

func point(points []int, s string) (point int) {
	switch s {
	case "r":
		point = points[2]
	case "s":
		point = points[0]
	case "p":
		point = points[1]
	}
	return
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

// ---------------------------------------------------

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

// ---------------------------------------------------

func yesOrNo(b bool) {
	if b {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func yesorNO(b bool) {
	if b {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

Measured memory_bytes: 2944
from bisect import bisect_left, bisect_right
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    a = bisect_left(A, b)
    c = bisect_right(C, b)
    ans += a*(N-c)
print(ans)

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

int main()
{
	int K;
	scanf("%d", &K);
	std::vector<bool> visited(K);
	std::deque<std::pair<int, int>> bfs;
	bfs.push_back({1, 1});
	while (!bfs.empty())
	{
		auto num{bfs.front()};
		bfs.pop_front();
		if (visited[num.first]) continue;
		if (num.first == 0)
		{
			printf("%d\n", num.second);
			break;
		}
		visited[num.first] = true;
		bfs.push_back({num.first == K - 1? 0: num.first + 1, num.second + 1});
		bfs.push_front({num.first * 10 % K, num.second});
	}

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int cnt;
void insertionSort(int A[], const int n, const int g)
{
    
    for( int i = g; i < n; ++i ){
        int tmp = A[i];
        int j = i - g;
        while( -1 < j && tmp < A[j] ){
           
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = tmp;
    }
}

void shellSort(int A[], const int n)
{
     cnt = 0;
    int m;
    int G[100];
    for( int i = 0; i < 100; ++i ){
        if( i == 0 ) G[i] = n / 2 + 1;
        else G[i] = G[i-1] / 2 - 1;
        if( G[i] < 0 ){
            G[i-1] = 1;
            G[i] = 0;
            m = i;
            break;
        }
    }

    for( int i = 0; i < m; ++i )
        insertionSort(A, n, G[i]);

    //出力
    printf("%d\n", m);
    for( int i = 0; i < m; ++i ){
        if( i ) printf(" ");
        printf("%d", G[i]);
    }
    printf("\n%d\n", cnt);
    for( int i = 0; i < n; ++i )
        printf("%d\n", A[i]);
}

int main()
{
    //入力
    int n;
    scanf("%d", &n);
    int A[n];
    for( int i = 0; i < n; ++i )
        scanf("%d", &A[i]);

    //シェルソート
    shellSort(A, n);

    return 0;
}


Measured memory_bytes: 5700
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).map { |n| [1, n] }
m.times { a << gets.split.map(&:to_i) }
r = 0
a.sort_by(&:last).reverse_each do |b, c|
  r += [b, n].min * c
  break if (n -= b) < 0
end
puts r


Measured memory_bytes: 24176
c = [nil]
3.times do
  c << [nil] + gets.split.map(&:to_i)
end
puts [
c[1][1] + c[2][2] == c[1][2] + c[2][1],
c[2][2] + c[3][3] == c[2][3] + c[3][2],
c[1][2] + c[2][3] == c[1][3] + c[2][2],
c[2][1] + c[3][2] == c[2][2] + c[3][1]
].all? {|x| x} ? 'Yes' : 'No'


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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;

vector<int> ans;

void restore(vector<int> a) {
  if (a.empty()) {
    return ;
  }

  int n = a.size();
  for (int i = n - 1; i >= 0; --i) {
    assert(a[i] <= i + 1);
  }

  for (int i = n - 1; i >= 0; --i) {
    if (a[i] == i + 1) {
      a.erase(a.begin() + i);
      restore(a);
      cout << i + 1 << "\n";
      return;
    }
  }
  assert(false);
}

int main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> a;

  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    a.push_back(x);
    if (x > i) {
      cout << "-1\n";
      return 0;
    }
  }

  restore(a);
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  char a[3];
  char b[3];
  int i;
  int count= 0;
  scanf("%s", &a);
  scanf("%s", &b);
  for(i=0; i<3; i++){
    if(a[i]== b[i]){
      count += 1;
    }
  }
  printf("%d\n",count);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	long n,s;
	s=0;
	cin>>n;
	for(long i=1;n>=i;i*=10){
		if(i==1){
			s+=n%(i*10);
		}
		else{
			s+=(n/i)%10;
		}
	}
	if(n%s==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] NK = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            if (NK[0] % NK[1] == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}


Measured memory_bytes: 13268
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using o_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) find_by_order(i)
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);


/*======================================================================*/
void solve(){
    map<string , int> m;
    int n;
    cin >> n;
    cout << (1000 - n%1000)%1000;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

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

using namespace std;

#define rep(i, a, b)  for(int i = (a); i < (b); i++)
#define rrep(i, a, b) for(int i = (a); i > (b); i--)
#define sq(x) ((x) * (x))
#define bit(x) bitset<32>(x)
#define vsort(v)  sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<llint>())
#define debug(x) cout << #x << " " << (x) << endl
#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


template<typename Tn> Tn __lcm(Tn a, Tn b)
{
    return a / __gcd(a, b) * b;
}

struct UF
{
    vi par, sizes;

    UF() {}
    UF(int size) : par(size, -1), sizes(size, 1) {
	for(int i = 0; i < size; i++) par[i] = i;
    }

    int root(int x)
    {
        return par[x] == x ? x : par[x] = root(par[x]);
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }

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

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);

        if(x == y) return ;

        if(sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
        sizes[y] = 0;
    }
};

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

int n;
vi uu;
vi vv;
vi ww;
vi edge[100001];

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

    UF uf(n + 1);
    
    int u, v, w;
    rep(i, 0, n - 1) {
	ci >> u >> v >> w;
	w = w % 2;
	uu.pb(u);
	vv.pb(v);
	ww.pb(w);
	
	if(w == 0) uf.unite(u, v);
    }

    rep(i, 0, n - 1) {
	if(ww[i] == 1) {
	    int a = uf.root(uu[i]);
	    int b = uf.root(vv[i]);
	    edge[a].pb(b);
	    edge[b].pb(a);
	}
    }
    
    rep(i, 1, n + 1) {
	rep(j, 0, edge[i].size()) {
	    uf.unite(edge[i][0], edge[i][j]);
	}
    }
    
    rep(i, 1, n + 1) {
	if(uf.same(1, i)) co << 0 << en;
	else co << 1 << en;
    }
    
    return 0;
}


Measured memory_bytes: 7660
//Joy Shree Kriskna
    #include<bits/stdc++.h>
    #define fast  ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define rep(i,n) for(i=0;i<n;i++)
    #define rep1(i,n) for(i=n-1;i>=0;i--)
    #define rep2(j,t) for(j=1;j<=t;j++)
    #define rep3(i,a,b) for(i=a;i<=b;i++)
    #define PI acos(-1)
    #define remove(s) s.erase(unique(s.begin(),s.end()),s.end());
    #define e return 0
    //#define lcm(a,b) ((a*b)/__gcd(a,b))
    #define endl "\n"
    #define al(v) v.begin(),v.end()
    #define ll long long
    using namespace std;
    void solve()
    {
       ll i,n,j,k=0,c;
       cin>>n;
      vector<ll>a(n-1);
      ll b[n+1];
      memset(b,0,sizeof b);
       rep(i,n-1)cin>>a[i];
       sort(al(a));
       for(i=1;i<=n;i++)
       {
           c=0;
           for(j=i-1+k;j<n-1;j++)
           {
               if(a[j]==i)c++;
               else if(a[j]>i)break;
           }
           k+=c-1;
           cout<<c<<endl;
       }
       //rep(i,n)cout<<b[i]<<endl;
     }

    int main()
      {
           fast;
           int i,n,t;
           solve();
      }
//arupsaha52
//1704052_Arup



Measured memory_bytes: 6364