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

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

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

#define MAX 100005
#define INF INT_MAX

vector<double> p, q;
vector< vector<double> > memo1; // 部分木の値(深さで重みづけ済み)
vector< vector<double> > memo2; // 部分木の値(深さで重みづけなし)

double obst(int l, int r)
{
    if (memo1[l][r]) return memo1[l][r];
    if (l == r) {
        memo1[l][r] = memo2[l][r] = q[l];
        return q[l];
    }

    double res = DBL_MAX;

    rep(i,r-l) {
        double lt = obst(l,l+i);
        double rt = obst(l+i+1,r);
        double rowt = p[l+i+1] + memo2[l][l+i] + memo2[l+i+1][r];
        double mg = rowt + rt + lt;
        if (mg < res) {
            res = mg;
            memo2[l][r] = rowt;
        }
    }

    memo1[l][r] = res;
    return res;
}

int main(int, char**)
{
    int n;
    cin >> n;
    p.assign(n+1, 0);
    q.assign(n+1, 0);
    memo1.assign(n+1, vector<double>(n+1, 0));
    memo2.assign(n+1, vector<double>(n+1, 0));

    rep(i,n) cin >> p[i+1];
    rep(i,n+1) cin >> q[i];

    printf("%.10f",obst(0, n));  
    return 0;
}



Measured memory_bytes: 6780
#include<bits/stdc++.h>
#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;

int n, d;

bool isOk(int x, int y) {
    long double dist = x * x + y * y;
    long double val = sqrt(dist);

    // dbg(val);

    return val <= (long double)d;

}


void solve() {
    cin >> n >> d;
    int ans = 0;

    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        if (isOk(x, y)) ans++;
    }

    cout << ans << endl;
}

// you should probably see down .. believe me it would help
int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
    int t_c = 1;
//    cin >> t_c;
    while (t_c--)
        solve();
}

// COME ON DUDE .... GIVING UP NOT GONNA HELP
// JUST GET YOUR ASS TO WORK ALREADY ..
// AND FOR FUCKING SAKE ... DONT PANIC !!


Measured memory_bytes: 3696
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;


int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > gg(n);
    rep(i, n) {
        int a,b;
        cin >> a >> b;
        gg[i] = make_pair(a, b);
    }

    sort(gg.begin(), gg.end());
    int j=0;
    priority_queue<int> pq;
    int ans = 0;
    rep(i, m) {
        int i_ = i+1;
        
        while(gg[j].first <= i_) {
            pq.push(gg[j].second);
            ++j;
        }
        if(!pq.empty()) {
            ans += pq.top();
            pq.pop();
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, seisu) for(int i = 0; i < (int)(seisu); i++)
typedef long long ll;


int main(){
  int h, w;
  cin >> h >> w;
  char paint[h][w];
  rep(i, h){
    rep(j, w){
      cin >> paint[i][j];
    }
  }
  int x[4] = {0, 0, -1, 1};
  int y[4] = {-1, 1, 0, 0};
  int check;
  int f = 0;
  rep(i, h){
    rep(j, w){
      check = 0;
      if (paint[i][j] == '#'){
        rep(k, 4){
          int nx = i + x[k], ny = j + y[k];
          if(nx >= 0 && ny >= 0 && nx <= h && ny <= w && paint[nx][ny] == '#'){
            check ++;
          }
        }
        if (check == 0) f = 1;
      }
      
    }
  }
  if (f == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  }

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vb vector<bool>
#define vi vector<ll>
#define vs vector<string>
#define vvi vector<vi>
#define vii vector<pair<ll, ll>>
#define pii pair<ll, ll>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(a) (a).begin(), (a).end()
#define INF 1000*1000*1000
#define mod (INF + 7)
#define mod1 (mod-1)
#define endl '\n'
#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;

int main()
{
    int t;
    cin >> t;

    if(t < 1200)
        cout << "ABC" << endl;
    else if(t < 2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
#include <deque>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdlib>
#include <cassert>

#define el_cucuy ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long
#define pb push_back
#define bpc __builtin_popcount
#define pii pair <int, int>
#define f first
#define s second

const llong mxn = 4 * 1e5 + 3;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

llong q, n, m, a[mxn], dp[mxn];

int main(){
    ///freopen("input.txt", "r", stdin);
    ///freopen("output.txt", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i ++){
        cin >> a[i];
    }
    dp[1] = 0;
    dp[2] = abs(a[1] - a[2]);
    for (int i = 3; i <= n; i ++){
        dp[i] = min(abs(a[i - 1] - a[i]) + dp[i - 1], abs(a[i - 2] - a[i]) + dp[i - 2]);
    }cout << dp[n];
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)

using namespace std;
ll po(ll x)
{
  ll re = 1;
  for(ll i=1;i<=5;i++){
    re*=x;
  }
  return re;
}

void solve(){
  ll x;
  cin >> x;
  for(ll i=-1000;i<=1000;i++){
    for(ll j=-1000;j<=1000;j++){
      ll A = po(i);
      ll B = po(j);
      if(A-B == x){
        cout << i << " " << j << endl;
        return;
      }
    }
  }
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
   // cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
      solve();
        
    }
return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>

long long int comb(int n, int r)
{
  if (n == r || r == 0)
    return 1;
  else 
    return comb(n, r - 1) * (n - r + 1) / r;
}

int main(){
	int n,p,i,g=0,k=0;
	long long int t,cog=0,cok1=0,cok2=0;
	scanf("%d %d",&n,&p);
	for(i=0;i<n;i++){
		scanf("%d",&t);
		if(t%2==0){
			g++;	
		}else{
			k++;	
		}
	}
	
	
	for(i=1;i<=g;i++){
		cog+=comb(g,i);	
	}
	
	for(i=2;i<=k;i+=2){
		cok1+=comb(k,i);
	}
	
	for(i=1;i<=k;i+=2){
		cok2+=comb(k,i);	
	}
	
	if(p==0){
		t=1+cog+cok1+(cog*cok1);	
	}else{
		t=cok2+(cog*cok2);
	}
	
	printf("%lld\n",t);
	
return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using vv = vector<V<T>>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int a[5];
  REP(i,5) cin >> a[i];
  int k;
  cin >> k;
  sort(a,a+5);
  cout << (a[4]-a[0]<=k?"Yay!":":(") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef         long double      dl;
#define		pb              push_back
#define		PB              pop_back
#define		nn              "\n"
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define         arrsize(a)      (sizeof(a)/sizeof(a[0]))
//#define       arrsize(a)      (sizeof(a)/sizeof(*a))
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)
typedef        pair <int, int>   pii;
typedef       pair <ll, ll>      pll;
typedef      vector< pair <ll, ll> >      vpll;
typedef		vector<ll>      vll;
typedef		map<string,ll>      msl;
typedef		map<ll,ll>      mll;
//#define sort(x) sort(x.begin(), x.end())
#define MAX 1000005


int main()
{
 //O_O ;
   ll a,b,c;
   cin>>a>>b>>c;
   cout<<c<<ss<<a<<ss<<b<<nn;

    return 0;
}


Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
a=tx-sx
b=ty-sy
ans=""

ans="U"*b+"R"*a
ans+="D"*b+"L"*a

ans+="D"+"R"*(a+1)+"U"*(b+1)+"L"
ans+="U"+"L"*(a+1)+"D"*(b+1)+"R"

print(ans)


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

using namespace std;

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

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

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  ll n;
  cin >> n;

  map<ll,ll> m;

  rep(i,n)
  {
    ll buf;
    cin >> buf;

    if(buf % 4 == 0)
    {
      m[4]++;
    }
    else if(buf % 2 == 0)
    {
      m[2]++;
    }
    else
    {
      m[1]++;
    }
  }

  bool ans = true;
  if(m[4] < m[1])
  {
    ans = false;
  }
  
  if(m[2] == 0 && m[4] + 1 == m[1])
  {
    ans = true;
  }

  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

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

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


Measured memory_bytes: 256
import numpy as np
from scipy.sparse import csgraph
H, W = map(int, input().split())
maze = "".join(input() for _ in range(H))
array = np.zeros((H * W, H * W), dtype=np.bool)
for n in range(H * W):
    if maze[n] == "#":
        continue
    r, c = divmod(n, W)
    if c and maze[n - 1] == ".":
        array[n][n - 1] = 1
        array[n - 1][n] = 1
    if r and maze[n - W] == ".":
        array[n][n - W] = 1
        array[n - W][n] = 1
dist = csgraph.shortest_path(array)
print(int(dist[dist < 401].max()))

Measured memory_bytes: 19260
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;
 
#define pai 3.14159265359
#define mod 1000000007

int main()
{
    long long int a, b, c;
    cin >> a >> b >> c;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << endl;
    else cout << min(b * c, min(c * a, a * b)) << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	week := []string{"fri", "sat", "sun", "mon", "tue", "wed", "thu"}

	var day int
	fmt.Scan(&day)
	dayOfWeek := -1
	for i := 0; i < day; i++ {
		if dayOfWeek == 6 {
			dayOfWeek = -1
		}
		dayOfWeek++
	}
	fmt.Println(week[dayOfWeek])
}



Measured memory_bytes: 1132
#include <bits/stdc++.h>
#include <string>
#include <vector>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

//https://atcoder.jp/contests/dp/tasks

int main(){
    int n;
    cin >> n;
    vector<int> dp(n);
    vector<int> w(n);
    rep(i,n) cin >> w[i];
    dp[0] = 0;
    dp[1] = abs(w[1]-w[0]);
    for(int i = 2;i<=n-1;i++){
        dp[i] = min(dp[i-2]+abs(w[i-2]-w[i]),dp[i-1]+abs(w[i]-w[i-1]));
    }

    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 200010
 
#define PI   3.14159265358979323846264338327950
 
#define PB push_back 
#define F first
#define S second
 
#define ll 	long long int
 
#define mod  1000000007
 
 
 
int main()
{
	FAST;
	ll n, m;
	cin >> n >> m;
	ll ans = 0;
	if(n >= 2){
		n -= 2;
	}
	if(m >= 2){
		m -= 2;
	}
	ans = n*m;
	
	cout <<  ans;
	return 0;
}

Measured memory_bytes: 3644
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    print(n*800-200*(n//15))

#B
def B():
    k = I()
    ans = 0
    for i in range(1,k):
        for j in range(i+1,k+1):
            if (i%2)^(j%2):
                ans += 1
    print(ans)

#C
def C():
    x,t = LI()
    print(max(0,x-t))

#D
def D():
    n = I()
    ans = 1
    for i in range(1,n+1):
        ans *= i
        ans %= mod
    print(ans)

#E
def E():
    x,y,s,t = LI()
    return

#F
def F():
    n = I()
    x = LI()
    a = sorted(x)
    for i in range(n):
        j = bisect.bisect_left(a,x[i])
        if j >= n//2:
            print(a[n//2-1])
        else:
            print(a[n//2])

#G
def G():
    n,m = LI()
    if m <= 2*n:print(m//2)
    else:
        ans = n
        m -= 2*n
        ans += m//4
        print(ans)

#H
def H():
    n,k = LI()
    if k%2:
        l = n//k
        print(l**3)
    else:
        l = n//(k/2)
        m = n//k
        l -= m
        print(int(l**3+m**3))

def J():
    n = I()
    d = defaultdict(int)
    for i in range(n):
        a = I()
        if d[a]:
            d[a] -= 1
        else:
            d[a] += 1
    print(sum(d.values()))

def K():
    n,h = LI()
    v = LIR(n)
    s = 0
    i = 0
    v.sort()
    m = v[-1][0]
    v.sort(key = lambda x:-x[1])
    for a,b in v:
        if b > m:
            s += b
            i += 1
            if s >= h:break
    ans = i+(max(0,h-s)//m)
    if max(0,h-s)%m>0:
        ans += 1
    print(ans)
#Solve
if __name__ == "__main__":
    H()


Measured memory_bytes: 40176
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        final int N = sc.nextInt();
        
        final int[] Ls = new int[N];
        for (int n = 0; n < N; n++) {
            Ls[n] = sc.nextInt();
        }
        
        int count = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                if (Ls[i] == Ls[j]) {
                    continue;
                }
                for (int k = j + 1; k < N; k++) {
                    if (Ls[i] != Ls[k]
                            && Ls[j] != Ls[k]
                            && Ls[i] < Ls[j] + Ls[k]
                            && Ls[j] < Ls[i] + Ls[k]
                            && Ls[k] < Ls[i] + Ls[j]) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 36292
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

        int N = stdIn.nextInt();
        int[][] a = new int[2][N];
        int tmpSum = 0;
        List<Integer> sum = new ArrayList<>();
        int j;
        int max;

        for (int i = 0; i < 2; i++) {
            for (j = 0; j < N; j++) {
                a[i][j] = stdIn.nextInt();
            }
            System.out.println();
        }

        for (int k = 0; k < N; k++) {
            for (j = 0; j < N - k; j++) {
                tmpSum += a[0][j];
            }
            sum.add(tmpSum);
            tmpSum = 0;
        }

        for (int k = 0; k < N; k++) {
            for (j = 0; j < k + 1; j++) {
                tmpSum += a[1][N - j - 1];
                sum.set(k, sum.get(k) + tmpSum);
                tmpSum = 0;
            }
        }

        max = sum.get(0);
        for (int index = 0; index < sum.size(); index++) {
            max = Math.max(max, sum.get(index));
        }
        System.out.println(max);
    }

}


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

int main() {
int arr[9];
bool flag=false;
for(int i =0 ; i< 9 ;++i)
scanf("%d",&arr[i]);
int cmp1=arr[3]-arr[0],
cmp2 = arr[6]-arr[0];
if (arr[4]-arr[1]==cmp1 && arr[5]-arr[2]==cmp1)
	if (arr[7]-arr[1]==cmp2 && arr[8]-arr[2] == cmp2)
		flag=true;

if (flag)
printf("Yes\n");
else
printf("No\n");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  int N,M;
  cin>>N>>M;
  vector<int> cnt(M);
  rep(i,N){
    int K;
    cin>>K;
    rep(j,K){
      int A;
      cin>>A;
      cnt[A-1]++;
    }
  }
  int ans=0;
  rep(i,M){
    if(cnt[i]==N) ans++;
  }
  cout<<ans<<endl;
}   

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

bool palindrome(int i)
{
  string str = to_string(i);
  int len = str.length();
  for(int i=0; i<len/2; ++i)
  {
    if(str[i] != str[len-1-i])
    {
      return false;
    }
  }
  return true;
}

int main()
{
  int A, B, ans=0;
  cin >> A >> B;

  for(int i=A; i<=B; ++i)
  {
    if(palindrome(i))
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
    हॉंजी । की हाल चाल?
    बड़ीया सब?
*/

#include<bits/stdc++.h>
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             unordered_map<int,int>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define MOD             998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define EPS             1e-9

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

int MAX = 2 * 100000 + 5;

int32_t main()
{
    gogeta();
    int n, k; cin >> n >> k;
    vector<pii> v(k);
    for (int i = 0; i < k; i++) {
        cin >> v[i].ff >> v[i].ss;
    }
    vector<int> dp(n + 2, 0);
    dp[n] = 1;
    vector<int> pre(n + 2, 0);
    pre[n] = 1;
    for (int i = n - 1; i >= 1; i--) {
        for (auto x : v) {
            if (i + x.ff <= n)   dp[i] = (dp[i] + pre[i + x.ff] - pre[min(n, i + x.ss) + 1]) % MOD;
        }
        pre[i] = (dp[i] + pre[i + 1]) % MOD;
    }
    cout << (dp[1] + MOD) % MOD << endl;
}


Measured memory_bytes: 6332
import java.io.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;


public  class Main 
{

	   
	   static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 

  

	  // Complete the hurdleRace function below.
//    public static void solve() {
//    	FastReader s=new FastReader();

   
    public static void main(String[] args) throws IOException {
    	FastReader s=new FastReader();
    	int[] ar = new int[6];
    	for(int i =1 ;i<=5;i++) {
    		ar[i] = s.nextInt();
    	}
    	for(int i =1 ;i<=5;i++) {
    		if(ar[i]==0)System.out.println(i);
    	}
    	

    	
    }	
}


Measured memory_bytes: 32760
use proconio::input;

fn main() {
    input! {
        n: String,
    }

    let mut sum = 0;
    for c in n.chars() {
        let n_i: usize = c.to_string().parse().unwrap();
        sum += n_i;
    }

    let ans = if sum % 9 == 0 { "Yes" } else { "No" };

    println!("{}", ans);
}


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

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<vector<int>> ans(h, vector<int> (w));
  int nh = 0, nw = 0;
  for(int i = 1; i <= n; i++){
    int a;
    cin >> a;
    
    for(int cnt = 0; cnt < a; cnt++){
      ans.at(nh).at(nw) = i;
      if(nw % 2){
        if(nh == 0) nw++;
        else nh--;
      }
      else{
        if(nh == h-1) nw++;
        else nh++;
      }
    }
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << ans.at(i).at(j) << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	ll D;
	cin >> N >> D;
	int r = 0;
	for (int i = 0; i < N; ++ i) {
		ll x, y;
		cin >> x >> y;
		if (x*x + y*y <= D*D) ++ r;
	}
	cout << r << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

template< typename G >
struct StronglyConnectedComponents {
  const G &g;
  vector<vector<int>> gg, rg;
  vector< int > comp, order, used;

  StronglyConnectedComponents(G &g) : g(g), gg(g.size()), rg(g.size()), comp(g.size(), -1), used(g.size()) {
    for(int i = 0; i < g.size(); i++) {
      for(auto e : g[i]) {
        gg[i].emplace_back((int) e);
        rg[(int) e].emplace_back(i);
      }
    }
  }

  int operator[](int k) {
    return comp[k];
  }

  void dfs(int idx) {
    if(used[idx]) return;
    used[idx] = true;
    for(int to : gg[idx]) dfs(to);
    order.push_back(idx);
  }

  void rdfs(int idx, int cnt) {
    if(comp[idx] != -1) return;
    comp[idx] = cnt;
    for(int to : rg[idx]) rdfs(to, cnt);
  }

  void build(vector<vector<int>> &t) {
    for(int i = 0; i < gg.size(); i++) dfs(i);
    reverse(begin(order), end(order));
    int ptr = 0;
    for(int i : order) if(comp[i] == -1) rdfs(i, ptr), ptr++;

    t.resize(ptr);
    for(int i = 0; i < g.size(); i++) {
      for(auto &to : g[i]) {
        int x = comp[i], y = comp[to];
        if(x == y) continue;
        t[x].push_back(y);
      }
    }
  }
};


int main(){
	ll n,m; cin >> n >> m;
	vvl G(n);
	vector<vector<int>> g;
	rep(i,m){
		ll s,t; cin >> s >> t;
		G[s].push_back(t);
	}
	StronglyConnectedComponents<vvl> scc(G);
	ll q; cin >> q;
	scc.build(g);
	while(q--){
		ll u,v; cin >> u >> v;
		cout << (scc[u] == scc[v]) << "\n";
	}
}


Measured memory_bytes: 5088
N,M=map(int,input().split())
A = list(map(int,input().split()))
l = [] 
for i in range(M):
  tmp = list(map(int,input().split()))
  l.append([tmp[1],tmp[0]])
l.sort(reverse=True)
for i,j in l:
    A.extend([i]*j)
    if len(A)>2*N:break
A.sort(reverse=True)
print(sum(A[:N]))

Measured memory_bytes: 26732
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M = map(int, input().split())
maxL = 1
minR = N
for _ in range(M):
    L, R = map(int, input().split())
    maxL = max(maxL, L)
    minR = min(minR, R)
ans = minR - maxL + 1
ans = max(ans, 0)
print(ans)

Measured memory_bytes: 9132
#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--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    long double dens = 0;
    int Water = 100 * A, Suger = 0;
    for(int a = 0; a <= F; a += 100*A){
        for(int b = a; b <= F; b += 100*B){
            for(int c = 0; c <= F - b; c += C){
                for(int d = c; d <= F - b; d += D){
                    if (b * E < d * 100 || b + d > F) continue;
                    int water = b;
                    int suger = d;
                    long double tmp = double(d) / double(b + d);
                    if(tmp > dens) Water = water, Suger = suger, dens = tmp;
                }
            }
        }
    }

    cout << Water + Suger << " " << Suger << endl;

    return 0;
}

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

int main() {

  string s;
  cin >> s;
  long long int w;
  cin >> w;

  long long int n = s.size();

  for ( long long int i = 0; i < n; i += w ) {
    cout << s[i];
  }
  cout << endl;

  return 0;

}


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

a = []
s = []
h = []
c = []
d = []
for i in range(n):
    a.append(list(map(str,input().split())))
    egara = a[i][0]
    num = int(a[i][1])
    if egara == "S":
        s.append(num)
    elif egara == "H":
        h.append(num)
    elif egara == "C":
        c.append(num)
    else:
        d.append(num)
s.sort()
h.sort()
c.sort()
d.sort()

def check(l, m):
    if len(l) != 13:
        for i in range(13):
            if (i+1) not in l:
                print(m + " " + str(i+1))
check(s, "S")
check(h, "H")
check(c, "C")
check(d, "D")

Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while(cin >> n and n) {
        vector<ll> p(n + 1), q(n + 1), r(n + 1), b(n + 1), is_root(n + 1, true);
        for(int i = 1; i <= n; i++) {
            cin >> p[i] >> q[i] >> r[i] >> b[i];
            is_root[r[i]] = is_root[b[i]] = false;
        }
        function<ll(int)> solve = [&](int i) -> ll {
            if(i == 0) {
                return 1;
            } else {
                ll rw = solve(r[i]), bw = solve(b[i]), g = __gcd(rw * p[i], bw * q[i]);
                return rw * bw * p[i] / g + rw * bw * q[i] / g;
            }
        };
        for(int i = 1; i <= n; i++) {
            if(is_root[i]) {
                cout << solve(i) << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3008
//Created by:Coding_lover(27-07-2020 11:05:31)
#include <bits/stdc++.h>
#define ll long long
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define INF LLONG_MAX
#define m 1000000007
#define f first
#define s second
#define LB lower_bound
#define UB upper_bound
#define pi pair<long long,long long>
#define pii pair<long long,pi>
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define vc vector
#define vll vector<long long>
#define rep(i, a, n) for (ll i = a; i < (long long)n; ++i)
#define repe(i, a, n) for (ll i = a; i <= (long long)n; ++i)
#define repr(i, n, a) for (ll i = n; i > (long long)a; --i)
#define repre(i, n, a) for (ll i = n; i >= (long long)a; --i)
#define dbg(x) cout<<"Debugging "<<#x<<":"<<endl;cout<<#x<<" = "<<x<<endl
#define dbgv(v) cout<<"Debugging "<<#v<<":"<<endl; for(ll i=0;i<v.size();i++){cout<<v[i]<<" ";}cout<<endl;
using namespace std;
int main() {
  FASTER;
  ll t=1;
  //cin >> t;
  while (t--) {
  	ll h,w;
  	cin>>h>>w;
  	vector<vll> adj(h);
  	adj.assign(h,vector<ll>(w,0));
  	rep(i,0,h)
  	{
  		string s;
  		cin>>s;
  		rep(j,0,w)
  		{
  			if(s[j]=='.')adj[i][j]=1;
  		}
  	}
  	vector<vll> dp(h);
  	dp.assign(h,vector<ll>(w,0));
  	dp[0][0]=1;
  	rep(i,0,h)
  	{
  		rep(j,0,w)
  		{
  			if(!adj[i][j])continue;
  			if(i>0)dp[i][j]=(dp[i][j]+dp[i-1][j])%m;
  			if(j>0)dp[i][j]=(dp[i][j]+dp[i][j-1])%m;
  		}
  	}
  	cout<<dp[h-1][w-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 19032
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,a[2005],dp[2005][2005][2],mx[2005][2005],mn[2005][2005];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> a[1] >> a[2];
    for(int i=3;i<=n+2;i++){
        cin >> a[i];
    }
    for(int i=1;i<=n+3;i++){
        for(int j=1;j<=n+3;j++){
            mx[i][j]=0;
            mn[i][j]=LINF;
        }
    }
    for(int i=1;i<=n+2;i++){
        dp[i][n+2][1]=dp[i][n+2][2]=dp[n+2][i][1]=dp[n+2][i][2]=abs(a[n+2]-a[i]);
        mn[i][n+2]=dp[i][n+2][1];
        mx[i][n+2]=dp[i][n+2][2];
        mn[n+2][i]=dp[n+2][i][1];
        mx[n+2][i]=dp[n+2][i][2];
    }
    for(int j=n+1;j>=1;j--){
        for(int i=n+1;i>=1;i--){
            dp[i][j][1]=max(abs(a[n+2]-a[j]),mx[max(i+1,j+1)][j]);
            dp[i][j][2]=min(abs(a[n+2]-a[i]),mn[i][max(i+1,j+1)]);
            mx[i][j]=max(mx[i+1][j],dp[i][j][2]);
            mn[i][j]=min(mn[i][j+1],dp[i][j][1]);
            //cout << i << ' ' << j << ' ' << dp[i][j][1] << ' ' << dp[i][j][2] << ' ' << mn[i][j] << '\n';
        }
    }
    cout << dp[1][2][1];
}


Measured memory_bytes: 125824
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		
		if (N % 2 == 0) {
			System.out.println(N / 2);
		} else {
			double number = (double)N / 2 ;
			System.out.println(Math.round(number));
		}
		
	}
}	

Measured memory_bytes: 22868
n = gets.to_i
array = []
while string = gets
  array << string.chomp.split.map(&:to_i)
end
s = 0
for i in 0..n-3
  if array[i][0]==array[i][1] && array[i+1][0]==array[i+1][1] && array[i+2][0]==array[i+2][1]
    s = 1
  end
end
if s == 1
  puts "Yes"
else
  puts "No"
end



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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    ll n; cin >> n;
    vl a(n+1);
    ll res = 0;
    for(int i=1;i<=n;i++){
        if(6*i*i > n)break;
        for(int j=i;j<=n;j++){
            for(int k=j;k<=n;k++){
                ll num = i*i + j*j + k*k + i*j + j*k + k*i;
                if(num > n){
                    continue;
                }
                if(i==j && j==k)a[num-1]++;
                else if(i!=j && j!= k && k!=i) a[num-1] += 6;
                else a[num-1] += 3;
            }
        }
    }
    rep(ii,n)out(a[ii]);
    return 0;
}

Measured memory_bytes: 3648
def main():
    N, K = map(int, input().split())
    A = [a-1 for a in map(int, input().split())]    # 0-indexed に変換
    B = [None]*N    # 何ステップ目に到達したかを記録。Noneなら未到達を表す
    now = 0         # 現在地
    step = 0        # ステップ数
    B[now] = 0      # 開始地点は、0ステップ目に到達済みとする
    while K:
        now = A[now]    # 現在地を更新 
        step += 1
        K -= 1
        if B[now] is not None:  # ループを検出したら...
            K %= (step - B[now])      # Kからループ長さを引けるだけ引く
        else:
            B[now] = step  # 到達したステップ数を記録
    print(now+1)    # 1-indexed に再変換
 
main()

Measured memory_bytes: 92536
#include <iostream>
using namespace std;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int k = 0; k < B; k++) {
		if (k * A % B == C) {
			cout << "YES";
			return 0;
		}
	}
	cout << "NO";
	return 0;
}

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

int main(){
  int H,W;
  cin >> H >> W;

  const int dx[8]= {1,1,1,0,-1,-1,-1,0};
  const int dy[8]= {1,0,-1,-1,-1,0,1,1};
  string board[50];
  
  for(int i = 0; i< H; i++){
    cin >> board[i];
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(board[i][j] != '#'){
        int cnt =0;
        for(int d=0; d <8; d++){
          const int ni = i + dx[d];
          const int nj = j + dy[d];
          
          if(ni < 0 || H <= ni)continue;
          if(nj < 0 || W <= nj)continue;
          if(board[ni][nj] == '#')cnt++;
        }
        board[i][j] = char(cnt + '0');
      } //if文閉じる
    }
  }//for文全部閉じる
  
  for(int i = 0; i< H; i++){
    for(int j = 0; j < W; j++){
      cout << board[i][j];
      
      if(j+1 == W){
        cout<< endl;
      }
    }
  }
  
}

Measured memory_bytes: 256
Imports System
Module ABC154A
	Sub Main()
		Dim s,t,u As String
		Dim a,b As Integer
		Dim inputs() As String
		
		inputs = Console.ReadLine().Split()
		s = inputs(0)
		t = inputs(1)
		inputs = Console.ReadLine().Split()
		a = Integer.Parse(inputs(0))
		b = Integer.Parse(inputs(1))
		u = Console.ReadLine()
		If u = s
			a -= 1
		Else
			b -= 1
		End If
		Console.WriteLine("{0} {1}",a,b)
	End Sub
End Module


Measured memory_bytes: 20432
N = int(input())
H = list(map(int, input().split()))

count = 0
diff = 0

if N == 1:
    print("Yes")
else:
    minn = 1
    tmp = 0
    for i in range (0, N):
        if minn <= H[i] - 1:
            H[i] -= 1
            minn = H[i]
        elif minn <= H[i]:
            minn = H[i]
        else:
            tmp = 1

    if tmp == 0:
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 14396
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()

void solve();

signed main () {
    cout.precision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) { 
        solve();
    }
    return 0;
}
const int N = 2e5 + 55;
vector<int> conn[N];
int sz[N];
int pw[N];
const int M = 1e9 + 7;
vector<int> adj[N];
int n;
int exp (int a, int b) {
	if (!b)
		return 1;
	int ans = exp(a, b/2);
	ans = (ans * ans) % M;
	if (b & 1)
		ans = (ans * a) % M;
	return ans;
}
int inv (int a) {
	return exp(a, M - 2);
}
void dfs (int v, int p) {
	sz[v] = 1;
	for(auto &i: adj[v]) {
		if (i != p) {
			dfs(i, v);
			sz[v] += sz[i];
			conn[v].push_back(sz[i]);
		}
	}
	if (v != 1) {
		conn[v].push_back(n - sz[v]);
	}
}
void solve() { 
    cin >> n;
    pw[0] = 1;
    for (int i = 1; i < N; ++i)
    	pw[i] = (pw[i - 1] * 2) % M;
    for (int i = 0; i < n - 1; ++i) {
    	int a, b;
    	cin >> a >> b;
    	adj[a].push_back(b);
    	adj[b].push_back(a);
    }
    dfs(1, 1);
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
    	if ((int) conn[i].size() < 2)
    		continue;
    	// need at least 2 to contain black
    	int none_prob = 1;
    	for (auto &j : conn[i]) 
    		none_prob *= inv(pw[j]), none_prob %= M;
    	int one_prob = 0;
    	for (auto &j : conn[i]) {
    		auto here = none_prob * pw[j];
    		here %= M;
    		here *= ((1 - inv(pw[j]) + M)) % M;
    		here %= M;
    		one_prob += here;
    		if (one_prob >= M)
    			one_prob -= M;
    	}
    	int contrib = (1 - none_prob - one_prob + M + M) % M;
    	contrib *= inv(2), contrib %= M;
    	ans += contrib;
    	if (ans >= M)
    		ans -= M;
    }
    cout << ans;
}


Measured memory_bytes: 34688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
 
int main(){
    ll N; cin>>N;
    ll flg=0;
    rep(i,0,26){
        rep(j,0,16){
            if(i==0&&j==0)continue;
            if(N%(4*i+7*j)==0){flg=1;break;}
        }
        if(flg==1)break;
    }
    cout<<(flg==1 ? "Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>

using namespace std;

int main() {
  int a;
  cin >> a;

  if (a < 1200) cout << "ABC" << endl;
  else if (a < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}


Measured memory_bytes: 256
/*input
3 3
1
3
1
3
1
3
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> cnt(n, 1);
  rep(i, k) {
    int d;
    cin >> d;
    rep(j, d) {
      int a;
      cin >> a, --a;
      cnt[a] = 0;
    }
  }
  int ans = 0;
  rep(i, n) ans += cnt[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
import math
r, g, b = [int(k) for k in input().split()]
k = int(input())
i = 0
while True:
    if b <= g or b <= r:
        b *= 2
    elif g <= r:
        g *= 2
    i += 1
    if i <= k:
        if b > g > r:
            print('Yes')
            break
    else:
        print('No')
        break

Measured memory_bytes: 9132
def trans(s):
    s1=""
    for c in s:
        if c.isalpha():
            s1+=chr(ord(c)+1)
        else:
            s1+=c
    return s1.replace("{","a")

while True:
    try:
        s=raw_input()
    except EOFError:
        break
    cnt=0
    the,this,that="the","this","that"

    while True:
        if (the in s) or (this in s) or (that in s):
            print s
            break
        else:
            s=trans(s)

Measured memory_bytes: 4232
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
	ll N = 0, ans = 0;
	cin >> N;
	vector<int> d(N,0);
	rep(i, N) cin >> d[i];
	rep(i, N-1) {
		for (int j = i+1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;

	return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            B();
        }

        static void B()
        {
            var NL = ReadSplitInt();
            var list = new List<string>();
            for (var i = 0; i <NL[0]; i++)
            {
                list.Add(Read());
            }
            Println(Join(list.OrderBy(x => x)));
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list); 
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13664
a, b = input().split()
a = int(a)
b = int(b)
A = a
B = b
while 1:
    if a < b:
        tmp = a
        a = b
        b = tmp
    r = a % b
    if r == 0:
        GCD = b
        break
    a = b
    b = r
LCM = int(A*B/GCD)
print(LCM)

Measured memory_bytes: 3064
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
ans=0
for i in range(1,n+1):
    if i%3==0 or i%5==0:
        continue
    else:
        ans+=i
print(ans)

Measured memory_bytes: 67992
import os, sys, re, math

N = int(input())

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N - 100 + 10)
elif N < 10000:
    print(999 - 100 + 10)
elif N < 100000:
    print(N - 10000 + (1000 - 100 + 10))
else:
    print(99999 - 10000 + (1000 - 100 + 10))


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

int main()
{   
    int a,b,c;
    cin>>a>>b>>c;
    int k; cin>>k;
    int flag=0;
    while(k>0)
     {
         if(b>a)
           {
               if(c>b)
                 { flag=1; break;
                 }
              else
                {c*=2;   
                 if(c>b){flag=1; break;}
                }
           }
         else
            b*=2; 
      k--;
     }
     
    if(flag)cout<<"Yes"<<endl;
    else 
      cout<<"No"<<endl; 
     
}


Measured memory_bytes: 3628