akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

void Main()
{
  i64 n;
  cin >> n;

  vi x(n);
  rep(i,n) cin >> x[i];

  i64 ans = INF;
  i64 tmp;
  rep(i,1,101){
    tmp = 0;
    rep(j,n)
      tmp += pow(x[j]-i,2);
    chmin(ans,tmp);
  }
  cout << ans << endl;
}

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


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

int main() {
    string S; cin >> S;
    ll K; cin >> K;
    ll N = S.size();
    // printf("%s\n", S.c_str());
    if (N == 1) {
        cout << K / 2 << endl;
        return 0;
    }

    // If all of the characters of S are the same, speciall
    bool same = true;
    rep(i,N) if (S[0] != S[i]) {same = false; break;}
    if (same) {
        N = N * K;
        cout << N/2 << endl;
        return 0;
    }

    // separate top and tail same characters
    string S1, S2;
    int a = 0, b = 0;
    if (S.at(0) == S.at(N-1)) {
        for (ll i = 0; i < N; i++) {
            if (S.at(0) == S.at(i)) {S1.push_back(S.at(i));}
            else break;
        }
        for (ll i = N-1; i >= 0; i--) {
            if (S[N-1] == S[i]) {S2.push_back(S[i]);}
            else break;
        }
        a = S1.size();
        b = S2.size();
    }

    ll cnt = 0, cnt2 = 0;;
    rep(i,N-1) {
        if (S[i] == S[i+1]) {
            int j = i + 1;
            while (j < N && S[i] == S[j]) j++;
            int num = j - i;
            for (int k = i+1; k < j; k+=2) S[k]++, cnt++;
            if (j < N && num % 2 == 0 && S[j-1] == S[j]) S[j-1]++;
        }
    }
    cnt2 = a / 2 + b / 2 - (a + b) / 2;
    // printf("%s\n", S.c_str());
    // printf("cnt2 = %ld\n", cnt2);

    cout << cnt * K - cnt2 * (K-1) << endl;
}


Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>

using namespace std;
typedef long long int ll;

int main(){
  char b;
  cin >> b;
  if(b == 'A') cout << 'T' << endl;
  if(b == 'T') cout << 'A' << endl;
  if(b == 'G') cout << 'C' << endl;
  if(b == 'C') cout << 'G' << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>
#include<stack>
#include<cmath>
#define LL long long
using namespace std;
inline void read(LL &x){
	x=0;LL f=1;char c=getchar();
	while(c>'9'||c<'0'){if(c=='-') f=-1;c=getchar();	}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	x*=f;
}
LL s;
int main()
{
	read(s);
	LL b,a,x=sqrt(s);
	if(x*x!=s) x+=1;
    s = x * x - s;
    
    a=sqrt(s);
    for(;a>0;a--)
    {
    	if(s%a==0)
		{
			b=s/a;
			break;
		}
    }
    
	printf("0 0 %lld %lld %lld %lld",x,a,b,x); 
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 25

typedef struct node {
    int parent;
    int left;
    int right;
} Node;

Node nodes[MAX];
int depth[MAX];

int max(int a, int b) {
    if(a > b) return a;
    else return b;
}

int getHeight(int u){
    int v1=0, v2 = 0;
    if(nodes[u].left == -1 && nodes[u].right == -1) return 0;
    
    if(nodes[u].left != -1) {
        v1 = getHeight(nodes[u].left);
    }
    if(nodes[u].right != -1) {
        v2 = getHeight(nodes[u].right);
    }
    
    return 1 + max(v1, v2);
}

void setDepth(int u, int p) {
    depth[u] = p;
    if(nodes[u].left != -1) setDepth(nodes[u].left, p+1);
    if(nodes[u].right != -1) setDepth(nodes[u].right, p+1);
}

int getDegree(int u){
    if(nodes[u].left == -1 && nodes[u].right == -1) return 0;
    if(nodes[u].left != -1 && nodes[u].right != -1) return 2;
    
    return 1;
}

int getSibling(int u){
    if(nodes[u].parent == -1) return -1;
    
    if(nodes[nodes[u].parent].left == u) {
        return nodes[nodes[u].parent].right;
    } else{
        return nodes[nodes[u].parent].left;
    }
}

int main(void){
    // Your code here!
    int n;
    scanf("%d", &n);
    int u, l, r;
    
    for(int i = 0; i < n; i++) {
        nodes[i].parent = nodes[i].left = nodes[i].right = -1;
    }

    for(int i = 0; i < n; i++){
        scanf("%d %d %d", &u, &l, &r);
        nodes[u].left = l;
        nodes[u].right = r;
        nodes[l].parent = nodes[r].parent = u;
    }
    
    int root = -1;
    for(int i = 0; i < n; i++) {
        if(nodes[i].parent == -1) {
            root = i;
            break;
        }
    }
    
    setDepth(root, 0);
    for(int i = 0; i < n; i++) {
        int h = getHeight(i);
        int degree = getDegree(i);
        if(i == root) {
            printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", i, nodes[i].parent, getSibling(i), degree, depth[i], h, "root");
        } else if(degree != 0) {
            printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", i,  nodes[i].parent, getSibling(i), degree, depth[i], h, "internal node");
        } else {
            printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", i,  nodes[i].parent, getSibling(i), degree, depth[i], h, "leaf");
        }
    }
    
}



Measured memory_bytes: 2104
#include<stdio.h>
#include<math.h>
int main(){
double a,b,c,d;
scanf("%lf %lf %lf %lf",&a,&b,&c,&d);
printf("%lf\n",sqrt(pow(c-a,2.0)+pow(d-b,2.0)));
return 0; }






Measured memory_bytes: 2108
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/20.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;





int main(){
   
    int X,A;
    cin >> X >> A;
    if(X<A) cout << 0 << endl;
    else cout << 10 << endl;
    
    return 0;
}




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

/** defines and macros */
#define ll long long
#define ull unsigned long long
#define loop(n) for(int i = 0; i < n; i++)
#define loop1(n) for(int i = 1; i <= n; i++)
#define all(v) ((v).begin()), ((v).end())
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vvi vector<vi>
#define vvpii vector<vii>
#define PB push_back

#define fw(fileName) freopen(fileName, "w", stdout)
#define fr(fileName) freopen(fileName, "r", stdin)
#define fc(stream) fclose(stream);

#define faster_IO_stream ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define endl "\n"

/*To compile and run

	g++ -o main main.cpp && ./main

*/

/*
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣀⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣀⡀⠄⠄⠄⠄⠄⣰⣷⡀⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⣀⣀⣀⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⢠⣿⣿⣷⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠤⠒⠛⠛⠛⠛⠻⠷⣦⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢀⣤⣤⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣡⡤⠐⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⢀⣶⣿⣿⠿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⢠⣿⠟⠉⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠘⠁⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⣾⣿⡿⣽⡿⢹⣿⣿⣟⣿⢻⠇⢀⢹⣿⢿⣿⣿⣿⣿⣿⣦⣙⢿⣿⢷⣈⠻⢿⣟⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢿⡿⠁⡿⠁⢸⣿⣿⢹⡇⢸⠄⠈⠄⠻⣏⠻⣿⡿⣿⣿⣿⣌⠛⢿⡌⠙⢧⣀⠙⢳⡹⢻⣿⣿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠘⡇⠄⡇⢠⣼⣿⣿⠈⡇⠘⠤⠤⠤⠤⢜⣢⣘⡻⢮⡛⢿⣿⣷⣬⡤⠤⠤⠤⠥⠤⠥⢬⣿⣧⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠘⢿⡏⠛⠄⠄⠄⠄⠄⠄⠄⠄⠄⠙⣿⣿⣿⡿⠋⠉⠛⠉⠄⠄⠄⠄⠄⠄⠄⢹⡿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡟⠁⠈⢳⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠱⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⡜⠁⠄⠄⠈⢇⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠑⠦⢄⣀⣀⣀⣀⣀⠴⠊⠄⠄⠄⠄⠄⠄⠑⠤⢀⣀⣀⣀⡀⠠⠔⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣶⣦⣄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣤⣶⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣶⣄⣀⣀⣀⣀⣤⣾⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠙⢿⣿⣿⣿⡟⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⠟⠋⠁⠄⠄⠄⠄⠄⠄⠄⠄⠉⠛⠿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
*/

const double pi = 3.14159265358979323846;

int main() {
	faster_IO_stream

	int x;
	cin >> x;
	cout << !x << endl;

	return 0;
}


Measured memory_bytes: 3640
a,b,c,x,y = map(int,input().split())

if x > y:
    tmp1 = a
    tmp2 = x
    a = b
    b = tmp1
    x = y
    y = tmp2
    
arr = []

arr.append(a*x+b*y)
arr.append(b*y+(2*c-b)*x)
arr.append(2*c*y)

print(min(arr))

Measured memory_bytes: 3064
BLACK = '0'
WHITE = '1'

original_tile = input()
tile_length = len(original_tile)

bwbw_tile = (BLACK+WHITE) * (tile_length//2)
if tile_length % 2 == 1:
    bwbw_tile += BLACK

repaint_times = 0
for i in range(tile_length):
    if original_tile[i] != bwbw_tile[i]:
        repaint_times += 1

if repaint_times < tile_length - repaint_times:
    print(repaint_times)
else:
    print(tile_length - repaint_times)

Measured memory_bytes: 3188
#include <cstdio>
#include <cmath>
int n;
double x[1005], y[1005], X, Y, d, e;
double dist(double a, double b) {
  return a*a + b*b;
}
int main() {

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf%lf", &x[i], &y[i]);
    X += x[i]; Y += y[i];
  }
  X /= n; Y /= n;
  double P = 0.1;
  for (int i = 0; i < 30000; i++) {
    int f = 0;
    d = dist(X - x[0], Y - y[0]);
    for (int j = 1; j < n; j++) {
      e = dist(X - x[j], Y - y[j]);
      if (d < e) { d = e; f = j; }
    }
    X += (x[f] - X)*P;
    Y += (y[f] - Y)*P;
    P *= 0.999;
  }
  printf("%.10lf",sqrt(d));
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int c[10][10];
	int h,w;
	cin>>h>>w;
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			cin>>c[i][j];
		}

	}
	int a[h][w];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
			cin>>a[i][j];
	}
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			for(int k=0;k<10;k++)
			{
				c[j][k]=min(c[j][k],c[j][i]+c[i][k]);
			}
		}
	}
	int cost=0;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(a[i][j]!=-1)
			{
				cost += c[a[i][j]][1];
			}
		}
	}
	cout<<cost<<"\n";
}

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

using namespace std;

const int N = 100;

int a[N][N];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  // for (int i = 0; i < n; ++i) {
  //   for (int j = 0; j < m; ++j) {
  //     for (int k = -1; k <= 1; ++k)
  //       for (int l = -1; l <= 1; ++l) {
  //         int x = i+k, y = j+l;
  //         if (min(x, y) < 0 || x >= n || y >= m) continue;
  //         a[x][y] ^= 1;
  //       }
  //   }
  // }
  // for (int i = 0; i < n; ++i) {
  //   for (int j = 0; j < m; ++j)
  //     cerr << a[i][j];
  //   cerr << endl;
  // }
  if (n > m) swap(n, m);
  if (n == 1 && m == 1) {
    puts("1");
    return 0;
  }
  if (n == 1)
    printf("%d\n", max(m-2, 0));
  else {
    long long ans = 1LL * n * m - n * 2 - m * 2 + 4;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int TC;
int N,Q,ans;
map<string,int>mp;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>N;
    for(int i=0;i<N;i++){
        string s;
        cin>>s;
        mp[s]++;
    }
    cin>>Q;
    while(Q--){
        string s;
        cin>>s;
        mp[s]--;
    }
    for(auto &p:mp)ans=max(ans,p.second);
    cout<<ans<<'\n';
    return 0;
}



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

using namespace std;

int main(void)
{
  int D;
  cin >> D;
  string str;
  if(D <= 25){
    cout << "Christmas";
  }
  if(D <= 24){
    cout << " Eve";
  }
  if(D <= 23){
    cout << " Eve";
  }
  if(D <= 22){
    cout << " Eve";
  }
  cout << endl;
  return 0;
}


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

point = []
parity = {}
for _ in range(N) :
    x, y = map(int, input().split())
    point.append((x, y))
    parity[(x + y) % 2] = 1

if len(set(parity)) == 2 :
    print('-1')
else :
    m = 38
    parity = 1 if (1 in parity) else 0
    print(m + 1 - parity)
    if parity == 1 :  # 距離が奇数
        print(*[1 << i for i in range(m)])
    else :
        print(1, *[1 << i for i in range(m)])

    def arm(x, y, m) :
        if abs(x) >= abs(y) :
            if x >= 0 :
                return ('R', x - (1<<m), y)
            else :
                return ('L', x + (1<<m), y)
        else :
            if y >= 0 :
                return ('U', x, y - (1<<m))
            else :
                return ('D', x, y + (1<<m))

    for x, y in point :
        ans = []
        for i in range(m-1, -1, -1) :
            mode, x, y = arm(x, y, i)
            ans.append(mode)
        if parity == 0 :  # 偶数の場合一つ足す
            if x == 1 :
                ans.append('R')
            elif x == -1 :
                ans.append('L')
            elif y == 1 :
                ans.append('U')
            elif y == -1 :
                ans.append('D')
        print(''.join(ans[::-1]))



Measured memory_bytes: 3188
N=int(input())
x=[]
y=[]
if N==1:
    print(1)
    quit()
xy=[]
for i in range(N):
    X,Y=map(int,input().split())
    x.append(X)
    y.append(Y)
    xy.append((X,Y))
c=[]
for i in range(N):
    for j in range(i+1,N):
        c.append((x[i]-x[j],y[i]-y[j]))
        c.append((x[j]-x[i],y[j]-y[i]))
ans=100
for p,q in c:
    s=0
    for i in range(N):
        if (x[i]-p,y[i]-q) in xy:
            pass
        else:
            s+=1
    ans=min(ans,s)
print(ans)


Measured memory_bytes: 41580
s=input()
a=int(s[:2])
b=int(s[2:])
if a==0:
  if 1<=b<=12:
    print("YYMM")
  else:
    print("NA")
elif 1<=a<=12:
  if 1<=b<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
    if 1<=b<=12:
      print("YYMM")
    else:
      print("NA")
  

Measured memory_bytes: 38384
def main
  a,b,c,x,y = gets.chomp.split(" ").map(&:to_i)
  if 2*c > (a+b)
    puts a*x+b*y
  elsif x > y && 2*c < a
    puts 2*c*x
  elsif x < y && 2*c < b
    puts 2*c*y
  elsif x > y
    puts y * 2 * c + (x-y)*a
  else
    puts x * 2 * c + (y-x)*b
  end
end

main



Measured memory_bytes: 14200
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  if(N % 2 == 1){
    cout << "No" << endl;
  }
  else{
    int SIZE = N / 2;
    bool a = true;
    for(int i = 0; i < SIZE; i++){
      int j = i + SIZE;
        if(S.at(i) != S.at(j)){
          a = false;
        }
    }
    if(a){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int a,b;
  cin >> a >> b;

  if(b % a == 0)
    cout << a + b;
  else
  {
    cout << b - a;
  }
  


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<llong, llong> ipair;

int N;
multiset<llong> st;

llong spop_back(multiset<llong> *s) {
    multiset<llong>::iterator it = s->end();
    --it;
    llong res = *it;
    s->erase(it);
    return res;
}

llong spop_front(multiset<llong> *s) {
    multiset<llong>::iterator it = s->begin();
    llong res = *it;
    s->erase(it);
    return res;
}

llong sget_end(multiset<llong> *s) {
    multiset<llong>::iterator it = s->end();
    --it;
    return *it;
}

llong sget_second(multiset<llong> *s) {
    multiset<llong>::iterator it = s->begin();
    ++it;
    return *it;
}

llong sget_second_end(multiset<llong> *s) {
    multiset<llong>::iterator it = s->end();
    --it;
    --it;
    return *it;
}


vector<ipair> pairs;
llong res;

bool judge() {
    llong big = sget_end(&st);
    llong next_big = sget_second_end(&st);
    llong next_small = sget_second(&st);
    llong small = *st.begin();

    llong dif = big - small;

    llong w1 = max(next_big, max(next_small, dif)) - min(next_big, min(next_small, dif));
    llong w2 = max(next_big, max(next_small, -dif)) - min(next_big, min(next_small, -dif));

    return w1 > w2;
}

void solve() {
    while(true) {
        if(st.size() >= 3) {
            ipair next;
            if(judge()) {
                next = make_pair(spop_back(&st), spop_front(&st));
            } else {
                next = make_pair(spop_front(&st), spop_back(&st));
            }
            pairs.push_back(next);
            st.insert(next.first - next.second);

        } else {
            ipair next = make_pair(spop_back(&st), spop_front(&st));
            res = next.first - next.second;
            pairs.push_back(next);
            return;
        }
    }
}

int main(int argc, char **argv) {
    cin >> N;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        st.insert(a);
    }

    solve();
    cout << res << endl;
    for(int i = 0; i < pairs.size(); ++i)
        cout << pairs[i].first << " " << pairs[i].second << endl;

}

Measured memory_bytes: 8188
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        if (a.length() > b.length()) {
            System.out.println("GREATER");
            return;

        } else if (a.length() < b.length()) {
            System.out.println("LESS");
            return;
        }
        for (int i = 0; i < a.length(); i++) {
            if (a.charAt(i) > b.charAt(i)) {
                System.out.println("GREATER");
                return;

            } else if (a.charAt(i) < b.charAt(i)) {
                System.out.println("LESS");
                return;
            }
        }
        System.out.println("EQUAL");
    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;

    vector<long long int> vec(N);

    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }

    int ans = 0;
    int num = 1;

    for (int i = 0; i < N; i++) {
        if (vec.at(i) == num) {
            num +=1;
        } else {
            ans += 1;
        }
    }

    if (ans == N) ans = -1;

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

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

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

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin >> n >> k;
    cout << n+1-k << "\n";

    return 0;
}

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

typedef pair<int,int> P;

int main(void)
{
	int cavers[1001][1001] = {0};
	int max = -1, rx = 0, ry = 0, dx, dy, count;
	P p;
	cin >> count;
	while (count) {
		cin >> dx >> dy;
		rx += dx;
		ry += dy;
		if (dx == 0 && dy == 0) {
			cout << p.first << " " << p.second << endl;
			max =  -1;
			count--;
			p = P(0,0);
			rx = 0;
			ry = 0;
		}
		int tmp;
		if (cavers[rx][ry] == 0) cavers[rx][ry] = rx * rx + ry * ry;
		tmp = cavers[rx][ry];
		if (max <= tmp) {
			if (max == tmp) {
				if (p.first < rx) p = P(rx, ry); 
			}else {
				p = P(rx, ry);
			}
			max = tmp;
		}
	}

	return 0;
}

Measured memory_bytes: 5084
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_7_B: Tree Walk

#include <cstdio>

class BinaryTree {
public:
  static const int NIL = -1;

  struct Node {
    // id is index of nodes_
    int parent = NIL;
    int left = NIL;
    int right = NIL;
  };

private:
  unsigned int n_;
  Node* nodes_;
  
public:
  BinaryTree(unsigned int n) : n_(n), nodes_(new Node[n]) { }

  ~BinaryTree() { delete[] nodes_; }

  Node& operator[](unsigned int id) { return nodes_[id]; }

  void pre_order() const
  {
    std::printf("Preorder\n");
    pre_parse(root());
    std::printf("\n");
  }

  void in_order() const
  {
    std::printf("Inorder\n");
    in_parse(root());
    std::printf("\n");
  }

  void post_order() const
  {
    std::printf("Postorder\n");
    post_parse(root());
    std::printf("\n");
  }

private:
  int root() const
  {
    for (auto id = 0u; id < n_; ++id) {
      const auto& node = nodes_[id];
      if (node.parent == NIL) {
        return id;
      }
    }
    return NIL;
  }

  void pre_parse(int id) const
  {
    if (id == NIL) {
      return;
    }
    const auto& node = nodes_[id];
    print_id(id);
    pre_parse(node.left);
    pre_parse(node.right);
  }

  void in_parse(int id) const
  {
    if (id == NIL) {
      return;
    }
    const auto& node = nodes_[id];
    in_parse(node.left);
    print_id(id);
    in_parse(node.right);
  }

  void post_parse(int id) const
  {
    if (id == NIL) {
      return;
    }
    const auto& node = nodes_[id];
    post_parse(node.left);
    post_parse(node.right);
    print_id(id);
  }

  void print_id(int id) const
  {
    std::printf(" %u", id);
  }
};

int main()
{
  unsigned int n;
  std::scanf("%u", &n);
  BinaryTree tree(n);

  for (auto i = 0u; i < n; ++i) {
    unsigned int id;
    int left, right;
    std::scanf("%u %d %d", &id, &left, &right);

    tree[id].left = left;
    if (left != BinaryTree::NIL) {
      tree[left].parent = id;
    }
    tree[id].right = right;
    if (right != BinaryTree::NIL) {
      tree[right].parent = id;
    }
  }

  tree.pre_order();
  tree.in_order();
  tree.post_order();
}

// eof

Measured memory_bytes: 2732
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <sstream>
#include <bitset>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
#define MOD ((int)1e9+7)
//static const long double pi = 3.1415926535897932;

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

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

struct Combination {
	const int num=51e4;			//要素数
	const int mod=1e9+7;
	vector<ll> fact,inv,finv; //階乗,逆元,逆元の階乗.
	
	Combination():fact(num),inv(num),finv(num){
		fact[0]=fact[1]=1;
		inv[1]=1;
		finv[0]=finv[1]=1;
		for(int i=2;i<num;++i){
			fact[i]=fact[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	int nCk(int n,int k){
		if(n<k) return 0;
		if(n<0 or k<0) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
	int big_nCk(int n,int k){ //nが大きいとき
		ll res=1LL;
		for (int i = 0; i < k; i++) {
			res=res*(n-i)%mod;
		}
		res = res*finv[k]%mod;
		return res;
	}
	int nHk(int n,int k){return nCk(n+k-1,n-1);}//重複組み合わせ.
};

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

ll pow_mod(ll n, ll k, ll p) { // n^k(mod p)
	if (k == 0) {
		return 1;
	}
	ll res = pow_mod(n * n % p, k / 2, p);
	if (k & 1) {
		res = res * n % p;
	}
	return res;
}

bool vector_finder(std::vector<int> vec, int number) { // vector 内にnumberがあるかどうか
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
  }
  else { // 発見できなかったとき
    return false;
  }
}

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#define N 100
int W,H;
char a[N][N];

int DFS(int curX,int curY,char curChar)
{   
	if(curX<0 || curX>=W)  return 0;
	if(curY<0 || curY>=H)  return 0;
	if(a[curX][curY] != curChar)   return 0;
   
	a[curX][curY] = '0';
    DFS(curX,curY+1,curChar);
	DFS(curX,curY-1,curChar);
	DFS(curX-1,curY,curChar);
    DFS(curX+1,curY,curChar);
	return 0;	
}

int main()
{
	while(scanf("%d%d",&W,&H),W||H)    //判断?入先列数，后行数！！！！ 若?0 0 ?停止
	{
	   int i,j;  
	   int count=0;                   //?次?入列数行数后，count要置0 
       for( i=0;i<W;i++)
	   { 
		 getchar(); 
	     for(j=0;j<H;j++)
		 {
	        scanf("%c",&a[i][j]);
		 }
	   }
	   
	   for( i=0;i<W;i++)
	   {  
	     for(j=0;j<H;j++)
		 {
		    if(a[i][j]!='0')     {DFS(i,j,a[i][j]);  count++;}
		 }
	   }
	   
	   printf("%d\n",count);
	}

	return 0;
}

Measured memory_bytes: 1352
var
  n,maxtime,ans,i:integer;
  c,t:array[1..1000] of integer;
begin
  readln(n,maxtime);
  ans:=10000;
  for i:=1 to n do
  begin
    readln(c[i],t[i]);
  end;
  for i:=1 to n do
  begin
    if t[i]<=maxtime then
    begin
      if c[i]<ans then
      begin
        ans:=c[i];
      end;
    end;
  end;
  if ans=10000 then
  begin
    writeln('TLE');
  end
  else
  begin
    writeln(ans);
  end;
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

int main(){
    int N;
    cin >> N;
    ll A[N];
    ll e[60];
    ll a[60];
    e[0] = 1;
    rep(i, 59) e[i+1] = 2*e[i];
    ll ans = 0;
    rep(i, N){
        cin >> A[i];
    }
    rep(i, 60){
        a[i] = A[0]%2;
        A[0]/=2;
    }
    rep2(i, 1, N-1){
        ll b[60];
        rep(j, 60){
            b[j] = A[i]%2; 
            A[i]/=2;
            if(b[j] == 0){
                ans += (e[j]%MOD)*a[j];
                ans %= MOD;
            }
            else{
                ans += (e[j]%MOD)*(i-a[j]);
                ans %= MOD;
            }
            a[j] += b[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

struct segtree {
    vector<int> lazy, dat;
    int n;

    segtree(int n_, int init){
        n = 1;
        while(n < n_) n *= 2;
        dat.assign(n*2, init);
        lazy.assign(n*2, -1);
    }

    void set(int l, int r, int x){
        set(l, r, x, 0, n, 1);
    }

    void set(int l, int r, int x, int segl, int segr, int n){
        // cout << l << ' ' << r << ' ' << x << ' ' << segl << ' ' << segr << ' ' << n << endl;
        push(segl, segr, n);
        if(segr <= l || r <= segl);
        else if(l <= segl && segr <= r) lazy[n] = x;
        else {
            int segm = (segl + segr) / 2;
            set(l, r, x, segl, segm, n*2);
            set(l, r, x, segm, segr, n*2+1);
        }
    }

    int get(int k){
        return get(k, 0, n, 1);
    }

    int get(int k, int segl, int segr, int n){
        push(segl, segr, n);
        if(segl + 1 == segr) return dat[n];
        int segm = (segl + segr) / 2;
        if(k < segm) return get(k, segl, segm, n*2);
        else return get(k, segm, segr, n*2+1);
    }

    void push(int segl, int segr, int node){
        if(lazy[node] != -1){
            dat[node] = lazy[node];
            if(segl + 1 != segr){
                lazy[node*2] = lazy[node];
                lazy[node*2+1] = lazy[node];
            }
            lazy[node] = -1;
        }
    }
};

int main(){
    int n, q;
    while(cin >> n >> q){
        segtree st(n, 2147483647);
        for(int iq = 0; iq < q; ++iq){
            int t;
            cin >> t;
            // dump(t);
            if(t == 0){
                int s, t, x;
                cin >> s >> t >> x;
                ++t;
                st.set(s, t, x);
            } else {
                int i;
                cin >> i;
                cout << st.get(i) << '\n';
            }

            // for(int i = 1; i < (int)st.dat.size(); ++i){
            //     cout << '[' << st.dat[i] << ' ' << st.lazy[i] << ']';
            //     if(i == 1 || i == 3 || i == 7 || i == 15) cout << endl;
            // }
        }
    }
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll K;

int main() {
    cin >> K;
    cout << (K / 2) * (K / 2 + K % 2) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(ll X) {
  ll sum = 0;
  for (int i = 1;; ++i) {
    sum += i;
    if (sum >= X) { cout << i << endl; return; }
  }
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll X;
	scanf("%lld", &X);
	solve(X);
	return 0;
}


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

int n, m, q, ans, a[10];
vector<tuple<int,int,int,int>> info;

void dfs(int idx, int lo) {
    if (idx == n) {
        int score = 0;
        for (auto [x, y, z, w] : info)
            if (a[y] - a[x] == z) score += w;
        ans = max(ans, score);
        return;
    }
    for (int i=lo;i<=m;++i) {
        a[idx] = i;
        dfs(idx+1, i);
    }
}

int main() {
    a[0] = 1;
    scanf("%d%d%d", &n, &m, &q);
    for (int i=0;i<q;++i) {
        int x, y, z, w;
        scanf("%d%d%d%d", &x, &y, &z, &w);
        info.push_back({x-1, y-1, z, w});
    }
    dfs(0, 1);
    printf("%d", ans);
}


Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ld,ll> P;
ll xz[1005]={0},yz[1005]={0};
ll rz[1005]={0};
ld dist[1005][1005]={0};
ld get_dist(ll i,ll j){
  ll da=(xz[i]-xz[j])*(xz[i]-xz[j]);
  da+=(yz[i]-yz[j])*(yz[i]-yz[j]);
  ll db=(rz[i]+rz[j])*(rz[i]+rz[j]);
  if(da<=db) return 0;
  else return sqrt((ld)da)-(rz[i]+rz[j]);
}
int main(){
  ll xs,ys,xg,yg;
  cin>>xs>>ys>>xg>>yg;
  ll n;
  cin>>n;
  xz[0]=xs;
  yz[0]=ys;
  xz[n+1]=xg;
  yz[n+1]=yg;
  for(int i=1;i<=n;i++) cin>>xz[i]>>yz[i]>>rz[i];
  for(int i=0;i<=n+1;i++){
    for(int j=0;j<=n+1;j++){
      if(i!=j) dist[i][j]=get_dist(i,j);
    }
  }
  ld min_cost[1005]={0};
  bool used[1005]={false};
  used[0]=false;
  for(int i=1;i<=n+1;i++) {
    min_cost[i]=174417441744.00;
    used[i]=false;
  }
  priority_queue<P,vector<P>,greater<P>> pque;
  pque.push(P(0,0));
  while(!pque.empty()){
    P p=pque.top();
    pque.pop();
    ld cos=p.first;
    ll pos=p.second;
    if(used[pos]) continue;
    used[pos]=true;
    for(int i=0;i<=n+1;i++){
      if(i!=pos&&!used[i]){
        ld ncos=cos+dist[pos][i];
        if(ncos<min_cost[i]){
          min_cost[i]=ncos;
          pque.push(P(ncos,i));
        }
      }
    }
  }
  cout<<fixed;
  cout<<setprecision(15)<<min_cost[n+1]<<endl;
}


Measured memory_bytes: 26220
<?php
fscanf(STDIN, "%d%d", $n, $k);

$array = array_fill(1,$n,1);

while($k--){
    fscanf(STDIN, "%d", $d);
    $map = explode(" ", trim(fgets(STDIN)));
    foreach($map as $value){
        if(isset($array[$value])){
            unset($array[$value]);
        }
    }

}
echo count($array);

Measured memory_bytes: 16264
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
int x;
vector<int>a;
void get_i(int x){
	a.pb(1);
	for(int i=2;i*i<=x;i++){
		if(x%i==0){
			a.pb(i);
		}
	}
}
int r,w;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>x;
    get_i(x);
    int flag=0;
    //cout<<a.size()<<endl;
    for(auto u:a){
    	//cout<<endl;
    	//cout<<u<<endl;
    	rep(i,-200,201){
    		//cout<<i<<" "<<i+u<<endl;
    		if(1LL*(i+u)*(i+u)*(i+u)*(i+u)*(i+u)-1LL*(i)*(i)*(i)*(i)*(i)==1ll*x){
    			flag=1;
    			r=i+u;
    			w=i;
			}
		}
		if(flag)
		break;
	}
	cout<<r<<" "<<w<<endl;
    return 0;
}


Measured memory_bytes: 3656
import java.util.*;


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

        String S = sc.next();
        
        int count = 0;
        for(int i = 0 ;i < S.length()-1;i++){
           char one = S.charAt(i);
           char two = S.charAt(i+1);
           if(one != two){
               count++;
           }else{
               continue;
           }           
        }
        
        System.out.println(count);        
        
        
    }                                       
}

Measured memory_bytes: 24148
from sys import stdin

matches = ['A','C','G','T']
S = stdin.readline().rstrip()
cnt_row = 0
cnt_max = 0
for s in S:
    if s in matches:
        cnt_row += 1
        if cnt_max < cnt_row:
            cnt_max = cnt_row
    else:
        cnt_row = 0
print(cnt_max)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

long max(long a, long b) {
	return a < b ? b : a;
}

int main()
{
	int N, W;
	long weight[100], value[100];

	scanf("%d", &N);
	scanf("%d", &W);

	for (int i = 0; i < N; i++) {
		scanf("%ld", &weight[i]);
		scanf("%ld", &value[i]);
	}

	//long bag[100][100000];
	long **bag;
	bag = (long**)malloc(sizeof(long*) * 100);
	for (int i = 0; i < 101; i++) {
		bag[i] = (long*)malloc(sizeof(long) * 100000);
	}

	// 初期化
	for (int i = 0; i < 10000; i++) {
		bag[0][i] = 0;
	}

	// 探索
	for (int i = 0; i < N; i++) {
		for (int w = 0; w <= W; w++) {
			if (weight[i] > w) {
				bag[i + 1][w] = bag[i][w];
			} else {
				bag[i + 1][w] = max(bag[i][w - weight[i]] + value[i], bag[i][w]);
			}
		}
		//printf("%d\n", bag[i + 1][W - 1]);
	}

	printf("%ld", bag[N][W]);

	return 0;
}

Measured memory_bytes: 78592
n, m, l = map(int, input().split())
A, B = [], []
for _ in range(n):
    A.append(list(map(int, input().split())))
for _ in range(m):
    B.append(list(map(int, input().split())))
 
C = []
B_T = list(zip(*B))
for a_row in A:
    C.append([sum(a * b for a, b, in zip(a_row, b_column)) for b_column in B_T])
for row in C:
    print(' '.join(map(str, row)))

Measured memory_bytes: 9068
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  var input = lines[0].split(' ');
  var A = parseInt(input[0]);
  var B = parseInt(input[1]);
  if (B / A === parseInt(B / A)) {
      console.log(A + B);
} else {
          console.log(B - A);
}
});

Measured memory_bytes: 21320
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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 (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



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

	int n; cin >> n;
	string s;
	map<string, int> m;
	rep(i, n)
	{
		cin >> s;
		m[s]++;
	}
	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;

	return 0;
}

Measured memory_bytes: 3660
<?php
  $n = trim(fgets(STDIN));
//   echo strlen($n);
  if($n%9 == 0){
     $cnt = 0;
     $len = strlen($n);
     for($i=0; $i<$len; $i++){
         $cnt += $n[$i];
      }
    //   echo $cnt;
      if($cnt%9==0){
          echo "Yes";
      }else{
          echo "No";
      }
  }else{
      echo "No";
  }

Measured memory_bytes: 16644
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    
    long int A[n];
    int i;

    for(i=0; i<n; i++) {
        scanf("%ld", &A[i]);
    }

    // printf("%ld\n", A[0]);

    int end_cal=0, count=0;
    while(1) {
        for(i=0; i<n; i++) {
            if(A[i]%2==1) {
                end_cal = 1;
                break;
            }
            A[i] = A[i]/2;
        }
        if(end_cal) {
            break;
        }
        count += 1;
    }

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

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位


int main(void) {
    ll n, m;
    cin >> n >> m;
    ll k[m], s[10][10], p[m];
    for(ll i = 0; i < m; i++){
        cin >> k[i];
        for(ll j = 0; j < k[i]; j++)
            cin >> s[i][j];
    }
    for(ll i = 0; i < m; i++)
        cin >> p[i];
    ll ans = 0;
    for(ll bit = 0; bit < (1 << n); bit++){
        bool ok = true;
        vector<ll> c(m, 0);
        for(ll i = 0; i < m; i++){
            for(ll j = 0; j < k[i]; j++){
                if((bit>>(s[i][j]-1))&1) c[i]++;
            }
           // cout << bit << " " << c[i] << endl;
            if(c[i]%2!=p[i]) ok = false;
        }
        if(ok==true){
            ans++;
         //   cout << bit << endl;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;


int main()
{
    string s; cin >> s;
    int n = s.size();
    int nin = n;
    for(int i = 1; i < n; i++) {
        if(s[i] != s[i - 1]) {
            int cur = max(i, n - i);
            nin = min(cur, nin);
        }
    }
    cout << nin << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
#include <cstdint>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long int ll;
typedef pair<int, int> P;
const vector<int> di = { -1, 0, 1, 0 };
const vector<int> dj = { 0, 1, 0, -1 };


int main() {

	ll x;
	cin >> x;
	ll cnt = 0;

	while (1) {
		ll a = (cnt + 1) * cnt / 2;

		if (x <= a) {
			cout << cnt << endl;
			break;
		}
		cnt++;
	}
	
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    using pint = pair<int, int>; // <人, 0or1>
    vector<vector<pint>> shogen;
    for (int i=0; i<N; i++) {
        int A;
        cin >> A;
        vector<pint> s(A);
        for (int i=0; i<A; i++) {
            cin >> s.at(i).first >> s.at(i).second;
            --s.at(i).first; 
        }
        shogen.push_back(s);
    }
    int res = 0;
    for (int bit=0; bit < (1<<N); bit++) {
        bool isOK = true;
        for (int i=0; i<N; i++) {
            if (!(bit & (1<<i))) continue;
            for (int j=0; j<shogen.at(i).size(); j++) {
                int x = shogen.at(i).at(j).first;
                int y = shogen.at(i).at(j).second;
                if (y == 1 && !(bit & (1<<x))) isOK =  false;
                if (y == 0 && (bit & (1<<x))) isOK = false;
                if (!isOK) break;
            }
            if (!isOK) break;
        }
        if (isOK) {
            int cnt=0;
            for (int i=0; i<N; i++) {
                if (bit & (1<<i)) cnt++;
            }
            res = max(cnt, res);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3588
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String line = sc.next();
        String[] s = line.split("");
        int count = 0;
        boolean check = false;
        for(int i=0; i<s.length; i++){
          if(s[i].equals("x")) count++;
          if(count >= 8) {
            check = true;
            break;
          }
        }
        if(check) System.out.println("NO");
        else System.out.println("YES");
	}
}

Measured memory_bytes: 23124
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;
typedef long long ll ;
# define rep (i , n ) for ( int i =0; i < n ; i++)
# define _sort(arg) sort(begin(arg), end(arg))

int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	int D;
	cin >> D;

	if (D == 25)
	{
		cout << "Christmas" << endl;
	}
	else if (D == 24)
	{
		cout << "Christmas Eve" << endl;
	}
	else if (D == 23)
	{
		cout << "Christmas Eve Eve" << endl;
	}
	else if (D == 22)
	{
		cout << "Christmas Eve Eve Eve" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;
  
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    
    if(x < K - x)
      sum += 2 * x;
    else
      sum += 2 * (K - x);
  }
  
  cout << sum <<endl;
}

Measured memory_bytes: 256