akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Main {
	/**
	 * ??\?????????????????? / ????????????????????????
	 */
	public static void main(String[] args) throws Exception {

		// ??\???????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int verticalLineCount = Integer.parseInt(br.readLine());
		// ???????????????????£??????° ???????????????
		String[] verticalLine = new String[verticalLineCount];
		List<String> goalNumberList = Arrays.asList(verticalLine);

		List<List<String>> allSideLine = processAllSideLine(br);

		goalNumberList = processGoalNumberList(goalNumberList, allSideLine);

		// ???????????????
		for (String string : goalNumberList) {

			System.out.println(string);
		}
	}

	/**
	 * ??¨???????¨??£?????????¨??????????´??????????????¬?????????????????????????
	 */
	public static List<List<String>> processAllSideLine(BufferedReader br) throws IOException {

		int sideLineCount = Integer.parseInt(br.readLine());
		List<List<String>> allSideLine = new ArrayList<>();

		for (int i = 0; i < sideLineCount; i++) {

			String[] sideLine = br.readLine().split(",");
			List<String> sideLineToList = Arrays.asList(sideLine);
			allSideLine.add(sideLineToList);
		}

		return allSideLine;
	}

	/**
	 * ????????????????????????????????????????????????????????§?????????????????????????????????????????§????????????
	 */
	public static List<String> processGoalNumberList(List<String> goalNumberList, List<List<String>> allSideLine) {

		for (int startNumber = 0; startNumber < goalNumberList.size(); startNumber++) {

			String goalNumber = String.valueOf(startNumber + 1);

			for (int j = 0; j < allSideLine.size(); j++) {

				String sideNode_1 = allSideLine.get(j).get(0);
				String sideNode_2 = allSideLine.get(j).get(1);

				if (sideNode_1.equals(goalNumber)) {

					goalNumber = sideNode_2;
				} else if (sideNode_2.equals(goalNumber)) {

					goalNumber = sideNode_1;
				}
			}

			goalNumberList.set(Integer.parseInt(goalNumber) - 1, String.valueOf(startNumber + 1));
		}

		return goalNumberList;
	}
}

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

int main() {
  
  int N;
  cin >> N ;
  
  if (N%101 < 100 && N%101%10 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    ll ans = 0;
    for (auto&& p : mp) {
        if (p.fi < p.se) ans += p.se - p.fi;
        else if (p.fi > p.se) ans += p.se;
    }
    cout << ans << endl;
}


Measured memory_bytes: 7988
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

ll f(ll x){
    if (x < 0) return 0;

    x++;
    ll ans = 0;
    rep(i, 50){
        ll loop = 1LL<<(i+1);
        ll cnt = (x / loop) * (loop / 2);
        cnt += max(0LL, (x % loop) - (loop / 2));

        if (cnt % 2 == 1){
            ans += 1LL<<i;
        }
    }
    return ans;
}

int main(){
    ll a, b;
    cin >> a >> b;
    ll ans = f(b) ^ f(a-1);
    cout << ans << endl;
    return 0;
}


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

#define REP(i, n, m) for(int i = n; i < m; i++)
#define REPR(i, n, m) for(int i = n; i >= m; i--)
#define LREP(i, n, m) for(ll i = n; i < m; i++)
#define LREPR(i, n, m) for(ll i = n; i >= m; i--)

#define P pair<int, int >


const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;

typedef long long ll;


//---functions---//
int gcd(int a, int b){
    if(a < b) swap(a, b);
    return b?gcd(b, a%b):a;
}

int s2i(string num){stringstream ss; ss << num << flush; int n; ss >> n; return n;}
string i2s(int n){stringstream ss; ss << n << flush; return ss.str();}

bool firstCompare(const P& firstElof, const P& secondElof){
    return firstElof.first < secondElof.first;
}
bool secondCompare(const P& firstElof, const P& secondElof){
    return firstElof.second < secondElof.second;
}
//---------------//

ll N, M;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> M;
    if(N >= 3 && M >= 3) cout << (N - 2) * (M - 2) << endl;
    else if(N == 1 && M == 1) cout << 1 << endl;
    else if(N == 1 && M > 1) cout << M - 2 << endl;
    else if(N > 1 && M == 1) cout << N - 2 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

    vector<long long> odd;
    vector<long long> even;

    for(long long i = 0; i < n; i++){
        long long a;
        cin >> a;
        if(a % 2 == 0){
            even.push_back(a);
        }
        else{
            odd.push_back(a);
        }
    }

    if(odd.size() == n){
        printf("0\n");
        return 0;
    }

    long long count_max = 0;
    long long count = 0;
    for(long long i = 0; i < even.size(); i++){
        long long num = even[i];
        
        while(num % 2 == 0){
            num /= 2;
            count++;
        }
        //count_max = max(count_max, count);
    }

    cout << count << endl;
    return 0;


}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n,M[MAX][MAX];

int prim()
{
    int u,minv,i,v;
    int d[MAX],p[MAX],color[MAX];
    int sum = 0;

    for(i=0;i<n;i++)
    {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }

    d[0] = 0;

    while(1)
    {
        minv = INFTY;
        u = -1;

        for(i=0;i<n;i++)
        {
            if(minv > d[i] && color[i] != BLACK)
            {
                u = i;
                minv = d[i];
            }
        }

        if(u == -1) break;
        color[u] = BLACK;

        for(v=0;v<n;v++)
        {
            if(color[v] != BLACK && M[u][v] != INFTY)
            {
                if(d[v] > M[u][v])
                {
                    d[v] = M[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }

   

    for(i=0;i<n;i++)
    {
        if(p[i] != -1) sum += M[i][p[i]];
    }

    return sum;
}

int main()
{
    int i,j,e;
    cin >> n;

    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            cin >> e;
            M[i][j] = (e == -1) ? INFTY : e;
        }
    }

    cout << prim() << endl;

    return 0;
    
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x1,y1,x2,y2,cx,cy;
	cin>>x1>>y1>>x2>>y2;
	cx=x1-x2;
	cy=y1-y2;
	cout<<x2+cy<<' '<<y2-cx<<' '<<x1+cy<<' '<<y1-cx;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<array>
#include<vector>

using namespace std;

vector<vector<int>>tile(22, vector<int>(22));

array<int, 4>mx = { -1,0,0,1 };
array<int, 4>my = { 0,-1,1,0 };

void walk(int x, int y) {
	tile[x][y] = 1;
	for (int i = 0; i < 4; i++) {
		if (tile[x + mx[i]][y + my[i]] != 0)continue;
		walk(x + mx[i], y + my[i]);
	}
}

int main() {
	int w, h;
	while (cin >> w >> h, w) {
		int stx, sty;
		for (auto &i : tile) {
			for (auto &j : i) {
				j = -1;
			}
		}
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				char ti;
				cin >> ti;
				if (ti == '.')tile[j][i] = 0;
				else if (ti == '#')tile[j][i] = -1;
				else {
					tile[j][i] = 1;
					stx = j; sty = i;
				}
			}
		}
		walk(stx, sty);
		int ans = 0;
		for (auto i : tile) {
			for (auto j : i) {
				if (j == 1)ans++;
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S; cin >> S;
    int count = 0;
    for(int i = 0; i < 3;i++){
        if(S.at(i) == 'o'){
            count++;
        }
    }
cout << 700 + (100 * count) << endl;
return 0;
}

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

string S;
int N, c[300009][3], cnt[3], Q1[300009], Q2[300009];
vector<int> A[3];

int main() {
	cin >> N >> S;
	for (int i = 0; i < S.size(); i++) {
		int ind = 2;
		if (S[i] == 'R') ind = 0;
		if (S[i] == 'G') ind = 1;
		c[cnt[ind]][ind] = i; cnt[ind]++;
	}
	for (int i = 0; i < N; i++) sort(c[i], c[i] + 3);
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < N; j++) A[i].push_back(c[j][i]);
	}
	for (int i = 0; i < N; i++) {
		int pos1 = lower_bound(A[0].begin(), A[0].end(), A[1][i]) - A[0].begin();
		Q1[i] = pos1;
	}
	for (int i = 0; i < N; i++) {
		int pos1 = lower_bound(A[2].begin(), A[2].end(), A[1][i]) - A[2].begin();
		Q2[i] = N - pos1;
	}
	long long ans = 1, mod = 998244353;
	for (int i = 0; i < N; i++) { ans *= 1LL * max(0LL, 1LL * (Q1[i] - i)); ans %= mod; }
	for (int i = 0; i < N; i++) { ans *= 1LL * max(0LL, 1LL * (Q2[i] - (N - i - 1LL))); ans %= mod; }
	for (int i = 1; i <= N; i++) { ans *= (1LL * i); ans %= mod; }
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4736
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


a, b = inl()
print((a + b) % 24)


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];
  sort(a.begin(), a.end());
  sort(c.begin(), c.end());
  ll ans = 0;
  rep(i, n) {
    int na = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
    int nc = c.end() - upper_bound(c.begin(), c.end(), b[i]);
    // printf("i = %d, na = %d, nc = %d\n", i, na, nc);
    ans += (ll)na * nc;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4588
k,n=map(int,input().split())
a=list(map(int,input().split()))
d=[""]*n
for i in range(n-1):
    d[i]=a[i+1]-a[i]
d[n-1]=k+a[0]-a[n-1]
d.sort()
print(k-d[n-1])

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

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}

int main()
{
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    vector<int> x(n), y(m);

    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];

    sort(all(x));
    sort(all(y));

    string ans = "War";
    for (int i = X + 1; i <= Y; i++)
    {
        if (i > x.back() && i <= y[0])
            ans = "No War";
    }

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


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int x = sc.nextInt();

		int m[] = new int[n];

		int minCost = Integer.MAX_VALUE;
		int total = 0;
		for(int i = 0; i < n; i++){
			m[i] = sc.nextInt();
			minCost = Math.min(minCost, m[i]);
			total += m[i];
		}


		System.out.println((x - total)/minCost + n);
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;


int main(void){
    ll n;
    cin>>n;
    vector<ll>c(n);
    for(ll i=0;i<n;i++)cin>>c[i];
    sort(c.begin(),c.end());
    ll ans=1;
    for(ll i=0;i<2*n-2;i++){
        ans = ans*2;
        ans = ans%N;
    }
    ll ans2 = 0;
    for(ll i=0;i<n;i++){
        ll tmp =(n-i+1)*c[i];
        tmp = tmp%N;
        ans2 = (ans2+tmp)%N;
    }
    cout<<(N+(ans*ans2)%N)%N<<endl;
    return 0;
}

Measured memory_bytes: 1792
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int prime(int x){
  for(int i=2;i*i<=x;i++){
    if( x%i==0 )return 0;
  }
  return 1;
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        
  // int a,b,k;
  // cin >> a >> b >> k;
  // int d = min(a,k);
  // a-=d;
  // k-=d;
  // d = min(k, b);
  // b-=d;
  // cout<<a << " " << b << endl;    
  string s,t;
  cin >> s >> t;
  cout << t << s << endl;

return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    int n=s.size();
    ll ans=0,b=0;
    rep(i,n){
        if(s[i]=='B') b++;
        else ans+=b;
    }
    cout<<ans;
}

Measured memory_bytes: 3668
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){
    int n; cin >> n;
    int res = 0;
    if(n <600)res = 8;
    else if(n<800)res = 7;
    else if(n<1000)res=6;
    else if(n<1200)res=5;
    else if(n<1400)res = 4;
    else if(n<1600)res = 3;
    else if(n<1800)res= 2;
    else res = 1;
    cout << res << ln;
}
    


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    ll a;
    const ll MOD=1e9+7;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(ll a,ll b){
    modint n(1),A(a);
    while(b){
        if(b&1) n*=A;
        A*=A;
        b>>=1;
    }
    return n;
}

modint f(vector<modint>& s,int i,int d){
    if(i<d) return s[i];
    else return s[i]-s[i-d];
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,h,d;
    cin>>n>>h>>d;
    modint ans,k,c(1);
    Fr(i,n){
        c*=i;
        k+=c;
    }
    vector<modint> s(h+1);
    s[0]=1;
    fr(i,h-1){
        ans=k*f(s,i,d);
        s[i+1]=s[i]+ans;
    }
    cout<<c*f(s,h-1,d)<<endl;
}

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

using namespace std;

#define ll long long
ll input(){
	ll x=0,f=0;char ch=getchar();
	while(ch<'0'||ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return f? -x:x;
}

const int N=20,M=1<<N;

ll st[M],dp[M];
int a[N][N];

int main(){
	int n=input();
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			a[i][j]=input();

	for(int t=0;t<(1<<n);t++){
		for(int i=0;i<n;i++)
			for(int j=i+1;j<n;j++){
				if((t&(1<<i))&&(t&(1<<j)))
					st[t]+=a[i][j];
			}
	}

	for(int t=0;t<(1<<n);t++){
		for(int t2=t;t2>0;t2=(t2-1)&t){
			ll tmp=dp[t-t2]+st[t2];
			dp[t]=max(dp[t],tmp);
		}
	}

	printf("%lld\n",dp[(1<<n)-1]);
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main(){
  	vector<int> a(100);
  	int n,t;
  	cin >> n;
  	for(int i = 1; i <= n; i++) {
    	t = i;
      	while(t % 2 == 0) {
        	a[2]++;
          	t >>= 1;
        }
      	for(int j = 3; j<=97; j+=2) {
        	while(t%j == 0) {
            	a[j]++;
              	t /= j;
            }
        }
    }
  	// 3 5 15 25 75
  	vector<int> k(5);
  	for(int i = 2; i <= 97; i++) {
      	if(a[i] >= 74)
      		k[4]++;
  		else if(a[i]>= 24)
      		k[3]++;
      	else if(a[i] >= 14)
          	k[2]++;
      	else if(a[i] >= 4)
          	k[1]++;
      	else if(a[i] >= 2)
          	k[0]++;
    }
  	int count = 0,tmp = k[1]+k[2]+k[3]+k[4];
  	count = k[4];
  	count += (k[4] + k[3]) * (k[0] + tmp - 1);
  	count += (k[4] + k[3] + k[2]) * (tmp - 1);
  	count += (tmp)*(tmp-1)/2*(k[0]+tmp-2);
  	
  	cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;

int main(){
  int n,m; cin>>n >>m;
  vector<bool>k(n+1,true);
  vector<long long int>dp(n+2);dp[0]=1;
  for(int i=0;i<m;i++){
    int a; cin>>a;
    k[a]=false;
  }
  for(int i=0;i<n;i++){
    if(k[i]){
      dp[i+1]+=dp[i];
      dp[i+1]%=mod;
      dp[i+2]+=dp[i];
      dp[i+2]%=mod;
    }
  }
  cout<<dp[n]<<endl;
}

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

bool judge(int n){
  if(10<=n&&n<=99) return false;
  if(1000<=n&&n<=9999) return false;
  if(100000<=n&&n<=999999) return false;
  return true;
}

int main()
{
  int n;
  cin>>n;
  int cnt=0;
  for (int i = 1; i <= n; ++i)
  {
    if(judge(i)) cnt++;
  }
  cout<<cnt;
}

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

    int main() {
        
        int n;
        long long d;
        cin >> n >> d;
        int ans=0;
        
        for(int i=0; i<n; i++){
            
            long long x,y;
            cin >> x >> y;
                
             long long sq = x*x + y*y;  
                if(sqrt(sq)<=d)
                    ans++;
                
            }
        
        cout << ans <<' ';
        
        return 0;
        }

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string S;
    cin >>S;
    if(S[0]== S[1] && S[1]==S[2]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    


    return 0;
    

}

Measured memory_bytes: 3588
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define REP(i, n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()

using namespace std;


class BTimeLimitExceeded {
public:
    ll N, T;
    ll c;
    ll t;
    ll m = 10000;

    void solve(std::istream& in, std::ostream& out) {
        in >> N >> T;
        REP(i, N) {
            in >> c >> t;
            if (t <= T) m = min(c, m);
        }
        if (m == 10000) out << "TLE" << endl;
        else out << m << endl;
    }
};


int main() {
    BTimeLimitExceeded solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main()
{
    long n, t, i, ans = 0;
    cin >> n >> t;
    vector<long> time(n);
    for (i = 0; i < n; i++)
    {
        cin >> time.at(i);
    }
    for (i = 0; i < n - 1; i++)
    {
        if (t + time.at(i) > time.at(i + 1))
        {
            ans += time.at(i + 1) - time.at(i);
        }
        else
        {
            ans += t;
        }
    }
    ans += t;
    cout << ans << endl;
}

Measured memory_bytes: 4720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    vector<ll> prefix_sum(n+1);
    rep(i,n){
        prefix_sum[i+1] = prefix_sum[i] + a[i];
    }
    ll ans = 1e18;
    for(int i = 0; i < n; i++){
        ll left = prefix_sum[i];
        ll right = prefix_sum[n] - prefix_sum[i];
        ans = min(ans, abs(right - left));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
import sys
input = sys.stdin.readline

n = int(input())
Words = [input() for _ in range(n)]


w = [list(x) for x in Words]

for i in range(n-1):
    if w[i+1][0] != w[i][-2]:
        print('No')
        exit()



if len(set(Words)) == n:
    print('Yes')
else:
    print('No')

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

int dp[85][85][40000]={};
int grid[85][85];

int main(){
    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>grid[i][j];
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int k;
            cin>>k;
            grid[i][j]=abs(grid[i][j]-k);
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int x=grid[i][j];
            if(i==0&&j==0){
                dp[i][j][20000+x]=1;
                dp[i][j][20000-x]=1;
                continue;
            }
            if(i==0){
                for(int k=1000;k<39000;k++){
                    dp[i][j][k]+=max(dp[i][j-1][k+x],0);
                    dp[i][j][k]+=max(dp[i][j-1][k-x],0);
                    dp[i][j][k]=min(1,dp[i][j][k]);
                }
                continue;
            }
            if(j==0){
                for(int k=1000;k<39000;k++){
                    dp[i][j][k]+=max(dp[i-1][j][k+x],0);
                    dp[i][j][k]+=max(dp[i-1][j][k-x],0);
                    dp[i][j][k]=min(1,dp[i][j][k]);
                }
                continue;
            }

            for(int k=1000;k<39000;k++){
                dp[i][j][k]+=max(dp[i][j-1][k+x],0);
                dp[i][j][k]+=max(dp[i][j-1][k-x],0);
                dp[i][j][k]=min(1,dp[i][j][k]);
            }
            for(int k=1000;k<39000;k++){
                dp[i][j][k]+=max(dp[i-1][j][k+x],0);
                dp[i][j][k]+=max(dp[i-1][j][k-x],0);
                dp[i][j][k]=min(1,dp[i][j][k]);
            }
        }
    }

    int ans=50000;
    for(int i=0;i<40000;i++){
        if(dp[h-1][w-1][i]>0){
            ans=min(ans,abs(i-20000));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 978964
#include <stdio.h>

typedef struct{
  char suit;
  char value;
} Card;

void Bubble(Card *X, int n)
{
  int i, j;
  Card card1;
  for(i = 0; i < n; i++){
    for(j = n-1; j >= i; j--){
      if(X[j].value < X[j-1].value){
	card1 = X[j];
	X[j] = X[j-1];
	X[j-1] = card1;
      }
    }
  }
}

void Selection(Card *X, int n)
{
  int i, j, k;
  Card card2;
  for(i = 0; i < n; i++){
    k = i;
    for(j = i; j < n; j++) if(X[j].value < X[k].value) k = j;
    card2 = X[i];
    X[i] = X[k];
    X[k] = card2;
  }
}

int TorF(Card *X, Card *Y, int n)
{
  int i, count=0;
  for(i = 0; i < n; i++) if(X[i].suit == Y[i].suit) count++;
  return count;
}

void Print(Card *X, int n)
{
  int i;
  for(i = 0; i < n; i++){
    if(i != n-1) printf("%c%c ", X[i].suit, X[i].value);
    else printf("%c%c", X[i].suit, X[i].value);
  }
  printf("\n");
}

int main()
{

  int n, i;
  Card C1[100], C2[100];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf(" %c%c",&C1[i].suit,&C1[i].value);
    C2[i] = C1[i];
  }

  Bubble(C1, n);
  Selection(C2, n);

  Print(C1, n);
  printf("Stable\n");
  Print(C2, n);
  if(TorF(C1, C2, n) == n) printf("Stable\n");
  else printf("Not stable\n");
  
  return 0;
}

Measured memory_bytes: 612
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.io.IOException;
import java.lang.String;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.BitSet;
import java.io.IOException;
import java.util.Arrays;
import java.util.GregorianCalendar;

public class Main {

    static BigInteger modulo = new BigInteger("1000000007");
    static long mod = 1000000007;
//    Nested ststic class FastReaders

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

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

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

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

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    }

    static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    }

    public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    }

    public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        int a = input.nextInt();
        int b = input.nextInt();
        if(a > 12){
            System.out.println(b);
        }else if(a <= 5){
            System.out.println(0);
        }else
            System.out.println(b/2);
    }

}


Measured memory_bytes: 20820
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repll(i, a, b) for(ll i=(a); i<(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl
#define ALL(a) (a).begin(),(a).end()
const long long int mod = 1e9 + 7;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false); 
    string S;
    int K;
    cin >> K >> S;
    string C;C.rs(K+3);
    if(S.size()<=K){
        cout << S << endl;
        return 0;
    }else{
        rep(i,0,K){
            C[i] = S[i];
        }
        C[K+1]='.';
        C[K+2]='.';
        C[K]='.';
    }
    cout << C << endl;
    return 0 ;
}

Measured memory_bytes: 3656
# https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_b

n = int(input())
nums = [int(i) for i in input().split()]
for i in range(n - 1):
    nums[i + 1] += nums[i]

ans = float('inf')
for i in range(n - 1):
    d = abs(nums[-1] - nums[i] * 2)
    ans = min(ans, d)
print(ans)

Measured memory_bytes: 88016
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin >>n;
  
  for(int i = 0; i < n.size(); i++){
    if(n.at(i) == '1'){n.at(i) = '9';}
    else if(n.at(i) == '9'){n.at(i) = '1';}
  }
  cout <<n<< endl;
  
  return 0;
}

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

typedef long long ll;

const ll mod = 998244353;

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

	int cells, segments;
	cin >> cells >> segments;
	size_t begin = cells + 1;
	size_t end = begin + cells;
	vector<ll> cell(begin * 2 + 1), sum(begin * 2 + 1);
	vector<pair<size_t, size_t>> segment(segments);
	for (int i = 0; i < segments; ++i)
	{
		cin >> segment[i].first >> segment[i].second;
		++segment[i].second;
	}
	cell[begin] = 1, sum[begin] = 1;
	for (size_t i = begin + 1; i < end; ++i)
	{
		for (auto &x : segment)
		{
			// cerr << sum[i - x.first] << " " << sum[i - x.second] << "\n";
			cell[i] += sum[i - x.first] - sum[i - x.second] + mod;
			cell[i] %= mod;
		}
		sum[i] = (sum[i - 1] + cell[i]) % mod;
		// for (size_t j = begin; j < end; ++j)
		// 	cerr << cell[j] << " ";
		// cerr << "\n";
		// for (size_t j = begin; j < end; ++j)
		// 	cerr << sum[j] << " ";
		// cerr << "\n";
	}
	cout << cell[end - 1] << "\n";

	return 0;
}

Measured memory_bytes: 9528
// AOJ 0212 (http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0212)
#include <cstdio>
#include <algorithm>
#include <limits>
#include <queue>
#include <utility>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

constexpr int MAX_N = 100, INF = std::numeric_limits<int>::max()>>2;

using P = std::pair<int, std::pair<int, int>>;

struct edge
{
  int to, cost;

  edge( int to, int cost )
  : to(to), cost(cost)
  {}
};

int c, n, m, s, d;
std::vector<edge> G[MAX_N];
int dp[MAX_N][11];

int main()
{
  while( scanf( "%d%d%d%d%d", &c, &n, &m, &s, &d ), c|n|m|s|d )
  {
    --s; --d;
    
    rep( i, n )
      G[i].clear();

    rep( i, m )
    {
      int a, b, f;
      scanf( "%d%d%d", &a, &b, &f );
      --a; --b;
      G[a].emplace_back( edge( b, f ) );
      G[b].emplace_back( edge( a, f ) );
    }

    std::fill( (int*)dp, (int*)(dp+n), INF );

    std::priority_queue<P, std::vector<P>, std::greater<P>> pque;
    pque.push( P( 0, std::make_pair( s, 0 ) ) );
    dp[s][0] = 0;
    while( !pque.empty() )
    {
      P p = pque.top(); pque.pop();
      int dist = p.first, v = p.second.first, ticket = p.second.second;

      if( dist > dp[v][ticket] )
        continue;

      for( auto e : G[v] )
      {
        if( dp[e.to][ticket] > dist+e.cost )
        {
          dp[e.to][ticket] = dist+e.cost;
          pque.push( P( dp[e.to][ticket], std::make_pair( e.to, ticket ) ) );
        }
        if( ticket < 10 && dp[e.to][ticket+1] > dist+e.cost/2 )
        {
          dp[e.to][ticket+1] = dist+e.cost/2;
          pque.push( P( dp[e.to][ticket+1], std::make_pair( e.to, ticket+1 ) ) );
        }
      }
    }

    printf( "%d\n", *std::min_element( dp[d], dp[d]+c+1 ) );
  }

  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    string S;
    cin >> S;
    if(S=="Sunny") cout << "Cloudy";
    if(S=="Cloudy") cout << "Rainy";
    if(S=="Rainy") cout << "Sunny";
    return 0;
}



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


int main (){
    int H, W;
    cin>>H>>W;
    vector<vector<char>> A(H, vector<char>(W));
    vector<vector<int>> B(H, vector<int>(W));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin>>A.at(i).at(j);
            B.at(i).at(j)=(A.at(i).at(j)=='#'?1:0);
        }
    }
    for(int i=0; i<H; i++){
        int Sum=0;
        for(int j=0; j<W; j++){
            Sum += B.at(i).at(j);
        }
        if(Sum==0){
            for(int j=0; j<W; j++){
                A.at(i).at(j)='%';
            }
        }
    }
    for(int i=0; i<W; i++){
        int Sum=0;
        for(int j=0; j<H; j++){
            Sum += B.at(j).at(i);
        }
        if(Sum==0){
            for(int j=0; j<H; j++){
                A.at(j).at(i)='%';
            }
        }
    }

    for(int i=0; i<H; i++){
        bool Check=false;
        for(int j=0; j<W; j++){
            if(!(A.at(i).at(j)=='%')){
                cout<<A.at(i).at(j);
                Check=true;
            }
        }
        if(Check){
            cout<<endl;
        }
    }
    
}

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

int main() {
  int a, b, c, d, e, f, g, h, t, s1, s2;
  cin >> a >> b >> c >> d >> e >> f;
  a *= 100;
  b *= 100;

  for(int i = 0; i <= 30 && i*a <= f; ++i) {
    for(int j = 0; j <= 30 && j*b + i*a <= f; ++j) {
      if(i + j) {
        g = i*a + j*b;
        h = min(g*e/100, f-g);
        t = 0;

        for(int k = 0; k <= 100 && c*k <= h; k++) {
          for(int l = 0; l <= 100 && c*k + d*l <= h; l++) {
            t = max(t, c*k+d*l);
          }
        }
        if(s1 == 0 || t*(s1+s2) > s2*(g+t)) {
          s1 = g;
          s2 = t;
        }
      }
    }
  }

  cout << s1+s2 << " " << s2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


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



int main(){
    int n;cin>>n;
    set<int> s;
    rep(i,0,n-1){
        int k;cin>>k;
        s.insert(k);
    }
    auto ite=s.begin();
    int ans=0;
    for(auto i=ite;i!=s.end();i++){
        ans++;
    }
    
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
let rec for_fold a b v f = if a >= b then v else for_fold (a+1) b (f v a) f
let () =
  Scanf.scanf "%d %d" @@ fun n k ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  for_fold 0 (n-k+1) 10101010101010 (fun s i ->
    let l, r = a.(i), a.(i+k-1) in
    if r <= 0 then min s (abs l)
    else if l >= 0 then min s r
    else min (r-2*l) (2*r-l) |> min s)
  |> Printf.printf "%d\n"

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll dp[105][2][5];
int main(){
  ll n; cin >> n;
  ll cnt=0;
  rep1(i,n){
    ll p; cin >> p;
    if(i!=p) cnt++;
  }
  cout << (cnt==0||cnt==2 ? "YES":"NO");
  return 0;
}

Measured memory_bytes: 256
// C - Lower
#include <iostream>
#include<algorithm>
using namespace std;

int main() {
	int N; cin >> N;
	int ans = 0;
	int count = 0;
	int pre, now; cin >> pre;
	for (int i = 1; i < N; ++i) {
		cin >> now;
		if (pre >= now){ count++; 
		}else{ count = 0; 
		}
		pre = now;
		ans = max(count, ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  int a,b,c;
  cin>>a>>b>>c;
  int ma = b/a;
cout<<min(b/a,c);


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int N,M,X;
    cin >> N >> M >> X;
    
    int A[100] = {};
    for(int i=0;i<M;i++){
        cin >> A[i];
    }
    bool costs[100] = {};
    for(int i=0;i<M;i++){
        costs[A[i]] = true;
    }
    
    int root1 = 0,root2 = 0;
    
    for(int i=X;i<=N;i++){
        if(costs[i] == true){
            root1++;
        }
    }
    for(int i=X;i>=0;i--){
        if(costs[i] == true){
            root2++;
        }
    }
    
    cout << min(root1,root2) << endl;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define INF 1000000007
int main(){
int c[3][3];
rep(i,3){
  rep(j,3){
    cin>>c[i][j];
  }
}
bool flag=true;
rep(i,2){
  rep(j,2){
    if(c[i][j]-c[i+1][j]!=c[i][j+1]-c[i+1][j+1]){
      flag=false;
    }
  }
}
if(flag){
  cout<<"Yes"<<endl;
}else
{
  cout<<"No"<<endl;
}

  return 0;
}


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

int main(){
 
	vector <vector <int>> sqr(3,vector<int>(3));
   
  	//配列に格納
 	for(auto it=sqr.at(0).begin();it!=sqr.at(0).end();++it)cin>>*it;
	for(auto it=sqr.at(1).begin();it!=sqr.at(1).end();++it)cin>>*it;
	for(auto it=sqr.at(2).begin();it!=sqr.at(2).end();++it)cin>>*it;
 
	//条件が正しいとき、各列の隣項同士の差、各行の隣項同士の差は等しくなる
	if((sqr[0][1]-sqr[0][0]==sqr[1][1]-sqr[1][0])&&(sqr[1][1]-sqr[1][0]==sqr[2][1]-sqr[2][0])
		&&(sqr[0][2]-sqr[0][1]==sqr[1][2]-sqr[1][1])&&(sqr[1][2]-sqr[1][1]==sqr[2][2]-sqr[2][1])
		&&(sqr[0][0]-sqr[1][0]==sqr[0][1]-sqr[1][1])&&(sqr[0][1]-sqr[1][1]==sqr[0][2]-sqr[1][2])
     	&&(sqr[1][0]-sqr[2][0]==sqr[1][1]-sqr[2][1])&&(sqr[1][1]-sqr[2][1]==sqr[1][2]-sqr[2][2])
		){
      		cout<<"Yes"<<endl;
         }else{
      		cout<<"No"<<endl;
    	}
    

}

Measured memory_bytes: 256
n=int(input())
c=0
a=0
for i in range(n):
    d1,d2=[int(x) for x in input().split()]
    if d1==d2:
        c+=1
        if c==3:
            a=1
    else:
        c=0
if a==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 62368
#include<stdio.h>
int main()
{
    int a,b,c,x;
    scanf("%d%d%d%d",&a,&b,&c,&x);
    int i,j,k,count=0;
    for(i=0;i<=a;i++)
    {
        if(i*500<=x)
        {
            for(j=0;j<=b;j++)
            {
                if(i*500+j*100<=x)
                {
                    for(k=0;k<=c;k++)
                    {
                        if(i*500+j*100+k*50==x)
                        {
                            count++;
                            break;
                        }
                    }
                }

            }
        }

    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 1000000009
using P = pair<int,int>;

int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<char>> grid(h,vector<char>(w));
  rep(i,h) rep(j,w) cin >> grid[i][j];

  queue<P> que;
  vvint visit(h,vint(w));
  rep(i,h) rep(j,w){
    if(grid[i][j] == '#'){
      que.push(P(i,j));
      visit[i][j] = 1;
    }
  }
  while(que.size() > 0){
    P p = que.front();
    que.pop();
    vint dx = {-1,0,0,1};
    vint dy = {0,-1,1,0};
    int cx = p.first;
    int cy = p.second;
    rep(i,4){
      int nx = cx + dx[i];
      int ny = cy + dy[i];
      if(nx < 0 || ny < 0 || h <= nx || w <= ny) continue;
      if(visit[nx][ny] == 0){
        visit[nx][ny] = visit[cx][cy] + 1;
        que.push(P(nx,ny));
      }
    }
  }
  int ans = 0;
  rep(i,h) rep(j,w){
    if (visit[i][j] > ans) {
      ans = visit[i][j];
    }
  }
  cout << ans - 1 << endl;
}



Measured memory_bytes: 13328
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    a_list = i_row(n)

    link = [[] for _ in range(n + 1)]

    for i, a in enumerate(a_list):
        if i+1 != 2:
            link[i+1].append(a)
        
    
    dist = [-1] * (n + 1)
    que = deque([1])

    while que:
        v = que.popleft()
        for i in link[v]:
            if dist[i] == -1:
                dist[i] = v
                que.append(i)

    count = 0
    j = 2
    while j != 1:
        j = dist[j]
        if j == -1:
            count = -1
            break
        count += 1
    
    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 25320