akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define MAX 100
#define W 0
#define G 1
#define B 2

int n,A[MAX][MAX];
int C[MAX],a[MAX],b[MAX],d;

void dfsV(int k){
  int x;
  C[k]=G;
  a[k]=++d;
  for(x=0;x<n;x++){
    if(A[k][x]==0)
      continue;
    if(C[x]==W){
      dfsV(x);
    }
  }
  C[k]=B;
  b[k]=++d;
}

void df(){
  int k;
  for(k=0;k<n;k++)
    C[k]=W;
  d=0;

  for(k=0;k<n;k++){
    if(C[k]==W)
      dfsV(k);
  }
  for(k=0;k<n;k++){
    printf("%d %d %d\n",k+1,a[k],b[k]);
  }
}

int main(){
  int k,l,h,i,j;

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

  for(i=0;i<n;i++){
    scanf("%d %d",&k,&h);
    k--;
    for(j=0;j<h;j++){
      scanf("%d",&l);
      l--;
      A[k][l]=1;
    }
  }

  df();

  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
#define sum(n) (n)*((n) + 1) / 2

long ineq_pair(char a, char b) {
    if ( (a == '>') && (b == '<')) {
        return 0;
    }
    else if ((a == '<') && (b == '>')) {
        return 1;
    }
    else {
        return -1;
    } 
}

int main()
{
    string S;
    cin >> S;
    long N = S.size() + 1;
    
    if (S.at(0) == '<') {
        S = '>' + S;
    }
    else {
        S = '<' + S;
    }

    if (S.at(N - 1) == '>') { //前で足しているからサイズが変わっている
        S = S + '<';
    }
    else {
        S = S + '>';
    }

    vector<long> type(N);
    queue<long> q0, q1;

    //>< 0   <> 1   << 2   >> 3
    for (long i = 0; i < N; i++) {
        type.at(i) = ineq_pair(S.at(i), S.at(i + 1));

        if (type.at(i) == 1) {
            q1.push(i);
            if (i == 0) {
                q0.push(-1);
            }
            else if (i == N - 1) {
                q0.push(N);
            }
        }
        
        if (type.at(i) == 0) {
            q0.push(i);
        }

        //if ((i == 0) && type.at(i) != 1) {
        //    q0.push(i);
        //}

        //if ((i == N - 1) && type.at(i) != 1) {
        //    q0.push(i);
        //}

    }

    //vector<pair<long, long>> border(q0.size() + 1, pair<long, long>(0, 0));
    //long i = 0, ans = 0;
    //while(!q1.empty()) {
    //    border.at(i).first = q1.front() - q0.front();
    //    q0.pop();
    //    border.at(i).second = q0.front() - q1.front();
    //    q1.pop();

    //    long temp_max, temp_min;
    //    temp_max = max(border.at(i).first, border.at(i).second);
    //    temp_min = min(border.at(i).first, border.at(i).second);

    //    ans += sum(temp_max) + sum(temp_min - 1);
    //    i++;
    //}
    
    long i = 0, ans = 0, temp_first, temp_second, temp_max, temp_min;
    while (!q1.empty()) {
        temp_first = q1.front() - q0.front();
        q0.pop();
        temp_second = q0.front() - q1.front();
        q1.pop();

        temp_max = max(temp_first, temp_second);
        temp_min = min(temp_first, temp_second);

        ans += sum(temp_max) + sum(temp_min - 1);
        i++;
    }

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

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

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        m: usize,
        v: [i32; m],
    }
    let mut x = 0;
    for value in v {
        x += value;
    }
    if (n as i32 > x) {
        println!("No");
    } else {
        println!("Yes");
    }
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;
using System.Xml;

namespace hello_world
{
	class Program
	{

		static void Main(string[] args)
		{

			string[] s = Console.ReadLine().Split(" ");
			decimal a = decimal.Parse(s[0]);
			decimal b = decimal.Parse(s[1]);
			decimal c = Math.Truncate(a * b);


			Console.WriteLine(c);

		}
	}
}

Measured memory_bytes: 27580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n;
  m =  n % 1000;
    if (m == 0){
      
 cout << 0 << endl;
    }
  else{
         
 cout << 1000 - m << endl; 
  }
}

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

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

		if( a == b ){
		cout << "a == b" << endl;
		}else{
			if( a > b){
			cout << "a > b" << endl;
			}else{
			cout << "a < b" << endl;
			}
		}

}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 3e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

ll dp[N]; // helth

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  for (int i = 0; i < N; ++i) {
    dp[i] = inf;
  }
  int H, n, a, b;
  cin >> H >> n;
  dp[H] = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    for (int j = H; j >= 0; --j) {
      int val = j - a;
      if(val < 0)
        val = 0;
      dp[val] = min(dp[val], dp[j] + b);
    }
  }
  cout << dp[0];
  return 0;
}


Measured memory_bytes: 2560
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	cout << (n*(n-1))/2;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    int n, m, a, b, c, d;
    cin >> n >> m;
    vector<int> A, B, C, D;
    for(int i=0; i<n; i++){
        cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }
    for(int i=0; i<m; i++){
        cin >> c >> d;
        C.push_back(c);
        D.push_back(d);
    }
    for(int i=0; i<n; i++){
        int minv = 1<<30, x;
        for(int j=0; j<m; j++){
            int dis = abs(A[i]-C[j])+abs(B[i]-D[j]);
            if(dis<minv){
                minv = dis;
                x = j+1;
            }
        }
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7ll;

int a,b;
int n;
int ans;

int digit(int x){
  int ret=0;
  while(x/10){
    ret+=(x%10);
    x/=10;
  }
  ret+=(x%10);
  return ret;
}

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>n>>a>>b;

for(int i=1; i<=n; i++){
  if((a<=digit(i))&&(b>=digit(i))){
    ans+=i;
  }
}

cout<<ans<<endl;

}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    cout<<n-m+1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <time.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 5020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	int n; cin >> n;
	int N = 2*n-1;
	vl a(N); rep(i,N) cin >> a[i];
	int ok = N, ng = 0;
	while(ok-ng > 1){
		int mid = (ng+ok) / 2;
		vb v(N);
		int s = 0;
		rep(i,N) v[i] = (a[i] <= mid), s += v[i];
		int last = -1;
		int mn = n;
		REP(i,n-1,N){
			if(v[i] == v[i+1]){
				mn = i-n+1; last = v[i];
				break;
			}
		}
		for(int i=n-1; i>=1; i--){
			if(v[i] == v[i-1]){
				if(mn == n-1-i){
					if(last != v[i]){
						last = v[n-1] ^ (mn & 1 ^ 1);
					}
				}
				if(chmin(mn, n-1-i)){
					last = v[i];
				}
				break;
			}
		}
		if(mn == n) last = v[n-1] ^ (n & 1 ^ 1);
		if(last == 1) ok = mid;
		else ng = mid;
	}
	cout << ok << "\n";
}

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

using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;

    bool flag = false;
    int cnt = 0, maxCnt = cnt;
    for(int i=0; i<s.length(); i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            if(!flag){
                flag = true;
            }
            cnt++;

        }else{
            if(flag){
                maxCnt = max(maxCnt, cnt);
                flag = false;
                cnt = 0;
            }
        }
    }

    maxCnt = max(maxCnt, cnt);
    cout << maxCnt << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    S = ['$'] + list(input().rstrip())

    c = lambda x: ord(x) - ord('a')
    bit = [BinaryIndexedTree(N) for _ in range(26)]
    for i, l in enumerate(S):
        if i == 0: continue
        bit[c(l)].add(i, 1)

    Q = int(input())
    for _ in range(Q):
        t, a, b = input().rstrip().split()
        if t == '1':
            a = int(a)
            bit[c(S[a])].add(a, -1)
            bit[c(b)].add(a, 1)
            S[a] = b
        else:
            a, b = int(a), int(b)
            ans = 0
            for i in range(26):
                t = bit[i].sum(b)
                if a >= 1: t -= bit[i].sum(a-1)
                ans += 1 if t else 0
            print(ans)

class BinaryIndexedTree:
    def __init__(self, n=None, f=lambda x,y:x+y, zero=0, initial_values=None):
        assert(n or initial_values)
        self.__f, self.__z, = f, zero
        self.__n = n if n else len(initial_values)
        self.__dat = [zero] * (self.__n + 1)
        if initial_values:
            for i in range(1, self.__n + 1): self.add(i, initial_values[i-1]) #slow

    def add(self, i, v):
        while i <= self.__n:
            self.__dat[i] = self.__f(self.__dat[i], v)
            i += -i&i

    def sum(self, r):
        ans = self.__z
        while r:
            ans = self.__f(ans, self.__dat[r])
            r -= -r&r
        return ans

if __name__ == '__main__':
    main()


Measured memory_bytes: 165220
import sys

def main():
  N, M = map(int, input().split())
  sunukes = set(range(1, N+1))
  
  is_skip = True
  for i in range(M*2):
    d = list(map(int, input().split()))
    if is_skip:
      is_skip = False
      continue

    sunukes = sunukes - set(d)
	
    is_skip = True

  print(len(list(sunukes)))
  
  
if __name__ == '__main__':
  main()


Measured memory_bytes: 9112
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int a[200001];
int mapdata[200001];
int ans = 0;
vector<int>P;

signed main() {
	int N, A, B;
	int a=0, b=0, c=0;
	cin >> N >> A >> B;
	for (int i = 0; i < N; i++) {
		int t = 0;
		cin >> t;
		if (t <= A) a++;
		if (t >= A + 1 && t <= B) b++;
		if (t >= B + 1)c++;
	}
	cout << min(a, (min(b, c))) << "\n";


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>

using namespace std;
const long long P = 1000000007;

int main() {
  int n;
  cin >> n;
  int num = n / 100;
  if(100*num <= n && n <= 105*num) {
    cout << "1" << endl;
  }else {
    cout << "0" << endl;
  }
  return 0;
}

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

using namespace std;

int main(void) {
  int B[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> B[i][j];
    }
  }

  int N; cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];

  bool exist[3][3];
  memset(exist, false, sizeof(exist));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        exist[i][j] |= (A[k] == B[i][j]);
      }
    }
  }

  for (int i = 0; i < 3; i++) {
    if (exist[i][0] && exist[i][1] && exist[i][2]) {
      cout << "Yes" << endl;
      return 0;
    }
    if (exist[0][i] && exist[1][i] && exist[2][i]) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  if ( (exist[0][0] && exist[1][1] && exist[2][2]) ||
       (exist[0][2] && exist[1][1] && exist[2][0]) ) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		long a = in.nextLong();
		long b = in.nextLong();
		long c = in.nextLong();
		long d = in.nextLong();

		System.out.println(countNonMultiple(b, c, d) - countNonMultiple(a - 1, c, d));

		in.close();
	}

	// 1以上limit以下の範囲でｃ、ｄの倍数でないものの個数を返す
	private static long countNonMultiple(long limit, long c, long d) {

		// cの倍数の個数
		long m_c = limit / c;

		// dの倍数の個数
		long m_d = limit / d;

		// c, dの最大公約数
		long gcd = getGCD(c, d);

		// c,dの最小公倍数
		long lcm = c * d / gcd;

		// lcm の個数
		long m_lcm = limit / lcm;

		return limit - m_c - m_d + m_lcm;
	}

	// 最大公約数を求める
	private static long getGCD(long c, long d) {
		if ( c % d == 0 ) return d;
		else return getGCD(d, c % d);
	}
}


Measured memory_bytes: 21844
import sys
input=lambda: sys.stdin.readline().rstrip()
D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for _ in range(D)]


for i in range(D):
    t = S[i].index(max(S[i]))
    print(t+1)



Measured memory_bytes: 68216
//https://atcoder.jp/contests/dp/tasks/dp_i
#include<bits/stdc++.h>
using namespace std;
typedef long double dl;
int main()
{
    int n,i,j;
    cin>>n;
    dl arr[n+1],dp[n+1][n+1],ans=0.0;// dp[i][j] means in pos j there are i heads
    for(i=1;i<=n;i++)
        cin>>arr[i];
  /*  for(i=0;i<n;i++)
        cout<<arr[i]<<' ';*/
    dp[0][0]=1.0;
    for(i=1;i<=n;i++)
        dp[0][i]=(1.0-arr[i])*dp[0][i-1];
    for(i=1;i<=n;i++)
    {
        for(j=i;j<=n;j++)
        {
            if(i==j)
            {
                dp[i][j]=dp[i-1][i-1]*arr[i];
            }
            else
            {
                dp[i][j]=(dp[i][j-1]*(1.0-arr[j]))+(dp[i-1][j-1]*arr[j]);
            }
        }
    }
  /*  for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
            cout<<dp[i][j]<<"   ";
        cout<<endl;
    }*/
    for(i=n/2+1;i<=n;i++)
    {
        ans=ans+dp[i][n];
    }
    printf("%.10llf\n",ans);
}


Measured memory_bytes: 140288
import java.io.FileNotFoundException;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		long startTime = System.currentTimeMillis();
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		System.out.println(Math.max(0, A - 2 * B));
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    for (auto &i: x) cin >> i;
    vector<int> asc(n);
    asc = x;
    sort(asc.begin(), asc.end());
    /*double med = ((long long)asc[n/2-1] + (long long)asc[n/2]) / 2.0;
    for (int i: x) {
        if (i > med) cout << asc[n/2-1] << endl;
        else if (i < med) cout << asc[n/2] << endl;
        else cout << med << endl;
    }*/
    int med1 = asc[n/2-1], med2 = asc[n/2];
    for (int i: x) {
        if (i < med2) cout << med2 << endl;
        else cout << med1 << endl;
    }
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

vector<vector<int>> graph;

int main(){
  int n, m;
  cin >> n >> m;
  vector<P> q(m);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    q[i].first = b;
    q[i].second = a;
  }
  sort(q.begin(), q.end());
  int ans = 0;
  int pre = 0;
  rep(i, m) {
    if(q[i].second >= pre) {
      ans++;
      pre = q[i].first;
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 1024
#include <iostream>
#include <math.h>

using namespace std;

int main(){
  int i, N;
  cin >> N;
  long long n[N];
  
  for(i = 0 ; i < N ; i++){
	cin >> n[i];
  }
  
  long long sum_f = 0, sum_r = 0;
  for(i = 0 ; i < N ; i++){
    sum_r += n[i];
  }
  
  long long min = sum_r, min_f, min_r;
  int flag = 1;
  for(i = 1 ; i <= N ; i++){
    sum_f += n[i-1];
    sum_r -= n[i-1];
    if(sum_f == sum_r){
      flag = 0;
      break;
    }else if(min > abs((sum_f - sum_r)) ){
      min_f = i;
      min_r = N - i;
      min = abs((sum_f - sum_r));
    }
  }
    
  if(flag == 1){
    cout << min << endl;
  }else{
    cout << 0 << endl;
  }
 
  
  
  return 0;
}
  

Measured memory_bytes: 1792
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    int a,b;
    cin>>a>>b;
    int ans=0;
    ans = max(a*2-1,max(b*2-1,a+b));
    cout<<ans<<endl;
}

Measured memory_bytes: 3652
import java.util.Scanner;
import java.util.function.LongSupplier;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final IntStream REPS(int v){return IntStream.range(0, v);};
	public static void main(String[] __){
		int n=s.nextInt();
		for(int i=0;i<n;i++) {
			int y=s.nextInt(),m=s.nextInt(),d=s.nextInt(),res=1;
			while (y!=1000) {
				res+=m%2==1||y%3==0?20-d:19-d;
				d=0;
				m++;
				if(m==11) {
					y++;
					m=1;
				}
			}
			System.out.println(res);
		}
	}
}

Measured memory_bytes: 27128
#include <bits/stdc++.h>
using namespace std;
#define int long long 
bool vis[4];
int level[4];
vector<int> v[4];
void dfs( int s, int l){
    vis[s]=true;
    level[s]=l;
    for(int i=0;i<(int)v[s].size();++i){
        if(!vis[v[s][i]])
        dfs(v[s][i],l+1);
    }
}
int32_t main()
{
    for(int i=0;i<3;++i){
        int a,b;
        cin>>a>>b;
        a--;b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=0;i<=3;++i){
        for(int j=0;j<=3;++j)
        vis[j]=false;
        dfs(i,0);
        for(int i=0;i<=3;++i)
        if(level[i]==3){
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
  
    sort(s.begin(), s.end());
    
    int res = 1;
    
    rep(i, n-1){
        if(s[i] != s[i+1]) ++res;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 9596
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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 MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

using Graph = vector<vector<ll>>;

int main(){
  ll n;
  cin>>n;
  ll ans=2;
  ll all=1;
  ll rem1=1;
  ll rem2=1;
  if(n==1){cout<<0<<endl;return 0;}
  if(n==2){cout<<2<<endl;return 0;}
  rep(i,n){
    all=(all*10)%mod;
    rem1=(rem1*8)%mod;
    rem2=(rem2*9)%mod;
  }
  ans=(all-rem2+mod)%mod;
  ans=(ans-rem2+mod)%mod;
  ans=(ans+rem1)%mod;
  
  cout<<ans<<endl;
    
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int dfs(int N, int s){
    if (s > N){
        return 0;
    }
    string t = to_string(s);
    int len_t = t.size();
    bool c3 = false;
    bool c5 = false;
    bool c7 = false;
    int ans = 0;
    rep(i,len_t){
        if (t.substr(i,1) == "3"){
            c3 = true;
        }
        else if (t.substr(i,1) == "5"){
            c5 = true;
        }
        else if (t.substr(i,1) == "7"){
            c7 = true;
        }
    }
    if (c3 && c5 && c7){
        ans++;
    }
    if (s > 100000001){
        return ans;
    }
    return ans + dfs(N, 10 * s + 3) + dfs(N, 10 * s + 5) + dfs(N, 10 * s + 7);
}

int main(){
    int N;
    cin >> N;
    cout << dfs(N,0) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int deduction,poll_sum=0,winner_poll=0,athlete_sum,winner_num,poll,i;

	while(1){
		scanf("%d %d %d",&athlete_sum, &winner_num, &deduction);
		poll_sum=0;
		winner_poll=0;
		
		if(athlete_sum==0 && winner_num==0 && deduction==0)break;

		for(i=1;i<=athlete_sum;i++){
			scanf("%d",&poll);
			poll_sum+=poll;
			if(winner_num==i)
				winner_poll=poll;
		}

		if(winner_poll==0)
			printf("0\n");
		else
			printf("%d\n",poll_sum*100*(100-deduction)/100/winner_poll);

		}

	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)

const int L=1e2+7;
string s[L];
ll n, m, dp[L][L][2];
ll solve(int i, int j, int f)
{
	if(i == n-1 && j == m-1)
	{
		// debug()
		if(s[i][j] == '.')
		{
			// if(f)return 0;
			return 0;
		}
		if(f)return 0;
		return 1;
	}
	if(i >= n || j>=m || i<0 || j<0)return 1e6; 
	if(dp[i][j][f] != -1)return dp[i][j][f];
	ll &ret = dp[i][j][f];
	ret = INT_MAX;
	if(f)
	{
		if(s[i][j] == '.')
		{
			// ret = 1 + min(solve(i+1,j,1-f),solve(i,j+1,1-f)) ;
			ret = min(solve(i+1,j,0),solve(i,j+1,0)) ;
		}
		else
		{
			ret = min(solve(i+1,j,1),solve(i,j+1,1)) ;
		}
	}
	else
	{
		if(s[i][j] == '#')
		{
			ret = 1 + min(solve(i+1,j,1),solve(i,j+1,1)) ;
		}
		else
		{
			ret = min(solve(i+1,j,f),solve(i,j+1,f)) ;
		}
	}
	// debug(i,j,f,ret);
	return ret;
}
void ffs()
{
	cin >> n >> m;
	FOR(i,0,n)FOR(j,0,m)FOR(k,0,2)dp[i][j][k] = -1;
	FOR(i,0,n)
	{
		cin >> s[i];
	}	
	cout<<solve(0, 0, 0)<<ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	ffs();
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    vector<int> vec(201);
    for(int i = 1;i <= 200;i++) {
        vec.at(i) = i * i;
    }
    vector<ll> ret(100010);
    for(int i = 1;i <= 200;i++) {
        for(int j = 1;j <= 200;j++) {
            for(int k = 1;k <= 200;k++) {
                if((i + j + k) % 2 == 0) {
                    int cnt = (i + j + k) / 2;
                    int a = cnt - i;
                    int b = cnt - j;
                    int c = cnt - k;
                    if(a > 0 && b > 0 && c > 0) {
                        if((vec.at(i) + vec.at(j) + vec.at(k)) % 2 == 0) {
                            ret.at((vec.at(i) + vec.at(j) + vec.at(k)) / 2)++;
                        }
                    }
                }
            }
        }
    }
    for(int i = 1;i <= N;i++) {
        cout << ret.at(i) << endl;
    }
}

Measured memory_bytes: 3956
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

#define POS(i,j) ((i)*n+(j))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  const int inf=100000+1;
  int cost[10000];
  int i,j,k;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      cost[POS(i,j)]=i==j?0:inf;
    }
  }
  for(i=0;i<m;i++){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    a--;b--;
    cost[POS(a,b)]=c;
    cost[POS(b,a)]=c;
  }
  int dp[10000];
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      dp[POS(i,j)]=cost[POS(i,j)];
    }
  }
  for(k=0;k<n;k++){
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	if(dp[POS(i,j)]>dp[POS(i,k)]+dp[POS(k,j)]) dp[POS(i,j)]=dp[POS(i,k)]+dp[POS(k,j)];
      }
    }
  }
  int cnt=0;
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(cost[POS(i,j)]!=inf && dp[POS(i,j)]<cost[POS(i,j)]) cnt++;
    }
  }
  printf("%d\n",cnt);
}

int main(void){
  run();
  return 0;
}


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

int main(){
    int n,m,c,ans=0;cin>>n>>m>>c;vector<int> B(m);
    for(int i=0;i<m;i++) cin>>B.at(i);
    for(int i=0;i<n;i++){
        vector<int> A(m);int sum=c;
        for(int j=0;j<m;j++){
            cin>>A.at(j);
            sum+=A.at(j)*B.at(j);
        }
        if(sum>0) ans++;     
    }
    cout<<ans<<endl;
}

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

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var X = ReadLong();
            var max = 0L;
            for (int b = 1; b <= 1000; b++)
            {
                for (int p = 2; p < 1000; p++)
                {
                    var bp = (long)Math.Pow(b, p);
                    if (bp > X) break;
                    max = Math.Max(max, bp);
                }
            }

            return max;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 27720
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string O,E; cin >> O >> E;
    string ans;
    for (int i=0;i<min(O.size(),E.size());i++) {
        ans += O[i]; 
        ans += E[i];
    }
    if (O.size()!=E.size()) {
        ans += O[O.size()-1];
    }
    cout << ans << endl;
}

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

int main() {
    int n, d;
    cin >> n >> d;
    int x=2*d+1;
    if (n%x==0) {
    cout << n/x << endl;
    }
    else{
      cout << n/x+1 << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main() {
	int n, m,pos[3];
	char s1[6],s2[6]="snuke";
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			scanf("%s", &s1);
			if (!strcmp(s1, s2)) {
				pos[0] = j;
				pos[1] = i;
			}
		}
	}
	printf("%c%d", pos[0] + 64, pos[1]);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][][]room_array = new int[4][3][10];

		// Initialize "room_array" with Zero
		for(int building = 0; building < 4; building++) {
			for(int floor = 0; floor < 3; floor++) {
				for(int room = 0; room < 10; room++) {
					room_array[building][floor][room] = 0;
				}
			}
		}

		int in_count = sc.nextInt();

		int[] b = new int[in_count];
		int[] f = new int[in_count];
		int[] r = new int[in_count];
		int[] v = new int[in_count];

		for(int i = 0; i < in_count; i++) {
			b[i] = sc.nextInt();
			f[i] = sc.nextInt();
			r[i] = sc.nextInt();
			v[i] = sc.nextInt();

			room_array[b[i] - 1][f[i] - 1][r[i] - 1] += v[i];
		}

		for(int building = 0; building < 4; building++) {
			for(int floor = 0; floor < 3; floor++) {
				for(int room = 0; room < 10; room++) {
					System.out.printf(" %d", room_array[building][floor][room]);
				}
				System.out.println();
			}
			if(building < 3) {
				for (int i = 0; i < 20; i++) System.out.printf("#");
				System.out.println();
			}
		}
		sc.close();
	}
}



Measured memory_bytes: 30580
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define reps(i, s, n) for (int i = (s); i < (n); ++i)
#define repse(i, s, n) for (int i = (s); i <= (n); ++i)
#define repsr(i, n, s) for (int i = (n); i >= (s); --i)
const int64_t inf = (int64_t)1e18;
const int64_t mod = (int64_t)1e9 + 7;

int main() {
  int N; cin >> N;
  vector<int> as(N);
  rep(i, N) cin >> as[i];
  auto gcd = [](int n, int m) {
    while (m > 0) {
        int tmp = m;
        m = n % m;
        n = tmp;
    }
    return n;
  };
  int ans = as[0];
  int minimum = as[0];
  reps(i, 1, N) {
    ans = gcd(ans, as[i]);
    minimum = min(minimum, as[i]);
  }
  cout << (ans ? ans : minimum) << endl;
  return 0;
}

Measured memory_bytes: 640
W = list()
K = list()

for i in range(10):
    W.append(int(input()))

W.sort()
W.reverse()

for i in range(10):
    K.append(int(input()))

K.sort()
K.reverse()

#print('@',W[0:],K[0:])

print(sum(W[0:3]),sum(K[0:3]))




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

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

Measured memory_bytes: 640
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
b = [int(input()) for i in range(n)]

a = a1+a2+a3
for i in b:
    if i in a:
        a[a.index(i)] = True

if True not in a:
    print("No")
elif a[0] == a[3] == a[6] == True or a[1] == a[4] == a[7] == True or a[2] == a[5] == a[8] == True:
    print("Yes")
elif a[0] == a[1] == a[2] == True or a[3] == a[4] == a[5] == True or a[6] == a[7] == a[8] == True:
    print("Yes")
elif a[0] == a[4] == a[8] == True or a[2] == a[4] == a[6] == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1000000007;


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    string S;
    for (int i =0 ;i < N; i++){
        cin >> S[i];
    }

    string ans ="Three";

    for (int i =0 ;i < N; i++){
        if( S[i] == 'Y' ){
            ans = "Four";
            break;
        }

    }
    cout << ans;

    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100010];
int n; 
int main()
{
	cin >> n;
	int x;
	for(int i = 1; i <= n; i++)
	{
		cin >> x;
		a[x] = i;
	}
	for(int i = 1; i <= n; i++)
	{
		if(i>1) cout << " ";
		cout << a[i];
	}
	return 0;
}

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

typedef long long ll;

int main(){
  ll n;
  ll a[200000],b[200000];

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

  ll res = 0;
  for(int k=29;k>=0;--k){
    for(int i=0;i<n;++i){
      a[i] %= 1<<(k+1);
      b[i] %= 1<<(k+1);
    }
    sort(b,b+n);

    ll z = 0;
    for(int i=0;i<n;++i){
      z += lower_bound(b,b+n,2*(1<<k)-a[i]) - lower_bound(b,b+n,(1<<k)-a[i]);
      z += lower_bound(b,b+n,4*(1<<k)-a[i]) - lower_bound(b,b+n,3*(1<<k)-a[i]);
    }
    if(z%2==1){
      res += 1<<k;
    }
  }
  cout<<res<<endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<char> S(N);
    long long count_R = 0, count_G = 0, count_B = 0;
    for (int i = 0; i < N; i++){
        cin >> S.at(i);
        if (S.at(i) == 'R') count_R ++;
        else if (S.at(i) == 'G') count_G ++;
        else if (S.at(i) == 'B') count_B ++;
    }
    long long ans;
    long long decount = 0;
    if (N > 2){
        for (int i = 0; i < N - 2; i++){
            for(int j = i + 1; j < N - 1; j++){
                if ((2 * j - i >= 0) && (2 * j - i < N) ){
                    //cout << "i " << i << " j " << j << " k " << 2*j - i << endl;
                    if ((S.at(i) != S.at(j)) && (S.at(i) != S.at(2 * j - i)) && (S.at(j) != S.at(2 * j - i))){
                        decount++;
                    }
                    else{
                        continue;
                    }
                }
                else{
                    continue;
                }
            }
        }
        ans = count_R * count_G * count_B - decount;
        //cout << count_R << " " << count_G << " " << count_B << " " << decount << endl;
    }
    else{
        ans = 0;
    }
    cout << ans << endl;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

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

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
long long int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
//↓,→,↑,←
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 

ll i,j,k,ii,jj;
ll n,m,num,sum;
ll ans;
ll a,b,c,d,e,f,g,h,w;
char s[500][500];
ll x[800005],y[800005],z[900005];
ll bit[500005];
ll bitsum(ll i){
	ll s = 0;
	while(i>0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void bitadd(ll b,ll x){
	while(b <= n+1){
		bit[b] += x;
		b += b & -b;
	}
}
int main(){	
	cin>>n>>k;
	for(i=1;i<=n;i++){
		cin>>x[i];
		x[i] -= k;
	}
	x[0] = 0;
	for(i=1;i<=n;i++){
		x[i] += x[i-1];
	}
	for(i=0;i<=n;i++){
		y[i] = x[i];
	}
	sort(y,y+n+1);
	for(i=0;i<=n;i++){
		x[i] = lb(y,y+n+1,x[i]+1) - lb(y,y+n+1,-INF);
	}
	for(i=0;i<=n;i++){
		num += bitsum(x[i]);
		bitadd(x[i],1);
	}
	p(num);
	return 0;
}

Measured memory_bytes: 15872
"use strict";

const main = arg => {
    const N = parseInt(arg.split("\n")[0].split(" ")[0]);
    const M = parseInt(arg.split("\n")[0].split(" ")[1]);
    const X = parseInt(arg.split("\n")[0].split(" ")[2]);
    const m = arg.split("\n")[1].split(" ").map(n=>parseInt(n));
    
    let rightCost = 0;
    let leftCost  = 0;
    
    for(let i=X; i<=N; i++) {
        if(m.indexOf(i) != -1) rightCost++;
    }
    
    for(let i=X; i>0; i--) {
        if(m.indexOf(i) != -1) leftCost++;
    }
    
    console.log(Math.min(rightCost, leftCost));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    A, B = in_nn()

    grid = [[''] * 100 for _ in range(100)]
    for y in range(100):
        for x in range(100):
            if 0 <= y < 50:
                grid[y][x] = '#'
            else:
                grid[y][x] = '.'

    for y in range(49):
        for x in range(100):
            if y % 2 == 0 and x % 2 == 0:
                if A > 1:
                    grid[y][x] = '.'
                    A -= 1

    for y in range(51, 100):
        for x in range(100):
            if y % 2 == 1 and x % 2 == 0:
                if B > 1:
                    grid[y][x] = '#'
                    B -= 1

    print(100, 100)
    for y in range(100):
        print(''.join(grid[y]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9360
package main

import (
	"fmt"
)

func main() {
	var n int
	var s, t string

	fmt.Scan(&n)
	fmt.Scan(&s, &t)

	ans := ""
	for i := 0; i < n; i++ {
		ans += string(s[i])
		ans += string(t[i])
	}

	fmt.Println(ans)
}


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

int main()
{
  int n;
  while(cin >> n){
    int count = 0;
    for(int a=0; a<10; a++){
      for(int b=0; b<10; b++){
	for(int c=0; c<10; c++){
	  if( 0<=n-(a+b+c) && n-(a+b+c)<10 ){
	    count++;
	  }
	}
      }
    }
    cout << count << endl;
  }
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }   

    return 0;
}

Measured memory_bytes: 3584