akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>

class Graph{
public:
	std::vector< std::vector<int> > A;
	std::vector<int> d;
	std::list<std::vector<int> > Q;
	int n;

	Graph(int n);

	void BreadthFirstSearch();

};

Graph::Graph(int n){
	A.resize(n);
	d.resize(n);
	for (int i = 0; i < n; i++){
		A[i].resize(n);
		for (int j = 0; j < n; j++){
			A[i][j] = 0;
		}
		d[i] = -1;
	}
	this->n = n;
}

void Graph::BreadthFirstSearch(){
	d[0] = 0;
	std::vector<int> a(2, 0);
	a[1] = 1;
	Q.push_back(a);
	while (!Q.empty()){
		std::vector<int> f = Q.front();
		Q.pop_front();
		for (int i = 0; i < n; i++){
			if (A[f[0]][i] == 1 && d[i] == -1){
				d[i] = f[1];
				a[0] = i;
				a[1] = f[1] + 1;
				Q.push_back(a);
			}
		}
	}
	return;
}

int main(){
	int n, u, k, v;
	scanf("%d", &n);
	Graph G(n);
	for (int i = 0; i < n; i++){
		scanf("%d%d", &u, &k);
		for (int j = 0; j < k; j++){
			scanf("%d", &v);
			G.A[u - 1][v - 1] = 1;
		}
	}

	G.BreadthFirstSearch();

	for (int i = 0; i < n; i++){
		printf("%d %d\n", i+1, G.d[i]);
	}


	return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
//typedef pair<int,int> P;
//typedef pair<int,P> PP;

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

int n;

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

	cin>>n;
	cout<<n/3<<endl;

	return 0;
}


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

//----------------------------------------------------------------------------------------------------------------------
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

#define mp make_pair
#define pb push_back
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
    os<<"("<<p.first<<": "<<p.second<<")";
    return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
    os<<"{";
    for(int i = 0;i < (int)v.size(); i++){
        if(i)os<<", ";
        os<<v[i];
    }
    os<<"}";
    return os;
}


//#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
//----------------------------------------------------------------------------------------------------------------------




int main()
{
    fastio;

    long n,m;
    cin >> n >> m;
    vector<bool> ac(n+1, false);
    vector <long> pen(n+1, 0);
    string v;
    long p;

    long ca = 0;
    long wa = 0;
    for (long i = 0; i < m; i++)
    {
        cin >> p >> v;
        if (ac[p])
            continue;
        if (v == "WA")
            pen[p] ++;
        else
        {
            wa += pen[p];
            ca ++;
            ac[p] = true;
        }
    }
    cout << ca << " " << wa;


    return 0;
}

Measured memory_bytes: 1024
N = int(input())
A = [int(a) for a in input().split(' ')]

counter = 0

l = 0
r = 0
flag = True
xor = 0
sum = 0

while r < N and l < N:
    if flag:
        xor ^= A[r]
        sum += A[r]
        if xor == sum:
            counter += (r - l + 1)
        else:
            flag = False
    else:
        xor ^= A[l-1]
        sum -= A[l-1]
        if xor == sum:
            counter += r - l + 1
            flag = True

    if flag:
        r += 1
    else:
        l += 1

print(counter)


Measured memory_bytes: 23560
#include<cstdio>

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

using namespace std;

int main(){
	static bool era[1<<15];
	era[0]=era[1]=1;
	rep(i,1<<8)	if(!era[i])	for(int j=i*i;j<1<<15;j+=i)	era[j]=1;

	for(int n;scanf("%d",&n),n;){
		int cnt=0;
		rep(i,n/2+1)	if(!era[i] && !era[n-i])	cnt++;
		printf("%d\n",cnt);
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<algorithm>
using namespace std;
void f(int);
int a,y;
int main()
{
	int b,i,flg;
	char s[11];
	scanf("%d %s",&a,s);
	f(0);
	while(1){
		if(a==y){
			break;
		}
	}
	b=0;
	for(i=0;i<3200;i++){
		b++;
	}
	flg=0;
	if(a>=b){
		flg=1;
	}
	else {
		flg=0;
	}
	if(flg==1) printf("%s\n",s);
	else printf("red\n");
}
void f(int x)
{
	if(x==3){
		y=a;
	}
	else {
		f(x+1);
	}
}

Measured memory_bytes: 1660
A, B, C = map(int, input().split()) # 横に2個

ans = A
for i in [A, B, C]:
    if i % 2 == 0:
        ans = 0

if ans != 0:
    F = []
    if C > 1:
        F.append(A*B)
    if B > 1:
        F.append(C*A)
    if A > 1:
        F.append(B*C)
    ans = min(F)

print(ans)

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll n;
	ll count1 = 0;
	ll count2 = 0;

	cin >> n;

	REP(i, n) {
		ll a;
		cin >> a;
		if (a % 2 == 1) {
			count1++;
		}
		else if (a % 4 == 0) {
			count2++;
		}
	}

	if (count1 <= count2) {
		cout << "Yes" << endl;
	}
	else if(count1 + count2 == n && count1 == count2 + 1){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
 int N, D;
 cin >> N >> D;

 int sum = 1 + 2 * D;
 int ans;
 if(N % sum == 0) ans = N / sum;
 else ans = (N / sum) + 1;
 print(ans);
 }

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int main(){
    int A, B;
    cin >> A >> B;
    static int64_t comb[2001][2001], S[2001][2001];
    for(int i=0; i<=2000; i++){
        comb[i][0] = comb[i][i] = 1;
        for(int j=1; j<i; j++) comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % MOD;
        S[i][i] = comb[i][i];
        for(int j=i-1; j>=0; j--) S[i][j] = (comb[i][j] + S[i][j+1]) % MOD;
    }

    int64_t ans = 0;
    for(int r=0; r<=A; r++) for(int b=0; b<=min(B-1, A-r); b++){
        int64_t res = r+1;
        mul(res, comb[B-1][b]);
        if(b == 0 && A-r-b > 0) continue;
        if(b > 0) mul(res, S[b-1][max(0, 2*b+r-A-1)]);
        add(ans, res);
    }
    cout << ans << endl;
}


Measured memory_bytes: 61312
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		char arr[] = S.toCharArray();
		int r = 0;//2
		int max = 0;
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]=='R') {
				r++;
			}else {
				if (max<r) {
					max = r;
					r = 0;
				}else {
					r = 0;
				}
			}
		}
		if (max<r) {
			System.out.println(r);
		}else {
		System.out.println(max);
		}
	}
}

Measured memory_bytes: 35676
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    while (1) {
        int n, a, b;
        string s;
        cin >> n;
        if (n == 0) break;
        vector<int> sum(1e5);
        rep(i,n) {
            cin >> s;
            a = 0, b = 0;
            a += ((s[0]-'0')*10+(s[1]-'0')) * 3600;
            a += ((s[3]-'0')*10+(s[4]-'0')) * 60;
            a += (s[6]-'0')*10+(s[7]-'0');
            cin >> s;
            b += ((s[0]-'0')*10+(s[1]-'0')) * 3600;
            b += ((s[3]-'0')*10+(s[4]-'0')) * 60;
            b += (s[6]-'0')*10+(s[7]-'0');
            // cout << a << " " << b << endl;
            sum[a]++; sum[b]--;
        }
        int ans = 0, now = 0;
        rep(i,1e5) {
            now += sum[i];
            chmax(ans, now);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main(){
  int N,k,l,m,ans;
  cin >> N;
  cin >> k;
  ans=0;
  for(int i=1;i<N;i++){
    cin >> l;
    if(k==l){
     l=0;
     ans++;
    }
    k=l;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    ll n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;



    bool cc = true;
    for(ll i=a;i<c;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            cc=false;
            break;
        }
    }

    for(ll i=b;i<d;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            cc=false;
            break;
        }
    }

    if(!cc){
        cout<<"No"<<endl;
        return 0;
    }

    if(c<d){
        cout<<"Yes"<<endl;
        return 0;
    }else{
        //s = '#'+ s + '#';
        bool f = false;
            for (ll i = b-1; i < d; i++) {
                if(i+1<n&&s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
                   cout<<"Yes"<<endl;
                   return 0;
                }
            }


            cout<<"No"<<endl;
//        for(int i=b-1;i<=d-1;i++) if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
//                puts("Yes");
//                return 0;
//            }
//        puts("No");
//        return 0;


    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(a) signed(a.size())
using namespace std;
bool within(ll i, ll j, ll h, ll w){
	return (i>=1 && j>=1 && i<=h && j <=w);	
}
void bfs01(ll i, ll j,vector<vector<ll>> &d, vector<vector<char>> &ar, ll h, ll w){
	if(ar[i][j] == '#') return;
	deque<pair<ll,ll>> q;
	q.push_back({i,j});
	d[i][j] = 0;
	while(!q.empty()){
		pair<ll,ll> from  = q.front();
		q.pop_front();
		for(ll x=-2;x<=2;x++){
			for(ll y=-2;y<=2;y++){
				ll ni = from.first+x,nj = from.second+y; 
				if(within(ni,nj,h,w) && ar[ni][nj] != '#'){
					if((abs(ni-from.first)+abs(nj-from.second))>1){
						if(d[ni][nj]>d[from.first][from.second]+1)
						q.push_back({ni,nj});
						d[ni][nj] = min(d[from.first][from.second]+1,d[ni][nj]);
					}
					else{
						if(d[ni][nj]>d[from.first][from.second])
						q.push_front({ni,nj});
						d[ni][nj] = d[from.first][from.second];	
					}
				}
			}
		}		
	}
}
void solve(){
	ll h,w;
	cin >> h >> w;
	ll s[2],des[2];
	cin >> s[0] >> s[1] >> des[0] >> des[1];
	vector<vector<char>> ar(h+1,vector<char>(w+1,'0'));
	vector<vector<ll>> d(h+1,vector<ll>(w+1,1e9));
	for(ll i=1;i<=h;i++){
		for(ll j=1;j<=w;j++){
			cin >> ar[i][j];
		}
	}
	bfs01(s[0],s[1],d,ar,h,w);
	cout << ((d[des[0]][des[1]] >= 1e9 ) ? -1 : d[des[0]][des[1]]) << "\n";
}

int main() {
    FAST;
    ll t=1;
    //cin>>t;
    while(t--) solve();	
    return 0;
}



Measured memory_bytes: 12584
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	int a,b,c;
	while(cin >> a >> b)
	{
		stringstream s;
	c = a+b;

	s << c;
	cout << s.str().size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    int N,M; cin >> N >> M ;
    vector<pair<ll,int> > xx(N);
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        xx[i] = make_pair(a,b);
    }
    ll cnt=0,sum=0;
    sort(xx.begin(),xx.end());
    bool f=false;
    int j=0;
    while(!f){
        cerr << "  " << xx[j].first << " " << xx[j].second << endl;
        for(int i=0;i<xx[j].second;i++){
            sum += xx[j].first;
            cnt++;
            if(cnt==M){
                f=true;
                break;
            }
        }
        j++;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1792
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#include <cassert>
#include <chrono>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head
int diff (string a, string b) {
    int cnt = 0;
    for (int i = 0; i < sz(a); i++)
        cnt += (a[i] != b[i]);
    return cnt;
}

void solve() {
    string s, t;
    cin >> s >> t;
    int ans = INT_MAX;
    for (int i = 0; i <= sz(s) - sz(t); i++) {
        ans = min(ans, diff(s.substr(i, sz(t)), t));
    }
    cout << ans << "\n";
}

int main() {
    #ifdef LOCAL
    auto t1 = std::chrono::high_resolution_clock::now();
    #endif

    io;
    solve();

    #ifdef LOCAL
    auto t2 = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();

    std::cout << "Time Taken: " << duration << "\n";
    #endif

}
// check for edge cases in limits
// printing double may print 1.223232e9 like values, beware of that
// carefully observe simulation of test cases
// multiset erase is does not do what it is supposed to


Measured memory_bytes: 3644
#include <stdio.h>
#include <math.h>

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

	while (scanf("%d", &n), ~n){
		double x = 1, y = 0;
		double r;
		int i;

		r = M_PI;
		for (i = 1; i < n; i++){
			r -= M_PI / 2;
			x += cos(r);
			y += sin(r);
			r = atan2(y, x);
		}
		printf("%f\n%f\n", y, x);
	}
	return (0);
}

Measured memory_bytes: 716
MOD = 10 ** 9 + 7
CHARS = 'ACGT'

def pos(ch):
    return CHARS.index(ch)

def ok(s):
    if 'AGC' in s:
        return False
    l = list(s)
    for i in range(len(s) - 1):
        l[i], l[i + 1] = l[i + 1], l[i]
        if 'AGC' in ''.join(l):
            return False
        l[i], l[i + 1] = l[i + 1], l[i]
    return True

n = int(input())
#dp[i][a][b][a] - number of ways to construct a correct string of length n, ending in abc characters
dp = [[[[0 for _ in range(4)] for _ in range(4)] for _ in range(4)] for _ in range(n + 1)]
for a in CHARS:
    for b in CHARS:
        for c in CHARS:
            if ok(a + b + c):
                dp[3][pos(a)][pos(b)][pos(c)] += 1
for i in range(4, n + 1):
    for a in CHARS:
        for b in CHARS:
            for c in CHARS:
                for d in CHARS:
                    if not ok(a + b + c + d):
                        continue
                    dp[i][pos(b)][pos(c)][pos(d)] += dp[i - 1][pos(a)][pos(b)][pos(c)]
                    dp[i][pos(b)][pos(c)][pos(d)] %= MOD
ret = 0
for a in CHARS:
    for b in CHARS:
        for c in CHARS:
            ret += dp[n][pos(a)][pos(b)][pos(c)]
            ret %= MOD
print(ret)


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

char a[20],b[]={"CODEFESTIVAL2016"};
int ans;

int main()
{
	cin>>a;
	int len=strlen(a);
	for(int i=0;i<len;i++) if(a[i]!=b[i]) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
#define si short int
#define fo(i,a,b) for(int i=a,_E=b;i<_E;++i)
using namespace std;
struct BIT{
	ull w[32];
	inline void reset(){fo(i,0,32)w[i]=0;}
	inline void set(){fo(i,0,32)w[i]=-1;}
	inline int flip(const int &x){w[x>>6]^=1ll<<(x&63);}
	inline bool get(const int &x){return w[x>>6]&1ll<<(x&63);}
}e[2000],d[2000],s,ex[2000][2000];
inline void operator^=(BIT &a,const BIT &b){fo(i,0,32)a.w[i]^=b.w[i];}
inline void operator&=(BIT &a,const BIT &b){fo(i,0,32)a.w[i]&=b.w[i];}
inline void operator|=(BIT &a,const BIT &b){fo(i,0,32)a.w[i]|=b.w[i];}
si n,m,fa[2000];int t;
pair<si,si> q[1000*2000];
#define mp make_pair
vector<si> r[2000];
void dfs(si x,si fr){
	s.flip(x);
	ex[fr][x]=s;
	fo(i,0,r[x].size()){
		si y=r[x][i];if(y==fa[x])continue;
		fa[y]=x;dfs(y,fr);ex[fr][x]|=ex[fr][y];ex[fr][x].flip(y);
	}s.flip(x);ex[fr][x].flip(x);
}
void ins(si x,si y){
	q[t++]=mp(x,y);
	e[x].flip(y);e[y].flip(x);
	d[x].flip(y);d[y].flip(x);
}
int main(){
	cin>>n>>m;
	fo(i,0,n)d[i].set(),d[i].flip(i);
	fo(i,1,n){
		si x,y;cin>>x>>y;--x;--y;
		r[x].push_back(y);r[y].push_back(x);
	}
	fo(i,0,m){
		si x,y;cin>>x>>y;
		--x;--y;ins(x,y);
	}
	fo(i,0,n)fo(j,0,r[i].size())
		fa[r[i][j]]=i,dfs(r[i][j],i);
	fo(i,0,n)fo(j,i+1,n)ex[i][j]|=ex[j][i],ex[j][i]=ex[i][j];
	for(int i=0;i<t;++i){
		int x=q[i].first,y=q[i].second;
		s=ex[x][y];s&=e[x];s&=d[y];
		fo(j,0,32)if(s.w[j]){
			ull S=s.w[j];
			fo(K,0,8){
				if(S&255)fo(k,0,8)if(S>>k&1)ins(y,k^K<<3^j<<6);	
				S>>=8;
			}
		}
		s=ex[x][y];s&=e[y];s&=d[x];
		fo(j,0,32)if(s.w[j]){
			ull S=s.w[j];
			fo(K,0,8){
				if(S&255)fo(k,0,8)if(S>>k&1)ins(x,k^K<<3^j<<6);	
				S>>=8;
			}
		}
	}printf("%d",t);
}

Measured memory_bytes: 1009408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int d, n; cin >> d >> n;
  ll t = 1;
  for(int i = 0; i < d; i++) t *= 100;
  cout << ((ll) t * (n + (n == 100 ? 1 : 0))) << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	unsigned int num[2000];
	double weight[2000],height[2000];
	int i=0;
	int qty;
	
	while((scanf("%d,%lf,%lf",&num[i],&weight[i],&height[i])) != EOF)
	{
		i++;
	}
	
	qty = i;
	
	for(i=0;i<=qty;i++)
	{
		if((weight[i] / (height[i] * height[i])) >= 25.0)
		{
			printf("%d\n",num[i]);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2628
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	string a;
	cin >> a;
	int ans = 0;

	int J = 0, o = 0, I = 0;

	for (int i = 1;i < a.size();i++) {
		if (a[i - 1] == 'J') {
			J++;
			if (a[i] == 'I') {
				
				if (o <= J&&o <= I)ans = max(ans, o);
				J = 0;
				o = 0;
				I = 0;
			}
		}
		else if (a[i - 1] == 'O') {
			o++;
			if (a[i] == 'J') {
				J = 0;
				o = 0;
				I = 0;
			}
		}
		else {
			I++;
			if (a[i] != 'I') {
				if (o <= J&&o <= I)ans = max(ans, o);
				J = 0;
				o = 0;
				I = 0;
			}
		}
	}

	if (a[a.size() - 1] == 'I') {
		if (a[a.size() - 2] != 'J')I++;
	}
	if (o <= J&&o <= I)ans = max(ans, o);
	cout << ans << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 3876
package main

import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func nextInt64() int64 {
    sc.Scan()
    i, e := strconv.ParseInt(sc.Text(), 10, 64)
    if e != nil {
        panic(e)
    }
    return i
}

func nextString() string {
    sc.Scan()
    return sc.Text()
}

var a []int64

func heapone(num int) {
    var i,vs int
    for j := 2; j <= num; j++ {
        i = j
        for ;; {
            vs = i/2
            if vs == 0 {
                break
            }
            if a[i] > a[vs] {
                tmp2 := a[i]
                a[i] = a[vs]
                a[vs] = tmp2
                i = vs
            } else {
                break
            }
        }
    }
}

func heapupdate(num int) {
    tmp := a[1] / 2
    var i,vs int

    //update
    a[1] = a[1] / 2

    i = 1
    for ;; {
        vs = i * 2
        if vs > num {
            break
        }
        if vs <= num - 1 && a[vs] < a[vs + 1] {
            vs++
        }
        if a[i] < a[vs] {
            tmp2 := a[i]
            a[i] = a[vs]
            a[vs] = tmp2
            i = vs
        } else {
            break
        }
    }
    return

    //delete
    a[1] = a[num]
    i = 1
    for ;; {
        vs = i * 2
        if vs > num - 1 {
            break
        }
        if vs <= num - 2 && a[vs] < a[vs + 1] {
            vs++
        }
        if a[i] < a[vs] {
            tmp2 := a[i]
            a[i] = a[vs]
            a[vs] = tmp2
            i = vs
        } else {
            break
        }
    }

    //insert
    a[num] = tmp
    i = num
    for ;; {
        vs = i/2
        if vs == 0 {
            break
        }
        if a[i] > a[vs] {
            tmp2 := a[i]
            a[i] = a[vs]
            a[vs] = tmp2
            i = vs
        } else {
            break
        }
    }
}

func main() {
    buf := make([]byte, 0)
    sc.Buffer(buf, 4000000)
    sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()

    a = make([]int64, n + 1)
    for i := 1; i <= n; i++ {
        a[i] = nextInt64()
    }
    heapone(n)
    for i := 0; i < m; i++ {
        //fmt.Println(a)
        //fmt.Println(a[1], "->", a[1]/2)
        heapupdate(n)
    }
    
    //fmt.Println(a)
    score := 0
    for i := 1; i <= n; i++ {
        score += int(a[i])
    }

    fmt.Println(score)

}

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

int main(){
    int n,b,f,r,v;

    int count[5][4][11];
    for (int i = 1; i <= 4; i++){
        for (int j = 1; j <= 3; j++){
            for (int k = 1; k <= 10; k++){
                count[i][j][k] = 0;
            }
        }
    }
    
    cin >> n;

    for (int s = 0; s < n; s++){
        cin >> b >> f >> r >> v;
        count[b][f][r] += v;
    }

    for (int i = 1; i <= 4; i++){
        if (i > 1){
            cout << "####################" << endl;
        }
        for (int j = 1; j <= 3; j++){
            for (int k = 1; k <= 10; k++){
                cout << " " << count[i][j][k];
            }
            cout << endl;
        }
    }

    return 0;
}


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

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

const ll mod =  1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int main()
{
    int n;
    cin >> n;
    string s = to_string(n);
    int div = 0;
    for(int i = 0; i < s.size(); i++){
        div += (s[i]-'0');
    }
    if(n % div == 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 256
from collections import Counter
from itertools import permutations
import sys
readline = sys.stdin.readline
write = sys.stdout.write

def solve():
    N = int(readline())
    if N == 0:
        return False
    def dist(a, b):
        LA = len(a); LB = len(b)
        dp = [[10**18]*(LB+1) for i in range(LA+1)]
        dp[0][0] = 0
        for i in range(LA):
            for j in range(LB):
                v = dp[i][j]
                if a[i] == b[j]:
                    dp[i+1][j+1] = min(dp[i+1][j+1], v)
                else:
                    dp[i+1][j+1] = min(dp[i+1][j+1], v+1)
                dp[i+1][j] = min(dp[i+1][j], v+1)
                dp[i][j+1] = min(dp[i][j+1], v+1)
            dp[i+1][LB] = min(dp[i+1][LB], dp[i][LB]+1)
        for j in range(LB):
            dp[LA][j+1] = min(dp[LA][j+1], dp[LA][j] + 1)
        return dp[LA][LB]
    def check(a, b):
        LA = len(a); LB = len(b)
        if abs(LA - LB) > D:
            return False
        d = dist(a, b)
        if d <= D:
            return True
        if d == 2 and LA == LB:
            ra = []; rb = []; rp = []
            for i in range(LA):
                if a[i] != b[i]:
                    rp.append(i)
                    ra.append(a[i])
                    rb.append(b[i])
            if len(rp) == 2 and rp[1] - rp[0] == 1:
                ra.reverse()
                if ra == rb:
                    return True
        if D == 2:
            if d == 4 and LA == LB:
                ra = []; rb = []; rp = []
                for i in range(LA):
                    if a[i] != b[i]:
                        rp.append(i)
                        ra.append(a[i])
                        rb.append(b[i])
                if len(rp) == 4 and rp[1] - rp[0] == 1 and rp[3] - rp[2] == 1:
                    ra[0], ra[1] = ra[1], ra[0]
                    ra[2], ra[3] = ra[3], ra[2]
                    return ra == rb
            if d == 3 and abs(LA - LB) < D:
                a = list(a); b = list(b)
                if not LA < LB:
                    LA, LB = LB, LA
                    a, b = b, a
                for i in range(LA-1):
                    a[i], a[i+1] = a[i+1], a[i]
                    if dist(a, b) <= D-1:
                        return True
                    for j in range(LA-1):
                        a[j], a[j+1] = a[j+1], a[j]
                        if a == b:
                            return True
                        a[j], a[j+1] = a[j+1], a[j]
                    a[i], a[i+1] = a[i+1], a[i]
        return False
    D = int(readline())
    S = [readline().strip() for i in range(N)]
    ans = []
    for i in range(N):
        for j in range(i+1, N):
            if check(S[i], S[j]):
                ans.append((S[i], S[j]) if S[i] < S[j] else (S[j], S[i]))
    ans.sort()
    for e in ans:
        write("%s,%s\n" % e)
    write("%d\n" % len(ans))
    return True
while solve():
    ...


Measured memory_bytes: 6076
from itertools import combinations_with_replacement as comb

N, M, Q = map(int, input().split())

ls_q = [tuple(map(int, input().split())) for q in range(Q)]

def calc(c):
    result = 0
    for q in ls_q:
        if c[q[1] - 1] - c[q[0] - 1] == q[2]:
            result += q[3]
            
    return result

ls = [i for i in range(1, M + 1)]

c = comb(ls, N)
max_result = 0
while True:
    try:
        max_result = max(calc(next(c)), max_result)
    except StopIteration:
        break

print(max_result)


Measured memory_bytes: 68060
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"from collections import*\n"
"n,*v=map(int,open(0).read().split())\n"
"a=Counter(v[::2]).most_common()+[(0,0)]\n"
"b=Counter(v[1::2]).most_common()+[(0,0)]\n"
"if a[0][0]==b[0][0]:\n"
"    print(min(n-a[0][1]-b[1][1],n-a[1][1]-b[0][1]))\n"
"else:\n"
"    print(n-a[0][1]-b[0][1])\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 20868
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    int i;
    long double sum=0;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
        sum+=a[i];
    }
    const long double eps=1e-12;
    long double min=HUGE_VAL;
    int mini=0;
    sum/=n;
    for(i=0; i<n; i++) {
        double tmp=fabs(a[i]-sum);
        if(tmp<min-eps) {
            min=tmp;
            mini=i;
        }
    }
    printf("%d\n", mini);

    return 0;
}



Measured memory_bytes: 256
import sys

def count(n):
    k = 0
    for a in range(10):
        for b in range(10):
            for c in range(10):
                for d in range(10):
                    if a + b + c + d == n:
                        k += 1
    return k

for line in sys.stdin:
    print(count(int(line)))

Measured memory_bytes: 7624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll mod = 1000000007;

void solve()
{
	int n; cin >> n;
	set<int> a;
	rep(i, n)
	{
		int tmp; cin >> tmp;
		a.insert(tmp);
	}
	if(sz(a)==n)cout << "YES" << endl;
	else cout << "NO" << endl;
	return;
}

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


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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    if (n % x == 0) {
        std::cout << (n / x) * t << endl;
    } else {
        std::cout << (n / x + 1) * t << endl;
    }
}

Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>

using namespace std;

int main() {
    string line;
    stringstream ss;
    int n;
    getline(cin, line);
    ss << line;
    ss >> n;
    int * P = new int[n];
    int * Q = new int[n];
    ss.clear();
    getline(cin, line);
    ss << line;
    for (int i = 0; i < n; i++) {
        ss >> P[i];
    }
    ss.clear();
    getline(cin, line);
    ss << line;
    for (int i = 0; i < n; i++) {
        ss >> Q[i];
    }
    // INPUT END
    int diff = 0;
    if (lexicographical_compare(P, P + n, Q, Q + n)) {
        while (next_permutation(P, P + n)) {
            diff++;
            bool there = true;
            for (int i = 0; i < n; i++) {
                if (P[i] != Q[i]) {
                    there = false;
                }
            }
            if (there) {
                cout << diff << endl;
                return 0;
            }
        }
    } else if (lexicographical_compare(Q, Q + n, P, P + n)) {
        while (next_permutation(Q, Q + n)) {
            diff++;
            bool there = true;
            for (int i = 0; i< n; i++) {
                if (Q[i] != P[i]) {
                    there = false;
                }
            }
            if (there) {
                cout << diff << endl;
                return 0;
            }
        }
    } else {
        cout << 0 << endl;
        return 0;
    }


    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(0, n):
	minj = min(range(i, n), key=lambda j: a[j])
	if i != minj:
		a[i], a[minj] = a[minj], a[i]
		count += 1
print(*a)
print(count)


Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[2000][1000];
signed main(){
	int a,b,ans=0;
	cin>>a>>b;
	f(i,a){
		char c;
		int d,e;
		cin>>d>>e>>c;
		if(c=='W')d+=b;
		d%=b*2;
		e%=b*2;
		if(d>=b&&e>=b){
			d-=b,e-=b;
		}
		if(e>=b){
			e-=b,d+=b;
		}
		x[d][e]++;
	}
	f(i,b*2){
		f(j,b-1){
			x[i][j+1]+=x[i][j];
		}
	}
	f(j,b){
		f(i,b*2-1){
			x[i+1][j]+=x[i][j];
		}
	}
	f(i,b*2){
		f(j,b){
			int sum=0;
			if(i>=b+1&&j){
				sum+=x[i-1][j-1]-x[i-b-1][j-1];
				sum+=x[i-1-b][b-1]-x[i-1-b][j-1];
				sum+=x[b*2-1][b-1]-x[i-1][b-1]-x[b*2-1][j-1]+x[i-1][j-1];
			}
			else if(i==b&&j){
				sum+=x[i-1][j-1];
				sum+=x[b*2-1][b-1]-x[i-1][b-1]-x[b*2-1][j-1]+x[i-1][j-1];
			}
			else if(i&&j){
				sum+=x[i-1][j-1];
				sum+=x[i+b-1][b-1]-x[i+b-1][j-1]-x[i-1][b-1]+x[i-1][j-1];
				sum+=x[b*2-1][j-1]-x[i+b-1][j-1];
			}
			else if(j){
				sum+=x[i+b-1][b-1]-x[i+b-1][j-1];
				sum+=x[b*2-1][j-1]-x[i+b-1][j-1];
			}
			else if(i>=b+1){
				sum+=x[b*2-1][b-1]-x[i-1][b-1]+x[i-b-1][b-1];
			}
			else if(i==b){
				sum+=x[b*2-1][b-1]-x[i-1][b-1];
			}
			else if(i){
				sum+=x[i+b-1][b-1]-x[i-1][b-1];
			}
			else{
				sum+=x[b-1][b-1];
			}
			ans=max(sum,ans);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 15872
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[2004],ans;
inline int abs(int x) {
	return x>0?x:-x;
}
int main() {
	scanf("%d",&n);
	int m=n;
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for (int i=1;i<m-1;++i) {
		for (int j=i+1;j<=m;++j) {
			int x=a[i],y=a[j];
			int pos=i+1;
			while (a[pos]+x<=y) ++pos;
			ans+=j-pos;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

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

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

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

    int t = 1;
    while( n-- ) {
        if( (t * 2) - t > (t + k) - t ) {
            t += k;

        } else {
            t *= 2;

        }
    }
    cout << t << endl;
    return 0;
}



Measured memory_bytes: 256
n = int(input())
witness = [[] for _ in range(n)]
for i in range(n):
    ai = int(input())
    for _ in range(ai):
        x, y = map(int, input().split())
        witness[i].append((x - 1, y))
ans = 0
for i in range(2 ** n):
    f = [False] * n
    flag = False
    for j in range(n):
        if i >> j & 1:
            f[j] = True
    for j in range(n):
        if f[j]:
            for x, y in witness[j]:
                if f[x] and y == 0 or not f[x] and y == 1:
                    flag = True
                    break

        if flag:
            break
        if j == n - 1:
            ans = max(ans, f.count(True))
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
	float h,min,max;
	max=0;min=1000000;
	while(scanf("%f",&h)!=EOF){
		if(h<min){min=h;}
		if(h>max){max=h;}
	}
	printf("%f\n",max-min);
	return 0;
}

Measured memory_bytes: 644
n = int(input())
x = input()
ones = 0
for i in x:
    if i=='1':
        ones += 1
mods = [0, 0]
for i in range(n):
    if x[n-i-1]=='1':
        if ones>1:
            mods[0] += pow(2, i, ones-1)
        mods[1] += pow(2, i, ones+1)
if ones>1:
    mods[0] %= ones-1
mods[1] %= ones+1
def f(x):
    if x==0:
        return 1
    cnt = 1
    while x>0:
        p = bin(x).count('1')
        x %= p
        cnt += 1
    return cnt
for i in range(n-1, -1, -1):
    if x[n-i-1]=='1' and ones==1:
        print(0)
        continue
    if x[n-i-1]=='1':
        init = (mods[0] - pow(2, i, ones-1))%(ones-1)
    else:
        init = (mods[1] + pow(2, i, ones+1))%(ones+1)
    print(f(init))

Measured memory_bytes: 81924
#include "stdio.h"
#include "iostream"
using namespace std;

int main()
{
	int a[200000];
	int b[200000];
	int N,I;
	cin >> N;
	//scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
		//scanf("%d", &a[i]);
	}
	if (N == 1)
		cout << a[1];
	else if (N % 2) {
		for (I = N; I > 0; I -= 2) {
			cout << a[I] << " ";
		}
		for (I = 2; I <= N; I += 2) {
			cout << a[I] << " ";
		}
	}
	else {
		for (I = N; I > 0; I -= 2) {
			cout << a[I] << " ";
		}
		for (I = 1; I <= N; I += 2) {
			cout << a[I] << " ";
		}
	}
	return 0;
}



Measured memory_bytes: 2944
// =========
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use std::process::exit;

const MOD: usize = 1000000007;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    // var... 変数の識別子, $t...型を一つよむ
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        //ここで繰り返し
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    //
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    // 配列の最後のNestではここで型が指定されてparseされる
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// =========

fn main() {
    input! {
        a: usize,
        b: usize,
        sugar0: usize,
        sugar1: usize,
        sugarperw: f64,
        capacity: usize,
    }
    let water0 = 100 * a;
    let water1 = 100 * b;
    let maxw0 = capacity / water0;
    let maxw1 = capacity / water1;
    let maxs0 = capacity / sugar0;
    let maxs1 = capacity / sugar1;
    let noudo = sugarperw * 100.0 / (100.0 + sugarperw);
    let mut ansnoudo = 0.0;
    let mut anstotal = 0;
    let mut anssugar = 0;
    for i in 0..maxw0 + 1 {
        for j in 0..maxw1 + 1 {
            for k in 0..maxs0 + 1 {
                for l in 0..maxs1 + 1 {
                    let watera = i * water0 + j * water1;
                    let sugara = k * sugar0 + l * sugar1;
                    let cap = sugara + watera;
                    let tmpnoudo = (sugara * 100) as f64 / (cap) as f64;
                    if watera != 0 && cap <= capacity && tmpnoudo <= noudo {
                        if ansnoudo < tmpnoudo {
                            ansnoudo = tmpnoudo;
                            anssugar = sugara;
                            anstotal = cap;
                        }
                    }
                }
            }
        }
    }
    if anstotal == 0 {
        println!("{} {}", water0, 0);
    } else {
        println!("{} {}", anstotal, anssugar);
    }
}

mod tests {
    use super::*;
    #[test]
    fn check() {}
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define lb(x) (x&-x)
#define X first
#define Y second
#define ls rt<<1
#define rs rt<<1|1
typedef long long ll;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int maxn = 1e5+10;
const int maxm = 1e6;
const int mod = 1e9+7;

int a[maxn],b[maxn];
int main()
{
#ifdef LOCAL
    freopen("input.txt","r",stdin);
#endif // LOCAL
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;
    cin>>n>>m;
    if(n<m) swap(n,m);
    if(n-m<2) puts("Brown");
    else puts("Alice");
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 0;
        for (int a = 1; a <= N-1; a++) {
            ans += (N-1)/a;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35684
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <cmath>
#include <bitset>
#include <queue>
#include <set>
#include <numeric>
#include <unordered_set>

using namespace std;

#define ef emplace_front
#define eb emplace_back
#define mp make_pair
#define MOD 1000000007

typedef long double f80;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef float f32;
typedef double f64;
typedef long double f80;
typedef unordered_set<int> usi;
typedef set<int> si;

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

	int n,r;
	cin>>n>>r;
	if (n>=10){
		cout<<r;
	}else{
		cout<<r+100*(10-n);
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, d, x;
    cin >> n >> d >> x;
    int ans = x;
    rep(i, n) {
      int day;  cin >> day;
      ans += (d - 1) / day + 1;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
n = int(input())
dam_amount = list(map(int, input().split()))
mt_amount = [0]*n
mt_amount[0] = dam_amount[0] + dam_amount[n-1]
for i in range(1, n-1):
    if i % 2 == 0:
        mt_amount[0] += dam_amount[i]
    else:
        mt_amount[0] -= dam_amount[i]

for i in range(n-1):
    mt_amount[i+1] = dam_amount[i]*2 - mt_amount[i]
print(*mt_amount)

Measured memory_bytes: 64612
#include<stdio.h>

int main(void){
    int A,B;
    scanf("%d%d",&A,&B);

    long K;

    if((A+B)%2==1){
        printf("IMPOSSIBLE");
    }else{
        K=A+B;
        K/=2;
        printf("%ld",K);
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  long long int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  long long ans=min(e*4*a,min(e*2*b,e*c));
  cout<<min(e/2*d+e%2*ans/e,ans)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff { ios_base::sync_with_stdio(false);cin.tie(NULL);}
using namespace std;

typedef long long ll;
 ll  pp=1e9+7; 
double pi=3.141592653589793238;
  
 int main() {
        ff;
        int n;
        cin>>n;
        int x,y;
        int c=0;
        int k=0;
        while(n--){
            cin>>x>>y;
            if(x==y){
                c++;
            }else{
                c=0;
            }
            if(c==3){
                k=1;
            }
        }
        if(k==1)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
		
    return 0;
}

            
		
        
           
  

Measured memory_bytes: 3660
#include<stdio.h>
int main()
{
    int A,B;
    scanf("%d%d",&A,&B);
    if((A==1&&B==2)||(A==2&&B==1))
    {
        printf("%d",3);
    }
    else if((A==1&&B==3)||(A==3&&B==1))
    {
        printf("%d",2);
    }
    else
    {
        printf("%d",1);
    }
}

Measured memory_bytes: 1632