akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define INF   (1e9+7)
#define MAX_N (200000)
#define MAX_K (100000)
#define MAX_L (100000)

class UnionFind {
private:
  int par[MAX_N];
public:
  void init(int n) {
    for (int x = 0; x < n; x++) par[x] = x;
  }
  int find(int x) {
    return (par[x] == x)? x: par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x != y) par[y] = x;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

int N, K, L;
std::vector<int> GR[MAX_N], GT[MAX_N];
UnionFind UFR, UFT;
map<Pi, int> COUNTS;

void mapping(vector<int> *g, UnionFind &uf) {
  uf.init(N);
  for (int v = 0; v < N; v++) {
    if (uf.find(v) != v) continue;
    queue<int> q;
    q.push(v);
    while (!q.empty()) {
      int u = q.front(); q.pop();
      for (int i = 0; i < g[u].size(); i++) {
        int w = g[u][i];
        if (!uf.same(v, w)) {
          uf.unite(v, w);
          q.push(w);
        }
      }
    }
  }
}

void solve() {
  mapping(GR, UFR);
  mapping(GT, UFT);
  for (int v = 0; v < N; v++){
    Pi p = Pi(UFR.find(v), UFT.find(v));
    COUNTS[p] = COUNTS[p] + 1;
  }
  for (int v = 0; v < N; v++) {
    printf("%d ", COUNTS[Pi(UFR.find(v), UFT.find(v))]);
  }
  printf("\n");
}

int main() {
  scanf("%d %d %d", &N, &K, &L);
  for (int i = 0; i < K; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--; v--;
    GR[u].push_back(v);
    GR[v].push_back(u);
  }
  for (int i = 0; i < L; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--; v--;
    GT[u].push_back(v);
    GT[v].push_back(u);
  }


  solve();

  return 0;
}


Measured memory_bytes: 27940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N, M;
int a[55], b[55], c[55], d[55];
int main(void){
	cin >> N >> M;
	rep(i, N) cin >> a[i] >> b[i];
	rep(i, M) cin >> c[i] >> d[i];

	rep(i, N){
		int x, y;
		x = a[i], y = b[i];
		int ans = INF, idx;
		rep(i, M){
			int di = abs(x - c[i]) + abs(y - d[i]);
			if(ans > di){
				idx = i + 1;
				ans = di;
			}
		}
		printf("%d\n", idx);
	}
	return 0;
}

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

using namespace std;
using ll=long long;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)

template<typename T,typename U> void Inparray(T &f,U n){for(int i=0;i<n;i++) cin>>f[i];}
template<typename T,typename U> void Printarray(T f,U n){for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int k,n;cin>>k>>n;
  vector<int> a(n);
  Inparray(a,n);
  int res=a[0]-a[n-1]+k;
  rep(i,n-1){
    res=max(res,a[i+1]-a[i]);
  }
  cout<<k-res<<endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    vector<ll> A(N);
    rep(i, N){cin >> A.at(i);}
    vector<int> indices(N);
    iota(indices.begin(), indices.end(), 0);
    sort(indices.begin(), indices.end(), [&A](ll i1, ll i2) {
        return A[i1] < A[i2];
    });
    ll best = indices.at(N-1);
    ll second_best = indices.at(N-2);
    rep(i, N){
        if (i == best) {
            cout << A.at(second_best) << endl;
        } else {
            cout << A.at(best) << endl;
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    ll ans = 1;
    map<int,int> mii;
    rep(i,n){
        int x;
        cin >> x;
        mii[x] ++;
    }
    if( n%2 == 0){
        if(mii.size() != n/2){
            cout << 0 << endl;
            return 0;
        }
        for(auto u : mii){
            if(u.first%2 == 0){
                cout << 0 << endl;
                return 0;
            }
            if(u.second != 2){
                cout << 0 << endl;
                return 0;
            }
        }
        rep(i,n/2){
            ans *= 2;
            ans %= MOD;
        }
        cout << ans << endl;
    }
    else{
        if(mii.size() != (n+1)/2){
            cout << 0 << endl;
            return 0;
        }
        if(mii[0] != 1){
            cout << 0 << endl;
            return 0;
        }
        for(auto u : mii){
            if(u.first%2 != 0){
                cout << 0 << endl;
                return 0;
            }
            if(u.second != 2 && u.first != 0){
                cout << 0 << endl;
                return 0;
            }
        }
        rep(i,n/2){
            ans *= 2;
            ans %= MOD;
        }
        cout << ans << endl;        
    }
    return 0;
}

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

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

int main() {
  int n;
  cin >> n;
  int c;
  cin >> c;
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    c = gcd(c, a);
  }
  int t = 0;
  while (c%2 == 0) {
    t += 1;
    c /= 2;
  }
  cout << t << endl;
  return 0;
}


Measured memory_bytes: 384
n = int(input())
A = list(map(int, input().split()))

x = 0; y = 0
for a in A:
    if a % 2 == 1:
        x += 1
    elif a % 4 == 0:
        y += 1

if x <= y:
    print("Yes")
elif x == y + 1 and x + y == n:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 15020
s = str(input())
a_index = 0
z_index = 0
for i in range(len(s)):
    if s[i] == 'A':
        a_index = i
        break
for i in range(len(s)):
    if s[i] == 'Z':
        z_index = i

print(z_index - a_index + 1)

Measured memory_bytes: 9156
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long i64;

i64 A, B;
int T = -1;

int main() {
  scanf("%lld%lld", &A, &B);
  
  for (int i = 60; i >= 0; --i) 
    if (((A >> i) & 1) != ((B >> i) & 1)) {
      T = i;
      break;
    }

  if (T == -1) {
    puts("1");
    return 0;
  }
  
  A &= (1LL << T + 1) - 1, B &= (1LL << T + 1) - 1;

  i64 L = A, R = 1LL << T;
  
  for (int i = T - 1; i >= 0; --i)
    if ((B >> i) & 1) {
      R |= (1LL << i + 1) - 1;
      break;
    }
  
  i64 nL = (1LL << T) + A, nR = (1LL << T + 1) - 1;

  if (nL <= R) R = nR, nR = nL - 1;

  printf("%lld\n", R - L + 1 + nR - nL + 1);
  
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		
		double ab = a+b;
		int ans = (int)Math.ceil(ab/2);
		
		System.out.println(ans);
		
		scanner.close();
	}

}


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

using namespace std;

int main(){
        string a[100];
        string b[100];
        int N, M;
        cin>>N>>M;
        for(int i=0;i<N;i++){
                cin>>a[i];
        }
        for(int i=0;i<M;i++){
                cin>>b[i];
        }
        bool flag=false;
        for(int i=0;i<=N-M;i++){
                for(int j=0;j<=N-M;j++){
                        int cnt=0;
                        for(int k=0;k<M;k++){
                                for(int h=0;h<M;h++){
                                        if(a[i+k][j+h]==b[k][h]){
                                                cnt++;
                                        }
                                }
                        }
                        if(cnt==M*M){
                                flag=true;
                        }
                }
        }
        if(flag){
                cout<<"Yes"<<endl;
        }
        else{
                cout<<"No"<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
#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(){
  int x;
  cin >> x;
  if(x==0){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;
bool flag = false;
char m[110][20];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%s", m[i] + 1);
        int len = strlen(m[i - 1] + 1);
        if (i != 1 && m[i][1] != m[i - 1][len])
            flag = true;
    }
    if (flag == true)
    {
        printf("No");
        return 0;
    }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
        {
            if (flag == true)
            {
                printf("No");
                return 0;
            }
            if (i == j)
                continue;
            else if (strlen(m[i] + 1) != strlen(m[j] + 1))
                continue;
            else
            {
                for (int k = 1; k <= strlen(m[i] + 1); k++)
                {
                    if (m[i][k] == m[j][k])
                    {
                        if (k == strlen(m[i] + 1))
                            flag = true;
                        else
                            continue;
                    }
                    else
                        break;
                }
            }
        }
    if (flag == true)
    {
        printf("No");
        return 0;
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int H, W, j, k;
   
    while(1){
        scanf("%d %d\n", &H, &W);
    
        if(H==0 && W==0){
            break;
        }
        
        
           //一番上の行
            for(k=0; k<W; k++){
                putchar('#');
            }
            
            putchar('\n');
            
            
            //真ん中の行
            for(k=0; k<(H-2); k++){
                putchar('#');
                       
                for(j=0; j<(W-2); j++){
                    putchar('.');
                }
                
                putchar('#');
                
                putchar('\n');
            }
            
            
            //一番下の行
            for(k=0; k<W; k++){
                putchar('#');
            }
            
            putchar('\n');
            
        putchar('\n');
    }
    
    return 0;    
}





Measured memory_bytes: 2032
n = int(input())
x = list(map(int, input().split()))
x_sort = sorted(x)
def median(L):
    #L = sorted(L)
    n = len(L)
    m = int(n/2)
    if n % 2 == 0:
        return (L[m - 1] + L[m]) / 2
    else:
        return L[(n - 1) // 2]
x_median = median(x_sort)
l = median(x_sort[:-1])
r = median(x_sort[1:])
for i in range(n):
    if x[i] > x_median:
        print(l)
    else:
        print(r)

Measured memory_bytes: 25556
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)

int main(void){
  int n;
  cin>>n;
  vector<int> a(n+1),b(n);

  r(i,n+1)cin>>a.at(i);
  r(i,n)cin>>b.at(i);

  long long sum=0;
  r(i,n){
    if(a.at(i)<b.at(i)){
      sum+=a.at(i);

      if(a.at(i+1)-b.at(i)+a.at(i)<0){
        sum+=a.at(i+1);
        a.at(i+1)=0;

      }else{
        a.at(i+1)=a.at(i+1)-b.at(i)+a.at(i);
        sum+=b.at(i)-a.at(i);
      }
    
    }
    else{
      sum+=b.at(i);
      b.at(i)=0;
    }
  }



  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
using namespace std;
void swap(int *x, int *y)
{
    int temp = *x;
    *x = *y;
    *y = temp;
}
int main() {
	int x, y,z;
    cin>>x>>y>>z;
	swap(&x, &y);
	swap(&x, &z);
	cout<<x<<" "<<y<<" "<<z;
	
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
    lines = input.split('\n')
    N = lines[0].split(' ')[0] * 1
    D = lines[0].split(' ')[1] * 1
    lines.shift()
    ans = 0
    lines = lines.map((l) => {
        return l.split(' ')
    })
    for (i = 0; i<N - 1; i++) {
        for (j = i+1; j<N; j++) {
            t = 0
            for (k =0; k < D; k++) {
                t += (lines[i][k] - lines[j][k]) * (lines[i][k] - lines[j][k])
            }
            r = Math.sqrt(t)
            if (r == parseInt(r)) {
                ans++
            }
        }           
    }
    console.log(ans)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int b_count = 0;
    int join = 0;
    rep(i, s.size()) {
        if(s[i] == 'c') {
            cout << "No" << "\n";
        }
        else if(s[i] == 'a' && join < a + b) {
            cout << "Yes" << "\n";
            join++;
        }
        else if(s[i] == 'b' && join < a + b && b_count < b) {
            cout << "Yes" << "\n";
            b_count++;
            join++;
        }
        else cout << "No" << "\n";
    }
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
    cout << "Bad" << endl;
  }
  else {
    cout << "Good" << endl;
  }
  return 0;
}


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

#define     fRead           freopen("INPUT.txt","r",stdin)
#define     fWrite          freopen("OUTPUT.txt","w",stdout)
#define     ss(a)           scanf("%s",a)
#define     gs(s)           getline(cin,s)
#define     gc              getchar()
#define     si(a)           scanf("%d",&a)
#define     sii(a,b)        scanf("%d%d",&a,&b)
#define     siii(a,b,c)     scanf("%d%d%d",&a,&b,&c)
#define     sl(a)           scanf("%lld",&a)
#define     sll(a,b)        scanf("%lld%lld",&a,&b)
#define     slll(a,b,c)     scanf("%lld%lld%lld",&a,&b,&c)
#define     sd(a)           scanf("%lf",&a)
#define     sdd(a,b)        scanf("%lf%lf",&a,&b)
#define     sddd(a,b,c)     scanf("%lf%lf%lf",&a,&b,&c)
#define     deb(x)          cout << #x " = " <<(x) << endl
#define     debb            printf("####\n")
#define     pi(a)           printf("%d",a)
#define     ps(a)           cout<<a
#define     pl(a)           printf("%lld",a)
#define     pd(a)           printf("%f",a)
#define     pc(a)           printf("%c",a)
#define     bl              printf("\n")
#define     spc             printf(" ")
#define     ll              long long
#define     llu             unsigned long long
#define     pie             2*acos(0.0)
#define     eps             1e-9
#define     qi              queue<int>
#define     vi              vector<int>
#define     vs              vector<string>
#define     vd              vector<double>
#define     vl              vector<long long>
#define     pb(a)           push_back(a)
#define     pii             pair <int,int>
#define     CLR(a)          memset(a,0,sizeof(a))
#define     fl(i,a,n)       for(int i=a; i<n; i++)
#define     rfl(i,n,a)      for(int i=n-1; i>=a; i--)
#define     fit(x,mp)       for(auto x = mp.begin(); x!=mp.end(); x++)
#define     MAX             1000000 //10^6
int a,b,n,tmp,flag;
char s[MAX+5];
int main()
{
    ss(s);
    si(n);

    fl(i,0,strlen(s))
    {
        if(i%n==0) pc(s[i]);
    }

    return 0;
}







Measured memory_bytes: 256
import numpy as np

N = int(input())
A = np.array([int(input()) for _ in range(N)] + [0], dtype='int64')

x = (A[:-1][A[:-1] >= A[1:]]).sum()

if A[0] != 0:
    x = -1
if (A[1:] >= A[:-1] + 2).any():
    x = -1

print(x)


Measured memory_bytes: 21860
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int a, b, ans, i;
	
	scanf("%d %d", &a, &b);

	ans = a - 1;
	if (b >= a) {
		ans++;
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
N = input()

maxDup, Dup = 0, 0

bc = N[0]
for c in N[1:]:
    if bc == c:
        Dup += 1
        if maxDup < Dup:
            maxDup = Dup
    else:
        Dup = 0
    bc = c
    #print(Dup, maxDup, bc)
if maxDup >= 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

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

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int a, b;
    cin >> a >> b;
    int ret = a + b;
    if (ret >= 10)
        cout << "error";
    else
        cout << ret;
    cout << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


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

using namespace std;

// input
int n;
vector<int> vec;

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

    int a;

    while(cin >> a){
        if(a % 4 == 0){
            vec.push_back(2);
        }
        else if(a % 2 == 0){
            vec.push_back(1);
        }
        else{
            vec.push_back(0);
        }
    }

    sort(vec.begin(),vec.end());

    int zero = count(vec.begin(),vec.end(),0);
    int one = count(vec.begin(),vec.end(),1);
    int four = count(vec.begin(),vec.end(),2);

    if ( one == 0 ){
        if(zero <= four +1 ){
            cout << "Yes" << "\n";
        }
        else{
            cout << "No" << "\n";
        }
    }
    else{
        if(zero <= four){
            cout << "Yes" << "\n";
        }
        else{
            cout << "No" << "\n";
        }
    }
    
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
    string s;
    cin >> s;
    int ans = 999;
    for(int i=0; i<s.length()-2; i++) {
        int a = stoi(s.substr(i, 3));
        ans = min(ans, abs(a-753));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

d = UnionFind(N)
num_fri = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    d.union(a - 1, b - 1)
    num_fri[a - 1] += 1
    num_fri[b - 1] += 1
#num = [d.size(i) for i in range(N)]
for i in range(K):
    a, b = map(int, input().split())
    if d.same(a - 1, b - 1):
        num_fri[a - 1] += 1
        num_fri[b - 1] += 1
for i in range(N):
    print((d.size(i) - 1) - num_fri[i], end=' ')

Measured memory_bytes: 8604
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        a:u64,
        b:u64,
        h:f64,
        m:f64,
    }
    let m_s = m / 60.0;
    let h_s = h / 12.0 + (m_s / 12.0);
    let angle = (h_s - m_s).abs();
    let rad = std::f64::consts::PI * 2.0 * angle;
    let r = (a.pow(2) as f64 + b.pow(2) as f64 - ((2 * a * b) as f64 * rad.cos())).sqrt();
    r.to_string()
}
test! {
    "3 4 9 0" => "5.00000000000000000000",
    "3 4 10 40" => "4.56425719433005567605",
}


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

int main()
{
	int N, A, B;
	string S;
	cin >> N >> A >> B >> S;

	int a = 0;
	int b = 0;
	for( int i = 0; i < N; i++ ) {
		if( S[i] == 'a' ) {
			string ans = "No";
			if( a + b < A + B ) {
				a++;
				ans = "Yes";
			}
			cout << ans << endl;
		}
		else if( S[i] == 'b' ) {
			string ans = "No";
			if( a + b < A + B && b + 1 <= B ) {
				b++;
				ans = "Yes";
			}
			cout << ans << endl;
		}
		else cout << "No" << endl;
	}
}


Measured memory_bytes: 3624
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int a = Char.Parse(input[0]) - '0';
		int b = Char.Parse(input[1]) - '0';
		if (a > b) {
			Console.WriteLine(">");
        } else if (a < b) {
			Console.WriteLine("<");
        } else {
			Console.WriteLine("=");
        }
	}
}

Measured memory_bytes: 11092
N=gets.to_i
X=gets.split.map &:to_i
min_location=Float::INFINITY

100.times do |i|
  location = X.map{|e| (e-i)**2}.reduce{|a,b| a+b}
  if min_location > location
    min_location = location
  end
end

puts min_location

Measured memory_bytes: 1916
from math import factorial
n, a, b = map(int, input().split())

mod = 10**9+7


def inv(a, mod):
    r = [1, 0, a]
    w = [0, 1, mod]
    while w[2] != 1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = w
        w = r_new
    x, y = w[0], w[1]    # a*x+y*mod = 1
    return (mod+x % mod) % mod


max_num = 2*10**5+1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]

fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1

for i in range(2, max_num):
    fact[i] = fact[i-1] * i % mod
    ifact[i] = ifact[i-1] * inv(i, mod) % mod


def comb(x, y):
    tmp = 1
    for i in range(1, y+1):
        tmp *= (n+1-i)
        tmp %= mod
    tmp *= ifact[y]
    tmp %= mod
    return tmp

po = [2]
for i in range(1, 100):
    po.append((po[-1]**2) % mod)

nb = list(bin(n)[2:])[::-1]
n2 = 1

for i in range(len(nb)):
    if nb[i] == '1':
        n2 *= po[i]

n2 %= mod

print((n2-1-comb(n, a)-comb(n, b))%mod)


Measured memory_bytes: 55372
#include<stdio.h>
#include<math.h>

int main(void)
{
	int box[7] = {100,900,10,90,1,9};
	int n,temp=0;

	scanf("%d",&n);

	if (n / box[0] == 1)
	{
		temp += box[1];
		n -= box[0];
	}
	else
	{
		temp += box[0];
		n -= box[1];
	}
	if (n / box[2] == 1)
	{
		temp += box[3];
		n -= box[2];
	}
	else
	{
		temp += box[2];
		n -= box[3];
	}
	if (n / box[4] == 1)
	{
		temp += box[5];
		n -= box[4];
	}
	else
	{
		temp += box[4];
		n -= box[5];
	}

	printf("%d\n",temp);

	return 0;
}

Measured memory_bytes: 128
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
    int N;
  	cin >> N;
    vector<double>v(N);
    rep(i,N)cin >> v[i];
    
    rep(i,N-1){
        sort(v.begin(),v.end());
        v[i+1]=(v[i]+v[i+1])/2;
        v[i]=0;
    }
    cout<<v[N-1]<<endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	string s;
	int k;
	cin >> s >> k;
	set<string> st;
	for (int i = 1; i <= min(k, (int)s.size()); i++) {
		for (int j = 0; j <= s.size() - i; j++) {
			st.insert(s.substr(j,i));
		}
	}
	auto itr = st.begin();
	for (int i = 0; i < k-1; i++) {
		itr++;
	}
	cout << *itr << endl;
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using _TYPE = int;
typedef tree< _TYPE, null_type, less< _TYPE >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

string s, t;
int dp[3003][3003];

int solve(int i, int j) {
    if(i == (int) s.size() || j == (int) t.size())
        return 0;
    int &rt = dp[i][j];
    if(rt != -1)
        return rt;
    rt = 0;
    if(s[i] == t[j])
        rt = solve(i + 1, j + 1) + 1;
    rt = max(rt, solve(i + 1, j));
    rt = max(rt, solve(i, j + 1));
    return rt;
}

void build(int i, int j) {
    if(i == (int) s.size() || j == (int) t.size())
        return;
    int &rt = dp[i][j];
    if(s[i] == t[j] && (1 + solve(i + 1, j + 1)) == rt) {
        cout << s[i];
        build(i + 1, j + 1);
        return;
    }
    int a = solve(i + 1, j);
    int b = solve(i, j + 1);
    if(rt == a)
        build(i + 1, j);
    else
        build(i, j + 1);
}

int main() {
    IO;
    cin >> s >> t;
    memset(dp, -1, sizeof dp);
    solve(0, 0);
    build(0, 0);
    return 0;
}


Measured memory_bytes: 35968
package main

import (
	"fmt"
	"sort"
)

func main() {
	var (
		n int
	)
	fmt.Scan(&n)
	moti := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&moti[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(moti)))
	count := 1
	for i := 1; i < n; i++ {
		if moti[i] == moti[i-1] {
			continue
		}
		count++
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>

const int MAX_N = 100100;

typedef struct pp {
	char name[100];
	int t;
} P;
P S[MAX_N];
int n, q, w, head, tail;

void enq(P x) {
	S[tail] = x;
	tail = (tail + 1) % MAX_N;
}
P deq() {
	P w = S[head];
	head = (head + 1) % MAX_N;
	return w;
}
int min(int a, int b) {
	return (a < b) ? a : b;
}
int main() {
	int elaps = 0;
	int c, i;
	P u;
	scanf("%d %d", &n, &q);
	for (i = 1; i <= n; i++) {
		scanf("%s", S[i].name);
		scanf("%d", &S[i].t);
	}
	head = 1;
	tail = n + 1;
	while (head != tail) {
		u = deq();
		c = min(q, u.t);
		u.t -= c;
		elaps += c;
		if (u.t > 0) {
			enq(u);
		} else {
			printf("%s %d\n", u.name, elaps);
		}

	}
	return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
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;
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;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll 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(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

bool is_kaibun(string s) {
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != s[s.size() - i - 1]) return false;
    }
    return true;
}

int main() {
    double l;
    cin >> l;

    double a = l / 3;
    printf("%.20f\n", a * a * a );

}





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

public class Main{
    public static void main(String[] args)throws IOException{
        Scanner s = new Scanner(System.in);

        int[] tmp = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        String[] week_day = { "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday" };

        while(s.hasNext()){
            int in_month = s.nextInt();
            int in_day = s.nextInt();
            if(in_month == 0 && in_day == 0) break;

            int sum_day = 0;
            for (int i = 0; i < in_month - 1; i++) {
                sum_day += tmp[i];
            }
            sum_day += in_day;

            int week_num = sum_day % 7;
            System.out.println(week_day[week_num]);
        }
    }
}

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

using namespace std;

typedef long long int ll;

int n;
vector<map<int,int>> tree;

void add(int pos, int val){
	for(;pos < n ; pos = pos | (pos+1)){
		tree[pos][val]++;
	}
}

ll query(int pos,int val){
	ll res = 0;
	for(; pos >= 0; pos = (pos & (pos + 1)) - 1){
		res += (ll)tree[pos][val];
	}
	return res;
}


int main(){
	cin >> n;
	tree.resize(n);
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	ll sum = 0;
	for(int i = 0; i < n; i++){
		sum += query(i,i-a[i]);
		add(i,i+a[i]);
	}
	cout << sum << "\n";
	return 0;
}


Measured memory_bytes: 179976
class Main{public static void main(String[]_)throws Exception{double y=1e5;int n=0,i;for(;(i=System.in.read())>32;n=n*10+i-48);for(i=1000;n-->0;y+=y%i>0?i-y%i:0)y*=1.05;System.out.println((int)y);}}

Measured memory_bytes: 9416
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



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

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

#define REP(i, n) for(ll i = 0; i < n; i++)











int main(){
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> cnt(n);
    REP(i, q){
        ll a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    REP(i, n){
        if(k - (q - cnt[i]) <= 0){
            cout << "No" << endl;
        }
        else{
            cout << "Yes" << endl;
        }
    }
}


Measured memory_bytes: 1408
from sys import stdin, setrecursionlimit


def main():
    n, m = map(int, stdin.readline().split())
    ac = [0] * n
    wa = [0] * n
    for _ in range(m):
        p, s = map(str, stdin.readline().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            wa[p] += 1
        elif s == 'AC':
            ac[p] = 1
    n_ac = 0
    n_wa = 0
    for i in range(n):
        n_ac += ac[i]
        if ac[i] == 1:
            n_wa += wa[i]

    print(n_ac, n_wa)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Measured memory_bytes: 42348
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char s[24];
int main(){
    RS(s);
    REP(i,4)printf("%c",s[i]);
    putchar(' ');
    REPP(i,4,12)printf("%c",s[i]);
    puts("");
    return 0;
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl




signed main() {

	int N, K;
	cin >> N >> K;
	

	cout << N-K+1 << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
s=input()
k=int(input())
f=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        f=1
        break
if f==0:
    print(len(s)*k//2)
    sys.exit()
if k>=3:
    ss=s+s+s
else:
    ss=s*k
flag=[0]*len(ss)
for i in range(1,len(ss)):
    if ss[i-1]==ss[i] and flag[i-1]==0:
        flag[i]=1
        continue
if k>=3:
    count=sum(flag[0:len(s)])+sum(flag[len(s):2*len(s)])*(k-2)+sum(flag[2*len(s):3*len(s)])
else:
    count=sum(flag)
print(count)

Measured memory_bytes: 38256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    int N;
    cin>>N;
    int tot=0;
    for(int i=1;i<=N;i++){
      string a=to_string(i);
      if(a.size()%2==1)tot++;
    }
    cout<<tot;
    return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll MOD = 1e9+9;

mat mul(mat const&A, mat const& B) {
  mat C(A.size(), vec(B[0].size()));
  for(int i=0; i<A.size(); i++) {
    for(int k=0; k<B.size(); k++) {
      for(int j=0; j<B[0].size(); j++) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
      }
    }
  }
  return C;
}

mat pow(mat A, ll n) {
  mat B(A.size(), vec(A.size()));
  for(int i=0; i<A.size(); i++) {
    B[i][i] = 1;
  }
  while(n > 0) {
    if(n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

ll W, H; int N;
mat coef;
vector<pair<ll, vector<ll>>> vs;
mat xsmat;

void print_coef() {
  rep(i, W) {
    rep(j, W) {
      cout << coef[i][j] << " ";
    }
    cout << endl;
  }
}

void make_identity_coef() {
  coef.clear(); coef.resize(W); rep(i, W) coef[i].resize(W);
  rep(i, W) rep(j, 3)
    if(i+j-1 >= 0 && i+j-1<W)
      coef[i][i+j-1] = 1;
}

void init_xsmat() {
  xsmat.clear();
  xsmat.resize(W);
  rep(i, xsmat.size()) xsmat[i].resize(1);
  xsmat[0][0] = 1;
}

void input_blocks() {
  vs.clear();
  map<ll, vector<ll>> y2xs;
  rep(i, N) {
    ll x, y; scanf("%lld%lld", &x, &y); x--, y--;
    y2xs[y].push_back(x);
  }
  for(auto& e: y2xs) vs.emplace_back(e.first, e.second);
  vs.emplace_back(H - 1, vector<ll>());
}

void update_n_step(ll n) {
  xsmat = mul(pow(coef, n), xsmat);
}

void print_xsmat() {
  for(int i=0; i<xsmat.size(); i++){for(int j=0; j<xsmat[i].size(); j++){cout << xsmat[i][j] << " ";}cout << endl;}cout << endl;
}

int main() {

  for(int tc = 1; cin >> W >> H >> N && (W|H|N); tc++) {
    input_blocks();
    make_identity_coef();
    init_xsmat();
    ll curr = 0;
    rep(i, (int)vs.size()) {
      update_n_step(vs[i].first - curr);
      curr = vs[i].first;
      for(auto& x: vs[i].second) xsmat[x][0] = 0;
    }
    printf("Case %d: %lld\n", tc, xsmat[W-1][0]);
  }

  return 0;
}

Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    if(t.length()-s.length()!=1)
        cout<<"No";
    else
    {
        for(int i=0;i<s.length();i++)
        {
            if(s[i]!=t[i])
            {
                cout<<"No";
                return 0;
            }
        }
        cout<<"Yes";
    }

}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(11);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int a;
  string s;
  cin >> a >> s;
  cout << (a >= 3200 ? s : "red") << endl;
}


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

using namespace std;
typedef long long ll;
const int MAXN = 15;
const int MAXP = (1 << MAXN);

int N, M;
int edge[MAXN][MAXN];
int cscore[MAXP];
int dp[MAXN][MAXP]; // last, cset

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        edge[a][b] = edge[b][a] = c;
    }

    for (int i = 0; i < (1 << N); i++)
    {
        cscore[i] = 0;
        for (int j = 0; j < N; j++)
        {
            for (int k = j + 1; k < N; k++)
            {
                if (i & (1 << j) && i & (1 << k))
                    cscore[i] += edge[j][k];
            }
        }
    }

    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXP; j++)
            dp[i][j] = -1e9;
    for (int i = 1; i < (1 << N); i += 2)
        dp[0][i] = cscore[i];

    for (int i = 0; i < (1 << N); i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (dp[j][i] < 0) continue;
            int mask = (1 << N) - 1 - i;
            for (int sub = mask; sub > 0; sub = (sub - 1) & mask)
            {
                for (int k = 0; k < N; k++)
                {
                    if (edge[j][k] && (sub & (1 << k)))
                        dp[k][i+sub] = max (dp[k][i+sub], dp[j][i] + cscore[sub] + edge[j][k]);
                }
            }
        }
    }
    ll ctot = 0;
    for (int i = 0; i < N; i++)
        for (int j = i + 1; j < N; j++)
            ctot += edge[i][j];
    cout << ctot - dp[N-1][(1<<N)-1] << "\n";
}

Measured memory_bytes: 2304
#include <iostream>

int main(int argc, const char * argv[])
{
    int result;
    
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            result = i * j;
            std::cout << i << "x" << j << "=" << result << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 1112
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "-1\n"; return;}

const int N = 12, M = 1007, INF = 1e18;

int dp[1 << N];
int key[M], cost[M];

void solve() {
    int n, m;
    cin >> n >> m;
    loop(i, m) {
        int k;
        cin >> cost[i] >> k;
        loop(j, k) {
            int b; cin >> b;
            key[i] ^= 1 << (b - 1);
        }
    }
    loop1(mask, (1 << n) - 1) {
        dp[mask] = INF;
        loop(i, m) {
            if ((key[i] & mask) == 0)
                continue;
            dp[mask] = min(dp[mask], dp[(mask ^ key[i]) & mask] + cost[i]);
        }
    }
    cout << (dp[(1 << n) - 1] == INF ? -1 : dp[(1 << n) - 1]);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define td(x) x.begin(),x.end()
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
using namespace std;
 

int32_t main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	vector<int> a(n+1),b(n+1),c(n+1);
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	for(int i=1;i<=n-1;i++)cin>>c[i];
	int sum=0;
	int last = -1;
	for(int i=1;i<=n;i++){
		if(a[i]==last+1){
			sum+=c[a[i]-1];
		}
		sum+=b[a[i]];
		last = a[i];
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 256