akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
int main()
{
    NFS
 	int n,r;
 	cin>>n>>r;
 	if(n>=10)
 		cout<<r;
 	else
 	{
 		cout<<r+100*(10-n);
 	}
    return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':

	while True:
		try:
			A = input().split()
			B = input().split()

			hit = 0
			blow = 0
			for i in range(4):
				if A[i] == B[i]:
					hit += 1
				else:
					if B[i] in A:
						blow += 1

			print(hit,blow)

		except EOFError:
			break



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

int main() {
    int N;
    bool J=false;
    cin >> N;
    vector<char> vec(N);
    for(int i=0; i<N; i++) cin >> vec.at(i);
    
    for(int i=0; i<N; i++){
        if(vec.at(i) == 'Y'){
            J=true;
            break;
        }
    }
    
    if(J == true){
        cout << "Four" << endl;
    }
    else{
        cout << "Three" <<endl;
    }
    
    return 0;
}

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

using namespace std;

int main(){
    int N, Q;
    scanf("%d %d", &N, &Q);
    char S[N + 1];
    scanf("%s", S);
    int l[Q], r[Q];
    for(int i = 0; i < Q; i++){
        scanf("%d %d", &l[i], &r[i]);
    }

    int T[N];
    for(int i = 0; i < N; i++){
        T[i] = 0;
    }
    for(int i = 1; i < N; i++){
        T[i] += T[i-1];
        if(S[i - 1] == 'A' && S[i] == 'C'){
                T[i]++;
        }
    }

    for(int i = 0; i < Q; i++){
        printf("%d\n", T[r[i] - 1] - T[l[i] - 1]);
    }

    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const int NAX=1005;
const long long  MOD=(long long)(998244353);

Int N,M,K;
Int X,Y,Z;
Int H,W;
Int perform(Int x){
    return (x*(x+1))/2LL;
}
vector<Int> A;
vector<int> adj[MAXN];
using D=long double;

bool inRange(Int a,Int b){
    return a*b<=0;
}

long long C[NAX][NAX];
const D pi=3.14159265359;


long long ModExpo(long long x,unsigned long long y,long long M){
    Int ans=1;
    ans=(long long)ans;
    
    while(y>0){
        if(y&1) ans=((ans%M)*(x%M))%M;
        y>>=1LL;
        x=((x%M)*(x%M))%M;
    }
    return ans%M;
}
long long fac[MAXN];
void fillFac(){
    fac[0]=1;
    for(int i=1;i<MAXN;++i){
        fac[i]=((fac[i-1]%MOD)*(i%MOD))%MOD;
    }
}

long long ModInv(long long x){
    return ModExpo(x,MOD-2,MOD);
}

long long FermatLast(long long n,long long r){
    if(r>n) return 0;
    if(!r) return 1;
    return (fac[n] * ModInv(fac[r]) % MOD * ModInv(fac[n - r]) % MOD) % MOD;
}

Int performMod(Int x){
    Int y=((x%MOD)*((x+1)%MOD))%MOD;
    return (y*ModInv(2))%MOD;
}

Int madd(Int x,Int y){
    return (x+y)%MOD;
}

Int mmul(Int x,Int y){
    return ((x%MOD)*(y%MOD))%MOD;
}

int main()
{
    fillFac();
    Int ans=0;
    cin>>N>>X>>Y>>K;
        for(Int i=0;i<=N;++i){
            Int rem=K-X*i;
            if(rem<0||rem%Y) continue;
            Int newB=rem/Y;
            if(newB>N) continue;
            ans=madd(ans,mmul(FermatLast(N,i),FermatLast(N,newB)));
        }
        cout<<ans<<"\n";
    
}


Measured memory_bytes: 19300
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int A = sc.nextInt();
		int res = 1;
		double memo = 0;

		for(int i=0; i<N; i++) {
			int H = sc.nextInt();
			double temp = (T - H * 0.006) - A;
			if(temp < 0) {
				temp *= -1;
			}
			if(i == 0) {
				memo = temp +1;
			}
			if(memo > temp) {
				memo = temp;
				res = i +1;
			}
		}

		System.out.println(res);
	}
}


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

vector<vector<int>> g;
int d[215][215];
const int INF = 998244353;

vector<int> mkd;

void dfs(int v, int col = 0) {
    mkd[v] = col;
    for (int u: g[v]) {
        if (mkd[u] == col) {
            cout << "-1\n";
            exit(0);
        }
        if (mkd[u] == -1) {
            dfs(u, 1 - col);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    g.resize(n);
    mkd.resize(n, -1);
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < n; ++j) {
            if (s[j] == '1') {
                g[i].push_back(j);
                d[i][j] = 1;
            } else {
                d[i][j] = INF;
            }
        }
        d[i][i] = 0;
    }
    for (int i = 0; i < n; ++i) {
        if (mkd[i] == -1) {
            dfs(i);
        }
    }
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    int mx = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            mx = max(mx, d[i][j]);
        }
    }
    cout << mx + 1 << endl;
}

Measured memory_bytes: 640
def main():
    N=int(input())
    A=list(map(int,input().split()))
    w=sum(A)
    if N==3:
        li=[]
        for i in range(1,N):
            li.append(w-2*A[i])
        li.append(w-2*A[0])
        result=" ".join(map(str,li))
        print(result)
    else:
        li=[0]*N
        n=N//2
        count=0
        for j in range(1,2*n+1,2):  #w_1を先に求める
            count+=2*A[j]
        li[0]=w-count
        
        for i in range(N-1):  #漸化式を用いて残りを求める
            li[i+1]=2*A[i]-li[i]

        result=" ".join(map(str,li))
        print(result)
if __name__=="__main__":
    main()

Measured memory_bytes: 19504
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int i, o, t, j, l ,s, z;
	cin>>i>>o>>t>>j>>l>>s>>z;
	ll ans = 0LL;
	ans += (i / 2) * 2;
	ans += o;
	ans += (j / 2) * 2;
	ans += (l / 2) * 2;
	if(i > 0 && j > 0 && l > 0) ans = max(ans, (i-1)/2*2LL+(j-1)/2*2+(l-1)/2*2+o+3);
	cout<<ans<<endl;
}

Measured memory_bytes: 384
// ＡＢＣのＡ過去問を解くだけだよ

// フォント:Electroharmonix
// x:小文字(ｘ)    X:大文字(Ｘ)
// +:プラス(＋)    &:アンド(＆)

#include <bits/stdc++.h>

using namespace std;

void Main()
{
    int a, b;
    cin >> a >> b;

    bool ret = true;
    if (a >= 9)
        ret = false;
    if (b >= 9)
        ret = false;

    cout << (ret ? "Yay!" : ":(");
}

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

    //std::cout << std::fixed << std::setprecision(10);

#ifdef DEBUG_BUILD
    while (true)
    {
        Main();
        cout << std::endl;
    }
#endif

    Main();
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

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



ll N;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
   cin>>N;
   double X[N] , Y[N];
   double sum = 0;
   for(ll i = 0 ; i<N ; i++){
     cin>>X[i]>>Y[i];
   }


for(ll i = 0 ; i<N ; i++){
	for(ll j = i+1 ; j<N ; j++){
		sum += (2*sqrt(pow(X[j]-X[i] , 2) + pow(Y[j] - Y[i] , 2)))/N;
	}
}

  cout << fixed << setprecision(10) << sum <<'\n';



   

}



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

  return 0;
}


Measured memory_bytes: 3788
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n; i >= 0; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

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

ll md(PL a, PL b){
    return abs(a.ff-b.ff) + abs(a.ss-b.ss);
}

int main(){
    ll H, W, D; cin >> H >> W >> D;
    vpl AA(H*W+1);
    rep(i, H) rep(j, W){
        ll a; cin >> a;
        AA[a] = {i,j};
    }
    vvl mod(D);
    rep(m, D){
        for(ll i = 1; i*D + m <= H*W; i++){
            ll now = i*D + m, prev = (i-1)*D + m;
            ll t = md(AA[now], AA[prev]);
            mod[m].pb(t);
        }
    }
    
    vvl modsum(D);
    rep(m, D){
        ll sum = 0;
        modsum[m].pb(sum);
        rep(i, mod[m].size()){
            sum += mod[m][i]; modsum[m].pb(sum);
        }
    }
    
    ll Q; cin >> Q;
    rep(_, Q){
        ll l, r; cin >> l >> r;
        ll m = l%D;
        ll lq = (l-m)/D, rq = (r-m)/D;
        cout << modsum[m][rq] - modsum[m][lq] << endstr;
    }
    
    return 0;
}


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

using namespace std;

#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

#define int long long

const int MOD = 1e9 + 7;

int a, b;
int d[50][50];
int go[200][200];

signed main()
{
    //freopen("input_02.txt", "r", stdin);
    //freopen("output_02.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> a >> b;
    for (int i = 1; i <= a; i++)
    {
        for (int j = 1; j <= b; j++)
        {
            cin >> d[i][j];
        }
    }
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            int max_c = -1e9;
            for (int x = 1; x <= a; x++)
            {
                for (int y = 1; y <= b; y++)
                {
                    int moved = i * x + j * y;
                    int add = d[x][y] - moved;
                    max_c = max(max_c, add);
                }
            }
            if (max_c <= 100 && 0 <= max_c)
            {
                go[i][j] = max_c;
            }
            else
            {
                go[i][j] = 1e9;
            }
        }
    }
    for (int x = 1; x <= a; x++)
    {
        for (int y = 1; y <= b; y++)
        {
            for (int i = 0; i <= 100; i++)
            {
                for (int j = 0; j <= 100; j++)
                {
                    if (x * i + go[i][j] + y * j < d[x][y])
                    {
                        go[i][j] = 1e9;
                    }
                }
            }
        }
    }
    for (int x = 1; x <= a; x++)
    {
        for (int y = 1; y <= b; y++)
        {
            int min_c = 1e9;
            for (int i = 0; i <= 100; i++)
            {
                for (int j = 0; j <= 100; j++)
                {
                    if (min_c > i * x + go[i][j] + j * y)
                    {
                        min_c = i * x + go[i][j] + j * y;
                    }
                }
            }
            if (min_c != d[x][y])
            {
                cout << "Impossible";
                return 0;
            }
        }
    }
    cout << "Possible\n";
    int cnt = 0;
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            if (go[i][j] <= 100 && 0 <= go[i][j]) cnt++;
        }
    }
    cout << 202 << " " << cnt + 200 << "\n";
    for (int i = 0; i < 100; i++)
    {
        cout << i + 1 << " " << i + 2 << " " << 'X' << "\n";
    }
    for (int j = 0; j < 100; j++)
    {
        cout << 202 - j - 1 << " " << 202 - j << " " << 'Y' << "\n";
    }
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            if (go[i][j] <= 100 && 0 <= go[i][j])
            {
                cout << i + 1 << " " << 202 - j << " " << go[i][j] << "\n";
            }
        }
    }
    cout << 1 << " " << 202 << "\n";
}


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

int main() {
  int n; cin >>n;
  vector<pair<string,int>> r;
  vector<pair<string,int>> moto(n);
  string bufs; int bufi;
  for (int i=0; i<n; i++){
    cin >>bufs >>bufi;
    r.push_back(make_pair(bufs, -bufi));
    moto.at(i) = r.at(i);
  }
  sort(r.begin(), r.end());
  for (int i=0; i<n; i++){
    for (int j=0; j<n; j++){
      if (r.at(i) == moto.at(j)){
        cout <<j+1 <<endl;
        break;
      }
    }
  }
  //cout <<ans;
  //cout <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define INF 2000000000.0
#define M 1000000007ll
#define INFLL 1000000000000000010ll
#define UQ(x) (x).resize(distance((x).begin(),unique(all((x)))))
#define mid(x,y) (((x)+(y))>>1)

int n;
ll t,x[200005];
int main() {
	scanf("%d%lld",&n,&t);
	ll ans=0ll;
	for (int i=0;i<n;i++) {
		scanf("%lld",&x[i]);
	}
	for (int i=1;i<n;i++) {
		if (x[i]-x[i-1]>t) ans+=t;
		else ans+=x[i]-x[i-1];
	}
	ans+=t;
	printf("%lld\n", ans);
}

Measured memory_bytes: 1792
from scipy.misc import comb

N,K = map(int, input().split())

red_ball_count = N - K

for i in range(1, K + 1):
    if red_ball_count + 1 - i < 0:
        print(0)
    else:
        print(comb(red_ball_count + 1, i, exact=True) * comb(K - 1, i - 1, exact=True) % (10**9 + 7))


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -fsanitize=signed-integer-overflow -fno-sanitize-recover=all -o template template.cpp


signed main()
{
	int a, b, n;
	cin>> a >> b >> n;
	int ans{};
	for(auto i = a; i < n+0.5; i += a){
		ans += b;
	}	
	cout << ans << endl;
	return 0;
}

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

const int M=1e5+5;
int sc[M];

int main()
{
	int n,k,q;
	scanf("%d%d%d",&n,&k,&q);
	for(int i=1;i<=n;i++)
		sc[i]=k-q;
	int ai;
	for(int i=1;i<=q;i++)
	{
		scanf("%d",&ai);
		sc[ai]++;
	}
	for(int i=1;i<=n;i++)
		printf("%s\n",sc[i]>0?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <climits>
using namespace std;

int main(){
    int N;
    while(cin>>N){
        int sum=0;
        for(int i=0;i<N;i++){
            int x;
            cin>>x;
            sum+=x-1;
        }
        cout<<sum<<endl;
    }
    return 0;
}

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

int root(vector<int> &r, int i) {
  if (r[i] == i) {
    return i;
  } else {
    return r[i] = root(r, r[i]);
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(n, 0);
  vector<int> r(n, 0);
  for (int i = 0; i < n; i++) {
    r[i] = i;
    cin >> p[i];
    p[i]--;
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    int rx = root(r, x);
    int ry = root(r, y);
    if (rx != ry) {
      r[rx] = ry;
    }
  }
  vector<vector<int>> gis(n, vector<int>());
  vector<vector<int>> gps(n, vector<int>());
  for (int i = 0; i < n; i++) {
    root(r, i);
    gis[r[i]].push_back(i);
    gps[r[i]].push_back(p[i]);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    auto &gi = gis[i];
    auto &gp = gps[i];
    sort(gp.begin(), gp.end());
    int lg = gi.size();
    int ji = 0;
    int jp = 0;
    while (ji < lg && jp < lg) {
      if (gi[ji] == gp[jp]) {
        cnt++;
        ji++;
        jp++;
      } else if (gi[ji] < gp[jp]) {
        ji++;
      } else {
        jp++;
      }
    }
  }
  cout << cnt << endl;
}


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

int main(){
    string S,T;
    cin >> S >> T;

    int ok = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i] != T[i]){
            ok++;
            break;
        }
    }

    if(ok == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3628
l,r=map(int,input().split())

ans=(l*(l+1))%2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        md=(i*j)%2019
        if md==0:
            print(0)
            exit()
            
        if ans>=md:
            ans=md
        
        
print(ans)        

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

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

  ll sum = 0;
  for (int i = 0; i < (1 << s.size() - 1); ++i) {
    ll tsum = 0;
    ll t = s[0] - '0';
    for (int j = 0; j < s.size() - 1; ++j) {
      if (i & (1 << j)) {
        tsum += t;
        t = 0;
      }
      t = t * 10 + s[j + 1] - '0';
    }
    tsum += t;
    sum += tsum;
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	string n;
	string x;
	int MIN=INT_MAX;
	cin>>n;
	int i,j;
	for(i=0;i<n.size()-2;i++){
		x.clear();
		for(j=i;j<n.size();j++){
			x+=n[j];
			if(x.size()==3)	break;
		}
		int y=atoi(x.c_str());
		MIN=min(MIN,abs(753-y));
	}
	cout<<MIN<<endl;
	return 0;
}
		
		

Measured memory_bytes: 256
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

gcd_sum = 0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            gcd_sum += gcd(a,b,c)

print(gcd_sum)

Measured memory_bytes: 69640
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
bool a[50][31];
int n;
int G[50][50];
int dp[50][50];
main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)
		{
			for(int j=0;j++<30;)a[i][j]=0;
			for(int j=0;j<n;j++)G[i][j]=0;
			int m;cin>>m;
			for(;m--;)
			{
				int b;cin>>b;a[i][b]=1;
			}
		}
		for(int j=0;j++<30;)
		{
			for(int i=0;i<n;i++)
			{
				if(a[i][j]==0)continue;
				for(int k=i+1;k<n;k++)
				{
					if(a[k][j]&&G[i][k]==0)G[i][k]=G[k][i]=j;
				}
			}
		}
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)dp[i][j]=1e9;
		for(int i=0;i<n;i++)dp[i][i]=0;
		for(int i=0;i<n;i++)
		{
			for(int j=0;j++<30;)
			{
				for(int k=0;k<n;k++)for(int l=0;l<n;l++)
				{
					if(a[k][j]&&a[l][j]&&dp[i][k]<=j)dp[i][l]=min(dp[i][l],j);
				}
			}
		}		
		int ans=1e9;
		for(int i=0;i<n;i++)
		{
			int now=0;
			for(int j=0;j<n;j++)now=max(now,dp[j][i]);
			ans=min(ans,now);
		}
		cout<<(ans<1e9?ans:-1)<<endl;
	}
}



Measured memory_bytes: 3012
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100010
struct NODE {
	int w;
	int e;
	int next;
} edge[MAXN*2];
int cnt=1;
int head[MAXN];
int color[MAXN];
void add(int u,int v,int w) {
	edge[cnt].w=w;edge[cnt].e=v;edge[cnt].next=head[u];head[u]=cnt++;
	edge[cnt].w=w;edge[cnt].e=u;edge[cnt].next=head[v];head[v]=cnt++;
}
bool vis[MAXN];
void dfs(int i,int Color) {
	color[i]=Color;
	int curedge=head[i];
	while(curedge!=0) {
		if(vis[edge[curedge].e]){
			curedge=edge[curedge].next;
			continue;
		}
		vis[edge[curedge].e]=true;
		int w=edge[curedge].w;
		if(w%2)
			dfs(edge[curedge].e,Color^1);
		else
			dfs(edge[curedge].e,Color);
		curedge=edge[curedge].next;
	}
}
int main() {
	int n;
	cin>>n;
	for(int i=0; i<n-1; i++) {
		int a,b,c;
		cin>>a>>b>>c;
		add(a,b,c);
	}
	vis[1]=true;
	dfs(1,0);
	for(int i=1;i<=n;i++)
		cout<<color[i]<<' ';
	return 0;
}

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

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

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

  int ans = 0;
  rep(i,n) ans += p[i];
  ans -= p[n-1] / 2;
  cout << ans << endl;
  return 0;
}


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

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

const int mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11

int main()
{
    int n; cin >> n;
    if(n >= 30) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3632
N, M, X = map(int, input().split())
Cs = []
As = []
for i in range(N):
    tmp = list(map(int, input().split()))
    Cs.append(tmp[0])
    As.append(tmp[1:])


def calc(isBuy):
    global min_cost
    understands = [0 for _ in range(M)]
    cost = 0
    for i in range(N):
        if isBuy[i]:
            cost += Cs[i]
            for j in range(M):
                understands[j] += As[i][j]

    isClear = True
    for und in understands:
        if und < X:
            isClear = False

    if isClear:
        min_cost = min(min_cost, cost)


def search(isBuy):
    if len(isBuy) == N:
        calc(isBuy)
    else:
        search(isBuy + [True])
        search(isBuy + [False])


min_cost = float('inf')
search([])

if min_cost < float('inf'):
    print(min_cost)
else:
    print(-1)


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

int main() {
  int64_t N,Q;
  cin>>N>>Q;
  int64_t a,b,A=N-2,B=N-2;
  int64_t Z=(N-2)*(N-2);
  vector<int64_t> p(N,-1);
  vector<int64_t> q(N,-1);
  for(int j=0;j<Q;j++){
    cin>>a>>b;
    a--,b-=2;
    if(a){
      for(int64_t i=b;i<B;i++){
        q[i]=A;
      }
      if(q[b]+1){
        Z-=q[b];
      }
      else{
        Z-=B;
      }
      B=min(B,b);
    }
    else{
      for(int64_t i=b;i<A;i++){
        p[i]=B;
      }
      if(p[b]+1){
        Z-=p[b];
      }
      else{
        Z-=A;
      }
      A=min(A,b);
    }
  }
  cout<<Z<<endl;
}

Measured memory_bytes: 6336
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    int arr[N][2];
    for(int i=0;i<N;i++){
        cin>>arr[i][0]>>arr[i][1] ;
    }
    vector<int> s(N,0);
    if(arr[0][0]==arr[0][1]) s[0] =1;
    for(int i=1;i<N;i++){
        if(arr[i][0]==arr[i][1]){
            s[i] = 1+s[i-1];
        }
    }
    int temp = *max_element(s.begin(),s.end());
    if(temp>=3) cout<<"Yes" ;
    else cout<<"No" ;
}


Measured memory_bytes: 3616
function Main(input) {
    N = input.split(' ')[0] * 1
    A = input.split(' ')[1] * 1
    B = input.split(' ')[2] * 1
    ans = A * N < B ? A * N : B
    console.log(ans)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22076
import sys
from itertools import chain

n, k, *a = map(int, sys.stdin.read().split())
*a, = map(lambda x: min(k, x), a)
# bitsが大きくなりすぎないように前処理
a.sort()

mask = (1 << k) - 1
def is_needed(i):
    res = 1
    for j in chain(a[:i], a[i+1:]):
        res |= res << j
        res &= mask
    return res >> (k - a[i]) 

def main():
    # neededとなるindexの最小を求める
    lo = 0 # 可能最小
    hi = n # 可能最大 + 1
    while lo != hi:
        i = (lo + hi) // 2
        if is_needed(i):
            hi = i
        else:
            lo = i + 1

    return hi
    
if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3572
using System;
using System.Linq;
using System.Collections.Generic;

class AOJ
{
    static void Main()
    {
        List<int> mt = new List<int>();
        for (int i = 0; i < 10; i++)
        {
            mt.Add(int.Parse(Console.ReadLine()));
        }
        mt.OrderByDescending(x => x).Take(3).ToList().ForEach(Console.WriteLine);
    }
}


Measured memory_bytes: 18244
#include <stdio.h>
int gcd(int a,int b);
int main(void) {
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		if(b>a){
			a^=b;
			b^=a;
			a^=b;
		}
		printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
	}
  
	return 0;
}


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

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

static const int N = 1000;

int lcs(string X, string Y){
  int c[N + 1][N + 1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  
  X = ' ' + X;
  Y = ' ' + Y;
  
  for(int i = 0; i <= m; i++) {
    c[i][0] = 0;
  }
  for(int j = 1; j <= n; j++) {
    c[0][j] = 0;
  }
  for(int i = 1; i <= m; i++) {
      for(int j = 1; j <= n; j++) {
        if (X[i] == Y[j]) {
          c[i][j] = c[i - 1][j - 1] + 1;
        }
        else {
          c[i][j] = max(c[i - 1][j], c[i][j - 1]);
        }
        maxl = max(maxl, c[i][j]);
      }
  }
  return maxl;
}

int main() {
  string s1, s2;
  int n;
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    cin >> s1 >> s2;
    cout << lcs(s1, s2) << endl;
  }
    
  return 0;

}


Measured memory_bytes: 7124
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();
  let a = read::<i64>();
  let b = read::<i64>();
  let mut ans = 0;

  for i in 1..n + 1 {
    let n_str = i.to_string();
    let mut sum = 0;

    for j in n_str.chars() {
      sum += j.to_digit(10).unwrap();
    }

    if a <= sum as i64 && sum as i64 <= b {
      ans += i;
    }
  }

  println!("{}", ans);
}



Measured memory_bytes: 4352
from collections import defaultdict

n = int(input())
A = map(int, input().split())
C = defaultdict(int)
for a in A:
    C[a] += 1
C = sorted(C.items(), key=lambda x: x[0], reverse=True)
rods = []
for k, v in C:
    if v >= 4:
        rods.append(k)
        rods.append(k)
        break
    if v >= 2:
        rods.append(k)
    if len(rods) == 2:
        break
if len(rods) >= 2:
    ans = rods[0]*rods[1]
else:
    ans = 0
print(ans)


Measured memory_bytes: 28188
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

bool sort_by_b(pair<int,int> a,pair<int,int> b){
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first > b.first;
    }
}

int main(void){
    int n,m,res=0,min=0;
    vector<pair <int,int>> o;
    cin >> n >> m;
    o.resize(m);
    for(int i=0;i<m;++i){
        cin >> o[i].first >> o[i].second;
    }
    sort(o.begin(),o.end(),sort_by_b);
    for(int i=m-1;i>=0;--i){
        if(min <= o[i].first){
            min = o[i].second;
            res++;
        }
    }
    cout << res << endl;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    string s, t;
    int n;
    cin >> n;
    cin >> s >> t;
    FOR(i, 0, n - 1)
        cout << s[i] << t[i];
    return 0;
}


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

public class Main {

    private static BufferedReader br;
    private static StringTokenizer tokenizer;

    private static void solve() throws IOException {
        int n = nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = nextInt();
        }

        // 前面都比他大
        int min = arr[0];
        int ans = 1;
        for (int i = 1; i < n; i++) {
            min = Math.min(min, arr[i]);
            if (min >= arr[i]) {
                ans++;
            }
        }
        
        System.out.println(ans);

    }




    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        solve();
    }

    public static String next() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null)
                throw new IOException();
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

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

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

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

}


Measured memory_bytes: 48004
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n;
  long long sum,sa;
  sum = 0;
  sa = 0;
  cin >> n;
  vector<long long> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    sa += a.at(i);
  }
  for(int i=0;i<n;i++){
    sa -= a.at(i);
    long long si = sa;
    si %= 1000000007;
    sum += a.at(i)*si;
    sum %= 1000000007;
  }
  cout << sum << endl;
}


Measured memory_bytes: 4684
#include<stdio.h>
#include<ctype.h>

int main(){
  char ch;

  while(1){
    scanf("%c",&ch);
    if(ch=='\n')break;

    if(islower(ch)){
      ch = toupper(ch);
    }else if(isupper(ch)){
      ch = tolower(ch);
    }

    printf("%c",ch);
  }
  printf("\n");
  return 0;
}


	   

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,x;
	cin>>n>>m>>x;
	if(n>x){
		cout<<"NO";
		return 0;
	}
	if(n==x){
		cout<<"YES";
		return 0;
	}
	if(n+m<x){
		cout<<"NO";
		return 0;
	}
	for(int i=1;i<m;i++){
		if(n+i==x){
			cout<<"YES";
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define INF 1000000007
#define elif else if
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}
int a[5],n;
signed main() {
	rep(i, 5) {
		cin >> a[i];
	}
	cin >> n;
	sort(a, a + 5);
	if (a[4] - a[0] > n) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define eps 1e-7
#define PI acos(-1)
#define de(x) cout<<#x<<'='<<x<<" , "
#define dee(x) cout<<#x<<'='<<x<<endl
#define sz(x) x.size()
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define mset(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int MAXN=55,MAXE=55*55;
struct Point{
    LL x,y;
    void read(){ scanf("%lld %lld",&x,&y); }
}p[MAXN];
int N,K;
bool check(Point i,Point j,Point k){
    return min(i.x,j.x)<=k.x&&max(i.x,j.x)>=k.x
        &&min(i.y,j.y)<=k.y&&max(i.y,j.y)>=k.y;
}

LL getarea(Point a,Point b){
    LL dx=abs(a.x-b.x),dy=abs(a.y-b.y);
    return dx*dy;
}

int main(){
    scanf("%d %d",&N,&K);
    rep(i,0,N) p[i].read();
    LL best=-1;

    for(int x1=0;x1<N;++x1) for(int y1=0;y1<N;++y1){
        for(int x2=x1+1;x2<N;++x2) for(int y2=y1+1;y2<N;++y2){
            Point a,b;
            a.x=min(p[x1].x,p[x2].x),a.y=min(p[y1].y,p[y2].y);
            b.x=max(p[x1].x,p[x2].x),b.y=max(p[y2].y,p[y1].y);
            int cnt=0;
            for(int k=0;k<N;++k){
                if(check(a,b,p[k])) cnt++;
                if(cnt>=K){
                    LL area=getarea(a,b);
                    if(best==-1||best>area) best=area;
                    break;
                }
            }
        }
    }
/*
    for(int i=0;i<N;++i) for(int j=i+1;j<N;++j){
        int cnt=2;
        for(int k=0;k<N;++k){
            if(k==i||k==j) continue;
            if(check(a,b,p[k])) cnt++;
            if(cnt>=K){
                LL area=getarea(a,b);
                if(best==-1||best>area) best=area;
                break;
            }
        }
    }
    */
    cout<<best<<endl;
}


















/*
struct Edge{
    int nx,v,w;
}e[MAXE];
int Fi[MAXN],sz;
void E_add(int u,int v,int w){
    e[sz].v=v,e[sz].w=w,e[sz].nx=Fi[u],Fi[u]=sz++;
}
void SPFA(int st){
    mset(dis,0x3f);
    mset(vis,0); dis[st]=0;
    queue<int> q;
    q.push(st);
    while(!q.empty()){
        int u=q.front(); q.pop();
        vis[u]=0;
        for(int i=Fi[u];i!=-1;i=e[i].nx){
            int v=e[i].v;
            if(dis[v]>dis[u]+e[i].w){
                dis[v]=dis[u]+e[i].w;
                if(!vis[v]){ vis[v]=1; q.push(v); }
            }
        }
    }
}
*/


Measured memory_bytes: 256
import itertools
n,m=map(int,input().split())
p=[[0]*n for i in range(n)]#隣接行列
for i in range(m):
    a,b=map(int,input().split())
    p[a-1][b-1]=1
    p[b-1][a-1]=1
seq=(i for i in range(n))
x=list(itertools.permutations(seq))
#print(x[0])
l=len(x)
ans=0
for i in range(l):
    k=x[i]
    if k[0]==0:
        for j in range(n-1):
            if p[k[j]][k[j+1]]!=1:
                break
        else:
            ans+=1
            #print(k)
    else:
        break
print(ans)


Measured memory_bytes: 8052
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
bool DEBUG = 0; void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void main(string[] args){ args ~= ["", ""]; string cmd = args[1]; if(cmd == "-debug") DEBUG = 1;
if(cmd == "-gen") gen; else if(cmd == "-jury") jury; else solve; } 
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ std.stdio.write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void gen(){
  int n = uniform(2, 100);
  print(n);
  long[] as;
  foreach(i; 0 .. n) as ~= uniform(1, 1000); 
  print(as.unsplit);
}
void jury(){
  int n = scan!int;
  long[] as = scan!long(n);

  long ans = -1;
  foreach(x; 0 .. as[0]){
    long tmp = (as[0] - x) ^ (as[1] + x);
    if(as.length > 2) foreach(a; as[2 .. $]) tmp ^= a;
    if(tmp == 0){
      ans = x;
      break;
    }
  }
  ans.writeln;
}
void solve(){
  int n = scan!int;
  long[] as = scan!long(n);
  as ~= 0;
  log("as:", as);
  
  long u, v;
  u = as[0] + as[1];
  foreach(a; as[2 .. $]) v ^= a;
  log("u:", u, "v:", v);
  
  long d = u - v;
  log("d:", d);

  if(d  < 0){
    "-1".writeln;
    return;
  }
  if(d % 2 == 1){
    "-1".writeln;
    return;
  }

  d /= 2;
  if(d > as[0]){
    "-1".writeln;
    return;
  }
  if(d & v){
    "-1".writeln;
    return;
  }

  long m = 1;
  while(m * 2 <= as[0]) m *= 2;
  log("m:", m);

  while(m > 0){
  	if((m & v) && d + m <= as[0]) d += m;
    m /= 2;
  }
  if(d == 0){
    "-1".writeln;
    return;
  }
  log("d:", d);
  
  long ans = as[0] - d;
  ans.writeln;
}
/*
　u := a[0] + a[1]
　v := a[2] ^ a[3] ^ ... ^ a[n-1]
とするとき、題意は
　a + b = u
　a ^ b = v
をみたす、a[0] 以下で最大の a を探すことである

u = 10011
v =  1011
であるとき その差は 1000 つまり 200
つまり v は 剰余をとる前は 1211 だったみたいな感じ
これをaとbに分ける
よって 100 は必須で、それ以外のビットは
a[0]に届かない限りなるべく立てる
*/


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

int main(){

	int n, m, sum;
	cin >> n >> m;
	
	int mix[n];
	
	sum = 0;
	
	int mini = 10000;
	
	for(int i=0; i<n; i++) {
		
		cin >> mix[i];
		
		sum += mix[i];
		
		if (mix[i] < mini) mini = mix[i];
		
	}
	
	/*cout << sum << endl;*/
	
	int ans = n + (m - sum) / mini;
	
	cout << ans <<endl;
	
    return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a[3],i;
    for(i=0;i<3;i++)
        scanf("%d",&a[i]);
    int count5 = 0;
    int count7 = 0;
    for(i=0;i<3;i++)
    {
        if(a[i]==5)
        count5++;
        else if(a[i]==7)
        count7++;
    }
    if(count5==2 && count7==1)
    printf("YES");
    else
    printf("NO");
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define double long double
void solve() {
    double w, h, x, y;
    cin >> w >> h >> x >> y;
     if(w/2 == x && h/2 == y) {
         cout << std::fixed;
        cout << setprecision(6);
        cout << w*h/2 << " " << '1' << endl;
     }
     else {
         cout << std::fixed;
        cout << setprecision(6);
        cout << w*h/2 << " " << '0' << endl;
     }
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<long>data(n);
  for(int i = 0;i < n;i++){
    cin >> data[i];
  }
  sort(data.begin(),data.end());
  reverse(data.begin(),data.end());
  int cnt = 0;long long ans = 1;
  for(int i = 0;i < n-1;i++){
    if(data[i] == data[i+1]){
      ans *= data[i];
      cnt++;
      i++;
    }
    if(cnt == 2){
      cout << ans << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}


Measured memory_bytes: 1024
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let cols = lines.shift().split(/\s/).map((v) => v - 0);
    let N = cols[0], M = cols[1];
    let ans = 1;
    for (let A = 1; A * A <= M; A++) {
        if (M % A != 0) continue;
        let B = Math.floor(M / A);
        if (A * N <= M) ans = Math.max(ans, A);
        if (B * N <= M) ans = Math.max(ans, B);
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include<stdio.h>
#include<stdlib.h>

void bubble_sort(int* A, int N);
void print_array(int* A, int N);
void swap(int* A, int* B);

int main() {
    int n;
    int i;
    int* A;
    scanf("%d", &n);
    A = (int*)malloc(sizeof(int)*n);
    for ( i = 0; i < n; i++ ) {
        scanf("%d", &A[i]);
    }
    
    bubble_sort(A, n);
    
    free(A);
    return 0;
}

void bubble_sort(int* A, int N ) {
    char flag = 1;
    int j;
    int count = 0;
    while ( flag ) {
        flag = 0;
        for ( j = N-1; j >= 1; j-- ) {
            if ( A[j] < A[j-1] ) {
                swap(&A[j], &A[j-1]);
                count++;
                flag = 1;
            }
        }
    }
    
    print_array(A,N);
    printf("%d\n", count);
}

void print_array(int* A, int N) {
    int i;
    for ( i = 0; i < N; i++ ) {
        if ( i != N-1 ) {
            printf("%d ", A[i]);
        } else {
            printf("%d", A[i]);
        }
    }
    printf("\n");
}

void swap(int* A, int* B ) {
    int temp = *A;
    *A = *B;
    *B = temp;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    ll N,A,B;cin>>N>>A>>B;
    if(A>B)cout<<0<<endl;
    else if(N==1 && B!=A)cout<<0<<endl;
    else if(N==1||N==2)cout<<1<<endl;
    // 最小(N-1)*A+B,最大A+(N-1)*Bの整数が総和の可能性として存在する.
    else{
        cout<<(N-2)*(B-A)+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int M,N,A[200010];
bool check(int md){
	for(int i=M;i>=1;i--){
		int ls=N+1-i,rs=N+2-i;
		if((A[i]>md ^ A[i-1]<=md) && A[i-1]!=0)	return A[i]>md;
		if((A[rs]>md ^ A[ls]<=md) && A[ls]!=0)	return A[rs]>md;
	}
	return A[1]>md;
}
int main(){
	scanf("%d",&M);N=2*M-1;
	for(int i=1;i<=N;i++)	scanf("%d",&A[i]);
	int L=1,R=1000010,m;
	while(L+1<R){
		m=(L+R)>>1;
		if(check(m))	L=m;
		else	R=m;
	}
	printf("%d\n",R);
	return 0;
}

Measured memory_bytes: 896
/*
 * wafuIroha.cpp
 *
 *  Created on: 2020/02/23
 *      Author: black
 */
#include <iostream>
using namespace std;

int main(){
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	int count = 0;

	if (n > k){
		for (int i = 0; i < k; ++i){
			count+=x;
		}


		for (int i = 0; i < n-k; ++i){
			count+=y;
		}
	}

	else{
		for (int i = 0; i < n; ++i){
					count+=x;
				}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;

int main(){
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  for(int g=0;g<=a;g++){
    for(int h=0;h<=b;h++){
      for(int f=0;f<=c;f++){
        if(500*g+100*h+50*f == x) ans ++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)


#define huge 1000000007
typedef long long ll;

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll K = 0;
	ll W = 0;
	ll X = 0;
	//ll m[100000] = {};
	ll w[3] = {};
	ll v[100] = {};
	ll *x, *c, *d;
	//string S,T,U;
	ll count = 0;
	ll sum = 0;
	ll min = 1;
	ll max = 0;
	int flag = 0;
	//char p;
	cin >> w[0] >> w[1] >> w[2];
	
	sort(w,w+3);

	//x = (ll *)malloc(N * sizeof(ll));

	sum += abs(w[0] - w[1]);
	sum += abs(w[1] - w[2]);


		cout << sum << endl;


	return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
#define ll long long
const double PI=4*atan(1);
using namespace std;
using boost::multiprecision::cpp_int; 
#define ull cpp_int
#define MOD 1000000007

int findmin(int a,int b) {
    return a<b?a:b;
}
int findmax(int a,int b) {
    return a>b?a:b;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long n,q;
    cin>>n;
    long a[n];
    ull sum=0;
    unordered_map<long,long> um;
    for(long i=0;i<n;i++) {
		cin>>a[i];
		sum+=a[i];
		um[a[i]]++;
	}
	cin>>q;
	long b,c;
	while(q--) {
		cin>>b>>c;
		ull diff=um[b]*(c-b);
		um[c]+=um[b];
		um[b]=0;
		sum+=diff;
		cout<<sum<<"\n";
	}
    cout.flush();
    return 0;
}


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

int main() {
    int a, b, c, d;
    cin >> a;
    b = a / 100;
    c = (a - b * 100) / 10;
    d = a - (b * 100) - (c * 10);
    cout << b + c + d << endl;
}

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

int main(){
    long long x;
    cin >> x;
    long long ans = (x / 11) * 2;
    x %= 11;
    if(x){
        if(x <= 6) ans += 1;
        else ans += 2;
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  ll n,m; cin>>n>>m;
  priority_queue<ll> pq;
  for(int i=0;i<n;i++){
    ll a; cin>>a;
    pq.push(a);
  }
  for(int i=0;i<m;i++){
    ll x=pq.top(); pq.pop();
    x/=2;
    pq.push(x);
  }ll ans=0;
  for(int i=0;i<n;i++){
    ans+=pq.top();
    pq.pop();
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1400