akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define PER(i,a,b) for(int i=(a);i>=(b);i--)
#define RVC(i,S) for(int i=0;i<(S).size();i++)
#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
     
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
/*============ Header Template ============*/

#define lowbit(x) (x)&(-x)

const int maxn=(int)(1e5)+5;
const int mo=(int)(1e9)+7;
LL s[maxn];
int C[2][maxn];
int top[2],ps[2][maxn],val[2][maxn];
int n;

inline void addv(int& x,int v) {
    x+=v;if(x>=mo) x-=mo;
}

inline void add(int p,int x,int v) {
    v%=mo;
    ++top[p];ps[p][top[p]]=x;val[p][top[p]]=v;
    for(;x<=n+1;x+=lowbit(x)) addv(C[p][x],v);
}

inline int sum(int p,int x) {
    int res=0;
    for(;x;x-=lowbit(x)) addv(res,C[p][x]);
    return res;
}

inline void clearAll(int p) {
    for(;top[p];top[p]-=2) {
        add(p,ps[p][top[p]],mo-val[p][top[p]]);
    }
}

int main() {
    LL a,b;
    read(n);read(a);read(b);
    REP(i,1,n) read(s[i]);
    add(0,n+1,1);add(1,n+1,1);
    int pa=1,pb=1;
    REP(i,2,n) {
        while(pa+1<i && s[i]-s[pa+1]>=a) pa++;
        while(pb+1<i && s[i]-s[pb+1]>=b) pb++;
        int ta=0,tb=0;
        if(s[i]-s[pa]>=a) ta=sum(1,pa);addv(ta,sum(1,n+1)-sum(1,n)+mo);
        if(s[i]-s[pb]>=b) tb=sum(0,pb);addv(tb,sum(0,n+1)-sum(0,n)+mo);
        if(s[i]-s[i-1]<a) clearAll(0);if(s[i]-s[i-1]<b) clearAll(1);
        add(0,i-1,ta);add(1,i-1,tb);
    }
    printf("%d\n",(sum(1,n+1)+sum(0,n+1))%mo);
    return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        final int m = fs.nextInt();
        final int[] arr = fs.nextIntArray(m);
        Utils.shuffleSort(arr);
        final PriorityQueue<Integer> distances = new PriorityQueue<>();
        for (int i = 0; i < m - 1; i++) {
            distances.add(arr[i + 1] - arr[i]);
        }
        long res = 0;
        for (int i = 0; i < m - n; i++) {
            res += distances.remove();
        }
        System.out.println(res);
    }

    static final class Utils {
        public static void shuffleSort(int[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffle(int[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void shuffle(long[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void swap(int[] arr, int i, int j) {
            final int t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        public static void swap(long[] arr, int i, int j) {
            final long t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


Measured memory_bytes: 46108
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
const ll M=1e5+6;
ll dp[M],a[M];
ll rec(ll index)
{
	if(index<=2)
		return dp[index];
	if(dp[index]!=-1)
		return dp[index];

	else
	{
		dp[index]=min(abs(a[index]-a[index-1])+rec(index-1),abs(a[index]-a[index-2])+rec(index-2));
		return dp[index];
	}
}
int main()
{
	ll n,i,j,k,x,y,t,m;
	cin >> n;
	for(i=1;i<=n;i++)
		cin >> a[i],dp[i]=-1;
	dp[1]=0;
	dp[2]=abs(a[2]-a[1]);
	cout << rec(n) << endl;
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll a,b;
    cin >> a >> b;
    if(a+b == 15){
        cout << '+' << endl;
    } else if(a*b == 15){
        cout << '*' << endl;
    } else {
        cout << 'x' << endl;
    }
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
const long mod=1e9+7;
int n,mt[21][21],dp[21][(1<<21)];
long dfs(int st,int msk)
{
  if(st==n)return 1;
  if(dp[st][msk]!=-1)return dp[st][msk];
  long now=0;
  for(int i=0;i<n;i++)
  {
    if(msk&(1<<i)||!mt[st][i])continue;
    now=(now+dfs(st+1,msk|(1<<i)))%mod;
  }
  return dp[st][msk]=now;
}
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  cin>>n;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>mt[i][j];
  memset(dp,-1,sizeof(dp));
  cout<<dfs(0,0)<<endl;
  return 0;
}

Measured memory_bytes: 172288
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long
#define ld                  long double
#define pb                  push_back
#define mkp                 make_pair
#define f(i,l,h)            for(ll i=l;i<h;i++)
#define fr(i,h,l)           for(ll i=h;i>=l;i--)
#define mem(a,val)          memset(a,val,sizeof(a))
#define all(v)              (v).begin(),(v).end()
#define ff                  first
#define ss                  second
#define spc(x)              cout<<fixed<<setprecision((x));
#define deb(x)              cout<<#x<<" "<<x<<endl;
#define deba(x)             cout<<#x<<": "; for(auto u:x) cout<<u<<" ";  cout<<endl;
#define check               cout<<"hello"<<endl;
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
const ld pi=3.141592653589793;
const ll mod=998244353;
const ll INF=(ll)(1e9+7);
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

ll power(ll a,ll b){
    ll res=1;
	while(b){
	    if(b&1) res=(res*a);
	    a=(a*a);
	    b>>=1;
	}
	return res;
}

int main()
{
    //cout << "Hello world!" << endl;
    ll n,k;
    cin>>n;
    ll a[n+1],b[n+1],c[n+1];
    f(i,1,n+1){
        cin>>a[i]>>b[i]>>c[i];
    }

    ll dp[n+1][3];
    dp[1][0]=a[1];
    dp[1][1]=b[1];
    dp[1][2]=c[1];
    f(i,2,n+1){
        dp[i][0]=a[i]+ max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=b[i]+ max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=c[i]+ max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;


    return 0;
}


Measured memory_bytes: 8264
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100000

enum Type{
	A,
	B,
	Both,
};

struct ADD{
	bool operator<(const struct ADD &arg) const{
		return value < arg.value;
	}
	int value,index;
};

struct SUB{
	bool operator<(const struct SUB &arg) const{
		return value < arg.value;
	}
	int value,index;
};

int N;
ADD info_add[NUM];
SUB info_sub[NUM];
Type type[2][NUM];


bool is_OK(int max_dist){

	for(int i = 0; i < N; i++){
		type[0][i] = Both;
		type[1][i] = Both;
	}

	int num_A;

	type[0][info_add[0].index] = A;
	num_A = 1;

	for(int i = 1; i < N; i++){
		if(info_add[i].value-info_add[0].value > max_dist && info_add[N-1].value - info_add[i].value > max_dist)return false;

		if(info_add[i].value-info_add[0].value > max_dist){
			type[0][info_add[i].index] = B;
		}
		if(info_add[N-1].value-info_add[i].value > max_dist){
			type[0][info_add[i].index] = A;
			num_A++;
		}
	}
	if(num_A == N)return false;

	type[1][info_sub[0].index] = A;
	num_A = 1;

	for(int i = 1; i < N; i++){
		if(info_sub[i].value-info_sub[0].value > max_dist && info_sub[N-1].value - info_sub[i].value > max_dist)return false;

		if(info_sub[i].value-info_sub[0].value > max_dist){
			type[1][info_sub[i].index] = B;
		}
		if(info_sub[N-1].value-info_sub[i].value > max_dist){
			type[1][info_sub[i].index] = A;
			num_A++;
		}
	}
	if(num_A == N)return false;


	int num_both = 0;
	int num_diff = 0;

	for(int i = 0; i < N; i++){
		if(type[0][i] == Both || type[1][i] == Both){

			num_both++;

		}else if(type[0][i] != type[1][i]){
			num_diff++;
		}
	}

	if(num_diff == 0)return true;
	if(num_both+num_diff == N)return true;

	return false;


}

int main(){

	scanf("%d",&N);

	for(int i = 0; i < N; i++){
		info_add[i].index = i;
		info_sub[i].index = i;
	}

	int x,y;
	for(int i = 0; i < N; i++){
		scanf("%d %d",&x,&y);

		info_add[i].value = x+y;
		info_sub[i].value = x-y;
	}
	sort(info_add,info_add+N);
	sort(info_sub,info_sub+N);

	int left = 0,right = 400000, m = (left+right)/2;
	int ans = right;

	while(left <= right){

		if(is_OK(m)){
			ans = m;
			right = m-1;
		}else{
			left = m+1;
		}
		m = (left+right)/2;
	}

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

	return 0;
}



Measured memory_bytes: 5568
N, T = map(int, input().split())

ct = [[int(j) for j in input().split()] for i in range(N)]

ct.sort(key=lambda x: x[0])

ans = 1001

for i in range(N):
    if ct[i][1] <= T:
        ans = ct[i][0]
        break

print("TLE" if ans == 1001 else ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

double PI = acos(-1);
int main() {
    double a,b,x;
    cin >> a >> b >> x;
    double s = x/a;
    double rad;
    double deg;
    if(s>=a*b/2) {
        double h = 2*(a*b-s)/a;
        rad = atan2(h,a);
        deg = rad*180/PI;
    }
    else {
        double w = 2*s/b;
        rad = atan2(b,w);
        deg = rad*180/PI; 
    }
    printf("%.10f",deg);

}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
ll p[200005];
typedef pair<int, int> P;
int cnt(int x) {
	ll count = 0;
	while (x) {
		x = x / 10;
		count++;
	}
	return count;
}

int main() {
	ll n;
	cin >> n;
	int ans = cnt(n);
	
	for (ll a = 1; a * a <= n; a++) {
		if (n % a == 0) {
			ll b = n / a;

			int cur = max(cnt(a), cnt(b));

			if (ans > cur) {
				ans = cur;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from itertools import accumulate
N, M, K = map(int,input().split())
A_list = [0] + list(map(int,input().split()))
B_list = [0] + list(map(int,input().split()))
A_sums_list = list(accumulate(A_list))
B_sums_list = list(accumulate(B_list))
ans = 0
for i, A_sums in enumerate(A_sums_list):
    B_min = -1
    B_max = M + 1
    while B_max - B_min > 1:
        B_index = int((B_max + B_min) * 0.5)
        if A_sums + B_sums_list[B_index] <= K:
            B_min = B_index
        else:
            B_max = B_index
    B_index = int((B_max + B_min) * 0.5)
    if i + B_index > ans and A_sums + B_sums_list[B_index] <= K:
        ans = i + B_index
print(ans)

Measured memory_bytes: 135992
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int a, b;
  cin >> a >> b;
  cout << max(max(a + b, a - b), a * b) << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3620
#include <stdio.h>
int main(void){


 int W,H,x,y,r;
 
 scanf("%d%d%d%d%d" , &W , &H , &x , &y , &r);
 
  W=W-r,H=H-r;
  
 if(r <= y && y <= H && r <= x && x <= W)
     printf("Yes\n");
     
 else printf("No\n");
 
 return 0;
 }



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

int main() {
 int A,B;
 cin >> A >> B;
  
 int count = 0;
 
 for (int i = A; i <= B; i++) {
   int a1 = i % 10;
   int a10 = (i / 10) % 10;
   int a1000 = (i / 1000) % 10;
   int a10000 = i / 10000;
   
   if (a1 == a10000 && a10 == a1000) {
    count++;
   }
 }
  
  cout << count << endl;
}


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

n, m, c = map(int, input().split())

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

count = 0
for i in range(n):
    a = list(map(int, input().split()))
    addcnt = 0

    for j in range(m): 
        addcnt += b[j]*a[j]
    addcnt += c

    if addcnt >0:
        count += 1
 
print(count)

Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val xs = readLine()!!.split(" ").map { it.toInt() }
    var count = 0
    for (i in 0 until n - 2) {
        val x1 = xs[i]
        val x2 = xs[i + 1]
        val x3 = xs[i + 2]
        if ((x1 < x2 && x2 < x3) || (x3 < x2 && x2 < x1)) {
            count++
        }
    }
    println(count)
}

Measured memory_bytes: 37624
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int gnk_a(int x){
	
	int xx=(x*25)/2;
	if((x*25)%2 != 0){
		xx++;
	}
	return xx;
}
int gnk_b(int x){
	return x*10;
}
int shz_a(int x){
	return (x*8)/100;
}
int shz_b(int x){
	return x/10;
}

int main(){
	int a,b;
	cin >> a >> b;
	syc(a,1,100);
	syc(b,1,100);
	int aa[100];
	int bb[100];
	int aaa[100];
	int num_a=0,num_b=0;

	/*
	cout << "shz_a(gnk_a(a))=   " << shz_a(gnk_a(a)+10) << endl;
	cout << "shz_b(gnk_b(b))=   " << shz_b(gnk_b(b)+10) << endl;
	*/
	
	//aa[0]=-99;
	for(int i=0;i<100;i++){ 
		if(shz_a(gnk_a(a)+i)>=a+1)break;
		aa[i]=gnk_a(a)+i;
		//cout << aa[i] << endl;
		num_a++;
	}
	//cout << endl;
	//bb[0]=-99;
	for(int i=0;i<10000;i++){ 
		if(shz_b(gnk_b(b)+i)>=b+1)break;
		bb[i]=gnk_b(b)+i;
		//cout << bb[i] << endl;
		num_b++;
	}
	/*
	for(int i=0;i<num_a;i++){ 
		cout << aa[i] << endl;
	}
	cout << endl;
	for(int i=0;i<num_b;i++){ 
		cout << bb[i] << endl;
	}
	cout << num_a << endl;
	cout << num_b << endl;
	cout << "XXXX" << endl;
	*/
	if(num_a <= num_b){
		for(int i=0;i<num_a;i++){
			for(int j=0;j<num_b;j++){
				if(aa[i] == bb[j]){
					cout << aa[i] << endl;
					return 0;
				}
			}
		}
	}else if(num_a > num_b){
		for(int i=0;i<num_b;i++){
			for(int j=0;j<num_a;j++){
				if(bb[i] == aa[j]){
					cout << bb[i] << endl;
					return 0;
				}
			}
		}
	}
	
	cout << "-1" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            // 入力
            String n1 = sc.next();
            String n2 = sc.next();
            String n3 = sc.next();

            // 出力
            System.out.println(n1.substring(0,1) + n2.substring(1,2) + n3.substring(2,3));
            
            sc.close();
        }
    }
	

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, string S){
	ll res = 1;
	rep(i, S.length()-1) {
		if (S[i] != S[i+1]) res++;
	}
	cout << res << endl;
}

int main(){	
	long long N;
	string S;
	scanf("%lld",&N);
	cin >> S;
	solve(N, S);
	return 0;
}



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

using namespace std;

int main()
{
  int N, K;
  cin >> N >> K;
  vector <int> h(N,0);
  for( int i=0;i<N;i++ )
    cin >> h[i];

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

  int ans = 1000000000;
  for( int i=0;i<N-K+1;i++ )
    {
      ans = min(ans, h[i+K-1]-h[i]);
    }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void){
	int a, b;
	a = 1;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 2;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 3;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 4;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 5;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 6;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 7;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 8;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	a = 9;
	for(b=1;b<10;b++){
		printf("%dx%d=%d\n", a, b, a*b);}
	return 0;
}

Measured memory_bytes: 524
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

const double eps = 1e-12;

int fcmp(double x, double y) {
  if(x - y < eps && y - x < eps) return 0;
  return (x - y < eps ? -1 : 1);
}

struct Point {
  double x, y;
  int id;
  Point(double x = 0, double y = 0) : x(x), y(y) {}

  void Read(int il) {
    int xx, yy; id = il;
    scanf("%d%d", &xx, &yy);
    x = xx; y = yy;
  }

  bool operator < (const Point &b)const {
    return fabs(x - b.x) < eps ? y < b.y : x < b.x;
  }

  bool operator == (const Point &b)const {
    return fabs(x - b.x) < eps && fabs(y - b.y) < eps;
  }

  Point operator + (const Point &b)const {
    return Point(x + b.x, y + b.y);
  }

  Point operator - (const Point &b)const {
    return Point(x - b.x, y - b.y);
  }

  Point operator / (const double &b)const {
    return Point(x / b, y / b);
  }

  Point operator * (const double &b)const {
    return Point(x * b, y * b);
  }

  Point Rot(void) {
    return Point(-y, x);
  }

  Point Rev(void)const  {
    return Point(-x, -y);
  }
  
  double Len(void) const{
    return sqrt(x * x + y * y);
  }

  double Det(const Point &b)const {
    return x * b.y - y * b.x;
  }

  Point Unit(void)const {
    return Point(x, y) / Len();
  }
  
};

struct Line{
  Point u, v;

  Line(Point u = Point(0, 0), Point v = Point(0, 0)) : u(u), v(v) {}
  
  vector<Point> operator & (const Line &b)const {
    if(!fcmp(v.Det(b.v), 0)) return {};
    double c = (b.u - u).Det(b.v.Rev()) / v.Det(b.v.Rev());
    return {u + v * c};
  }

  double Shadow(const Point &b)const {
    double e1 = (b - u).Len(), e2 = v.Len(), e3 = (u + v - b).Len();
    if(!e1) return 0;
    double cosb = (e1 * e1 + e2 * e2 - e3 * e3) / (2 * e1 * e2);
    return cosb;
  }
  
};



Point po[110], st[110], sm;
double ans[110];
int n, top, mm;
vector<Line> l[110];

bool cmp(Point x, Point y) {
  x = x - sm; y = y - sm;
  if(fcmp(x.Det(y), 0.0) == 0) return x.Len() < y.Len();
  return fcmp(x.Det(y), 0.0) == 1;
}

double Angle(Line a, Line b) {
  double bb = a.Shadow(b.v + b.u);
  // cerr << bb << endl;
  return acos(bb);
}

int main(void) {
  scanf("%d", &n);
  for(int i = 1; i <= n; i++) {
    po[i].Read(i);
    if(i == 1) sm = po[i], mm = i;
    else if(po[i] < sm) sm = po[i], mm = i;
  }
  swap(po[mm], po[1]);
  //cerr << mm << endl;
  sort(po + 2, po + n + 1, cmp);
  //cerr << po[3].x << " " << po[3].y << endl;
  st[++top] = po[1];
  st[++top] = po[2];
  for(int i = 3; i <= n; i++) {
    while(fcmp((po[i] - st[top - 1]).Det(po[i] - st[top]), 0.0) < 1 && top >= 2) top--;
    st[++top] = po[i];
  }
  for(int i = 1; i <= top; i++) {
    int nex = i == top ? 1 : i + 1;
    // cerr << st[i].x << " " << st[i].y << " " << st[i].id << endl;
    l[i].push_back(Line(st[i], st[nex] - st[i]));
    l[nex].push_back(Line(st[nex], st[i] - st[nex]));
  }
  for(int i = 1; i <= top; i++) {
    //cerr << st[i].id << endl;
    ans[st[i].id] = acos(-1) - Angle(l[i][0], l[i][1]);
  }
  for(int i = 1; i <= n; i++)
    printf("%.10lf\n", ans[i] / (2 * acos(-1)));
  return 0;
}


Measured memory_bytes: 384
import sys
from itertools import permutations
 
def read_int_list():
    return list(map(int, input().split()))
 
 
def main():
    def floyd_warshall():
        for k in range(n):
            for i in range(n):
                for j in range(n):
                    dd = d[i][k] + d[k][j]
                    if dd < d[i][j]:
                        d[i][j] = dd
 
    n, m, r = read_int_list()
    v = read_int_list()
    v = [x - 1 for x in v]
    d = [[float('inf')] * n for i in range(n)]
    for i in range(n):
        d[i][i] = 0
    for i in range(m):
        a, b, c = read_int_list()
        a -= 1
        b -= 1
        d[a][b] = c
        d[b][a] = c
    floyd_warshall()
    res = float('inf')
    for p in permutations(v):
        s = 0
        for i in range(r - 1):
            s += d[p[i]][p[i + 1]]
        if s < res:
            res = s
    print(res)
 
 
main()

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

#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;


int main()
{
	int N;
	cin>>N;
	
	int a[N+10];
	REP(i,N){
		cin>>a[i];
	}
	
	sort(a,a+N);
	
	cout<<a[N-1]-a[0]<<endl;
}


Measured memory_bytes: 256
cnt = 0
coefficients = [1]
n = 1

_list = []
length = int(input())
for i in range(length):
    try:
        _list.append(int(input()))
    except EOFError:
        continue


for i in range(1,length):
    if i < n:
        continue
    coefficients.append(i)
    n = i*2.25 + 1

for c in coefficients[::-1]:
    for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val

print(len(coefficients))
print(*coefficients[::-1])
print(cnt)
print(*_list, sep='\n')

Measured memory_bytes: 63028
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

#define INF 1000000000
#define MAX_V 102


// UnionFind??¨
class UnionFindTree{
private:
  int parent[MAX_V];
  int rank[MAX_V];
  int find(int a);
public:
  void init(int size);
  void unite(int a, int b);
  bool isSameTree(int a, int b);
};

// UF??¨????????????
void UnionFindTree::init(int size){
  for(int i = 0; i < size; i++){
    parent[i] = i;
    rank[i] = 0;
  }
  return; 
}

// UF??¨?????????????????????
int UnionFindTree::find(int a){
  if(parent[a] == a){
    return a;
  }else{
    return parent[a] = find(parent[a]); 
  }
}

// UF??¨??§???????????£?????????
void UnionFindTree::unite(int a, int b){
  int x = find(a);
  int y = find(b);
  if(x == y){ return; }

  if(rank[x] < rank[y]){
    parent[x] = y;
  }else{
    parent[y] = x;
    if(rank[x] == rank[y]){ rank[x]++; }
  }
  return;
}

// UF??¨??§???????????????????????????????????????
bool UnionFindTree::isSameTree(int a, int b){
  return find(a) == find(b);
}

// ??????????????????
// ?????°: ??????????????????????????????????????????????????\???(first: ?????????, second: to-front), ????????°
// ?????????: ??¨????????????
int kruskal(priority_queue<pair<int, pair<int, int> > > edge, int v){
  int length = 0;

  // UF??¨?????£?¨???¨?????????
  UnionFindTree uf;
  uf.init(v);
  
  while(!edge.empty()){
    // ????£????????????????????°?????????????????????????
    int cost = edge.top().first;
    int a = edge.top().second.first;
    int b = edge.top().second.second;
    edge.pop();
    // ????????????????????????????????£????????????????£???°???
    if(uf.isSameTree(a, b)){ continue; }

    // UF??¨?????£??????????????????????????´??°
    length += (-cost);
    uf.unite(a, b);
  }
  
  return length;
}

int main(void){
  
  while(true){
    // ???????????°??¨???????????°???????????????
    int n, m;
    cin >> n;
    if(n == 0){ break; }
    cin >> m;
    
    // ???????????±??????????????????????????????????????\????????????
    priority_queue<pair<int, pair<int, int> > > edge;
    for(int i = 0; i < m; i++){
      int a, b, d;
      scanf("%d,%d,%d", &a, &b, &d);
      edge.push(make_pair(-d, make_pair(a, b)));
    }
  
    // ????°???¨?????¨????????????????±???????
    int length = kruskal(edge, n);

    // ???????????????
    cout << length / 100 - n + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 1376
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N,K;
 
  cin>>N>>K;
  int a[N];
  int member=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
        if(a[i]>=K){
           member++;
        }
   }
  cout<<member<<endl;
  return 0;
}


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

int main() {
  
  string s;
  cin >> s;
  
  bool ans = true;
  
  rep(i, s.size()) {
    if (s.at(i) == 'L') ans = false;
    i++;
    }
  
  rep(i, s.size()-1) {
    if (s.at(i+1) == 'R') ans = false;
    i++;
  }
  
  cout << (ans ? "Yes" : "No") << endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        double[][] dp = new double[n + 1][n + 1];
        double[] ps = new double[n];
        for (int i = 0; i < n; i++) {
            ps[i] = std.nextDouble();
        }

        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (dp[i][j] == 0) {
                    continue;
                }
                dp[i + 1][j] += dp[i][j] * (1 - ps[i]);
                dp[i + 1][j + 1] += dp[i][j] * ps[i];
            }
        }

        int count = n / 2 + 1;
        double ans = 0;
        for (int i = count; i <= n; i++) {
            ans += dp[n][i];
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 133696
#include<stdlib.h>
#include<iostream>
#include<string>

using namespace std;

int main() {

	int A, B, C;
	cin >> A >> B >> C;
	if (A < C && C < B) {
		cout << "Yes" << endl;
	}
	else if(A>C&&C>B){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;

signed main(){
    int k,n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
    }
    int ans = k - a[n-1]+a[0];
    int ma = k - a[n-1]+a[0];
    FOR(i,1,n) {
        ans += a[i]-a[i-1];
        ma = max(ma, a[i]-a[i-1]);
    }
    cout << ans-ma << endl; 
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  int sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
  rep(i,tx-sx) cout<<"R";
  rep(i,ty-sy) cout<<"U";
  rep(i,tx-sx) cout<<"L";
  rep(i,ty-sy) cout<<"D";
  cout<<"D";
  rep(i,tx-sx+1) cout<<"R";
  rep(i,ty-sy+1) cout<<"U";
  cout<<"LU";
  rep(i,tx-sx+1) cout<<"L";
  rep(i,ty-sy+1) cout<<"D";
  cout<<"R"<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const double PI=acos(-1);
using namespace std;
#define ll long long
#define ull unsigned long long
#define ul unsigned long
#define MOD 1000000007

long findmin(long a,long b) {
    return a<b?a:b;
}
long findmax(long a,long b) {
    return a>b?a:b;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin>>x;
    if(x>=30) {
		cout<<"Yes\n";
	}
	else {
		cout<<"No\n";
	}
    cout.flush();
	return 0;
}


Measured memory_bytes: 3604
using System;
using System.Linq;
using System.Collections;
class Program
{
    public static void Main()
    {
        //int n = int.Parse(Console.ReadLine());
        char[] str = Console.ReadLine().ToCharArray();
        Console.Write(str[0]);
        str = Console.ReadLine().ToCharArray();
        Console.Write(str[1]);
        str = Console.ReadLine().ToCharArray();
        Console.Write(str[2]);
        Console.WriteLine();
    }
}

Measured memory_bytes: 11092
n, m = map(int, input().split())
arr = [input().split() for i in range(m)]
q = [int(arr[j][0]) for j in range(m)]
# [q, judges]
judges = [str(arr[h][1]) for h in range(m)]
results = [False]*n
wa_cnt = [0]*n
total_wa = 0
for k in range(m):
    if results[q[k]-1] == False:
        if judges[k] == "AC":
            results[q[k]-1] = True
            total_wa += wa_cnt[q[k]-1]
        else:
            wa_cnt[q[k]-1] += 1
    else:
        continue
print("{} {}".format(results.count(True), total_wa))

Measured memory_bytes: 38608
from heapq import *
from collections import defaultdict

n, m = map(int, input().split())
jobs = defaultdict(list)
for _ in range(n):
    a, b = map(int, input().split())
    jobs[a].append(-b)

result = 0
pool = []
for i in range(1, m+1):
    for j in jobs[i]:
        heappush(pool, j)
    if 0 < len(pool):
        result += -heappop(pool)

print(result)

Measured memory_bytes: 27740
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template <class T> void read(T &);
template <class T> void write(const T &);

typedef long long ll;
typedef unsigned long long ull;
typedef const long long &cll;
typedef const int &ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::abs;
using std::max;
using std::min;

int main() {
  ll a, b, c, d;
  read(a), read(b), read(c), read(d);
  write(max(max(a * c, a * d), max(b * c, b * d))), EL;
  return 0;
}

template <class T> inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template <class T> inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
    Node *cur = nil->next;  // 番兵の次の要素からたどる
    while(cur != nil && cur->key != key){
        cur = cur->next;
    }
    return cur;
}

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList(){
    Node *cur = nil->next;
    int isf = 0;
    while(1){
        if(cur == nil) break;
        if(isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t){
    if(t == nil) return;  // tが番兵の場合は処理しない
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    // 検索したノードを削除
    deleteNode(listSearch(key));
}

void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    // 番兵の直後に要素を追加
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main(){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for(i = 0; i < n; i++){
        scanf("%s%d", com, &key);  // より高速な入力関数を使用
        if(com[0] == 'i') {insert(key); np++; size++;}
        else if(com[0] == 'd'){
            if(strlen(com) > 6){
                if(com[6] == 'F') deleteFirst();
                else if(com[6] == 'L') deleteLast();
            }else{
                deleteKey(key); nd++;
            }
            size--;
        }
    }

    printList();

    return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

template <ll mod>
class modint
{
public:
    constexpr modint(ll value = 0) : _value(value >= 0 ? value % mod : (value % mod) + mod) {}

    constexpr modint operator+() const { return *this; }
    constexpr modint operator-() const { return modint(-_value); }

    constexpr modint &operator+=(const modint &rhs) {
        if ((_value += rhs._value) >= mod) _value -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
        if ((_value += mod - rhs._value) >= mod) _value -= mod;
        return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
        (_value *= rhs._value) %= mod;
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
        *this *= rhs.inv();
        return *this;
    }
    constexpr modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }

    constexpr modint operator++() { *this += 1; return *this; }
    constexpr modint operator--() { *this -= 1; return *this; }
    constexpr modint operator++(int) { modint tmp = *this; ++*this; return tmp; }
    constexpr modint operator--(int) { modint tmp = *this; --*this; return tmp; }

    constexpr bool operator==(const modint &rhs) const { return _value == rhs._value; }
    constexpr bool operator!=(const modint &rhs) const { return _value != rhs._value; }

    constexpr modint inv() const {
        ll a = _value, b = mod, u = 1LL, v = 0LL;
        while (b > 0) {
            ll tmp = a / b;
            a -= tmp * b; swap(a, b);
            u -= tmp * v; swap(u, v);
        }
        return modint(u);
    }

    constexpr modint pow(ll n) const {
        modint e = *this, res = 1;
        while (n) {
            if (n & 1) res *= e;
            e *= e, n >>= 1;
        }
        return res;
    }

    friend ostream &operator<<(ostream &os, const modint &m) {
        os << m._value;
        return os;
    }

    friend istream &operator>>(istream &is, modint &m) {
        ll in;
        is >> in;
        m = modint(in);
        return is;
    }

private:
    ll _value;
};
using mint = modint<1000000007>;

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

    int n; cin >> n;
    mint ans = 1;
    for (int i = 1; i <= n; i++) ans *= i;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int N = in.i();
        int[] A = in.ii();
        HashSet<Integer> hs = new HashSet<>();
        for(int i = 0; i < N; i++){
            hs.add(A[i]);
        }        
        out.println(hs.size() == N ? "YES" : "NO");
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 55208
#include<bits/stdc++.h>
using namespace std;
int n,ans=0;
void dfs(long long x){
  if(n<x) return;
  string s=to_string(x);
  if(count(s.begin(),s.end(),'3') && count(s.begin(),s.end(),'5') && count(s.begin(),s.end(),'7')){
    ans ++;
  }
  dfs(10*x+3);
  dfs(10*x+5);
  dfs(10*x+7);
  return;
}

int main(){
  cin >> n;
  dfs(3);
  dfs(5);
  dfs(7);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int n,m,i,day,income=0;
    cin>>n>>m;
    vector<pair<int,int>>v(n);
    for(int i=0;i<n;i++)cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end(),[](const auto &x,const auto &y){return x.first<y.first;});
    priority_queue<int>w;
    for(day=1,i=0;day<=m;day++){
        while(i<n&&v[i].first<=day){w.push(v[i++].second);}
        if(!w.empty())income+=w.top(),w.pop();
    }
    cout<<income<<endl;
    return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string S;
	int n;
	cin >> n;
	cin >> S;
	int count = 0;
	int ans = 0;
	vector<int> v1(26,0);
	vector<int> v2(26,0);
	for (int i = 0;i < n - 1;i++){
		count = 0;
		for (int j = 0;j<=i;j++){
			if (v1[S[j] - 'a'] == 0){
				v1[S[j] - 'a'] = 1;
			}
		}
		for (int k = i + 1;k < n;k++){
			if (v2[S[k] - 'a'] == 0){
				v2[S[k] - 'a'] = 1;
			}
		}
		for (int l = 0;l < 26;l++){
			if (v1[l] == 1 && v1[l] == v2[l]){
				count++;
			}
		}
		ans = max(ans,count);
		v1.assign(26,0);
		v2.assign(26,0);
	}

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

Measured memory_bytes: 256
fun main() {
    val n = readLine()!!.toInt()
    val a0 = readLine()!!.split(" ").map { it.toInt() }
    val a1 = readLine()!!.split(" ").map { it.toInt() }

    val s0 = IntArray(n) { 0 }
    val s1 = IntArray(n) { 0 }

    s0[0] = a0[0]
    s1[0] = a1[0]
    for (i in 1 until n) {
        s0[i] += a0[i] + s0[i - 1]
        s1[i] += a1[i] + s1[i - 1]
    }

    var answer = 0

    for (i in 0 until n) {
        val second = if (i == 0) s1[n - 1] else s1[n - 1] - s1[i - 1]
        val total = s0[i] + second
        if (answer < total) {
            answer = total
        }
    }

    println(answer)
}

Measured memory_bytes: 38032
#include <iostream>
#include <bits/stdc++.h>
#define mod 1000000007;
using namespace std;
int main() {
	int h,w;
	cin>>h>>w;
	vector<string>grid(h);
	for(int i=0;i<h;i++)
	{
	    cin>>grid[i];
	}
	vector<vector<int>>dp(h,vector<int>(w));
 	dp[0][0]=1;
	for(int i=0;i<h;i++)
	{
	    for(int j=0;j<w;j++)
	    {
	        if(grid[i][j]=='#')
	            continue;
	        if(i==0&&j==0)
	            continue;
	       if(i==0)
                dp[i][j]=dp[i][j-1];
            else if(j==0)
                    dp[i][j]=dp[i-1][j];
            else
                    dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
	    }
	}
 	cout<<dp[h-1][w-1];
	return 0;
}

Measured memory_bytes: 9420
using System;

namespace HalfAndHalf {
    class Program {
        static void Main(string[] args) {

            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
            int X = int.Parse(input[3]);
            int Y = int.Parse(input[4]);

            //  AをX枚BをY枚買ったと仮定する

            //  Cを2枚買い足してAとBから1枚ずつ引く
            //  AとBが両方0枚になったら終了
            int tmpA, tmpB, tmpC, sum;
            tmpA = X;
            tmpB = Y;
            tmpC = 0;
            sum = A * X + B * Y;
            while (true) {
                if (tmpA <= 0 && tmpB <= 0) {   //  AとBの両方が0枚なら終わる
                    Console.WriteLine(sum);
                    break;
                }

                tmpA--; if (tmpA < 0) tmpA = 0;
                tmpB--; if (tmpB < 0) tmpB = 0;
                tmpC += 2;

                //  今回sumの計算
                int newSum = tmpA * A + tmpB * B + tmpC * C;

                //  前回sumより高くなったら前回値で終了
                if (sum < newSum) {
                    Console.WriteLine(sum);
                    break;
                }

                sum = newSum;
            }
        }
    }
}


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

// ABC082B - Two Anagrams
int main(){
  string s, t;
  cin >> s >> t;

  std::sort(s.begin(), s.end());
  std::sort(t.begin(), t.end(), std::greater<char>());

  int len = (int)min(s.length(), t.length());
  for (int i = 0; i < len; ++i) {
    if (s[i] < t[i]) {
      cout << "Yes" << endl;
      return 0;
    } else if (s[i] > t[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (s.length() < t.length()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main(){
int n;
int a,b,c,d;
cin>>n;
a=n/100;
c=n%10;
d=(n-c)-a*100;
b=d/10;
if(a==7)cout<<"Yes"<<endl;
else if(b==7)cout<<"Yes"<<endl;
else if(c==7)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}


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

int main() {
	long long int n,w;
	cin>>n>>w;
	long long int wei[n],val[n];
	for(auto i=0;i<n;i++){
	    cin>>wei[i]>>val[i];
	}
	long long int dp[n+1][w+1];
	for(auto i=0;i<=n;i++){
	    for(auto j=0;j<=w;j++){
	        if(i==0 || j==0) dp[i][j]=0;      
	    }
	}
	for(auto i=1;i<=n;i++){
	    for(auto j=1;j<=w;j++){
	        if(j>=wei[i-1]){
	            dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-wei[i-1]]);
	        }
	        else{
	            dp[i][j]=dp[i-1][j];
	        }
	    }
	}
	cout<<dp[n][w];
	return 0;
}


Measured memory_bytes: 79104
from collections import Counter

N = int(input())
S = input()

RGB = Counter(S)

su = RGB['R']*RGB['G']*RGB['B']

for i in range(N-2):
    for k in range(i+2,N,2):
        j = (i + k)//2
        a = [S[i],S[j],S[k]]
        if 'R' not in a:
            continue
        if 'G' not in a:
            continue
        if 'B' not in a:
            continue
        su -= 1

print(su)

Measured memory_bytes: 68868
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

class BitSum:
    def __init__(self, n):
        self.n = n + 3
        self.table = [0] * (self.n + 1)

    def update(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def InversionNumber(lst):
    bit=BitSum(max(lst))
    res=0
    for i,a in enumerate(lst):
        res+=i-bit.sum(a)
        bit.update(a,1)
    return res

def main():
    n=int(input())
    aa=list(map(int, input().split()))
    s=set()
    for a in aa:
        s.add(a)
    atob={}
    for i,a in enumerate(sorted(s)):
        atob[a]=i+1
    bb=[]
    for a in aa:
        bb.append(atob[a])
    #print(bb)
    print(InversionNumber(bb))

main()



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

int main() {
    int n;
    cin >> n;
    int ans=0;
    rep(i,n){
        int x;
        cin >> x;
        if(i%2==0&&x%2==1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3672