akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

int N;
VL A;
VL sum;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    cin >> N;
    A.resize(N); sum.resize(N+1);
    sum[0] = 0;
    REP(i,N) cin >> A[i], sum[i+1] = sum[i] + A[i];

    LL res = LINF;
    FOR(i,2,N-1){
        int low = 0, high = i;
        while(high - low > 1){
            int mid = (low + high) / 2;
            if(sum[mid] >= sum[i] - sum[mid]) high = mid;
            else low = mid;
        }
        LL P = sum[low], Q = sum[i] - sum[low];
        LL P2 = sum[high], Q2 = sum[i] - sum[high];
        LL left_min = min(P,Q), left_max = max(P,Q);
        if(abs(P2-Q2) < abs(P-Q)) left_min = min(P2,Q2), left_max = max(P2,Q2);

        low = i, high = N;
        while(high-low > 1){
            int mid = (low + high) / 2;
            if(sum[mid] - sum[i] >= sum[N] - sum[mid]) high = mid;
            else low = mid;
        }
        LL R = sum[low] - sum[i], S = sum[N] - sum[low];
        LL R2 = sum[high] - sum[i], S2 = sum[N] - sum[high];
        LL right_min = min(R,S), right_max = max(R,S);
        if(abs(R2-S2) < abs(R-S)) right_min = min(R2,S2), right_max = max(R2,S2);

        LL tmp = max(left_max, right_max) - min(left_min, right_min);
        res = min(res,tmp);

    }
    cout << res << endl;

}

Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 };

int n, cou, row;
long long ans = INF, mon;
bool checked[575], che2[575];
int main() {
	cin >> n;
	char k[575][575];
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> k[i][j];
			if (k[i][j] == '#') { ++cou; }
			else if (!checked[j]) {
				checked[j] = 1;
				++row;
			}
		}
	}

	if (cou == 0) {
		cout << -1 << endl;
		return 0;
	}

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (k[i][j] == '.' && !che2[i]) {
				che2[i] = 1;
			}
		}
	}

	for (int i = 0; i < n; ++i) {
		bool bo = 0;
		for (int j = 0; j < n; ++j) {
			if (k[j][i] == '#') { bo = 1; }
		}
		mon = 0;
		for (int j = 0; j < n; ++j) {
			if (k[i][j] == '.') { ++mon; }
		}
		if (!bo) { ++mon; }
		ans = min(ans, mon);
	}
	cout << ans + row << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int ans = 0;
    string s1 = "";
    string s2 = "";
    if( s.size() % 2 == 0)
    {
        for(int i = 0; i < s.size()/2; i++){
            s1 += s[i];
            s2 += s[i + s.size()/2];
        }
        reverse(s1.begin(), s1.end());
        for(int i = 0; i < s.size()/2; i++){
            if( s1[i] != s2[i] ) ans++;
        }
    }
    else
    {
        for(int i = 0; i < s.size()/2; i++){
            s1 += s[i];
        }
        for(int i = s.size()/2+1; i < s.size(); i++){
            s2 += s[i];
        }
        reverse(s1.begin(), s1.end());
        for(int i = 0; i < s.size()/2; i++){
            if( s1[i] != s2[i] ) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def check(n, nums):
    kind = set(nums)
    if len(kind) > 3:
        return False
    if len(kind) == 1 and 0 in kind:
        return True
    if n % 3 != 0:
        return False
    if len(kind) == 3:
        a, b, c = kind
        return nums.count(a) == nums.count(b) == nums.count(c) and a ^ b ^ c == 0
    else:
        return 0 in kind and n / 3 == nums.count(0)


def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print("Yes" if check(n, a_list) else "No")
    # 0 0 0
    # 1 0 1 1 0 1
    # 1 2 3


if __name__ == "__main__":
    main()


Measured memory_bytes: 14576
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

pair <ll, ll> pos[100005];
ll pref[100005];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    ll L;
    cin >> n >> L;
    for (int i = 1; i <= n; i++)
        cin >> pos[i].x >> pos[i].y;

    ll ans = 0, sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += pos[i].y;
        ans = max(ans, sum - pos[i].x);
    }
    sum = 0;
    for (int i = n; i > 0; i--)
    {
        sum += pos[i].y;
        ans = max(ans, sum - (L - pos[i].x));
    }

    sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += pos[i].y;
        pref[i] = max(pref[i - 1], sum - 2 * pos[i].x);
    }
    sum = 0;
    for (int i = n; i > 0; i--)
    {
        sum += pos[i].y;
        ans = max(ans, sum - (L - pos[i].x) + pref[i - 1]);
    }

    sum = 0;
    for (int i = n; i > 0; i--)
    {
        sum += pos[i].y;
        pref[i] = max(pref[i + 1], sum - 2 * (L - pos[i].x));
    }
    sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += pos[i].y;
        ans = max(ans, sum - pos[i].x + pref[i + 1]);
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 2688
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));

class UnionFind {
public:
	vector<int> Parent;

	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	int root(int A) {
		if (Parent[A] < 0)return A;
		return Parent[A] = root(Parent[A]);
	}

	int size(int A) {
		return -Parent[root(A)];
	}

	bool unite(int A, int B) {
		A = root(A);
		B = root(B);
		if (A == B)
			return false;

		if (size(A) < size(B))
			swap(A, B);

		Parent[A] += Parent[B];
		Parent[B] = A;

		return true;
	}

	bool same(int A, int B) {
		if (root(A) == root(B))
			return true;
		else
			return false;
	}
};
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
	int N,M;
	cin >> N >> M;
	VI P(N);
	VI X(M);
	VI Y(M);
	UnionFind uni(N);
	REP(i, N)cin >> P[i];
	REP(i, M) {
		cin >> X[i] >> Y[i];
		X[i]--;
		Y[i]--;
		uni.unite(X[i], Y[i]);
	}
	int ans = 0;
	REP(i,N){
		if (uni.same(P[i]-1,i))ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3456
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  string a;
  cin >> a;
  int lst = 0;
  long long ans = 0;
  for (int i = 0, j; i < a.size(); i = j) {
    for (j = i; j < a.size() && a[i] == a[j]; j++);
    int x = j - i;
    if (a[i] == '<') {
      ans += 1ll * x * (x + 1) / 2;
      lst = x;
    } else {
      ans += 1ll * x * (x - 1) / 2;
      if (lst < x) {
        ans += (x - lst);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 900
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		if(n == 1){
			System.out.println("Hello World");
		}else{
			int a = sc.nextInt();
			int b = sc.nextInt();

			System.out.println(a + b);
		}
	}
}


Measured memory_bytes: 23252
#include<iostream>
#include<string>
using namespace std;
int main() {
	string S;
	long long int spart[100];

	long long int k;
	int diflag = 0;
	cin >> S;
	cin >> k;

	int i;
	int j = 0;
	for (i = 0; i < 100; i++) {
		spart[i] = 0;
	}
	spart[0] = 1;
	for (i = 0; i < S.length() - 1; i++) {
		if (S[i] == S[i + 1]) {
			spart[j]++;
		}
		else {
			diflag = 1;
			j++;
			spart[j]++;
		}
	}
	long long int counter = 0;
	if (diflag == 1) {
		if (S[0] == S[S.length() - 1]){
			if ((spart[0] % 2 == 1) && (spart[j] % 2 == 1))counter = -1;
			spart[0] = spart[0] + spart[j];
			
			//spart[j] = 0;
			j = j - 1;
		}
		for (i = 0; i <= j; i++) {
			//cout << spart[i] ;
			counter = counter + k * ((spart[i] - (spart[i] % 2)) / 2);
		}
		cout << counter;
	}
	else {
		if (k % 2 == 0) {
			cout << S.length() * k / 2;
		}
		else if (S.length() % 2 == 0) {
			cout << S.length() * k / 2;

		}
		else {
			cout << (S.length() * k - 1) / 2;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=998244353;
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
ll mul(ll a, ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a, ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll sub(ll a, ll b)
{
	return ((a%mod)-(b%mod)+mod)%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll x,n;
	cin>>x>>n;
	map<ll,ll> m;
	while(n--)
	{
		ll x;
		cin>>x;
		m[x]++;
	}
	ll u=0;
	ll ma=1e18;
	for(ll i=0;i<=102;i++)
	{
		if(m[i]==0)
		{
			if(abs(i-x)<ma)
			{
				ma=abs(i-x);
				u=i;
			}
		}
	}
	cout<<u;
}


Measured memory_bytes: 3652
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N,M;
    cin >> N >> M;
    vector<P> bridge(M);
    REP(i,M){
        cin >> bridge[i].second >> bridge[i].first;
        bridge[i].first--;
        bridge[i].second--;
    }
    SORT(bridge);
    int pre_N = 0;
    int ans = 0;
    REP(i,M){
        if(bridge[i].second >= pre_N){
            ans++;
            pre_N = bridge[i].first;
        }
        else{
            chmin(pre_N, bridge[i].first);
        }
    }
    cout << ans << endl;
    return 0;
}

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

ll N;
int cnt;

int dfs(ll n = 0ll, int k = 0)
{
    if(k == cnt){
        ll x = n;
        if(x > N){
            return 0ll;
        }
        bool flag1 = false;
        bool flag2 = false;
        bool flag3 = false;
        while(x){
            ll s = x % 10ll;
            if(s == 3ll){
                flag1 = true;
            }
            else if(s == 5ll){
                flag2 = true;
            }
            else if(s == 7ll){
                flag3 = true;
            }
            x /= 10ll;
        }
        //printf("%lld\n", n);
        return (int)(flag1 && flag2 && flag3);
    }
    int res = 0ll;
    res += dfs(n * 10ll + 7ll, k + 1);
    res += dfs(n * 10ll + 5ll, k + 1);
    res += dfs(n * 10ll + 3ll, k + 1);
    if(n == 0 && k < cnt - 3)res += dfs(0ll, k + 1);
    return res;
}

int main()
{
    cin >> N;
    ll n = N;
    while(n){
        cnt++;
        n /= 10ll;
    }
    cout << dfs() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

int main(){
   int d,t,s;
   std::cin >> d >> t >> s;
   float rt = (float)d/s;
   if (rt <= float(t)) {std::cout << "Yes" << std::endl;
   return 0;}
   std::cout << "No" << std::endl;
   return 0;
}

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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 

template <class T>
void printArray(vector<T> arr) {for (T a: arr) cout << a << " ";cout << '\n';}
void printVerdict(bool verdict) {cout << (verdict ? "YES": "NO") << '\n';}
void printDecimal(double d) {printf("%.9f\n", d);}
bool inrange(int val, int start, int end) {return val >=start && val <= end;}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int l,r,d; cin >> l >> r >> d;
	int left = l/d + (l%d != 0), right = r/d;
	cout << right - left + 1 << '\n';
}



Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    void solve() throws IOException {
        String s1 = readString();
        String s2 = readString();
        int n = s1.length();
        int m = s2.length();
        int[][] all = new int[n+1][m+1];
        for(int i=0;i<=n; i++) {
            for(int j=0;j<=m;j++){
                if(i==0 || j==0) {
                    all[i][j] = 0;
                    continue;
                }
                if(s1.charAt(i-1)==s2.charAt(j-1)){
                    all[i][j]=1+all[i-1][j-1];
                    continue;
                }
                all[i][j]=Math.max(all[i-1][j], all[i][j-1]);
            }
        }
        if(all[n][m]==0) {
            System.out.println("");
            return;
        }
        char[] ans = new char[all[n][m]];
        int ansIndex = all[n][m]-1;
        int nindex = n;
        int mindex = m;
        while (ansIndex>=0){
            if(s1.charAt(nindex-1)==s2.charAt(mindex-1)){
                ans[ansIndex]=s1.charAt(nindex-1);
                nindex--;
                mindex--;
                ansIndex--;
                continue;
            }
            if(nindex-1>=0 && all[nindex][mindex]==all[nindex-1][mindex]) {
                nindex--;
                continue;
            }
            if(mindex-1>=0 && all[nindex][mindex]==all[nindex][mindex-1]) {
                mindex--;
                continue;
            }
        }
        System.out.println(new String(ans));
    }
}


Measured memory_bytes: 80900
#include "bits/stdc++.h"

using namespace std;

const int N = 505;

int in[N];

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

    int n, k;
    cin >> n >> k;

    int sum = 0;
    for (int i = 1; i <= n; i ++) {
        cin >> in[i];
        sum += in[i];
    }

    vector< int> factors;
    for (int i = 1; i * i <= sum; i ++) {
        if (sum % i == 0) {
            factors.emplace_back(i);
            factors.emplace_back(sum / i);
        }
    }

    sort(factors.rbegin(), factors.rend());

    for (const int& F : factors) {
        vector< int> remainders;

        int add = 0;
        for (int i = 1; i <= n; i ++) {
            int x = in[i] % F;
            remainders.emplace_back(x);
            add += F - x;
        }

        sort(begin(remainders), end(remainders));

        int subtract = 0;
        for (const int& x : remainders) {
            subtract += x;
            add -= F - x;
            if (subtract <= k and subtract == add) return cout << F << endl, 0;
        }
    }
}


Measured memory_bytes: 256
#!/usr/bin/env python3
H, W = map(int,input().split())
s = [input() for _ in range(H)]
for h in range(H):
    l = ""
    for w in range(W):
        l += "#" if s[h][w] == "#" else str(
                    sum(
                        [t[max(0, w - 1) : min(W, w + 2)]
                            .count("#") for t in 
                         s[max(0, h - 1) : min(H, h + 2)]
                        ]
                        ))
    print(l)

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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
using ll = long long;
using P = pair<int,int>;

// code starts
int main()
{
  ll x,k,d;
  cin >> x >> k >> d;
  x = abs(x);
  if(x/d > k)
  {
    cout << x-k*d << endl;
  }
  else
  {
    ll times = x/d;
    ll close = x-times*d;
    ll left = k-times;
    if(left%2 == 0)
    {
      cout << close << endl;
    }
    else
    {
      cout << abs(close-d) << endl;
    }
  }
}


Measured memory_bytes: 3556
#include<stdio.h>
//大きい順にソート
int c[51];
void merge(int i,int j,double *s){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d]=s[b];
        b++;
      }
      else if(j<b){
        c[d]=s[a];
        a++;
      }
      else if(s[a]>s[b]){
        c[d]=s[a];
        a++;
      }
      else{
        c[d]=s[b];
        b++;
      }
    }
    for(d=i;d<=j;d++)
      s[d]=c[d];
  }
}

int main(){
  int n,i,j;
  scanf("%d",&n);
  double v[51];
  for(i=0;i<n;i++)
    scanf("%lf",&v[i]);
  merge(0,n-1,v);
  double count=0;
  for(i=0;i<n-1;i++){
    for(j=i;j<n;j++)
      v[j]=v[j]/2;
    count+=v[i];
  }
  count+=v[n-1];
  printf("%lf\n",count);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std; 
int a,b[100],c=1,d=1;
int main(void){
    cin>>a;
    for(int i=0;i<a;i++){
        cin>>b[i];
    }
    for(int i=0;i<a;i++){
        c=c*3;
        if(b[i]%2==0){
            d=d*2;
        }
    }
    cout<<c-d<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i,j,ans=0;
	scanf("%d",&n);
	int d[100];
	for(i=0;i<n;i++)
	{
	scanf("%d",&d[i]);
	}
	for(j=0;j<n;j++)
	 {
	  for(i=j+1;i<n;i++)
	   {
	     ans+=d[i]*d[j];
	   }
	 } 
                    
	printf("%d\n",ans);
	return 0;
}


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

int main(){

	int a[100];
	int list[4]={0,0,0,0};


	for(int i=1;i<=10;i++){

		cin>>a[i];

		if(list[1]<a[i]){
			list[3]=list[2];
			list[2]=list[1];
			list[1]=a[i];
		}

		else if(list[2]<a[i]){
			list[3]=list[2];
			list[2]=a[i];
		}

		else if(list[3]<a[i]){
			list[3]=a[i];
		}

	}
	
	for(int j=1;j<=3;j++){
			cout<<list[j]<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160
n, k = (int(z) for z in input().split())
a = [int(z) for z in input().split()]
a = [0] + a
for i in range(1, len(a)):
  a[i] -= 1
for i in range(1, len(a)):
  a[i] += a[i - 1]
mx = 0
for i in range(k, len(a)):
  mx = max(mx, (a[i] - a[i - k]) / 2 + k)
print(mx)


Measured memory_bytes: 25188
s = int(input())
l = {s}
s = s // 2 if s % 2 == 0 else s * 3 + 1
i = 1
while s not in l:
    l.add(s)
    s = s // 2 if s % 2 == 0 else s * 3 + 1
    i += 1
else:
    i += 1
print(i)

Measured memory_bytes: 2940
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll N, K; cin >> N >> K;
    vector<ll> V(N); for (auto& v : V) cin >> v;
    ll ans = 0;
    for (ll i = 0; i <= min(N, K); i++) {
        priority_queue<ll, vector<ll>, greater<ll>> pq;
        for (ll left = 0; left <= i; left++) {
            ll right = i - left;
            for (ll j = 0; j < left; j++) {
                pq.push(V[j]);
            }
            for (ll j = N - 1; j >= N - right; j--) {
                pq.push(V[j]);
            }
            for (ll j = 0; j < K - i; j++) {
                if (pq.empty()) break;
                ll tmp = pq.top();
                if (tmp > 0) break;
                pq.pop();
            }
            ll sum = 0;
            while (!pq.empty()) {
                sum += pq.top();
                pq.pop();
            }
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n, i;
    vector<double> v;
    cin >> n;
    double num, tmp;
    
    for (i=0; i<n; i++) {
        cin >> num;
        v.push_back(num);
    }
    sort(v.rbegin(), v.rend());
    
    for (i=n-1; i>0; i--) {
        tmp =0;
        tmp += v[i]+v[i-1];
        v.pop_back();
        v[i-1]=tmp/2;
    }
    cout << v[0] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		char s[] =fr.next().toCharArray() ;
 		if (s[0]=='7' || s[1]=='7' || s[2]=='7')	op.println("Yes") ;
 		else 	op.println("No") ;
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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

Measured memory_bytes: 32900
#include <iostream>
#include <cmath>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

struct point {
  double x, y;
};

void printPoint(point p) {
  cout << fixed << p.x << " " << p.y << endl;
}

void KochCurve(point p1, point p2, int rec, int n) {
  if (rec < n) {
    point s, t, u;
    double deg = 60.0*(M_PI/180.0);
    s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
    s.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
    t.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
    t.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;
    u.x = s.x + (t.x - s.x) * cos(deg) - (t.y - s.y) * sin(deg);
    u.y = s.y + (t.x - s.x) * sin(deg) + (t.y - s.y) * cos(deg);
    rec++;
    KochCurve(p1, s, rec, n);
    printPoint(s);
    KochCurve(s, u, rec, n);
    printPoint(u);
    KochCurve(u, t, rec, n);
    printPoint(t);
    KochCurve(t, p2, rec, n);
  }
}

int main () {
  cin.tie(0); // tie
  ios::sync_with_stdio(false); // sync
  int n;
  point p1, p2;
  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;

  cin >> n;
  printPoint(p1);
  KochCurve(p1, p2, 0, n);
  printPoint(p2);
  return 0;
}

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


int main() {
	string s,t;
	cin>>s>>t;
	int res=0x3f3f3f3f;
	for(int i=0;i<s.size()-t.size()+1;i++) {
		int cnt=0;
		for(int j=i;j<i+t.size();j++) {
			if(s[j]!=t[j-i]) {
				cnt++;
			}
		}
		res=min(res,cnt);
	}
	cout<<res;
	return 0;
}

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

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483647

class RMQ {
private:
  int n;
  vector<int> data;
public:
  RMQ(int n_){
    n=1;
    while(n<n_) n*=2;
    data = vector<int>(2*n-1, 0);
  }
  void update(int k, int a){ // update data[k]=a, k(0-indexed)
    k+=n-1;
    data[k]+=a;
    while(k>0){
      k = (k-1)/2;
      data[k] += a;
    }
  }
  int query(int a,int b,int k=0,int l=0,int r=-1){ //min value in [a,b)
    if(r==-1) r=n;
    // k := current node, range of k := [l,r)
    if(r<=a || b<=l) return 0;
    if(a<=l && r<=b) return data[k];
    int vl=query(a,b,k*2+1,l,(l+r)/2);
    int vr=query(a,b,k*2+2,(l+r)/2,r);
    return vl+vr;
  }
  inline int operator[](int idx){ return data[idx+n-1]; }
}; // END class RMQ

int main(){
  int n,q;
  cin>>n>>q;

  RMQ rmq(n);

  rep(i,q){
    int c,x,y;
    cin>>c>>x>>y;
    if(c==0){
      rmq.update(x-1,y);
    } else {
      cout<<rmq.query(x-1,y)<<endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int city[5], k; 
    for (int i = 0; i < 5; i++) {
        cin >> city[i];
    }
    cin >> k;

    cout << (city[4] - city[0] > k ? ":(" : "Yay!") << endl;

    return 0;
}


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

int main() {
  int K, S;
  cin >> K >> S;
  
  int count = 0;
  for (int x = 0; x <= K; ++x) {
    for (int y = 0; y <= K; ++y) {
	  int z = S - x - y;
      if (0 <= z && z <= K) ++count;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3640
H, W, N = map(int, input().split())
li = []
for i in range(N):
  li.append(tuple(map(int, input().split())))
t = tuple(li)
st = set(t)
#print(t)

Js = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

for a, b in t:
  if a > H-2 or b > W-2:
    pass
  else:
    t_p1 = ((a, b), (a, b+1), (a, b+2),\
            (a+1, b), (a+1, b+1), (a+1, b+2),\
            (a+2, b), (a+2, b+1), (a+2, b+2))
    s1 = st & set(t_p1)
    ls1 = len(s1)
    Js[ls1] += 1
  
  if a > H-2 or b > W-1 or b < 2:
    pass
  else:
    t_p2 = ((a, b-1), (a, b), (a, b+1),\
            (a+1, b-1), (a+1, b), (a+1, b+1),\
            (a+2, b-1), (a+2, b), (a+2, b+1))
    s2 = st & set(t_p2)
    ls2 = len(s2)
    Js[ls2] += 1
  
  if a > H-2 or b < 3:
    pass
  else:
    t_p3 = ((a, b-2), (a, b-1), (a, b),\
            (a+1, b-2), (a+1, b-1), (a+1, b),\
            (a+2, b-2), (a+2, b-1), (a+2, b))
    s3 = st & set(t_p3)
    ls3 = len(s3)
    Js[ls3] += 1

  if a > H-1 or a < 2 or b > W-2:
    pass
  else:
    t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\
            (a, b), (a, b+1), (a, b+2),\
            (a+1, b), (a+1, b+1), (a+1, b+2))
    s4 = st & set(t_p4)
    ls4 = len(s4)
    Js[ls4] += 1
  
  if a > H-1 or a < 2 or b > W-1 or b < 2:
    pass
  else:
    t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\
            (a, b-1), (a, b), (a, b+1),\
            (a+1, b-1), (a+1, b), (a+1, b+1))
    s5 = st & set(t_p5)
    ls5 = len(s5)
    Js[ls5] += 1
  
  if a > H-1 or a < 2 or b < 3:
    pass
  else:
    t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\
            (a, b-2), (a, b-1), (a, b),\
            (a+1, b-2), (a+1, b-1), (a+1, b))
    s6 = st & set(t_p6)
    ls6 = len(s6)
    Js[ls6] += 1
  
  if a < 3 or b > W-2:
    pass
  else:
    t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\
            (a-1, b), (a-1, b+1), (a-1, b+2),\
            (a, b), (a, b+1), (a, b+2))
    s7 = st & set(t_p7)
    ls7 = len(s7)
    Js[ls7] += 1
  
  if a < 3 or b > W-1 or b < 2:
    pass
  else:
    t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\
            (a-1, b-1), (a-1, b), (a-1, b+1),\
            (a, b-1), (a, b), (a, b+1))
    s8 = st & set(t_p8)
    ls8 = len(s8)
    Js[ls8] += 1
  
  if a < 3 or b < 3:
    pass
  else:
    t_p9 = ((a-2, b-2), (a-2, b-1), (a-2, b),\
            (a-1, b-2), (a-1, b-1), (a-1, b),\
            (a, b-2), (a, b-1), (a, b))
    s9 = st & set(t_p9)
    ls9 = len(s9)
    Js[ls9] += 1

for i in range(1, 10):
  Js[i] = Js[i] // i

all = (H - 2) * (W - 2)
Js[0] = all - sum(Js)
  
for i in range(10):
  print(Js[i])

Measured memory_bytes: 23616
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

vector<int> g1(200001, 0);
vector<int> g2(200001, 0);
int main(){

  int n, m;
  cin >> n >> m;


  int a,b;
  for(int i = 0; i < m; i++){

    cin >> a >> b;
    if(a == 1){
      g1[b-1] = 1;
    }else if(b == n){
      g2[a-1] = 1;
    }
  }


  for(int i = 0; i < n; i++){
    if(g1[i] == 1){
      if(g2[i] == 1){
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
} 


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
 
using namespace std;
 
int main() {
	long long S, c;
	cin >> S >> c;
	long long set = 0;
 
	if (S - c / 2 <= 0) {
		set = S + (c - S * 2) / 4;
	}
	else {
		set = floor(c / 2);
	}
 
	cout << set << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

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

   int ans = 999999999;
   int calcres = 0;
   rep(i,s.size()-2){
      tmp.push_back(s[i]);
      tmp.push_back(s[i+1]);
      tmp.push_back(s[i+2]);
      calcres = stoi(tmp);
      ans = min(ans ,abs(calcres-753));
      tmp = "";
   }
   cout << ans << endl;




   return 0;
}

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


int main() {
  int N; cin >> N;
  vector<double> v(N); rep(i,N)cin >> v.at(i);
  sort(v.begin(),v.end());
  rep(i,N-1)v.at(i+1) = (v.at(i) + v.at(i+1)) / 2;
    cout << v.at(N-1) << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

using namespace std;
//using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll mod = 998244353;
const double eps = DBL_EPSILON;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL_DEBUG
    freopen("input.txt", "r", stdin);
#endif
    int a, b, c;
    cin >> a >> b >> c;
    cout << c _ a _ b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  long long N, K;
  cin >> N >> K;
  vector<pair<long long, long long>> array;
  array.push_back(make_pair(0, 0));
  rep(i, N)
  {
    long long a, b;
    cin >> a >> b;
    if (array.back().first != a)
      array.push_back(make_pair(a, b));
    else
      array.back().second += b;
  }
  sort(array.begin(), array.end());

  int ans = 0;
  long long count = 0;
  long long pre_count = 0;
  rep(i, array.size())
  {
    count += array[i].second;
    if (pre_count < K && K <= count)
      ans = array[i].first;
    pre_count = count;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2420
#include <stdio.h>

int main(void) {

    int A,B,C,D;
    scanf("%d %d %d %d", &A, &B, &C, &D);

    if(A*B >= C*D){
        printf("%d\n", A*B);
    }else{
        printf("%d\n", C*D);
    }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

#define N 99999

int main() {
	static int aa[N];
	int n, i, x, m;

	scanf("%d", &n);
	x = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]);
		x += aa[i];
	}
	for (i = 1; i < n; i += 2)
		x -= aa[i] * 2;
	printf("%d ", x);
	for (i = 0; i < n - 1; i++) {
		m = aa[i] * 2 - x;
		printf("%d ", m);
		x = m;
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <set>
using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.size(), m, a[100000] = {}, b[100000] = {};
	for (int i = 0; i < n; i++) {
		bool f = 1;
		if (i >= 2 && s[i - 1] == s[i] && s[i - 2] == s[i]) {
			a[b[i - 2]]++;
			b[i] = b[i - 2];
			f = 0;
		}
		if (f) {
			if (s[i] == 'L') {
				int j = i - 1;
				while (s[j] == 'L') {
					j--;
				}
				if ((i - j) % 2 == 0) {
					a[j]++;
					b[i] = j;
				}
				else {
					a[j + 1]++;
					b[i] = j + 1;
				}
			}
			else if (s[i] == 'R') {
				int j = i + 1;
				while (s[j] == 'R') {
					j++;
				}
				if ((j - i) % 2 == 0) {
					a[j]++;
					b[i] = j;
				}
				else {
					a[j - 1]++;
					b[i] = j - 1;
				}
			}
		}
	}
	for (int i = 0;i < n;i++) {
		if (i) cout << " ";
		cout << a[i];
	}
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  string s; cin >> s;
  int w; cin >> w;
  for (int i = 0; i < s.size(); i += w) {
    cout << s[i];
  }
  cout << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, minans = INT16_MAX;
	


	cin >> n;

	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		int count = 0;
		while (a % 2 == 0)
		{
			a = a / 2;
			count++;
		}
		minans = min(minans, count);
	}



	cout << minans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String s = sc.next();

//        System.out.println(a);
//        System.out.println(b);
//        System.out.println(s);

        boolean flag = true;
        for (int i = 0; i < s.length(); i++) {
            if (i == a) {
                if (s.charAt(i) != '-') {
                    flag = false;
                    break;
                }
            } else {
                try {
                    int n = Integer.parseInt("" + s.charAt(i));
                } catch (Exception e) {
                    flag = false;
                    break;
                }
            }
        }

        if (flag) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
fun main(args:Array<String>):Unit {
    println(Array(readLine()!!.toInt()){
        val arg = readLine()!!.split(' ')
        val (value, weight) = arg.take(2).map(String::toInt)
        val date = arg[3].toLong()
        Goods(value, weight, Type(arg[2]), date, arg.last())
    }.sorted().joinToString("\n"))
}
class Type(val name:String):Comparable<Type>{
    override fun compareTo(other: Type): Int {
        return name.first().compareTo(other.name.first())
    }

    override fun toString(): String {
        return name
    }
}
fun <T, A:Comparable<A>> Pair<T, T>.compareWith(factor:Iterable<T.() -> A>):Int {
    val (a, b) = this
    return factor.map{func -> a.func().compareTo(b.func())}.find{it != 0} ?: 0
}
class Goods(val value:Int, val weight:Int, val type:Type, val date:Long, val name:String):Comparable<Goods>{
    override fun compareTo(other: Goods): Int {
        return if (value == other.value)
            if (weight == other.weight)
                if (type.compareTo(other.type) == 0)
                    if (date == other.date) name.compareTo(other.name)
                    else date.compareTo(other.date)
                else type.compareTo(other.type)
            else weight.compareTo(other.weight)
        else value.compareTo(other.value)
    }
    override fun toString(): String {
        return "$value $weight $type $date $name"
    }
}


Measured memory_bytes: 142144
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=305;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,K,p,C[N][N],f[N][N],s[N][N];
void check(int &x,int y){if ((x+=y)>=p) x-=p;}
int pl(int x,int y){if ((x+=y)>=p) x-=p;return x;}

int main(){
	n=read();K=read();p=read();
	for (int i=0;i<=n;i++){
		C[i][0]=1;
		for (int j=1;j<=i;j++) C[i][j]=pl(C[i-1][j],C[i-1][j-1]);
	}
	for (int i=K;i>=0;i--){f[1][i]=1;s[1][i]=pl(f[1][i],s[1][i+1]);}
	for (int i=2;i<=n+1;i++)
	for (int j=K;j>=0;j--){
		for (int k=1;k<i;k++)
		check(f[i][j],(ll)f[i-k][j]*C[i-2][k-1]%p*s[k][j+1]%p);
		s[i][j]=pl(f[i][j],s[i][j+1]);
	}
	printf("%d\n",f[n+1][0]);
	return 0;
}

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

int main()
{
    ll N;
    cin >> N;

    map<string, ll> S;
    for (size_t i = 0; i < N; i++)
    {
        string temp;
        cin >> temp;
        S[temp]++;
    }

    ll ans = S.size();
    cout << ans << endl;
}


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

 
int main() {
    int n,k,d,a;
    cin >> n >> k;
    vector<int> A(n,0);
    rep(i,k){
        cin >> d;
        rep(i,d){
            cin >> a;a--;
            if(A[a]==0){
                n--;
                A[a]=-1;
            }
        }
    }
    cout << n << endl;
}

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

//int calc(vector<int> num, int roop, int &sum){

int main(){
  //桁数が増えるほど繰り返しが2倍されていく。
  //1桁=1回=2^0
  //2桁=2回=2^1
  //3桁=4回=2^2･･･
  //2^num.size()だけ。2でわってあまりが1なら＋して、0ならそのまま
 
  string S;
  cin >> S;
  vector<int> num(S.size());
  for(int i=0; i<S.size(); i++){
    num.at(i)=S.at(i)-48; //-48で数値化できる
  }

//繰り返し回数
  int roop=1;
  for(int i=0; i<num.size()-1; i++){
    roop*= 2;
  }
  
//和を求める
  long sum=0;
  for(int i=0; i<roop; i++){
    int k=i;
    long temp=0;
    for(int j=0; j<=num.size(); j++){
      if(j==num.size()){
        sum+=temp;
        break;
      }
      if(k%2==0){
        temp= temp*10+num.at(j);
      }
      else if(k%2==1){
        sum+= temp*10+num.at(j);
        temp=0;
      }
      k/=2;
    }
  }
  cout << sum << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, x; cin >> n >> x;
    if (1 < x && x < 2*n-1) {
        cout << "Yes" << endl;
        if (n == 2) {
            rep(i, 3) cout << i+1 << endl;
        }
        else {
            set<ll> s;
            rep(i, 1, 2*n) s.insert(i);
            vector<ll> ans(2*n-1, -1);
            ans[n-1] = x; s.erase(x);
            ans[n] = *s.begin(); s.erase(*s.begin()); // 最小
            ans[n-2] = *s.rbegin(); s.erase(*s.rbegin()); // 最大
            ans[n+1] = *s.rbegin(); s.erase(*s.rbegin()); // 最大
            ans[n-3] = *s.begin(); s.erase(*s.begin()); // 最小
            rep(i, ans.size()) {
                if (ans[i] >= 0) {
                    cout << ans[i] << endl;
                }
                else {
                    cout << *s.begin() << endl;
                    s.erase(*s.begin());
                }
            }
        }
    }
    else {
        cout << "No" << endl;
    }
}


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

// 小数点以下桁数
// fixed << setprecision(i)

int gcd(int a,int b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//   for(auto x : v) cout << x << " "; cout << "\n";    // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

int main()
{
  int n;
  bool flag = true;

  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < n - 1; i++)
  {
    if (a[i] == a[i + 1])
    {
      flag = false;
      break;
    }
  }
  cout << (flag ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3932
#include<iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
int main(){
	int n,i,flag=0,flag2=0;
	cin>>n;
	long long a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n;i++){
		if(a[i]%4==0){
			flag++;
		}
		if(a[i]%2==0&&a[i]%4!=0){
			flag2++;
		}
	}
	flag2/=2;
	int s=2*(flag+flag2)+1;
	if(n>s){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,a,b,counta=0,countb=0;
  while(1){
    cin >> n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin >> a >> b;
      if(a>b){
	counta=counta+a+b;
      } else if(a<b){
	countb=countb+a+b;
      } else if(a==b){
	counta+=a;
	countb+=a;
      }
    }
    cout << counta << " " << countb << endl;
    counta=0;
    countb=0;
  }
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> mochi;
	for (int i = 0; i < n; i++)
	{
		int j;
		cin >> j;  mochi.push_back(j);
	}
	int dan = 0;
	vector<int> name(1,0);
	for (int i = 0; i < n; i++)
	{
		for (int x = 0; x < name.size(); x++ )
		{
			if (mochi.at(i) == name.at(x))break;
			if (x+1 == name.size())
			{
				name.push_back(mochi.at(i));
				dan++;
			}
		}
	}
	cout << dan << endl;

}

Measured memory_bytes: 3632