akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    def is_pal(n):
        s = str(n)
        for i in range(len(s)):
            if s[i] != s[-1 - i]:
                return False
        return True
    ret = 0
    for i in range(A, B + 1):
        if is_pal(i):
            ret += 1
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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

using Graph=vector<vector<int>>;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i],a[i]--;
    if(k==1){
        cout<<n-count(a.begin(),a.end(),0)<<endl;
    }
    else{
        int res=0;
        if(a[0]!=0) a[0]=0,res++;
        vector<int> d(n,0);
        for(int i=0;i<n;i++) d[a[i]]++;
        queue<int> que;
        for(int i=0;i<n;i++) if(d[i]==0) que.push(i); 
        vector<int> b(n);
        while(!que.empty()){
            int v=que.front(); que.pop();
            if(b[v]==k-1){
                if(a[v]!=0) res++;
                d[a[v]]--;
                if(d[a[v]]==0) que.push(a[v]);
                continue;
            }
            
            d[a[v]]--;
            b[a[v]]=max(b[a[v]],b[v]+1);
            if(d[a[v]]==0) que.push(a[v]);
        }
        cout<<res<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  int n;
  cin >> n;
  cout << "ABC" << n;
    return 0;
}

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

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


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.nextLine().toCharArray();
        int n = S.length;

        long ans = 0;
        for (int i = 0; i < (1 << n - 1); i++) {
            // char -> long
            long tmp = (S[0] - '0');
            for (int j = 0; j < n - 1; j++) {
                if ((i & (1 << j)) != 0) {
                    ans += tmp;
                    tmp = 0;
                }

                tmp = (tmp * 10) + (S[j + 1] - '0');
            }
            ans += tmp;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <list>
#include <typeinfo>
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
long long search_use[10000000] = {};
int dp_left[11000000] = {};
int dp_right[11000000] = {};
bool hoge_canuse[10000] = {};
void prepare_for_search() {
	for (int i = 0;i < 200;++i) {
		search_use[i] = (i + 1)*(i + 2)*(i + 3) / 6;
		if (search_use[i] % 2 == 1) hoge_canuse[i] = true;
	}
}

int main() {
	prepare_for_search();
	dp_left[0] = 0;
	for (int i = 1;i < 1100000;++i) {
		int hoge = 9999999,hogehoge = 99999999;
		for (int q = 0;i-search_use[q] >= 0;++q) {
			hoge = min(hoge, dp_left[i - search_use[q]] + 1);
			if (hoge_canuse[q] == true) hogehoge = min(hogehoge, dp_right[i - search_use[q]] + 1);
		}
		dp_left[i] = hoge;
		dp_right[i] = hogehoge;
	}
	int ans = 0;
	while(cin >> ans){
		if (ans == 0) break;
		cout << dp_left[ans] <<" "<<dp_right[ans]<< endl;
	}
}


Measured memory_bytes: 17532
n = int(input())
l = []
for i in range(n):
    l.append([i for i in input().split()])

for i in range(n):
    l[i][1] = 100 -int(l[i][1])

for i in range(n):
    l[i].append(int(i))

for i in sorted(l):
    print(i[2] + 1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1000007,INF=1<<30;

vector<int> prime;//i番目の素数
bool is_prime[MAX+1];

void sieve(int n){
    for(int i=0;i<=n;i++){
        is_prime[i]=true;
    }
    
    is_prime[0]=is_prime[1]=false;
    
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime.push_back(i);
            for(int j=2*i;j<=n;j+=i){
                is_prime[j] = false;
            }
        }
    }
}

int cnt[MAX];

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    sieve(MAX-2);
    
    int N;cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
        int sub=A[i];
        
        for(int p:prime){
            int a=0;
            while(sub%p==0){
                sub/=p;
                a++;
            }
            cnt[p]=max(cnt[p],a);
            
            if(sub==1) break;
            
            if(p*p>sub){
                cnt[sub]=max(cnt[sub],1);
                break;
            }
        }
    }
    
    ll mae=1;
    
    for(int p:prime){
        mae*=rui(p,cnt[p]);
        mae%=mod;
    }
    
    ll ans=0;
    
    for(int i=0;i<N;i++){
        ll plus=mae;
        int sub=A[i];
        for(int p:prime){
            int a=0;
            while(sub%p==0){
                sub/=p;
                a++;
            }
            if(a){
                plus*=rui(rui(p,mod-2),a);
                plus%=mod;
            }
            
            if(sub==1) break;
            
            if(p*p>sub){
                plus*=rui(sub,mod-2);
                plus%=mod;
                break;
            }
        }
        
        ans+=plus;
        ans%=mod;
        
        //cout<<ans<<endl;
    }
    
    cout<<ans<<endl;
}




Measured memory_bytes: 5368
#include<iostream>
#include<math.h>
#include<string.h>
#include<set>
#include<algorithm>
using namespace std;

int main(){
    string a,b;
    cin>>a>>b;

    int sizea=a.size();
    int sizeb=b.size();
    for(int i=0;i<sizeb;++i){
        cout<<a[i]<<b[i];
    }
    if(sizea>sizeb)cout<<a[sizea-1];
}

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

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

  if( a < b ) cout<<"a < b"<<endl;
  if( a > b ) cout<<"a > b"<<endl;
  if( a == b ) cout<<"a == b"<<endl;

  return 0;

}


Measured memory_bytes: 3088
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        if(a<b){
            System.out.println("a < b");
        }else if(a>b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }
    }
}



Measured memory_bytes: 26404
#include <iostream>
#include <string>

using namespace std;

int main() {

	char c[1000][10000];

	for (int i = 0;; i++) {

		cin >> c[i];

		if (c[i][0] == '0')break;

		int ans = 0;
		int u = 0;

		while (c[i][u] != 0) {

			ans += c[i][u] - '0';
			u++;

		}

		cout << ans << endl;

	}



	return 0;

}



Measured memory_bytes: 3624
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int A[100010];

lint getCost(int N, int s)
{
    lint sum = 0, cost = 0;
    FOR(i, 0, N) {
        sum += A[i] * s;
        if (i % 2 == 0) {
            if (sum <= 0) {
                cost += 1 - sum;
                sum = 1;
            }
        } else {
            if (sum >= 0)
                cost += 1 + sum, sum = -1;
        }
    }

    return cost;
};

void solveSingleCase(int caseNo)
{
    int N;
    cin >> N;
    READRANGE(A, A + N);

    cout << min(getCost(N, 1), getCost(N, -1)) << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

    ll n, r;cin >> n >> r;
    n = min(n, 10LL);
    cout << r + (10 - n) * 100 << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

string s;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s;
	llint sum = 0;
	for(int i = 0; i < s.size(); i++){
		sum += s[i]-'0';
	}
	if(sum % 9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 3748
#include <iostream>

using namespace std;

int main()
{
    int a[30],b,c,j;
    for(int k=0;k<30;k++){
        a[k]=0;
    }
      for(int i=0;i<28;i++){
        cin>>b;
          a[b-1]=1;
    }for(int h=0;h<30;h++){
        if(a[h]==0){
          c=h+1;
            cout<<c<<endl;}}

       return 0;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long
#define R register
using namespace std;
const int N =82;
template <class Ruby_Rose> inline void read(Ruby_Rose &x)
{
 	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}
int n, m, val[N][N], f[N][N][N*N*4], ans=2e9;

int main()
{
	read(n), read(m);
	for(R int i=1; i<=n; i++)
		for(R int j=1; j<=m; j++)
			read(val[i][j]);
	for(R int i=1; i<=n; i++)
		for(R int j=1, qa; j<=m; j++)
			read(qa), val[i][j]-=qa;
	f[1][1][N*N*2+val[1][1]]=1;
	for(R int i=1; i<=n; i++)
	{
		for(R int j=1; j<=m; j++)
		{
			for(R int k=1; k<N*N*4; k++)
			{
				f[i+1][j][k+val[i+1][j]]|=f[i][j][k];
				f[i][j+1][k+val[i][j+1]]|=f[i][j][k];
				f[i+1][j][k-val[i+1][j]]|=f[i][j][k];
				f[i][j+1][k-val[i][j+1]]|=f[i][j][k];
			}
		}
	}
	for(R int k=1; k<N*N*4; k++)
		if(f[n][m][k])ans=min(ans, abs(N*N*2-k));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 698496
/*input

*/
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

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

#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)

class DivideNumber {
public:
    string get(int n, int base){
        if(!n) return "0";
        string res = "";
        while(n){
            int rem = n%base;
            n /= base;
            if(rem < 0){
                rem -= base;
                ++n;
            }
            res = to_string(rem) + res;
        }
        return res;
    }
    void solve(std::istream& in, std::ostream& out) {
        int n; in >> n;
        out << get(n, -2);
    }
};


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    DivideNumber solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    int n = 1;
for(int i = 0; i < n; ++i) {
    solver.solve(in, out);
}
    return 0;
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    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;
    }
}
ll 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;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
bool compare_by(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

vector<pair<int,ll>> vec[100000];
ll cost[100000];
void dfs(int now,ll COST){
    cost[now]=COST;
    int next;
    REP(i,vec[now].size()){
        next=vec[now][i].first;
        if(cost[next]<0){
            dfs(next,COST+vec[now][i].second);
        }
    }
}
int counter(int x){
    if(!x)return 0;
    return counter(x>>1)+(x&1);
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    int M=in();
    COMint();
    int a[N];

    REP(i,N){
        cin>>a[i];
        a[i]/=2;
    }
    int A;A=a[0];
    int cnt=0;
    REP(i,30){
        if(A%2==0){
            cnt++;
        }else{
            break;
        }
        A/=2;
    }
    ll l;l=1;
    cnt=pow(2,cnt);
    REP(i,N){
        if(a[i]%cnt!=0||a[i]%(cnt*2)==0){
            cout<<0<<endl;
            
            return 0;
        }else{
            l=lcm(l,a[i]/cnt);
        }
        if(l>M){
            cout<<0<<endl;
            return 0;
        }
    }
    int ans;ans=0;
    l=l*cnt;
    debug(l);
    if(l>M){
        cout<<"0"<<endl;
        return 0;
    }
    ans=(M-l)/(2*l);
    ans++;
    cout<<ans<<endl;
    return 0;
}


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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    int n,ans=0;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;++i)
    {
        cin>>v[i];
        if(i%2==0 && v[i]%2==1)
            ++ans;
    }
    cout<<ans;
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
	long long val;
	constexpr Fp(long long v = 0) noexcept : val(v% MOD) {
		if (val < 0) val += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr Fp operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
	constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
	constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
	constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
	constexpr Fp& operator += (const Fp& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr Fp& operator -= (const Fp& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr Fp& operator *= (const Fp& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr Fp& operator /= (const Fp& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const Fp& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Fp& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream& os, const Fp<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

int main() {
	
	const ll mod = 1000000007;
	ll n; cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (n == 2) {
		cout << 2 << endl;
		return 0;
	}
	mint tmp10 = 1;
	mint tmp9 = 1;
	mint tmp8 = 1;
	ll m = n;
	while (m--) {
		tmp10 *= 10;
		tmp9 *= 9;
		tmp8 *= 8;
	}
	mint ans = tmp10 + tmp8 - tmp9 - tmp9;
	cout << ans << endl;
}

Measured memory_bytes: 3588
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int n;cin>>n;
  vector<int> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i];
  }
  vector<int> B(n);
  for(int i = 0; n > i; i++){
    cin>>B[i];
  }
  vector<int> C(n-1);
  for(int i = 0; n-1 > i; i++){
    cin>>C[i];
  }
  int ans = 0;
  for(int i = 0; n > i; i++){
    ans += B[A[i]-1];
    if(i){
      if(A[i-1]+1 == A[i]){
        ans += C[A[i-1]-1];
      }
    }
  }
  cout << ans << endl;

  
}


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

int n;
vector<int> a, b;

int sub(vector<int> a) {
  vector<int> s;
  for (int i = 0; i < n; ++i) s.push_back(i + 1);
  
  int cnt = 0;
  do {
    ++cnt;
    if (s == a) break;
  } while(next_permutation(s.begin(), s.end()));
  return cnt;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    a.push_back(k);
  }
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    b.push_back(k);
  }

  int p = sub(a);
  int q = sub(b);
  cout << abs(q - p) << endl;
}

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

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        int l=s.length();
        boolean flag=(l%2==0);
        for(int i=1;i<l;i+=2){
            if(!s.substring(i-1,i+1).equals("hi"))flag=false;
        }
        if(flag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc060
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            List <int> input = s.Select(e => int.Parse(e)).ToList();
            
            int m = int.Parse(Console.ReadLine());
            List<int> result = new List<int>();

            for (int i = 0; i < m; ++i)
            {
                string[] line = Console.ReadLine().Split(' ');
                int index = int.Parse(line[0]);
                int value = int.Parse(line[1]);
                int sum = 0;
                for (int j = 1; j <= n; ++j)
                {
                    if (index != j)
                        sum += input[j-1];
                }
                sum += value;
                result.Add(sum);
            }

            for (int i = 0; i < m; ++i)
            {
                Console.WriteLine(result[i]);
            }
        }
    }
}


Measured memory_bytes: 3032
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <vector>
using namespace std;

const int N = 2e5;
deque<int> q;

int n;

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        int x;
        scanf("%d", &x);
        if (i & 1)
            q.push_back(x);
        else
            q.push_front(x);
    }
    if ((n & 1) == 0)
    {
        for (deque<int>::iterator it = q.begin(); it != q.end(); ++it)
        {
            printf("%d ", *it);
        }
        return 0;
    }
    else
    {
        deque<int>::iterator it = q.end();
        --it;
        for (; it != q.begin(); --it)
        {
            printf("%d ", *it);
        }
        printf("%d\n", q.front());
        return 0;
    }
    return 0;
}

Measured memory_bytes: 2944
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;
int main() {
	while (true) {
		int a, b;
		cin >> a >> b;
		if (a == 0 && b == 0)break;
		for (int i = 0; i < a; i++) {
			for (int j = 0; j < b; j++) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
N = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(N-2):
    if (p[i+1] > p[i] and p[i+1] < p[i+2]) or (p[i+1] < p[i] and p[i+1] > p[i+2]):
        ans += 1
print(ans)

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

using namespace std;

#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second

typedef long long ll;

const int N3 = 1e3 + 5;
const int N4 = 1e4 + 5;
const int N5 = 1e5 + 5;
const int N6 = 1e6 + 5;
const int N7 = 1e7 + 5;
const int N8 = 1e8 + 5;
const int N9 = 1e9 + 5;
const int mod = N9 + 2;

int n, x, a[N5 * 2], used[N5 * 2];

vector < int > v;

int main()
{
    cin >> n >> x;
    if (x == 1 || x == n + n - 1)
        return !(cout << "No");
    if (x == 2)
    {
        a[n] = x;
        a[n - 1] = x + 1;
        a[n + 1] = x - 1;
        a[n + 2] = x + 2;
        used[x] = used[x - 1] = used[x + 1] = used[x + 2] = 1;
    }
    else
    {
        a[n] = x;
        a[n - 1] = x - 1;
        a[n + 1] = x + 1;
        a[n + 2] = x - 2;
        used[x] = used[x + 1] = used[x - 1] = used[x - 2] = 1;
    }
    forn (i, 1, n + n - 1)
    {
        if (!used[i])
            v.pb(i);
    }
    int cnt = 0;
    forn (i, 1, n + n - 1)
    {
        if (!a[i])
        {
            a[i] = v[cnt++];
        }
    }
    cout << "Yes\n";
    forn (i, 1, n + n - 1)
        cout << a[i] << "\n";
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int q;
    cin>>q;
    
    vector<bool> pr(100001,true);
    pr[1]=false;
    for(int i=2; i<=100000; i++){
        if(pr[i]){
            for(int j=2*i; j<=100000; j+=i){
                pr[j]=false;
            }
        }
    }
    vector<bool> cands(100001, false);
    //cands[3]=true;
    for(int i=3; i<=100000; i++){
        if(pr[i] && pr[(i+1)/2]) cands[i]=true;
    }
    vector<int> cs(1000001,0);
    for(int i=3; i<=100000; i++){
        cs[i]=cs[i-1]+cands[i];
    }
    
    for(int i=0; i<q; i++){
        int x,y;
        cin>>x>>y;
        cout<<cs[y]-cs[x-1]<<endl;
    }
    
    
    
    
    return 0;
}

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

class UnionFind{
public:
    vector<ll>data;
    UnionFind(ll n):data(n,-1){}
    bool Union(ll a,ll b){
        a=root(a);b=root(b);
        if(a==b)return 1;
        if(data[a]>data[b])swap(a,b);
        data[a]+=data[b];
        data[b]=a;
        return 0;
    }
    bool Find(ll a,ll b){return root(a)==root(b);}
    ll root(ll a){return data[a]<0?a:root(data[a]);}
};

signed main(){
    ll h,w;
    cin>>h>>w;
    UnionFind uf(h*w);
    vector<string>s(h);
    for(auto&i:s)cin>>i;
    rep(i,h)rep(j,w){
        if(i+1<h&&s[i][j]!=s[i+1][j])uf.Union(i*w+j,(i+1)*w+j); // 下が違う色だったらまとめる
        if(j+1<w&&s[i][j]!=s[i][j+1])uf.Union(i*w+j,i*w+j+1); // 右が違う色だったらまとめる
    }
    vector<pair<ll,ll>>cnt(h*w);
    rep(i,h)rep(j,w){
        if(s[i][j]=='#')cnt[uf.root(i*w+j)].first++; // rootで白と黒を数える
        else cnt[uf.root(i*w+j)].second++;
    }
    ll ans=0;
    rep(i,h*w)ans+=cnt[i].first*cnt[i].second;
    cout<<ans;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef long double LD;

const int MOD = 1e9 + 7;
const int MAXN = 1e5;

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

	int N, A[MAXN];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A+N);
	int pre = A[0], cnt = 0;
	for (int i = 1; i < N; i++) {
		if (pre == A[i]) cnt++;
		else pre = A[i];
	}
	cout << N-cnt-((cnt%2==1)?1:0) << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int b=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a==b+1)
      b++;
  }
  cout<<(b!=0?n-b:-1)<<endl;
}

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

const int N = 100;

int main(){
	int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;
	int water, sugar;
	double den = -1;
	for (int i = 0; i <= N; i++){
		for (int j = 0; j <= N; j++){
			if (i == 0 && j == 0) continue;
			for (int k = 0; k <= N; k++){
				for (int l = 0; l <= N; l++){
					if (a*i*100 + b*j*100 + k*c + l*d > f) continue;
					if (e*(a*i + b*j) >= k*c+l*d){
						if (den < (double)(k*c+l*d)/(a*i+b*j)) {
							water = (a*i+b*j)*100, sugar = k*c+l*d; 
							den = (double)(k*c+l*d)/(double)(a*i+b*j);
						}
					}
				}
			}
		}
	}
	cout << water + sugar << " " << sugar << endl;
}

Measured memory_bytes: 256
N = int(input())
n6 = 1
n9 = 1
li = []
while 9**n9 <= N:
    li.append(9**n9)
    n9 += 1
while 6**n6 <= N:
    li.append(6**n6)
    n6 += 1

li.sort()
INF = 10**10
# 1円の場合はね
dp = [[i for i in range(N+1)] for i in range(len(li) + 1)]
dp = [i for i in range(N+1)]


for i,l in enumerate(li):
    for j in range(N+1):
        if j+l > N : continue
        dp[j+l] = min(dp[j+l], dp[j]+1)
print(dp[N])


Measured memory_bytes: 54436
import sys

n = list(map(int,input().split()))
r = list(map(int,input().split()))
t = int(input())

A = n[0]
V = n[1]

B = r[0]
W = r[1]

T = t

after_a = A + V * T
after_b = B + W * T

after_a_min = A - V * T
after_b_min = B - W * T

if (after_a == after_b) or (after_a_min == after_b_min):
    print('YES')
    sys.exit()

if A < B and after_a > after_b:
    print('YES')
    sys.exit()

if A < B and after_a < after_b:
    print('NO')
    sys.exit()


if A > B and after_a_min < after_b_min:
    print('YES')
    sys.exit()

if A > B and after_a_min > after_b_min:
    print('NO')
    sys.exit()

Measured memory_bytes: 9184
n = int(input())
a = [input() for i in range(n)]

b = sorted(a)

word = b[0]
word_idx = 0
w = []
for i in range(n):
  if word == b[i]:
    word_idx += 1
  else:
    w.append((word,word_idx))
    word_idx = 1
    word = b[i]
    
w.append((word,word_idx))
#print(w)
n_max = max(w, key=lambda x:x[1])[1]

for i in range(len(w)):
  if w[i][1] == n_max:
    print(w[i][0])



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

int n, x, L[100], c, d[100];




int main() {
	cin >> n >> x;
	for (int i = 0; i < n; i++) cin >> L[i];
	if (d[0] <= x) c++;
	for (int i = 1; i < n + 2; i++) {
		d[i] = d[i - 1] + L[i - 1];
		if (d[i] <= x) c++;
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>

int compare(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int main() {
    int N;
    int *nums;
    int i;
    int count = 1;
    int total = 0;

    scanf("%d", &N);

    nums = (int *)malloc(sizeof(int) * (N+1));

    for(i = 0; i < N; i++) {
        scanf("%d", &nums[i]);
    }

    nums[N] = -1;

    qsort(nums, N, sizeof(int), compare);

    for(i = 0; i < N; i++) {
        while(nums[i] == nums[i+1]) {
            count++;
            i++;
        }

        if(count % 2 != 0) total++; 

        count = 1;
    }

    printf("%d", total);

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define irep(i,a,b) for(typeof(i) i = (a); i < (b); ++i)
#define itrep(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)


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

	int N;
	cin >> N;
	multiset<pair<ll, ll> > L; // (A,B)
	multiset<pair<ll, ll> > U; // (B,A)
	for (int i = 0; i < N; i++) {
		ll A, B;
		cin >> A >> B;
		L.insert(pair<ll, ll>(A, B));
		U.insert(pair<ll, ll>(B, A));
	}

	if (N % 2 == 1) {
		auto it = L.begin();
		auto jt = U.rbegin();
		for (int i = 0; i < (N - 1) / 2; i++) { // (N+1)/2番目に移動
			it++;
			jt++;
		}
		cout << jt->first - it->first + 1 << endl;
	}
	else {
		auto it = L.begin();
		auto jt = U.rbegin();
		for (int i = 0; i < N / 2 - 1; i++) {
			it++;
			jt++;
		}
//		cout << it->first << "," << jt->first << endl;
//		cout << (++it)->first << "," << (++jt)->first << endl;
		cout << (jt->first + (++jt)->first) - (it->first + (++it)->first) + 1 << endl;
	}
	return(0);
}


Measured memory_bytes: 28576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,m;
	cin>>n>>m;
	vector<pair<ll,ll>>a;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		a.push_back(make_pair(y,x));
	}
	sort(a.begin(),a.end());
	ll ans=0,cnt=0;
	while(cnt!=m){
		ll now=a[cnt].first;
		ans++;
		cnt++;
		while(cnt!=m&&now>a[cnt].second){
			cnt++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 2420
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s;cin>>s;
    int k;cin>>k;
    map<string,int>m;
    vector<string>sss;
    for(int i=0;i<s.length();i++){
        string ss="";
        ss+=s[i];
        if(!m[ss]){
            m[ss]++;
            sss.pb(ss);
        }
        for(int j=i+1;j<i+k&&j<s.length();j++){
            ss+=s[j];
            if(!m[ss]){
                m[ss]++;
                sss.pb(ss);
            }
        }
    }
    sort(all(sss));
    cout<<sss[k-1]<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

using lli = int64_t;

int main()
{
    ios_base::sync_with_stdio(0);

    lli n, k; cin >> n >> k;

    map<lli, lli> mp;

    for(int i = 0; i < n; i++)
    {
        lli a, b; cin >> a >> b;

        mp[a] += b;
    }

    lli cur = 0, ans = 0;
    for(auto& pr : mp)
    {
        if(cur < k) ans = pr.first;
        cur += pr.second;
    }

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

Measured memory_bytes: 4224
S = input()
Count = 0

if S[0] != 'A':
    print('WA')

else:
    if S[1].isupper() or S[-1].isupper():
        print('WA')
    else:
        for i in S[2:]:
            if i.isupper():
                if Count==0 and i == 'C':
                    Count += 1
                else:
                    print('WA')
                    exit()
        if Count == 1:
            print('AC')
        else:
            print('WA')


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

int main(void) {
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0 && i % 5 == 0) {}
		else if (i % 3 == 0) {}
		else if(i%5==0){}
		else {
			ans += i;
		}
	}
	cout << ans;
	cout << endl;
}



Measured memory_bytes: 3676
fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var a = readLine()!!.split(" ").map{it.toInt()}
    var ans = Array(n){0}
    for (i in a) {
        ans[i-1] += 1
    }
    println(ans.joinToString("\n"))
}

Measured memory_bytes: 73088
from sys import stdin

while True:
    (h, w) = [int(i) for i in stdin.readline().split(' ')]
    if h == 0 and w == 0:
        break

    for i in range(h):
        for j in range(w):
            if i == 0 or i == h - 1 or j == 0 or j == w - 1:
                print('#', end='')
            else:
                print('.', end='')

        print()

    print()

Measured memory_bytes: 6804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
P p[100005];
string s;
int k[100005];
int w[100005];
int ans1,ans2;
int main(void){
    ll n,m; cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>p[i].first;
        cin>>s;
        if(s=="AC"){
            p[i].second=1;
        }else{
            p[i].second=0;
        }
    }
    for(int i=0;i<m;i++){
        int t=p[i].first;
        if(k[p[i].first]==0){
            if(p[i].second==0){
                w[p[i].first]++;
            }else{
                ans2++;
                k[p[i].first]=1;
            }
        }
    }
    for(int i=0;i<=n;i++){
        ans1+=k[i]*w[i];
    }
    cout<<ans2<<" "<<ans1<<endl;
    
}


Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var info = Console.ReadLine();
            var chr = info.ToCharArray();
            if(chr[0] == chr[1] && chr[1] == chr[2])
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}

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

int main(){
    int ans=0;
    string s,t;
    cin>>s>>t;
    rep(i,s.size()){
        if(s[i]!=t[i])ans+=1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3832
n= [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
lake = n[0]
num_ie = n[1]
kyori = []
for i in range(num_ie-1):
    kyori.append(l[i+1]-l[i])
kyori.append(lake - l[num_ie-1] + l[0])
output = 0
output += sum(kyori) 
output -= max(kyori)

print(output)



Measured memory_bytes: 24948
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; j < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  ll N;
  ll inputs[5];
  ll minT = LINF;
  cin >> N;
  rep(i,5){
    cin >> inputs[i];
    minT= min(minT,inputs[i]);
  }
  if(minT >= N) {
    cout << 5 << endl;
    return 0;
  }
  ll p = 0;
  if(N % minT == 0) {
    p = N / minT;
  } else {
    p = N / minT + 1;
  }
  p--;
  
  cout << 5 + p << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

bool solve(){
  ll A,B,C,D;cin >> A >> B >> C >> D;
  if(A<B)return false;
  if(D<B) return false;
  if(B<=C) return true;
  //C<B && B<=Dとなっている
  A%=B;
  if(A>C)return false;
  D%=B;
  if(D==0)return true;
  set<ll> st;
  while(true){
    A%=B;
    A%=D;
    if(st.count(A))return true;
    st.insert(A);
    ll Q = (B-A-1)/D;
    A+=Q*D;
    if(A>C)break;
    A+=D;
  }
  return false;
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int T;cin >> T;
  while(T--){
    YesNo(solve());
  }
  return 0;
} 

//1回の補充で増える数D


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lld;

#define forn(i,n) for(int i = 0;i<n;i++)
#define forne(i,j,n) for(int i = j;i<n;i++)
const ll mod = 1e9+7;
const ll INF = 1000000001;
const ll N = 1000001;
#define F first
#define pb(a) push_back(a)
#define S second
#define pii pair<int,int>
typedef pair<ll,ll> pll;

ll powm(ll base,ll exp) {
	ll ans=1;
	while(exp){
		if(exp&1) ans=(ans*base)%mod;
		exp>>=1,base=(base*base)%mod;
	}
	return ans;
}
// int maxdepth = INT_MAX;
// vector<int> edgeVector[100000];
// ll minans = 1;
// printf("1 %d D\n",abs(r));
// priority_queue<ll,vector<ll>,greater<ll>> pq;
ll A[N],B[N];
// vector<vector<ll>> adj(N);
// vector<set<ll>> adjs(N);
// ll adj[1001][1001];
// vector<vector<ll>> ans(1001);
// bool visited[N];
// ll cnt[1001];
// ll h,c,t;
// vector<pair<int, pair<int, int> > > g[300043];

int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

lld a,b;
cin>>a>>b;
ll ans = (ll)(a*b);
cout<<ans<<endl;

}

Measured memory_bytes: 3748
fun main(args: Array<String>) = yorukatsu11d()

fun yorukatsu11d() {
    val (h, w) = readLine()!!.split(' ').map { it.toInt() }
    val walls = (0..9).map {
        readLine()!!.split(' ').map { it.toInt() }.toIntArray()
    }.toTypedArray()
    val queries = (1..h).map { readLine()!!.split(' ').map { it.toInt() } }
        .flatten().filter { it != 1 && it != -1 }.toIntArray()

    for (k in 0..9)
        for (i in 0..9)
            for (j in 0..9) walls[i][j] = Math.min(walls[i][j], walls[i][k] + walls[k][j])

    val answer = queries.map { walls[it][1] }.sum()

    println(answer)
}


Measured memory_bytes: 41848
import numpy as np
import math
#入力
n = int(input())
x = np.array(list(map(int, input().split())))
mean_x = x.mean()
if sum((x - math.ceil(mean_x))**2) >= sum((x - math.floor(mean_x))**2):
    print(sum((x - math.floor(mean_x))**2))
else:
    print(sum((x - math.ceil(mean_x))**2))

Measured memory_bytes: 12484
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int p = 0;
    for(int i = 0; i < n; i++) {
      int a = sc.nextInt();
      if(a == (p + 1)) {
        p++;
      }
    }
    int ans = n - p;
    if(ans == n) ans = -1;
    System.out.println(ans);
  }
}


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

int main(){
	string S;
	cin >> S;
	int min = 753;
	for (int i = 0; i < S.length()-2; ++i){
		int tmp = 100*(S[i]-'0') + 10*(S[i+1]-'0') + S[i+2]-'0';
		if(tmp <= 753 && 753 - tmp < min) min = 753 - tmp;
		if(tmp > 753 && tmp - 753 < min) min = tmp - 753;
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 256