akhauriyash/Code-Regression huggingface dataset:
use std::io;
use std::cmp::Ordering;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn max_i32( A: i32, B: i32 ) -> i32 {
    if A > B {
        return A;
    } else {
        return B;
    }
}

fn max_vec( vec: Vec<i32> ) -> i32 {
    let max = vec.iter().fold(i32::min_value(), |max, el| if max < *el { *el } else { max } );

    return max;
}

fn main() {
    input! {
        A: i32,
        B: i32,
    }

    let vec: Vec<i32> = vec![
        A + B,
        A - B,
        A * B
    ];

    println!( "{}", max_vec( vec ) );
}


Measured memory_bytes: 4352
using System;
class ProgramC
    {
        static void Main(string[] args)
        {
            
            //入力
            long k = long.Parse(Console.ReadLine());
            long sum = 0;

            
            //i番目の最大公約数を見つける
            for(int i = 1; i <= k;i++)
                for(int j = 1; j <= k;j++)
                   for(int a = 1; a <= k;a++)
            {
                long temp = gcd((long)i,(long)j);
                temp = gcd((long)temp, (long)a);
                sum += temp;
            }
            
            Console.WriteLine(sum);
                
        }

        /*最大公約数を求める関数*/
        static long gcd(long p, long q)
        {
            if(p < q)
            {
                long temp = p;
                p = q;
                q = temp;
            }

            long r = 1;

            while(r != 0)
            {
                r = p % q;
                p = q;
                q = r;
            }

            return p;
        }
 
    }  

Measured memory_bytes: 27480
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb push_back
const int N=309;
// const ll M = 998244353;
const ll M=1e9+7;
const ll inf=1e18;

double dp[N][N][N];

int main()
{
	var(n);var(k);
	int a[n];
	int dp[k+1]={0};	
	rep(i,0,n)
	{
		scn(a[i]);
		dp[a[i]]=1;
	}
	dp[0]=0;
	for(int i=1;i<=k;i++)
	{
		int ok = 0;
		for(int j=0;j<n;j++)
		{
			int pos = i-a[j];
			if(pos>=0)
			{
				if(dp[pos]==0)
				{
					ok = 1;
					break;
				}
			}
		}
		dp[i]=ok;
	}
	if(dp[k]==1)
		printf("First\n");
	else
		printf("Second\n");

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

lli combi[55][55];

lli nCr(lli n, lli r)
{
       if(n<r) return 0;
       if(n==r) return combi[n][r] = 1;
       if(r==0) return combi[n][r] = 1;
       if(r==1) return combi[n][r] = n;
       if(combi[n][r]) return combi[n][r];
       return combi[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main() {
  lli N;
  cin >> N;
  lli ocount=0, count=0;
  
  int P;
  cin >> P;
  lli a;
  rep(i, N){
  cin>>a;
    if(a%2==0) ocount++;
    else count ++;
  }
  
  lli ans=0;
  
  if(P==0){
  rep(i, count/2+1){
  ans+=nCr(count,2*i);
  }
    rep(j, ocount){ans*=2;}
  }
  if(P==1){
  rep(i, (count+1)/2){
  ans+=nCr(count,2*i+1);
  }
    rep(j, ocount){ans*=2;}
  }
  cout <<ans << endl;
}

Measured memory_bytes: 3464
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i, n){
    int aa, bb;
    cin >> aa >> bb;
    a.at(i) = aa; b.at(i) = bb;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  double r, l;
  if(n % 2 == 1){
    l = a.at(n/2);
    r = b.at(n/2);
  }else{
    l = (double)(a.at(n/2)+a.at(n/2-1))/2;
    r = (double)(b.at(n/2)+b.at(n/2-1))/2;
  }
  int ans = 0;
  cerr << l << " " << r << endl;
  if(n % 2 == 1){
    ans = r - l + 1;
  }else{
    l *= 2; r *= 2;
    ans = r - l + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4844
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let v = read_vec::<u32>();
    let n = v[0];
    let k = v[1];
    let ans = if n % k == 0 {
        0
    } else { 1 };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#encoding:utf-8 No.0522 2014.12.11
while gets
  str = $_.chomp.split("")
  cnt_joi = 0
  cnt_ioi = 0
  i = 0

  while i < str.length
    if str[i] == "J" && str[i+1] == "O" && str[i+2] == "I"
      cnt_joi += 1
    end

    if str[i] == "I" && str[i+1] == "O" && str[i+2] == "I"
      cnt_ioi += 1
    end

    i += 1
  end

  puts cnt_joi
  puts cnt_ioi
end

Measured memory_bytes: 6176
#include <iostream>

using namespace std;
using int64 = long long;

int main() {
    int64 a,b,c;
    cin >> a >> b >> c;
    
    int64 ans = LONG_MAX;
    ans = min(ans, abs(a*b*(c/2) - a*b*((c+1)/2)));
    ans = min(ans, abs(a*c*(b/2) - a*c*((b+1)/2)));
    ans = min(ans, abs(b*c*(a/2) - b*c*((a+1)/2)));
    cout << ans << endl;
    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() {
  string s, t;
  cin >> s >> t;
  
  rep(i, (int)s.size()){
    if(s[i] != t[i]){
      cout << "No" << endl;
      return 0; 
    }
  }

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

Measured memory_bytes: 3596
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    vector<lint> zero(60);
    vector<lint> one(60);
    
    int n;cin>>n;
    lint x,tmp,ans=0;
    for(int i=0;i<n;i++){
        cin>>x;
        for(int j=0;j<60;j++){
            tmp=x%2;
            if(tmp==0)zero[j]++;
            else one[j]++;
            x/=2;
        }
    }
    const int mod=1000000007;
    tmp=1;
    for(int i=0;i<60;i++){
        ans+=(zero[i]*one[i]%mod)*tmp;
        ans%=mod;
        tmp=tmp*2%mod;
    }
    cout<<ans<<endl;
}


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
	ll n;
	cin>>n;
	Array a(n);
	map<ll,ll> mp,mp2;
	REP(i,n){
		cin>>a[i];
		mp[a[i]]++;
	}
	mp2=mp;
	ll max_a=1010101;
	for(auto i:mp){
		
		for(ll j=2;j*i.first<max_a;j++){
			if(mp2.find(i.first*j)!=mp2.end()){
				mp2.erase(i.first*j);
			}
		}
	}

	ll con=0;
	for(auto i:mp2){
		//cout<<i.first<<en;
		if(i.second>1) continue;
		con+=i.second;
	}
	cout<<con<<en;
}

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

	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 29760
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

/*全てのライブラリをインクルード*/
#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()
{
    ll n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n <= k)
    {
        cout << n * x << endl;
    }
    else
    {
        cout << k * x + (n - k) * y << endl;
    }
    return 0;
}

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

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

    for(char c = 'a'; c <= 'z'; c++) {
        bool b = false;
        for(int i=0; i < s.size(); i++) {
            if(s[i] == c) {
                b = true;
                break;
            }
        }
        if(!b) {
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


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

int main(){
    int n, wt;
    cin>>n>>wt;
    vector<ll> w(n), v(n);
    vector<vector<ll>> dp(n+1, vector<ll>(wt+1, 0));
    rep(i, n)
        cin>>w[i]>>v[i];
    rep1(i, 1, n+1){
        rep1(j, 1, wt+1){
            if(j>=w[i-1]){
                // if(i==3&&j==3)
                //     cout<<v[i-1]+dp[i-1][j-w[i-1]]<<" "<<dp[i-1][j]<<endl;
                dp[i][j] = max(v[i-1]+dp[i-1][j-w[i-1]], dp[i-1][j]);
            }
            else dp[i][j] = dp[i-1][j];
            // cout<<dp[i][j]<< " ";
        }
        // cout<<endl;
    }
    cout<<dp[n][wt]<<endl;
}

Measured memory_bytes: 80256
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main() {
	ll k, a, b;
	cin >> k >> a >> b;
	if (k <= a) {
		cout << 1 << endl;
		return 0;
	}
	else if (a <= b) {
		cout << -1 << endl;
		return 0;
	}
	else {
		ll m = (k - a) / (a - b);
		while ((a - b) * m + a < k) {
			m++;
		}
		cout << 2 * m + 1 << endl;
	}
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

s = INT()
ans = 4
while not (s == 4 or s == 2 or s == 1):
    if s % 2 == 0:
        s //= 2
    else:
        s = s * 3 + 1
    ans += 1
print(ans)

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

#define      ll      long long int

const int N = 300005;
int east[N];
int west[N];

int main( )
{
    int n, i, j, k, l;
    string s;
    cin >> n >> s;
    l = (int) s.size();
    s = "@" + s;
    for (i = 1; i <= n; i++) {
        west[i] += west[i - 1];
        if (s[i] == 'W') {
            west[i]++;
        }
    }
    for (i = n; i >= 1; i--) {
        east[i] += east[i + 1];
        if (s[i] == 'E') {
            east[i]++;
        }
    }
    int mn = 1e9;
    for (i = 1; i <= n; i++) {
        mn = min(mn, west[i - 1] + east[i + 1]);
    }
    cout << mn << '\n';
    return 0;
}



Measured memory_bytes: 3040
#"""
import sys
input = sys.stdin.readline
#"""

N,T = map(int,input().split())
AB = [list(map(int,input().split())) for _ in [0]*N]

dp = [[0 for _ in [0]*T] for _ in [0]*(N+1)]

for i in range(N):
    a,b = AB[i]
    for t in range(T):
        dp[i+1][t] = dp[i][t]
        if t-a>=0:
            dp[i+1][t] = max(dp[i+1][t],dp[i][t-a]+b)

s = []
t = T-1
for j in range(N-1,-1,-1):
    a,b = AB[j]
    while (dp[j+1][t] == dp[j+1][t-1]) and t>0:
        t -= 1
    if dp[j+1][t] == dp[j][t]:
        pass
    else:
        t -= a
        s.append(j)

ans0 = dp[N][-1]
ans = ans0
for i in range(N):
    if s and i==s[-1] :
        s.pop()
        continue
    ans = max(ans,ans0+AB[i][1])
print(ans)

Measured memory_bytes: 122460
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

#define REP(i,m,M) for(int i=m; i<M; i++)
#define REPR(i,M,m) for(int i=M; i>m; i—-)
#define REPLL(i,m,M) for(ll i=m; i<M; i++)
#define REPLLR(i,M,m) for(ll i=M; i>m; i—-)
#define ALL(v) v.begin(),v.end()


int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    ll a[200000];
    REP(i, 0, n){
        cin >> a[i];
    }
    
    if(n%2==0){
        for(int i=n; i>0; i-=2){
            cout << a[i-1] << " ";
        }
        for(int i=1; i<n; i+=2){
            cout << a[i-1] << " ";
        }
        cout << endl;
    }else{
        for(int i=n; i>0; i-=2){
            cout << a[i-1] << " ";
        }
        for(int i=2; i<n; i+=2){
            cout << a[i-1] << " ";
        }
        cout << endl;
    }

    
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  int h,w;
  cin>>h>>w;
  string masu[h];
  for(int i=0;i<h;i++){
    cin>>masu[i];
  }
  bool yoko[h],tate[w];
  for(int i=0;i<h;i++) yoko[i]=true;
  for(int i=0;i<w;i++) tate[i]=true;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(masu[i][j]=='#'){
        yoko[i]=false;
        tate[j]=false;
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(!yoko[i] and !tate[j])cout<<masu[i][j];
    }
    cout<<endl;
  }
  return 0;
}


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

int main() {
	int n; cin >> n;
	int arr[n];
	map<int, int> index;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		index[arr[i]] = i;
	}
	sort(arr, arr+n);

	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += (i%2 != index[arr[i]]%2);
	}
	cout << ans/2 << '\n';
}


Measured memory_bytes: 5376
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define MKP make_pair
 
const int N=6e2+5;
int n,D1,D2,lim,qaq1,qaq2;
int col1[N][N],col2[N][N],vis[N][N],set[N][N],flag[N*N];
vector <pair <int,int> > T1,T2;
vector <pair <int,int> > G[N][N]; 
 
template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}
 
void dfs1(int x,int y,int now,int cnt) {
	col1[x][y]=now,set[x][y]=cnt,(now==1)?++qaq1:++qaq2;
	for(pair <int,int> v:G[x][y])
		if(!col1[v.first][v.second]) dfs1(v.first,v.second,3-now,cnt);
}
void dfs2(int x,int y,int now,int cnt) {
	col2[x][y]=now,set[x][y]=cnt,(now==1)?++qaq1:++qaq2;
	for(pair <int,int> v:G[x][y])
		if(!col2[v.first][v.second]) dfs2(v.first,v.second,3-now,cnt);
}
 
inline bool check(int x,int y) {return (x>0&&y>0&&x<=lim&&y<=lim);}
int main() {
	IN(n),IN(D1),IN(D2),lim=n<<1;
	for(int i=0;i<=lim;++i)
		for(int j=0;j<=lim;++j) {
			if(i*i+j*j==D1) T1.push_back(MKP(i,j));
			if(i*i+j*j==D2) T2.push_back(MKP(i,j));
		}
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y)
			for(pair <int,int> now:T1) {
				int dx=now.first,dy=now.second;
				if(check(x+dx,y+dy)) G[x][y].push_back(MKP(x+dx,y+dy));
				if(check(x-dx,y+dy)) G[x][y].push_back(MKP(x-dx,y+dy));
				if(check(x+dx,y-dy)) G[x][y].push_back(MKP(x+dx,y-dy));
				if(check(x-dx,y-dy)) G[x][y].push_back(MKP(x-dx,y-dy));
			}
	int cnt=0;
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y) if(!col1[x][y]) {
			qaq1=0,qaq2=0,dfs1(x,y,1,++cnt);
			if(qaq1<qaq2) swap(qaq1,qaq2),flag[cnt]=true;
		}
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y)
			if(flag[set[x][y]]) col1[x][y]=3-col1[x][y];
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y)
			G[x][y].clear();
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y)
			for(pair <int,int> now:T2) {
				int dx=now.first,dy=now.second;
				if(check(x+dx,y+dy)) G[x][y].push_back(MKP(x+dx,y+dy));
				if(check(x-dx,y+dy)) G[x][y].push_back(MKP(x-dx,y+dy));
				if(check(x+dx,y-dy)) G[x][y].push_back(MKP(x+dx,y-dy));
				if(check(x-dx,y-dy)) G[x][y].push_back(MKP(x-dx,y-dy));
			}
	cnt=0;
	memset(set,0,sizeof(set)),
	memset(flag,0,sizeof(flag));
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y) if(!col2[x][y]) {
			qaq1=0,qaq2=0,dfs2(x,y,1,++cnt);
			if(qaq1<qaq2) swap(qaq1,qaq2),flag[cnt]=true;
		}
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y)
			if(flag[set[x][y]]) col2[x][y]=3-col2[x][y];
	cnt=0;
	for(int x=1;x<=lim;++x)
		for(int y=1;y<=lim;++y)
			if(col1[x][y]==col2[x][y]&&col2[x][y]==1) {
				printf("%d %d\n",x-1,y-1),++cnt;
				if(cnt>=n*n) return 0;
			}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  int mil=N/1000;
  int cent=(N%1000)/100;
  int dec=(N%100)/10;
  int uno=N%10;

  if(mil==cent and cent==dec or cent==dec and dec==uno){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
'use strict';

Array.prototype._sort = Array.prototype.sort;
Array.prototype.sort = function(fn) {
	if (fn) {
		return this._sort(fn);
		
	} else if (typeof this[0] === 'number') {
		return this._sort((a, b) => a - b);

	} else {
		return this._sort();
	}
};

const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const N = Number(lines[0]);
const L = lines[1].split(' ').map(Number);

let result = L.sort().reduce((s, v, i) => {
	if ((i & 1) === 0) {
		s += v;
	}
	
	return s;
}, 0);

console.log(result);

Measured memory_bytes: 7032
date = input()
year = date[:4]
month = date[5:7]
if int(year) < 2019:
        print("Heisei")
elif int(year)==2019:
    if month == "04":
        print("Heisei")
    elif month == "03":
        print("Heisei")
    elif month == "02":
        print("Heisei")
    elif month == "01":
        print("Heisei")
    else:
        print("TBD")
else:
        print("TBD")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,kai=0,hako[100][100];
    cin >> n;
    for(int i=0;i<n;i++){
        for(int m=0;m<2;m++){
            cin >> hako[i][m];
        }
    }
    for(int i=0;i<n;i++){
        for(int m=0;m<1;m++){
            if(hako[i][m]==hako[i][m+1]){
                kai++;
            }else if(kai>=3){
                cout << "Yes";
                return 0;         
            }else{
                kai=0;
            }
        }
    }
    if(kai>=3){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;

}

Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=1000000000;i++){
        int c=i*0.08;
        int d=i*0.1;
        if(c==a&&d==b){
            cout<<i<<"\n";
            return(0);
        }
    }
    cout<<"-1\n";
    return(0);
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(b-a==c-b) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >>s;
  long long int k=1;
  string ii;
  ii=s.substr(0,1);
  for(long long int i=1;i<s.size();i++){
    bool out=true;
    for(long long int j=1;j<s.size()-i+1;j++){
      if(ii!=s.substr(i,j)){
        ii=s.substr(i,j);
        k++;
        out=false;
        i+=(j-1);
        cerr << ii <<endl;
        break; 
      }
    }
    if(out)break;
  }
  cout << k<<endl;
}

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

int main() {
	int n, ans = 0;
	string s;
	cin >> n >> s;
	int A = 0, B = 0, t;
	for (int i = 1; i < n; i++) {
		int cnt = 0;
		string s1 = s.substr(0, i);
		string s2 = s.substr(i);
		for (char c = 'a'; c <= 'z'; c++) {
			bool f = false, s = false;
			for (int j = 0; j < s1.length(); j++) {
				if (s1[j] == c)f = true;
			}
			for (int j = 0; j < s2.length(); j++) {
				if (s2[j] == c)s = true;
			}
			if (f && s)cnt++;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

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

using namespace std;

#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll) 1 << 62;
const ll MOD = 1000000007, INF = 1e18;

template<typename T1, typename T2>
bool pairCompare(const pair<T1, T2> &firstElof, const pair<T1, T2> &secondElof) {
    return firstElof.second > secondElof.second;
}

int mapMaxValue(std::map<ll, int> m) {
    int max = 0;
    for (std::map<ll, int>::iterator it = m.begin(); it != m.end(); it++) {
        if (max < it->second) max = it->second;
    }
    return max;
}

int main(void) {
    ll n;
    cin >> n;
    ll ans = 1;
    ans += (n + 1) * (n - 2) / 2LL;
    cout << ans << endl;
}

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

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

/*
   0 1 2
B: 2 5
A: 2 


*/

int ans;
int N;
int A[105], B[105];

int main(void) {
    scanf("%d", &N);
    REP(i, 0, N-1) scanf("%d", &B[i]);

    A[0] = B[0];
    REP(i, 1, N-1) A[i] = min(B[i], B[i-1]);
    A[N-1] = B[N-2];

    REP(i, 0, N) ans += A[i];
   

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

	return 0;
}


Measured memory_bytes: 256
# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)

h = {}
0.upto(n - 1) do |i|
  h[a[i]] = i + 1
end

b = []
1.upto(n) do |i|
  b.push h[i]
end
puts b.join(' ')


Measured memory_bytes: 19136
N, M = map(int, input().split())
B = [None] * M
for i in range(M):
    ks = list(map(int, input().split()))
    B[i] = [s - 1 for s in ks[1:]]
p = list(map(int, input().split()))

ans = 0
bit = 0
for bit in range(1 << N):
    for i, b in enumerate(B):
        if p[i] != (len([1 for s in b if bit & (1 << s)]) % 2):
            break
    else:
        ans += 1
print(ans)

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

using namespace std;

const int MOD = 1e9+7;

typedef unsigned long long ull;

ull bits0[65];
ull bits1[65];

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    ull x;
    for(int i=0;i<n;++i){
        cin >> x;
        for(int j=0;j<63;++j)
            if((x & (1LL<<j)) != 0)
                bits1[j]++;
            else
                bits0[j]++;            
    }

    ull sol = 0;
    for(int i=0;i<63;++i)
        sol = (sol + (1LL << i) % MOD * bits0[i] % MOD * bits1[i] % MOD) % MOD;
    
    cout << sol << '\n';

    return 0;
}

Measured memory_bytes: 384
// #include <bits/stdc++.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
constexpr ll MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int K, S, c123 = 0, c112 = 0, c122 = 0, c111 = 0;
	cin >> K >> S;
	for (int x = 0; x <= K; x++)
	{
		if (x + 0 + 0 > S) break;
		if (x + K + K < S) continue;
		for (int y = 0; y < x; y++)
		{
			if (x + y + 0 > S) break;
			if (x + y + K < S) continue;
			for (int z = 0; z < y; z++)
			{
				if (x + y + z > S) break;
				if (x + y + z == S) c123++;
			}
		}
	}
	for (int x = 0; x <= K; x++)
	{
		if (x + x + 0 > S) break;
		if (x + x + K < S) continue;
		for (int z = 0; z < x; z++)
		{
			if (x + x + z > S) break;
			if (x + x + z == S) c112++;
		}
	}
	for (int x = 0; x <= K; x++)
	{
		if (x + 0 + 0 > S) break;
		if (x + K + K < S) continue;
		for (int z = 0; z < x; z++)
		{
			if (x + z + z > S) break;
			if (x + z + z == S) c122++;
		}
	}
	for (int x = 0; x <= K; x++)
	{
		if (x + x + x > S) break;
		if (x + x + x == S) c111++;
	}
	cout << c123 * 6 + c112 * 3 + c122 * 3 + c111 << endl;
	cout << flush;
	return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np

if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC
    cc = CC('my_module')

    @cc.export('is_ok', '(u8[:],u8[:],u8,u8)')
    def is_ok(A, F, x, k):
        tmp = 0
        for a, f in zip(A, F):
            y = a * f
            if y > x:
                tmp += a - x // f
        return tmp <= k

    cc.compile()
    exit()

from my_module import is_ok

n, k = map(int, input().split())
A = np.array(input().split(), dtype=np.uint64)
F = np.array(input().split(), dtype=np.uint64)

A = np.sort(A)
F = np.sort(F)[::-1]

ok = 2 * (10 ** 12)
ng = -1
while ok - ng > 1:
    mid = (ok + ng) // 2
    if is_ok(A, F, mid, k):
        ok = mid
    else:
        ng = mid

print(ok)



Measured memory_bytes: 51848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    ll a[n];
    rep(0,i,n){
        cin>>a[i];
        if(a[i]==0){
            cout<<0;
            return 0;
        }
    }
    ll ans=1;
    rep(0,i,n){
        if(ans>(ll)1e18/a[i]){
            cout<<-1;
            return 0;
        }
        ans*=a[i];
    }
    cout<<ans;
}

Measured memory_bytes: 4376
import java.util.Scanner;
public class Main {
	static long []fac;
	static long []finv;
	static long []inv;
	
	static int mod = 1000000007;
	static int n,a,b;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		n = Integer.parseInt(sc.next());
		
		a = Integer.parseInt(sc.next());
		b = Integer.parseInt(sc.next());
		
		fac = new long [501001];
		finv = new long[501001];
		inv = new long [501001];
		
		COMinit();
		
		
		long ans = Modpow(2L,n) -1;
		
		long aa = 1L;
		long bb = 1L;
		
		for(int i = n ; i >= n - a + 1 ; i--) {
			aa *= i;
			aa %= mod;
		}
		
		for(int i = n ; i >= n - b +1 ; i--) {
			bb *= i;
			bb %= mod;
		}
		
		aa = aa * finv[a] % mod;
		bb = bb * finv[b] % mod;
		
		ans = ans - aa - bb;
		
		ans += 2 * mod;
		
		ans = ans % mod;
		
		System.out.println(ans);

	}
	public static void COMinit() {
	    fac[0] = fac[1] = 1;
	    finv[0] = finv[1] = 1;
	    inv[1] = 1;
	    for (int i = 2; i <= 500001; i++){
	        fac[i] = fac[i - 1] * i % mod;
	        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
	        finv[i] = finv[i - 1] * inv[i] % mod;
	    }
	}

	// 二項係数計算
	public static long COM(int k){
	    if (n < k) return 0;
	    if (n < 0 || k < 0) return 0;
	    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
	}

	//a^n mod
	public static long Modpow(long a, long n) {
		long res = 1;
		while(n > 0) {
			if((n & 1) == 1) {
				res = res * a % mod;
			}
			a = a * a % mod;
			n >>= 1;
		}
		return res;
	}
	



}


Measured memory_bytes: 36052
#pragma region template 1.0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

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

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<string> A(N);
    REP(i, N)
    {
        cin >> A[i];
    }
    vector<string> B(M);
    REP(i, M)
    {
        cin >> B[i];
    }

    string ans = "No";
    REP(i, N - M + 1)
    {
        REP(j, N - M + 1)
        {
            bool ok = true;
            REP(u, M)
            {
                REP(v, M)
                {
                    ok &= A[i + u][j + v] == B[u][v];
                }
            }
            if (ok)
            {
                ans = "Yes";
            }
        }
    }
    OUT(ans);
}
#pragma endregion template

Measured memory_bytes: 256
N, W = map(int, input().split())
goods = []
for _ in range(N):
    v, w = map(int, input().split())
    goods.append((v, w))

# i個目までの品物から重さがwを超えないように選んだ時の価値の最大値
dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(N):
    v, w = goods[i]
    for j in range(W + 1):
        if w <= j:
            dp[i+1][j] = max(dp[i][j-w] + v, dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[N][W])



Measured memory_bytes: 41856
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

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

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int a;
    cin >> n >> a;
    int c = 0;
    REP(i,n-1){
      int b;
      cin >> b;
      //cout << a << b << endl;
      if(c<a)a--;
      if(a>b){
        cout << "No" << endl;
        return 0;
      }
      c = a;
      a = b;
    }
    cout << "Yes" << endl;
}

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

int main(){
  vector<vector<int> > g(3, vector<int>(3));
  int n;
  vector<int> b(n);
  
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>g[i][j];
    }
  }
  cin>>n;
  for(int i=0;i<n;i++)cin>>b[i];
  
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<n;k++){
        if(g[i][j]==b[k]){
          g[i][j]=0;
        }
      }
    }
  }
  
  bool ok=false;
  for(int i=0;i<3;i++){
    if(!(g[i][0]||g[i][1]||g[i][2])){
      ok = true;
    }
  }
  for(int j=0;j<3;j++){
    if(!(g[0][j]||g[1][j]||g[2][j])){
      ok=true;
    }
  }
  
  if(!(g[0][0]||g[1][1]||g[2][2]))ok=true;
  if(!(g[2][0]||g[1][1]||g[0][2]))ok=true;
  if(ok){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

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

using namespace std;

int main() {
  int i = 1;
  for(int j=0; j<5; j++) {
  	int a;
    scanf("%d", &a);
    if(a == 0) {
    	printf("%d", i);
      	exit(0);
    }
    i++;
  }
  return 0;  
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int K;
  cin >> K;
  int Q;
  cin >> Q;
  vector<int> Point(N);
  for(int i = 0; i < N; i++){
  Point.at(i) = K-Q;
  }
  vector<int> add_Point(Q);
  for(int j = 0; j < Q; j++){
  cin >> add_Point.at(j);
  }
  for(int k = 0; k < Q; k++){
  Point.at(add_Point.at(k) - 1) =  Point.at(add_Point.at(k) - 1) + 1;
  }
  for(int m = 0; m < N; m++){
  if(Point.at(m)<=0){ cout << "No" << endl;}
    else{ cout << "Yes" << endl;}
  }
}

Measured memory_bytes: 1408
n= int(input().strip())
a= list(map(int, input().strip().split()))
x=0
A=0

for i in range(n):
    A+=a[i]
x=0
for i in range(n):
    x+=a[i]*(A-a[i])
x=x//2
x=x%(10**9+7)
print(x)

Measured memory_bytes: 94260
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
   int n,k;
   cin>>n>>k;
   vector<int>h(n);
   rep(i,n)cin>>h[i];
   sort(h.begin(),h.end());
   int ans=INF;
   for(int i=0;i+k<=n;i++){
       ans=min(abs(h[k+i-1]-h[i]),ans);
   }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    bool one = false;
    for (int i = 0; i < n; ++i) {
        char c;
        std::cin >> c;
        a[i] = c - '0' - 1;
        if (a[i] == 1)
            one = true;
    }
    if (one)
        for (int i = 0; i < n; ++i)
            a[i] %= 2;
    int ans = 0;
    for (int i = 0; i < n; ++i)
        if (((n - 1) & i) == i)
            ans ^= a[i];
    std::cout << ans << "\n";
    return 0;
}

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

int main() {
    int n,h,w; cin>>n>>h>>w;
    int count=0;
    for(int i=0;i<n;i++)
    {
        int h1,w1;
        cin>>h1>>w1;
        if(h1>=h && w1>=w)
        count++;
    }
    cout<<count<<endl;
    
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		int t = sc.nextInt();
		
		sc.close();
		
		if(x-t>0) {
			System.out.println(x-t);
		}else {
			System.out.println(0);
		}

	}

}


Measured memory_bytes: 35500
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n) for (int i = ((int)(n) - 1); i >= 0; --i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()

#define left left___
#define right right__

void solve (int n)
{
    vi d(n);
    forn (i, n)
        cin >> d[i];

    sort(all(d));
    int m;
    cin >> m;
    vi t(m);
    forn (i, m)
        cin >> t[i];
    sort(all(t));

    int ptr = 0;
    forn (i, m)
    {
        if (ptr == n)
        {
            cout << "NO" << endl;
            return;
        }

        while (ptr < n && d[ptr] < t[i])
            ptr++;

        if (ptr == n || d[ptr] != t[i])
        {
            cout << "NO" << endl;
            return;
        }
        ptr++;
    }

    cout << "YES" << endl;
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    while (cin >> n)
        solve(n);
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
  char n[5];
  cin >> n;

  if (n[0] == n[1] && n[1] == n[2]) {
    cout << "Yes" << '\n';
  } else if (n[1] == n[2] && n[2] == n[3]) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
}

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

#define ll long long int
#define ull unsigned long long int
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


using namespace std;

const int INF = 1e9 + 7;
const int N = 1e5+5;

int main() {

	IO; 
	
	string s;
  	cin >> s;
  	int ans = 0, temp = 0;
  	for (int i = 0; i < (int) s.size(); ++i) {
      if (s[i] == 'R') {
        temp++;
      }
      else {
		ans = max(ans, temp);
		temp = 0;
	  }
    }
    ans = max(ans, temp);
	cout << ans;
	

}


Measured memory_bytes: 3652
import scala.math.sqrt

object Main{
  def main(args: Array[String]){
    val input=io.Source.stdin.getLines().mkString("\n")
    println(solve(input).trim())
  }

  def solve(input:String):String={
    val n=input.toInt
    Range(1, 100000).toList.map{v=>v*v}.takeWhile(_<=n).last.toString
  }
}


Measured memory_bytes: 37424
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define int long long
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
int i[111100];
bool ii[11111];
int u;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=1,h=2,j;
  string s,w;
  cin >>s;
  if(s.size()==3){
    cout <<s[2]<<s[1]<<s[0]<<'\n';
  }
  else cout <<s<<'\n';
  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);
        int n = sc.nextInt();
        int count = 0;

        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                if (n == i * j) {
                    count++;
                }
            }
        }
        if (count >= 1) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 35780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class Main {
	private	static	BufferedReader		br    = null;
	private	static	ArrayList<Integer>	listA = null;
	private	static	ArrayList<Integer>	listB = null;

	static {
		br    = new BufferedReader(new InputStreamReader(System.in));
		listA = new ArrayList<Integer>();
		listB = new ArrayList<Integer>();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		while (paramNum() != -1) {
			int	nH = 0;
			int	nB = 0;
			for (int n = 0; n < 4; n++) {
				int i = listA.indexOf(listB.get(n));
				if (i != -1) {
					if (i == n) {
						nH++;
					}
					else {
						nB++;
					}
				}
			}
			System.out.printf("%d %d\n", nH, nB);
		}
	}

	private static int paramNum() {
		int		nRet  = 0;
		String	strIn = null;

		for (int n = 0; n < 2; n++) {
			if ((strIn = parseStdin()) == null) {
				nRet = -1;
				break;
			}

			String[]	aN = strIn.split(" ");
			if (n == 0) {
				listA.clear();
				listA.add(Integer.parseInt(aN[0]));
				listA.add(Integer.parseInt(aN[1]));
				listA.add(Integer.parseInt(aN[2]));
				listA.add(Integer.parseInt(aN[3]));
			} else {
				listB.clear();
				listB.add(Integer.parseInt(aN[0]));
				listB.add(Integer.parseInt(aN[1]));
				listB.add(Integer.parseInt(aN[2]));
				listB.add(Integer.parseInt(aN[3]));
			}
		}
		
		return nRet;
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

Measured memory_bytes: 16940
#include <stdio.h>

int main() {
  int n, cn;
  char c;
  char x[10] = {'w', 0, 'k', 's', 't', 'n', 'h', 'm', 'y', 'r'};
  char f[5] = {'a', 'i', 'u', 'e', 'o'};

  while(scanf("%d %c", &n, &c) != EOF) {
    if(c == 'T') cn = 0;
    else if(c == 'L') cn = 1;
    else if(c == 'U') cn = 2;
    else if(c == 'R') cn = 3;
    else cn = 4;

    if(n == 0 && cn == 2) printf("nn");
    else if(x[n] == 0) printf("%c", f[cn]);
    else printf("%c%c", x[n], f[cn]);
  }

  printf("\n");

  return 0;
}

Measured memory_bytes: 604