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

const int MN = 3010;

int N;
int A[MN];
vector<int> adj[MN];
int dp[MN];

void dfs(int u, int p) {
    dp[u] = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        dfs(v, u);
        if(A[v] <= A[u] - 1) {
            dp[u] |= dp[v] ^ 1;
        }
    }
}

int main() {
    scanf("%d", &N);

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

    for(int i = 0; i < N - 1; i++) {
        int u, v; scanf("%d %d", &u, &v);
        u--; v--;

        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    for(int i = 0; i < N; i++) {
        dfs(i, -1);
        if(dp[i]) printf("%d ", i + 1);
    }
}


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

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1; 
    //cin >> t;
    for(int T = 0; T < t ; T++){
        ll n;
        cin >> n;
        ll sum[n], sub[n], a, b;
        for(int i = 0; i <n; i++){
            cin >> a >> b;
            sum[i] = a + b;
            sub[i] = a - b;
        }
        sort(sum, sum + n);
        sort(sub, sub + n);
        cout << max(abs(sum[0] - sum[n - 1]), abs(sub[n - 1] - sub[0])) << endl;
    }
    return 0;
}

Measured memory_bytes: 6768
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int Y = sc.nextInt();
    boolean f = false;

    for (int i=0; i <= N; i++) {
      if (Y < i * 10000 || f == true) {
        break;
      }

      for (int j=0; j <= N-i; j++) {
        if (Y < i * 10000 + j * 5000  || f == true) {
          break;
        }

        if (i * 10000 + j * 5000 + (N-i-j) * 1000 == Y) {
          System.out.println(i + " " + j + " " + (N-i-j));
          f = true;
          break;
        }
      }
    }

    if (f == false) {
      System.out.println("-1 -1 -1");
    }
  }
}


Measured memory_bytes: 23124
import heapq
n = int(input())
A = []
for _ in range(n):
    a, b = map(int, input().split())
    heapq.heappush(A, [b, a])
a_sum = 0
f = 1
for _ in range(n):
    b, a = heapq.heappop(A)
    a_sum += a
    if a_sum > b:
        f = 0
        break
print(["No", "Yes"][f])

Measured memory_bytes: 82008
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
using namespace std;
typedef long long ll;
ll dx[] = { 1,1,0,-1,-1,-1,0,1 };
ll dy[] = { 0,1,1,1,0,-1,-1,-1 };
ll prime(ll x) {
	ll 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;
}
ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}

ll MOD = 1000000007;
int main() {
	string S;
	cin >> S;
	if (S.substr(0, 4) == "YAKI")
		cout << "Yes" << endl;
	else 
		cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int n,k,q;
	cin>>n>>k>>q;
	vector<int> a(q);
	rep(i,q)cin>>a[i],a[i]--;
	vector<int> p(n,k-q);
	rep(i,q)p[a[i]]++;

	rep(i,n) cout<<(p[i]>0?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k,sum=0;
    cin>>n>>k;
    long long int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    sort(h,h+n);
    for(int i=0;i<(n-k);i++)
    {
        sum+=h[i];
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1792
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, -1, mod)


def main():
    s=input()
    a = 0
    for i in s:
        a += ord(i) - ord('0')
        a %= 9
    print("Yes" if a == 0 else "No")
main()


Measured memory_bytes: 9636
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n;
	cin>>n;
	int x,y;
	cin>>x>>y;
	--x; --y;
	vector<vector<int>> dis(n,vector<int>(n,inf));
	rep(i,n){
		queue<int> Q;
		Q.push(i);
		dis[i][i] = 0;
		while(!Q.empty()){
			int now = Q.front();
			Q.pop();
			if(dis[i][now-1] == inf && now-1>=0){
				dis[i][now-1] = dis[i][now]+1;
				Q.push(now-1);
			}
			if(dis[i][now+1] == inf && now+1 <n){
				dis[i][now+1] = dis[i][now]+1;
				Q.push(now+1);
			}
			if(now == x && dis[i][y] == inf){
				dis[i][y] = dis[i][now]+1;
				Q.push(y);
			}
			if(now == y && dis[i][x] == inf){
				dis[i][x] = dis[i][now]+1;
				Q.push(x);
			}
		}
	}/*
	cout<<"pj"<<endl;
	rep(i,n){
		rep(j,n){
			cout<<dis[i][j]<<' ';
		}
		cout<<endl;
	}
	cout<<"pp"<<endl;*/
	vector<vector<int>> cnt(n,vector<int>(n,0));
	//cout<<"bbbb"<<endl;
	rep(i,n){
		rep(j,n){
			++cnt[i][dis[i][j]];
		}
	}
	/*
	cout<<"pj"<<endl;
	rep(i,n){
		rep(j,n){
			cout<<cnt[i][j]<<' ';
		}
		cout<<endl;
	}*/
	REP(k,n-1){
		ll ans = 0;
		rep(i,n){
			ans += cnt[i][k];
		}
		cout<<ans/2<<endl;
	}
	/*
	REP(k, n-1){
		int ans = 0;
		for(int i = 1; i+k<=n; ++i){
			for(int j = i+k; j<=n; ++j){
				if(abs(i-x) + abs(j-y) + 1 >= k)ans++;
			}
		}
		cout<<ans<<endl;
	}*/
	return 0;
}

Measured memory_bytes: 31616
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
#include <iterator>     // std::back_inserter
const double PI = acos(-1);
using namespace std;
using ll =long long;
#define rep(i,n)for(ll i=0;i<(n);i++)
const int mod = 1000000007;
const ll inf = 1e18 + 1;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
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;
}
ll f[101010], rf[101010];
ll inv(ll x) {
	ll res = 1;
	ll k = mod - 2;
	ll y = x;
	while (k) {
		if (k & 1) res = (res * y) % mod;
		y = (y * y) % mod;
		k /= 2;
	}
	return res;
}
void init() {
	f[0] = 1;
	for (ll i = 1; i < 101010;i++) f[i] = (f[i - 1] * i) % mod;
	for(ll i = 0; i < 101010; i++) rf[i] = inv(f[i]);
}
//---------------------------------------------------------------------------------------------------
ll C(int n, int k) {
	ll a = f[n]; // = n!
	ll b = rf[n - k]; // = (n-k)!
	ll c = rf[k]; // = k!

	ll bc = (b * c) % mod;

	return (a * bc) % mod;
}

//小文字=大文字+32
int main() {

	ll S;
	cin >> S;
	if (S <= 2) {
		cout << 0;
		return 0;
	}
	ll m=0;//分ける個数
	ll res = 1;
	m++;
	ll c=1;//かける数
	init();
	while(S - 3*(m+1)>=0) {
	 
		c=C(m + S - 3*(m + 1), m);
		
		res+=c;
		res%=mod;
		m++;
	}
	cout << res;
	
}

Measured memory_bytes: 5200
n = int(input())
lists =[]
for i in range(n):
  lists.append(i+1)
list_2=[int(x)for x in input().split()]

count =0
for s in range(n):
  if lists[s]!=list_2[s]:
    count+=1
if count>2:
  print('NO')
else:
  print('YES')

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

int main(){
	int n,m;
	cin >> n >> m;
	
	if(n == m){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
'use strict';
function Main(inputs) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const input = inputs.split("\n");
  const [n, k] = input[0].split(' ').map(Number);
  const a = input[1].split(' ').map(Number);

  let left = 1;
  let right = 1e9;
  while(left < right){
    const middle = Math.floor((left + right) / 2);
    const cut = a.reduce((acc, t) => t <= middle ? acc : acc + Math.ceil(t / middle) - 1, 0);
    if (k < cut){
      left = middle + 1;
    } else {
      right = middle;
    }
  }
  console.log(left);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 49880
#include <cstdio>

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

    int a[100] = {};
    int b[100] = {};
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    for (int i = 0; i < n; ++i) scanf("%d", &b[i]);

    int max = 0;
    for (int i = 0; i < n; ++i) {
        int sum = 0;
        for (int j = 0; j <= i; ++j) {
            sum += a[j];
        }
        for (int k = i; k < n; ++k) {
            sum += b[k];
        }
        if (sum > max) max = sum;
    }
    printf("%d\n", max);
}

Measured memory_bytes: 128
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var Number = new int[N];
            var ave = 0;

            for(var i=0;i<N;i++){
                Number[i] = cin.ReadInt;
                ave += Number[i];
            }
            Array.Sort(Number);

            var countUp = N/2 - 1;
            var countDown = N/2;
            var ans = 0;
            if(Number[countDown] != Number[countUp]) ans = Number[countDown] - Number[countUp];
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}

Measured memory_bytes: 20832
#include <iostream>

using namespace std;

int main()
{
	int h,w;

	while(1)
	{

		cin >> h >> w;

		if(h == 0 && w == 0)
		{
			break;
		}

		for(int i=1; i<=h; i++){
			for(int j=1; j<=w; j++)
			{
				if(j == w || j == 1 || i == h || i == 1)
				{
					cout << "#";
				}
				else
					cout << ".";
			}

			cout << endl;
		}

		cout << endl;

	}
		return 0;
}

Measured memory_bytes: 1152
package main

import (
	"fmt"
)

func main() {
	var a,b,k int
	fmt.Scan(&a,&b,&k)

	var ans []int
	for i := 1; i <= 100; i++ {
		if a % i == 0 && b % i == 0 {
			ans = append(ans,i)
		}
	}
	fmt.Println(ans[len(ans)-k])
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;
double dp[400][400][400];

int ara[4];

int main()
{
    fastRead;
    int n;
    cin>>n;
    for(int i = 0 ; i < n ; i++ ) {
        int tmp;
        cin>>tmp;
        ara[tmp]++;
    }
    
    for(int i = 0 ;i <= ara[3] ; i++ ) {
        for(int j = 0 ; j <= ara[2]+ ara[3] - i ; j++ ) {
            for(int k =0 ; k <= ara[3] + ara[2] + ara[1] - i - j ; k++ ) {
                if(i == 0 && j ==0 && k==0) continue;
                
                if(i) dp[i][j][k] += 1.0*i*dp[i-1][j+1][k];
                if(j) dp[i][j][k] += 1.0*j*dp[i][j-1][k+1];
                if(k) dp[i][j][k] += 1.0*k*dp[i][j][k-1];
                
                dp[i][j][k] += n;
                dp[i][j][k] /= 1.0*(i+j+k);
            }
        }
    }
    cout<<setprecision(12)<<fixed<<dp[ara[3]][ara[2]][ara[1]]<<'\n';
    return 0;
    
}

Measured memory_bytes: 145876
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pi 3.14159265358979323846
#define mod 1000000007
int main()
{ 
    IOS;
    ll p;
    p=1;
    while(p--)
    {
        ll a,b,c,d,e,n,maxx=0,sum1=0;
        cin>>a;
        ll A[a],sum[a]={0};
        for(b=0;b<a;b++)
        {
            cin>>A[b];
            sum1=sum1+A[b];
            if(b!=0)
            sum[b]=sum[b-1]+A[b];
            else
            sum[b]=A[b];
        }
        for(b=0;b<a;b++)
        {
            maxx=maxx+((A[b]%mod)*((sum1-sum[b])%mod))%mod;
            maxx%=mod;
        }
        cout<<maxx<<endl;
    }
}

Measured memory_bytes: 6768
#include<cstdio>
#include<vector>
using namespace std;
int main(){
    for(;;){
        int w,h;
        scanf("%d%d",&w,&h);
        if(w==0&&h==0)break;
        vector<vector<vector<vector<int> > > > path(w,vector<vector<vector<int> > >(h,vector<vector<int> >(2,vector<int>(2))));
        for(int i=1;i<w;i++){
            path[i][0][0][0]=1;
            path[i][0][0][1]=1;
            path[i][0][1][0]=0;
            path[i][0][1][1]=0;
        }
        for(int j=1;j<h;j++){
            path[0][j][0][0]=0;
            path[0][j][0][1]=0;
            path[0][j][1][0]=1;
            path[0][j][1][1]=1;
        }
        for(int i=1;i<w;i++){
            for(int j=1;j<h;j++){
                path[i][j][0][0]=path[i-1][j][0][0]+path[i-1][j][0][1];
                path[i][j][0][1]=path[i-1][j][1][0];
                path[i][j][1][0]=path[i][j-1][1][0]+path[i][j-1][1][1];
                path[i][j][1][1]=path[i][j-1][0][0];
                path[i][j][0][0]%=100000;
                path[i][j][0][1]%=100000;
                path[i][j][1][0]%=100000;
                path[i][j][1][1]%=100000;
            }
        }
        printf("%d\n",(path[w-1][h-1][0][0]+path[w-1][h-1][0][1]+path[w-1][h-1][1][0]+path[w-1][h-1][1][1])%100000);
    }
}

Measured memory_bytes: 0
N = int(input())

a_list = list(map(int, input().split()))

b_list = [0]*(N//2)+a_list[N//2:]
for i, a in enumerate(range(N//2)):
    j = N//2 - i

    j_list = []
    k = j
    while(1):
        j = j + k
        if j > N:
            break
        else:
            j_list.append(j)
    #print(j_list)                                                                       
    s = 0
    for j in j_list:
        s += b_list[j-1]

    if s % 2 == a_list[k-1]:
        b_list[k-1] = 0
    else:
        b_list[k-1] = 1

print(len([str(i+1) for i, b in enumerate(b_list) if b == 1]))
print(' '.join([str(i+1) for i, b in enumerate(b_list) if b == 1]))

Measured memory_bytes: 22572
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

string strmax( string a, string b ){
	if( a.l_ength() == b.l_ength() ) return ( a > b ) ? a : b;
	else return ( a.l_ength() > b.l_ength() ) ? a : b;
}

int main(){
	string a, b; cin >> a >> b;
	if( a.compare(b) == 0 ) cout << "EQUAL" << endl;
	else if( strmax(a, b) == a ) cout << "GREATER" << endl;
	else cout << "LESS" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  
    long int n;
    cin>>n;
    long int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    long long int dp[n];
    dp[n-1]=0;
    dp[n-2]=abs(h[n-2]-h[n-1]);
    for(int i=n-3;i>=0;i--)
    {
        dp[i]=min(dp[i+1]+abs(h[i]-h[i+1]),dp[i+2]+abs(h[i]-h[i+2]));
    }
    cout<<dp[0];
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "



int main(){
    string s;cin>>s;
    if(s.size()==1){co(s);return 0;}
    int ans1 = 0;
    ans1 += (atoi(s.substr(0,1).c_str())-1);
    rep(i,s.size()-1){
        ans1 += 9;
    }
    int ans2 =0;
    rep(i,s.size()){
        ans2+=atoi(s.substr(i,1).c_str());
    }
    co(max(ans1,ans2));
}


Measured memory_bytes: 256
#include<iostream>

int main()
{
  int W, H, x, y, r;
  std::cin >> W >> H >> x >> y >> r;
  if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H)
    std::cout << "Yes";
  else std::cout << "No";
  std::cout << std::endl;

  return 0;
}



Measured memory_bytes: 3112
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#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 all(s) s.begin(), s.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;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int h, w;
vvi s;

int main()
{
    cin >> h >> w;
    vector<string> vs; vs.resize(h);
    rep(i, h) cin >> vs[i];
    vi mv{-1, 1};
    rep(y0, h) rep(x0, w){
        if(vs[y0][x0] == '#'){
            bool isMiss = true;
            for(int dx: mv){
                int x = x0 + dx, y = y0;
                if(x < 0 || y < 0 || x >= w || y >= h) continue;
                if(vs[y][x] == '#'){
                    isMiss = false;
                }
            }
            for(int dy: mv){
                int x = x0, y = y0 + dy;
                if(x < 0 || y < 0 || x >= w || y >= h) continue;
                if(vs[y][x] == '#'){
                    isMiss = false;
                }
            }
            if(isMiss){
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");

    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<iterator>
using namespace std;
int main()
{
	int n,m,k,p;
	vector<int>known[100];
	vector<int>vk,va,vb;
	while(scanf("%d",&n),n)
	{
		int i,j;
		for(i=0;i<n;++i)
			known[i].clear();
		for(i=0;i<n;++i)
		{
			scanf("%d",&m);
			for(j=0;j<m;++j)
			{
				scanf("%d",&p);
				known[p-1].push_back(i);
			}
		}
		scanf("%d",&k);
		vk.clear();
		for(i=0;i<k;++i)
		{
			scanf("%d",&p);
			vk.push_back(p-1);
		}
		sort(vk.begin(),vk.end());
		va.clear();
		for(i=0;i<n;++i)
		{
			va.push_back(i);
			sort(known[i].begin(),known[i].end());
		}
		vector<int>*vp, *vq;
		vp=&va; vq=&vb;
		for(i=0;i<vk.size();++i)
		{
			vq->clear();
			set_intersection(vp->begin(),vp->end(),known[vk[i]].begin(),known[vk[i]].end(),back_inserter(*vq));
			swap(vp,vq);
		}
		printf("%d\n", vp->size()==1?vp->at(0)+1:-1);
	}
}

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

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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  cout << (n % 2 == 0? n / 2: (int)(n / 2) + 1) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(int i = a; i < b; i++)
#define mod 10000code200007
#define printDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<int,pair<int,int>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

/*E(x,y,z) = (1 + p1*E(x-1,y,z) + p2*E(x+1,y-1,z) + p3*E(x,y+1,z-1))/(1-p0)
(1 - N-(x+y+z))/N = N - N + x + y + z
E(x,y,z) = (n + x*E(x-1,y,z) + y*E(x+1,y-1,z) + z*E(x,y+1,z-1))/(x + y + z);*/

double dp[301][301][301];
double solve(int x, int y, int z, int& n)
{
    if (x == 0 && y == 0 && z == 0)
        return 0;
    if (x < 0 || y < 0 || z < 0)
        return 0;

    if(dp[x][y][z] > -0.5)
        return dp[x][y][z];

    int remaining  = n - (x + y + z);
    double exp_val = n + x * solve(x-1, y, z, n) + y*solve(x+1, y-1, z,n) + z*solve(x,y+1,z-1,n);

    return dp[x][y][z] = exp_val / (x + y + z);
}

int main(){
    ll i,j,t,n,m,x,p,k;
    fast_io;
    //cin>>t;
    t=1;
    while(t--)
    {
        memset(dp, -1, sizeof dp);
        int n, x = 0, y = 0, z = 0;
        cin >> n;
        for(int i =0 ; i < n; i++)
        {
            int sushi;
            cin >> sushi;
            if(sushi == 1)
                x++;
            else if(sushi == 2)
                y++;
            else z++;
        }
        printDouble(solve(x,y,z,n));
    }
    return 0;
}


Measured memory_bytes: 213376
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,t,e,ans=0,x=0,c[1000];
	cin>>n>>t;
	int a[n-1],b[n-1];
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(int g=0;g<n;g++)
	{
		if(b[g]<=t)
		{
			x++;
			c[x-1]=a[g];
		}
	}
	if(x==0)
	{
		cout<<"TLE";
	}
	else
	{
		ans=c[0];
	    for(int y=1;y<x;y++)
	    {
	    	if(c[y]<ans)
	    	{
	    		ans=c[y];
			}
	    }
	cout<<ans;
	} 
    return 0;
} 

Measured memory_bytes: 256
from collections import Counter
s=input()[::-1]
l=[0]*(len(s)+1)
kake=1
for i in range(1,len(s)+1):
    l[i]=l[i-1]+kake*int(s[i-1])
    l[i]%=2019
    kake*=10
    kake%=2019
S=Counter(l);ans=0
for i in S.values():
  ans+=(i*(i-1))//2
print(ans)

Measured memory_bytes: 16676
#include <iostream>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int a,b,c,d,ans;
 	cin >> a>>b>>c>>d;
 	if(a<=b){
 		ans=a;
 	}else{
 		ans=b;
 	}
 	if(c<=d){
 		ans=ans+c;
 	}else{
 		ans=ans+d;
 	}
 	cout << ans << endl;
 }

Measured memory_bytes: 256
use proconio::input;

macro_rules! chmax {
    ($max_v: expr, $v: expr) => {
        if $v > $max_v {
            $max_v = $v;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        n: usize,
        w: usize,
        wv: [(usize, usize); n],
    };
    let mut dp = vec![vec![vec![0; 400 + 1]; n + 1]; n + 1];
    let w_1 = wv[0].0;
    for (i, (w_i, v_i)) in wv.iter().enumerate() {
        for j in 0..=n {
            for k in 0..=400 {
                chmax!(dp[i + 1][j][k], dp[i][j][k]);
                if j + 1 <= n && k + w_i - w_1 <= 400 && w_1 * j + w_i + k <= w {
                    chmax!(dp[i + 1][j + 1][k + w_i - w_1], dp[i][j][k] + v_i);
                }
            }
        }
    }
    let mut ans = 0;
    for j in 0..=n {
        chmax!(ans, *dp[n][j].iter().max().unwrap());
    }
    println!("{}", ans);
}


Measured memory_bytes: 34264
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=1000000007;

int main(){
	string s;
	cin>>s;
	if(s=="Sunny")cout<<"Cloudy"<<"\n";
	else if(s=="Cloudy")cout<<"Rainy"<<"\n";
	else cout<<"Sunny"<<"\n";
	
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,L=map(int,input().split())
    a=tuple(map(int,input().split()))
    for i in range(N-1):
        if a[i]+a[i+1]>=L:
            print('Possible')
            for j in range(i):
                print(j+1)
            for j in range(N-2,i,-1):
                print(j+1)
            print(i+1)
            break
    else:
        print('Impossible')

if __name__ == '__main__':
    main()


Measured memory_bytes: 63984
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
c = [None]*3
for i in range(3):
    c[i] = [None]*3
for i in range(3):
    c[i] = readints()
# print(c)
# a1=0,a2=1,a3=0,b1=1,b2=0,b3=1
#a = [0, 1, 0]
#b = [1, 0, 1]


def func(a, b):
    for i in range(3):
        for j in range(3):
            if a[i]+b[j] == c[i][j]:
                continue
            return False
            break
    return True


a = [None]*3
b = [None]*3

for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(3):
                a[0] = i
                a[1] = j
                a[2] = k
                b[0] = c[l][0]-a[l]
                b[1] = c[l][1]-a[l]
                b[2] = c[l][2]-a[l]
                if func(a, b):
                    print('Yes')
                    exit()
print('No')


Measured memory_bytes: 44312
#include <stdio.h>
int main()
{
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  char s[n + 1];
  scanf("%s",&s);
  int i = 0;
  int countera = 0;
  int counterb = 0;
  while (s[i])
  {
    if ((s[i] == 'a' && countera < a+b))
    {
      printf("Yes\n");
      countera++;
    }
    else if (s[i] == 'b' && countera < a+b && counterb < b)
    {
      printf("Yes\n");
      counterb++;
      countera++;
    }
    else
    {
      printf("No\n");
    }
    i++;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct disjoint_set {
  public:
    int n;
    vector<int> prt;
    disjoint_set (int sz) {
      n = sz;
      prt.resize(sz, -1);
    }
    bool isRoot (int x) {
      return prt[x] < 0;
    }
    int find (int x) {
      if (isRoot(x)) return x;
      else return prt[x] = find(prt[x]);
    }
    int getSize (int x) {
      return prt[find(x)];
    }
    bool is_equiv (int x, int y) {
      return find(x) == find(y);
    }
    bool unite (int x, int y) {
      x = find(x);
      y = find(y);
      if (x == y) return false;
      if (getSize(x) < getSize(y)) swap(x, y);
      prt[x] += prt[y];
      prt[y] = x;
      return true;
    }
};
int main() {
  int n, m;
  cin >> n >> m;
  disjoint_set djs(n);
  vector<pair<int, int>> dat(m);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    dat[i] = {--a, --b};
  }
  vector<long long> ret;
  long long tmp = (long long)n * (n - 1) / 2;
  ret.push_back(tmp);
  int a, b;
  for (int i = m - 1; i >= 1; i--) {
    tie(a, b) = dat[i];
    if (!djs.is_equiv(a, b)) {
      tmp -= (long long)djs.getSize(a) * djs.getSize(b);
      djs.unite(a, b);
    }
    ret.push_back(tmp);
  }
  reverse(ret.begin(), ret.end());
  for (int i = 0; i < m; i++) {
    cout << ret[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    vector<string>s(3);
    rep(i, 3)	cin >> s[i];
    int sptr = 0;
    int cptr[3] = {0};
    while(1){
	if(cptr[sptr] < s[sptr].size()){
	    int tmp = cptr[sptr]++;
	    sptr = s[sptr][tmp] - 'a';
	}else{
	    cout << (char)('A' + sptr)<< endl;
	    break;
	}
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            
            if(H == 0 && W == 0){
                break;
            }
            
            for(int i = 0; i < H; i++){
                for(int j = 0; j < W; j++){
                    if((i+j)%2 == 0){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}



Measured memory_bytes: 36328
//#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
#include<bits/stdc++.h>

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FIXED cout << fixed << setprecision(12)
#define RANDOM srand(94385)
#define all(a) a.begin(), a.end()
#define shuffle(a) \
    for (int i = 0; i < sz(a); ++i) \
        swap(a[i], a[rand() % sz(a)]);
#define enter puts("")
#define space putchar(' ')
#define Mem(a, x) memset(a, x, sizeof(a))
using namespace std;

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

void debug_out() { cerr << '\n'; }

template<typename T, typename ...R>
void debug_out(const T &f, const R &...r) {
    cerr << f << " ";
    debug_out(r...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__);

inline ll read() {
    ll x = 0;
    int f = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
    return x = f ? -x : x;
}

inline void write(ll x) {
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[23];
    int l = 0;
    while (x != 0)s[l++] = x % 10 + 48, x /= 10;
    while (l)putchar(s[--l]);
}

int lowbit(int x) { return x & (-x); }

template<class T>
T big(const T &a1, const T &a2) { return a1 > a2 ? a1 : a2; }

template<typename T, typename ...R>
T big(const T &f, const R &...r) { return big(f, big(r...)); }

template<class T>
T sml(const T &a1, const T &a2) { return a1 < a2 ? a1 : a2; }

template<typename T, typename ...R>
T sml(const T &f, const R &...r) { return sml(f, sml(r...)); }

template<class T, class U>
inline void checkMin(T &x, U y) { if (y < x) x = y; }

template<class T, class U>
inline void checkMax(T &x, U y) { if (y > x) x = y; }

template<class T, class U>
inline bool ifMax(T &x, U y) {
    if (y > x) return x = y, true;
    return false;
}

template<class T, class U>
inline bool ifMin(T &x, U y) {
    if (y < x) return x = y, true;
    return false;
}

const int M = 212345;// 2e5+5
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;// 1e9+7

// HAVE FREE OPEN IN MAIN FUNCTION

void init() {
    int k = read(), x = read();
    for (int i = big(x - k + 1, -1000000); i <= (sml(x + k - 1, 1000000)); i++) {
        write(i);
        space;
    }
    enter;
}

void solve() {

}

int main() {
    init();

    solve();

    return 0;
}

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

void fin(int a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  int N;cin>>N;
  int A=1<<N;
  vector<int> a(A);
  for(int i=0;i<A;i++)cin>>a[i];
  /*
  鼻がより多くふさがっているのに息を吹き替えしていたらおかしい
  鼻の塞がる極小集合の数だけ肺があるはず
  */
  int ans=0;
  vector<int> v(N),already(A);
  for(int i=1;i<N;i++){
    for(int j=0;j<N;j++)v[N-1-j]=(j<i);
    do{
      int now=0;
      for(int j=0;j<N;j++)now+=v[j]<<j;
      if(!already[now]&&a[now]){
        ans++;
        already[now]++;
      }
      if(already[now]){
        if(!a[now])fin(-1);
        for(int i=0;i<N;i++)already[now|(1<<i)]++;
      }
    }while(next_permutation(v.begin(),v.end()));
  }
  fin(ans);
}



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

int main(){
  string s;cin>>s;
  if(s.size()%2){
    reverse(s.begin(),s.end());
    cout << s<<endl;
  }else{
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<iostream>
#define ll long long
using namespace std;
const ll mod = 1e9+7;
ll num[70][2];
int n;
ll ans,x;
void work(ll x){
	for(int i=0;i<60;i++) 
		if(x&(1ll<<i))
			num[i][1]++;
		else 
			num[i][0]++;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&x);
		work(x);
	}
	for(int i=0;i<60;i++){
		ll k=1ll<<i;
		k%=mod;
		ans=(ans+k*num[i][1]%mod*num[i][0])%mod;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
s=list(input())
t=list(input())
s.sort()
t.sort()
t=t[::-1]
flg=0
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        print("Yes")
        exit()
    if s[i]==t[i]:flg+=1
if flg==len(s) and len(s)!=len(t):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    string s;
    cin >> s;
    int n = s.length();

    for (int i = n-1; i >= 2; --i) {
        if (i & 1) continue;
        if (s.substr(0, i/2) == s.substr(i/2, i/2)) {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

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

typedef long long ll;
const ll mod=1e9+7;
const ll N=1e5+1;
const ll INF=1e10;
const double PI=acos(-1.0);

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	ll n,m,x;
	cin>>n>>m>>x;
	vector<ll> c(n);
	vector<vector<ll>> a(n,vector<ll> (m));
	for(int i=0;i<n;i++){
		cin>>c[i];
		for(int j=0;j<m;j++) cin>>a[i][j];
	}
	ll k=1<<n,ans=LLONG_MAX;
	for(ll i=1;i<k;i++){
		bitset<12> b(i);
		ll sum=0;
		vector<ll> skill(m);
		for(int l=0;l<n;l++){
			if(!b[l]) continue;
			sum+=c[l];
			for(int j=0;j<m;j++) skill[j]+=a[l][j];
		}
		bool ok=true;
		for(int j=0;j<m;j++){
			if(skill[j]<x){
				ok=false;
				break;
			}
		}
		if(ok) ans=min(ans,sum);
	}
	cout<<(ans^LLONG_MAX?ans:-1);
}


Measured memory_bytes: 3560
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[derive(Eq, PartialEq, Clone, Debug)]
struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    let n = get!(usize);
    let mut aa = util::gets::<u64>();

    aa.sort_by_key(|&a| Rev(a));

    let ans = (0..n)
        .map(|i| unsafe { aa.get_unchecked(i * 2 + 1) })
        .sum::<u64>();

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


Measured memory_bytes: 13428
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define breps(i,x,n) for(int i=x;i>=n;i--)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

ll flag(ll x) {
	ll F;
	if (x % 2 == 0) {
		if (x / 2 % 2 == 0) F = 0 ^ x;
		else F = 1 ^ x;
	}
	else {
		ll xx = x - 1;
		if (xx / 2 % 2 == 0) F = 0 ^ x ^ xx;
		else F = 1 ^ x ^ xx;
	}
	return F;
}

int main(void) {

	ll A, B; cin >> A >> B;

	ll Fa = flag(A - 1);
	ll Fb = flag(B);

	cout << (Fa ^ Fb) << endl;
	return 0;
}


Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

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

	int cnt = 0;
	rep(i, n) {
		char c1 = a[i], c2 = b[i], c3 = c[i];
		if (c1 == c2 && c2 == c3);
		else if ((c1 == c2) || (c2 == c3) || (c3 == c1))cnt++;
		else cnt += 2;
	}
	cout << cnt << endl;
}

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

typedef long long ll;

ll mod=1e9+7;

bool is_prime(ll n){
  if(n==1) return false;
  else{
    bool ans=true;
    for(int i=2;i*i<=n;i++){
      if(n%i==0){
        ans=false;
      }
    }
    return ans;
  }
}

int main(){
  ll n;
  cin >> n;
  ll pr[1000];
  ll k=0;
  for(ll i=1;i<=1000;i++){
    if(is_prime(i)){
      pr[k]=i;
      k++;
    }
  }
  ll cnt[k];
  for(ll i=0;i<k;i++) cnt[i]=0;
  for(ll i=2;i<=n;i++){
    ll x=i;
    for(ll j=0;j<k;j++){
      while(x%pr[j]==0){
        cnt[j]++;
        x/=pr[j];
      }
    }
  }
  ll ans=1;
  for(ll i=0;i<k;i++){
    ans=(ans*(cnt[i]+1))%mod;
  }
  cout << ans << endl;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  REP(i, M) cin >> X[i];
  sort(ALL(X));
  vector<ll> D(M - 1);
  REP(i, M - 1) D[i] = X[i + 1] - X[i];
  sort(ALL(D));
  ll ans = 0;
  REP(i, M - N) ans += D[i];
  cout << ans << endl;
  return 0;
}

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

int main(){
  int h,w;
  char c[102][102];
  cin>>h>>w;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>c[i][j];
    }
  }
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cout<<c[i][j];
    }
    cout<<endl;
    for(int j=1;j<=w;j++){
      cout<<c[i][j];
    }
    cout<<endl;
  }
}
      


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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,x;
    cin >> n >> x;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll count=0;
    if(a[0]>x){
        count+=a[0]-x;
        a[0]=x;
    }
    for(int i = 1; i < n; i++) {
        if(a[i]+a[i-1] > x){
            int tmp=a[i]+a[i-1]-x;
            count+=tmp;
            a[i]-=tmp;
        }
    }
    cout << count << "\n";
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n,m,a,b;
	bool one[200000] = {false}, two[200000] = {false};
	string s="IMPOSSIBLE";
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		if (a == 1) one[b-1]=true;
		if (b == n) two[a-1]=true;
	}
	for (int i = 0; i < m; i++) {
		if (one[i]==true && two[i]==true) s = "POSSIBLE";
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline
from collections import deque
N = int(input())
table = [[] for i in range(N)]
for i in range(N-1):
  u, v, w = map(int, input().split())
  u, v = u-1, v-1
  table[u].append((v, w))
  table[v].append((u, w))
H = deque()
H.append(0)
visit = [-1]*N
visit[0] = 0
while H:
  x = H.popleft()
  for y, w in table[x]:
    if visit[y] == -1:
      visit[y] = (visit[x]+w)%2
      H.append(y)
for i in range(N):
  print(visit[i])      
  

Measured memory_bytes: 39060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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

int main()
{
  int n;
  cin >> n;
  ll p[n];
  rep(i, n)
  {
    cin >> p[i];
  }

  int ans = 0;
  ll mini = INF;
  rep(i, n)
  {
    mini = min(p[i], mini);
    if (mini >= p[i])
      ans++;
  }

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

Measured memory_bytes: 1792
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
use proconio::{fastout, input, marker::*};
use std::cmp::*;
use std::collections::*;
//use std::num;
//use petgraph::unionfind::UnionFind;
//use permutohedron::LexicalPermutation as _;

#[fastout()]
fn main() {
    input! {
        N:usize, K:usize,
        A:[i64;N]
    }
    let mut sum = vec![0i64; N + 1];
    let mut val = vec![0i64; N + 1];
    for i in 0..N {
        sum[i + 1] = sum[i] + A[i];
    }
    for i in K..=N {
        val[i] = sum[i] - sum[i - K];
    }
    for i in K + 1..=N {
        if val[i] > val[i - 1] {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


Measured memory_bytes: 8876
import sys

if sys.platform =='ios':
	sys.stdin=open('input_file.txt')
	
#+++++

#a,b = map(int, input().split())
n = int(input().strip())
s,t=input().split(' ')
a = ""
for i in range(n):
	a +=s[i]
	a+=t[i]
print(a)


Measured memory_bytes: 2940
import java.util.Scanner;

class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		if(
		   ((x+r)<=W)
		&& ((x-r)>=0)
		&& ((y+r)<=H) 
		&& ((y-r)>=0)
		){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26312