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

/*
貪欲法(その場その場で最善と思われる手を選らび答えを得る手法)
最短手数で魔術を成功させる方法を考えたとき、赤のカードには一切操作を行わないことが
最適であると分かる。緑のカードに対して行う操作も赤<緑となるために必要な分だけで良い。
(最終的に赤 < 緑 < 青となっていれば良いため)
*/

int main() {
  int a, b, c, k, count = 0;
  cin >> a >> b >> c >> k;

  while (a >= b) { count++; b *= 2; }
  while (b >= c) { count++; c *= 2; }
  
  cout << (count <= k ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3548
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <functional>
#include <algorithm>

using namespace std;

typedef long	DWORD;
typedef unsigned long U_DWORD;
typedef long long QWORD;
typedef unsigned long long U_QWORD;
typedef short WORD;
typedef unsigned short U_WORD;
typedef bool	BOOL;
typedef pair<U_QWORD, U_QWORD> PAIR;

DWORD N,Y;

BOOL solve(DWORD *yukichi_num, DWORD *higuchi_num, DWORD *noguchi_num)
{
	for (DWORD yukichi = 0; yukichi <= N; yukichi++) {
		for (DWORD higuchi = 0; higuchi <= N; higuchi++) {
			DWORD noguchi = N - yukichi - higuchi;
			if (noguchi < 0) {
				continue;
			}
			if((yukichi * 10000 + higuchi * 5000 + noguchi * 1000) == Y) {
				*yukichi_num = yukichi;
				*higuchi_num = higuchi;
				*noguchi_num = noguchi;
				return true;
			}		 
		}
	}

	return false;

}

int main()
{
#ifdef FOR_IDE

	ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif

	DWORD yukichi_num, higuchi_num, noguchi_num;

	cin >> N >> Y;


	if (!solve(&yukichi_num, &higuchi_num, &noguchi_num)) {
		printf("%d %d %d\n", -1, -1, -1);
	} else {
		cout << yukichi_num << " " << higuchi_num << " " << noguchi_num << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
// 051 C - Back and Forth

#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    int sx , sy , tx , ty;
    cin >> sx >> sy >> tx >> ty;
    string s;
    rep(i ,tx-sx) s+='R';
    rep(i ,ty-sy) s+='U';
    rep(i ,tx-sx) s+='L';
    rep(i ,ty-sy) s+='D';
    s+='L';
    rep(i ,ty-sy+1) s+='U';
    rep(i ,tx-sx+1) s+='R';
    s+="DR";
    rep(i ,ty-sy+1) s+='D';
    rep(i ,tx-sx+1) s+='L';
    s+='U';
    cout << s << endl;
}

Measured memory_bytes: 256
N = int(input())
if N <= 111:
    print(111)
elif N<=222:
    print(222)
elif N<=333:
    print(333)
elif N<=444:
    print(444)
elif N<=555:
    print(555)
elif N<=666:
    print(666)
elif N<=777:
    print(777)
elif N<=888:
    print(888)
elif N<=999:
    print(999)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  string s;
  cin >> s;
  int ans = 700;
  rep(i, 0, 3){
    if(s[i]=='o') ans += 100;
  }
  cout << ans << endl;
}


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

int main(){
  vector<int> v(10);
  for(int i=0;i<10;i++)
    cin >> v[i];
  sort(v.begin(), v.end());
  for(int i=0;i<3;i++)
    cout << v[9-i] << endl;
  return 0;
}

Measured memory_bytes: 1212
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll d, tt, s;
		cin >> d >> tt >> s;

		double ttt = (d * 1.0) / (s * 1.0);
		// deba(ttt);

		if (ttt <= tt)
			cout << "Yes";
		else
			cout << "No";
	}
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,j,n) for(int (i)=j;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int main(){
   ll n,k;
   cin>>n>>k;
   n%=k;
   cout<<min(abs(n-k),n)<<endl;
}

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

int main() {
  int n, h, a, count;
  cin >> n >> h;
  count = 0;
  for (int i=0; i<n; i++) {
    cin >> a;
    if (a>=h) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n; cin >> n;
    int ans = 0;
    srep(i,1,n){
        srep(j,1,n){
            if(i*j<n)ans++;
            else break;
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3636
count = int(0)
x = input().split()
count2 = int(x[0])
y = list(map(int, input().split()))
y.reverse()
print(y[count],end='')
count += 1
for j in range(count2 - 1):
    print(' ',end='')
    print(y[count],end='')
    count += 1
print('')


Measured memory_bytes: 5620
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
const int MAX_N = 100001;
struct edge{
    int tonode, cost;
};
vector<edge> node[MAX_N];
int color[MAX_N];

void paint(int n, int c){
    color[n] = c;
    for(int i=0; i<node[n].size(); i++){
        if(color[node[n][i].tonode] == -1){
            if(node[n][i].cost %2 == 0) paint(node[n][i].tonode, c);
            else paint(node[n][i].tonode, !c);
        }
    }
}
int main(){
    memset(color, -1, sizeof(color));
    int n, u, v, w;
    cin >> n;
    for(int i=0; i<n-1; i++) {
        cin >> u >> v >> w;
        node[u].push_back({v, w});
        node[v].push_back({u, w});
    }
    paint(1, 0);
    for(int i=1; i<=n; i++) cout << color[i] << endl;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-8;
const int MAX=1e5+10;
const ll mod=1e9+7;
int main()
{
	int n,y,i,j,k;
	while(~scanf("%d%d",&n,&y))
	{
		for(i=0;i*10000<=y;i++)
		{
			for(j=0;i*10000+j*5000<=y;j++)
			{
				k=y-i*10000-j*5000;
				k/=1000;
				if(i+j+k==n)
				{
					printf("%d %d %d\n",i,j,k);
					goto end;
				}
			}
		}
		puts("-1 -1 -1");
		end:;
	}
	return 0;
}

Measured memory_bytes: 256
a,b,c,d = gets.split.map &:to_i

c_cnt = b/c - a/c
if a % c == 0 then
	c_cnt += 1
end

d_cnt = b/d - a/d
if a % d == 0 then
	d_cnt += 1
end

lcm = c.lcm(d)

lcm_cnt = b/lcm - a/lcm
if a % lcm == 0 then
	lcm_cnt += 1
end

puts b - a + 1 - (c_cnt + d_cnt - lcm_cnt)


Measured memory_bytes: 1788
#include <iostream>

using namespace std;

const int MAX_N = 5e2+10;
const int MAX_Q = 1e5+10;

int main(int argc, char const *argv[])
{
	int n, m, Q;
	cin >> n >> m >> Q;

	int s[MAX_N][MAX_N]={0};

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d %d", &l, &r);
		s[l][r]++;
	}

	int p[MAX_Q], q[MAX_Q];
	for (int i = 0; i < Q; ++i) {
		scanf("%d %d", &p[i], &q[i]);
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			s[i][j] += s[i-1][j]+s[i][j-1]-s[i-1][j-1];
		}
	}

	for (int i = 0; i < Q; ++i) {
		int l=p[i], r=q[i];
		cout << s[r][r] - s[r][l-1] - s[l-1][r] + s[l-1][l-1] << endl;
	}

	return 0;
}

Measured memory_bytes: 2688
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		sc.nextLine();
		String str = sc.nextLine();

		int consum=0;
		for(int i=0;i<str.length();i++){
			String subSf=str.substring(0, i);
			String subSl=str.substring(i, str.length());
			// System.out.println(subSf+"  "+subSl);
			int flength=subSf.length();
			int llength=subSl.length();

			ArrayList<Character> charF = new ArrayList<Character>();
			for(int n=0;n<flength;n++){
				if(!charF.contains(subSf.charAt(n))){
					charF.add(subSf.charAt(n));
				}
			}
			ArrayList<Character> charL = new ArrayList<Character>();
			for(int j=0;j<llength;j++){
				if(!charL.contains(subSl.charAt(j))){
					charL.add(subSl.charAt(j));
				}
			}
			int con=0;
			for(char cf:charF) {
				for(char cl:charL) {
					if(cf==cl){
						con++;
					}
				}
			}
			consum=Math.max(consum, con);
		}
		System.out.println(consum);
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 100010
int vis1[N],vis2[N];
int main()
{
    int i,j,k,n,x,y;
    int x1,x2,y1,y2;
    int p1,p2,q1,q2;
    scanf("%d",&n);
    for(i=0;i<n/2;i++)
    {
        scanf("%d%d",&x,&y);
        vis1[x]++;
        vis2[y]++;
    }
    x1=0;
    x2=-1;
    y1=0;
    y2=-1;
    for(i=1;i<=N-10;i++)
    {
        if(vis1[i]>x1)
        {
            y1=x1;
            y2=x2;
            x1=vis1[i];
            x2=i;
        }
        else
        if(vis1[i]>y1)
        {
            y1=vis1[i];
            y2=i;
        }
    }
    p1=0;
    p2=-1;
    q1=0;
    q2=-1;
    for(i=1;i<=N-10;i++)
    {
        if(vis2[i]>p1)
        {
            q1=p1;
            q2=p2;
            p1=vis2[i];
            p2=i;
        }
        else
        if(vis2[i]>q1)
        {
            q1=vis2[i];
            q2=i;
        }
    }
    if(x1>0&&y1>0&&p1>0&&q1>0)
    {
        if(x2!=p2)
        {
            printf("%d\n",n-x1-p1);
            return 0;
        }
        else
        {
            printf("%d\n",n-max(x1+q1,y1+p1));
            return 0;
        }
    }
    if(x1>0&&y1>0&&p1>0&&q1<=0)
    {
        if(x2!=p2)
        {
            printf("%d\n",n-x1-p1);
            return 0;
        }
        else
        {
            printf("%d\n",n-y1-p1);
            return 0;
        }
    }
    if(x1>0&&y1<=0&&p1>0&&q1>0)
    {
        if(x2!=p2)
        {
            printf("%d\n",n-x1-p1);
            return 0;
        }
        else
        {
            printf("%d\n",n-x1-q1);
            return 0;
        }
    }
    if(x2!=p2)
    {
        printf("%d\n",n-x1-p1);
        return 0;
    }
    printf("%d\n",n/2);
    return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _Ty> static _Ty tp_abs(const _Ty& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _Ty> static _Ty tp_min(_Ty a, _Ty b) {
	return a < b ? a : b;
}
template <class _Ty> static _Ty tp_max(_Ty a, _Ty b) {
	return a > b ? a : b;
}
template<class T> static void getint(T& a) {
	const char* fmt = " %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class T> static void getint(T& a, T& b) {
	const char* fmt = " %d %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class T> static void getint(T& a, T& b, T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static const int EduDp_INF = 1100000000;
static const int MOD_NUM = 1000000007;
static void G_task();

#if 1
int main()
{
	G_task();
	fflush(stdout);
	return 0;
}
#endif

static LLONG G_dfs(std::vector<LLONG>& dp, int nowEdge, std::vector<std::vector<int>>& graph)
{
	if(dp[nowEdge]) return (dp[nowEdge]);

	LLONG tmpPath = 0;
	int edgeNum = graph[nowEdge].size();
	for (int e = 0; e < edgeNum; e++) {
		tmpPath = tp_max(tmpPath, G_dfs(dp, graph[nowEdge][e], graph));
	}
	dp[nowEdge] = tmpPath + 1;
	return dp[nowEdge];
}

static void G_task()
{
	int N, M;
	getint(N, M);

	std::vector<std::vector<int>> graph(N);
	for (int i = 0; i < M; i++) {
		int x, y;  getint(x, y);
		graph[x - 1].push_back(y - 1);
	}

	std::vector<LLONG> dp(N, 0);
	
	LLONG max = 0;
	for (int i = 0; i < N; i++) {
		max = tp_max(max, G_dfs(dp, i, graph) - 1LL);
	}
	printf("%lld\n", max);
}


Measured memory_bytes: 9856
#include <bits/stdc++.h>
#define INF 2000000000
using namespace std;
typedef long long ll;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while(c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while(c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
int n, d[1005];
void init(){
    n = read();
    for (int i = 1; i <= n; ++i)
        d[i] = read();
}
void solve(){
    int ans = 0;
    for (int i = 1; i <= n; ++i){
        for (int j = i + 1; j <= n; ++j)
            ans += d[i] * d[j];
    }
    cout << ans << endl;
}
int main(){
    init();
    solve();
    return 0;
}

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

static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n,A[MAX][MAX];

void ant();

int main(){
  cin >> n;

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      A[i][j]=INFTY;
    }
  }

  int a,b,c,d;

  for(int i=0;i<n;i++){
    cin >> a >> b;
    for(int j=0;j<b;j++){
      cin >> c >> d;
      A[a][c]= d;
    }
  }
  ant();
  return 0;
}

void ant(){
  int minv,d[MAX],color[MAX];

  for(int i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;

  while(1){
    minv = INFTY;
    int u=-1;
    for(int j=0;j<n;j++){
      if(minv > d[j] && color[j]!=BLACK){
        u=j;
        minv=d[j];
      }
    }
    if(u==-1)break;

    color[u]=BLACK;

    for(int m=0;m<n;m++){
      if(color[m]!=BLACK && A[u][m]!=INFTY){
        if(d[m]>d[u]+A[u][m]){
          d[m]=d[u]+A[u][m];
          color[m]=GRAY;
        }
      }
    }
  }
  for(int i=0;i<n;i++){
    cout << i << " " << (d[i]==INFTY ? -1 : d[i]) << endl;
  }
}



Measured memory_bytes: 3120
N,D=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(N)]
def dist(a,b):
    return (sum([(a[i]-b[i])**2 for i in range(D)]))**0.5
cnt=0
for i in range(N):
    for j in range(i+1,N):
        if dist(X[i],X[j])==int(dist(X[i],X[j])):
            cnt+=1
print(cnt)

Measured memory_bytes: 3188
n,m = map(int,input().split())

a = [0] * (n+1)
dp = [0] * (n+1)
mod = 1000000007

for i in range(m):
	num = int(input())
	a[num] = 1

dp[0]=1

for i in range(1,n+1):
	if a[i] == 1:
		continue

	dp[i] += dp[i-1]
	if i>1:
		dp[i] += dp[i-2]

	dp[i] = dp[i] % mod

print(dp[n]%mod)

Measured memory_bytes: 13428
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    string x,y;
    cin>>x>>y;
    int a=x.length(),b=y.length();
    if(a!=b)
        cout<<"No"<<endl;
    else{
        for(int i=0;i<a;i++){
            char temp=x[0];
            x.erase(x.begin()+0);
            x+=temp;
            if(x==y){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
         cout<<"No"<<endl;
    }


    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    priority_queue<int> que;
    rep(i, n) {
        que.push(a[i]);
        que.push(a[i]);
    }

    ll ans = 0;
    que.pop();
    rep(i, n - 1) {
        ans += que.top();
        que.pop();
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6908
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int k,x;
	cin >> k >> x;
	int minx,maxx;
	minx = max(-1000000,x-k+1);
	maxx = min(1000000,x+k-1);
	FOR(i,minx,maxx){
		printf("%d ",i);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 100000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define pi atan(1)*4
#define ALL(x) x.begin(),x.end()
#define int ll


main(){
	int n,a,b;cin>>n>>a>>b;
	if(a>b) swap(a,b);
	if((b-a)%2==0){
		cout<<(b-a)/2<<endl;
	}else{
		int q1=a-1+((b-(a-1)-2))/2+1;
		int q2=n-b+(n-(a+(n-b)+1))/2+1;
		//cout<<q1<<" "<<q2<<endl;
		cout<<min(q1,q2)<<endl;
	}
}

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

int main()
{
    char name[10];
    int a, b;
    for (int i = 0; i < 9; i++) {
        scanf("%s %d %d", name, &a, &b);
        printf("%s %d %d\n", name, a+b, a*200+b*300);
    }
    return 0;
}



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

int main(){
	int n , x;
	cin>>n;
	for(int i=1 ; i<=n ; i++){
		x=i;
		if(i%3==0 && x%10!=3){
			cout << " " << i;
		} else if(x%10==3) { 
			cout << " " << i;
		} else {
			for(int j=0 ; j<(int(log10((double)n))) ; j++){
				x/=10;
				if(x){
					if(x%10==3){ 
						cout << " " << i;
						break;
					}
				}
			}
		}		
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i,n) for (int i=0; i < int(n); i++)
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	cout << '\n';
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	cout << '\n';
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	cout << '\n';
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) * b;
	//a*bは64bit integer overflow
}

bool integer(double num) {
	return floor(num) == num;
}

Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	IOS;
	int a,b,c;
	cin >> a >> b ;
	for (int i = b - a + 1; i < b + a;i++){
		cout << i;
		if (i!=b+a-1)
			cout << " ";
	}

		cout << endl;
	return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from itertools import combinations
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
def inpl(): return tuple(map(int, input().split()))
 
N, K, L = inpl()
 
tree = [[[-1, 1]  for _ in range(N+1)] for _ in range(2)] # [next, rank]

def find(i, t):
    if tree[t][i][0] == -1:
        group = i
    else:
        group = find(tree[t][i][0], t)
        tree[t][i][0] = group
    return group
 
def unite(x, y, t):
    px = find(x, t)
    py = find(y, t)
     
    if tree[t][px][1] == tree[t][py][1]: # rank is same
        tree[t][py][0] = px
        tree[t][px][1] += 1
    else:
        if tree[t][px][1] < tree[t][py][1]:
            px, py = py, px
        tree[t][py][0] = px
 
for _ in range(K):
    x, y = inpl()
    if not int(find(x, 0) == find(y, 0)):
        unite(x, y, 0)

for _ in range(L):
    x, y = inpl()
    if not int(find(x, 1) == find(y, 1)):
        unite(x, y, 1)

D = defaultdict(lambda: 0)
P = []
for i in range(1, N+1):
    a, b = find(i, 0), find(i, 1)
    D[(a, b)] += 1
    P.append((a, b))
print(" ".join(map(str, [D[(a, b)] for a, b in P])))

Measured memory_bytes: 99740
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*
    Ball and Boxes 2
    男、女、一人以上(保護者形式)
*/

int main() {
    ll n, k;
    cin >> n >> k;
    COMinit();

    ll ans = 0;

    rep(i,k){
        ll mul = 1;
        rep(j,n){
            mul *= (k-i);
            mul %= MOD;
        }
        mul *= COM(k,i);
        mul %= MOD;
        if(i%2==0){
            ans += mul;
            ans %= MOD;
        }else{
            ans -= mul;
            ans += MOD;
            ans %= MOD;
        }
    }

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



Measured memory_bytes: 15076
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rbf(a, x) for (auto& a : x)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen
    vector<long long> divisor(long long n) {
        vector<long long> ret;
        for (long long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                ret.push_back(i);
                if (i * i != n) ret.push_back(n / i);
            }
        }
        sort(ret.begin(), ret.end()); // 昇順に並べる
        return ret;
    }

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        vl A(n);
        rep(i,n)cin>>A[i];
        sort(all(A));
        umap<ll,ll> M;
        ll res=0;
        rep(i,n){
            if(M[A[i]])continue;
            if(i<n-1&&A[i]==A[i+1]){
                M[A[i]]++;
                continue;
            }
            bool c=true;
            vl x=divisor(A[i]);
            rbf(p,x){
                if(M[p]){
                    c=false;
                    break;
                }
            }
            M[A[i]]++;
            if(c)res++;
        }
        cout<<res<<"\n";
    }

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

int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A--, B--, C--, D--;
  string S;
  cin >> S;
  bool ans_check = true;
  int double_count = 0;
  bool double_check = false;
  for(int i = A; i < max(C, D); i++) {
    if(S[i] == '#') {
      double_count++;
      if(double_count == 2) {
        double_check = true;
        break;
      }
      continue;
    }
    double_count = 0;
  }
  if(double_check) ans_check = false;
  if(C < D) {
    if(ans_check) {
      cout << "Yes" << endl;
      return 0;
    }
    else {
      cout << "No" << endl;
      return 0;
    }
  }
  else {
    int triple_count = 0;
    bool triple_check = false;
    for(int i = B - 1; i <= D + 1; i++) {
      if(S[i] == '.') {
        triple_count++;
        if(triple_count == 3) {
          triple_check = true;
          break;
        }
        continue;
      }
      triple_count = 0;
    }
    if(!triple_check) ans_check = false;
    if(ans_check) {
      cout << "Yes" << endl;
      return 0;
    }
    else {
      cout << "No" << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define fi first
#define sc second
#define pii pair<int,int>
#define vi vector<int>
#define msi map<string,int>
#define si set<int>
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define dep(i,a,b)	for(int i=a;i>=b;i--)
#define isinarr(i,n) ((i>=0)?((i<n)?1:0):0)
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppb pop_back
#define hell 1000000007
#define mp make_pair
#define	endl '\n'

using namespace std;
void solve()
{
	string s;
	cin>>s;
	int k=s.length(),c=0;
	rep(i,0,k/2)
	{
		if(s[i]!=s[k-1-i])
			c++;
	}
	cout<<c;

} 



signed main()
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    return 0;
}

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

using namespace std::literals;
constexpr auto N_max = 100'000;

struct Edge;

struct Node {
  Node *parent;
  Edge *edge;
  std::vector<Node *> children;
};

struct Edge {
  Node *a, *b;
  int color;
  int index;
};

static Node nodes[N_max + 1];
static Edge edges[N_max];

int main() {
  auto N = 0;
  std::cin >> N;
  for (auto i = 1; i <= N - 1; ++i) {
    auto ai = 0, bi = 0;
    std::cin >> ai >> bi;
    edges[i] = {&nodes[ai], &nodes[bi], 0, i};

    assert(!nodes[bi].parent);
    nodes[bi].parent = &nodes[ai];
    nodes[bi].edge = &edges[i];
    nodes[ai].children.emplace_back(&nodes[bi]);
  }

  auto stack = std::stack<Node *>{};
  {
    auto root = &nodes[0];
    for (auto i = 1; i <= N; ++i) {
      if (!nodes[i].parent) {
        root = &nodes[i];
        break;
      }
    }
    stack.push(root);
  }

  auto max_color = 0;
  while (!stack.empty()) {
    auto node = stack.top();
    stack.pop();
    if (node->children.empty())
      continue;
    for (auto c : node->children)
      stack.push(c);

    auto parent_color = node->parent ? node->edge->color : 0;
    auto color = 0;
    for (auto c : node->children) {
      if (++color == parent_color)
        ++color;
      c->edge->color = color;
    }

    max_color = std::max(max_color, color);
  }
  std::cout << max_color << "\n";

  for (auto i = 1; i <= N - 1; ++i) {
    std::cout << edges[i].color << "\n";
  }
  return 0;
}


Measured memory_bytes: 8576
/*If my response is late, it's just how long it takes
To hit my fuckin' radar, I'm so far away
*/


#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

using ll = long long;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() int t; cin>>t; while(t--)
#define print(n) cout<<n<<"\n"
#define inp(n) int n; cin>>n
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define maxn 1000010
#define mod 1e9+7
#define ff  first
#define ss  second
#define fora(var, start, end) for(int var = start; var < end; var++)
int main()
{
    fast();
    ll n,k;
    cin>>n>>k;
    print(min(n%k,(k-n%k)));

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long f0=2,f1=1,f2,n;
int main()
{
	cin>>n;
	if(n==0)
	{
		cout<<"2"<<'\n';
		goto portal;
	}
	if(n==1)
	{
		cout<<"1"<<'\n';
		goto portal;
	}
	for(int i=2;i<=n;i++)
	{
		f2=f0+f1;
		f0=f1;
		f1=f2;
	}
	cout<<f2<<'\n';
	portal:
		return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
int n, m;

int main(){
	IOS
	cin >> n >> m;
	cout << n*(n-1)/2 + m*(m-1)/2 << '\n';
}

Measured memory_bytes: 3608
use proconio::*;
use proconio::marker::Chars;

fn main() {
    input!{
        a: i64,
        b: Chars,
    }

    let mut bb = 0i64;
    bb += (b[0].to_digit(10).unwrap()* 100) as i64;
    bb += (b[2].to_digit(10).unwrap() * 10) as i64;
    bb += (b[3].to_digit(10).unwrap()) as i64;
    let ans = a * bb / 100;

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


Measured memory_bytes: 2168
#define		_CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>

using namespace std;

int main()
{
	for (;;)
	{
		string		line;
		getline(cin, line);

		if (line == "0")
			break;

		int		sum = 0;
		for (auto it : line)
		{
			sum += it - '0';
		}

		cout << sum << "\n";

	}

	return 0;
}

Measured memory_bytes: 3156
#include "bits/stdc++.h"
#define rep(i, j) for (long long i = j; i > 0; i--)
using namespace std;


int main() {
	long long n;
	cin >> n;

	vector<long long> h(n);
	for (long long i = 0; i < n; i++)
		cin >> h[i];
	int flag = 1;
	int current_num;
	for (long long i = 0; i < n - 1; i++) {
		signed long long diff = h[i] - h[i + 1];
		if (diff >= 2) {
			cout << "No" << endl;
			return 0;
		}
		if (diff == 1) {
			if (flag == 0)
			    flag = 1;
			else {
				cout << "No" << endl;
				return 0;
			}
		}
		if (diff < 0) {
			flag = 0;
		}
	}

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

Measured memory_bytes: 1024
//BINARY_BOY!!
//Bool THINK TWICE CODE ONCE = true;
//Im back basterds
//KEEP CALM AND FUCK PYTHON
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
#include <iomanip>
#include <sstream>
#include <limits>
#include <queue>
using namespace std;
const int MAXN = 1e5 + 10;
#define salar long double
#define mp make_pair
#define sp setprecision
#define pb push_back
#define pp pop_back
#define oold numeric_limits<long double>::max()
#define _oold numeric_limits<long double>::min()
#define ooint numeric_limits<int>::max()
#define _ooint numeric_limits<int>::min()
#define ooll numeric_limits<long long>::max()
#define _ooll numeric_limits<long long>::min()
#define ct cout
#define vec vector
#define fx fixed
#define cn cin
#define input readInt()
#define print writeInt
#define pc(x) putchar(x)
typedef long long ll;
#define pii pair < int , int>
#define ppi pair < pair < int , int > , int>

void show(long double a , int x , bool endofline , bool space)
{
	ct << fx << sp(x) << a;
	if(endofline)
		ct << endl;
	if(space)
		ct << ' ';
}
int readInt () {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}
inline void writeInt (long long n) {
	long long  N = n, rev, count = 0;
	rev = N;
	if (N == 0) { pc('0'); pc('\n'); return ;}
	while ((rev % 10) == 0) { count++; rev /= 10;} //obtain the count of the number of 0s
	rev = 0;
	while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}  //store reverse of N in rev
	while (rev != 0) { pc(rev % 10 + '0'); rev /= 10;}
	while (count--) pc('0');
}
ll i , z , j;
ll ar [ MAXN ] , dp [ MAXN ];
vec < ll > v , v2;
set < ll > st;
pii p;
string s;
bool flag2 , flag ;
void debug() {
	cout << "DEBUGGING\n";
}
int main()
{
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	ll n , m;
	cin >> n >> m;
	ll preok = (1LL<<31) - 1;
	for(i = 0 ; i < MAXN ; i++)
		ar [ i ] = preok;
	for(i = 0 ; i < MAXN ; i++)
		dp [ i ] = (1LL<<31) - 1;
	ll k = sqrt(n);
	for(i = 0 ; i < n / k; i += k)
		for(j = i ; j < i + k ; j++)
			dp [ i ] = min(dp [i ] , ar[ j ]);
	for(i = 0 ; i < m ; i++)
	{
		ll a;
		cn >> a;
		if(a)
		{
			ll s1 , e1;
			cn >> s1 >> e1;
			if(s1 == e1)
			{
				cout << ar [ s1 ] << endl;
				continue;
			}
			ll minans = (1LL<<31) - 1;
			flag = false;
			for( ; s1 <= e1 && (s1 % k); s1++)
				minans = min(minans , ar [ s1 ]);
			for(j = s1/k ; (j + 1)* k - 1 <= e1 ; j++ , s1 += k , flag = true)
				minans = min(minans , dp [ j ]);
				if(flag)
					s1+= -k;
			for( ; s1 <= e1 ; s1++)
				minans = min(minans , ar [ s1 ]);
			cout << minans << endl;		
		}
		else
		{
			ll ii , x;
			cn >> ii >> x;
			ar [ ii ] = x;
			ii = ii/k;
			ii *= k;
			if(ii + k - 1 < n)
			{
				dp [ ii / k ] = (1LL<<31);
				for(j = 0 ; j < k ; j++)
					dp [ ii / k ] = min(dp [ ii / k ] , ar [ ii + j ]);
			}
		}
		
	}
}




Measured memory_bytes: 4812
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
prev = -1

for i in range(N):
    a = A[i]
    ans += B[a-1]
    if a - 1 == prev:
        ans += C[a-2]
    prev = a

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int isPrime(int);

int main(){
  int n, x, i;
  int cnt = 0;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(isPrime(x)) cnt++;
  }

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

  return 0;
  
}

int isPrime(int x){
  int i;
  
  if(x<2) return 0;
  else if(x==2) return 1;
  
  if(x%2==0) return 0;
  for(i=3;i*i<=x;i+=2){
    if(x%i==0){
      return 0;
    }
  }

  return 1;
}



Measured memory_bytes: 2068
#ifdef local_mode
    #include <cstdio>
    #include <cassert>
#endif
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
#define pb push_back
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
#ifdef local_mode
    ios_base::sync_with_stdio(0), cin.tie(0);
    assert(freopen("in", "r", stdin));
    assert(freopen("out", "w", stdout));
#endif
    
    int n;
    cin >> n;

    ll sum = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        sum += a;
    }
    sum -= n;
    cout << sum;
    
    return 0;
}







































Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] value = new int[num];
        int[] cost = new int[num];
        for(int i=0; i<num; i++){
          value[i] = sc.nextInt();
        }
        for(int i=0; i<num; i++){
          cost[i] = sc.nextInt();
        }
        int sum = 0;
        int sub = 0;
        for(int i=0; i<num; i++){
          sub = value[i] - cost[i];
          if(sub > 0) sum += sub;
        }
		System.out.println(sum);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e8,cnt;


int main(){
	string s;
	cin>>s;
	for(ll i=0; i<s.size(); i++){
		if(s[i]=='A'){
			ans=i;
			break;
		}
	}
	for(ll i=s.size()-1; i>=0; i--){
		if(s[i]=='Z') {
			sum=i;
			break;
		}
	}
	cout<<(sum-ans)+1<<endl;
}




Measured memory_bytes: 640
import Data.List  -- sortBy, group
import Data.Ord   -- comparing

mode = fst . head . sortBy (flip $ comparing snd) . freqList
maxLen =     head . sortBy (flip $ comparing length)

freqList = map valFrq . group . sort -- list of value-freq pairs
  where
    valFrq ls = (head ls, length ls)

main = do s <- getLine
          putStrLn . modeMaxLen . words $ s
  where
          modeMaxLen ls = (mode ls) ++ " " ++ (maxLen ls)

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

typedef long long ll;
typedef long double ld;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define eb emplace_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)

int power(int a, int b, int mod){
    int res = 1;
    a %= mod;
    while(b > 0){
        if(b & 1){
            res = res * 1ll * a % mod;
            b--;
        }
        a = a * 1ll * a % mod;
        b >>= 1;
    }
    return res;
}

int f(int x){
    if(x == 0) return 0;
    int cnt = __builtin_popcount(x);
    x %= cnt;
    return f(x) + 1;
}

void solve(){
    
    int n; cin >> n;
    string s; cin >> s;
    reverse(all(s));
    int tmp1[n], tmp2[n], sum1 = 0, sum2 = 0, mod = 0;
    for(char c : s){
        mod += c == '1';
    }
    for(int i = 0; i < n; i++){
        if(mod > 1)tmp1[i] = power(2, i, mod - 1);
        tmp2[i] = power(2, i, mod + 1);
        if(s[i] == '1'){
            if(mod > 1)sum1 = (sum1 + tmp1[i]) % (mod - 1);
            sum2 = (sum2 + tmp2[i]) % (mod + 1);
        }
    }
    int ans[n];
    for(int i = 0; i < n; i++){
        if(s[i] == '0'){
            if(mod == 0){
                ans[i] = 1;
                continue;
            }
            int _sum2 = (sum2 + tmp2[i]) % (mod + 1);
            ans[i] = f(_sum2) + 1;
        }
        else{
            if(mod == 1){
                ans[i] = 0;
                continue;
            }
            int _sum1 = ((sum1 - tmp1[i]) % (mod - 1) + (mod - 1)) % (mod - 1);
            ans[i] = f(_sum1) + 1;
        }
    }
    for(int i = n - 1; i >= 0; i--)
        cout << ans[i] << '\n';
    
}


int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    boost;

    int t = 1;
    // cin >> t;


    for(int i = 1; i <= t; i++){
        // cout << "Case #" << i << ": ";

        solve();

    }
    return 0;
}

Measured memory_bytes: 6124
#include <stdio.h>

int f[45];

int fib(int n) {
  if (n <= 1) return f[n] = 1;
  if (f[n] > 0) return f[n];
  return f[n] = fib(n - 1) + fib(n - 2);
}

int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", fib(n));

  return 0;
}



Measured memory_bytes: 2104
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long ll;

const ll N = 2e5 + 10;

ll a[N];
ll n, k;

int main() {
	cin >> n >> k;
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (ll p = 0, q = k; q < n; q++, p++) {
		if (a[p] < a[q]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 5156
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

LL a, b;

int main(){
	cin >> a >> b;
	cout << lcm(a, b) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i += 2) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x,t;
    cin >> x >> t;
    cout << max(0, x-t) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, ans;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) {
        cin >> a[i];
        ans += a[i];
    }
    sort(a.begin(), a.end());
    int i = 0;
    while(i < n) {
        if (ans % 10) {
            cout << ans << endl;
            return 0;
        }
        if (a[i] % 10) ans -= a[i];
        i++;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256