akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace AtCoderTutorial
{
    public class AtCoder176
    {
        public static void Main(string[] args)
        {
//            long[] HW = Console.ReadLine().Split(' ').Select(_ => long.Parse(_)).ToArray();
//            long[] C = Console.ReadLine().Split(' ').Select(_ => long.Parse(_)).ToArray();
//            long[] D = Console.ReadLine().Split(' ').Select(_ => long.Parse(_)).ToArray();

            string S = Console.ReadLine();
            string T = Console.ReadLine();
            int maxMatchNum = 0;

            if (S.Contains(T))
            {
                maxMatchNum = T.Length;
            }

            for (int i = 0; i <= S.Length - T.Length; i++)
            {
                int matchNum = 0;
                char[] subS = S.Substring(i, T.Length).ToCharArray();
                char[] charT = T.ToCharArray();
                for (int j = 0; j < subS.Length; j++)
                {
                    if (subS[j] == charT[j])
                    {
                        matchNum++;
                    }
                }

                if (matchNum > maxMatchNum)
                {
                    maxMatchNum = matchNum;
                }
            }

            Console.WriteLine(T.Length - maxMatchNum);
        }
    }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

template<int mod> struct ModInt {
    int64_t x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (y % mod + mod) % mod) {}

    ModInt &operator+=(const ModInt &a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &a) {
        x = 1LL * x * a.x % mod;
        return *this;
    }

    ModInt &operator/=(const ModInt &a) {
        *this *= a.inverse();
        return *this;
    }

    ModInt operator-() const {
        return ModInt(-x);
    }

    ModInt operator+(const ModInt a) const {
        return ModInt(*this) += a;
    }

    ModInt operator-(const ModInt a) const {
        return ModInt(*this) -= a;
    }

    ModInt operator*(const ModInt a) const {
        return ModInt(*this) *= a;
    }

    ModInt operator/(const ModInt a) const {
        return ModInt(*this) /= a;
    }

    bool operator==(const ModInt a) const {
        return x == a.x;
    }

    bool operator!=(const ModInt a) const {
        return x != a.x;
    }

    ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while (k > 0) {
            if (k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }

    ModInt inverse() const {
        return pow(mod - 2);
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};

const int MOD = 998244353;
using modint = ModInt<MOD>;

const int MAX = 3030;

int N, S;
int A[MAX];

modint dp[MAX][MAX];

modint solve() {
    dp[0][0] = modint(1);
    REP (i, N) {
        REP (s, S+1) {
            dp[i+1][s] += modint(2) * dp[i][s];
            if (s+A[i] <= S) {
                dp[i+1][s+A[i]] += dp[i][s];
            }
        }
    }
    return dp[N][S];
}

int main() {
    cout << fixed << setprecision(15);
    cin >> N >> S;
    REP (i, N) cin >> A[i];
    cout << solve() << endl;
}

Measured memory_bytes: 75352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main()
{
  ll n;
  cin>>n;
  string ans="";
  
  while(n>0)
  {
    ll k=n/26;
    ll l=n%26;

    if(l==0)
    {
      k--;
      ans+=(char)('z');
    }
    else
      ans+=(char)('a'+ l-1);

    n=k;
    
  }
  reverse(ans.begin(),ans.end());
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3652
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	for(auto&&x:a) std::cin >> x;
	const int INF = 1e18;
	// dp[l][r] min cost it takes to get this slime
	// use recursion
	std::vector<int> ac(n+1,0);
	rep(i,n) ac[i+1] = ac[i] + a[i];
	std::vector<std::vector<int> > dp(n,std::vector<int>(n,0));
	auto g = [&] (auto f, int l, int r) -> int {
		if(dp[l][r]!=0) return dp[l][r];
		if(l==r) return 0;
		int min = INF;
		for(int x = l;x<r;x++) {
			min = std::min(min, f(f,l,x)+f(f,x+1,r)+ac[r+1]-ac[l]);
		}
		return dp[l][r] = min;
	};
	print(g(g,0,n-1));
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    bool ans = false;
    [&]{
        for(int i = 1; i <= 9; ++i) {
            for(int j = 1; j <= 9; ++j) {
                if(i*j==n) {
                    ans = true;
                    return;
                }
            }
        }
    }();
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

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

using std::vector;
vector<int> ppp[26];

char str[200010];
int dy[200010];
int next[200010][26];
int go(int idx) {
	
	auto& ret = dy[idx];
	if (ret != -1) {
		return ret;
	}
	ret = 0x7fffffff / 2;
	for (int k = 0; k < 26; k++) {
		if (next[idx][k]==-1) {
			ret = std::min(ret, 1);
		}
		else {
			ret = std::min(ret, go(next[idx][k]) + 1);
		}
	}
	return ret;
}
void trace(int idx) {
	int len = go(idx);
	for (int k = 0; k < 26; k++) {
		if (next[idx][k] == -1) {
			printf("%c", 'a' + k);
			return;
		}
		else if (go(next[idx][k]) == len - 1) {
			printf("%c", 'a' + k);
			trace(next[idx][k]);
			return;
		}
	}
}


int main() {
	memset(dy, 0xff, sizeof(dy));
	scanf("%s", str);
	for (int i = 0; str[i]; i++) {
		ppp[str[i] - 'a'].push_back(i);
	}
	for (int i = 0; str[i]; i++) {
		for (int k = 0; k < 26; k++) {
			auto it = std::lower_bound(ppp[k].begin(), ppp[k].end(), i);
			if (it == ppp[k].end()) {
				next[i][k] = -1;
			}
			else {
				next[i][k] = *it + 1;
			}
		}
	}
	trace(0);
}



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

int main(){
    int N,M;
    int ans=0;
    vector<int>v;
    cin>>N>>M;
    for(int i=0;i<N;i++){
        int A;
        cin>>A;
        ans=ans+A;
        v.push_back(A);
    }
    double t=double((double(ans)/4)/M);
    sort(v.begin(),v.end());
    int n=v.size();
        if(v[n-M]<t) cout<<"No";
        else cout<<"Yes";


}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	int N,K;
	cin>>N>>K;
	vector<int>h(N);
	REP(i,N){
		cin>>h[i];
	}
	std::sort(h.begin(),h.end());
	int ans=1000000000;
	for(int i=0;i<=N-K;i++)
		ans=min(ans,h[i+K-1]-h[i]);
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 640
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll MAX = LONG_MAX / 3;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m,l;
    cin>>n>>m>>l;
    vector<vector<ll> > G(n,vector<ll>(n,MAX));
    vector<vector<ll> > dd(n,vector<ll>(n,MAX));
    for(ll i=0;i<n;i++)
    {
        G[i][i]=0;
        dd[i][i]=0;
    }
    for(ll i=0;i<m;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        a--;
        b--;
        G[a][b]= c;
        G[b][a] = c;
    }
    for(ll k=0;k<n;k++)
    {
        for(ll i=0;i<n;i++)
        {
            for(ll j=0;j<n;j++)
            {
                ll val = G[i][k]+G[k][j];
                G[i][j] = min(G[i][j],val);
            }
        }
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            dd[i][j]=G[i][j];
        }
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j = 0;j<n;j++)
        {
            if(dd[i][j]<=l)
            {
                G[i][j]=1ll;
            }
            else
            {
                G[i][j]=MAX;
            }
            if(i==j)
            {
                G[i][j]=0ll;
            }
        }
    }
    for(ll k=0;k<n;k++)
    {
        for(ll i=0;i<n;i++)
        {
            for(ll j=0;j<n;j++)
            {
                ll val = G[i][k]+G[k][j];
                G[i][j] = min(G[i][j],val);
            }
        }
    }
    ll q;
    cin>>q;
    while(q--)
    {
        ll s,t;
        cin>>s>>t;
        s--;
        t--;
        ll p = G[s][t];
        if(p>=MAX)
        {
            cout<<-1<<endl;
        }
        else//(s!=t)
        {
            cout<<(p-1)<<endl;
        }
    }
    return 0;
}



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


int main(){

    int n;
    cin >> n;
    cout << 0 << endl;
    string ss;
    cin >> ss;
    if (ss == "Vacant") return 0;
    int l = 0, r = n;
    while(true){
        int mid = (l+r)/2;
        cout << mid << endl;
        string s;
        cin >> s;
        if (s == "Vacant") return 0;
        if (mid % 2 == 1 && s != ss || mid % 2 == 0 && s == ss)
            l = mid + 1;
        else
            r = mid;
    }
}


Measured memory_bytes: 3864
#include "iostream"
#include "algorithm"
#include "string"
#include "map"
#include "vector"
using namespace std;
typedef long long ll;
// ll max(ll b, ll c)
// {
//    return (b>c)?b:c;
// }
int main()
{
   ll n,s,count=0;
   cin>>n;
   vector<ll> a(n);
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   for(int i=1;i<n;i++)
   {
       if(a[i]<a[i-1])
       {
        //    cout<<"i value :"<<i<<endl;
        //    cout<<"array value :"<<a[i]<<endl;
         //  s = max(0LL,a[i]-a[i+1]);
           int d = a[i-1] - a[i];
            a[i] +=d;
           //count = count+s;
           count+=d;
           //a[i+1] = a[i+1]+ s; 
        //    cout<<"s value :"<<count<<"\n";
        //    cout<<"array value new :"<<a[i+1]<<"\n";
           
       }
    //    else
    //    {
    //     //    cout<<"skip value"<<a[i]<<"\n";
    //        continue;
    //    }
       

   }
    cout<<count;        


}


Measured memory_bytes: 4816
N = int(input())
lengths = [int(i) for i in input().split()]

# 最長の辺を取り出す
longest_index = lengths.index(max(lengths))
longest = lengths.pop(longest_index)

# 最長の辺と、残りの辺の合計を比較
if longest < sum(lengths):
    print('Yes')
else :
    print('No')

Measured memory_bytes: 2940
#include <stdio.h>
int main(){
  int a,b,c;
  char buf[128];
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  if(a<=b){
    if(c<=b){
       printf("%d",a+c);
    }else{
        printf("%d",a+b);
    }
 }else{
    if(c<=a){
    printf("%d",b+c);
    }else{
     printf("%d",a+b);
    }
 }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	ll x;
	cin>>x;
	cout<<x/500*1000+(x%500)/5*5<<'\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String line = scanner.nextLine();
		String[] row = line.split(" ");
		int n = Integer.parseInt(row[0]);
		int t = Integer.parseInt(row[1]);

		int minCost = 1001;
		for (int i = 0; i < n; i++) {
			String line2 = scanner.nextLine();
			String[] row2 = line2.split(" ");
			int cost = Integer.parseInt(row2[0]);
			int time = Integer.parseInt(row2[1]);

			if (time <= t && cost < minCost) {
				minCost = cost;
			}
		}
		if (minCost > 1000) {
			System.out.println("TLE");
		} else {
			System.out.println(minCost);
		}

	}

}


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


int main()
{
	int N;
	cin>>N;
	map<string,int> S;
	for(int i=0;i<N;i++)
	{
		string s;
		cin>>s;
		S[s]++;
	}
	cout<<S.size()<<endl;
	return 0;
}


Measured memory_bytes: 19152
s=(?a..?z)
cnt=s.map{100}

n=gets.to_i
n.times do
    gets
    cnt=cnt.zip(s.map{|c|$_.count(c)}).map{|x, y| x<y ? x : y}
end

puts s.map{|c|c*cnt[c.ord-?a.ord]}.join


Measured memory_bytes: 2044
// Contest: AtCoder Beginner Contest 154 (https://atcoder.jp/contests/abc154)
// Problem: A: Remaining Balls (https://atcoder.jp/contests/abc154/tasks/abc154_a)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cpp_lib_nonmember_container_access >= 201411
#   define sz(x) ((int)size(x))
#else
#   define sz(x) ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define all(a)         (a).begin(),(a).end()
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __has_cpp_attribute(maybe_unused) >= 201603
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18;
//endregion }}}

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

    string s, t, u; int a, b; cin >> s >> t >> a >> b >> u;
    cout << (a - (s == u)) << ' ' << (b - (t == u)) << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define spc " "
#define oi "oi\n"
#define ll long long 
#define pi pair<int,int>
#define vi vector<int>
#define pl pair<ll,ll>
#define vl vector<ll>
#define vii vector<pi>
#define vll vector<pl>
#define ft first
#define sd second
ll dp[100020][105];
int n;
pair<ll,int> a[105];
ll solve(int v,int p){
    if(dp[v][p]!=-1)return dp[v][p];
    if(!v)return dp[v][p]=0;
    if(p==n){
        return dp[v][p]=1e9 +1;
    }
    ll &ans=dp[v][p];
    ans=1e9+1;
    if(a[p].sd<=v){
        ans=min(ans,solve(v-a[p].sd,p+1)+a[p].ft);
    }
    return ans=min(ans,solve(v,p+1));
 
 
}
 
 
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int n,k;
    ll w;
    
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)cin>>a[i].ft>>a[i].sd;
    for(int i=100000; i >= 0;i--){
        //memset(dp,-1,sizeof(dp));
        if(solve(i,0)<=w){
            cout<<i<<endl;
            return 0;
        }
    }
 
    return 0;
}

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

bool solve() {
  string S; cin >> S;
  vector<int> cnt(3);;
  cnt[0] = count(S.begin(), S.end(), 'a');
  cnt[1] = count(S.begin(), S.end(), 'b');
  cnt[2] = count(S.begin(), S.end(), 'c');
  int mx = *max_element(cnt.begin(), cnt.end());
  int mn = *min_element(cnt.begin(), cnt.end());
  return mx - mn < 2;
}

int main() {
  cout << (solve() ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int H, W, h, w;

int main(){
	cin >> H >> W >> h >> w;
	if((H/h)*(W/w)*(1000*(h*w-1)+1)>1000*(H*W-(H/h)*(W/w)))
		cout << "No\n";
	else{
		cout << "Yes\n";
		for(int i = 1; i <= H; i ++){
			for(int j = 1; j <= W; j ++){
				if(i%h==0&&j%w==0) 
					cout << -1000*(h*w-1)-1 << ' ';
				else cout << 1000 << ' ';
			}
			cout << endl;
		}
	}
	return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};


int main(){
    string s; cin >> s;
    cout << alpha[s[0]-'a'+1] << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define pb push_back
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c, x, y;
	cin >> x >> y >> a >> b >> c;
	vector<ll> p(a), q(b), r(c);
	for (int i = 0; i < a; i++)
		cin >> p[i];
	for (int i = 0; i < b; i++)
		cin >> q[i];
	for (int i = 0; i < c; i++)
		cin >> r[i];
	sort(p.begin(), p.end());
	reverse(p.begin(), p.end());
	p.resize(x);
	sort(q.begin(), q.end());
	reverse(q.begin(), q.end());
	q.resize(y);
	ll sum = 0;
	for (int i = 0; i < x; i++)
		r.pb(p[i]);
	for (int i = 0; i < y; i++)
		r.pb(q[i]);
	sort(r.begin(), r.end());
	reverse(r.begin(), r.end());
	for (int i = 0; i < x + y; i++)
		sum += r[i];
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 6512
import java.util.*;

public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt()+1;
        int m = in.nextInt();
        int q = in.nextInt();
        int[] L = new int[200009];
        int[] R = new int[200009];
        int[][] M = new int[n][n];
        for(int i = 0; i < m; i++) {
            L[i] = in.nextInt();
            R[i] = in.nextInt();
            M[L[i]][R[i]] += 1;
        }
        int[] P = new int[1000009];
        int[] Q = new int[1000009];
        for(int i = 0; i < q; i++) {
            P[i] = in.nextInt();
            Q[i] = in.nextInt();
        }

        int[][] S = new int[n][n];
        for(int i = 1; i < n; i++) {
            for(int j = 1; j < n; j++) {
                S[i][j] = S[i][j-1] + M[i][j];
            }
        }

        for(int i = 0; i < q; i++) {
            int ans = 0;
            for(int j = P[i]; j <= Q[i]; j++) {
                ans += S[j][Q[i]] - S[j][P[i]-1];
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 164036
import heapq

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
#print(N, M)
#print(A)

A = [-i for i in A]

heapq.heapify(A)
for i in range(M):
    a = -heapq.heappop(A)
    a = a//2
    heapq.heappush(A, -a)

print(-sum(A))

Measured memory_bytes: 14180
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	
	ll H, W, h, w;
	cin >> H >> W >> h >> w;

	if (H%h == 0 && W%w == 0) { cout << "No"; }
	else {
		cout << "Yes" << endl;

		ll M = (H-1) / h+1;
		ll N = (W-1) / w+1;

		ll pos = M * N;
		ll neg = H * W - pos;

		ll T = pos / ((h*w - 1)*pos - neg) + 1;





		ll X = T * (h*w - 1) - 1;
		ll Y = -T;

		//cout << X << Y;

		
		rep(i, H){
			rep(j, W) {
				if (i%h == 0 && j%w == 0) { cout << X; }
				else { cout << Y; }
				cout << " ";
			}
			cout << endl;
		}
		
	}


	system("PAUSE");
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  long long N;
  long long K;
  cin >> N >> K;
  
  vector<long long> A(0);
  
  long long num;
  
  while(true){
    if(N >= K){
      num = N % K;
      A.push_back(num);
      N = N / K;
    }
    else{
      A.push_back(N);
      break;
    }
  }
  
  reverse(A.begin(),A.end());
  
  cout << A.size() << endl;
}

Measured memory_bytes: 256
S = list(input())
A = []

for i,x in enumerate(S):
    if (i+1)%2 == 0 and x == "R":
        A.append("No")
    elif (i+1)%2 == 1 and x == "L":
        A.append("No")
    else:
        A.append("Yes")

if "No" in A:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    while(1){
        string str;
        cin >> str;
        if(str[0] == '#') break;
        
        vector<int> nw;
        int idx=0;
        while(str[idx]!=0){
            if(str[idx]=='n'){
                nw.push_back(-90);
                idx+=5;
            }else if(str[idx]=='w'){
                nw.push_back(90);
                idx+=4;
            }
        }
        
        long long int dir;
        long long int den = pow(2,nw.size()-1);
        dir = (45+nw[nw.size()-1]/2)*pow(2,nw.size()-1);
        for(int i=0; i<(int)nw.size()-1; i++){
            dir += nw[i]*pow(2,i);
        }

        while(dir%2==0 && den%2==0){
            dir /= 2;
            den /= 2;
        }
        if(den==1){
            cout << dir << endl;
        }else{
            cout << dir << "/" << den << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin>>S;
  if(S=="Sunny"){
    cout<<"Cloudy";
  }
  else if(S=="Cloudy"){
    cout<<"Rainy";
  }
  else if(S=="Rainy"){
    cout<<"Sunny";
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int x=0,i,a,b,j,k;
    scanf("%d",&a);
    for(i=1;i<=a;i++)
    {
        x+=i;
        if(x>=a)
            break;
    }
    printf("%d",i);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;


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

	vector <int> x(N);

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

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

	int a = x.back();

	int best;
	double bestDist = BIGLL;

	for (int i = 0; i < SZ(x)-1; ++i)
	{
		if (abs(x[i]-a*0.5)<bestDist)
		{
			bestDist = abs(x[i] - a*0.5);
			best = x[i];
		}
	}

	printf("%d %d\n",a, best);




	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int ans;

	if (A * C <= B) {
		ans = C;
	}
	else {
		ans = B / A;
	}
	
	cout << ans << endl;


}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
public class Pg
{
    public static void Main()
    {
        var n = new List<string>();
        for (string line; !string.IsNullOrEmpty(line = Console.ReadLine()); n.Add(line)) ;
        Console.WriteLine(n.Count - IsNotPalidrome(n).Select(x => x == true).Count());
    }
    internal static IEnumerable<bool> IsNotPalidrome(List<string> s)
    {
        foreach (var v in s)
        {
            for (int i = 0; i < v.Length / 2; ++i)
            {
                if (v[i] != v[v.Length - (i + 1)])
                {
                    yield return true;
                    break;
                }
            }
        }
    }
}



Measured memory_bytes: 16148
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		if(500*num1 >= num2){
			System.out.println("Yes");
		} else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21332
#include <cassert>

#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>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// 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>
#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>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
//#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<int>> v(h,vector<int>(w));
    rep(i,0,h)rep(j,0,w){
        cin>>v[i][j];
    }
    int y=0,x=0,ct=0;
    int ans=0;
    bool hand=false;
    vector<pair<int,int>> anss,ansp;
    while(1){
        if(ct==h*w)break;
        if(hand){
            if(v[y][x]%2==1){
                anss.pb(MP(y,x));
                hand=false;
            }else {
                ansp.pb(MP(y,x));
                anss.pb(MP(y,x));
            }
        }else  if(v[y][x]%2==1){
            hand=true;
            ansp.pb(MP(y,x));
        }
        if(y%2==0)x++;
        else x--;
        if(x==w){
            x=w-1;
            y++;
        }
        if(x==-1){
            x=0;
            y++;
        }

        ct++;
    }
    cout<<anss.size()<<endl;
    rep(i,0,anss.size()){
        cout<<ansp[i].fi+1<<" "<<ansp[i].se+1<<" "<<anss[i].fi+1<<" "<<anss[i].se+1<<endl;
    }
    
    return 0;

}




Measured memory_bytes: 5228
a,b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
c=sorted(c,reverse=True)
d=sum(c)
for i in range(0,len(c)):
    if(b>0):
        d=d-c[i]
        b=b-1
    else:
        break
print(d)
        
    
    

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

import numpy
import sys
import os

def solve():
    num = int(input())
    camels = [int(i) for i in input().split()]

    if len(camels) % 3 != 0:
        for c in camels:
            if c !=0:
                print("No")
                return(0)

        print("Yes")
        return

    camels.sort()
    length = len(camels)

    for i in range(3):
        for j in range(int(i*length/3), int((i+1)*length/3)):
            if camels[int(i*length/3)] != camels[j]:
                print("No")
                return(0)

    if camels[0] ^ camels[int(num/3)] != camels[int(num/3)*2]:
        print("No")
        return(0)

    print("Yes")

solve()

Measured memory_bytes: 23160
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define INF 1073741824
#define ll long long
#define PI (2*acos(0.0))
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> 
void dbg_out(Head H, Tail... T) { 
    cerr << ' ' << H;
     dbg_out(T...); 
}
#define dbg(...) cerr << '(' << #__VA_ARGS__ << ')'<<':', dbg_out(__VA_ARGS__)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define on(val,pos) (val|(1<<pos))
#define off(val,pos) (val&(~(1<<pos)))
#define check(val,pos) (val&(1<<pos))
#define all(n) n.begin(),n.end()
//first four adjacent,second four corner
//int row[8]={0,-1,0,1,1,-1,-1,1};
//int col[8]={-1,0,1,0,-1,-1,1,1};
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main(){
    int i,j,k,n,m,val,t=0,test;
    //freopen("000input.txt","r",stdin);
    string s;
    cin>>s;
    int ans=0;
    for(i=0;i<s.size();i++)ans+=s[i]-'0';
    if(ans%9)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    //free();   //if pointer array
    return 0;
}


Measured memory_bytes: 3720
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
		int N = int.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');
		int[] H = new int[N];
        for(var i = 0; i < N; i++)
		{
			H[i] = int.Parse(input[i]);
		}
		int ans = 0;

        for(var i = 0; i < N; i++)
		{
			int count = 0;
            for(var j = 0; j <=i; j++)
			{
				if (i == j) { continue; }
				if (H[i] < H[j]) { count++; }
			}
			if (count == 0) { ans++; }
		}
		Console.WriteLine(ans);
	}
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  if (a < b && b < c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    vector<string> vs(3);
    cin>>vs[0]>>vs[1]>>vs[2];
    cout<<vs[0][0]<<vs[1][1]<<vs[2][2]<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		int x=Integer.parseInt(scan.next());
    		int y=Integer.parseInt(scan.next());
    		System.out.print(x+y/2);
    }
    }
// end 

Measured memory_bytes: 21844
n = int(input())
problem = [list(map(int, input().split())) for _ in range(n)]

problem.sort()

min_r_up = [0] * n
r = problem[0][1]
for i in range(n):
    r = min(r, problem[i][1])
    min_r_up[i] = r

min_r_down = [0] * n
r = problem[-1][1]
for i in reversed(range(n)):
    r = min(r, problem[i][1])
    min_r_down[i] = r


ans = 0

for i in range(n-1):
    num = 0
    l1 = problem[i][0]
    l2 = problem[-1][0]

    # 1
    r1 = problem[i][1]
    if i >= 1:
        if min_r_up[i-1] < r1:
            r2 = min(min_r_up[i-1], min_r_down[i+1])
        else:
            r2 = min_r_down[i+1]
    else:
        r2 = min_r_down[i+1]

    num += max(0, r1-l1+1)
    num += max(0, r2-l2+1)

    ans = max(ans, num)

    # 2
    r1 = min_r_up[i]
    r2 = min_r_down[i+1]

    num = 0
    num += max(0, r1-l1+1)
    num += max(0, r2-l2+1)
    ans = max(ans, num)


print(ans)



Measured memory_bytes: 29016
#include <cstdio>
#include <utility>
#include <complex>
#include <array>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n';)s+=c;return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;if((c=gcu())=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

using P = complex<double>;
void dump(P p) {printf("%.10f %.10f\n", real(p), imag(p));}

int main() {
	times(i, in) {
		array<P, 4> p;
		for (P &i: p) {
			double x = (int) in, y = (int) in;
			i = {x, y};
		}
		P b = p[3] - p[2];
		auto D = [&](P &a) {return abs(imag(b *  conj(a - p[2])));};
		double d1 = D(p[0]);
		dump(p[0] + (p[1] - p[0]) * d1 / (d1 + D(p[1])));
	}
}


Measured memory_bytes: 2720
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
#define MAX 250
#define min(a,b) ((a)<(b))?a:(b)
int dc=100000;


int c[10][10];
int a[MAX*MAX];

int main(){
  if(df)printf("*** debug mode ***\n");
  int h,w,i,j;
  scanf("%d%d",&h,&w);
  for(i=0;i<10;i++){
    for(j=0;j<10;j++){
      scanf("%d",&c[i][j]);
    }
  }
  for(i=0;i<h*w;i++)
    scanf("%d",&a[i]);


  int k;
  for(k=0;k<10;k++){
    for(i=0;i<10;i++){
      for(j=0;j<10;j++){
	c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
      }
    }
  }

  int sum=0;
  for(i=0;i<h*w;i++){
    if(a[i]>=0)sum+=c[a[i]][1];
  }
  
  

  printf("%d",sum);
  return 0;
}


/// confirm df==0 ///


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Set___Disjoint_Set_Union_Find_Tree
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);
            int[] nums = new int[n];
            for (int i = 0; i < n; ++i)
            {
                nums[i] = i;
            }
            for (int i = 0; i < q; ++i)
            {
                string[] temp = Console.ReadLine().Split(' ');
                int com = int.Parse(temp[0]);
                int x = int.Parse(temp[1]);
                int y = int.Parse(temp[2]);
                int t;
                if (x > y)
                {
                    t = y;
                    y = x;
                    x = t;
                }
                if (com == 0)
                {
                    int t1 = nums[x];
                    int t2 = nums[y];
                    for (int j = 0; j < nums.Length; ++j)
                    {
                        if (nums[j] == t2)
                        {
                            nums[j] = t1;
                        }
                    }

                }


                if (com == 1)
                {

                    if (nums[y] == nums[x]) Console.WriteLine(1);                    
                    else Console.WriteLine(0);
                }
            }
        }
    }
}



Measured memory_bytes: 20048
n = int(input())
x=1
a=list(map(int,input().split(" ")))
if(0 in a):
	print(0)
else:
	for i in a:
		x=x*i
		if(x==0):
			break
		if(x>=1000000000000000000):
			break
	if(x<=1000000000000000000):
		print(x)
	else:
		print(-1)

Measured memory_bytes: 21476
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int n,m,k,a,b,par[100005]={},cnt[100005]={};
struct unionfind {
  vector<int> par;
  unionfind(int n) : par(n,-1) {}
  void init(int n) {par.assign(n,-1);}
  int find(int x) {
    if (par[x]<0) return x;
    else return par[x]=find(par[x]);
  }
  bool issame(int x,int y) {
    return find(x)==find(y);
  }
  bool unit(int x,int y) {
    x=find(x),y=find(y);
    if (x==y) return false;
    if (par[x]>par[y]) swap(x, y); 
    par[x]+=par[y];
    par[y]=x;
    return true;
  }
  int size(int x) {
    return -par[find(x)];
  }
};

int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  unionfind uf(n);
  for(int i=0; i<n; i++) {
    par[i]=i;
  }
  for(int i=0; i<m; i++) {
    cin >> a >> b;
    a--,b--;
    uf.unit(a,b);
    cnt[a]++,cnt[b]++;
  }
  for(int i=0; i<k; i++) {
    cin >> a >> b;
    a--,b--;
    if(uf.find(a)==uf.find(b)) {
      cnt[a]++,cnt[b]++;
    }
  }
  for(int i=0; i<n; i++) {
    cout << uf.size(i)-cnt[i]-1 << " ";
  }
  cout << "\n";
}

Measured memory_bytes: 2048
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    string S;
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>
#define N 100
#define W 0
#define Gr 1
#define B 2
int n,t;
int G[N][N],iro[N],D[N],F[N];
void visit(int tar);
void dfs();
int main(){
  int i,j,u,k,in;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<n;j++){
      G[u-1][j]=0;
    }
    if(k!=0){
	for(j=0;j<k;j++){
	  scanf("%d",&in);
	  G[u-1][in-1]=1;
	}
    }
  }
  dfs();
  return 0;
}
void dfs(){
  int i;
  for(i=0;i<n;i++) iro[i] = W;
  t=0;
  for(i=0;i<n;i++){
    if(iro[i]==W) visit(i);
  }
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,D[i],F[i]);
  }
}
void visit(int tar){
  int j;
  iro[tar]=Gr;
  D[tar]=++t;
  for(j=0;j<n;j++){
    if(G[tar][j]==0)continue;
    if(iro[j]==W) visit(j);
  }
  iro[tar]=B;
  F[tar]=++t;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
string b;
int cnt[4];
int main(){
	cin>>b;
	rep(i,b.size()) cnt[b[i]-'a']++;
	if(max(cnt[0],max(cnt[1],cnt[2]))-min(cnt[0],min(cnt[1],cnt[2]))<=1){
		puts("YES");
	}
	else{
		puts("NO");
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

string d;
ll ans = 0;
void dfs (int idx, ll cur, ll sum) {
    if (idx == SZ(d)) {
        ans += cur + sum;
    } else {
        dfs(idx + 1, 0, sum + cur);
        dfs(idx + 1, cur * 10 + d[idx] - '0', sum);
    }
}
/********** Good Luck :) **********/
int main()
{
    TIME(main);
    IOS();

    cin >> d;

    dfs(0, 0, 0);

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


Measured memory_bytes: 256