akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static int mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] ins = br.readLine().split(" ");
		int h = Integer.parseInt(ins[0]), w = Integer.parseInt(ins[1]);
		char tb[][] = new char[h][w];
		for ( int r = 0; r < h; r++ ) {
			char[] temp = br.readLine().toCharArray();
			tb[r] = temp;
		}
		br.close();

		int dp[][] = new int[h + 1][w + 1];
		dp[1][1] = 1;
		//		for ( int r = 0; r < h; r++ ) {
		//			if ( tb[r][0] == '#' ) break;
		//			dp[r][0] = 1;
		//		}
		//		for ( int c = 0; c < w; c++ ) {
		//			if ( tb[0][c] == '#' ) break;
		//			dp[0][c] = 1;
		//		}

		for ( int r = 1; r <= h; r++ ) {
			for ( int c = 1; c <= w; c++ ) {
				if ( tb[r - 1][c - 1] == '#' ) continue;
				dp[r][c] += (dp[r - 1][c] + dp[r][c - 1]) % mod;
			}
		}
		System.out.println(dp[h][w] % mod);
	}
}


Measured memory_bytes: 33684
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
/*---------------------------------------------------------*/
string n,m;

int main(){
	cin>>n>>m;
	int ln=n.length(),lm=m.length();
	int c=-1;
	FORD(i,ln-1,0){
		if(n[i]==m[0]||n[i]=='?'){
			int num=1;
			FOR(j,i+1,i+lm-1){
				if(n[j]!='?'&&n[j]!=m[num])break;
				num++;
			}
			if(num==lm){c=i;break;}
		}
	}
	if(c==-1){
		cout<<"UNRESTORABLE";
		return 0;
	}
	FOR(i,0,ln-1){
		if(i==c){
			i=i+lm-1;
			FOR(j,0,lm-1)cout<<m[j];
		}
		else n[i]=='?'?cout<<'a':cout<<n[i];
	}
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#n,p = map(int,input().split())
s=input()
p = 2019
ans = 0
l = [0 for i in range(p)]
l[0] = 1
z = 0
ten = 1
tmp = 0
for i in s[::-1]:
    i = int(i)
    tmp=(tmp+i*ten)%p
    ten = (ten*10)%2019
    l[tmp]+=1
for i in l:
    ans+= i*(i-1)//2
print(ans)


Measured memory_bytes: 9388
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <cmath>
#include <algorithm>
#define ll long long
//for (auto &x : a) { cin >> x; }
using namespace std;

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

    ll n;
    cin >> n;
    ll a[n];
    for(ll i=0; i<n; i++){
        cin >> a[i];
    }
    ll ans = 0;
    for(ll i=1; i<n; i++){
        if(a[i] < a[i-1]){
            ans += a[i-1] - a[i];
            a[i] += a[i-1]-a[i];
        }
    }
    cout << ans;
}

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

class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st  = new StringTokenizer(br.readLine());

        long N = Long.parseLong(st.nextToken())-1;
        int len = 1;
        for (int i=1; i<13; i++) {
            long sub = (long)Math.pow(26,i);
            if (N-sub>=0) {
                N-=sub;
                len++;
            }
            else
                break;
        }

        String ans = "";

        for (int i=len-1; i>=0; i--) {
            long sub = (long)Math.pow(26,i);
            ans+=(char)(N/sub+'a');
            N=N%sub;
        }

        System.out.println(ans);
        



        



    }

}

Measured memory_bytes: 37072
#include<bits/stdc++.h>
using namespace std;
int a[101],sum[101];
int main()
{
	int n;
	cin>>n;
	sum[0]=0;int ans=0x3f3f3f;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=1;i<n;i++)
	{
		int x1=sum[i],x2=sum[n]-sum[i];
		int x=abs(x1-x2);
		ans=min(ans,x);
	}
	cout<<ans;
	return 0; 
} 

Measured memory_bytes: 256
x,k,d=[int(i) for i in input().strip().split(" ")]
#絶対値変換
x=abs(x) if x<0 else x
#減らすのみ
if x//d>=k:
    print(x-d*k)
else:
    if (k-x//d)%2==0:
        print(x%d)
    else:
        print(d-(x%d))

Measured memory_bytes: 9184
#include<stdio.h>
#include <iostream>
using namespace std;
/* 値を入れ替える関数 */
void swap(int* x, int* y) {
	int temp;    // 値を一時保存する変数

	temp = *x;
	*x = *y;
	*y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition(int array[], int left, int right) {
	int i, j, pivot;
	i = left;
	j = right + 1;
	pivot = left;   // 先頭要素をpivotとする

	do {
		do { i++; } while (array[i] < array[pivot]);
		do { j--; } while (array[pivot] < array[j]);
		// pivotより小さいものを左へ、大きいものを右へ
		if (i < j) { swap(&array[i], &array[j]); }
	} while (i < j);

	swap(&array[pivot], &array[j]);   //pivotを更新

	return j;
}

/* クイックソート */
void quick_sort(int array[], int left, int right) {
	int pivot;

	if (left < right) {
		pivot = partition(array, left, right);
		quick_sort(array, left, pivot - 1);   // pivotを境に再帰的にクイックソート
		quick_sort(array, pivot + 1, right);
	}
}

int main(void) {

	//vector<long long int> d;
	int d[100001];
	int dd;
	long long int count = 0;
	long long int n;
	
	cin >> n;
	int nn = n;
	int i = 0;
	for (;i<n;i++)
	{
		cin >> d[i];				
	}

	//int array[10] = { 2, 1, 8, 5, 4, 7, 9, 0, 6, 3 };
	//int i;

	//printf("Before sort: ");
	//for (i = 0; i < n; i++) { printf("%d ", d[i]); }
	//printf("\n");

	quick_sort(d, 0, n-1);

	//printf("After sort: ");
	//for (i = 0; i < n; i++) { printf("%d ", d[i]); }
	//printf("\n");
	int k =  d[(n / 2)]- d[n / 2-1];
	cout << k << endl;

	
}

Measured memory_bytes: 640
<?php
fscanf(STDIN,"%d %d %d",$a,$b,$k);
if(($b-$a)<$k*2){
  for($i=$a;$i<=$b;$i++) echo $i."\n";
  exit;
}
for($i=$a;$i<$a+$k;$i++) echo $i."\n";
if($b-$k+1<$i) $d=$i;
else $d=$b-$k+1;
for(;$d<=$b;$d++) echo $d."\n";
?>

Measured memory_bytes: 4604
def solve():
    A = [0]*N
#    A[-1] = 10**6
#    A[0] = 10**6
    A[-1] = B[-1]
    A[0] = B[0]
    for i in range(N-2,0,-1):
        A[i] = min(B[i], B[i-1])
#        print(i)
#    print(A)
    print(sum(A))

if __name__ == "__main__":
    N = int(input())
    B = list(map(int, input().split()))
    solve()  


Measured memory_bytes: 8932
import queue

class Process:
    def __init__(self, name, time):
        self.name = name
        self.time = time

N, Q = list(map(int, input().split()))

q = queue.Queue()

for _ in range(N):
    name, time = input().split()
    item = Process(name, int(time))
    q.put(item)

time_sum = 0
while not q.empty():
    pop = q.get()
    if pop.time > Q:
        pop.time = pop.time - Q
        time_sum += Q
        q.put(pop)
    else:
        time_sum += pop.time
        print(pop.name, time_sum)
        


Measured memory_bytes: 18612
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=1000010;
const ll mod=1e9+7;


int main(){
  int n;
  string s;
  cin >> n >> s;
  int cnt = 0;
  rep(i,n){
    if(s[i]=='R') cnt++;
  }
  if(cnt>n-cnt){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

using namespace std;

long long f(long long x) {
	if (x % 4 == 0) {
		return x;
	} else if (x % 4 == 1) {
		return 1;
	} else if (x % 4 == 2) {
		return x + 1;
	} else {
		return 0;
	}
}

int main() {
	long long a, b;
	
	cin >> a >> b;
	
	cout << (f(b) ^ f(a - 1)) << '\n';
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n, a, b;
	(void)fscanf(stdin, "%d %d %d", &n, &a, &b);

	int	q = 0;
	for(int i = 1;i <= n;i++)
	{
		int		t = ((i / 10000)%10) + ((i / 1000)%10) + ((i / 100)%10) + ((i / 10)%10) + (i%10);
		if (t >= a && t <= b)
			q += i;
	}
	printf("%d\n", q);

	return 0;
}


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

int n;
num ans;

int main() {
	scanf("%d", &n);
	cont (i, n) {
		int fm = i, to = n - (n % i), k = (to - fm) / i + 1;
		ans += (num) (fm + to) * k / 2;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    ll x; cin >> x;
    ll aa, bb;
    for (int a = -120; a < 120; ++a){
        for (int b =-120; b < 120; ++b) {
            if (x == std::pow(a, 5) - std::pow(b, 5)) {
                aa = a; bb = b; 
                break;
            }
        }
    }
    cout << aa << " " << bb << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    X--, Y--;
    vector<vector<int>> graph(N);
    rep(i, N - 1) {
        int j = i + 1;
        graph[i].emplace_back(j);
        graph[j].emplace_back(i);
    }
    graph[X].emplace_back(Y);
    graph[Y].emplace_back(X);

    auto bfs = [&](int s) {
        vector<int> dist(graph.size(), -1);
        queue<int> que;
        auto push = [&](int v, int cost) {
            if(dist[v] != -1) return;
            dist[v] = cost;
            que.emplace(v);
        };
        push(s, 0);
        while(!que.empty()) {
            int cur = que.front(); que.pop();
            for(auto &to : graph[cur]) push(to, dist[cur] + 1);
        }
        return dist;
    };

    vector<vector<int>> dist(N);
    rep(i, N) dist[i] = bfs(i);
    vector<int> ans(N);
    rep(i, N) for(int j = i + 1; j < N; ++j) {
        ans[dist[i][j]]++;
    }
    for(int i = 1; i < N; ++i) cout << ans[i] << '\n';
    return 0;
}


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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define fi first
#define se second
#define pb push_back
#define int long long

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

const int N = 1e5 + 10;
const int oo = 1e18;

int 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};

signed main()  {
    //freopen("test.inp", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false); cout.tie(0);

    int k; cin >> k;
    cout << a[k - 1];
}


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



int main(){
	int n;
	int a[101],b[101];
	while(cin>>n&&n){
		int ans=0;
		for(int i=0;i<n+1;i++)cin>>a[i];
		for(int i=0;!ans&&i<n+1;i++){
			int j;
			for(j=0;j<n+1;j++){
				if(i==j)continue;
				b[j-(i<j)]=a[j];
			}
			for(j=1;j<n;j++){
				if(b[1]-b[0]!=b[j]-b[j-1])break;
			}
			if(j==n)ans=a[i];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N = int(input())
S_P_I = list()

for i in range(N):
    s, p = tuple(input().split())
    S_P_I.append((s, int(p), i + 1))

S_P_I = sorted(S_P_I, key=lambda spi: spi[1], reverse=True)
S_P_I = sorted(S_P_I, key=lambda spi: spi[0])

for s, p, i in S_P_I:
    print(i)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  vector<ll> a(3);
  cin >> a[0] >> a[1] >> a[2];
  ll k;
  cin >> k;
  sort(a.rbegin(), a.rend());
  cout << a[0] * pow(2, k) + a[1] + a[2] << endl;
  return 0;
}

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

int main() {
int x,y,a[]={0,1,3,1,2,1,2,1,1,2,1,2,1};
cin >> x >> y;

if(a[x]==a[y]){
    cout << "Yes"; return 0;
}
cout << "No";
return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
l = 0
j = 0
while j < n-1:
    count = 0
    i = j
    while h[i] >= h[i+1]:
        count+=1
        if i+1 == n-1:
            break
        i+=1
    if l < count:
        l =count
    j += count+1

print(l)

Measured memory_bytes: 14252
using System;
using System.Linq;

class Program {
  static void Main() {
    int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
    if ((a[0] * a[1] & 1) == 0) {
      Console.WriteLine("Even");
    } else {
      Console.WriteLine("Odd");
    }
  }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define fr first
#define pb push_back
#define skip continue
#define se second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define vi vector<ll>
#define MAX 1e9 + 1234

using namespace std;

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

int const INF = 1e5 + 9 ;
const int N = 100100;

void faster(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int simple( int n ) {
    int i, sq;
    if ( n%2 == 0 ) { return 0; }
    sq= (int)sqrt( n );
    for ( i= 3; i<=sq; i++ ) {
    if ( (n%i) == 0 ) { return 0; }
    }
    return 1;
}
ll gcd(ll a, ll b){
    if(a > b)	swap(a, b);
    if(!a)	return b;
    return gcd(b % a, a);
}



void solve() {
    ll n , m;
    cin >> n >> m;
    if(n == m){
        cout << "Yes";
    }
    else cout << "No";
}

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


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int x;
  cin >> x;
  vector<int> exps {1};
  for(int i = 2; i * i <= x; ++i)
  {
    int num = i * i;
    while(num <= x)
    {
      exps.emplace_back(num);
      num *= i;
    }
  }
  int ans = *std::max_element(exps.begin(), exps.end());
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll  long long 
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e7+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
int main() 
{

	  ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    string s;
    int n , m , k;
    cin>>n;
    ll arr[n+1];
    ll ans=0;
    for(int i=0;i<n;i++){
      cin>>arr[i];
    }
    sort(arr, arr+n);
    ans=arr[n-1];
    int p=n-2;
    n=n-2;
    while(p>0){
      //cout<<p<<endl;
      if(p-2>=0)
      {
      //  cout<<n<<endl;
        ans=ans+arr[n]+arr[n];
        p=p-2;
      }
      else if(p-1>=0){
        ans=ans+arr[n];
        p=p-1;
      }
     // cout<<ans<<" "<<p<<endl;
      n=n-1;
    }
    cout<<ans;

  
}

Measured memory_bytes: 5200
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
signed main(){
    int n,k; cin>>n>>k;
    map<int,int>mp;
    vector<int>tiya;
    rep(i,n){
        int num,cnt; cin>>num>>cnt;
        if(mp[num]==0){
            tiya.push_back(num);
        }
        mp[num]+=cnt;
    }
    sort(all(tiya));
    rep(i,tiya.size()){
        k-=mp[tiya[i]];
        if(k<=0){cout<<tiya[i]<<endl; return 0;}
    }
}


Measured memory_bytes: 4728
#include <stdio.h>
#define N 2000000
int main(){
  int i=0,minv=0,R[N],j=0,n=0,maxv=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&R[i]);
  }
  minv=R[0];
  maxv=R[1]-R[0];
  for(j=1;j<=n-1;j++){
    if(maxv<R[j]-minv) maxv=R[j]-minv;
    if(minv>R[j]) minv=R[j];
  }
  printf("%d\n",maxv);
  return 0;
}

Measured memory_bytes: 2680
#include <stdio.h>
 
int main(void){
  double a,b,c,d,e,f;
  double x,y;
 
  while(scanf("%lf %lf %lf %lf %lf %lf" ,&a ,&b ,&c ,&d ,&e ,&f) != EOF){
   
  x = (c*e - b*f)/(a*e - b*d);
  y = (a*f - c*d)/(a*e - b*d);
 
  if(x == 0) x = 0.000;
  else if(y == 0) y = 0.000; 
  
  printf("%.3f %.3f\n" ,x ,y);
   
}
  return 0;
}

Measured memory_bytes: 652
#include<iostream>

using namespace std;

int main(){
	int n , a , b , x,f;
	cin>>n>>a>>b;
	f = 0;
		for(int i = 0 ; i < n ; i++){
		cin>>x;
		if(x>=b || x < a) f++;
		}
	cout<<f<<endl;

return 0;
}

Measured memory_bytes: 256
K,N = map(int,input().split())
A = list(map(int,input().split()))

X = A[1] - A[0]
i = 1
while i < N-1:
    Y = A[i+1] - A[i]
    if X < Y:
        X = Y
    i += 1
Z = A[0] + K - A[N-1]
if X < Z:
    X = Z

print(K - X)

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

int main(){
	while(true){
		int N;
		cin >> N;
		
		if(N <= 0){
			break;
		}
		
		int oneCount = 0;
		int moreCount = 0;
		for(int i=0; i<N; ++i){
			int k;
			cin >> k;
			if(k == 1){
				oneCount++;
			}else if(k >= 2){
				moreCount++;
			}
		}
		
		if(moreCount == 0){
			puts("NA");
		}else{
			cout << (oneCount+moreCount+1) << endl;
		}
	}
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

typedef complex<double> P;
const double EPS = 1e-10;

double cross(P a, P b) {
    return imag(conj(a) * b);
}

double dot(P a, P b) {
    return real(conj(a) * b);
}

struct L {
    P a, b, v;
    L(){}
    L(P _a, P _b) {a = _a, b = _b, v = b - a;}
    L(double _ax, double _ay, double _bx, double _by) {
        a = P(_ax, _ay), b = P(_bx, _by), v = b - a;
    }
};

// 0: counter-clockwise
// 1: clockwise
// 2: online_back
// 3: online_front
// 4: on_segment
int ccw(P p0, P p1, P p2) {
    if (cross(p1 - p0, p2 - p0) > 0) return 0;
    if (cross(p1 - p0, p2 - p0) < 0) return 1;
    if (dot(p1 - p0, p2 - p0) < 0) return 2;
    if (dot(p0 - p1, p2 - p1) < 0) return 3;
    return 4;
}

bool intersectPS(P p, L l) {
    return ccw(l.a, l.b, p) == 4;
}

bool intersectSS(L l1, L l2) {
    double c1 = cross(l1.v, l2.a - l1.a);
    double c2 = cross(l1.v, l2.b - l1.a);
    double c3 = cross(l2.v, l1.a - l2.a);
    double c4 = cross(l2.v, l1.b - l2.a);
    // all points on the same line
    if (c1 == 0 && c2 == 0 == c3 == 0 && c4 == 0) {
        return (intersectPS(l2.a, l1) || intersectPS(l2.b, l1) ||
                intersectPS(l1.a, l2) || intersectPS(l1.b, l2));
    }
    return (cross(l1.v, l2.a - l1.a) * cross(l1.v, l2.b - l1.a) < EPS &&
            cross(l2.v, l1.a - l2.a) * cross(l2.v, l1.b - l2.a) < EPS);
}

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

    int q;
    cin >> q;
    while (q--) {
        double v[4][2];
        rep(i, 4) rep(j, 2) cin >> v[i][j];
        L l1(v[0][0], v[0][1], v[1][0], v[1][1]);
        L l2(v[2][0], v[2][1], v[3][0], v[3][1]);
        cout << intersectSS(l1, l2) << endl;
    }

}

Measured memory_bytes: 3284
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <unordered_map>
using namespace std;

#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))

typedef unsigned long long lu;
typedef vector<int> Poly;

const int mod = 998244353, gen = 3;

inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x = Sub(x - y); }
inline int Mul(int x, int y) { return (lu)x * y % mod; }
inline int Mul(int x, int y, int z) { return (lu)x * y % mod * z % mod; }

int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}

int Inv(int x) { return Pow(x, mod - 2); }

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

const int maxn = 2e5;

int n;
vector<int> g[maxn];
int M[maxn], P[maxn], F[maxn];

void Dfs(int u) {
  for (int v : g[u]) {
    if (v == P[u]) continue;
    P[v] = u;
    M[v] = max(u, M[u]);
    Dfs(v);
  }
}

unordered_map<int, int> dp[maxn];

int Dfs3(int u, int x) {
  if (dp[u].count(x)) return dp[u][x];
  int ans = 0;
  for (int v : g[u]) {
    if (v == P[u]) continue;
    if (v < x) {
      ans += 1 + Dfs3(v, x);
    }
  }
  return dp[u][x] = ans;
}

int Calc(int x) {
  int p = P[x];
  int B = M[p];
  int ans = 1;

  // x itself
  if (x < B) {
    ans -= 1;
  }

  // class 1
  if (B < x) {
    ans += Dfs3(x, B);
  }

  // class 2
  if (B < p) {
    ans += Dfs3(x, p) - Dfs3(x, B);
  }

  return ans;
}

void Dfs2(int u) {
  for (int v : g[u]) {
    if (v == P[u]) continue;
    F[v] = F[u] + Calc(v);
    Dfs2(v);
  }
}

int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  M[0] = -1;
  P[0] = -1;
  Dfs(0);
  F[0] = 0;
  Dfs2(0);
  for (int i = 1; i < n; ++i) {
    printf("%d%c", F[i], " \n"[i == n - 1]);
  }
  return 0;
}


Measured memory_bytes: 50816
#include <stdio.h>

int F(int, int [], int);

int main()
{
  int sum=0, i, mid, l, r, n, k, w[1000000];

  scanf("%d%d", &n, &k);

  for(i=0; i<n; i++)
    scanf("%d", &w[i]);

  w[n]=-1;
  l=0;
  r=2000000000;

  while(l<r){
    mid=(l+r)/2;
    sum=F(mid,w,k);
    if(sum==n && F(mid-1,w,k)!=sum)break;
    if(sum<n){
      l=mid+1;
    }
    else if(sum==n &&F(mid-1,w,k)==sum){
      r=mid;
    }
  }

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

  return 0;
  
}

int F(int P, int w[], int k){
  int i, sum=0, a=0;
  for(i=0; i<k; i++){
    if(w[a]<=P){
      while(sum+w[a]<=P && w[a]!=-1){
    sum+=w[a];
    a++;
      }
    }
    sum=0;
  }
  return a;
}

Measured memory_bytes: 3104
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

char s[1010];

int tong[30],n,m,cnt1,cnt2;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		for(int j=0;j<m;j++)
			tong[s[j]-'a']++;
	}
	cnt1=cnt2=0;
	for(int i=0;i<=25;i++)
	{
		if(tong[i]&1)
			cnt1++,tong[i]--;
		if(tong[i]%4==2)
			cnt2++,tong[i]-=2;
	}
	if(n&1) 
		swap(n,m);
	if((n%2==1)&&(m%2==1))
	{
		if((cnt1==1)&&(cnt2<=(n+m-2)/2))
			puts("Yes");
		else 
			puts("No");
	}
	else 
	if(m%2==1)
	{
		if(cnt1==0&&cnt2<=(n/2)) 
			puts("Yes");
		else 
			puts("No");
	}
	else 
	{
		if(cnt1==0&&cnt2==0) 
			puts("Yes");
		else 
			puts("No");
	}
	
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int g[60], h[100];
int main() {
	for (int i = 0; i < 60; i++)g[i] = i*i*i;
	for (int i = 0; i < 100; i++)h[i] = i*(i + 1)*(i + 2) / 6;
	while (true) {
		int p, q = 0; cin >> p; if (p == 0)break;
		for (int i = 0; i < 60; i++) {
			for (int j = 0; j < 100; j++) {
				int t = g[i] + h[j];
				if (t <= p && q < t)q = t;
			}
		}
		cout << q << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

import fractions
from functools import reduce

def gcd(x,y):
  if x == 0:
    return y
  else:
    return gcd(y-x*(y//x),x)
 

def lcm(x, y):
    return (x*y)//gcd(x,y)
    
l = 1
B = 0

for i in range(N):
  l = lcm(l,A[i])
for i in range(N):
  B += l//A[i]
B %= mod

print(B)

Measured memory_bytes: 5612
from sys import stdin

input = stdin.readline().rstrip

#x = input().rstrip()
#n = int(input())

#a,b,c = input().split()
#a,b,c = map(int, input().split())

D,T,S = map(int, input().split(" "))

if(T * S >= D):
	print("Yes")
else:
	print("No")


Measured memory_bytes: 61752
#include <stdio.h>

long long a,b,c,tmpa,tmpb;

int main()
{
    while(scanf("%lld %lld",&a,&b) != EOF)
    {
        if(a<0) a = -a;
        if(b<0) b = -b;
        tmpa = a;
        tmpb = b;
        c=a;
        while(a != b)
        {
            if(a>b)
            {
                c = a - b;

                a = c;
            }
            else
            {
                c = b - a;

                b = c;
            }
        }
        tmpa = tmpa/c;
        printf("%lld %lld\n",c,tmpa*tmpb);
    }
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll a[7],p,o,k,l;
  p=0;
  o=0;
  k=0;
  l=0;
  rep(i,6)cin >> a[i];
  rep(i,6){
    if(a[i]==1)p++;
    if(a[i]==2)o++;
    if(a[i]==3)k++;
    if(a[i]==4)l++;
  }
  if(p!=0&&o!=0&&k!=0&&l!=0&&p!=3&&o!=3&&k!=3&&l!=3)printf("YES");
  else printf("NO");
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;

int main() {
	vector<string> v;

	REP(i, 3) {
		string s;
		cin >> s;
		v.push_back(s);
	}

	cout << v[0][0] << v[1][1] << v[2][2] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll SORT(int n, vector<pair<ll, ll>> &v, int start){
  sort(v.begin()+start, v.end());
  return v[n-1].first;
}


int main(void){
 
  ll x;
  cin>>x;
  vector<ll> v(x+1, 0);
  if(x==1){
    cout<<"1"<<endl;
    return 0;
  }

  for(int i=2;i<=x+1;i++){
    ll count = i*i;
    while(1){
      //cout<<count<<endl;
      if(count>x) break;
      v[count]++;
      count *= i;
    }
  }
  for(int i=x;i>0;i--){
    if(v[i]>0){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"1"<<endl;

  return 0;

}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args)
	{
		new Main().run();
	}
	
	public void run()
	{
		Scanner file = new Scanner(System.in);
		int N = file.nextInt();
		int[] ints = new int[N];
		for(int i = 0;i<N;i++)
			ints[i] = file.nextInt();
		int[] before = new int[N];
		int[] after = new int[N];
		before[0] = ints[0];
		after[after.length - 1] = ints[ints.length - 1];
		for(int i = 1;i<ints.length;i++)
		{
			before[i] = gcd(before[i-1],ints[i]);
			after[after.length-i-1] = gcd(after[after.length-i],ints[ints.length-i-1]);
		}
		
		int best = 0;
		
		for(int i = 1;i<ints.length-1;i++)
			best = Math.max(best,gcd(before[i-1],after[i+1]));
		best = Math.max(best, after[1]);
		best = Math.max(best,before[ints.length-2]);
		System.out.println(best);
	}
	
	int gcd(int a, int b)
	{
		return BigInteger.valueOf(a).gcd(BigInteger.valueOf(b)).intValue();
	}
	
}


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

 int main()
 {
     int n;
     string s;
     cin >> n >> s;

    char c = s.at(0);
    int ans = 1;

    for(int i = 1; i < n; i++)
    {
        if(s.at(i) == c) continue;

        c = s.at(i);
        ans++;
    }

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

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void){
    int H, N;
    cin >> H >> N;
    int A[N], B[N];
    for(int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }
    int M[H+10][N+10];
    for(int i = 0; i < N; i++){
        M[0][i] = 0;
    }
    for(int i = 0; i <= H; i++){
        if(i%A[0] == 0){
            M[i][0] = (i/A[0])*B[0];
        }else{
            M[i][0] = (i/A[0]+1)*B[0];
        }
    }
    for(int n = 1; n < N; n++){
        for(int h = 1; h <= H; h++){
            M[h][n] = min(M[h][n-1], M[max(0, h-A[n])][n]+B[n]);
        }
    }
    cout << M[H][N-1] << endl;
    return 0;
}

Measured memory_bytes: 39680
// UNNECESSARY
// #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration
// #include <cstdio>//printf/scanf/fopen/fclose/fprintf/fscanf/snprintf/putc/puts/getc/gets
// #include <fstream>//ifstream/ofstream

// DATA STRUCTURES
#include <array>
#include <bitset>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <valarray>
#include <vector>

// MISCELLANEOUS
#include <algorithm>//min/max/sort(rand-access it)/merge
#include <cassert>
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
#include <iomanip>//setfill/setw/setprecision/fixed/scientific
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN
#include <new>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <utility>//pair

#ifndef REP
#define REP(i,n) for (int i = 0; i < n; ++i)
#endif

#ifndef REPST
#define REPST(i,n) for (size_t i = 0; i < n; ++i)
#endif

#ifndef READ
#define READ(x) std::cin >> x
#endif

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> plli;
typedef std::pair<ull, int> puli;
typedef std::pair<double, int> pdi;
typedef std::pair<ll, ll> pllll;
typedef std::pair<ull, ull> pulul;
typedef std::pair<double, double> pdd;
typedef std::tuple<int, int, int> ti3;
typedef std::tuple<int, int, int, int> ti4;

const bool debug = true;

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

using namespace std;

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a <= c && c <= b ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 256
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif
 
using namespace std;
 
 
int main(){
    int n=0,ans;
    string s;

    cin >> s;
    
    
    for(int i = 0;i<105;i++){
        if(s[i]=='\0'){
            n=i-2;
            break;
        }
    }
    //cout << (!flag ? "Yes" : "No") << endl;
    cout << s[0] << n << s[n+1] << endl;
 
}


Measured memory_bytes: 256
def main():
    n = int(input())
    num_list = [int(input()) for _ in range(n)]

    light_no = 1
    for i in range(n):
        if light_no == 2:
            print(i)
            exit()
        light_no = num_list[light_no-1]
    
    print(-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 49240
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
long long power(long long x, unsigned long long y, unsigned int m){
    if(y == 0) return 1;
    unsigned long long p = power(x, y/2, m) % m;
    p = (p * p) % m;
    
    if(y & 1)
        return  ((x % m)*p) % m;
    else 
        return p;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("in6.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    int T = 1;
    // cin >> T;
    
    FOR1(tt, T){
        // cout << "Case #" << tt << ": ";
        int n; cin >> n;
        if(n < 2) cout << 0;
        else{
            cout << (power(10, n, MOD) - 2*power(9, n, MOD) + MOD + power(8, n, MOD) + MOD) % MOD;
        }
        cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
int main(){
    ll n,k,q,ans=0;
    cin>>n>>k>>q;
    vector<ll> a(q),point(n,0);
    For(i,0,q) {
        cin>>a.at(i);a.at(i)--;
        point.at(a.at(i))++;
    }
    For(i,0,n){
        if(q-point.at(i)<k){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,t,x,y;
    cin>>n;
    for(int i=0;i<n;i++)
{
        cin>>t>>x>>y;
        if(!(x+y<=t&&(t-x-y)%2==0))
{
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";
    return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long X){
    i64 a = X / 500;
    i64 b = (X - a * 500) / 5;
    cout << a * 1000 + b * 5 << endl;
}

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


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

int main() {
	long long N, NOW, COUNT = 1, Cur = 2;
	static long long L[500][500] = {};
	cin >> N;
	NOW = N;
	while (NOW != 0) {
		long long LABEL[500] = {};
		for (int i = 0; i < N; i++) {
			LABEL[i] = i % Cur;
		}
		for (int i = 0; i < N - 1; i++) {
			for (int j = i + 1; j < N; j++) {
				if (LABEL[i] != LABEL[j] && L[i][j] == 0) L[i][j] = COUNT;
			}
		}
		Cur *= 2;
		COUNT++;
		NOW /= 2;
	}
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			cout << L[i][j];
			if (j != N - 1) cout << " ";
			else cout << endl;
		}
	}
}

Measured memory_bytes: 2432
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    static boolean arr[];

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        System.out.println(((n)*(n+1))/2);


    }


}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

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

     for(int t1=0;t1<T;t1++){
	  int x,y,w,h;
	  cin>>x>>y>>w>>h;

	  int N,ans=0;
	  cin>>N;
	  for(int i=0;i<N;i++){
	       int nx,ny;
	       cin>>nx>>ny;

	       if(nx>=x&&ny>=y&&nx<=x+w&&ny<=y+h)++ans;
	  }
	  cout<<ans<<endl;
     }
     return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>

using namespace std;
using ll = long long int; 

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}


ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

ll keta(ll a){
  ll ans = 1;
  while(1){
    if(a/10 > 0){
      ans++;
      a = a/10;
    }
    if(a<10) break;
  }
  return ans;
}

const int MAX = 50;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
  
  ll n;
  cin>>n;
  vector<pair<ll, ll>> map(n);

  for(int i=0;i<n;i++){
    ll x, l;
    cin>>x>>l;
    map[i] = make_pair(x, l);
  }

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

  ll END;
  ll x0, l0;
  x0 = map[0].first;
  l0 = map[0].second;
  END = x0 + l0;
  ll ans = 1;

  for(int i=1;i<n;i++){
    ll x, l;
    x = map[i].first;
    l = map[i].second;

    ll start = x - l;
    ll end = x + l;

    if(start < END){
      if(END > end){
        END = end;
      }
    }else{
      ans++;
      END = end;
    }    
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 1792
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
		
		if(s.charAt(0)!='A'){
		    System.out.println("WA");
		    return;
		}
		
		int ccount=0;
		int cnum=0;
		for(int i=2; i<s.length()-1; i++){
		    if(s.charAt(i)=='C'){
		        ccount++;
		        cnum=i;
		    }
		}
		
		if(ccount!=1){
		    System.out.println("WA");
		    return;
		}
		
		for(int i=1; i<s.length(); i++){
		    if(i!=cnum){
		        if(Character.isUpperCase(s.charAt(i))){
		            System.out.println("WA");
		            return;
		        }
		    }
		}
		
		System.out.println("AC");
		return;
    }
}


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    double k = 0;
    REP(i, N) {
        double x;
        string u;
        cin >> x >> u;
        k += u == "JPY" ? x : x*380000;
    }
    printf("%.8f\n", k);
    return 0;
}


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

#define INF 1234567890
#define ll long long

int X;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> X;
	if (400 <= X && X <= 599) cout << 8;
	else if (600 <= X && X <= 799) cout << 7;
	else if (800 <= X && X <= 999) cout << 6;
	else if (1000 <= X && X <= 1199) cout << 5;
	else if (1200 <= X && X <= 1399) cout << 4;
	else if (1400 <= X && X <= 1599) cout << 3;
	else if (1600 <= X && X <= 1799) cout << 2;
	else if (1800 <= X && X <= 1999) cout << 1;
	return 0;
}

Measured memory_bytes: 3648
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()
a = MAP()

m = 1
ans=0
for _ in range(60):
    bit = sum(i & m for i in a)
    bit //= m
    non_bit = n-bit
    ans = (ans+bit*non_bit*m)%MOD
    m <<= 1
print(ans)

Measured memory_bytes: 44568
#include <iostream>

int main()
{
  int r, g, b;

  int a=0;

  std::cin >> r;
  std::cin >> g;
  std::cin >> b;

  a += r*100 + g*10 + b;

  if ( 0 == a%4){
    std::cout << "YES" << std::endl;
  }else {
    std::cout << "NO" << std::endl;
  }



}


Measured memory_bytes: 256