akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int next_combination(int sub)
{
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, c;
    cin >> n >> c;
    vector<vector<int>> iwakan(c, vector<int>(c));
    for (int i = 0; i < c; i++)
    {
        for (int j = 0; j < c; j++)
        {
            cin >> iwakan[i][j];
        }
    }
    vector<vector<int>> color(n, vector<int>(n));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> color[i][j];
            color[i][j]--;
        }
    }

    vector<vector<int>> cost(3, vector<int>(c, 0));
    for (int e = 0; e < c; e++)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                cost[(i + j) % 3][e] += iwakan[color[i][j]][e];
            }
        }
    }

    int ans = INF;
    for (int bit = (1 << 3) - 1; bit < (1 << c); bit = next_combination(bit))
    {
        vector<int> kouho;
        for (int i = 0; i < c; i++)
        {
            if (bit & (1 << i))
            {
                kouho.push_back(i);
            }
        }

        do
        {
            int tmp = 0;
            for (int i = 0; i < 3; i++)
            {
                tmp += cost[i][kouho[i]];
            }
            chmin(ans, tmp);
        } while (next_permutation(ALL(kouho)));
    }
    cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int>x(N);
    vector<int>y(N);
    for (int i = 0; i < N; ++i) {
      cin >> x[i] >> y[i];
    }

    // x, yをソート
    vector<pair<int, int>> xy(N);
    vector<pair<int, int>> yx(N);
    for (int i = 0; i < N; ++i) {
        xy[i] = make_pair(x[i], y[i]);
        yx[i] = make_pair(y[i], x[i]);
    }
    sort(xy.begin(), xy.end());
    sort(yx.begin(), yx.end());
    for (int i = 0; i < N; ++i) {
        x[i] = xy[i].first;
        y[i] = yx[i].first;
    }

    // mapで探索済みか管理
    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; ++i) {
        mp[xy[i]] = 0;
    }

    ll ans = 0; // 操作後の点の数
    for (int i = 0; i < N; ++i) {
        if(mp[xy[i]] == 0){
            set<int> setX;
            set<int> setY;
            stack<pair<int, int>> st;
            st.push(xy[i]);
            while (! st.empty()){
                stack<int> coY; // stの点とx座標が同じ点のy座標
                while (! st.empty()){
                    auto top = st.top();
                    st.pop();
                    if(setX.count(top.first) == 0){
                        setX.insert(top.first);
                        auto iter1 = lower_bound(x.begin(), x.end(), top.first);
                        auto iter2 = upper_bound(x.begin(), x.end(), top.first);
                        for (int j = iter1 - x.begin(); j < iter2 - x.begin(); ++j) {
                            if(mp[xy[j]] == 0){
                                mp[xy[j]] = 1;
                                coY.push(xy[j].second);
                            }
                        }
                    }
                }
                while (! coY.empty()){
                    int top = coY.top();
                    coY.pop();
                    if(setY.count(top) == 0){
                        setY.insert(top);
                        auto iter1 = lower_bound(y.begin(), y.end(), top);
                        auto iter2 = upper_bound(y.begin(), y.end(), top);
                        for (int j = iter1 - y.begin(); j < iter2 - y.begin(); ++j) {
                            pair<int, int> rev = make_pair(yx[j].second, yx[j].first);
                            if(mp[rev] == 0){
                                mp[rev] = 1;
                                st.push(rev);
                            }
                        }
                    }
                }
            }

            ll temp = setX.size();
            temp *= setY.size();
            ans += temp;
        }
    }

    ans -= N;
    cout << ans;
    return 0;
}

Measured memory_bytes: 13568
words = STDIN.gets.split(/ /).sort!
maxlength = 0
maxappearance = 0
num = 0
temp = ""
out = Array.new
for i in 0.. words.length-1
  if maxlength < words[i].length
    maxlength = words[i].length
    out[1] = words[i]
  end
  if temp == words[i]
    num += 1
    temp = words[i]
  else
    num = 0
    temp = words[i]
  end
  if maxappearance < num
    maxappearance = num
    out[0] = words[i]
  end
end
puts out*" "

Measured memory_bytes: 2356
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		int l = sc.nextInt();
		int d, t, x, time = 0, max = 0;
		int[] tv = new int[n];
		int[] score = new int[n];
		for (int i = 0; i < r; i++) {
			d = sc.nextInt() - 1;
			t = sc.nextInt();
			x = sc.nextInt();
			tv[max] += t - time;
			score[d] += x;
			if (x > 0) {
				if (score[max] < score[d]) {
					max = d;
				} else if (score[max] == score[d]) {
					max = min(max, d);
				}
			} else if (max == d) {
				max = 0;
				for (int j = 1; j < n; j++) {
					if (score[max] < score[j]) {
						max = j;
					}
				}
			}
			time = t;
		}
		tv[max] += l - time;
		int ans = 0;
		for (int i = 1; i < n; i++) {
			if (tv[ans] < tv[i]) {
				ans = i;
			}
		}
		System.out.println(ans + 1);
		sc.close();
	}

	static int min(int a, int b) {
		return a < b ? a : b;
	}
}

Measured memory_bytes: 306784
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] w = Console.ReadLine().Split(' ');
            int[] nw = new int[n];
            int j = 0;
            foreach(string s in w)
            {
                nw[j] = int.Parse(s);
                j++;
            }

            int cnt=0, end = n;

            for(int i =2;i<n;i++)
            {
                if((nw[i - 2] < nw[i - 1]) & (nw[i-1] < nw[i]))
                {
                    cnt++; 
                }
                else
                {
                    if ((nw[i - 2] > nw[i - 1]) & (nw[i - 1] > nw[i]))
                    {
                        cnt++;
                    }
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


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

const int MAX_N =510000;

int par[MAX_N];
int depth[MAX_N];

void init(int n){
    for(int i=0; i<n; i++){
        par[i]=i;
        depth[i]=0;
    }
}

int find(int x){
    if(par[x]==x) return x;
    par[x] =find(par[x]);
    return par[x];
}

void unite(int x, int y){
    x = find(x); y = find(y);
    if(x==y) return;
    if(depth[x]<depth[y]) {par[x]=y; return;}
    if(depth[x]>depth[y]) {par[y]=x; return;}
    par[y]=x;
    depth[x]++;
    return;
}

bool same(int x,int y){
    return find(x)==find(y);
}


int main(){
    map<int,int> m1, m2; //m1i番目にある数, m2はiがある番号
    int N, M;
    cin >> N >> M;
    int p[100100];
    for(int i=1; i<=N; i++){
        cin >> p[i];
        m1[i] =p[i];
        m2[p[i]] =i;
    }
    init(N+1);
    for(int i=0; i<M; i++){
        int x, y;
        cin >> x >> y;
        unite (x,y);
    }
    int cnt=0;
    for(int i=1; i<=N; i++){
        if( same(i,m2[i]) ) {
            cnt++;
//            cout << i << endl;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 10752
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto & in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

std::string S;

template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T & arr, const U & v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR & arr, const U & v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> S;
	int64_t count = 0;
	int aftlen = 0;
	int64_t bc_cou = 0;
	for (int i = S.size()-1; i >= 0; --i)
	{

		if (aftlen == 0) {
			if (S[i] == 'C') {
				aftlen = 1;
			}
			else {
				bc_cou = aftlen = 0;
			}
		}
		else if (aftlen == 1) {
			if (S[i] == 'B') {
				aftlen = 2;
				++bc_cou;
			}
			else {
				bc_cou = aftlen = 0;
				if (S[i] == 'C') {
					aftlen = 1;
				}
			}
		}
		else {
			if (S[i] == 'C') {
				aftlen = 1;
			}
			else if (S[i] == 'A') {
				count += bc_cou;
			}
			else {
				bc_cou = aftlen = 0;
			}
		}
	}
	out << count << endl;
	return 0;
}
#endif


Measured memory_bytes: 832
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

const ll MOD = 1e9 + 7;

ll frac(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    return (n * frac(n - 1)) % MOD;
}

int main(int argc, char const *argv[])
{
    int n, m;
    cin >> n >> m;
    if (abs(n - m) >= 2)
    {
        cout << 0 << endl;
    }
    else if (abs(n - m) == 1)
    {
        cout << (frac(n) * frac(m)) % MOD << endl;
    }
    else
    {
        cout << (2 * frac(n) * frac(m)) % MOD << endl;
    }

    return 0;
}


Measured memory_bytes: 1792
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
if 1<=s1<=12 and 1<=s2<=12:
    print('AMBIGUOUS')
elif 1<=s1<=12:
    print('MMYY')
elif 1<=s2<=12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 9068
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  bool ans = false;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      if (i * j == n) {
        ans = true;
        break;
      }
    }
  }

  cout << (ans ? "Yes" : "No") << '\n';

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

pii red[200],blue[200];
int ans,n,f[200];
bool used[200];
int sz[200];
set <int> s[200];
sitr itr;
priority_queue <pii> q;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
        int x,y; cin>>x>>y;
        red[i]=mp(x,y);
    }
    for(int i=1;i<=n;i++){
        int x,y; cin>>x>>y;
        blue[i]=mp(x,y);
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            int a,b,c,d;
            a = red[i].fi;
            b = red[i].se;
            c = blue[j].fi;
            d = blue[j].se;
            if(a<c && b<d){sz[i]++;s[i].insert(j);f[j]++;}
        }

        if(sz[i]>0){q.push(mp(-1*sz[i],i));}
    }

    while(!q.empty()){
        int temp = q.top().se;
        int er = *s[temp].begin();
        int fm = f[er];
        for(itr = s[temp].begin();itr!= s[temp].end();itr++){
            if(f[*itr]<fm){
                fm = f[*itr];
                er = *itr;
            }
            f[*itr]--;
        }

        ans++;
        used[temp]=true;
        while(!q.empty())q.pop();

        for(int i=1;i<=n;i++){
            if(used[i])continue;
            if(s[i].count(er)){
                s[i].erase(s[i].find(er));
                sz[i]--;
                f[er]--;
            }
            if(sz[i]>0){q.push(mp(-1*sz[i],i));}
        }
    }
    cout<<ans<<newl;


}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<tuple>
#include<vector>
#include<cstdlib>
#include<cstdint>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip> 
#include<ctime>
#include<climits>
#include<random>
#include<queue>

using namespace std;
void Solve();

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

void Solve(){
  std::random_device rnd;
  std::mt19937 mt(rnd());
  std::uniform_int_distribution<> rand100(0,10000);
  double n;
    cin>>n;
  double ans=0.0;
  for(int i=0;i<5000000;i++){
    int x=rand100(mt);
    int y=rand100(mt);

    double d1=sqrt(x*x+y*y);
    
    if(d1<=10000){
      ans+=1.0;
    }
  }
  cout<<ans/5000000*8*n<<"\n";
}

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

int main() { 
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for (int& x : a) {
        scanf("%d", &x);
    }
    long double sum = 0.00;
    for (int x : a) {
        sum += (1.00 / x);
    }
    cout << 1.00 / sum;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char c = sc.next().charAt(0);
		if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
			System.out.println("vowel");
		else
			System.out.println("consonant");
	}
}

Measured memory_bytes: 23636
import java.util.*;
  public class Main{
      public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int[] counter  =new int[30];
        
        int i;
        while(sc.hasNext()){
        String str = sc.next();
        String str_low  =str.toLowerCase();
        for(i=0;i<str.length();i++){
          
          
          char value = str_low.charAt(i);
          if(value<123 && value>=97){
          counter[value-97]++;
        }
      }
      }
        for(i=97;i<123;i++){
          System.out.printf("%c : %d\n",i,counter[i-97]);
        }
      }
    }


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

typedef long long int llint;

int main(){
	llint A,B,K;
	cin >> A >> B >> K;
	if(B-A+1>=2*K){
		for(int i=1;i<=K;i++){
			cout << (A+(i-1)) << endl;
		}
		for(int i=K;i>=1;i--){
			cout << (B-(i-1)) << endl;
		}
	}else{
		for(llint i=A;i<=B;i++){
			cout << i << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#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 PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

const int MAX = 1e5+10;

int N;
ll s[MAX];

ll solve() {
    ll ans = 0;
    FOR (c, 1, N) {
        ll score = 0;
        ll k = 1;
        set<int> pos;
        while (k*c < N) {
            int a = N-1-k*c;
            int b = a-c;
            if (b <= 0 || b >= a) break;
            if (a == N-1-a || pos.find(a) != pos.end() || pos.find(N-1-a) != pos.end()) {
                break;
            }
            score += s[a];
            score += s[N-1-a];
            ans = max(ans, score);
            pos.insert(a);
            pos.insert(N-1-a);
            k++;
        }
    }
    return ans;
}

int main() {
    cin >> N;
    REP (i, N) cin >> s[i];
    cout << solve() << endl;
}

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

int waru2(int a){
    int cnt = 0;
    while(a % 2 == 0){
        cnt++;
        a /= 2;
    }
    return cnt;
}

int main(void){
    int N,cnt = 0;
    cin >> N;
    int a[N];
    for(int i = 0;i < N;i++)
    cin >> a[i];
    
    for(int j = 0;j < N;j++){
        cnt += waru2(a[j]);
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<map>
using namespace std;
#define N 215000
map<int,int> tp;
int n,s[N];
bool check(int k)
{
	if(k==1){for(int i=2;i<=n;i++)if(s[i]<=s[i-1])return 0;return 1;}
	tp.clear();
	int ls=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]>ls){ls=s[i];continue;}
		while(1)
		{
			if(!tp.size())break;
			map<int,int>::reverse_iterator it=tp.rbegin();
			if(it->first<=s[i])break;
			tp.erase(--(it.base()));
		}
		tp[s[i]]++;
		int t=s[i];
		while(tp[t]>=k){if(t==1)return 0;tp[t]-=k,tp[t-1]++,t--;}
		ls=s[i];
	}
	return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&s[i]);
	int lb=1,rb=n,as=n;
	while(lb<=rb)
	{
		int mid=(lb+rb)>>1;
		if(check(mid))as=mid,rb=mid-1;
		else lb=mid+1;
	}
	printf("%d\n",as);
}//

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl


using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}



//#define solvsh
//#define multi

#ifdef solvsh


#else

const int MAXN = 40;
const int MAXLOG = 20;


vector<int> v[10];

vector<int> t;
int n;

void init (int nn)
{
    n = nn;
    t.assign (n, 0);
}

int sum (int r)
{
    int result = 0;
    for (; r >= 0; r = (r & (r+1)) - 1)
        result += t[r];
    return result;
}

void inc (int i, int delta)
{
    for (; i < n; i = (i | (i+1)))
        t[i] += delta;
}

int sum (int l, int r)
{
    return sum (r) - sum (l-1);
}


int inp[MAXN][MAXN];
int curr[MAXN][MAXN];

void solve() {

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

    for (int i = 0 ; i < n; ++ i) {
        for (int j = 0; j < m; ++j) {
            char ch;

            cin >> ch;
            inp[i][j] = ch == '#' ? 1 : 0;
        }
    }

    int answr = 0;
    for (int i = 0; i < (1 << n ); ++ i){
        for (int j = 0; j < (1 << m); ++j)
        {
            int curr_cnt = 0;
            for (int ii = 0; ii < n; ++ ii){
                for (int jj = 0; jj < m; ++ jj) {

                    if (((1 << ii) & i) || ((1 << jj) & j)) {
                        curr[ii][jj] = 2;
                    } else {
                        curr[ii][jj] = inp[ii][jj];
                        if (curr[ii][jj] == 1) {
                            ++curr_cnt;
                        }
                    }
                }
            }

            if (curr_cnt == k)
                ++answr;
        }
    }


    cout << answr;
}

#endif

void multisolve() {

    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case #" << (i++) << ": ";
        solve();
//        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    multisolve();
#else
    solve();
//    gen();
#endif

}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll x;
int main()
{
	cin>>x;
	for(ll i=-120;i<=120;i++)
	for(ll j=-120;j<=120;j++)
	{
		if(i*i*i*i*i-j*j*j*j*j==x)
		{
			cout<<i<<" "<<j;
			return 0;
		}
	}
    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 101000
using namespace std;
int n, m, Num[N_], cnt, Out[N_];
vector<int>E[N_], L[N_];
void DFS(int a, int pp) {
	Num[a] = ++cnt;
	for (int i = 0; i < E[a].size(); i++) {
		int x = E[a][i];
		if (Num[x])continue;
		DFS(x, a);
	}
	for (int i = 0; i < E[a].size(); i++) {
		int x = E[a][i];
		if (Num[x] < Num[a] && x != pp) {
			Out[a]++;
			printf("%d %d\n", a, x);
		}
	}
	if (pp) {
		if (Out[a] & 1) {
			Out[a]++;
			printf("%d %d\n", a, pp);
		}
		else {
			Out[pp]++;
			printf("%d %d\n", pp, a);
		}
	}
}
int main() {
	int i, a, b;
	scanf("%d%d", &n, &m);
	for (i = 1; i <= m; i++) {
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		E[b].push_back(a);
		L[a].push_back(i);
		L[b].push_back(i);
	}
	if (m % 2) {
		puts("-1");
		return 0;
	}
	DFS(1, 0);
}

Measured memory_bytes: 19456
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> Ai = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			Ai.add(sc.nextInt());
		}
		Collections.sort(Ai);

		while (Ai.size() > 1) {
			int min = Ai.get(0);
			for (int i=Ai.size()-1; i>0; i--) {
				if (Ai.get(i) % min == 0) {
					Ai.remove(i);
				}
				else {
					Ai.set(i, Ai.get(i) % min);
				}

			}
			Collections.sort(Ai);
		}
		System.out.println(Ai.get(0));
	}

}


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

#define endl "\n"
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(),(x).end()
#define rect return 0
#define pause cout << endl; system("pause")
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(x) (int)(x).size()
#define Pi acos(-1.0)
#define bitcount __builtin_popcountll

#define TupleGet(name, index) std::get<(index)>(name)
#define FOR(a, b, c) for(int (a) = (b); (a) < (c); ++(a))
#define FORs(a, b, c) for(int (a) = (b); (a) <= (c); ++(a))
#define revFOR(a, b, c) for(int (a) = (b); (a) > (c); --(a))
#define revFORs(a, b, c) for(int (a) = (b); (a) >= (c); --(a))
#define foreach(it, a) for(auto it = (a).begin(); it != (a).end(); it++)

using namespace std;

// *** TYPEDEF'S, CONSTANTS AND FUNCTIONS *** //
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tii;
typedef vector<vector<int> > vvi;

/* |T| |I| |P| |S|
@ string abc = "abcdefghijklmnopqrstuvwxyz";
@ 'char' - 'a' ::: порядковый номер латинской буквы
@ 'digit' - '0' or 'digit' - 48 ::: (char) ---> (int)
@ 'A' = dec 65 'Z' = dec 90
  'a' = dec 97 'z' = dec 122
  '0' = dec 48 '9' = dec 57
@ Если страдает скорость ввода:
1) ios::sync_with_stdio(0);
   cin.tie(0);
2) юзать сканф
@ для стринга перевод i-того символа в другой регистр: a[i] = char (a[i] +- 32)  :::  32 == 'a' - 'A'
@ int n (m знаков) :::  n[1] = n / 10^(m-1) ; n[m] = n % 10 ; n[m-1] = (n % 100)/10 ; n[m-2] = (n % 1000)/100...
@ cout << fixed << setprecision(n) ::: n знаков после запятой, без "fixed" - всего n знаков
@ abs(x-y) < EPS ::: равентсво вещественных чисел x и y по точности EPS
@ x + EPS < y  или  x - EPS < y ::: сравнение больше-меньше для вещественных чисел по точности EPS
@ если цифру можешь записать из головы - так и пиши в программе, иначе - пиши ФОРМУЛУ
@ «экспонента» - целое число, показывающее, на сколько надо сдвинуть десятичную запятую в числе ::: 123e2 = 12300 , 123e-4 = 0.0123
@ если задача плохо решается при нумерации с единицы, иногда оказывается намного проще перейти к нумерации с нуля.
  Особенно задачах, где явно надо делить на равные части.
@ while(cin >>)  |||  while (getline(cin, )) ::: считывание, пока даются данные
@ ctrl+Z ::: конец файла в консоли
@ Глобальные массивы, чтобы не было ошибок; размер брать с запасом
@ Количество цифр N числа X в b-ичной записи, N = floor[ log[b](X) ] + 1
@ ios::sync_with_stdio(0); //ввод
@ cin.tie(0); cout.tie(0); //могут быть проблемы в интерактивных задачах (частый ввод-вывод)
*/

void A() {
    int n, k;
    cin >> n >> k;
    if (n % k == 0) {
        cout << 0;
    } else {
        cout << 1;
    }
}

int main() {
    A();
    return 0;
}

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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;


ll sum(ll n) {
  ll m=0;
  FOR(i,0,12){
    m+=n%10;
    n/=10;
  }
  return m;
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/


signed main() {
  ll n,y;
  	ci(n>>y);
  ll a=(y-1000*n);
  bool A=true;
  ll b;
  FOR(i,0,n+1){
    
    if((a-i*4000)%9000==0){
      b=(a-i*4000)/9000;
    
    if(i+b<=n&&b>=0){
      cout<<b<<" "<<i<<" "<<n-b-i<<endl;
      A=false;
      break;
    }
    }
    b=0;
  }
    if(A){
      cout<<-1<<" "<<-1<<" "<<-1<<endl;
    }
  }


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

int n, m;
vector<int> edge[5000];
int cnt[5000];

int main() {
	cin >> n >> m;
	
	REP(i, m) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		edge[a].push_back(b);
		cnt[b]++;
	}
	
	vector<int> ans;
	bool flag = false;
	vector<int> next;
	
	REP(i, n) if (cnt[i] == 0) next.push_back(i);
	
	REP(i, n) {
		int tar = next[next.size() - 1];
		ans.push_back(tar + 1);
		next.erase(next.end() - 1);
		
		if (next.size() > 0) flag = true;
		
		REP(j, edge[tar].size()) {
			int to = edge[tar][j];
			if (--cnt[to] == 0) next.push_back(to);
		}
	}
	
	REP(i, ans.size()) printf("%d\n", ans[i]);
	if (flag) puts("1");
	else puts("0");
	
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int n;
    cin >> n;
    vector<int> a(3*n);
    for (int i=0; i<3*n; ++i) {
        cin >> a.at(i);
    }

    priority_queue<int, vector<int>, greater<int>> P;
    priority_queue<int> B;
    vector<ll> maxi(2*n);
    ll sumP = 0, sumB = 0;
    for (int i=0; i<2*n; ++i) {
        int cur = a.at(i);
        if (i < n) {
            sumP += cur;
            P.push(cur);
        } else if (cur > P.top()) {
            int tmp = P.top(); P.pop();
            sumP += cur - tmp;
            P.push(cur);
        }
        maxi.at(i) = sumP;
    }
    ll res = -LINF;
    for (int i=3*n-1; i>=n; --i) {
        int cur = a.at(i);
        if (i >= 2*n) {
            sumB += cur;
            B.push(cur);
        } else if (cur < B.top()) {
            int tmp = B.top(); B.pop();
            sumB += cur - tmp;
            B.push(cur);
        }
        if (i <= 2*n) chmax(res, maxi.at(i-1) - sumB);
    }
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 4216
// avvinci - sem_7 
// #include"prettyprint.hpp"
#include<bits/stdc++.h>
using namespace std;

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

#define mod 1000000007 
#define pb push_back
#define mk make_pair
#define fs first
#define sc second
#define ll long long int
#define fr(it,st,en) for(it=st;it<en;it++)
#define all(container) container.begin(),container.end()
#define INP ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ws(x) cout << #x << " = " << x << endl
#define sz(x)  (ll)x.size()
#define N 1000004

const long long infl = 1e18+5;

ll n,m,k,q,x,y,f,val,t=1,i,j;
ll ind = -1,sz,sm,ans,mx = -1,mn = infl ;
ll cnt[29] ;
string s ; 
int main(){
INP
if (fopen("inp.txt", "r")) {
    freopen("myfile.txt","w",stdout);
    freopen("inp.txt", "r", stdin);
}



cin>>s;
fr(i,0,s.size()){
    ll diff = i - cnt[s[i]-'a'];
    cnt[s[i] -'a']++  ;
    ans += diff ; 
}
cout<<ans +1; 

return 0 ;
}

Measured memory_bytes: 720
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

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

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    }

    private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    }

}


Measured memory_bytes: 35896
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
from collections import Counter

def main():
    N = int(input())
    S = {}
    cnt = 0
    for i in range(N):
        s = ''.join(sorted(list(input())))
        if not s in S.keys():
            S[s] = 1
        else:
            cnt += S[s]
            S[s] += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 18192
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int N;
    int A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    string S, T;
    S.push_back('.');
    cin >> T;
    S += T;
    if(C > D){
        bool is = false;
        for(int i = B; i <= D; i++){
            if(S[i-1] == '.' && S[i] == '.' && S[i+1] == '.') is = true;
        }
        if(!is){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = A+1; i<= C; i++){
        if(S[i] == '#' && S[i-1] == '#'){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = B+1; i <= D; i++){
        if(S[i] == '#' && S[i-1] == '#'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3764
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<utility>
#include<vector>
using namespace std;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
//--------------------

int main() {
	long long res = 0;
	long long A, B, C, D; cin >> A >> B >> C >> D;
	long long mylcm = lcm(C, D);
    res = B - A + 1;
	long long CA , CB , DA , DB , LA, LB;
    CA = (A / C) * C; //Aは左に
    if (A % C != 0) CA += C;
    CB = (B / C) * C;
    DA = (A / D) * D;
    if (A % D != 0) DA += D;
    DB = (B / D) * D;
	LA = (A / mylcm) * mylcm; //LA切り捨て
    if (A % mylcm != 0) LA += mylcm;
	LB = (B / mylcm) * mylcm; //LB切り捨て
  
    res -= (CB - CA) / C + (DB - DA) / D - (LB - LA) / mylcm;
    res--;
    cout << res << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
int main()
{
		int a, b, c, d;
		scanf("%d", &a);
		b = a /3600;
		c = (a / 60) % 60;
		d = a % 60;
		printf("%d:%d:%d\n", b, c, d);
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    string s;
    cin >> s;
    int cntb = 0,cntr =0;
    rep(i,s.size()){
        if(s[i]=='0'){
            cntr++;
        }else{
            cntb++;
        }
    }
    cout << 2 * min(cntr, cntb) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define vec vector<ll>
#define ms multiset<ll>
#define f(i,x,n) for(int i=x;i<n;i++)
#define int long long
#define mod 1000000007
#define endl "\n"
void fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}
int32_t main()
{
	fastio();
	int n;
	cin>>n;
	int w[n],sm=0;
	f(i,0,n)
	{
		cin>>w[i];
		sm+=w[i];
	}
	int mn=1e9;
	int s1=0,s2=0,pt=1;
	f(i,0,n-1)
	{
		// if(i<=pt)
		// {
		// 	s1+=w[i];
		// }
		// else
		// {
		// 	s2=sm-s1;
		// 	mn=min(mn,abs(s1-s2));
		// 	pt++;
		// 	if(pt==n)
		// 		break;
		// 	i--;
		// }
		s1+=w[i];
		s2=sm-s1;
		mn=min(mn,abs(s2-s1));
	}
	cout<<mn<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  long n,k;
  scanf("%ld %ld", &n, &k);
  long a[n+1];
  for (long i = 1; i <= n; i++) {
    scanf("%ld", &a[i]);
  }
  int visited[n+1][2];
  visited[1][0] = 1;
  visited[1][1] = 0;
  for (long i = 2; i <= n; i++) {
    visited[i][0] = 0;
  }
  long cur = 1;
  long telepote = 0;
  long f_a,f_b;
  while (1) {
    telepote++;
    cur = a[cur];
    if (telepote == k) {
      printf("%ld\n", cur);
      return 0;
    }
    if (visited[cur][0] == 0) {
      visited[cur][0] = 1;
      visited[cur][1] = telepote;
    } else {
      if (cur == 1) {
        f_a = 0;
        f_b = telepote;
      } else {
        f_a = visited[cur][1];
        f_b = telepote-visited[cur][1];
      }
      break;
    }
  }
  long left = k-telepote;
  left %= f_b;
  telepote = 0;
  while (1) {
    if (telepote == left) {
      printf("%ld\n", cur);
      break;
    }
    telepote++;
    cur = a[cur];
  }

  return 0;
}

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

using namespace std;

int main()
{
  int a,b;
  cin >> a >> b;
  int half=b/2;
  if(a<=5){cout << 0 << endl;}
  else if( a>= 13){cout << b << endl;}
  else
  {
    cout << half << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long; using ll = long long; using ld = long double;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
template<typename T> using minQ = priority_queue<T, vector<T>, greater<T>>;

#define endl '\n'
#define ALL(a)       (a).begin(),(a).end()
#define FOR(i,a,b)   for(ll i = (ll)(a); i < (ll)(b); ++i)
#define FORO(i,a,b)  for(ll i = (ll)(a); i <= (ll)(b); ++i)
#define RFOR(i,a,b)  for(ll i = (ll)(b) - 1; i >= (ll)(a); --i)
#define RFORO(i,a,b) for(ll i = (ll)(b); i >= (ll)(a); --i)
#define REP(i,n)     for(ll i = 0; i < (ll)(n); ++i)
#define REPO(i,n)    for(ll i = 1; i <= (ll)(n); ++i)
#define RREP(i,n)    for(ll i = (ll)(n) - 1; i >= 0; --i)
#define RREPO(i,n)   for(ll i = (ll)(n); i >= 1; --i)
#define SORT(a)      sort(ALL(a))
#define UNIQ(a)      a.erase(unique(ALL(a)), a.end())
#define SUNIQ(a)     SORT(a), UNIQ(a)
#define MINI(a,b)    a=min(a,(b))
#define MAXI(a,b)    a=max(a,(b))

const ll mod = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LINF = 1000000000000000000ll;
const ld eps = 1e-8;
const ld PI = acosl(-1);

ll Nll() { ll a; cin >> a; return a; }
ld Nld() { ld a; cin >> a; return a; }
int Ni() { int a; cin >> a; return a; }
char Nc() { char a; cin >> a; return a; }
string Ns() { string a; cin >> a; return a; }

template <typename T>
void O(const T &a) { cout << a << endl; }
template <typename T>
void O(T &&a) { cout << a << endl; }
template <typename T>
void Os(const vector<T> &v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Os(vector<T> &&v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Is(vector<T> &v) { for (auto& t : v) cin >> t; }

void yes(bool f) { cout << (f ? "yes" : "no") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }

struct Edge {
	int from, to;
	Edge() {}
	Edge(int f, int t) : from(f), to(t) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void solve();

int main() { ios::sync_with_stdio(false), cin.tie(0); cout << fixed << setprecision(20); solve(); }

//-----------------------------------------------template-------------------------------------------------------------

//-----------------------------------------------library-------------------------------------------------------------

void solve()
{
	string A = Ns();
	ll N = A.size();
	ll val = 0;
	vl cnt(26);
	REP(i, N) ++cnt[A[i] - 'a'];
	REP(i, 26) val += cnt[i] * (cnt[i] - 1) / 2;
	O(N * (N - 1) / 2 - val + 1);
}


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

typedef long long ll;

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

  ll sum = 0;
  rep(i, n.size()) sum += (n.at(i) - '0');

  string ans;
  if (sum % 9 == 0) {
    ans = "Yes";
  } else {
    ans = "No";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

const int limit = 1e9;

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

	int x1, y1, x2, y2, x3, y3;
	x3 = 0;
	y3 = 0;
	// x1y2 - x2y1 = s;

	if (s > limit) {
		x1 = limit;
		y2 = s / limit + 1;
		if (y2 > limit) {
			y2 = limit;
		}

		x2 = 1LL * x1 * y2 - s;
		y1 = 1;
	} else {
		x1 = s;
		y1 = 0;
		x2 = 0;
		y2 = 1;
	}


	cout << x1 << " " << y1 << " ";
	cout << x2 << " " << y2 << " ";
	cout << x3 << " " << y3 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long X;
    long long Y;

    if (a < 0 && b < 0 && c < 0 && d < 0) { /*負負　負負*/
        X = a;
        Y = c;
    }
    else if (a < 0 && 0 <= b && c < 0 && 0 <= d && a * c>=b * d) { /*負正　負正の負＊負が大きい*/
        X = a;
        Y = c;
    }
    else if (0 <= a && 0 <= b && c < 0 && d < 0) { /*正正　負負*/
        X = a;
        Y = d;
    }
    else if (a < 0 && b < 0 && 0 <= c && 0 <= d) { /*負負　正正*/
        X = b;
        Y = c;
    }
    else if (a < 0 && 0 <= b && c < 0 && d < 0) {
        X = a;                                          /*負正　負負*/
        Y = c;
    }
    else if (a < 0 && b < 0 && c < 0 && 0 <= d) {   /*負負　負正*/
        X = a;
        Y = c;
    }
    else {
        X = b;
        Y = d;

    }



    cout << X * Y;
}


Measured memory_bytes: 3640
n = int(input())
l =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(l[n-1])
            

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    ll n;
    cin>> n;

    cout << (n * (n-1))/2;
    nl;


    return 0;
}




Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long LL;
const int INF = int(1e9);

int a[26] = {0};
int N,M;

int main()
{
    cin>>N>>M;
    for(int i = 1;i<=N;i++)
    for(int j = 1;j<=M;j++){
        char temp;
        cin>>temp;
        a[temp-'a']++;
    }
    int t4 = (N/2)*(M/2);
    int flag = 0;
    for(int i = 0;i<26;i++){
        if(a[i]==0)continue;
        if(a[i]>=4){
            if(a[i]/4<t4){
                t4 -= a[i]/4;
                a[i] = a[i]%4;
            }
            else{
                t4 = 0;
                a[i] = a[i] - t4*4;
            }
        }
        if(a[i]>1)
            a[i]%=2;
        if(a[i]==1&&flag==0)
            flag = 1;
        else if(a[i]==1&&flag==1)
            flag = 2;
        
    }
    if(t4<=0&&flag<=1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#define r(i,n) for(int i=0; i<n; i++)
typedef long long ll;
using namespace std;

int main(void){
  int a, b, x;
  cin >> a >> b >> x;
  if(a<=x && (a+b>=x)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


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

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

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

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

using namespace std;

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    using P = pair<int,int>; //to, idx
    vector<vector<P> > adj(n);
    rep(i,n-1){
        int a,b; cin>>a>>b; a--; b--;
        adj[a].emplace_back(b,i);
        adj[b].emplace_back(a,i);
    }
    int m; cin>>m;
    vector<ll> es(m);
    rep(i,m){
        int u,v; cin>>u>>v; u--; v--;

        using T = tuple<int,int,ll>; //node, par, es
        queue<T> que;
        que.emplace(u,-1,0ll);
        while(que.size()){
            int node, p; ll nowes;
            tie(node,p,nowes) = que.front(); que.pop();
            if (node==v){
                es[i] = nowes;
                break;
            }
            for(auto e:adj[node]){
                if (e.fi!=p){
                    que.emplace(e.fi,node,nowes|(1ll<<e.se));
                }
            }
        }
    }
    
    ll ans=0;
    rep(i,1<<m){
        int popcnt = __builtin_popcountll(i);
        int sign = (popcnt&1)? -1 : 1;
        ll edges=0;
        rep(j,m){
            if (i&(1<<j)) edges|=es[j];
        }
        int free = (n-1)-__builtin_popcountll(edges);
        ans += (ll)sign*(1ll<<free);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		long T = scan.nextLong();
		long[] t = new long[N];
		for(int i = 0; i < N; i++) {
			t[i] = scan.nextLong();
		}
		long X = 0;
		for(int i = 1; i < N; i++) {
			if(t[i] - t[i - 1] >= T) {
				X += T;
			} else {
				X += t[i] - t[i - 1];
			}
		}
		X += T;
		
		System.out.println(X);
		scan.close();
	}

}


Measured memory_bytes: 64680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b >= c) Yes();
  else No();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
using pp=pair<int,pair<int,int>>;
#define MOD 1000000007
#define INF 1000000000

int main(){
  int N;
  cin>>N;
  if(N%1000==0){
    cout<<0<<endl;
  }else{
    cout<<1000-N%1000<<endl;
  }
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;

int N;

int main() {
    cin >> N;
    vector<map<char, int>> cnt(N);
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        for (int j = 0; j < S.size(); j++) {
            cnt[i][S[j]]++;
        }
    }
    map<char, int> ans = cnt[0];
    for (auto itr = ans.begin(); itr != ans.end(); itr++) {
        char c = (*itr).first;
        for (int i = 1; i < N; i++) {
            if (ans[c] > cnt[i][c]) {
                ans[c] = cnt[i][c];
            }
        }
        for (int j = 0; j < ans[c]; j++) {
            cout << c;
        }
    }
    cout << endl;
}

Measured memory_bytes: 256