akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N;
vector<pair<int,int> > A;

int main(void){
    cin>>N;
    REP(i,N){
        int a;
        cin>>a;
        A.pb(mp(a,i));
    }
    sort(ALL(A));
    int ans=0;
    REP(i,N)
        if(A[i].second%2!=i%2)
            ans++;
    cout<<ans/2<<endl;
    return 0;
}

Measured memory_bytes: 1400
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
# define debug cerr<<"ERROR"<<endl
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

typedef long long ll;
typedef pair<int,int> pii;

const int dx[]={1,0,-1,0,-1,-1,1,1};
const int dy[]={0,1,0,-1,-1,1,-1,1}; 
const int inf=1e9,mod=1e9+7,N=2e5+5;

int cnt[N];

void solve(){
	int n,k,q;
	cin>>n>>k>>q;
	forn(i,q){
		int x;
		cin>>x;
		cnt[x]++;
	}	
	forn(i,n){
		if(q-cnt[i]<k){
			cout<<"Yes\n";
		}
		else cout<<"No\n";
	}
}

int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}

Measured memory_bytes: 4024
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <queue>
#include <deque>
#include <vector>
#define maxc 100010
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
int main()
{
    int n;
    char a[300005];
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i];
    int sum=0;
    for(int i=1; i<n; i++)
    {
        if(a[i]=='E')
            sum++;
    }
    int k=sum;
    int sum1=sum;
    for(int i=0; i<n-1; i++)
    {

        if(a[i]=='E'&&a[i+1]=='E')
        {
            sum1=sum1-1;
        }
        if(a[i]=='W'&&a[i+1]=='W')
        {
            sum1=sum1+1;
        }
        k=min(sum1,k);
    }
cout<<k<<endl;
return 0;


}




Measured memory_bytes: 512
<?php
list($n) = ints();
list($k) = ints();
$x = 1;
for ($i = 0; $i < $n; ++$i) {
    if ($x > $k) $x += $k;
    else $x *= 2;
}
echo $x;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 4604
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B;
	cin >> A >> B;

	cout << ((A * B % 2) ? "Yes" : "No") << "\n";

	return 0;
}

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

using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    ll x, y;
    cin >> x >> y;

    ll ans = INF;
    rep (i, 2) {
        rep (j, 2) {
            ll xx, yy;
            if (i == 0) xx = x;
            else xx = -x;
            if (j == 0) yy = y;
            else yy = -y;

            ll temp = i + j;
            if (xx > yy) continue;
            temp += yy - xx;
            chmin(ans, temp);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

int main(){
  ll r,d,x; cin >> r >> d >> x;
  for(int i = 0; i < 10; i++){
    x = r * x - d;
    cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
/*
void chmin(ll a, ll b){if (a>b){a = b; return true;}return false;}
void chmax(ll a, ll b){if (a<b){a = b; return true;}return false;}
*/

const ll MOD = 1000000007;
const ll INF = 9999999999;

int main() {
  string s; cin >>s;
  int n = s.size();
  vector<int> ans(2, -1);
  if (s.at(0) == s.at(1)){
    ans.at(0) = 1, ans.at(1) = 2;
  }
  for (int i=2; i<n; i++){
    int ai = i-2, bi = i-1;
    char a = s.at(ai), b = s.at(bi);
    char c = s.at(i);
    if (a == c){
      ans.at(0) = ai+1, ans.at(1) = i+1;
      break;
    }else if (b == c){
      ans.at(0) = bi+1, ans.at(1) = i+1;
      break;
    }
  }
  cout <<ans.at(0) <<" " <<ans.at(1) <<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <functional>
#include <queue>
using namespace std;

int N, M, L[200009], R[200009];
vector<int>vec[200009];
priority_queue<int, vector<int>, greater<int>>Q;

int main() {
	cin >> N >> M; M++;
	for (int i = 1; i <= N; i++) {
		cin >> L[i] >> R[i]; vec[L[i]].push_back(R[i]);
	}
	for (int i = M; i > N; i--) {
		for (int j : vec[i]) Q.push(M - j);
	}
	int P = M - 1;
	for (int i = N; i >= 1; i--) {
		for (int j : vec[i]) Q.push(M - j);
		if (!Q.empty()) { Q.pop(); P--; }
	}
	for (int j : vec[0]) Q.push(M - j);

	vector<int>v; while (!Q.empty()) { v.push_back(Q.top()); Q.pop(); }
	int B = 1, cnt = v.size();
	for (int i = 0; i < v.size(); i++) {
		if (B > P) break;
		if (B <= v[i]) { B++; cnt--; }
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 10744
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while (n != 0) {
			String[] pointAry = br.readLine().split(" ");
			double total = 0;
			for (int i = 0; i < n; i++) {
				total += Integer.parseInt(pointAry[i]);
			}
			double mean = total / n;
			double var = 0;
			for (int i = 0; i < n; i++) {
				var += Math.pow(Integer.parseInt(pointAry[i]) - mean, 2);
			}
			System.out.println(Math.sqrt(var / n));
			n = Integer.parseInt(br.readLine());
		}
	}
}

Measured memory_bytes: 25304
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int ans;
 
        while(true){
 
            try {
                String inputed = br.readLine();
                if(inputed.length() == 1 && inputed.equals("0"))break;
 
                ans = 0;
                for(int i = 0; i < inputed.length(); i++){
                    ans += inputed.charAt(i)-'0';
                }
 
                System.out.printf("%d\n", ans);
 
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}


Measured memory_bytes: 24972
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
N = int(input())

print(A[N-1])

Measured memory_bytes: 3060
N = int(input())
A = list(map(int,input().split()))	
flag = 0

for i in range(N):
	if A[i] % 2 == 0:
		if A[i] % 5 != 0 and A[i] % 3 != 0:
			flag = 1
			break

if flag==0:
	print("APPROVED")
else:
	print("DENIED")


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		if(n.indexOf("7")!=-1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35712
a = input().split(" ")
w = int(a[0])
h = int(a[1])
x = int(a[2])
y = int(a[3])
s = w * h / 2
if w % 2 == 0:
    if h %  2 == 0:
        if x == int(w/2):
            if y == int(h/2):
                how = 1
            else:
                how = 0
        else:
            how = 0
    else:
        how = 0
else:
    how = 0
print(str(s) + " " + str(how))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
#define _GLIBCXX_DEBUG
                    
using ll = long long;
using ull = unsigned long long;
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; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}


int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;

int main() {  
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  //入力
  int N; cin >> N;
  string S; cin >> S;

  //連続する"ABC"をカウント
  int count = 0;
  rep(i, N-2) {
    if(S.substr(i, 3) == "ABC") count++;
  }

  cout << count << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);
 
int main()
{
	vi a(5);
	rep(i,5) cin >> a[i];
	sort(all(a));
	int ans = INF;
	do{
		int sum = 0;
		for(int i = 0; i < 4; i++){
			int aa = a[i];
			while(aa%10) aa++;
			sum += aa;
		}
		ans = min(ans,sum+a[4]);
	}while(next_permutation(all(a)));
	cout << ans << endl;
	return 0;	
}

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

using namespace std;

#define int long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pb emplace_back
#define pf emplace_front
#define mp make_pair
#define ld long double
#define all(x) x.begin(), x.end()
#define uniq(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())

const int maxn = 3009;
int dp[maxn][maxn];
int mod = 998244353;

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    for (int i = x1; i <= x2; i++)
        for (int e = y1; e <= y2; e++)
    {
        if (i == x1 && e == y1)
        {
            dp[i][e] = 1;
            continue;
        }
        if (i == x1)
        {
            dp[i][e] = (dp[i][e - 1] * i) % mod;
            continue;
        }
        if (e == y1)
        {
            dp[i][e] = (dp[i - 1][e] * e) % mod;
            continue;
        }
        dp[i][e] = (dp[i][e - 1] * i + dp[i - 1][e] * e - (dp[i - 1][e - 1]) * ((e - 1) * (i - 1))) % mod;
        dp[i][e] = (dp[i][e] + mod) % mod;
//        cout << i << " " << e << " " << dp[i][e] << "\n";
    }
    cout << dp[x2][y2];
}


Measured memory_bytes: 74040
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e-8;
//typedef vector<int> vec;
typedef pair<int,int> P;
struct edge{int to,cost;};


typedef vector<char> vec;
typedef vector<vec> mat;
const int dx[] = {0,0,1,-1};
const int dy[] = {1,-1,0,0};
int X, Y;

struct State{
    int d,pn;
    char c;
    mat f;
    bool operator<(const State& right) const{
        return d == right.d ? pn < right.pn : d > right.d;
    }
};

int paint(int y, int x, char c, char nc, mat& f){
    f[y][x] = nc;
    int ret = 1;
    for(int i=0;i<4;i++){
        int nx = x+dx[i], ny = y+dy[i];
        if(nx<0||X<=nx||ny<0||Y<=ny||f[ny][nx]!=c) continue;
        ret += paint(ny, nx, c, nc, f);
    }
    return ret;
}

const char color[] = {'R','G','B'};
int dfs(int pn, mat& f){
    int turn = 100;
    for(int i=0;i<3;i++){
        if(f[0][0]==color[i])continue;
        mat nf = f;
        int npn = paint(0,0,f[0][0],color[i],nf);
        if(npn==X*Y) return 0;
        if(npn<=pn) continue;
        else turn = min(turn, 1+dfs(npn, nf));
    }
    return turn;
}

int main(){
    while(cin >> X >> Y, X){
        mat field(Y, vec(X));
        for(int i=0;i<Y;i++){
            for(int j=0;j<X;j++){
                cin >> field[i][j];
            }
        }
        priority_queue<State> que;
        //int d[100][100];
        //for(int i=0;i<100;i++)fill(d[i],d[i]+100,INF);
        int d[101];fill(d,d+101,INF);
        d[0] = 0;
        que.push((State){0,0,field[0][0],field});
        bool ans_found = false;
        while(que.size()){
            State p = que.top(); que.pop();
            if(d[p.pn]<p.d) continue;
            for(int i=0;i<3;i++){
                if(p.c==color[i])continue;
                mat nf = p.f;
                int npn = paint(0,0,p.f[0][0],color[i],nf);
                if(npn == X*Y){
                    ans_found = true;
                    break;
                }
                if(npn <= p.pn) continue;
                if(d[npn]<p.d+1) continue;
                d[npn] = p.d+1;
                que.push((State){p.d+1,npn,color[i],nf});
            }
            if(ans_found){
                cout << p.d << endl;
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1560
package main
import (
  "fmt"
  "sort"
)
func main() {
  var n,x,y,m int
  red := Points{}
  blue := Points{}
  fmt.Scan(&n)
  for i:=0;i<n;i++ {
    fmt.Scan(&x,&y)
    red = append(red,Point{x,y})
  }
  for i:=0;i<n;i++ {
    fmt.Scan(&x,&y)
    blue = append(blue,Point{x,y})
  }
  sort.Sort(sort.Reverse(red))
  sort.Sort(blue)
  m = 0
  for j:=0;j<blue.Len();j++ {
    p := Point{blue[j].x-1,-1}
    k := -1
    for i:=0;i<red.Len();i++ {
      if red[i].x < blue[j].x && red[i].y < blue[j].y &&
      p.y < red[i].y {
        p = red[i]
        k = i
      }
    }
    if k >= 0 {
      red[k] = Point{100000,100000}
      m++
    }
  }
  fmt.Println(m)
}
func abs(n int) int {
  if n < 0 { return -n }
  return n
}
type Point struct {
  x int
  y int
}
func(p Point) equals(t Point) bool {
  return p.x == t.x && p.y == t.y
}
type Points []Point
func(ps Points) Len() int {
  return len(ps)
}
func(ps Points) Swap(i,j int) {
  ps[i],ps[j] = ps[j],ps[i]
}
func(ps Points) Less(i,j int) bool {
  if ps[i].x == ps[j].x {
    return ps[i].y < ps[j].y
  } else {
    return ps[i].x < ps[j].x
  }
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A, B, C;
    cin >> A >> B >> C;
    int ans = A == B ? C : (B == C ? A : B);
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int N,flg=0,i;
    char S[100],c;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%c",&c);
        if(c=='Y') flg = 1;
    }
    if(flg==0){
        printf("Three\n");
    }
    else{
        printf("Four\n");
    }
    return 0;

}

Measured memory_bytes: 128
//#include <bits\stdc++.h>
#include<chrono>
#include<iostream>
#include<sstream>
#include<iomanip>
using namespace std;
#define all(v) begin(v),end(v)
#define rall(v) rbegin(v),rend(v)
using ld = long double;
using ll = long long;
using pll = pair<ll, ll>;
//-----------------------------

void solve()
{
	tm a{}, b{};
	cin >> get_time(&a, "%Y/%m/%d");
	stringstream ss("2019/04/30");
	ss >> get_time(&b, "%Y/%m/%d");
	auto x1 = chrono::system_clock::from_time_t(mktime(&a));
	auto x2 = chrono::system_clock::from_time_t(mktime(&b));
	auto res = x1 - x2;
	cout << ((res.count() <= 0) ? "Heisei" : "TBD" );
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
#ifdef LocaL
	freopen("input.txt", "r+", stdin);
	freopen("output.txt", "w+", stdout);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 256
//https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/14/ALDS1_14_B
#include <string>
#include <vector>
#include <tuple>
#include <iostream>
#include <set>
#include <cassert>

struct HashString{
public:
    using hashtype=long long;
    using hashcomptype=std::tuple<hashtype,hashtype,hashtype>;

    std::vector<hashtype> table1;
    std::vector<hashtype> table2;
    std::vector<hashtype> table3;
    std::vector<hashtype> powtable1;
    std::vector<hashtype> powtable2;
    std::vector<hashtype> powtable3;

    hashtype mod=1000000007ll;
    hashtype base1=1919ll;
    hashtype base2=114514ll;
    hashtype base3=334334ll;

    HashString(){}
    HashString(std::string s){
        table1.resize(s.size()+1);
        table2.resize(s.size()+1);
        table3.resize(s.size()+1);
        powtable1.resize(s.size()+1);
        powtable2.resize(s.size()+1);
        powtable3.resize(s.size()+1);

        table1[0]=0ll;
        table2[0]=0ll;
        table3[0]=0ll;
        powtable1[0]=1ll;
        powtable2[0]=1ll;
        powtable3[0]=1ll;

        for(int i=0;i < s.size(); ++i){
            table1[i+1]=table1[i]*base1+s[i];
            table2[i+1]=table2[i]*base2+s[i];
            table3[i+1]=table3[i]*base3+s[i];
            powtable1[i+1]=powtable1[i]*base1;
            powtable2[i+1]=powtable2[i]*base2;
            powtable3[i+1]=powtable3[i]*base3;

            table1[i+1]=table1[i+1]%mod;
            table2[i+1]=table2[i+1]%mod;
            table3[i+1]=table3[i+1]%mod;
            powtable1[i+1]=powtable1[i+1]%mod;
            powtable2[i+1]=powtable2[i+1]%mod;
            powtable3[i+1]=powtable3[i+1]%mod;
        }
    }

    bool operator == (HashString s){
        if(this->table1.size()!=s.table1.size())return false;
        if(this->table1.back()!=s.table1.back())return false;
        if(this->table2.back()!=s.table2.back())return false;
        if(this->table3.back()!=s.table3.back())return false;
        return true;//maybe :)
    }

    hashcomptype get_hash(int l,int r){//[l,r)でのhash
        //assert(r-l>0);

        hashtype hash1=table1[r]-(powtable1[r-l]*table1[l]%mod);
        while(hash1<0)hash1+=mod;
        hash1=hash1%mod;

        hashtype hash2=table2[r]-(powtable2[r-l]*table2[l]%mod);
        while(hash2<0)hash2+=mod;
        hash2=hash2%mod;

        hashtype hash3=table3[r]-(powtable3[r-l]*table3[l]%mod);
        while(hash3<0)hash3+=mod;
        hash3=hash3%mod;

        //std::cout<<hash1<<" "<<hash2<<" "<<hash3<<std::endl;
        return std::make_tuple(hash1,hash2,hash3);
    }
};

int main(){
    std::string t,p;
    std::cin>>t>>p;
    HashString ht(t);
    HashString hp(p);
    
    /*
    int l1,r1,l2,r2;
    std::cin>>l1>>r1>>l2>>r2;
    std::cout<<t.substr(l1,r1-l1)<<" "<<p.substr(l2,r2-l2)<<std::endl;
    if(ht.get_hash(l1,r1)==hp.get_hash(l2,r2))std::cout<<"same"<<std::endl;
    else std::cout<<"different"<<std::endl;
    */
    
    
    for(int i=0;i+p.size() <= t.size(); ++i){
        if(ht.get_hash(i,i+p.size())==hp.get_hash(0,p.size())){
            printf("%d\n",i);
        }
    }
    
    
    return 0;
}



Measured memory_bytes: 52004
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int N;
	int D[100000];
	int R=0;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>D[i];
	}
	int a1=1,a2=1,a3=1;
	for(int i=1;i<N;i++){
		if(D[i]==D[i-1]){
			R=max(R,a3);
			a3=a2+1;
			a2=a1+1;
			a1=1;
		}
		if(D[i]!=D[i-1]){
			a1+=1;
			a2+=1;
			a3+=1;
		}

	}
	R=max(R,a1);
	R=max(R,a2);
	R=max(R,a3);

	cout<<R<<endl;
	return 0;
}

Measured memory_bytes: 3480
#include <stdio.h>
	
int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	if (a > b)
		printf("a > b\n", a, b);
	else if (a < b)
	    printf("a < b\n", a, b);
	else
	    printf("a == b\n", a, b);
	return 0;
}

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

public class Main {
  public static void main(String[] args) {
    FastScanner fs = new FastScanner();

    String S = fs.next();
    for (int i = 0; i < S.length(); i++) System.out.print('x');
  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte())
    return buffer[ptr++];
    else
    return -1;
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  public boolean hasNext() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr]))
    ptr++;
    return hasNextByte();
  }

  public String next() {
    if (!hasNext())
    throw new NoSuchElementException();
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public long nextLong() {
    if (!hasNext())
    throw new NoSuchElementException();
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
      throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public int nextInt() {
    long nl = nextLong();
    if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
    throw new NumberFormatException();
    return (int) nl;
  }

  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int

const int lim = (int)1e5;
const int base = (int)1e5 + 1;
unordered_map<int, int> dp;
unordered_map<int, bool> vis;

const int MOD = (int)1e9 + 7;
vi fac((int)1e5 + 1), inv((int)1e5 + 1), nex((int)1e5 + 1);
vi in;
long long inv2(long long a, long long b){
    return 1<a ? b - inv2(b%a,a)*b/a : 1;
}
int solve(int x,int prev){
    int hash = x*base + prev;
    if(vis[hash]){
    //    cout << "used hash" <<endl;
        return dp[hash]; 
    }
    vis[hash] = true;
    int lim = nex[x]; 
    int& ans = dp[hash];
    ans = fac[prev];
    ans *= (lim == -1)? 1: inv[lim + 1]; 
    ans %= MOD;
    if(lim == -1){
        ans *= x;
        ans %= MOD;
        return ans;
    }
    int ans2 = 0;
    FOR(i, lim+1){
        ans2 += solve(x % in[i], lim);
        ans2 %= MOD;
    }
    ans *= ans2;
    ans %= MOD;
    //debug(ans);
    return ans;
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    int n;cin >> n;
    int x;cin >> x;
    in.resize(n);
    FOR(i ,n)cin >> in[i];
    sort(in.begin(), in.end());
    fac[0] = 1;
    FOR1(i, lim)fac[i] = i*fac[i-1], fac[i] %= MOD;
    FOR1(i, lim)inv[i] = inv2(fac[i], MOD);

    int start = 0;
    FOR(i, in.size()){
        while(start < in[i]){
            nex[start] = i -1;
            start++;
        } 
    }
    while(start <= 1e5)nex[start++] = in.size() -1;
    //    FOR(i, 100)cout << i << " " << nex[i] <<endl;
    cout << solve(x, n);


}




Measured memory_bytes: 15468
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

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

ll s[100001];
int dp[100001];

int main(void) {
    int i, n;
    ll a, b;
    scanf("%d%lld%lld",&n,&a,&b);
    if (a > b) swap(a,b);
    REP (i,1,n) scanf("%lld",&s[i]);
    REP (i,1,n-2) if (s[i+2] - s[i] < a) {
        puts("0");
        return 0;
    }

    s[0] = -INF;
    dp[0] = 1;
    int sum = 0, r = 0;
    REP (i,1,n) {
        for (; r < i && s[i] - s[r] >= b; r++) {
            sum = (sum + dp[r]) % MOD;
        }
        dp[i] = sum;
        if (s[i] - s[i-1] < a) {
            sum = 0;
            r = i-1;
        }
    }
    REP (i,r,n) sum = (sum + dp[i]) % MOD;
    printf("%d\n",sum);
    return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */


int main(){
    int n; cin>>n; n%=10;
    if(n==2 || n==4 || n==5 || n==7 || n==9) out("hon");
    else if(n==3) out("bon");
    else out("pon");
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for(int i = (l); i < (r); ++i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
//-------
const int N = 101010, M = 4040;
int n, m;
int wt[M][M], bk[M][M];
const int OFF = 1;
int qry(int x, int y, int c[][M]) {
	x += OFF, y += OFF;
	int a = x + m, b = y + m;
	return c[a - 1][b - 1] + c[x - 1][y - 1] - c[x - 1][b - 1] - c[a - 1][y - 1];
}
int main() {
	scanf("%d%d", &n, &m);
	int k = m * 2;
	rep(i, 0, n) {
		int a, b; char c[2];
		scanf("%d%d%s", &a, &b, c);
		c[0] == 'W' ? wt[a % k + OFF][b % k + OFF]++ : bk[a % k + OFF][b % k + OFF]++;
	}
	rep(i, OFF, k + OFF) rep(j, OFF, k + OFF) {
		wt[i + k][j] = wt[i][j + k] = wt[i + k][j + k] = wt[i][j];
		bk[i + k][j] = bk[i][j + k] = bk[i + k][j + k] = bk[i][j];
	}
	rep(i, OFF, k + k + OFF) rep(j, OFF, k + k + OFF) {
		wt[i][j] = wt[i][j - 1] + wt[i][j];
		bk[i][j] = bk[i][j - 1] + bk[i][j];
	}
	rep(i, OFF, k + k + OFF) rep(j, OFF, k + k + OFF) {
		wt[i][j] = wt[i - 1][j] + wt[i][j];
		bk[i][j] = bk[i - 1][j] + bk[i][j];
	}
//	de(qry(0, 0, wt));
	int ans = 0;
	rep(i, 0, m) rep(j, 0, m) {
		int w = qry(i, j, wt) + qry(i + m, j + m, wt) + qry(i + m, j, bk) + qry(i, j + m, bk);
		int b = qry(i, j, bk) + qry(i + m, j + m, bk) + qry(i + m, j, wt) + qry(i, j + m, wt);
		ans = max(ans, max(w, b));
	}
	printf("%d\n", ans);
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  string s;
  cin>>s;
  int n=s.size();
  rep(i,n)cout<<'x';
  cout<<endl;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  if(a % x == 0){
    cout << b / x - a / x + 1 << "\n";
  }
  else {
    cout << b / x - a / x << "\n";
  }
}

Measured memory_bytes: 256
def main():
    N = int(input())
    S, T = [], []
    for _ in range(N): 
        s, t = input().split()
        S.append(s)
        T.append(int(t))
    X = input()
    i = S.index(X)
    print(sum(T[i+1:]))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

char buf[99];

int main(){
    int i;

    for(;~scanf("%[^\n] ",buf);){
        for(i=0;;i++){
            if( buf[i]-buf[i+1]==12 || buf[i]-buf[i+1]==-14 ){
                break;
            }
        }
        int sa = buf[i] - 't';
        for(i=0; buf[i]!='\0'; i++){
            if( 'a' <= buf[i] && buf[i]<='z' ){
                int tmp = buf[i] - sa;
                putchar( tmp + (tmp<'a' ? 26 : tmp>'z' ? -26 : 0) );
            }
            else{
                putchar(buf[i]);
            }
        }
        puts("");
    }
    return 0;
}

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

int main() {
    vector<pair<int,int> > hw;
    for (int i = 0; ; i++) {
        int h,w;
        cin >> h >> w;
        if (h == 0 && w == 0) {
            break;
        }
        pair<int,int> p(h,w);
        hw.push_back(p);
    }
    for (int i = 0; i < hw.size(); i++) {
        for (int j = 0; j < hw.at(i).first; j++) {
            for (int k = 0; k < hw.at(i).second; k++) {
                if (j % 2 == 1) {
                    if (k % 2 == 1) {
                        printf("#");
                    } else {
                        printf(".");
                    }
                } else {
                    if (k % 2 == 1) {
                        printf(".");
                    } else {
                        printf("#");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,n) for(int i = n - 1; i >= 0; i--)
#define REP(i,k,n) for(int i = k; i < n; i++)

#define vi vector<int>
#define pb push_back
using namespace std;

typedef long long ll;

int main(){

    int n;
    cin >> n;
    rep(i,n){
        int y,m,d;
        cin >> y >> m >> d;
        //誕生年は含まないで計算
        int by = 999 / 3 - y / 3;
        int sy = (999 - y) - by;
        ll sday = by * 20 * 10 + sy * (20 * 5 + 19 * 5);
        if(y % 3 == 0) {
            sday += (20 - d + 1) + (10 - m) * 20;
        }else{
            if(m % 2 == 1) {
                sday += (20 - d + 1) + (10 - m) / 2 * 20 + ((10 - m) / 2 + 1) * 19;
            }else{
                sday += (19 - d + 1) + (10 - m) / 2 * 19 + (10 - m) / 2 * 20;
            }
        }
        cout << sday << endl;
    }

    return 0;

}



Measured memory_bytes: 2980
#include<bits/stdc++.h>
using namespace std;
const int maxn=110;
int n;
struct node
{
	string s;
	int x,b;
}a[maxn];
inline bool cmp(node x,node y)
{
	return (x.s<y.s || x.s==y.s && x.x>y.x);
}
int main()
{
	scanf("%d",&n);
	for(register int i=1;i<=n;i++)
	{
		cin>>a[i].s>>a[i].x;
		a[i].b=i;
	}
	sort(a+1,a+n+1,cmp);
	for(register int i=1;i<=n;i++)
		printf("%d\n",a[i].b);
	return 0;
}

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

int main(void){
	long X;
	std::cin>>X;
	long max=0;
	for(int i=1;i<40;i++){
		for(int j=2;j<20;j++){
			long cand = std::pow(i,j);
			if(cand <= X){
				if(cand > max){
					max = cand;
				}
			}
		}
	}

	std::cout<<max<<std::endl;
	return 0;
}


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n;
  cin >> n;
  vector<int> v, c;
  load(v, n);
  load(c, n);

  int score = 0;
  rep(i, n) {
    score += max(v[i] - c[i], 0);
  }
  p(score);
}

Measured memory_bytes: 256
package main

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

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}

func main() {
	n := nextInt()
	m := nextInt()

	broken := make([]int, n+1)
	patterns := make([]int, n+1)

	for i := 0; i < m; i++ {
		pos := nextInt()
		broken[pos] = 1
	}

	patterns[0] = 1

	if broken[1] == 1 {
		patterns[1] = 0
	} else {
		patterns[1] = 1
	}

	for i := 2; i <= n; i++ {
		if broken[i] == 1 {
			// 壊れていれば通れない
			patterns[i] = 0
		} else {
			patterns[i] = (patterns[i-1] + patterns[i-2]) % 1000000007
		}
	}

	fmt.Println(patterns[n])
}


Measured memory_bytes: 2816
#include<stdio.h>

int main(){
	int n,a;
	while(scanf("%d",&n)!=EOF){
		if(n==-1)break;
		a=4280-1150;
		if(n>30)a-=160*(n-30),n=30;
		if(n>20)a-=140*(n-20),n=20;
		if(n>10)a-=125*(n-10);
		printf("%d\n",a);
	}
	return 0;
}

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

int main (){
  string S;
  cin >> S;
  
  if(S == "Sunny"){
    cout << "Cloudy" << endl;
  }
  
  else if(S == "Cloudy"){
    cout << "Rainy" << endl;
  }
  
  else if(S == "Rainy"){
    cout << "Sunny" << endl;
  }
}

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

int main() {

  int A, B, C = 0, p;
  cin >> A >> B;
  
  string a;
  bool chk;
  
  for (int i = A; i <= B; i++) {
    a = std::to_string(i);
    chk = true;

    for (int j = 0; j < a.size(); j++) {
      p = a.size() - j -1;
      if (j >= p) {
        break;
      }

      if (a.at(j) != a.at(p)) {
        chk = false;
        continue;
      }
    }
    if (chk) C++;
  }
  
  cout << C << endl;
}

Measured memory_bytes: 256
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;
using namespace literals;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (auto& v : S)cin >> v;
  auto to_index = [](int x, int y) { return x + y * 20; };
  auto to_coord = [](int index, int& x, int& y) { y = index / 20, x = index % 20; };
  constexpr int INF = INT_MAX / 2;
  const int MAX = W + H * 20;
  vector<vector<int>> dp(MAX, vector<int>(MAX, INF));
  for (int y = 0; y < H; ++y)
    for (int x = 0; x < W; ++x) {
      if (S[y][x] == '#')continue;
      dp[to_index(x, y)][to_index(x, y)] = 0;
      if (x > 0 && S[y][x - 1] == '.')dp[to_index(x, y)][to_index(x - 1, y)] = 1;
      if (x < W - 1 && S[y][x + 1] == '.')dp[to_index(x, y)][to_index(x + 1, y)] = 1;
      if (y > 0 && S[y - 1][x] == '.')dp[to_index(x, y)][to_index(x, y - 1)] = 1;
      if (y < H - 1 && S[y + 1][x] == '.')dp[to_index(x, y)][to_index(x, y + 1)] = 1;
    }
  for (int k = 0; k < MAX; ++k)
    for (int u = 0; u < MAX; ++u)
      for (int v = 0; v < MAX; ++v)
        dp[u][v] = min(dp[u][v], dp[u][k] + dp[k][v]);
  int ans = 0;
  for (int x1 = 0; x1 < W; ++x1)for (int y1 = 0; y1 < H; ++y1)
    for (int x2 = 0; x2 < W; ++x2)for (int y2 = 0; y2 < H; ++y2) {
      if (x1 == x2 && y1 == y2)continue;
      if (S[y1][x1] != '.' || S[y2][x2] != '.')continue;
      ans = max(ans, dp[to_index(x1, y1)][to_index(x2, y2)]);
    }
  cout << ans << endl;
}


Measured memory_bytes: 1152
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		100000									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// ソート関数 - int昇順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// int昇順
	if (*lipVal1 > *lipVal2) {
		return 1;
	}
	else if (*lipVal1 < *lipVal2) {
		return -1;
	}

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);
	if (siACnt % 2 != 0) {
		return 0;
	}

	// 配列 - 取得
	for (i = 0; i < siACnt; i++) {
		fscanf(szpFpI, "%d", &si1Array[i]);
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 配列 - ソート
	qsort(si1Array, siACnt, sizeof(int), fSortFnc);

	return si1Array[siACnt / 2] - si1Array[siACnt / 2 - 1];
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOut(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 892
#include <stdio.h>

int main(void)
{
	int i=1,c=0;
	unsigned long long a,b;
	scanf("%lld %lld",&a,&b);
	while(i){
		if(a<=b){
			c=c+1;
		}
		if(a>b){
			i=0;
		}
		a=a*2;
	}
	printf("%d",c);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <chrono>
#include <random>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
#include<string>
using namespace std;

#define ll long long
typedef pair<ll , ll > pii;
const int MOD = 998244353;
const int N=500004;

vector<int> BIT;

void update(int i, int add)
{
    while (i > 0 && i < BIT.size())
    {
        BIT[i] += add;
        i = i + (i & (-i));
    }
}

int sum(int i)
{
    int ans = 0;
    while (i > 0)
    {
        ans += BIT[i];
        i = i - (i & (-i));
    }

    return ans;
}
int findKthSmallest(int k)
{
    int l = 0;
    int h = BIT.size();
    while (l < h)
    {
        int mid = (l + h) / 2;
        if (k <= sum(mid))
            h = mid;
        else
            l = mid+1;
    }

    return l;
}

void insertElement(int x)
{
    update(x, 1);
}

void deleteElement(int x)
{
    update(x, -1);
}

int findRank(int x)
{
    return sum(x);
}

///


void min_self(int &a , int b){
    a=min(a,b);
}

int add(int x, int y)
{
    return (x + y) % MOD;
}

int sub(int x, int y)
{
    return add(x, MOD - y);
}

int mul(int x, int y)
{
    return (x * 1ll * y) % MOD;
}

int binpow(int x, int y)
{
    int z = 1;
    while(y > 0)
    {
        if(y % 2 == 1)
            z = mul(z, x);
        x = mul(x, x);
        y /= 2;
    }
    return z;
}

int inv(int x)
{
    return binpow(x, MOD - 2);
}

int fact[N];

int C(int n, int k)
{
    return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}
/////-----//////
int calc(int e){
    if( e == 0) return 0;
    int ans=0;
    for(int i=1; i<=100; i++){
        if(e>=i){
            ans++;
            e-=i;
        }
        else{
            break;
        }
    }
    return ans;
}




int  main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   //freopen("input.txt", "r", stdin);
   int n; cin>>n;
   vector<int> v1(n);
   vector<int> v2(n);
   for(int i=0; i<n; i++){
       int a,b; cin>>a>>b;
       v1[i]=a;
       v2[i]=b;
   }
   sort(v1.begin(),v1.end());
   sort(v2.begin(),v2.end());
   if(n%2 ==0){
       double mi=(1.0*v1[n/2-1]+1.0*v1[n/2])/2;
       double mx=(1.0*v2[n/2-1]+1.0*v2[n/2])/2;
       int ans=(mx-mi)*2.0+1.0;
       cout<<ans;
       return 0;
   }
   else{
       int mi=v1[(n+1)/2-1];
       int mx=v2[(n+1)/2-1];
       cout<<mx-mi+1;
       return 0;
   }
   return 0;
}


Measured memory_bytes: 4744
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

const ll MOD=1e9+7;
ll n=0,c[200010],k[200010]={},ans=0,dp[200010]={},rv[200010]={};
vector<ll> v[200010]={};
bool vis[200010]={};

ll ad(ll x,ll y=0){
  return (x+y)%MOD;
}

ll mlt(ll x,ll y=1){
  return (x*y)%MOD;
}

ll rec(ll i){
  if(vis[i]) return dp[i];
  vis[i]=1;
  if(i>=n-1) dp[i]=1;
  else{
    dp[i]=rec(i+1);
    ll j=rv[i];
    if(j<v[c[i]].size()-1) dp[i]=ad(dp[i],rec(v[c[i]][j+1]));
  }
  return dp[i];
}

int main(){
  ll m,b[200010],b0=0;
  cin>>m;
  fr(i,m) cin>>b[i];
  fr(i,m){
    if(b0!=b[i]){c[n++]=b[i];b0=b[i];}
  }
  fr(i,n){k[c[i]]++;rv[i]=v[c[i]].size();v[c[i]].pb(i);}
  cout<<rec(0)<<endl;
}

Measured memory_bytes: 22272
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main(){
	string s;
	int n,k;
	cin>>n>>k>>s;
	s[k-1]=s[k-1]-'A'+'a';
	cout<<s;
	return 0;
}

Measured memory_bytes: 256