akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n, m := r.nextInt(), r.nextInt()

	ans := make([]byte, n)
	for i := 0; i < m; i++ {
		r.Scan(true)
		s, c := r.nextInt()-1, r.nextString()[0]
		if ans[s] == 0 || ans[s] == c {
			ans[s] = c
		} else {
			ans = []byte{'-', '1'}
			break
		}
	}
	if len(ans) > 1 && ans[0] == '0' {
		ans = []byte{'-', '1'}
	} else {
		for i, ansI := range ans {
			if ansI == 0 {
				if i == 0 && len(ans) > 1 {
					ans[i] = '1'
				} else {
					ans[i] = '0'
				}
			}
		}

	}
	fmt.Fprintln(stdout, string(ans))
}


Measured memory_bytes: 1740
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

if len(S) < len(T):
    print(ans)
    sys.exit()

if len(S) < len(T):
    print(ans)
    sys.exit()

tmp = True
anss = -1
anse = -1
for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        anss = i
        anse = i + len(T)

if anss == -1:
    print(ans)

else:
    ans = S.replace('?', 'a')
    ans = ans[:anss] + T + ans[anse:]
    print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s.length()==3){
        for(int i=s.length()-1;i>=0;i--)
            cout<<s[i];
        cout<<endl;
    }
    else cout<<s<<endl;
}

Measured memory_bytes: 256
n = int(input())
c = []
s = []
f = []

for i in range(n-1):
    ci,si,fi = map(int,input().split())
    c.append(ci)
    s.append(si)
    f.append(fi)
def time(t,i):
    if s[i] >= t:
        T = s[i]
    else:
        if(t-s[i])%f[i]==0:
            T = t
        else:
            T = t+f[i] -(t-s[i])%f[i]
    return T+c[i]
for i in range(n):
    t = 0
    for j in range(i,n-1):
        t = time(t,j)
    print(t)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	int N; int K; cin >> N >> K;  
	long double ans = 0; 
	int kaisuu[20] = {}; 
	for(int i = 1; i <= N; i++){
		int a = 0; int j = i; 
		while(j < K){
			j *= 2; a ++; 
		}
		kaisuu[a] ++; 
	}
	for(int j = 0; j < 20; j++){
		ans += (long double) pow(2, -j) * kaisuu[j]; 
	}
  	ans /= N; 
	cout.precision(20); 
	cout << ans << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N = 0,K = 0;
  cin >> N >> K;
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0;i < N - 1;i++){
    if(s.at(i) == s.at(i + 1)){
      ans++;
    }
  }
  ans = min(ans+2*K,N - 1);
  cout << ans << endl;
}


Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;



const int MAX_V = 10010;
int V;
int cmp[MAX_V]; // components of each vertex
bool used[MAX_V];
vector<int> g[MAX_V], rg[MAX_V], ng[MAX_V], vs;

void add_edge(int from, int to) {
    g[from].push_back(to);
    rg[to].push_back(from);
}

void dfs(int v) {
    used[v] = true;
    for (int nv: g[v]) {
        if (!used[nv]) dfs(nv);
    }
    vs.push_back(v);
}

void rdfs(int v, int k) {
    used[v] = true;
    cmp[v] = k;
    for (int nv: rg[v]) {
        if (!used[nv]) rdfs(nv, k);
    }
}

// return number of components
int scc() {
    memset(used, false, sizeof(used));
    vs.clear();
    for (int v = 0; v < V; v++) {
        if (!used[v]) dfs(v);
    }
    memset(used, false, sizeof(used));
    int k = 0;
    for (int i = vs.size()-1; i >= 0; i--) {
        if (!used[vs[i]]) rdfs(vs[i], k++);
    }
    return k;
}

void new_graph(int k) {
    for (int v = 0; v < V; v++) {
        for (int nv: g[v]) {
            int x = cmp[v];
            int y = cmp[nv];
            if (x == y) continue;
            ng[x].push_back(y);
        }
    }
}


int main() {
    int e; cin >> V >> e;
    rep(i, e) {
        int s, t; cin >> s >> t;
        add_edge(s, t);
    }

    scc();

    int q; cin >> q;
    rep(i, q) {
        int u, v; cin >> u >> v;
        cout << (cmp[u] == cmp[v] ? 1 : 0) << endl;
    }


    return 0;
}


Measured memory_bytes: 5072
N,M=map(int,input().split())
LIKE=[list(map(int,input().split())) for i in range(N)]

FOOD=[0]*(M+1)

for i in range(N):
    for l in LIKE[i][1:]:
        FOOD[l]+=1

ANS=0
for f in FOOD:
    if f==N:
        ANS+=1

print(ANS)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF 1e9
#define MOD 1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}


signed main(){
	
	ll a,b,c,d,e,n,m,memo = 0,cnt = 0,k;
	string s = "",t = "";
	
	
	cin >> a >> b >> c >> d >> e >> k;
	
	if(b-a > k || c-a > k || d-a> k || e-a > k  || b-c > k || d-b > k || d-c > k || e-c > k || e-d > k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
	
	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long LL;
const int maxn = 1000;
int X, Y, Z, K;
LL a[maxn + 5], b[maxn + 5], c[maxn + 5];
LL ans[maxn * maxn + 5], array[3 * maxn * maxn + 5];
bool cmp(LL x, LL y) {return x > y; }
int main() {
	scanf("%d%d%d%d", &X, &Y, &Z, &K);
	for(int i = 1; i <= X; i++)scanf("%lld", &a[i]);
	for(int i = 1; i <= Y; i++)scanf("%lld", &b[i]);
	for(int i = 1; i <= Z; i++)scanf("%lld", &c[i]);
	sort(c + 1, c + Z + 1, cmp);
	int t = 0;
	for(int i = 1; i <= X; i++)
		for(int j = 1; j <= Y; j++)
			ans[++t] = a[i] + b[j];
	sort(ans + 1, ans + X * Y + 1, cmp);
	for(int i = 1; i <= min(3000, X * Y); i++)
		for(int j = 1; j <= Z; j++)
			array[(i - 1) * Z + j] = ans[i] + c[j];
	sort(array + 1, array + min(3000, X * Y) * Z + 1, cmp);
	for(int i = 1; i <= K; i++)printf("%lld\n", array[i]);
	return 0;
}

Measured memory_bytes: 31488
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin >> n >> m;

    if (m <= 2 * n) {
        cout << m / 2 << '\n';
    } else {
        cout << n + (m - 2 * n) / 4 << "\n";
    }

    return 0;
}

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

int *mp;
int *vis;
int len(vector<int> *mat,int n,int in)
   {
        if(mp[in]!=-1)
            return mp[in];
        int r=1;
        for(int i=0;i<mat[in].size();i++)
         {
            r=max(r,1+len(mat,n,mat[in][i]));
         }
        mp[in]=r;
        vis[in]=1;
        return r;
   }
    

int main() {
	// your code goes here
	int n,m;
	cin>>n>>m;
    vector<int> mat[n];
	vis=new int[n];
	mp=new int[n];
	for(int i=0;i<n;i++)
	  {
	      mp[i]=-1;
	      vis[i]=0; 
	  }
	int x,y;    
	for(int i=0;i<m;i++)
	 {
	     cin>>x>>y;
	     mat[x-1].push_back(y-1);
	 }
	m=1; 
	for(int i=0;i<n;i++)
	  {
	      if(!vis[i])
	        m=max(m,len(mat,n,i));
	  }
	cout<<m-1;  
	return 0;
}


Measured memory_bytes: 9856
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define NMAX 110000
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
typedef long long int ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll mod = 1e+9+7;

int main()
{	
    ll h,w; cin >> h >> w;
    vector<string> S(h);
    for(int i=0; i<h; i++) cin >> S[i];

    ll L[h][w];
    ll R[h][w];
    ll U[h][w];
    ll D[h][w];

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(S[i][j]=='#'||j==0) L[i][j] = 0;
            else if(S[i][j-1]=='#') L[i][j] = 0;
            else L[i][j] = L[i][j-1] + 1;
        }
        for(int j=w-1;j>=0;j--){
            if(S[i][j]=='#'||j==w-1) R[i][j] = 0;
            else if(S[i][j+1]=='#') R[i][j] = 0;
            else R[i][j] = R[i][j+1] + 1;
        }
    }

    for(int j=0;j<w;j++){
        for(int i=0;i<h;i++){
            if(S[i][j]=='#'||i==0) U[i][j] = 0;
            else if(S[i-1][j]=='#') U[i][j] = 0;
            else U[i][j] = U[i-1][j] + 1;
        }
        for(int i=h-1;i>=0;i--){
            if(S[i][j]=='#'||i==h-1) D[i][j] = 0;
            else if(S[i+1][j]=='#') D[i][j] = 0;
            else D[i][j] = D[i+1][j] + 1;
        }
    }

    ll ans(0);
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(S[i][j]=='#') continue;
            ll sum = 1 + L[i][j] + R[i][j] + U[i][j] + D[i][j];
            if(sum > ans) ans = sum;
        }
    }

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

Measured memory_bytes: 129408
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a_max = max(a)
n_max = len(list(filter(lambda x: x==a_max, a)))
if n_max >= 2:
  for i in range(n):
    print(a_max)
else:
  a_exp = max(list(filter(lambda x: x < a_max, a)))
  for i in range(n):
    if a[i] == a_max:
      print(a_exp)
    else:
      print(a_max)
  

Measured memory_bytes: 75948
#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)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
void operator>> (istream& ist, vector<int>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N; cin >> N;
  vector<int> vs(N); cin >> vs;

  int M; cin >> M;

  rep(i, M) {
    int p; cin >> p; p--;
    int x; cin >> x;
    ll sum = 0;
    rep(k, N) {
      if(k == p) sum += x;
      else sum += vs[k];
    }
    cout << sum << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int r; cin>>r;
  cout << r*r << endl;
  return 0;
}


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

int main() {
  int n, k;
  string nums = "";
  cin >> n >> k;
  int tmp;
  int flag = 0;
  for (int i = 0; i < k; i++) {
    cin >> tmp;
    nums += to_string(tmp);
  }
  string s;
  for (int i = 0; i <= n * 9; i++) {
    flag = 0;
    s = to_string(n + i);
    for (int j = 0; j < k; j++) {
      if (s.find(nums[j]) != string::npos) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << n + i << endl;
      break;
    }
  }
}

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

void _139() {
    string s, t;
    cin >> s;
    cin >> t;

    int count = 0;
    for (int i = 0; i < 3; ++i) {
        if (s[i] == t[i])
            count++;
    }
    cout << count << endl;
}

void _138() {
    int a;
    string s;
    cin >> a;
    cin >> s;

    if (a >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;
}

int main()
{
    _138();
    return 0;
}



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var s string
	fmt.Scan(&s)

	slice := strings.Split(s, "")

	count := 0
	for i := 1; i < len(slice); i++ {
		if slice[i-1] == slice[i] {
			if slice[i-1] == "0" {
				slice[i] = "1"
			} else {
				slice[i] = "0"
			}
			count++
		}
	}

	// fmt.Println(slice)
	fmt.Println(count)
}


Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n,k;
  cin>>n>>k;
  int h[n];
  rep(i,n) cin>>h[i];
  int dp[n];
  dp[0] = 0;dp[1] = abs(h[1] - h[0]);
  FOR(i, 2, n) {
    dp[i] = MOD;
    rep(j,k+1) {
      if(i - j >= 0) {
        dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]));
      }
    }
  }
  cout << dp[n-1] << endl;

  return 0;
}


Measured memory_bytes: 1024
N = int(input())
SS = []
for _ in range(N):
    SS.append(sorted(input()))
common = SS[0]
for s in SS:
    sc = s[:]
    z = []
    for c in common:
        if c in sc:
            sc.remove(c)
            z.append(c)
    common = z
print(''.join(common))

Measured memory_bytes: 38640
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
 
const int MAXN = 100100;
const int MOD = 1e9+7;
int cnt[MAXN];
 
int solve(int N) {
	ll ans = 1;
	if (N % 2 == 1) {
		if (cnt[0] != 1) return 0;
		for (int i = 2; i < N; i += 2) {
			if (cnt[i] != 2) return 0;
			(ans *= 2) %= MOD;
		}
		return ans;
	} else {
		for (int i = 1; i < N; i+=2) {
			if (cnt[i] != 2) return 0;
			(ans *= 2) %= MOD;
		}
		return ans;
	}
}
 
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	cout << solve(N) << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 2014159
#define  vi vector<int>
#define  v  vector




string s;

void solve()
{
    cin>>s;
    int ans = 1;
    string bc = "";
    bc+=s[0];
    vector<string>x;
    x.pb(bc);
    int n = s.size();
    string xd = "";
    forn(i,1,n-1)
    {
        xd+=s[i];

        if(x.back() == xd);
        else
        {
            x.pb(xd);
            xd = "";
            ans++;
        }
    }
    cout<<ans;
    


}   


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int tc = 1;
    //cin>>t;
    while(tc--)
    {
        solve();
    }



    return 0;

}

//       g++ -g c.cpp ; ./a.exe

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

int main() {
  int N, M;
  cin >> N >> M;
  int a, b;
  vector<int> v;
  bool toN[N+1];
  fill(toN, toN + (N+1), false);
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    if (a == 1) v.push_back(b);
    if (b == N) toN[a] = true;
  }

  string ans = "IMPOSSIBLE";
  for (int i = 0; i < v.size(); i++) {
    if (toN[v[i]]) {
      ans = "POSSIBLE";
      break;
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1020
def slove():
    import sys
    import itertools
    input = sys.stdin.readline
    n, a, b, c = list(map(int, input().rstrip('\n').split()))
    l = [int(input().rstrip('\n')) for _ in range(n)]
    mt = 10 ** 10
    for v in itertools.product([i for i in range(4)], repeat=n):
        nl = [[] for _ in range(4)]
        for i, vv in enumerate(v):
            nl[vv].append(l[i])
        if len(nl[1]) != 0 and len(nl[2]) != 0 and len(nl[3]) != 0:
            t = 0
            t += ((len(nl[1]) - 1) * 10 + abs(a - sum(nl[1])))
            t += ((len(nl[2]) - 1) * 10 + abs(b - sum(nl[2])))
            t += ((len(nl[3]) - 1) * 10 + abs(c - sum(nl[3])))
            mt = min(t, mt)
    print(mt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 51292
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling, digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vpll flag, D; vll path;
//***********//
//main内でCOMinit(N+1)を忘れずに！
vl fac, finv, inv;
void COMinit(ll N) {
	fac.resize(N);
	finv.resize(N);
	inv.resize(N);
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
	ll A, B;
	cin >> H >> W >> A >> B;
	COMinit(210000);
	for (k = 0; k <= H-A-1; k++) {
		(ans += COM(k + B - 1, k) * COM(H - k - 1 + W - B - 1, H - k - 1)) %= MOD;
	}
	cout << ans;
}

Measured memory_bytes: 8252
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

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

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

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

mt19937 mrand(random_device{} ()); 

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

void precalc() {
}

const int maxn = (int) 1e5 + 5, mod = (int) 1e9 + 7;
int n;
long long a, b;
long long s[maxn];

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int read() {
  if (scanf("%d%lld%lld", &n, &a, &b) < 3) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &s[i]);
  }
  return true;
}

int dp[maxn];
int sum[maxn];

void solve() {
  if (a > b) {
    swap(a, b);
  }
  s[n] = (long long) 2e18 + 5;
  n++;
  for (int i = 0; i + 2 < n; i++) {
    if (s[i + 2] - s[i] < a) {
      printf("0\n");
      return;
    }
  }
  dp[0] = 1;
  sum[0] = 1;
  int l = -1, r = -1;
  for (int i = 0; i < n; i++) {
    while (s[i] - s[r + 1] >= b) {
      r++;
    }
    if (l <= r) {
      dp[i + 1] = sum[r + 1];
      add(dp[i + 1], mod - sum[l]);
    } else {
      dp[i + 1] = 0;
    }
    //eprintf("l = %d, r = %d, dp = %d\n", l, r, dp[i + 1]);
    sum[i + 1] = sum[i];
    add(sum[i + 1], dp[i + 1]);
    if (s[i] - s[i - 1] < a) {
      l = i - 1;
    }
  }
  printf("%d\n", dp[n]);
}

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


Measured memory_bytes: 1920
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
g=Array.new(N){[]}
def bfs(g,c,ans)
    que=[0]
    ans[0]=c[0]
    ret=0
    i=1
    until que==[]
        p=que.shift
        g[p].each do|v|
            next unless ans[v]==-1
            ans[v]=c[i]
            i+=1
            ret+=min(ans[p],ans[v])
            que.push(v)
        end
    end
    return ret
end
size=Hash.new(0)
(N-1).times do|i|
  a,b=get_i.map{|x| x-=1}
  g[a].push(b)
  g[b].push(a)
end
c=get_i.sort{|x,y| y<=>x}
ans=array(N,-1)
puts bfs(g,c,ans)
puts ans.join(" ")

Measured memory_bytes: 16100
using System;

namespace ITP1 {
	class Program {
		public static void Main() {
			int input = int.Parse(Console.ReadLine());
			int h = input / 60 / 60;
			int m = (input / 60) % 60;
			int s = input % 60;

			Console.WriteLine(h + ":" + m + ":" + s);
		}
	}
}



Measured memory_bytes: 9180
import numpy as np

N = int(input())

l = []
for i in range(N):
    if i == 0:
        before = list(map(int, input().split()))
        road = before[0] - before[1] - before[2]
        #print(road)
        if road < 0:
            ans = 'No'
            break
        elif road >= 0 and road%2 == 1:
            ans = 'No'
            break
        else:
            ans = 'Yes'
    else:
        after = list(map(int, input().split()))
        road = after[0] - before[0] - after[1] + before[1] - after[2] + before[2]
        #print(road)
        if road < 0:
            ans = 'No'
            break
        elif road >= 0 and road%2 == 1:
            ans = 'No'
            break
        else:
            ans = 'Yes'
            before = after

print(ans)


Measured memory_bytes: 12504
N = int(input())
a = list(map(int, input().split()))
num = [0] * 9
for i in range(N):
    if 1 <= a[i] <= 399:
        num[0] = 1
    elif 400 <= a[i] <= 799:
        num[1] = 1
    elif 800 <= a[i] <= 1199:
        num[2] = 1
    elif 1200 <= a[i] <= 1599:
        num[3] = 1
    elif 1600 <= a[i] <= 1999:
        num[4] = 1
    elif 2000 <= a[i] <= 2399:
        num[5] = 1
    elif 2400 <= a[i] <= 2799:
        num[6] = 1
    elif 2800 <= a[i] <= 3199:
        num[7] = 1
    else:
        num[8] = num[8] + 1

if num[8] == 0:
    maximum = sum(num[0:8])
    minimum = sum(num[0:8])
else:
    if num[8] == N:
        maximum = N
        minimum = 1
    else:
        maximum = sum(num[0:8]) + num[8]
        minimum = sum(num[0:8])

print(minimum, maximum)


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

using namespace std;

int main() {
    int n;
    cin >> n;
    string ans = "No";
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i * j == n) {
                ans = "Yes";
            }
        }
    }

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

Measured memory_bytes: 3608
#include<stdio.h>
#include<string.h>
int main(){
  char s[400];
  int i,m,h,size,sum=0;

  while(1){
      sum=0;
    scanf("%s",s);
    if(s[0] == '-') break;
    size = strlen(s);
    for(i=0;i<size;i++){
      s[i+size] = s[i];
    }
    scanf("%d",&m);
    for(i=0;i<m;i++){
      scanf("%d",&h);
      sum+=h;
      }
    for(i=0;i<size;i++){
      printf("%c",s[i+sum%size]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2124
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstdint>
#include<unordered_map>
#include<sstream>
#include<boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool ps2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool ps3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool ps4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}


int main()
{
	string s;
	cin >> s;
	vector<int>alpha(26);
	rep(i, 4) {
		alpha[s[i] - 65]++;
	}
	int count = 0;
	rep(i, 26) {
		if (alpha[i] == 2) {
			count++;
		}
	}
	if (count == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int 
#define f(i,n) for(int i=0;i<(n);i++)
#define rep(i,a,n) for(int i=(a);i<=(n);i++)
#define vi vector<int>
#define pi pair<int,int>
#define pb push_back
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define inf LONG_MAX
#define ninf LONG_MIN
const int mod = 1e9+7;

int32_t main() {
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  
  int k;string s;
  cin>>k>>s;
  int i=s.length();
  cout<<s.substr(0,min(k,i));
  if(i > k)
    cout<<"..."<<"\n";
  
  
  return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>

using std::vector;
using std::printf;
using std::cout;
using std::endl;
using std::string;
using std::cin;
using std::pair;
using std::sort;
using std::priority_queue;

#define i64t long long int
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

template<typename T>
void dump(vector<T> vec) {
    for (auto x : vec) {
        std::cout << x << " ";
    }
    std::cout << std::endl;
}

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

const i64t MOD = 1000000007;

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

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

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (h[i] >= K) {
            ans++;
        }
    }

    printf("%d", ans);

}

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


int main(){
	int k;
	string s;
	int i,j;
	
	cin >> s;
	cin >> k;
	
	j=k;
	for(i=0;i<s.length();i++){
		if(s.substr(i,1)=="1"){
			j--;
			if(j==0){
				cout <<1 << endl;
				
				return 0;
			}
		}else{
			cout <<s[i] << endl;
			return 0;
		}
		// cout << i<<" "<<j<<endl;
	}
	return 1;
}

Measured memory_bytes: 256
X, N = list(map(int, input().split()))
p = set(map(int, input().split()))
d = 0
while True:
    x_n = X - d
    x_p = X + d
    if x_n not in p:
        print(x_n)
        break
    elif x_p not in p:
        print(x_p)
        break
    d += 1

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

int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int* inputint(int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) cin >> ans[i];
    return ans;
}

int main()
{
    int n;
    cin >> n;
    int *a = inputint(n);

    int sum = 0;
    for( int i = 0; i < n; i++ ) sum = sum ^ a[i];

    for( int i = 0; i < n; i++ )
    {
        cout << (sum ^ a[i]);
        if( i + 1 < n) cout << " ";
    }
    return 0;    
}

Measured memory_bytes: 4224
#include <stdio.h>
#define LEN 100005
typedef struct pp {
	char name[10];
	int time;
}PP;

int head, tail;
PP Q[LEN];

PP dequeue() {
	PP x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

void enqueue(PP x) {
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	int i;
	int n, q;
	PP u;
	int c, expl = 0;

	scanf("%d %d", &n, &q);
	for (i = 1; i <= n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].time);
	}
	head = 1; tail = n + 1;

	while (head != tail) {
		u = dequeue();
		c = min(u.time, q);
		expl += c;
		u.time -= c;
		if (u.time <= 0) {
			printf("%s %d\n", u.name, expl);
		} else {
			enqueue(u);
		}
	}

	return 0;
}


Measured memory_bytes: 3244
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

const int N = 500000;

int sz[N];
vector<int> graph[N];
ll dist[N];

void dfs(int v, int p, int di)
{
    dist[v] = di;
    for (auto u : graph[v]) if (u != p)
    {
        dfs(u, v, di + 1);
    }
}

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    int n;
    cin >> n;
    vector<ll> d(n + 1);
    vector<pair<ll, int> > q(n);
    map<ll, int> mm;
    for (int i = 1; i <= n; i++) cin >> d[i], q[i - 1] = {d[i], i}, mm[d[i]] = i;
    sort(rall(q));
    fill(sz, sz + N, 1);
    for (int i = 0; i + 1 < q.size(); i++)
    {
        auto it = q[i];
        ll ex = it.first + sz[it.second] - (n - sz[it.second]);
        if (ex >= it.first || mm.find(ex) == mm.end())
        {
            cout << "-1";
            return 0;
        }
        graph[it.second].push_back(mm[ex]);
        graph[mm[ex]].push_back(it.second);
        sz[mm[ex]] += sz[it.second];
    }
    dfs(1, 0, 0);
    ll si = 0;
    for (int i = 1; i <= n; i++) si += dist[i];
    if (si != d[1])
    {
        cout << -1;
        return 0;
    }
    for (int i = 1; i <= n; i++)
    {
        for (auto u : graph[i])
        {
            if (u > i) cout << u << " " << i << "\n";
        }
    }
}


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

int main() {
  int H,W;
  cin >> H >> W;
  
  string S[50];
  for (int i = 0; i < H; i++) cin >> S[i];
  
  const int sy[8] = {-1, -1, -1,  0, 0,  1, 1, 1};
  const int sx[8] = {-1,  0,  1, -1, 1, -1, 0, 1};
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') continue;
      
      int num = 0;
      for (int k = 0; k < 8; k++) {
        const int cy = i + sy[k];
        const int cx = j + sx[k];
        if (cy < 0 || H <= cy) continue;
        if (cx < 0 || W <= cx) continue;
        
        if (S[cy][cx] == '#') num++;
      }
      
      S[i][j] = char(num + '0');
    }
  }
  
  for (int i = 0; i < H; i++) cout << S[i] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

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

int main(){
    int amount,max;
    scanf("%d %d",&amount,&max);
    int value[amount+1],weight[amount+1];
    
    for(int i=1;i<=amount;i++){
        scanf("%d %d",&value[i],&weight[i]);
    }
    int dp[amount+1][max+1];
    
    for(int i=0;i<=max;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<=amount;i++){
        dp[i][0]=0;
    }
    
    for(int i=1;i<=amount;i++){
        for(int j=1;j<=max;j++){
            if(weight[i]>j){
                dp[i][j]=dp[i-1][j];
            }
            else{
                dp[i][j]=compare(dp[i-1][j],dp[i-1][j-weight[i]]+value[i]);
            }
        }
    }
    
    printf("%d\n",dp[amount][max]);
    
    return 0;
}


Measured memory_bytes: 5792
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
    int h,w,n=0;
    cin>>h>>w;
    int coin[h][w];
    int ans[4][500000];
    for(int gyo=0;gyo<h;gyo++){
        for(int re=0;re<w;re++){
            cin>>coin[gyo][re];
        }
    }
    for(int gyo2=0;gyo2<h-1;gyo2++){
        for(int re2=0;re2<w;re2++){
            if(coin[gyo2][re2]%2==1){
                coin[gyo2+1][re2]++;
                ans[0][n]=gyo2+1;
                ans[1][n]=re2+1;
                ans[2][n]=gyo2+2;
                ans[3][n]=re2+1;
                n++;
            }
        }
    }
    for(int re3=0;re3<w-1;re3++){
        if(coin[h-1][re3]%2==1){
            coin[h-1][re3+1]++;
            ans[0][n]=h;
            ans[1][n]=re3+1;
            ans[2][n]=h;
            ans[3][n]=re3+2;
            n++;
        }
    }
    cout<<n<<endl;
    for(int i=0;i<n;i++){
        cout<<ans[0][i]<<" "<<ans[1][i]<<" "<<ans[2][i]<<" "<<ans[3][i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 9728
using System.Collections.Generic;
class MaxProfit
{
     public static void Main()
     {
         var inputNum = int.Parse(System.Console.ReadLine());
         int[] input = new int[inputNum];
         for(int i = 0; i < inputNum; ++i) {
             input[i] = int.Parse(System.Console.ReadLine());
         }
         
         int maxProfit = (1 << 30) * -1; // ?????§?????? ?????????????\??°????
         int minValue = input[0]; // ????°????
         for (int i = 1; i < input.Length; ++i) {
             if (maxProfit < input[i] - minValue) maxProfit = input[i] - minValue;
             if (minValue > input[i]) minValue = input[i]; // ??¢??????????°????
         }
         
         System.Console.WriteLine(maxProfit);
     }
}

Measured memory_bytes: 10888
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int a,b;
	int ans=0;
	cin >>a>>b;
	string s,t;
	int bef;
	for(int i=a;i<=b;i++){
		s="";
		bef=i;
		while(bef!=0){
			s+=((bef%10)+'0');
			bef/=10;
		}
		t=s;
		reverse(all(s));
		if(s==t){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3572
//
//  main.cpp
//  ProgrammingContestChallengeBook2
//
//  Created by Hisaki Kobayashi on 2020/04/04.
//  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <string>
#include <bits/stdc++.h>
#include <stdlib.h>
//#include "mylibrary.hpp"



using namespace std;


int main(){
    string S; cin >> S;
    if(S[0]=='B' && S[1]=='B' && S[2]=='B')
        cout << "No" << endl;
    else if(S[0]=='A' && S[1]=='A' && S[2]=='A')
        cout << "No"<< endl;
    else{
        cout << "Yes"<< endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#define abs lolabs

using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

inline int64_t abs(int64_t x) { return x > 0 ? x : -x; }

int n;
int64_t a[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
}

int64_t psum[MAXN];

int64_t sum(int l, int r) 
{
	if(!l) return psum[r];
	return psum[r] - psum[l - 1];
}

int64_t Pmx[MAXN], Pmn[MAXN];
int64_t Smx[MAXN], Smn[MAXN];

void solve()
{
	for(int i = 0; i < n; i++) psum[i] = (i ? psum[i - 1] : 0) + a[i];

	for(int i = 1; i < n; i++)
	{
		/*int low = 0, high = i - 1, mid, ret = i - 1;
		  while(low <= high)
		  {
		  mid = (low + high) >> 1;
		  if(sum(0, mid) <= sum(mid + 1, i))
		  ret = mid, low = mid + 1;
		  else 
		  high = mid - 1;
		  }
		  */

		//mid = ret;
		/*int64_t df = (int64_t)1e18;
		  for(int p = 0; p <= i - 1; p++)
		  chkmin(df, abs(sum(0, p) - sum(p + 1, i)));

		  Pmx[i] = Pmn[i] = (sum(0, i) - df) / 2ll;
		  Pmx[i] += df;*/


		int low = 0, high = i - 1, mid, ret = 0;
		while(low <= high)
		{
			mid = (low + high) >> 1;
			if(sum(0, mid) <= sum(mid + 1, i))
				ret = mid, low = mid + 1;
			else 
				high = mid - 1;
		}

		mid = ret;
		if(mid + 1 < i && abs(sum(0, mid + 1) - sum(mid + 2, i)) < abs(sum(0, mid) - sum(mid + 1, i)))
			mid++;

		int64_t df = abs(sum(0, mid) - sum(mid + 1, i));
		Pmx[i] = Pmn[i] = (sum(0, i) - df) / 2ll;
		Pmx[i] += df;

	}

	for(int i = n - 2; i >= 0; i--)
	{
		/*int low = i, high = n - 2, mid, ret = i;
		  while(low <= high)
		  {
		  mid = (low + high) >> 1;
		  if(sum(i, mid) >= sum(mid + 1, n - 1))
		  ret = mid, high = mid - 1;
		  else 
		  low = mid + 1;
		  }*/

		//mid = ret;
		/*int64_t df = (int64_t)1e18;
		  for(int p = i; p <= n - 2; p++)
		  chkmin(df, abs(sum(i, p) - sum(p + 1, n - 1)));

		  Smx[i] = Smn[i] = (sum(i, n - 1) - df) / 2ll;
		  Smx[i] += df;*/

		int low = i, high = n - 2, mid, ret = n - 2;
		while(low <= high)
		{
			mid = (low + high) >> 1;
			if(sum(i, mid) >= sum(mid + 1, n - 1))
				ret = mid, high = mid - 1;
			else 
				low = mid + 1;
		}

		mid = ret;
		if(mid - 1 >= i && abs(sum(i, mid - 1) - sum(mid, n - 1)) < abs(sum(i, mid) - sum(mid + 1, n - 1)))
			mid--;

		int64_t df = abs(sum(i, mid) - sum(mid + 1, n - 1));
		Smx[i] = Smn[i] = (sum(i, n - 1) - df) / 2ll;
		Smx[i] += df;			
	}

	int64_t answer = (int64_t)1e18;
	for(int i = 1; i < n - 2; i++)
	{
		vector<int64_t> li;
		li.push_back(Pmn[i]);
		li.push_back(Pmx[i]);
		li.push_back(Smn[i + 1]);
		li.push_back(Smx[i + 1]);
		sort(li.begin(), li.end());	
		chkmin(answer, li[3] - li[0]);
	}

	cout << answer << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
using Graph = vector <vector<int>>;

vector<int> rabel(100001,0);
void dfs(const Graph &friends,int v,int ctr,vector<int>& treeno){
  rabel.at(v) = ctr;
  
  treeno[ctr]++;

  for(auto next_v : friends[v]){
    if(rabel.at(next_v)) continue;
    else dfs(friends,next_v,ctr,treeno);
  }
}

int main(){
  int n,m,k;
  cin >> n >> m >> k;
 
  Graph friends(n+1);
  vector<int> friendsno(n+1,0),frtreeno(n+1,0);
  for(int i=0; i<m; i++){
    int a,b;
    cin >> a >> b;
    friends[a].push_back(b);friendsno[a]++;
    friends[b].push_back(a);friendsno[b]++;
  }
  //cout << friends.at(1).at(0) << endl;
  int tree_ctr=1;
  for(int i=1; i<=n;i++){
    if(!rabel.at(i)){
      dfs(friends,i,tree_ctr,frtreeno);
      tree_ctr++;
    }
  }
  //cout << frtreeno.at(1) << endl;
  //cout << friendsno.at(1) << endl;
  vector<int> answer(n+1);
  for(int i=1; i<=n; i++){
      answer.at(i)
        =frtreeno.at(rabel.at(i)) - friendsno.at(i) - 1;
    }

  for(int i=0; i<k; i++){
    int c,d;
    cin >> c >> d;
    
      
    if(rabel.at(c)==rabel.at(d)){
      answer.at(c)--;
      answer.at(d)--;
    }
  }
  for(int i=1; i<=n; i++)
    cout << answer.at(i) << endl;
  
  return 0;
}

Measured memory_bytes: 8704
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll n;
    cin  >> n ;

    cout << n*n << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256