akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define reep(i,n) for(ll i = n; i >-1; i--)
#define deb(variable) cout<<#variable<<"="<<variable<<endl;
const ll INF=99999999999999999;
const ll MAX_N=100010;
ll a,b,x,y,m,n,l,q,ans=0;
#define kill(s); cout<<s<<endl;
vl v,v1,v2;
int main(){
    string s;
    v.push_back(0);
    string s1;
    cin>>s;
    rep(i,s.length()){
        if(s[i]=='A')v.back()++;
        else {
            s1+=s[i];
            v.push_back(0);
        }
    }

    if(s1=="KIHBR"&&v[0]<2&&v[1]<1&&v[2]<1&&v[3]<2&v[4]<2&&v[5]<2)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,h,sum(0),ans(0);
  
  cin >> h >> n;
  vector<int> a(n);
  
  for(int i = 0;i<n;i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  if(sum<h){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

}

Measured memory_bytes: 640
#include <iostream>
#include <vector>

int main()
{
  int N;
  std::cin >> N;
  std::vector<int> a_to_i(N);
  for(int i=0; i<N; i++) {
    int a;
    std::cin >> a;
    a--;
    a_to_i[a] = i+1;
  }

  for(auto i: a_to_i) {
    std::cout << i << " ";
  }
  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 3760
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

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

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n,k;
  std::cin>>n>>k;

  std::vector<ll> h(n),dp(n,0);
  rep(i,0,n)std::cin>>h[i];

  rep(i,1,n){
    ll min=LLONG_MAX;
    rep(j,std::max(0ll,i-k),i){
      min=std::min(min,dp[j]+std::abs(h[i]-h[j]));
    }
    dp[i]=min;
  }

  std::cout<<dp[n-1];

  return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		double sqrt = Math.sqrt(N);
		sc.close();
		Map<Long, Integer> map = new TreeMap<Long, Integer>();
		for (long i = 2; i <= sqrt; i++) {
			if (N == 1) {
				break;
			}
			while (N % i == 0) {
				// 因数をmapに記録
				if (map.containsKey(i)) {
					map.put(i, map.get(i) + 1);
				} else {
					map.put(i, 1);
				}
				N /= i;
			}
		}
		if (N != 1) {
			map.put(N, 1);
		}
		long ans = 0;
		for (int cnt : map.values()) {
			int order = 1;
			int sum = 1;
			while (true) {
				if (cnt - sum >= 0) {
					ans++;
				} else {
					break;
				}
				order++;
				sum = sum + order;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35932
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let _t: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut b = vec![0; n + 1];
    for i in (0..n).rev() {
        b[i] = max(a[i], b[i + 1]);
    }

    let mut c = Vec::new();
    for i in 0..n {
        c.push(b[i] - a[i]);
    }
    c.sort();
    c.reverse();

    let mut ans = 1;
    while ans < c.len() && c[ans] == c[ans - 1] {
        ans += 1;
    }
    println!("{}", ans);
}


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

#define ll long long
#define deb(x) cerr << #x << ":" << x << "\n"
#define all(x) x.begin(),x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int ll
int n,w;
vector<pair<int,int>> v(105);
vector<vector<int>> dp(105,vector<int>(100005,-1));

int max_val(int ind,int w){
    if(ind<0)return 0;
    if(dp[ind][w]!=-1)return dp[ind][w];
    dp[ind][w]=max_val(ind-1,w);
    if(w-v[ind].first>=0)dp[ind][w]=max(dp[ind][w],v[ind].second+max_val(ind-1,w-v[ind].first));
    return dp[ind][w];
}

void solve()
{
    cin>>n>>w;
    for(int i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
    }
    cout<<max_val(n-1,w)<<"\n";
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 86220
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222




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


  cin >> m >> n;
  vll x(n), v;
  rep(i, n) cin >> x[i];
  sort(all(x));
  if (n > 1)v.pb(x[1] - x[0]);
  if (n > 2) v.pb(x[n - 1] - x[n - 2]);
  FOR(i, 2, n - 1) {
    v.pb(x[i] - x[i - 1]);
  }
  sort(all(v));
  rep(i, n - m) ans += v[i];
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};


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

    int h,w;
    cin >> h >> w;
    vector<string> map(h);
    rep(i,h){
        cin >> map[i];
    }
    vector<vector<int>> dp(h,vector<int> (w,0));
    dp[0][0] = 1;
    rep(i,h){
        rep(j,w){
            if(i == 0 && j == 0 || map[i][j] == '#'){
                continue;
            }
            if(i-1 >= 0){
                dp[i][j] += dp[i-1][j];
            }
            if(j-1 >= 0){
                dp[i][j] += dp[i][j-1];
            }
            dp[i][j] %= mod;
        }
    }
    cout << dp[h-1][w-1] << endl;


    cout << endl;
    return 0;
}


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


    const int N = 100000;
    int dp [N] ;
    int Arr[N];
    int n ;

   int   solve ( int idx ){

        if ( idx == n-1 )
            return 0;

        if (dp[idx] != -1)
            return dp[idx];


           int  ans = abs (Arr[idx] - Arr[idx+1]) + solve (idx+1 );

           if ( idx != n-2)
               ans = min ( ans , abs( Arr[idx] - Arr[idx+2]) + solve ( idx+2)) ;


           return dp[idx] = ans;


   }

int main() {


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

            memset ( dp, -1 ,sizeof dp);

          cout <<    solve (0) << endl;


    return 0;
}

Measured memory_bytes: 9016
// CGL_3_A
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
using namespace std;

struct vec{
	double x;
	double y;
};

int main(){
	int n;
	double area;
	vector<struct vec> v;
	vec temp;

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>temp.x>>temp.y;
		v.push_back(temp);
	}

	area = v[n-1].x*v[0].y - v[0].x*v[n-1].y;
	for(int i=0;i<n-1;i++)
		area += v[i].x*v[i+1].y - v[i+1].x*v[i].y;

	area = fabs(area) / 2.0;
	printf("%.1lf\n", area);

	return 0;
}

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

#define int long long
const int INF = 1e9;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  while ( cin >> s, s != "#" ) {
    int ans = INF;    
    for ( int i = 0; i < 9; i++ ) { // init of left
      for ( int j = 0; j < 9; j++ ) { // init of right
	if ( j%3 < i%3 || i == 4 || j == 4 ) continue; // 初期状態も気をつける！	
	for ( int k = 0; k < 2; k++ ) { // init turn (0:L 1:R)
	  int l = i, r = j;
	  int t = k;
	  int cnt = 0;
	  for ( int a = 0; a < (int)s.size(); a++ ) {
	    int d = s[a]-'1';	    
	    int nl = l, nr = r;
	    if ( !t ) nl = d;	    
	    else nr = d;
	    if ( nr%3 < nl%3 ) { // violate
	      cnt++;
	      nl = l; nr = r;	      
	      if ( !t ) nr = d;
	      else nl = d;
	      t = !t;
	    }
	    l = nl; r = nr;
	    t = !t;
	  }

	  ans  = min(ans, cnt);
	}
      }
    }

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



Measured memory_bytes: 3292
def main():
    """
    奇数枚の余りは1に、偶数枚の余りは2にできる
    偶数枚が偶数個余っていたら種類は減らないが、奇数個であれあ一つ種類が減る
    """
    _ = int(input())
    A = [int(i) for i in input().split()]
    from collections import Counter
    c = Counter(A)
    even = len([v for v in c.values() if v % 2 == 0])
    ans = len(c.keys())
    if even % 2 == 1:
        ans -= 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 17696
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
const int N = 5005, mod = 1e9 + 7;
int n, g[N], f[N][N], sz[N], t[N];
vector<int> G[N];
void dfs(int u, int fa = 0) {
	sz[u] = f[u][1] = 1;
	for(int i = 0; i < (int) G[u].size(); i ++) {
		int v = G[u][i];
		if(v == fa) continue ;
		dfs(v, u);
		fill(t, t + sz[u] + sz[v] + 1, 0);
		for(int j = sz[u]; j >= 1; j --) {
			for(int k = sz[v]; k >= 1; k --) {
				(t[j + k] += 1ll * f[u][j] * f[v][k] % mod) %= mod;
				(t[j] += 1ll * f[u][j] * f[v][k] % mod * (mod - g[k]) % mod) %= mod;
			}
		}
		sz[u] += sz[v];
		copy(t, t + sz[u] + 1, f[u]);
	}
}
int main() {
	scanf("%d", &n);
	for(int i = 1; i < n; i ++) {
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	g[0] = 1;
	for(int i = 2; i <= n; i += 2)
		g[i] = g[i - 2] * (i - 1ll) % mod;
	dfs(1);
	int ans = 0;
	for(int i = 2; i <= n; i += 2)
		(ans += 1ll * f[1][i] * g[i] % mod) %= mod;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 97536
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[101][101];

void solve() {
    int h , w;
    cin>>h>>w;
    char x[h][w+1];
    for (int i = 0; i < h; ++i) {
        cin>>x[i];
    }
    memset(dp , 0 , sizeof(dp));
    for(int i = 0 ; i< h ; i++){
        for(int j = 0 ; j < w ; j++){
            if(i == 0 && j== 0){
                if(x[i][j] == '.')
                    dp[i][j] = 0;
                else dp[i][j] = 1;
            }else if(i == 0){
                if(x[i][j] =='#'){
                    if(x[i][j-1] == '#' ) dp[i][j] = dp[i][j-1];
                    else dp[i][j] = dp[i][j-1] + 1;
                }else {
                    dp[i][j] = dp[i][j-1];
                }
            }else if(j == 0){
                if(x[i][j] =='#'){
                    if(x[i-1][j] == '#' ) dp[i][j] = dp[i-1][j];
                    else dp[i][j] = dp[i-1][j] + 1;
                }else {
                    dp[i][j] = dp[i-1][j];
                }
            }else {
                if(x[i][j] == '#'){
                    int m = (x[i][j-1] == '#' ? dp[i][j-1] : dp[i][j-1] + 1);
                    m = min(m , (x[i-1][j] == '#' ? dp[i-1][j] : dp[i-1][j] + 1));
                    dp[i][j] = m;
                }else dp[i][j] = min(dp[i-1][j] , dp[i][j-1]);
            }
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
string place[20];
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0},n,m;
int serch(int y,int x)
{
	int ans=1;
	place[y][x]='#';
	for(int i=0,ax,ay;i<4;i++)if((ay=dy[i]+y)<m&&(ax=dx[i]+x)<n&&ay>=0&&ax>=0&&place[ay][ax]=='.')ans+=serch(ay,ax);
	return ans;
}

int main() {
	while(cin>>n>>m,n,m){
		for(int i=0;i<m;i++)cin>>place[i];
		for(int i=0;i<m;i++)for(int j=0;j<n;j++)if(place[i][j]=='@')cout<<serch(i,j)<<endl;
	}
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using P = pair<int, int>;
int s, d, m;
int f[101];
int dp1[102][302];
int cost[102][302];
int dfs1(int idx, int p) {
    // printf("%d %d\n", idx, p);
    if (idx == d) return 0;
    if (dp1[idx][p] != -INF) return dp1[idx][p];
    int res = 0;

    rep(i, p + 1) { res = max(res, dfs1(idx + 1, p - i) + cost[f[idx]][i]); }
    return dp1[idx][p] = res;
}
int main() {
    while (cin >> s >> d >> m && s) {
        rep(i, 102) rep(j, 302) dp1[i][j] = -INF;
        rep(i, 102) rep(j, 302) cost[i][j] = 0;
        rep(i, s) {
            int k;
            cin >> k;
            vector<int> ws, ps;
            rep(j, k) {
                int w, p;
                cin >> w >> p;
                ws.push_back(w);
                ps.push_back(p);
            }
            rep(a, k) for (int j = m + 1; j >= ps[a]; j--) {
                cost[i][j] = max(cost[i][j], cost[i][j - ps[a]] + ws[a]);
            }
        }
        rep(i, d) cin >> f[i];
        int ans1 = dfs1(0, m);
        int ans2 = 0;

        rep(i, m + 1) {
            if (ans1 == dfs1(0, i)) {
                cout << ans1 << " " << i << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3392
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

N = [k]*n
Q = [q]*n
l = [0]*n
for i in a:
    l[i-1] += 1
hiku = [x-y for (x, y) in zip(Q, l)]
result = [x-y for (x, y) in zip(N, hiku)]
for i in result:
    if i>0:
        print("Yes")
    else:
        print("No")

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    for (i64 i = 0; i <= n; i++) {
        if (s.substr(i) == t.substr(0, n - i)) {
            cout << n + i << endl;
            return;
        }
    }
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <queue>
#define debug(...) //fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
using namespace std;
inline char nc() {
//	return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++; 
}
template<class T> void read(T &x) {
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 2e5 + 5;
int n;
int a[maxn], b[maxn];
priority_queue<pii> q;
inline int f(int x, int y) {
	return x / y * y;
}
ll solve() {
	for(int i = 1; i <= n; ++i) {
		if(b[i] < a[i]) return -1;
		if(b[i] == a[i]) continue;
		q.push(make_pair(b[i], i));
	}
	ll cnt = 0;
	while(!q.empty()) {
		pii now = q.top(); q.pop();
		int x = now.se - 1; if(now.se == 1) x = n;
		int y = now.se + 1; if(now.se == n) y = 1;
		if(b[now.se] < b[x] + b[y]) return -1;
		int delt = (b[now.se] - a[now.se]) / (b[x] + b[y]); cnt += delt;
		b[now.se] -= delt * (b[x] + b[y]);
		if(b[now.se] < a[now.se]) return -1;
		if(b[now.se] > a[now.se]) q.push(make_pair(b[now.se], now.se));
	}
	return cnt;
}
int main() {
	read(n);
	for(int i = 1; i <= n; ++i) {
		read(a[i]);
	}
	for(int i = 1; i <= n; ++i) {
		read(b[i]);
	}
	printf("%lld\n", solve());
	return 0;
}

Measured memory_bytes: 4084
import math
from decimal import Decimal

N = int(input())
T, A = [Decimal(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [Decimal(x) for x in input().split()]
        n = Decimal(max(math.ceil(T/T2),math.ceil(A/A2)))
        T = T2 * n
        A = A2 * n

print(T+A)

Measured memory_bytes: 5588
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
#define PI 3.141592
using namespace std;

int main()
{
	int r;
	cin >> r;
	double l = (double)r * 2.0 * PI;

	printf("%.6f", l);
	
	return 0;
}

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

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

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

int main()
{
string s;
cin>>s;
if(s[s.length()-1]=='s'){
cout<<s<<"es"<<endl;
}else{
cout<<s<<"s"<<endl;

}
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    int n;
    vi a,b,c;
    cin>>n;

    a.resize(n);
    b.resize(n);
    c.resize(n);

    REP(i,n) cin>>a[i];
    REP(i,n) cin>>b[i];
    REP(i,n) cin>>c[i];

    int ans = 0;
    REP(i,n){
        ans += b[a[i]-1];

        if(a[i] == a[i-1]+1)
            ans += c[a[i-1]-1];
    }

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

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

int main(){
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for(int i=0; i<s.size(); i++){
        cin >> s.at(i);
    }
    sort(s.begin(), s.end());
    for(auto e:s){
        cout << e;
    }
    cout << endl;
}

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

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var X = vals[0];
        var A = vals[1];

        if (X < A)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine(10);
        }
    }
}

Measured memory_bytes: 13268
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, m;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >>s;
    rep(i,4){
        cout<<s[i];
    }
    cout<<" ";
    rep(i,8){
        cout<<s[4+i];
    }
    cout<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

struct Unionfind{
    vector<int> data;
    Unionfind(int size):data(size, -1) {}
    bool unite(int x, int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x!=y;
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    int root(int x){
        return (data[x] < 0) ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

signed main(){
    int n; cin >> n;
    int x[n],y[n];
    int X[100100],Y[100100];
    rep(i,100100) X[i]=Y[i]=-1;
    Unionfind uni(n);
    rep(i,n){
        cin >> x[i] >> y[i];
        if(X[x[i]]==-1) X[x[i]]=i;
        if(Y[y[i]]==-1) Y[y[i]]=i;
        if(i!=X[x[i]]) uni.unite(i,X[x[i]]);
        if(i!=Y[y[i]]) uni.unite(i,Y[y[i]]);
    }
    map<P,int> mp_x; map<P,int> mp_y;
    map<int,Pll> mp_num;
    rep(i,n){
        int rt=uni.root(i);
        //cout << rt << endl;
        if(mp_x[{rt,x[i]}]==0){
            mp_x[{rt,x[i]}]=1;
            mp_num[rt].fi++;
        }
        if(mp_y[{rt,y[i]}]==0){
            mp_y[{rt,y[i]}]=1;
            mp_num[rt].se++;
        }
    }
    ll ans=0;
    for(auto u:mp_num){
        //cout << u.se.fi << " " << u.se.se << endl;
        ans+=u.se.fi*u.se.se;
    }
    cout << ans-n << endl;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();
    
    int n, m; cin >> n >> m;
    vector<vector<string>> s(n);
    FOR(i, 0, m) {
        int p; string t; cin >> p >> t;
        --p;
        s[p].push_back(t);
    }

    int a = 0, b = 0;
    FOR(i, 0, n){
        bool ac = false;
        int c = 0;
        FOR(j, 0, s[i].size()) {
            if (s[i][j] == "AC") {
                ++a;
                ac = true;
                break;
            }
            else ++c;
        }
        if (ac)b += c;
    }
    cout << a << " " << b << "\n";
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
/*	vvi g(3,vl(0));
	rep(i,0,n){
		int a,b; cin>>a>>b;
		-- a; -b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	vi vec={0,1,2,3};
	do{
		bool ok=true;
		rep(i,0,3){
			
		}
	}while(next_permutation(all(vec)));*/
	int a=0,b=0,c=0,d=0;
	rep(i,0,6){
		int n; cin>>n;
		if(n==1)a++;
		else if(n==2)b++;
		else if(n==3)c++;
		else d++;
	}
	if(a<3 && b<3 && c<3 && d<3)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int n;
char num;
vector<string> ans;

void func(int x,int y){
	int keta=1;
	while(keta<=y) keta*=10;
	keta/=10;
	while(keta){
		int tmp=y/keta;
		ans[x+1]+=(char)tmp+'0';
		y%=keta;
		keta/=10;
	}
	ans[x+1]+=num;
}

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		ans=vector<string>(n+1);
		cin>>ans[0];
		bool tmp=1;
		for(int i=0;i<n;i++){
			int count=0,len=ans[i].size();
			for(int j=0;j<len;j++){
				if(tmp){
					num=ans[i][j];
					count++;
					tmp=0;
				}
				else count++;
				if(j+1==len||ans[i][j+1]!=num){
					func(i,count);
					count=0;
					tmp=1;
				}
			}
		}
		cout<<ans[n]<<endl;
	}
}

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

int main(){
  string S,T;
  cin>>S>>T;
  for(int i=S.size()-T.size();i>=0;i--){
    bool bo=false;
    for(int j=0;j<T.size();j++)
      if(T[j]!=S[i+j] && S[i+j]!='?'){
        bo=true;
        break;
      }
    if(bo)
      continue;
    for(int j=0;j<S.size();j++){
      if(j<i || j>i+T.size()-1){
        if(S[j]=='?')
          cout<<'a';
        else
          cout<<S[j];
      }else
        cout<<T[j-i];
    }
    cout<<endl;
    return 0;
  }
  cout<<"UNRESTORABLE"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;

int main()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    if (n % 2 != 0)
    {
        cout << "No" << endl;
        exit(0);
    }
    string sa = s.substr(0, n / 2);
    string sb = s.substr(n / 2, n/ 2);
    if(sa==sb){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
using namespace std;
const int N = 1005;
void fast(){std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
int n,a[N][N];
queue<int>q[N];
vi v,e;
bool check()
{
	for(int i=0;i<n;i++)
	{
		if(!q[i].empty())
		{
			return false;
		}
	}
	return true;
}
int main()
{
	fast();
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n-1;j++)
			cin>>a[i][j],q[i].push(a[i][j]-1);
	for(int i=0;i<n;i++)v.pb(i);
	for(int ans=1;;ans++)
	{
		e.clear();
		vector<bool>use(n);
		if(check())
		{
			cout<<ans-1<<endl;
			return 0;
		}
		bool ok=false;
		for(int k=0;k<v.size();k++)
		{
			int i=v[k];
			if(!use[i]&&!q[i].empty())
			{
				int nxt=q[i].front();
				if(!use[nxt]&&!q[nxt].empty()&&q[nxt].front()==i)
				{
					ok=true;
					use[nxt]=true;
					use[i]=true;
					q[nxt].pop();
					q[i].pop();
					e.pb(nxt);
					e.pb(i);
				}
			}
		}
		if(!ok)
		{
			cout<<"-1";
			return 0;
		}
		v=e;
	}
	return 0;
}

Measured memory_bytes: 8704
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include<list>
#include<cctype>
#include<utility>
#include<algorithm>
#include<cctype>
using namespace std;

int main()
{
	double a,b,c;
	cin >> a >> b >> c;
	c = c * M_PI / 180;
	printf("%.6f\n",a*b*sin(c)/2);
	printf("%.6f\n",sqrt(b*b + a*a - 2*a*b*cos(c))+ a + b);
	printf("%.6f\n",b*sin(c));
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Sep 19 21:23:56 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(n), b(n);
    REP(i, n) std::cin >> a[i] >> b[i];
    REP(i, n - 2) {
        bool ok = true;
        REP(j, i, i + 3) {
            if (a[j] != b[j]) ok = false;
        }
        if (ok) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    std::cout << "No" << std::endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
using namespace std;
int main(){
    int a, b;
    cin >> a >> b;
    cout << (b-a)*(b-a+1)/2 - b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long int ll;

vector<int> a[1100];

int main(){
	int n; cin >> n;
	for(int i=0;i<n;i++){
		a[i].resize(n-1);
		for(int j=0;j<n-1;j++){
			cin >> a[i][j];
			a[i][j]--;
		}
		reverse(a[i].begin(),a[i].end());
	}
	vector<pair<int,int> > q;
	auto check = [&](int i){
		if(a[i].size()==0)return;
		int j=a[i].back();
		if(a[j].back()==i){
			pair<int,int> p=make_pair(i,j);
			if(j<i) swap(i,j);
			q.push_back(make_pair(i,j));
		}
	};
	for(int i=0;i<n;i++){
		check(i);
	}
	int day=0;
	while(q.size()>0){
		day++;
		vector<pair<int,int> > prevQ;
		sort(q.begin(),q.end());
		q.erase(unique(q.begin(),q.end()),q.end());
		swap(prevQ,q);
		for(pair<int,int> p:prevQ){
			int i=p.first,j=p.second;
			a[i].pop_back();
			a[j].pop_back();
		}
		for(pair<int,int> p:prevQ){
			int i=p.first,j=p.second;
			check(i);
			check(j);
		}
	}
	for(int i=0;i<n;i++){
		if(a[i].size()!=0){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << day << endl;
	return 0;
}

Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

template<class Val, int MAX_LEN = 100001>
void permutate(vector<Val> &arr, const vector<int> &perm) {
    static Val temp[MAX_LEN];
    assert(arr.size() == perm.size());
    for(size_t i = 0; i < arr.size(); i++) {
        temp[i] = arr[perm[i]];
    }
    copy_n(temp, arr.size(), arr.begin());
}

int n, x[100001], m, a[100001];
ll k, ans[100001];

void solve() {
    vi dx(n - 1);
    rep(i, n-1) {
        dx[i] = x[i + 1] - x[i];
    }

    vi pw2(n - 1);
    iota(all(pw2), 0);

    rep(i, m) swap(pw2[a[i]-2], pw2[a[i] - 1]);

    for(; k > 0; k >>= 1, permutate(pw2, pw2)) {
        if(k & 1)permutate(dx, pw2);
    }

    ans[0] = x[0];
    rep(i, n - 1)
        ans[i + 1] = ans[i] + dx[i];
    rep(i, n)printf("%lld\n", ans[i]);
}

int main(){
    while(cin >> n) {
        rep(i, n)scanf("%d", &x[i]);
        cin >> m >> k;
        rep(i, m)scanf("%d", &a[i]);
        solve();
    }
}

Measured memory_bytes: 3968
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <functional>
#include <numeric>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	int ans = 0;
	ans = min(A,K);
	K -= A;
	if (K <= 0) {
		cout << ans << endl;
		return 0;
	}
	K -= B;
	if (K <= 0) {
		cout << ans << endl;
		return 0;
	}
	ans -= K;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define MAX 1000001
ll prime[MAX];
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define gcd __gcd
// ll rec(vector<vector<ll> >& dp,vector<ll>& arr,int n,int i,int k,int w)
// {
//   ll ans=0;
//   if(i>=n)
//     return 0;

//   if(dp[i][k]!=-1)
//     return dp[i][k];


//   if(k!=0)
//   ans=max(rec(dp,arr,n,i+1,w,w),arr[i]+rec(dp,arr,n,i+1,k-1,w));
//   else
//   ans=max(rec(dp,arr,n,i+1,k,w),rec(dp,arr,n,i+1,w,w));

//   return dp[i][k]=ans;

// }

ll t[1200002]={0};
void build(vector<ll>& a, int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

ll maxi(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(maxi(v*2, tl, tm, l, min(r, tm)) ,maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
}



void update(int v, int tl, int tr, int pos, ll new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}


struct hash_pair {
   template <class T1, class T2>
   size_t operator()(const pair<T1, T2>& p) const{
      auto hash1 = hash<T1>{}(p.first);
      auto hash2 = hash<T2>{}(p.second);
      return hash1 ^ hash2;
   }
};


// int temp[1000002]={0};

// void sieve()
// {
  
//   for(int i=1;i<1000002;i++)
//     temp[i]=1;

//   for(int i=2;i<1000002;i++)
//   {
//      temp[i]++;
//       for(int j=i*2;j<1000002;j+=i)
//       { 
//         temp[j]++;;
//       }
//   }

// }



int main() { 

ll n,k;
cin>>n>>k;
vector<ll> a(n);
for(int i=0;i<n;i++)
  cin>>a[i];

int m=300000;
int l,r;
int ans=0,temp;
for(int i=0;i<n;i++)
{
 temp=a[i]-k;
l=max(1,temp);
 temp=a[i]+k;
r=min(m,temp);
temp=maxi(1,1,m,l,r);
update(1,1,m,a[i],temp+1);
ans=max(ans,temp+1);

}
cout<<ans;

return 0;
}
/*

*/


Measured memory_bytes: 13856
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

void solve(void){
	int N, A, B;
	string S;
	cin >> N >> A >> B >> S;
	int sa = 0, sb = 0;
	rep(N, i) {
		if (S[i] == 'c') {
			cout << "No" << endl;
			continue;
		}
		if (S[i] == 'a') {
			if (sa + sb + 1 <= A + B) {
				cout << "Yes" << endl;
				sa++;
			}
			else cout << "No" << endl;
		}
		if (S[i] == 'b') {
			if (sa + sb + 1 <= A + B && sb + 1 <= B) {
				cout << "Yes" << endl;
				sb++;
			}
			else cout << "No" << endl;
		}
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 896
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main(void){

    int N,K; cin>>N>>K;
    string S; cin>>S;
    S[K-1] = S[K-1]+32;
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

K, X = MAP()

if K*500 >= X:
    Yes()
else:
    No()


Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>

using namespace std;
int main() {

    string S;
    cin>>S;

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

    if(S[0]==S[1] && S[2]==S[3] && S[1]!=S[2]){

        cout<<"Yes"<<endl;
    }
    else{

        cout<<"No"<<endl;
    }

}



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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    for (int i=0;i<N;i++) cin >> L[i];
    sort(L.begin(),L.end());
    int ans = 0;
    for (int i=0;i<N;i++){
        for (int j=0;j<i;j++){
            int r = lower_bound(L.begin(),L.end(),L[i]+L[j]) - L.begin();
            int l = i;
            ans += max(0,r-1-l);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll N;
ll a[100001];
int main(){
    cin >> N;
    ll cnt = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        if(a[i] < 0) cnt++;
    }
    ll ans = 0;
    if(cnt%2 == 0){
        for(int i = 0; i < N; i++){
            ans += abs(a[i]);
        }
    } else {
        ll mn = MM;
        for(int i = 0; i < N; i++){
            ans += abs(a[i]);
            mn = min(mn,abs(a[i]));
        }
        ans -= 2*mn;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

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

struct edge{int to,cost;};
	
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
}

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

	int n,x;
	cin >> n >> x;

	int tmp,prev;
	int ans;

	if(n==1){
		cin >> tmp;
		cout << abs(tmp-x) << "\n";
		return 0;
	}
	else{
		cin >> prev;
		prev = abs(prev-x);
		cin >> tmp;
		tmp = abs(tmp-x);
		ans = gcd(tmp,prev);
		for(int i=2;i<n;i++){
			cin >> tmp;
			tmp = abs(tmp-x);
			ans = gcd(tmp,ans);
		}
		cout << ans << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
N=gets.to_i
P=[*1..N].map{gets.to_i}
Q=[*1..N]
N.times{|i|
  Q[P[i]-1]=i
}
c=1
mc=1
last=Q[0]
1.upto(N-1){|i|
  if last<Q[i] then
    c+=1
    if c>mc then
      mc=c
    end
  else
    c=1
  end
  last=Q[i]
}
p N-mc

Measured memory_bytes: 10036
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>


using namespace std;


int main(void) {

	int A, B, T;
	int bis = 0;
	int kaisu = 0;

	cin >> A >> B >> T;

	kaisu = (T + 0.5) / A;

	cout << kaisu * B << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
#include<stack>

using namespace std;

#define st first
#define nd second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (long long)1e18

typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;



int main() {
		int n;
		cin>>n;
		while(n>0){
				if(n%10==9){
						cout<<"Yes\n";
						return 0;
				}
				n/=10;
		}
		cout<<"No\n";








		return 0;
}


Measured memory_bytes: 256
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc067_a.cpp
 * time   : Tue Apr 28 23:06:16 2020
 * quest  : A - Sharing Cookies
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << (((a % 3 == 0) || (b % 3 == 0) || ((a + b) % 3 == 0)) ? "Possible" : "Impossible") << "\n";
  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target("avx512f")
#pragma region header
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

using vi = vector<int>;

#pragma endregion header

void solve(int N, vi a, vi b) {
  int ans = 0;
  rep(i, N)rep(j, N)ans ^= a[i] + b[j];
  cout << ans << endl;
}


#pragma region main
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int N;
  cin >> N;
  vi a(N);
  for(int i = 0 ; i < N ; i++){
    cin >> a[i];
  }
  vi b(N);
  for(int i = 0 ; i < N ; i++){
    cin >> b[i];
  }
  solve(N, move(a), move(b));
}
#pragma endregion main


Measured memory_bytes: 4736