akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#include <list>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;
#define int ll

class MyCombination{
private:
	vector<long long> fac, ifac;
public:
	ll mpow(ll x, ll n) { //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
		ll ans = 1;
		while (n != 0) {
			if (n & 1) ans = ans * x % MOD;
			x = x * x % MOD;
			n = n >> 1;
		}
		return ans;
	}

	ll comb(ll a, ll b) { //aCbをmod計算
		if (a == 0 && b == 0)return 1;
		if (a < b || a < 0)return 0;

		ll tmp = ifac[a - b] * ifac[b] % MOD;

		return tmp * fac[a] % MOD;
	}

	MyCombination(long long SIZE = 200001) {
		fac.resize(SIZE);
		ifac.resize(SIZE);
		fac[0] = 1;
		ifac[0] = 1;
		for (ll i = 0; i < SIZE - 1; i++) {
			fac[i + 1] = fac[i] * (i + 1) % MOD; // n!(mod M)
			ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD; // k!^{M-2} (mod M) ←累乗にmpowを採用
		}
	}
};

signed main(){
    int N,K; cin >> N >> K;
    vi A(N); rep(i,N) cin >> A[i];
    MyCombination myc;
    int ans = 0;
    sort(ALL(A));
    for(int i = 0; i < N; i++){
        int N_left = i,N_right = N-i-1;
        int Lcmb,Rcmb;

        if(N_left < K-1){
            Lcmb = 0;
        }else{
            Lcmb = myc.comb(N_left,K-1);
        }
        int addMax = A[i] * Lcmb % MOD;
        addMax %= MOD;

        if(N_right < K-1){
            Rcmb = 0;
        }else{
            Rcmb = myc.comb(N_right,K-1);
        }
        int subMin = A[i] * Rcmb % MOD;
        subMin %= MOD;

        ans += addMax - subMin;
        ans %= MOD;
    }
    cout << ans << endl;
    sysp;
}

Measured memory_bytes: 7148
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N, A[500500], cnt;

void merge(int left, int mid, int right){
    int n1 = mid - left, n2 = right - mid;
    int L[n1 + 1] = {0}, R[n2 + 1] = {0};
    for(int i = 0; i < n1; i++){
        L[i] = A[left + i];
    }
    for(int i = 0; i < n2; i++){
        R[i] = A[mid + i];
    }
    L[n1] = INF;
    R[n2] = INF;
    int li = 0, ri = 0;
    for(int k = 0; k < right - left; k++){
        cnt++;
        if(L[li] <= R[ri]){
            A[left + k] = L[li];
            li++;
        }
        else {
            A[left + k] = R[ri];
            ri++;
        }
    }
}

void mergeSort(int left, int right){
    if(left + 1 < right){
        int mid = (left + right) / 2;
        mergeSort(left, mid);
        mergeSort(mid, right);
        merge(left, mid, right);
    }
}

signed main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    mergeSort(0, N);
    for(int i = 0; i < N; i++){
        cout << A[i] << ((i == N - 1) ? "\n" : " ");
    }
    cout << cnt << endl;

    return 0;
}

/*

*/


Measured memory_bytes: 6912
import heapq


def main():
    X, Y, Z, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
    q = []
    heapq.heappush(q, (-(A[0] + B[0] + C[0]), 0, 0, 0))
    pushed = set([0, 0, 0])
    for _ in range(K):
        total, a, b, c = heapq.heappop(q)
        print(-total)
        if a + 1 < X and (a+1, b, c) not in pushed:
            heapq.heappush(q, (total + A[a] - A[a+1], a+1, b, c))
            pushed.add((a+1, b, c))
        if b + 1 < Y and (a, b+1, c) not in pushed:
            heapq.heappush(q, (total + B[b] - B[b+1], a, b+1, c))
            pushed.add((a, b+1, c))
        if c + 1 < Z and (a, b, c+1) not in pushed:
            heapq.heappush(q, (total + C[c] - C[c+1], a, b, c+1))
            pushed.add((a, b, c+1))


if __name__ == "__main__":
    main()


Measured memory_bytes: 56412
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc085b
{
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力
            int a = int.Parse(Console.ReadLine());
            var list = new List<int>();
            for (var i = 0; i < a; i++){
                list.Add(int.Parse(Console.ReadLine()));
            }
            list.Sort();
            var result = list.Distinct().ToArray();
            Console.WriteLine(result.Length);
           
        }
    }
}


Measured memory_bytes: 13280
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int D[50], ss[13];
bool ctr[24];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) cin >> D[i], ss[D[i]]++;
  ss[0]++;
  rep(i, 13) {
    if (ss[i] > 2) {
      cout << 0 << "\n";
      return 0;
    }
    if ((i == 0 || i == 12) && ss[i] == 2) {
      cout << 0 << "\n";
      return 0;
    }
  }

  int m = 0;
  rep(S, 1<<12) {
    rep(i, 24) ctr[i] = false;
    ctr[0] = ss[0];
    ctr[12] = ss[12];
    for (int i=1; i<=11; i++) {
      if (ss[i] == 2) {
        ctr[i] = ctr[12+12-i] = 1;
      }
      else if (ss[i] == 1) {
        int left = (S>>i)&1;
        if (left) ctr[i] = 1;
        else ctr[12+12-i] = 1;
      }
    }
    vector<int> on;
    rep(i, 24) if (ctr[i]) on.pb(i);
    int d = 24-on.back();
    rep(i, (int)on.size()-1) {
      d = min(d, on[i+1]-on[i]);
    }
    //for (int x:on)cout<<x<<",";cout<<" -> "<<d<<"\n";
    m = max(m, d);
  }
  cout << m << "\n";
  return 0;
}


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

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

        public void Solve(ConsoleInput cin)
        {
            var T = cin.ReadDouble;
            var X = cin.ReadDouble;

            double result = T / X;

            Console.Write(result);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		BigDecimal a = new BigDecimal(sc.next());
		BigDecimal b = new BigDecimal(sc.next());
		BigDecimal c = a.multiply(b);
		BigDecimal d = c.setScale(0, RoundingMode.DOWN);
		System.out.println(d);
	}
}


Measured memory_bytes: 35964
let () =
  let a = read_int () and
      b = read_int () and
      c = read_int () and
      d = read_int () and
      p = read_int () in
  let x = a*p and
      y = if p <= c then b else b + d*(p-c) in
  Printf.printf "%d\n" (if x > y then y else x)
;;

Measured memory_bytes: 2332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n),b(n),c(n);
	rep(i,n) cin >> a.at(i) >> b.at(i) >> c.at(i);
	vector<vector<int>> dp(3,vector<int>(n+2));
	dp[0][0]=a.at(0);
	dp[1][0]=b.at(0);
	dp[2][0]=c.at(0);
	rep(i,n-1){
		dp[0][i+1]=max(dp[0][i+1],dp[1][i]+a.at(i+1));
		dp[0][i+1]=max(dp[0][i+1],dp[2][i]+a.at(i+1));
		dp[1][i+1]=max(dp[1][i+1],dp[0][i]+b.at(i+1));
		dp[1][i+1]=max(dp[1][i+1],dp[2][i]+b.at(i+1));
		dp[2][i+1]=max(dp[2][i+1],dp[1][i]+c.at(i+1));
		dp[2][i+1]=max(dp[2][i+1],dp[0][i]+c.at(i+1));
	}
	cout << max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1])) << endl;
}

Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;

class C{
    public:
        int abc[3], sign;
        C(int _a, int _b, int _c, int _sign);
};

C::C(int _a, int _b, int _c, int _sign){
    abc[0] = _a;
    abc[1] = _b;
    abc[2] = _c;
    sign = _sign;
}

int cntOK(C cls, vector<int> ok){
    int ret = 0;
    REP(i, 3){
        if(ok[cls.abc[i]] == true) ret++;
    }
    return ret;
}

int searchNG(C cls, vector<int> ok){
    REP(i, 3){
        if(ok[cls.abc[i]] == 2) return cls.abc[i];
    }
    return -1;
}

int main(){
    int x, y, z;
    while(cin >>x >>y >>z && (x && y && z)){
        int sum = x + y + z;
        vector<int> ok(sum + 1, 2);

        int n;
        cin >>n;
        vector<C> vec;
        REP(i, n){
            int a, b, c, s;
            cin >>a >>b >>c >>s;

            if(s == 0){
                C cls(a, b, c, s);
                vec.push_back(cls);
            } else{
                ok[a] = 1; ok[b] = 1; ok[c] = 1;
            }

        }

        REP(i, vec.size()){
            if(vec[i].sign == 1) continue;

            int cntok = cntOK(vec[i], ok);
            if(cntok == 2){

                ok[searchNG(vec[i], ok)] = 0;
                vec[i].sign = 1;

            }
        }
        FOR(i, 1, ok.size()) cout <<ok[i] <<endl;
    }

    return 0;
}

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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

lli gcd(lli a, lli b) {
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    lli r;
      r = a % b;

  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main() {
    lli n;
    cin >> n;
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    vector<P> xy;
    REP(i, 0, n) {
        lli xi, yi;
        cin >> xi >> yi;
        xy.push_back(P(xi, yi));
    }
    sort(xy.begin(), xy.end());
    //REP(i, 0, xy.size()) {
    //    cout << "x: " << xy[i].first << ", y: " << xy[i].second << endl;
    //}
    lli ans = LLONG_MAX;
    REP(i, 0, n) {
        REP(j, i+1, n) {
            // この(p, q)の組み合わせでのコストを出す。
            lli p = xy[j].first - xy[i].first;
            lli q = xy[j].second - xy[i].second;

            // 集合を作る
            set<P> s;
            REP(i, 0, n) {
                s.insert(P(xy[i].first, xy[i].second));
            }

            // 一個取り出す => それに (p, q) を足してあったら消す、みたいにやっていく
            lli cur_cost = 0;
            lli x = xy[i].first;
            lli y = xy[i].second;
            bool is_first = true;
            while(true) {
                if (s.empty())
                    break;
                P target = P(x, y);
                if (s.find(target) != s.end()) {
                    s.erase(target);
                    if (is_first) {
                        cur_cost++;
                        is_first = !is_first;
                    }
                    x += p;
                    y += q;
                }
                else {
                    is_first = true;
                    auto it = s.begin();
                    x = it->first;
                    y = it->second;
                }

            }
            //REP(i, 0, n) {
            //    lli x = xy[i].first;
            //    lli y = xy[i].second;
            //    P orig = P(x, y);
            //    if (s.find(orig) == s.end()) {
            //        continue;
            //    }
            //    s.erase(orig);
            //    cur_cost++;
            //    while (true) {
            //        x += p;
            //        y += q;
            //        P target = P(x, y);

            //        if (s.find(target) == s.end()) {
            //            break;
            //        }

            //        s.erase(target);
            //    }
            //}

            ans = min(ans, cur_cost);
        }
    }
    cout << ans << endl;
}


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

int main() {
  int a=0;
  int b=0;
  int c=0;
  int d=0;
  int n;
  cin>>n;
  string t;
  for(int i=0;i<n;i++){cin>>t;if(t=="AC"){a++;}
                      else if(t=="WA"){b++;}
                      else if(t=="TLE"){c++;}
                      else {d++;}}
  cout<<"AC x "<<a<<endl;
  cout<<"WA x "<<b<<endl;
  cout<<"TLE x "<<c<<endl;
  cout<<"RE x "<<d<<endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("6");
            WillReturn.Add("1 2 3 2 2 1");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("9");
            WillReturn.Add("1 2 1 2 1 2 1 2 1");
            //5
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("7");
            WillReturn.Add("1 2 3 2 1 999999999 1000000000");
            //3
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();

        int SuuretuCnt = 1;
        int KouSuu = 0;
        int PrevInt = -1;
        bool CanZouka = true;
        bool CanGensyou = true;
        foreach (int EachA in AArr) {
            bool WillCreateNewSuuretu = false;
            KouSuu++;

            if (KouSuu >= 2) {
                //前の項より大きい場合
                if (PrevInt < EachA) {
                    CanGensyou = false;
                    if (CanZouka == false) {
                        WillCreateNewSuuretu = true;
                    }
                }
                //前の項より小さい場合
                if (PrevInt > EachA) {
                    CanZouka = false;
                    if (CanGensyou == false) {
                        WillCreateNewSuuretu = true;
                    }
                }
            }

            if (WillCreateNewSuuretu) {
                SuuretuCnt++;
                CanZouka = CanGensyou = true;
                KouSuu = 1;
            }
            PrevInt = EachA;
        }
        Console.WriteLine(SuuretuCnt);
    }
}


Measured memory_bytes: 19680
#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 int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
//#define ordered_set         tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
/*

    order_of_key (k) : Number of items strictly smaller than k .
    find_by_order(k) : K-th element in a set (counting from zero).

*/
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 3e18;
vi g[N];
/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
bool vis[N];
int dp[N];
void dfs(int u)
{
    vis[u]=true;
    for(auto v:g[u])
    {
        if(!vis[v])
        {
            dfs(v);
            
        }
        dp[u]=max(dp[u],dp[v]+1);
    }
}
signed main()
{
    FastIO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        int n,m;
        cin>>n>>m;
        memset(vis,false,sizeof(vis));
        FF(i,0,m)
        {
            int x,y;
            cin>>x>>y;
            g[x].pb(y);
        }
        FF(i,1,n+1)
        {
            if(!vis[i])
            {
                dfs(i);
            }
        }
        int ans = 0;
        FF(i,1,n+1)
        {
            ans=max(ans,dp[i]);
        }
        cout<<ans<<"\n";

    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||

|| A year from now you may wish you had started today ||
*/



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

int main(){
  int n,m;
  cin >> n >> m;
  int a[n],b[n],c[m],d[m],ans[n],ans2[n];
  r(i,n){
    cin >> a[i] >> b[i];
    ans[i]=1000000000;
  }
  r(i,m){
    cin >> c[i]>>d[i];
    r(j,n){
      if(ans[j]>abs(a[j]-c[i])+abs(b[j]-d[i])){
        ans[j]=min(ans[j],abs(a[j]-c[i])+abs(b[j]-d[i]));
        ans2[j]=i+1;
      }
    }
  }
  r(i,n)cout << ans2[i]<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
  int a, b;

  scanf("%d %d", &a, &b);
  if(a < b)
    printf("a < b\n");
  else if(a > b)
    printf("a > b\n");
  else if("a == b")
    printf("a == b\n");

  return 0;
}

Measured memory_bytes: 1008
from collections import deque

h,w = map(int,input().split())
s = [input() for i in range(h)]

def bfs(i,j):
  visited = [[-1]*w for i in range(h)]
  que = deque()
  que.append([i,j])
  visited[i][j]=0
  
  while True:
    if not que:
      return -1
    
    [current_i,current_j] = que.popleft()
    
    if  current_i == h-1 and current_j == w-1:
      return visited[current_i][current_j]
  
    for next in [[-1,0],[+1,0],[0,-1],[0,+1]]:
      next_i = current_i + next[0]
      next_j = current_j + next[1]
      if 0<=next_i<h and 0<=next_j<w:
        if visited[next_i][next_j] == -1 and s[next_i][next_j]==".":
          visited[next_i][next_j] = visited[current_i][current_j]+1
          que.append([next_i,next_j])

count_point=0
for i in range(h):
  for j in range(w):
    if s[i][j] == ".":
      count_point += 1 


if bfs(0,0)==-1:
  print(-1)
else:
  print(count_point-bfs(0,0)-1)

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

int N,M,C;
int B[30];


int main()
{
	cin >> N >> M >> C;
	for(int i=0;i<M;++i) cin >> B[i];
	int ans = 0;
	for(int i=0;i<N;++i){
		int temp = 0;
		for(int j=0;j<M;++j){
			int a;
			cin >> a;
			temp += a * B[j];
		}
		if(temp+C > 0) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt(), B = scanner.nextInt(), C = scanner.nextInt(), K = scanner.nextInt();
        System.out.println(max1(A,B,C,K)?"Yes":"No");
        /*if (A>=1800) {
            System.out.println(1);
        } else if (A>=1600)
            System.out.println(2);
        else if (A>=1400)
            System.out.println(3);
        else if (A>=1200)
            System.out.println(4);
        else if (A>=1000)
            System.out.println(5);
        else if (A>=800)
            System.out.println(6);
        else if (A>=600)
            System.out.println(7);
        else if (A>=400)
            System.out.println(8);*/
    }

    private static boolean max1(int a, int b, int c, int k) {
        boolean ans = true;
        while (k>0) {
            if (b<=a) {
                b*=2;
                k--;
            } else if (c<=b) {
                c*=2;
                k--;
            }
            if (c>b&&b>a)
                break;
        }
        return c>b&&b>a;
    }

}


Measured memory_bytes: 27076
#include <bits/stdc++.h>
using namespace std;
#define NewNode (ListNode *)malloc(sizeof(ListNode))
#define Mem(a,b) memset(a,b,sizeof(a))
const int N = 4e5 + 5;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const unsigned long long mod = 998244353;
const double II = 3.1415926535;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> piil;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    ll x,sum = 100,num = 0;
    cin >> x;
    while(sum < x)
    {
        sum *= 1.01;
        num++;
    }
    cout << num << endl;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
int32_t main()
{
   fastio
   int a,b,c;
   cin>>a>>b>>c;
   int ans=min(a+b,min(b+c,c+a));
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int n;
double p[3000];
double dp[3000][3000];  // dp[i][j] = i枚目までで表がj枚出る確率

int main() {
    cin >> n;
    reps(i, n) cin >> p[i];
    dp[0][0] = 1;
    reps(i, n) repc2(j, 0, n) {
        if (j == 0)
            dp[i][j] = dp[i - 1][j] * (1 - p[i]);
        else
            dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
    }
    double ans = 0;
    repc2(i, n / 2 + 1, n) ans += dp[n][i];
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 74024
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <functional>
#include <iterator>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end())
#define PSort(x) sort(begin(x), end(x), pairCompare)
#define ll long long
#define INF 2000000000
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979

using namespace std;

int main() {
	while (1) {
		stack<char> st;
		string s;
		getline(cin, s);

		bool start = true;
		bool f = false;
		if (s == ".") {
			break;
		}

		bool judge = true;
		rep(i, 0, s.length()) {
			if (s[i] == '(' || s[i] == '[' || s[i] == ']' || s[i] == ')') {
				judge = false;
			}
		}
		if (judge) {
			cout << "yes" << endl;
			continue;
		}
		rep(i, 0, s.length()) {
			if (s[i] == '(') {
				if (start) {
					start = false;
				}
				st.push('(');
			}
			else if (s[i] == '[') {
				if (start) {
					start = false;
				}
				st.push('[');
			}
			else if (s[i] == ')') {
				if (!st.empty()) {
					if (st.top() != '(') {
						break;
					}
					else st.pop();
				}
				else {
					f = true;
					break;
				}
			}
			else if (s[i] == ']') {
				if (!st.empty()) {
					if (st.top() != '[') {
						break;
					}
					else st.pop();
				}
				else {
					f = true;
					break;
				}
			}
		}
		if (st.empty() && !f)cout << "yes" << endl;
		else cout << "no" << endl;
	}

	

	return 0;
}

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

int main(){
    ll n,m; cin >> n >> m;
    vector<ll> d; //約数全列挙
    for(ll i = 1; i*i <= m; i++){ //O(√m)
        if(m % i == 0){
            d.push_back(i);
            d.push_back(m/i);
        }
    }
    sort(d.begin(),d.end()); //O(√mlogm)
    ll ans;
    for(int i = 0; i < d.size(); i++){
        if(m/d[i] < n) break; //d[i]でmをn個以上に分割出来ればよい
        ans = d[i];
    }
    //全体はO(√mlogm)
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include <string.h>
using namespace std;

int main(){
	long long int i,j,m,n;//1 2 3 4 5  12
	char a,b;
	
	while(cin>>n){
		long long int f[n+1];
		f[0]=1;
		for(i=1;i<=n;i++){
			f[i]=f[i-1]*i%1000000007;
		}
		cout<<f[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
 
typedef long long LL;
using namespace std;
 
int n, m;
char s[105][105];
int l[105], r[105];
 
int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
 
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++){
		scanf("%s", s[i] + 1);
	}
	for (int i = 1; i <= n; i++){
		int t = 0;
		for (int j = 1; j <= m; j++){
			if(s[i][j] == '.'){
				t++;
			}
		}
		if(t == m) l[i] = 1;
	}
	for (int i = 1; i <= m; i++){
		int t = 0;
		for (int j = 1; j <= n; j++){
			if(s[j][i] == '.'){
				t++;
			}
		}
		if(t == n) r[i] = 1;
	}
	for (int i = 1; i <= n; i++){
		int flag = 0;
		for (int j = 1; j <= m; j++){
			if(l[i] || r[j]) continue;
			flag = 1;
			printf("%c", s[i][j]);
		}
		if(flag) printf("\n");
	}
 
	return 0;
}


Measured memory_bytes: 256
/*-----input blog start------//
<!-- more -->
//-----input blog end  ------*/
/*!
 * Copyright(c) 2019 Shu_Yan
 * MIT Licensed
 * Luogu: https://www.luogu.org/space/show?uid=44615
 * Github: https://github.com/shuyumo2003/
 * Gitee: https://gitee.com/Shu_Yu_Mo/
 * These words were created by an amazing tool written by Shu_Yu_Mo(Shu_Yan).
 * date: 2020-09-13 20:01:48
 * pid : 
 */
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<ctime>
#define For(x) for(int i = 1;i <= x;i++)
#define _For(x) for(int i = 0;i < x;i++)
#define LL long long
const int MOD = 1e9 + 7;
#define show(x) cerr <<"[" <<  __LINE__ << "] " << #x << " = " << x << endl;
using namespace std;
// const int _ = 1e6 + 10;
inline int read() { char c = getchar(); int sign = 1; int x = 0; while(c > '9' || c < '0') { if(c=='-')sign = -1; c = getchar(); } while(c <= '9' && c >= '0') { x *= 10; x += c - '0'; c = getchar(); } return x * sign; }
//--------------init finish line-------------------

int qp(int a,int b) {int r = 1; while(b) {if(b & 1) r = 1ll * r * a % MOD; a = 1ll * a * a % MOD; b >>= 1;} return r;}
int n;

int main()
{
    cin >> n;
    int ans = qp(10, n), k;
    k = 2ll * qp(9, n) % MOD;
    ans = (ans - k + MOD) % MOD;
    k = qp(8, n);
    ans = (ans + k) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
n,k,*a=`dd`.split.map &:to_i;a=(b=[0])+a;1.upto(a.size-1){|i|b[i]=b[i-1]+[0,a[i]].max;a[i]+=a[i-1]};p (k...a.size).map{|i|b[-1]-b[i]+b[i-k]+[a[i]-a[i-k],0].max}.max

Measured memory_bytes: 13812
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define PP pair<P,P>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	random_device rnd;
	mt19937_64 mt64(rnd());
	uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n, m, cost[114514];
vector<int>G[114514];
bool used[114514];
void dfs(int x, vector<int>& v) {
	used[x] = true;
	for (int i : G[x]) {
		if (!used[i]) {
			v.push_back(cost[i]);
			dfs(i, v);
		}
	}
}
signed main() {
	cin >> n >> m;
	rep(i, n)cin >> cost[i];
	rep(i, m) {
		int a, b; cin >> a >> b;
		G[a].push_back(b); G[b].push_back(a);
	}
	int ans = 0, cnt = 0;
	vector<int>x;
	rep(i, n) {
		if (used[i])continue;
		vector<int>v; v.push_back(cost[i]); dfs(i, v);
		cnt++;
		int mi = inf, index;
		rep(j, v.size()) {
			if (mi > v[j]) {
				mi = v[j]; index = j;
			}
		}
		ans += mi;
		v.erase(v.begin() + index);
		x.insert(x.end(), v.begin(), v.end());
	}
	sort(all(x));
	int memo = 2 * (cnt - 1) - cnt;
	if (m == n - 1) {
		cout << 0 << endl; return 0;
	}
	if (x.size() < memo) {
		cout << "Impossible" << endl; return 0;
	}
	rep(i, memo)ans += x[i];
	cout << ans << endl;
}

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

const int MOD = 1000000007;
const ll INF = 1LL<<60;

int main(){
    int N, M;
    cin >> N >> M;
    vector<ll> H(N,0);
    rep(i,N){
        cin >> H[i];
    }
    Graph G(N);
    rep(i,M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans = 0;
    rep(i,N){
        bool ok = true;
        for (auto v : G[i]){
            if (H[v] >= H[i]){
                ok = false;
                break;
            }
        }
        if (ok){
            ans++;
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 9012
import java.util.*;

public class Main {

    private static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {

        int n = in.nextInt();
        if(n== 7 || n==5 || n == 3) System.out.println("YES");
        else System.out.println("NO");

    }

    static int equalStacks(int[] h1, int[] h2, int[] h3) {
        int sum1 = sumOfArray(h1,0);
        int sum2 = sumOfArray(h2,0);
        int sum3 = sumOfArray(h3,0);

        if(sum1==sum2 && sum2==sum3) return sum1;

        int index = 0;

        while (sum1!=sum2 && sum2!=sum3) {

        }

        return 0;
    }

    static int sumOfArray(int [] a,int index) {
        int sum = 0;
        for (int i = index; i < a.length; i++) {
            sum+=a[i];
        }
        return sum;
    }

    public boolean checkInclusion(String s1, String s2) {
        int [] mainFreq = frequency(s1);
        int length = s1.length();
        for (int i = 0; i <=s2.length() - length; i++) {
            String temp = s2.substring(i,length+i);
            int [] freq = frequency(temp);
            boolean check = checkFrequencies(mainFreq,freq);
            if(check) return true;
        }
        return false;
    }

    public List<Integer> findAnagrams(String s, String p) {
        int [] mainFreq = frequency(p);
        int length = p.length();

        List<Integer> indexes = new ArrayList<>();

        for (int i = 0; i <=s.length()-length; i++) {
            String temp = s.substring(i,length+1);
            int [] freq = frequency(temp);
            if(checkFrequencies(freq,mainFreq)) indexes.add(i);
        }
        return indexes;
    }
    private static boolean checkFrequencies(int [] freqA, int [] freqB) {
        for (int i = 0; i < freqA.length; i++) {
            if(freqA[i]!=freqB[i]) return false;
        }
        return true;
    }

    private static int [] frequency(String s) {
        int [] freq = new int[26];
        for (char c:s.toCharArray()) {
            freq[c-'a']++;
        }
        return freq;
    }
    static int lowerBound(int [] a, int target) {
        int lo = 0;
        int hi = a.length - 1;
        int ans = -1;

        while (lo<=hi) {
            int med = hi - (hi-lo)/2;
            if(target == a[med]){
                ans = med;
                hi = med - 1;
            }
            else if(target < a[med])  hi = med - 1;
            else lo = med + 1;
        }
        return ans;
    }

    static int upperBound(int [] a, int target) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo<=hi) {
            int med = hi-(hi-lo)/2;
            if(target>=a[med]) lo = med + 1;
            else hi = med - 1;
        }
        return hi;
    }
    static boolean isPrime(int n) {
        if(n<=2) return false;
        for (int i = 2; i*i <=n ; i++) {
            if(n%i==0) return  false;
        }
        return  true;
    }
    static int [] readAnArray(int n) {
        int [] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }
        return  a;
    }
}



Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int n,a[3][201],dp[2][201];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			scanf("%d",&a[i][j]);
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			dp[i][j]=max(dp[i-1][j],dp[i][j-1])+a[i][j];
	printf("%d\n",dp[2][n]);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int qmin(int a, int b) {
    if (a == 0) {
        return b;
    }
    else {
        return min(a, b);
    }
}
int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    vector<int> su(n+1);
    su[0] = 0;
    for (int i = 1; i <= n; i++) {
        su[i] = su[i - 1] + l[i-1];
    }
    vector<vector<int> > a(n + 1, vector<int>(su[n]+1, -1));
    a[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= su[i - 1];j++) {
                for (int k = 0; k < i; k++) {
                    if (a[k][j] != -1) {
                        int z = max(su[i] - su[k], j);
                        a[i][z] = max(a[i][z],qmin(a[k][j], su[i]-su[k]));
                    }
                }
          }
    }
    int ans = su[n];
    for (int i = 0; i < su[n]; i++) {
        if (a[n][i] != -1) {
            ans = min(ans, i - a[n][i]);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 12732
#include<stdio.h>
int main()
{
    int a,b,i,m=0,j,k;
    scanf("%d",&a);
    for(i=0,j=2; i<10000,j<=a; i++,j+=2)
    {
        if(j%2==0)
        {
            for(k=1; k<=a; k+=2)
            {
                m++;
            }
        }
    }
    printf("%d\n",m);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll, ll>
#define pb push_back
#define rep0(i, n) for(ll i = 0;i<n;i++)
#define rep1(i, n) for(ll i = 1;i<n;i++)
#define all(v) v.begin(),v.end()
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
const int N = 1e6 + 5;

void solve(){
    int n;
    cin >> n;
    vector<int> arr(n);
    for(int i=0; i<n; i++){cin >> arr[i];}
    sort(arr.begin(), arr.end());
    int mid = n/2;
    cout << arr[mid]-arr[mid-1];
}
 
int main()
{
    fast;
    solve();
    // int t;
    // cin >> t;
    // while(t--){
    //     solve();
    // }
    return 0;
}

Measured memory_bytes: 3688
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>h(n),dp(n);
    REP(i,n){
        cin >> h[i];
        dp[i] = 1000000000000;
    }
    dp[0] = 0;
    FOR(i,0,n){
        FOR(j,1,k+1){
            //cout << i << " " << j << endl;
            if(i+j >= n)break;
            dp[i+j] = min(dp[i+j],llabs(h[i]-h[i+j])+dp[i]);
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int maxn=2*1e5+100;
int a[maxn],b[maxn],s[maxn],vl[maxn],vr[maxn];
int main()
{
    int n,t,last,ans2=0,ans1=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        s[a[i]]++,s[b[i]]--;
        vl[a[i]]++,vr[b[i]]++;
    }
    for(int i=1; i<=100000; i++)
    {
        ans2=max(s[i]=s[i-1]+s[i],ans2);
        vr[i]+=vr[i-1];
        vl[100001-i]+=vl[100002-i];
    }
    for(int i=0; i<n; i++)ans1=max(n-vl[b[i]]-vr[a[i]],ans1);
    printf("%d %d\n",ans1,ans2);
}



Measured memory_bytes: 5936
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] As = new int[9];
		for(int i=0; i<9;i++) {
			As[i]= sc.nextInt();
		}
		int b = sc.nextInt();
		ArrayList<Integer> Bs = new ArrayList<Integer>();
		for(int i=0; i<b;i++) {
			Bs.add(sc.nextInt());
		}
		boolean flag = false;
		if(Bs.contains(As[0]) && Bs.contains(As[1])&& Bs.contains(As[2])){
			flag=true;
		}else if(Bs.contains(As[3]) && Bs.contains(As[4])&& Bs.contains(As[5])){
			flag=true;
		}else if(Bs.contains(As[6]) && Bs.contains(As[7])&& Bs.contains(As[8])){
			flag=true;
		}else if(Bs.contains(As[0]) && Bs.contains(As[3])&& Bs.contains(As[6])){
			flag=true;
		}else if(Bs.contains(As[1]) && Bs.contains(As[4])&& Bs.contains(As[7])){
			flag=true;
		}else if(Bs.contains(As[2]) && Bs.contains(As[5])&& Bs.contains(As[8])){
			flag=true;
		}else if(Bs.contains(As[0]) && Bs.contains(As[4])&& Bs.contains(As[8])){
			flag=true;
		}else if(Bs.contains(As[2]) && Bs.contains(As[4])&& Bs.contains(As[6])){
			flag=true;
		}
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline
import numpy as np
from decimal import *

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n = int(input())
if n == 1:
    print(0)
else:
    arr = factorization(n)

    arr = np.array(arr)

    kazu = arr[:,1]
    sum = 0
    for i in range(1, 1000000):
        if len(kazu) ==0:
            break
        sum += len(kazu)
        kazu -= (i)
        tugi =[]
        for k in kazu:
            if k < 0:
                sum -=1
                pass
            elif k == 0:
                pass
            else:
                tugi.append(k)
        kazu = np.array(tugi)
    print(sum)


Measured memory_bytes: 27240
S = input()
K = int(input())

lst = []
b = ""
tmp = 0
rlt = 0
for s in S:
  if s == b:
    tmp += 1
  else:
    lst.append(tmp)
    tmp = 1
  b = s
    
lst.append(tmp)

if len(lst) == 2:
  rlt = (lst[1]*K)//2

elif S[0] == S[-1]:
  rlt = ((lst[1]+lst[-1])//2)*(K-1) + lst[1]//2 + lst[-1]//2
  for t in lst[2:-1]:
    rlt += (t//2)*K
else:
  for t in lst[1:]:
    rlt += (t//2)*K
    
print(rlt)


Measured memory_bytes: 61388
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> a_n = new ArrayList<Integer>();
		for(int i = 0; i < N ; i++) {
			int a_i = sc.nextInt();
			a_n.add(a_i);
		}
		int count = 0;
		for(int i = 1; i < N ; i++) {
			if(a_n.get(i-1) == a_n.get(i)) {
				a_n.set(i, 0);
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21716
#include<stdio.h>
#define M 100+1
int main(){
	int r,c;
	int i,j;
	int yoko=0;
	int tate=0;
	int a[M][M];
	
	scanf("%d %d",&r,&c);
	
	for(i=0;i<M;i++){
		for(j=0;j<M;j++){
			a[i][j] = 0;
		}
	}
	
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			scanf("%d ",&a[i][j]);
			yoko += a[i][j];
		}
		a[i][c] = yoko;
		yoko = 0;
	}
	
	for(j=0;j<c+1;j++){
		for(i=0;i<r;i++){
			tate += a[i][j];
		}
		a[r][j] = tate;
		tate = 0;
	}
	
	for(i=0;i<r+1;i++){
		for(j=0;j<c+1;j++){
			if(j==0){
				printf("%d",a[i][j]);
			}else{
				printf(" %d",a[i][j]);
			}
		}
		printf("\n");
	}
}

Measured memory_bytes: 1076
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
template <typename T>
struct UnionFind {
   vector<T> par; 
 
   UnionFind(T N) : par(N) { 
        for(T i = 0; i < N; i++) par[i] = i;
   }
 
   int root(T x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
   }
 
   void unite(T x, T y) { 
       T rx = root(x); 
       T ry = root(y); 
       if (rx == ry) return; 
       par[rx] = ry; 
   }
 
   bool same(T x, T y) { 
       T rx = root(x);
       T ry = root(y);
       return rx == ry;
   }
};
 
int main(){

    ll n,k=0;
    cin >> n;
    vector<ll> data(n);
    
    rep(i,n){
        cin >> data[i];
        chmax(k,data[i]);
    }
    sort(data.begin(),data.end());
    if(n%2==0){
        cout << data[n/2]-data[n/2-1] << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>

using namespace std;

int main() {
	string str;
	cin >> str;
	int k;
	cin >> k;
	int len = str.size();
	vector<int> n;
	for (int i = 0; i < len; i++) {
		n.push_back(str[i] - 96);
	}
	for (int i = 0; i < len; i++) {
		if (i == len - 1) {
			k = k % 26;
			n[i] += k;
			k = 0;
			if (n[i] >= 27) {
				n[i] = n[i] - 26;
			}
			break;
		}
		if (n[i] != 1 && n[i] + k > 26) {
			k -= (27 - n[i]);
			n[i] = 1;
			if (k <= 0) break;
			//cout << k << endl;
		}
		if (k <= 0) break;
	}
	string ans;
	for (auto xx : n) {
		ans.push_back(xx + 96);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1020