akhauriyash/Code-Regression huggingface dataset:
height_array =[0, 0, 0]
for i in 1..10
     new_height = gets.to_i
    if height_array[0] <= new_height 
        height_array[2] = height_array[1]
        height_array[1] = height_array[0]
        height_array[0] = new_height
    elsif height_array[1] <= new_height
        height_array[2] = height_array[1]
        height_array[1] = new_height
    elsif height_array[2] <= new_height
        height_array[2] = new_height
    else
    end
end
height_array.each do |height|
    puts height
end

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

#define ll long long int
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vl>
#define vvi vector<vi>
#define pb push_back
#define P pair<ll,ll>
#define mp make_pair
#define F first
#define S second
#define rep(i,n) for(ll i=0; i<n; i++)
#define Sort(v) sort(v.begin(), v.end())
#define all(v) v.begin(),v.end()

ll mo = 1000000007;
ll MO = 998244353;

ll modpower(ll a, ll b, ll mod){
	ll ans = 1;
	if(b == 0){
		return 1;
	}
	if(b%2 == 1){
		ans = a;
	}
	ll x = modpower(a,b/2,mod)%mod;
	ans *= (x*x)%mod;
	ans %= mod;
	return ans;
}

void pri(vl a){
	for(auto i:a)
		cout<<i<<" ";
	cout<<endl;
}

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

void solve(){
	int x; cin >> x;
	if(x>=30)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	int nt = 1;
	// cin>>nt;
	while(nt--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int n,a,b,c,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d",&a,&b,&c);
		if(a*a==b*b+c*c || b*b==c*c+a*a || c*c==a*a+b*b){
			printf("YES\n");
		}
		else printf("NO\n");
	}
	
	return 0;
}

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

int main() {
  string s[3];
  cin >> s[0];
  cin >> s[1];
  cin >> s[2];

  string ans;
  ans.push_back('A');
  ans.push_back(s[1][0]);
  ans.push_back('C');
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

#define MAX_DP  100005
int dp[MAX_DP];

inline int abs( int n ){
    return (n>=0)? n:-n;
}

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> H(N);
    for( auto &h: H ){
        std::cin >> h;
    }

    if( N == 2 )
    {
        std::cout << abs(H[1]-H[0]) << std::endl;
        return 0;
    }
    else if( N == 3 )
    {
        std::cout << std::min( abs(H[1]-H[0]), abs(H[2]-H[0]) ) << std::endl;
    }

    // 0-origin
    dp[0] = H[0];
    dp[1] = abs( H[0]-H[1] );
    dp[2] = abs( H[0]-H[2] );
    
    for( int i = 3; i < N; i++ ){
        dp[i] = std::min( dp[i-2]+abs( H[i-2]-H[i] ), abs( dp[i-1]+abs(H[i-1]-H[i]) ) );
    }

    std::cout << dp[N-1] << std::endl;
    
    return 0;
}

Measured memory_bytes: 1024
import scala.annotation.tailrec

object Scanner {
  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}

object Main extends App {
  val n = Scanner.nextInt()
  var a = Array.fill(n)(Scanner.nextInt())

  var dp0 = 0L
  var dp1 = Long.MinValue/2

  (0 until n).foreach(i=>{
    val newDp0 = Seq(dp0+a(i),dp1-a(i)).max
    val newDp1 = Seq(dp0-a(i),dp1+a(i)).max
    dp0 = newDp0
    dp1 = newDp1
  })

  println(dp0)
}

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

right = []
left = []
for i in range(N):
    if i % 2 == 0:
        right.append(A[i])
    else:
        left.append(A[i])
answer = left[::-1]
answer += right
if N%2 == 1:
  answer = answer[::-1]
print(*answer)
                

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

int main(){
	ll a,v;	cin>>a>>v;
 	ll b,w;	cin>>b>>w;
  	double t;	cin>>t;
  if(v>w){
  	double temp=abs(b-a)*(1.0);
    double tm=v-w;
   	double p=(temp/tm);
    if(p<=t){
    	cout<<"YES"<<endl;
    }
    else{
    	cout<<"NO"<<endl;
    }
  }
  else{
  	cout<<"NO"<<endl;
  }
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    for(int i=0; i<s.size(); ++i) {
        cout << (char)('A' + (s[i] - 'A' + 23) % 26);
    }
    cout << endl;
}


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

typedef long long ll;
const int maxn = 900010,rhl = 1000000007;
int N,M,K; ll jie[maxn],inv[maxn],mi[maxn];

inline ll qsm(ll a,int b)
{
	ll ret = 1;
	for (;b;b >>= 1,(a *= a) %= rhl) if (b&1) (ret *= a) %= rhl;
	return ret;
}

inline int gi()
{
	char ch; int ret = 0,f = 1;
	do ch = getchar(); while (!(ch >= '0'&&ch <= '9')&&ch != '-');
	if (ch == '-') f = -1,ch = getchar();
	do ret = ret*10+ch-'0',ch = getchar(); while (ch >= '0'&&ch <= '9');
	return ret*f;
}

inline ll C(int n,int m) { if (n < m||m < 0) return 0; return jie[n]*inv[m]%rhl*inv[n-m]%rhl; }

int main()
{
	//freopen("H.in","r",stdin);
	//freopen("H.out","w",stdout);
	N = gi(); M = gi(); K = gi();
	jie[0] = mi[0] = 1;
	for (int i = 1;i <= N+M+K;++i)
	{
		mi[i] = mi[i-1]*3LL; while (mi[i] >= rhl) mi[i] -= rhl;
		jie[i] = jie[i-1]*(ll)i; if (jie[i] >= rhl) jie[i] %= rhl;
	}
	inv[N+M+K] = qsm(jie[N+M+K],rhl-2);
	for (int i = N+M+K;i;--i)
	{
		inv[i-1] = inv[i]*(ll)i;
		if (inv[i-1] >= rhl) inv[i-1] %= rhl;
	}
	ll sum = 1,ans = 0;
	for (int i = 0;i <= M+K;++i)
	{
		ll tm = C(N+i-1,i)*mi[M+K-i]%rhl;
		ans += tm*sum%rhl; if (ans >= rhl) ans %= rhl;
		sum <<= 1; if (sum >= rhl) sum -= rhl;
		sum -= C(i,i-K)+C(i,M); while (sum < 0) sum += rhl;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 21376
#include<iostream>
#include<stdio.h>
#include<math.h>
//#define PI 3.141592653589;
using namespace std;
int main()
{
    double r,b,PI=3.141592653589;
    cin>>r;
    printf("%.6lf %.6lf\n",r*r*PI,r*2*PI);


    return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b ,c, d;
	cin >> a>> b >> c >> d;
	if(a + b == c + d){
		cout << "Balanced" << endl;
	}else if(a + b > c + d){
		cout << "Left" << endl;
	}else{
		cout << "Right" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://atcoder.jp/contests/abc119/tasks/abc119_d>
 問題文============================================================
 =================================================================
 解説=============================================================
 
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B,Q; cin >> A >> B >> Q;
    vector<ll> s(A),t(B),x(Q);
    for(auto& in:s) cin >> in;
    for(auto& in:t) cin >> in;
    s.push_back(-LINF); s.push_back(LINF);
    t.push_back(-LINF); t.push_back(LINF);
    
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    
    while(Q--){
        ll x; cin >> x;
        auto sit = lower_bound(s.begin(),s.end(),x);
        auto tit = lower_bound(t.begin(),t.end(),x);
        
        ll ans = LINF;
        ans = min(ans,max(*sit,*tit)-x);
        ans = min(ans,*sit-*(tit-1) + min(*sit-x,x-*(tit-1)));
        ans = min(ans,*tit-*(sit-1) + min(*tit-x,x-*(sit-1)));
        ans = min(ans,x-min(*(sit-1),*(tit-1)));
        cout << ans << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    //cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 3680
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn min (a: &i64, b: &i64)-> i64{
    if *a <= 0i64 {*b}
    else if *b <= 0i64  {*a}
    else if *a < *b {*a}
    else {*b}
}

fn abs (a: &i64, b: &i64) -> i64{
    if *a - *b <= 0 {*b - *a} else {*a - *b}
}

fn main(){
    input!{
        s: chars
    }
    let mut res: Vec<u64> = vec![0u64; s.len()];
    let mut bef = 0u64;
    for i in 0..s.len()-1{
        let length = (i as u64) - bef + 1;
        if s[i] != s[i+1] {
            if s[i] == 'R'{
                res[i] += (length + 1) / 2;
                res[i+1] += length / 2;
            }
            else {
                res[bef as usize] += (length+1) / 2;
                res[bef as usize - 1] += length / 2;
            }
            bef = i as u64 + 1;
        }
    }
    let length = s.len() as u64 - bef;
    res[bef as usize] += (length + 1) / 2;
    res[bef as usize - 1] += length / 2;
    for i in res{
        print!("{} ", i);
    }
}


Measured memory_bytes: 6524
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
  vector<int> vec;
  int a;
  
  for(int i = 0 ; i < 3 ; i++){
    cin >> a;
    vec.push_back(a);
  }
  sort(vec.begin(), vec.end());
  
  cout << (vec[2] - vec[1]) + (vec[1] - vec[0]) << endl;
  
  return 0;
}
  

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<vector>
using namespace std;
bool is_prime(long long j)
{
	for (int i = 2; i*i < j; i++)
	{
		if (j % i == 0)
		{
			return false;
		}
	}
	return true;
}
long long  solveitabdo(long long x)
{
	for (int  i = x; i < 1e9+7; i++)
	{
		if (is_prime(i))
		{
			return i;
		}
	}
}
int main()
{
	long long x;
	cin >> x;
	cout << solveitabdo(x);
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){

	int x,a,b;
	cin>>x>>a>>b;
	
	if(abs(x-a)<abs(x-b)){
		cout<<'A'<<endl;
	}
	else{
		cout<<'B'<<endl;
	}
	
    return 0;
}



Measured memory_bytes: 256
import std.stdio;

void main() {
    int n;
    readf("%d\n", &n);
    ulong ret = 0;
    enum scale = 10000;
    foreach (i; 0 .. n) {
        double d;
        string s;
        readf("%f %s\n", &d, &s);
        if (s == "JPY") {
            ret += (cast(ulong) d) * scale;
        } else {
            ret += (cast(ulong) (d * 1e8)) * 38;
        }
    }
    writefln("%d.%04d", ret / scale , ret % scale);
}


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

long long calc(int n, const vector<int>& options, const vector<int>& cost,
               const vector<array<int, 26>>& s, int dd, int nt, int ot, int total) {
  //long long x(total);
  int before(dd-1), after(dd+1);
  while (before >= 0 && options[before] != nt) before--;
  while (after < n && options[after] != nt) after++;
  int a(dd - before - 1), b(after - dd - 1), c(after - before - 1);
  int diff = c * (c+1) / 2 - a * (a+1) / 2 - b * (b+1) / 2;
  int before2(dd-1), after2(dd+1);
  while (before2 >= 0 && options[before2] != ot) before2--;
  while (after2 < n && options[after2] != ot) after2++;
  int a2(dd - before2 - 1), b2(after2 - dd - 1), c2(after2 - before2 - 1);
  int diff2 = c2 * (c2+1) / 2 - a2 * (a2+1) / 2 - b2 * (b2+1) / 2;
  return total - (long long) diff * cost[nt] + (long long) diff2 * cost[ot] + s[dd][nt] - s[dd][ot];
}
int main() {
  int n;
  cin >> n;
  vector<int> c(26);
  vector<array<int, 26>> s(n);
  
  vector<int> last(26, -1);
  
  for (int i = 0; i < 26; ++i)
    cin >> c[i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 26; ++j)
      cin >> s[i][j];
  
  long long total(0);
  vector<int> options(n);
  
  for (int i = 0; i < n; ++i) {
    int neg(0), test(-1);
    for (int j = 0; j < 26; ++j) {
      neg -= c[j] * (i - last[j]);
    }
    //cout << neg << 'n' << endl;
    int max_score = -1e9;
    for (int j = 0; j < 26; ++j) {
      int ss = s[i][j] + neg + c[j] * (i - last[j]);
      if (ss > max_score) {
        max_score = ss;
        test = j;
      }
    }
    total += max_score;
    //cout << test + 1 << endl;
    options[i] = test;
    //cout << test + 1 << ' ' << max_score << endl;
    last[test] = i;
  }
  //cout << total << endl;
  for (int t = 1; t <= 100; ++t) {
    for (int dd = n - 1; dd >= 0; --dd) {
      for (int tt = 25; tt >= 0; --tt) {
        if (tt == options[dd]) continue;
        int ot = options[dd];
        options[dd] = tt;
        long long ns = calc(n, options, c, s, dd, tt, ot, total);
        //cout << ns << endl;
        if (ns > total) {
      		total = ns;
    	} else {
      		options[dd] = ot;
    	}
      }
    }
  }
  for (const int& i: options) cout << i + 1 << endl;
  //cout << total << endl;
  return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define lli long long int
using namespace std;
#define S second
#define F first
#define pb push_back 
#define M1 1000000007
#define M2 998244353
#define plli pair<lli,lli>
#define setit set<lli>::iterator seti
#define mapit map<lli,lli> ::iterator mapi
#define MP make_pair
#define MT make_tuple
// map      iterator->first  iterator.first
// map      mp[key]=value
// set      *s.begin()
// vector   v[j]=value
// pair     p.first p.second
// vector of pairs v[j].first v[j].second
// tuple    get<index>(tuple_name)
// vector of tuples get<index>(v[j])  sort(v.begin(),v.end())
//priority queue .top() .pop() .push()
// __gcd(x,y)
#define fr(j,a,b) for(j=a;j<b;j++)

int power(int x, unsigned int y, int p)  
{    int res = 1;    
     x = x % p;
     if (x == 0) return 0;
     while (y > 0)  
     {  if (y & 1)  
        res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
     }  
    return res;  
}





















int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli b,w,sx,sy,t,i,j,n,x,l,r,y,u,d;
    string s;
    cin>>x;
    j=(x/500)*1000;
    b=(x-((x/500)*500));
    y=b/5;
    w=y*5;
    cout<<j+w;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<map>

using namespace std;

int main()
{
	int n;
	int i, j;
	int temp;
	vector<int> prime;
	map<int, int> cur;
	map<int, int>::iterator it,ret;
	bool isprime;
	int cand4 = 0, cand2 = 0;
	int cand14 = 0, cand24 = 0, cand74 = 0;

	scanf("%d", &n);

	if (n < 10)
	{
		printf("0\n");

		return 0;
	}

	prime.push_back(2);	
	cur[2] = 1;

	for (i = 3; i <= n; i++)
	{
		isprime = true;

		temp = i;

		for (j = 0; j < prime.size() && prime[j]*prime[j]<=i; j++)
		{
			if (!(temp%prime[j]))
			{
				isprime = false;

				ret = cur.find(prime[j]);

				while (!(temp%prime[j]))
				{
					temp /= prime[j];

					ret->second++;
				}
			}
		}

		if (isprime)
		{
			cur[i] = 1;

			prime.push_back(i);
		}

		else if(temp!=1)
		{
			ret = cur.find(temp);

			ret->second++;
		}
	}

	for (it = cur.begin(); it != cur.end(); it++)
	{
		if (it->second >= 74)
		{
			cand74++;
		}

		if (it->second >= 24)
		{
			cand24++;
		}

		if (it->second >= 14)
		{
			cand14++;
		}

		if (it->second >= 4)
		{
			cand4++;
		}

		else if (it->second >= 2)
		{
			cand2++;
		}
	}

	printf("%d\n", (cand4*(cand4 - 1)*cand2) / 2 + (cand4*(cand4 - 1)*(cand4 - 2)) / 2 + cand74 + cand24*(cand4 + cand2 - 1) + cand14*(cand4 - 1));

	return 0;
}

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

main(){
  int H, W;
  char c;
  cin >> W >> H >> c;
  for ( int i = 0; i < H; i++ ){
    for ( int j = 0; j < W; j++ ){
      if ( i == 0 && j == 0 || i == 0 && j == W-1 ||
           i == H-1 && j == 0 || i == H-1 && j == W-1 ){
        cout << '+';
      } else if ( i == 0 || i == H-1 ){
        cout << '-';
      } else if ( j == 0 || j == W-1 ){
        cout << '|';
      } else if ( i == H/2 && j == W/2 ){
        cout << c;
      } else {
        cout << '.';
      }
    }
    cout << endl;
  }
}



Measured memory_bytes: 3100
MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(1000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
import numpy as np

def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    
    cnt = [0] * 2002
    ret = [0] * n
    for i in range(n):
        for j in range(a[i] + 1):
            cnt[j] += 1

        tmp = 0
        for j in range(i):
            if a[j] > a[i]:
                tmp += 1
        ret[i] = tmp
    
    ans = 0
    for i in range(n):
        ans += ret[i] * k
        ans %= MOD
        ans += cnt[a[i] + 1] * k * (k - 1)//2
        ans %= MOD
    print(ans)

if __name__ =='__main__':
    main()  

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

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


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int N;
    cin >> N;

    rep(i, 9)
    {
        rep(j, 9)
        {
            if ((i + 1) * (j + 1) == N) {
                cout << "Yes" << endl;

                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


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

using namespace std;

void f(string &s)
{
    for (char &c : s) {
        if ('a' <= c && c <= 'z') c = (c - 'a' + 25) % 26 + 'a';
    }
}

int main()
{
    string s;

    while (getline(cin, s)) {
        if (s.empty()) break;
        while (s.find("the") == string::npos && s.find("this") == string::npos && s.find("that") == string::npos) f(s);
        cout << s << endl;
    }
}

Measured memory_bytes: 2984
#include <bits/stdc++.h>
 
using namespace std;
 
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forp(a,b,c) for(int (a)=(b); (a)<(c); (a++))
#define form(a,b,c) for(int (a)=(b); (a)>(c); (a--))
#define fori(a,b) for(auto (a):(b))
#define pb(a) push_back(a)
#define INF ((unsigned) ~0)
#define endl "\n"
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}
 
int main()
{
    fastIO
    map<int,int> res;
    forp(i,1,101)
    {
        forp(j,1,101)
        {
            forp(k,1,101)
            {
                ++res[i*i + j*j + k*k + i*j + j*k + i*k];
            }
        }
    }
    int n;
    cin>>n;
    forp(i,1,n+1) cout<<res[i]<<endl;
}

Measured memory_bytes: 5364
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;
const int AtoZ = 26;

bool check(int n, int b, int e, vector<string> &str, vector<vector<int> > &ord){
	char now=str[b][n];
	int s=b;
	for(int i=b; i<=e; i++){
		if(str[i][n] != now){
			if(str[i][n]=='0') return false;
			if(now!='0'){
				ord[now-'a'][str[i][n]-'a'] = 0;
				if(!check(n+1, s, i-1, str, ord)) return false;
			}
			s = i;
			now = str[i][n];
		}
	}
	if(now!='0'){
		if(!check(n+1, s, e, str, ord)) return false;
	}
	return true;
}

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<string> str(n);
		vector<vector<int> > ord(AtoZ, vector<int>(AtoZ, inf));
		for(int i=0; i<n; i++){
			cin >> str[i];
			str[i] += "0";
		}
		if(!check(0, 0, n-1, str, ord)){
			cout << "no" << endl;
			continue;
		}
		
		for(int k=0; k<AtoZ; k++){
			for(int i=0; i<AtoZ; i++){
				for(int j=0; j<AtoZ; j++){
					ord[i][j] = min(ord[i][j], ord[i][k]+ord[k][j]);
				}
			}
		}
		bool flag = true;
		for(int i=0; i<AtoZ; i++){
			for(int j=i+1; j<AtoZ; j++){
				if(ord[i][j]==0 && ord[j][i]==0){
					flag = false;
					break;
				}
			}
		}
		if(flag){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
    return 0;
}

Measured memory_bytes: 3176
def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
    return area_of_pond


terrains = input().strip()
x, last_x, ponds = 0, [], []

for terrain in terrains:
    if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            area_of_pond = marge_ponds(lx, x - lx)
            ponds.append((lx, area_of_pond))
    x += 1

print(sum(pond[1] for pond in ponds))
ponds.insert(0, (0, len(ponds)))
print(' '.join(map(str, [pond[1] for pond in ponds])))

Measured memory_bytes: 8152
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}

constexpr ll LNF = 1LL<<50;

constexpr int INF = 1e9+7;

const long double PI=3.14159265358979323846;


vector<int> dx = {1,0,-1,1,-1,0};
vector<int> dy = {1,1,1,0,0,-1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; ll l; cin >> n >> l;
    vector<ll> a(n);
    rep(i,0,n) cin >> a[i];
    int flag = 0;
    int index;
    rep(i,0,n-1){
        if(a[i]+a[i+1]>=l){
            flag = 1;
            index = i+1;
            break;
        }
    }
    if(flag==0){
        cout << "Impossible" << endl;
    }
    else{
        cout << "Possible" << endl;
        rep(i,1,index){
            cout << i << endl;
        }
        rrep(i,index+1,n){
            cout << i << endl;
        }
        cout << index << endl;
    }
}


Measured memory_bytes: 1664
n,m=input().split()
n=int(n)
m=int(m)
x=[False for i in range(n)]
count=[0 for i in range(n)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  if(not x[p-1]):
    if(s=="AC"):
      x[p-1]=True
    else:
      count[p-1]=count[p-1]+1
ans=0
ans2=0
for i in range(n):
  if(x[i]):
    ans+=1
    ans2+=count[i]
print(ans,ans2)

Measured memory_bytes: 4760
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;



int main() {
    int n;
    cin >> n;
    vi a(n), b(n), c(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> b[i];
    }
    rep(i, n) {
        cin >> c[i];
    }

    sort(all(a));
    sort(all(b));
    sort(all(c));

    vector<ll> dd(n);
    rep(i, n) {
        vi::iterator itr = upper_bound(all(c), b[i]);
        dd[i] = distance(itr, c.end());
    }

    
    rep(i, n-1) {
        dd[n-2-i] += dd[n-1-i];
    }


    ll ans = 0LL;
    rep(i, n) {
        vi::iterator itr = upper_bound(all(b), a[i]);
        int num = distance(b.begin(), itr);
        if(num == n) continue;
        ans += dd[num];
    }

    cout << ans << endl;
}

Measured memory_bytes: 2176
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	string s;
	int k;
	cin >> s;
	cin >> k;
	int n = s.size();
	REP(i, n) {
		if(s[i] != 'a' && 'z' - s[i] + 1 <= k) {
			k -= 'z' - s[i] + 1;
			s[i] = 'a';
		}
	}
	s[n - 1] = (s[n - 1] + k - 'a') % 26 + 'a';
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3704
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdint>
#include <utility>
#include <tuple>
#include <map>    
#include <queue> 
#include <set>  
#include <stack> 
#include <deque>  
#include <unordered_map> 
#include <unordered_set> 
#include <bitset>

using namespace std;

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

	vector<int> H(N);
	for (int i = 0; i < N; i++) {
		cin >> H.at(i);
	}

	bool isStairs = true;
	for (int i = N - 1; i > 0; i--) {
		int dif = H.at(i) - H.at(i - 1);
		if (dif >= 0) {
			continue;
		}
		else if (dif == -1) {
			H.at(i - 1) -= 1;
			continue;
		}
		else {
			isStairs = false;
			break;
		}
	}

	if (isStairs) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int h, w;
  cin >> h >> w;
  
  vector<vector<char>> s(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> s.at(i).at(j);
    }
  }
  
  vector<vector<int>> x(h, vector<int>(w, 1e9));
  
  //if (s.at(0).at(0) == '#') x.at(0).at(0) = 1;
  /*else*/ x.at(0).at(0) = 0;
  queue<pair<int, int>> q;
  q.push(make_pair(0, 0));
  
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    if (p.first != h - 1) {
      if (s.at(p.first).at(p.second) == s.at(p.first + 1).at(p.second)) {
        if (x.at(p.first + 1).at(p.second) > x.at(p.first).at(p.second)) {
          x.at(p.first + 1).at(p.second) = x.at(p.first).at(p.second);
          q.push(make_pair(p.first + 1, p.second));
        }
      }
      else {
        if (x.at(p.first + 1).at(p.second) > x.at(p.first).at(p.second) + 1) {
          x.at(p.first + 1).at(p.second) = x.at(p.first).at(p.second) + 1;
          q.push(make_pair(p.first + 1, p.second));
        }
      }
    }
    if (p.second != w - 1) {
      if (s.at(p.first).at(p.second) == s.at(p.first).at(p.second + 1)) {
        if (x.at(p.first).at(p.second + 1) > x.at(p.first).at(p.second)) {
          x.at(p.first).at(p.second + 1) = x.at(p.first).at(p.second);
          q.push(make_pair(p.first, p.second + 1));
        }
      }
      else {
        if (x.at(p.first).at(p.second + 1) > x.at(p.first).at(p.second) + 1) {
          x.at(p.first).at(p.second + 1) = x.at(p.first).at(p.second) + 1;
          q.push(make_pair(p.first, p.second + 1));
        }
      }
    }
  }
  
  if (s.at(0).at(0) == '.') cout << (x.at(h - 1).at(w - 1) + 1) / 2 << '\n';
  else cout << (x.at(h - 1).at(w - 1) + 2) / 2 << '\n';
}

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

	cout<<min(b/a,c)<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define faster_io ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mem(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define ll long long
#define pb push_back
#define pll pair<ll, ll>
using namespace std;
const ll N = 1e6 + 7, M = 1e5 + 7, mod = 998244353, inf = 1e9 + 7;
ll n, m, q, a, b, c, d, i, j, k, ans;
//ll ar[N];
string s;
vector < ll > vec;

int main()
{
    faster_io;
    cin >> n >> s;
    for(i = 2; i < n; i++)
        if(s[i] == 'C' && s[i - 1] == 'B' && s[i - 2] == 'A')
            ans++;
    cout << ans << endl;
}


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

int main()
{
  	string s;
  	cin>>s;
  	int res = 0;
  	char cur = s[0];
  	for(int i = 1; i < s.length(); i++)
    {
    	if(s[i] != cur)
        {
        	cur = s[i];
          	res++;
        }
    }
  	cout<<res<<"\n";
	return 0;
}

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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first > arg2.first;
}

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

    int ans=0;
    for(int i=0;i<2;i++) {
        ans += max(a, b);
        if(a>b) a--;
        else b--;
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<string.h>
#include<queue>
#include<math.h>
#include<set>
#include<unordered_set>
#include<limits.h>
using namespace std;

typedef unsigned long long ll;







int main(){
    int a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"Draw"<<endl;
    } else if(a==1){
        cout<<"Alice"<<endl;
    } else if(b==1){
        cout<<"Bob"<<endl;
    } else if(a>b){
        cout<<"Alice"<<endl;
    } else {
        cout<<"Bob"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

int main(void)
{
    int A, B;
    cin>>A>>B;

    int Result;
    if(B%A == 0)
    {
        Result = A+B;
    }
    else
    {
        Result = B-A;
    }
    
    cout<<Result;

    return 0;
}

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

using namespace std;


#define PI 3.14159265
#define int long long



main(){


	int n, k; cin >> n >> k;


	vector <int> v(n);


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

	int r = min(n, k);


	int record = 0;
	
	for(int i = 0; i <= r; i++){
		for(int j = n - 1; j != -1; j--){
			int ab = i + (n - j - 1);
			if(ab <= r){
				multiset <int> s;
				int sum = 0;
				for(int l = 0; l < n; l++){
					if(l < i or l > j){
						if(v[l] < 0){
							s.insert(v[l]);
						}

						sum += v[l];
					}
				}

				for(int l = 0; l < k - ab and !s.empty(); l++){
					sum -= *s.begin();
					s.erase(s.begin());
				}


				record = max(record, sum);

			}
		}
	}


	cout << record << endl;


	return 0;
}

Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
count=0
keep=0
for i in range(0,n-1):
  if h[i]>=h[i+1]:
    count+=1
  else:
    if count>keep:
      keep=count
    count=0
if count>keep:
  keep=count
print(keep)

Measured memory_bytes: 14252
#include <iostream>
#include <utility>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  map<int,int> c[2];
  for(int i = 0; n > i; i++){
  	int a;
    cin >> a;
    c[i%2][a]++;
  }
  int ans = 0;
  
  auto check = [&](int a, int b){
    if(a == b) return 100000000;
    int ret = 0;
    for(auto itr : c[0]){
      if(itr.first != a) ret += itr.second;
    }
    for(auto itr : c[1]){
      if(itr.first != b) ret += itr.second;
    }
    return ret;
  };
  
  vector<pair<int,int>> cand[2];
  for(int i = 0; 2 > i; i++){ 
    for(auto itr : c[i])
      cand[i].push_back({itr.second, itr.first});
    cand[i].push_back({0,-1});
  sort(cand[i].begin(), cand[i].end(), greater<pair<int,int>>());
  }
  
  cout << min({check(cand[0][0].second,cand[1][0].second),check(cand[0][0].second,cand[1][1].second),check(cand[0][1].second,cand[1][0].second)}) << endl;
  
  return 0;  
}


Measured memory_bytes: 6136
# coding=utf-8
get = lambda: int(raw_input().strip())
gets = lambda: map(int, raw_input().strip().split())
getss = lambda x: [gets() for _ in xrange(x)]
getl = lambda x: [gets() for _ in xrange(x)]


m, n = gets()
A0 = [list(raw_input().strip()) for _ in xrange(m)]

for i in xrange(m):
    for j in xrange(n):
        if A0[i][j] == '.':
            A0[i][j] = 0
        else:
            A0[i][j] = -1


def test(i, j):
    # print '\ntest ', i, j
    A = [row[:] for row in A0]
    bfs = [[i, j]]
    A[i][j] = 1
    dep = 0
    while bfs:
        dep += 1
        bfs2 = []
        for i, j in bfs:
            for di, dj in [[0, -1], [0, 1], [-1, 0], [1, 0]]:
                i2, j2 = i + di, j + dj
                if 0 <= i2 < m and 0 <= j2 < n and A[i2][j2] == 0:
                    A[i2][j2] = dep + 1
                    bfs2.append([i2, j2])
        bfs = bfs2
    # for row in A:
    #     print row
    # print
    return dep


res = 0
for i in xrange(m):
    for j in xrange(n):
        if A0[i][j] < 0: continue
        res = max(res, test(i, j) - 1)
print res


Measured memory_bytes: 2696
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T = int > T in() {
  T x;
  cin >> x;
  return (x);
}
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int N = (int)S.size();
  vec< int > ans(N, 0);
  int nowindex = 0;
  int count = 0;
  REP(i, N) {
    if (S[i] == 'L' && count == 0) {
      nowindex = i;
    }
    if (S[i] == 'L') {
      ans[nowindex - count % 2]++;
      count++;
    } else {
      count = 0;
    }
  }
  count = 0;
  REPR(i, N - 1) {
    if (S[i] == 'R' && count == 0) {
      nowindex = i;
    }
    if (S[i] == 'R') {
      ans[nowindex + count % 2]++;
      count++;
    } else {
      count = 0;
    }
  }
  REP(i, N) { cout << ans[i] << " "; }
  cout << "\n";
}

Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) if(x)
int main() {
	vector<int> a,b,c;
	int n;
	cin >> n;
	a.resize(n);
	b.resize(n);
	c.resize(n - 1);
	for(int i = 0; i < n; i++) cin >> a[i], a[i]--;
	for(int i = 0; i < n; i++) cin >> b[i];
	for(int i = 0; i < n - 1; i++) cin >> c[i];		
	int sum = 0;
	for(int i = 0; i < n; i++) {
		DEBUG(0) cout << i << ": " << b[a[i]] + (i > 0 && a[i-1] == a[i] - 1 ? c[i - 1] : 0) << endl;
		sum += b[a[i]] + (i > 0 && a[i-1] == a[i] - 1 ? c[a[i - 1]] : 0);
	}
	cout << sum << endl;
	return 0;
}

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

int main(){
    double a, b; cin >> a >> b;
    int ans=0;
    int dis=1;
    bool flg = true;
    while(true){
        if(floor(dis * 0.08) == a && floor(dis*0.1) == b){
            ans = dis; break;
        }
        if(dis > 1000){
            flg = false; break;
        }
        dis++;
    }
    if(flg)
        cout<< ans << endl;
    else
    {
        cout << -1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3692
fn main() {
    let s = read::<String>().chars().take(4).collect::<String>();
    if s == "YAKI" {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2140
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int C = sc.nextInt();
        double S = a * b * Math.sin(Math.toRadians(C)) / 2.0;
        double c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(Math.toRadians(C)));
        double L = a + b + c;
        double h = 2*S / a;
        System.out.println(S + " " + L + " " + h);
    }
}


Measured memory_bytes: 26312
from itertools import accumulate
MAX = 1000000
is_prime = [1] * MAX
is_prime[0] = is_prime[1] = 0
for i in range(2, int(MAX ** (1 / 2)) + 1):
  if is_prime[i]:
    for j in range(i * i, MAX, i):
      is_prime[j] = 0
acc_prime = list(accumulate(is_prime))

while True:
  n = int(input())
  if n == 0:
    break
  ans = 0
  for _ in range(n):
    p, m = map(int, input().split())
    ans += acc_prime[min(p + m, MAX - 1)] - acc_prime[max(0, p - m - 1)] - 1
  print(ans)


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

template<class c> auto try_out(c a) -> decltype(cerr << a, 0);
char try_out(...);

struct debug {
#ifdef LOCAL
template<class c, class d> debug& operator << (pair<c, d> e) {
	return *this << "(" << e.first << ", " << e.second << ")";
}
template<class c> typename enable_if<sizeof(try_out(declval<c>())) != 1, debug&>::type operator << (c a) {
	cerr << boolalpha << a;
	return *this;
}
template<class c> typename enable_if<sizeof(try_out(declval<c>())) == 1, debug&>::type operator << (c a) {
	*this << "[";
	for (auto it = a.begin(); it != a.end(); ++it)
		*this << ","[1 - (it != a.begin())] << *it;
	return *this << "]";
}
#else
template<class c> debug& operator << (c) {
	return *this;
}
#endif
};

#define aty(x) " [" << #x ": " << x << "] "

using ll = long long;






int main() {
	
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
	
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mn(a,b) (a < b ? a : b)
#define mx(a,b) (a > b ? a : b)
#define f first
#define s second
#define mp make_pair
#define all(v) (v).begin(),(v).end()

using namespace std;

int table[120];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    a++, b++, c++, d++;
    table[a]++;
    table[1] += 2;
    table[b]--;
    table[c]++;
    table[d]--;
    int con = 0;
    for(int i = 1; i < 120; i++){
        table[i] += table[i - 1];
        if(table[i] == 4)
            con++;
    }
    cout<<con;
    return 0;
}


Measured memory_bytes: 256
import sys


def compare(s: str, t: str) -> bool:
    return all(x == y or x == "?" for x, y in zip(s, t))


if __name__ == "__main__":
    S = input()
    T = input()

    len_s = len(S)
    len_t = len(T)

    indexes = []
    for i in range(len_s):
        if i + len_t <= len_s:
            s = S[i : i + len_t]
            if compare(s, T):
                indexes.append(i)

    if len(indexes) == 0:
        print("UNRESTORABLE")
        sys.exit(0)

    decrypted = []
    for j in indexes:

        d = ""
        for i, s in enumerate(S):
            if i in range(j, j + len_t):

                d += T[i - j]
                continue
            if s == "?":
                d += "a"
                continue

            d += s

        decrypted.append(d)
    decrypted.sort()
    print(decrypted[0])

Measured memory_bytes: 65812
K = int(input())
A , B = (map(int , input().split()))
kk = K
while True:
    if kk >= A and kk <= B:
        ans = 'OK'
        break
    elif  kk > B:
        ans = 'NG'
        break
    else:
        kk = kk+K
print(ans)

Measured memory_bytes: 9172
#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++)
const int inf=1e9+1;
template <class T>
void print(T x){cout << x << '\n';}


const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> t, std::vector<long long> x, std::vector<long long> y){
    bool flag=true;
    FOR(i,1, N+1){
        int subt = t[i]-t[i-1];
        int cost = abs(x[i]-x[i-1])+abs((y[i]-y[i-1]));
        if(!((subt >= cost) && (subt%2 == cost%2))){
            flag=false;
            break;
        }
    }
    if(flag)print(YES);
    else print(NO);
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> t(N+1);
  std::vector<long long> x(N+1);
  std::vector<long long> y(N+1);
  t[0]=0, x[0]=0, y[0]=0;
  for(int i = 1 ; i < N+1 ; i++){
    scanf("%lld",&t[i]);
    scanf("%lld",&x[i]);
    scanf("%lld",&y[i]);
  }
  solve(N, std::move(t), std::move(x), std::move(y));
  return 0;
}


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

using namespace std ;

int main ()
{
    int cnt = 0 , a ;
    cin >> a ;
    int j = 1 ;
    while ( 1 ){
    cnt += j ;
        if ( cnt >= a ){
            cout << j ;
            break ;
        }
    j ++ ;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
int n, m, a[101], box=0, flag = 0;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
cin >> a[i];
box += a[i];
}
for (int i = 0; i < n; ++i) {
if (box <=a[i]*(4 * m)) flag++;
if (m == flag) break;
}
if (m <= flag) {
cout << "Yes" << endl;
}
else {
cout << "No" << endl;
}

}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
using VI = vector<int>;

int main()
{
  int N;
  cin >> N;
  int total = -N;
  int tmp;
  REP(i, N) {
    cin >> tmp;
    total += tmp;
  }
  cout << total << endl;
}

Measured memory_bytes: 256