akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <climits>
using namespace std;

int main(){
    
    int N,K;
    cin >> N >> K;
    double long P[N];
    for(int i = 0; i < N;i++)cin >> P[i];
    
    double long Q[N];
    
    for(int i = 0; i < N;i++)Q[i] = (P[i]+1);
    
    double long S[N+1];
    S[0] = 0;
    for(int i = 1; i < N+1;i++)S[i] = S[i-1] + Q[i-1];
    
    double long mx = 0;
    for(int i = 0; i < N-K+1;i++){
        mx = max(mx, S[K+i]-S[i]);
    }
    cout <<setprecision(20)<< mx/2 <<endl;    
    
    
}


Measured memory_bytes: 9600
#define  _USE_MATH_DEFINES

#define  rep(i, n) for(int i = 0; i < n; i++)
#define  repx(i, a, n) for(int i = a; i < n; i++)
#define  loop while(1)
#define  lli long long int
 
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <utility>
#include <set>

using namespace std;

int main() {

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

  vector<int> org(n, 0);
  int tmpx = 0;
  int cnt  = 0;

  rep (i, n) {
    cin >> tmpx;
    cnt += tmpx;
    org[i] = tmpx;
  }

  vector<int> tmp(m, 0);
  rep (i, m) cin >> tmp[i];

  vector<int> goal1(n, 0);
  vector<int> goal2(n, 0);

  int x = 0;
  int tmpi = 0;

  int cnt1 = 0;
  int cnt2 = 0;

  rep (i, m) {
    x = (x + 1) % 2;
    rep (j, tmp[i]) {
      goal1[tmpi] = x;
      cnt1 += x;
      goal2[tmpi] = (x + 1) % 2;
      cnt2 += (x + 1) % 2;
      tmpi += 1;
    }
  }

  int ans1 = 0;
  int ans2 = 0;

  tmpi = 0;
  rep (i, n) {
    if (cnt != cnt1) {
      ans1 = 1000;
      break;
    }
    if (org[i] == 1) {
      while (goal1[tmpi] == 0) {
        tmpi += 1;
      }
      ans1 += abs(tmpi - i);
      tmpi += 1;
    }
  }

  tmpi = 0;
  rep (i, n) {
    if (cnt != cnt2) {
      ans2 = 1000;
      break;
    }
    if (org[i] == 1) {
      while (goal2[tmpi] == 0) {
        tmpi += 1;
      }
      ans2 += abs(tmpi - i);
      tmpi += 1;
    }
  }

  cout << min(ans1, ans2) << endl;

  return 0;
}



Measured memory_bytes: 3112
R, G, B, N = map(int, input().split())
ball = 0
count = 0
num = N//R
for i in range(num+1):
    ball = N-(i*R)
    num2 = ball//G
    for j in range(num2+1):
        n2 = ball-(j*G)
        if n2%B == 0 or n2 == 0:
            count +=1
        else:
            continue
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;


void solve() {
	char a[50][50], b[50][50];
	int n, m;
	bool match = false;
	cin >> n >> m;
	for(int i = 0; i < n; ++i){
	    for(int j = 0; j < n; ++j) {
		cin >> a[i][j];
		}
	}
		for(int i = 0; i < m; ++i) {
	     	for(int j = 0; j < m; ++j) {
			cin >> b[i][j];
			}
		}
		for(int i = 0 ; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				if(i + m - 1 >= n || j + m - 1 >= n) continue;
				bool exist = true;
				for(int lx = 0; lx < m; ++lx) {
					for(int ly = 0; ly < m; ++ly) {
						if(a[i + lx][j + ly] != b[lx][ly]) exist = false;
						}
					}
					if(exist) match = true;
				}
			}
			if(match) cout << "Yes" << endl;
			else cout << "No" << endl;
			return;
}
	

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
    using namespace std;
     
    int main(){
     
    int a,b,c,d;
      cin>>a>>b>>c>>d;
      for(int i=1;i<=100;i++){
        int k=c-i*b;
        if(k<=0){cout<<"Yes\n";return 0;}
        int g=a-i*d;
       if(g<=0) {cout<<"No\n";return 0;}
      }
    }

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;


int n, a[114514], r = inf, ri = -1, r2 = inf, rr = inf, rri = -1, rr2 = inf;
map<int,int> x, y;

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a[i];
		(i%2 ? x : y)[a[i]]++;
	}
	each(i,x) {
		if (n/2-i.second<=r) r2 = r, r = n/2-i.second, ri = i.first;
		else if (n/2-i.second<r2) r2 = n/2-i.second;
	}
	each(i,y) {
		if (n/2-i.second<=rr) rr2 = rr, rr = n/2-i.second, rri = i.first;
		else if (n/2-i.second<rr2) rr2 = n/2-i.second;
	}
	int res = (ri==rri ? min(r+min(rr2,n/2), min(n/2,r2)+rr) : r+rr);
	cout << res << endl;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define max_char 128
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lbd lower_bound
#define ubd upper_bound
#define PI 3.141592653589793238
#define pf push_front
#define all(x) x.begin(),x.end()
#define input(arr,n) for(ll c1=0;c1<n;c1++)cin>>arr[c1];
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define mems(x, y) memset(x, y, sizeof(x))
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
//cout<<"Case #"<<v1+1<<": ";
 
ll power(ll base,ll pow, ll mo)
{
   ll res=1;
   while(pow)
   {     
        if (pow%2!=0)  res=(res*base)%mo;
        base=(base*base)%mo;
        pow/=2;
   }
   return res;
}
 
 
int main()
{
    fastio
	
	ll t,i,j,x;
	
	ll n,m;
	cin>>n>>m;
	ll h[n];
	input(h,n);
	
	vector<ll>v[n+1];
	while(m--)
	{
	    cin>>i>>j;
	    v[i].pb(j);
	    v[j].pb(i);
	}
	
	ll ans=0;
	for(i=1;i<=n;i++)
	{
	    if(v[i].size()==0)
	    ++ans;
	    else 
	    {
	        int f=1;
	        for(j=0;j<v[i].size();j++)
	        {
	            if(h[v[i][j]-1]>=h[i-1])
	            {
	                f=0;
	                break;
	            }
	        }
	        ans+=f;
	    }
	}
	cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 10268
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s;cin>>s;
	int cnt = 0;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == 'x')cnt++;
	}
	if(cnt >= 8){
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n,m,k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]

t = sum(b)
j = m
ans = 0
for i in range(n+1):
    while j > 0 and t > k:
        j -= 1
        t -= b[j]
    if t > k: break
    ans = max(ans, i + j)
    if i==n:break
    t+=a[i]

print(ans)

Measured memory_bytes: 40660
#include <iostream>
typedef long long ll;
using namespace std;
int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if(a>b) cout << '0' << endl;
    else if(n==1) {
        if(a!=b) cout << '0' << endl;
        else cout << '1' << endl;
    } else cout << (b-a)*(n-2) + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int a, b;
	cin >> a >> b;
	if(a+b >= 10){
		cout << "error" << endl;
	}else{
		cout << a+b << endl;
	}
}

Measured memory_bytes: 256
import sys
n = int(input())
if n > 81 or n == 0:
    print('No')
    sys.exit()
elif n == 1:
    print('Yes')
    sys.exit()
else:
    for i in reversed(range(2, 10)):
        if n % i != 0:
            pass
        elif n % i == 0 and n / i < 10:
            print('Yes')
            sys.exit()
        else:
            print('No')
            sys.exit()
print('No')

Measured memory_bytes: 3060
#!/usr/bin/env python
size = int(input())
line = list(map(int, input().split()))

def insertionSort(A, N):
    ans = " ".join(map(str, line))
    print(ans)
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        ans = " ".join(map(str, line))
        print(ans)

def main():
    insertionSort(line, size)

if __name__ == '__main__':
    main()

Measured memory_bytes: 7752
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	num, _ := strconv.Atoi(a + b)

	for i := 0; i < 1000; i++ {
		if i*i == num {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")

}


Measured memory_bytes: 512
#include<stdio.h>
int p[110][5],m;
int f(int a,int b,int c,int d){
  int k;
  for(k=0;k<m;k++){
    if(p[k][0]==a&&p[k][1]==b&&p[k][2]==c&&p[k][3]==d||
       p[k][0]==c&&p[k][1]==d&&p[k][2]==a&&p[k][3]==b)return 0;
  }
  return 1;
}
int main(){
  int n,w,h,i,j;
  scanf("%d",&n);
  while(n--){
    int d[20][20]={1};
    scanf("%d %d %d",&h,&w,&m);
    for(i=0;i<m;i++){
      for(j=0;j<4;j++)scanf("%d",&p[i][j]);
    }
    for(i=0;i<=h;i++){
      for(j=0;j<=w;j++){
	d[i+1][j]+=d[i][j]*f(i,j,i+1,j);
	d[i][j+1]+=d[i][j]*f(i,j,i,j+1);
      }
    }
    d[h][w]?printf("%d\n",d[h][w]):printf("Miserable Hokusai!\n");
  }
  
  return 0;
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r" , stdin) ; freopen("out.txt" , "w" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , d[MAXN];

int main() {
    fast_io;

    cin >> n;
    for(ll i = 1 ; i <= n ; i++)    cin >> d[i];
    sort(d + 1 , d + n + 1);
    cout << d[n / 2 + 1] - d[n / 2];

    return 0;
}
/*

*/


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

// O(n^3)
// dp[i][j] := [i,j]????¨???????????????????????°?????????????????????°
// i??????????????????(?????°????????°)??????(p[i - 1], p[i])
int matrixChainMultiplication(int n, pair<int, int> p[105]){
    int dp[105][105] = {{0}};
    range(seg, 2, n + 1){ //?¨????????????????????????°
        range(i, 0, n - seg + 1){
            int j = i + seg - 1;
            dp[i][j] = INT_MAX;
            range(k,i,j){
                //cout << i << ' ' << k << ' ' << j << endl;
                //show(dp[i][k])
                //show(dp[k + 1][j])
                //show(p[i].second * p[k].first * p[k + 1].second * p[j].first);
                int cost = dp[i][k] + dp[k + 1][j] + p[i].second * p[k].first * p[k + 1].second * p[j].first;
                //show(cost)
                dp[i][j] = min(dp[i][j], cost);
            }
        }
    }
    return dp[0][n - 1];
}

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

    pair<int, int> p[105];
    rep(i,n) cin >> p[i].second >> p[i].first;
    cout << matrixChainMultiplication(n,p) << endl;
}

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

int main(){

    int N, K;
    cin >> N >> K;

    vector<int> x(N);
    int ans = 0;
    for (int i=0; i<N; i++){
        cin >> x.at(i);

        int diff_a, diff_b;
        diff_a = x.at(i)*2;
        diff_b = (K - x.at(i))*2;
        ans += min(diff_a, diff_b);
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * a - b;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	long long n,d,ans=0;
	cin>>n>>d;
	d=d*d;
	for(long long i=1;i<=n;i++){
		long long x,y;
		cin>>x>>y;
		if(x*x+y*y<=d)ans++;
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-8;

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

int X, Y;

bool map[50][50];
bool passed[50][50][50][50];

struct node{
    int cost,tx,ty,kx,ky;
};

bool check(int x, int y)
{
    return x < 0 || x >= X || y < 0 || y >= Y || map[y][x];
}

int main()
{
    int tx, ty, kx, ky, ans;
    while(cin >> X >> Y, X|Y)
    {
        ans = -1;
        memset(passed, 0, sizeof passed);
        queue<node> que;

        cin >> tx >> ty >> kx >> ky;
        tx--, ty--, kx--, ky--;

        for(int i = 0; i < Y; i++)
            for(int j = 0; j < X; j++)
                cin >> map[i][j];

        passed[tx][ty][kx][ky] = true;

        for(que.push((node){0,tx, ty, kx, ky}); !que.empty(); que.pop())
        {
            node p = que.front();

            if(p.cost >= 100)
                break;

            if(p.tx == p.kx && p.ty == p.ky)
            {
                ans = p.cost;
                break;
            }

            for(int i = 0; i < 4; i++)
            {
                int mtx = p.tx + dx[0][i], mty = p.ty + dy[0][i];
                int mkx = p.kx + dx[1][i], mky = p.ky + dy[1][i];

                if(check(mtx, mty))
                    mtx = p.tx, mty = p.ty;
                if(check(mkx, mky))
                    mkx = p.kx, mky = p.ky;
                if(passed[mtx][mty][mkx][mky])
                    continue;

                passed[mtx][mty][mkx][mky] = true;
                que.push((node){p.cost + 1,mtx, mty, mkx, mky});
            }
        }

        if(ans == -1)
            puts("NA");
        else
            cout << ans << endl;
    }
}

Measured memory_bytes: 7536
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [n, x] <- fmap read . words <$> getLine :: IO [Int]
    as <- fmap read . words <$> getLine :: IO [Int]
    case x `compare` sum as of
        LT -> do
            let bs = takeWhile (<= x) $ scanl1 (+) (sort as)
            print $ length bs
        EQ -> print n
        GT -> print (n - 1)


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#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))
//-------------------------------------------------------
 
int W,H;
string S[12];
string T[12],R[12];
int num=0;
 
void hoge() {
	int x,y;
	set<string> U;
	int left=0;
	
	FOR(x,W) {
		if(U.count(R[x])) {
			U.erase(R[x]);
		}
		else {
			U.insert(T[x]);
		}
	}
	
	if(U.empty()) {
		cout<<"YES"<<endl;
		exit(0);
	}
	if(U.size()==1) {
		string s=*U.begin();
		string t=s;
		reverse(ALL(s));
		if(t==s) {
			cout<<"YES"<<endl;
			exit(0);
		}
	}
}
 
void add(int l) {
	int x;
	FOR(x,W) {
		T[x].push_back(S[l][x]);
		R[x][H-T[x].size()]=S[l][x];
	}
}
void del() {
	int x;
	FOR(x,W) T[x].pop_back();
}
 
void dfs(int mask,int last) {
	int i;
	if(__builtin_popcount(mask)>=(H+1)/2) {
		int num=0;
		FOR(i,H) {
			if((mask&(1<<i))==0) {
				num++;
				add(i);
			}
		}
		hoge();
		FOR(i,num) del();
		return;
	}
	
	FOR(i,H) if((mask&(1<<i))==0) {
		add(i);
		dfs(mask^(1<<i),i);
		del();
	}
}
 
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	FOR(x,W) R[x].resize(H);
	FOR(y,H) cin>>S[y];
	vector<int> V;
	dfs(0,-1);
	cout<<"NO"<<endl;
}
 
 
int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define outt(x,y) cout<<(x)<<" "<<(y)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
	in(n);
	int x[100] = {};
	rep(i, n) cin >> x[i];

	ll min = lim9;
	repp(i, 100) {
		ll a = 0;
		repp(j, n) {
			a += (x[j - 1] - i) * (x[j - 1] - i);
		}
		if (a < min) min = a;
	}

	out(min);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;


int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,k;
    cin >> n >> k;
    int64_t d;
    vi res(n,0);
    rep(i,k){
        cin >> d;
        vi a(d);
        rep(j,d) cin >> a.at(j);
        rep(j,d){
            res.at(a.at(j)-1) = 1;
        }
    }
    int64_t result = 0;
    rep(i,n){
        if(res.at(i) == 0) result++;
    }
    cout << result << endl;
}

Measured memory_bytes: 3664
a,b,c,d = (int(i) for i in input().split())
x = c
y = d
if x<y:
  tmp = x
  x = y
  y = tmp
r = x%y
while r>0:
  x = y
  y = r
  r = x%y
m = c*d//y
n = b//m - (a+m-1)//m + 1
c0 = b//c - (a+c-1)//c + 1
d0 = b//d - (a+d-1)//d + 1
ans = (b-a+1) - (c0+d0) + n
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void) {
  char buf[1200];
  char c;
  int i;
  int answer[26];
  memset(answer, 0, sizeof(answer));
  while(fgets(buf, sizeof(buf), stdin) != NULL) {
    for(i = 0; buf[i] != '\0'; i++) {
      if(buf[i] >= 'A' && buf[i] <= 'Z')
        buf[i] = tolower(buf[i]);
      answer[buf[i] - 'a'] += 1;
    }
  }
  for(c = 'a', i = 0; c <= 'z'; c++, i++)
    printf("%c : %d\n", c, answer[i]);
  return 0;
}

Measured memory_bytes: 524
#include <iostream>
using namespace std;
#define FOR(i,s,e) for(int i = (s);i <= (e);i++)
int cou[13];

int N;

int main()
{
	cin >> N;
	int a;
	FOR(i,0,N - 1)
	{
		cin >> a;
		int rate = a / 400;

		cou[rate]++;
	}

	int kind = 0;

	FOR(i,0,7)
	{
		if(cou[i] > 0) kind++;
	}
	
	int max_cou = 0;
	FOR(i,8,12)
	{
		max_cou += cou[i];
	}

	if(kind == 0) cout << 1 << " ";
	else cout << kind << " ";

	kind += max_cou;

	cout << kind << endl;
	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 m = sc.nextInt();
        long[] x = new long[n+1];
        long[] y = new long[n+1];
        long[] z = new long[n+1];
        for (int i = 1; i <= n; i++) {
            x[i] = sc.nextLong();
            y[i] = sc.nextLong();
            z[i] = sc.nextLong();
        }
        long ans = 0L;
        for (int i = 0; i < 8; i++) {
            long xs = (i & 1) == 1 ? 1L : -1L;
            long ys = (i >>1& 1) == 1 ? 1L : -1L;
            long zs = (i >>2& 1) == 1 ? 1L : -1L;
            long t = 0L;
            long[] s = new long[n+1];
            s[0] = Long.MIN_VALUE;
            for (int j = 1; j <= n; j++) {
                s[j] = x[j]*xs + y[j]*ys + z[j]*zs;
            }
            Arrays.sort(s);
            for (int j = 0; j < m; j++) {
                t += s[n-j];
            }
            if(ans < t) ans = t;
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 27776
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class AAirportBus
    {
        public static void Main(string[] args)
        {
            new AAirportBus().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var N = cin.ReadInt;
            var C = cin.ReadInt;
            var K = cin.ReadInt;
            var ans = 1;

            int[] A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = cin.ReadInt;
            }

            Array.Sort(A);

            var timer = A[0] + K;
            var passenger = 0;

            for (int j = 0; j < N; j++)
            {
                if (A[j] > timer || passenger == C)
                {
                    ans++;
                    timer = A[j] + K;
                    passenger =1;
                }
                else
                {
                    passenger++;
                }

            }
            WriteLine(ans);
        }

    }
}
public class ConsoleInput
{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read
    {
        get
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}

Measured memory_bytes: 15568
using Microsoft.VisualBasic.FileIO;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;


namespace AtCoder
{
    class Program
    {

        const int BiggestMod = 1000000007;


        static void Main()
        {

            var args = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var numRooms = args[0];
            var numLoots = args[1];

            var roomsWith = new List<int>[numRooms + 1];
            var roomsLength = numRooms + 1;
            var result = new int[numRooms + 1];

            for (int i = 1; i < roomsLength; i++)
            {
                roomsWith[i] = new List<int>();
                result[i] = 0;
            }

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

                var buf = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                roomsWith[buf[0]].Add(buf[1]);
                roomsWith[buf[1]].Add(buf[0]);

            }

            Search(new int[] { 1 });

            for (int i = 2; i < roomsLength; i++)
                if (result[i] == 0)
                {

                    Console.WriteLine("No");
                    return;

                }

            Console.WriteLine("Yes");

            for (int i = 2; i < roomsLength; i++)
                Console.WriteLine(result[i]);

            void Search(int[] searchIndex)
            {

                

                var list = new List<int>();
                for (int i = 0, l = searchIndex.Length; i < l; i++)
                foreach (var find in roomsWith[searchIndex[i]])
                    if (result[find] == 0)
                    {

                        result[find] = searchIndex[i];
                        list.Add(find);

                    }

                if (list.Count != 0) Search(list.ToArray());

            }

        }
    }
}


Measured memory_bytes: 64484
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from bisect import bisect_right
from operator import itemgetter

N,M,Q = II()
x = []
for _ in range(M):
    L,R = II()
    x.append((L-1, R-1))
query = []
for _ in range(Q):
    p0,q0 = II()
    query.append((p0-1, q0-1))

x.sort(key=itemgetter(1))

y = [[10**5+1]*M for _ in range(N)]
c = [0]*N
for i in range(M):
    for j in range(x[i][0]+1):
        y[j][c[j]] = x[i][1]
        c[j] += 1

ans = 0
for q in query:
    print(bisect_right(y[q[0]], q[1]))

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

#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

int main() {
    long long n, k, ans = 0;
    cin >> n;
    vector<long long> as(n);
    REP(i, n) { cin >> as[i]; }
    vector<vector<long long>> dp(n / 2, vector<long long>(2));
    dp[0][0] = as[0];
    dp[0][1] = as[1];
    for (long long i = 1; i < n / 2; i++) {
        REP(j, 2) {
            if (j == 0) {
                dp[i][j] = dp[i - 1][j] + as[2 * i];
            }
            if (j == 1) {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][0]) + as[2 * i + 1];
            }
        }
    }
    if (n % 2 == 0) {
        cout << max(dp[n / 2 - 1][0], dp[n / 2 - 1][1]) << endl;
    } else {
        long long big = max(dp[n / 2 - 1][0], dp[n / 2 - 1][1]);
        long long take = 0;
        REP(i, n / 2) {
            take += as[n - 1 - i * 2];
            if (i == n / 2 - 1) {
                if (take > big) {
                    big = take;
                }
                continue;
            }
            if (take + max(dp[(n - 2 * i - 2) / 2 - 1][0], dp[(n - 2 * i - 2) / 2 - 1][1]) > big) {
                big = take + max(dp[(n - 2 * i - 2) / 2 - 1][0], dp[(n - 2 * i - 2) / 2 - 1][1]);
            }
        }
        cout << big << endl;
    }
}

Measured memory_bytes: 10324
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,X;
  cin>>A>>B>>C>>X;
  int count=0;
  for(int i=0;i<A+1;i++){
    for(int j=0;j<B+1;j++){
      for(int k=0;k<C+1;k++){
        if(500*i+100*j+50*k==X){
          count=count+1;
        }
      }
    }
  }
  cout<<count<<endl;
}

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

int main(int argc, char const *argv[]) {
    int A,B,C;
    std::cin >> A>>B>>C;
    int g = std::__gcd(A,B);
    if (C%g==0) {
        std::cout << "YES" << '\n';
    }else{
        std::cout << "NO" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ans := 0
	for i := 1; i*i < n; i++ {
		if n%i == 0 {
			if m := n/i - 1; m > i {
				ans += m
			}
		}
	}
	fmt.Println(ans)
}


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

int func(int n){
  if (n%2==0){
    return n/2;
  }else{
    return 3*n+1;
  }
}

int a(int i,int s){
  if (i==1){
    return s;
  }else{
    return func(a(i-1,s));
  }
} 

int main(){
  int s;
  cin>>s;
  multiset<int> x;
  for (int i=1; i<=1000000; i++){
    if (find(x.begin(),x.end(),a(i,s))!=x.end()){
      cout<<i<<endl;
      break;
    }
    x.insert(a(i,s));
  }
}
  

Measured memory_bytes: 3600
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int A = int.Parse(input[0]);
    int B = int.Parse(input[1]);
    int C = int.Parse(input[2]);
    
    if ((B <= A) && (C <= A)) {
      Console.WriteLine(A * 10 + B + C);
    } else if ((A <= B) && (C <= B)) {
      Console.WriteLine(B * 10 + A + C);
    } else {
      Console.WriteLine(C * 10 + A + B);
    }
  }
}


Measured memory_bytes: 11092
/* 
	Author: ankrypt
*/
 
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
 
ll N;
ll L, R;
std::vector<pair<ll, ll>> V, V1;
 
int main() {
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lld %lld", &L, &R);
		V.push_back(make_pair(L + R, L - R));
		V1.push_back(make_pair(L - R + 1, L + R - 1));
	}
	sort(V.begin(), V.end());
	ll cnt = 1;
	ll lastVal = V[0].first;
	for(int i = 1; i < N; i++) {
		if(V[i].second < lastVal) {
			continue;
		}
		else {
			lastVal = max(lastVal, V[i].first);
			cnt++;
		}
		// cout << lastVal << " " << i << "\n";
	}
	// cnt = max(cnt1, cnt);
	printf("%lld\n", cnt);
	return 0;
}
/*
	Powered by Buggy Plugin
*/

Measured memory_bytes: 3564
n,k=map(int,input().split())
s=list(input())
s=list(map(int,s))
stack=[]
tmp=1
flag=True
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    stack.append(tmp)
    tmp=1
  else:
    tmp+=1
stack.append(tmp)
left=[0]
right=[0]
tmp=0
if s[0]==0:
  flag=False
  if len(stack)%2==1:
    stack.append(0)
  if len(stack)//2<=k:
    print(len(s))
    exit()
else:
  if len(stack)%2==0:
    stack.append(0)
  if len(stack)//2<=k:
    print(len(s))
    exit()
for i in range(len(stack)):
  tmp+=stack[i]
  if i%2==0:
    if flag:
      right.append(tmp)
    else:
      left.append(tmp)
  else:
    if flag:
      left.append(tmp)
    else:
      right.append(tmp)
ans=0
if flag:
    for i in range(len(right)-k-1):
      ans=max(ans,right[i+k+1]-left[i])
else:
  for i in range(len(right)-k):
    ans=max(ans,right[i+k]-left[i])
print(ans)


Measured memory_bytes: 8592
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005
#define INF (1e9+1)

int n,W;
int dp[MAX];

int main(){
  fill(dp,dp+MAX,INF);
  dp[0]=0;
  
  cin>>n>>W;
  for(int i=0;i<n;i++){
    int v,w;
    cin>>v>>w;
    for(int j=MAX-1;j>=v;j--){
      dp[j]=min(dp[j],dp[j-v]+w);
    }
  }

  for(int i=MAX-1;i>=0;i--){
    if(dp[i]<=W){
      cout<<i<<endl;
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3468
#include <iostream>

int main()
{
    int N;
    std::cin >> N;

    long result{0};
    for (auto i = 1; i <= N; i++) {
        auto divided = N / i;  // floor(N, i);
        result += long{i} * divided * (divided + 1) / 2;
    }

    std::cout << result << std::endl;

    return 0;
}


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

int main()
{
  int h[100010];
  int dp[100010];
  int N, K;
  cin >> N >> K;
  rep(i, N) cin >> h[i];
  rep(i, N) dp[i] = INF;

  dp[0] = 0;
  rep(i, N) {
    rep(k, K+1) {
      if (i+k < N && i+k > 0) {
        dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]));
      }
    }
  }
  cout << dp[N-1] << endl;
  return 0;
} 

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>

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

int main() {

	ll N, n = 0;
	scanf("%lld", &N);

	for (ll i = 1; i * (i + 1) / 2 < 112345; ++i) {
		if (N == i * (i + 1) / 2) {
			n = i;
			break;
		}
	}
	if (!n) {
		printf("No\n");
		return 0;
	}

	vector<vector<ll>> Ans(n + 1);
	ll unused = 1;

	rep(i, n + 1) {
		rep(j, i) {
			Ans[i].push_back(Ans[j][i - 1]);
		}
		for (; Ans[i].size() < n; ++unused) Ans[i].push_back(unused);
	}

	printf("Yes\n");
	printf("%lld\n", n + 1);
	rep(k, n + 1) {
		printf("%lld ", n);
		rep(Sk, n) printf("%lld ", Ans[k][Sk]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void)
{
    int n,l;
    cin >> n >> l;

    vector<int> t(n);
    int t_all=0;

    for(int i = 0;i < n;i++)
    {
        t[i]=l+i;
        t_all+=t[i];
    }

    int err_min=1e8;
    int t_nearest;

    for(int i = 0;i<n;i++)
    {
        int t_rest=t_all-t[i];

        if(abs(t_all-t_rest)<err_min)
        {
            t_nearest=t_rest;
            err_min=abs(t_all-t_rest);
        }
    }

    cout << t_nearest <<endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int sum =0;
      for(int i=1;i<=3;i++){
    	  sum += Math.pow(a, i);  	
        }
		// 出力
		System.out.println(sum);
	}
}

Measured memory_bytes: 35976
#include <vector>
#include <iostream>
using namespace std;
int main() {
  int N; cin >> N;
  vector<int> A(N), B(N);
  for(int i=0;i<N;i++) cin>>A[i];
  for(int i=0;i<N;i++) cin>>B[i];
 
  int ans = 0;
  for(int i=0;i<N;i++) if(A[i]>B[i])ans+=A[i]-B[i];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Map.Entry;
import java.util.*;

import org.w3c.dom.css.Counter;


public class Main {
    public static void main(final String[] args){
        final Scanner s = new Scanner(System.in);
        int A = Integer.parseInt(s.next());
        int B = Integer.parseInt(s.next());
        int C = Integer.parseInt(s.next());
        int K = Integer.parseInt(s.next());
        if(A >K){
            System.out.println(K);
        }else if(A+B>K){
            System.out.println(A);
        }else{
            System.out.println(A-(K-A-B));
        }
    }
}


Measured memory_bytes: 35684
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
#include <map>
using ll = long long int;
using namespace std;

int main()
{
    int r;
    cin >> r;
    cout << r * r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long n,a[10000],min,max,sum=0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (i == 0)
            min = max = a[i];
        else if (a[i] > max)
            max = a[i];
        else if (a[i] < min)
            min = a[i];
        sum += a[i];
    }
    cout << min << " " << max << " " << sum << "\n";
}



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


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

using namespace std;

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

long long int a[100009], l[100009], r[100009];

int main(){
    int n;
    memset(a, 0, sizeof(a));
    memset(l, 0, sizeof(l));
    memset(r, 0, sizeof(r));
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    l[0] = 0;
    for(int i=1;i<=n;i++){
        l[i] = gcd(a[i], l[i-1]);
    }
    r[n+1] = 0;
    for(int i=n;i>=1;i--){
        r[i] = gcd(a[i], r[i+1]);
    }
    long long mx = 0;
    for(int i=1;i<=n;i++){
        mx = max(mx, gcd(l[i-1], r[i+1]));
    }
    cout << mx << endl;
}

Measured memory_bytes: 2560
n, m = map(int, input().split())
L = []
R = []

for i in range(m):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)
if min(R) - max(L) + 1 >= 0:
    print(min(R) - max(L) + 1)
else:
    print(0)


Measured memory_bytes: 10980
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 93193111451418101
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
  ll a;
  cin >> a;
  REP(i, 100) {
    REP(j, 100) {
      if (i * 4 + j * 7 == a) {
        return !printf("Yes\n");
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int count = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			if((i+1)%2==1 && a[i]%2==1) {
				count++;
			}
		}
		System.out.println(count);
	}
}

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

int main(){

    string S;
    cin>>S;
    int cnt_1=0,cnt_0=0;
    for(int i=0;i<S.size();i++){
        if(S.at(i)=='1') cnt_1++;
        else cnt_0++;
    }
    cout<<min(cnt_1,cnt_0)*2<<endl;
}


Measured memory_bytes: 512
s = str(input())
n = s.replace(',','') #,のところをスペースに変える
o = n.replace('.','') #.のところをスペースに変える
m = o.split() #スペースごとに代入
a = []
for i in m:
    l = len(i)
    if l>=3 and l<=6:
        a.append(i)

print(*a)


Measured memory_bytes: 5552
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    ll ii=0,n,d,p,c=0;
    float ans=0.0f;
    cin>>n>>d;
    ll t=n;
    vector< vector<ll> > v;
    v.resize(t);
  	while(t--)
  	{
  	   for(ll k=0;k<d;k++)
  	   {
  	       cin>>p;
  	       v[ii].push_back(p);
  	   }
  	   ii++;
  	}
  	for(ll i=0;i<n-1;i++)
  	{
  	    for(ll j=i+1;j<n;j++)
  	    {
  	        ans=0.0f;
  	        for(ll k=0;k<d;k++)
  	            ans+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
  	        ans=(float)sqrt(ans);
  	       // cout<<ans<<endl;
  	       
  	       if(floor(ans)==ans)
  	            c++;
  	    }
  	}
  	cout<<c;
}

Measured memory_bytes: 256
#include <cstdio>
int main(void){
  int x1,y1,x2,y2,m,n;
  scanf("%d",&m);
  for(int k = 0; k < m; k++){
    scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
    x2 += x1;
    y2 += y1;
    scanf("%d",&n);
    int res = 0;
    for(int i = 0; i < n; i++){
      int x,y;
      scanf("%d %d",&x,&y);
      if(x1 <= x && x <= x2 && y1 <= y && y <= y2) res++;
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 1028
#include<stdio.h>
int main()
{
    int a, b, c, i, j, k, m, n,sum=0;
    int arr[1000],brr[1000];

    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&arr[i]);
        sum=sum+arr[i];
    }
    scanf("%d",&a);
    for(j=0; j<a; j++)
    {
        scanf("%d %d",&b,&c);
        brr[j]=sum-arr[b-1]+c;

    }
    for(m=0; m<a; m++)
        printf("%d\n",brr[m]);

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
#define int long long

#define fr(s,n,i) for(int i=s;i<n;i++)
#define fr_(s,n,i) for(int i=s;i>=n;i--)
#define srt(v) sort(v.begin(), v.end())
#define size(v) (int)v.size()
#define erase(v, i) v.erase(v.begin() + i)
#define swap(v, i, j) int buf = v[j]; v[j] = v[i]; v[i] = buf;
#define shout(a) cout << a << endl;
#define vi vector<int>

int MOD = 1000000007;

void solve();

signed main() {
    solve();
    return 0;
}

void solve(){
    int N;
    cin >> N;
    vi mons(N);
    fr(0,N,i){
        int buf;
        cin >> buf;
        mons[i] = buf;
    }
    srt(mons);
    while(size(mons) > 1){
        mons[1] %= mons[0];
        if(mons[1] == 0){
            erase(mons,1);
        } else if(mons[1]<mons[0]){
            swap(mons, 0,1);
        }
    }
    shout(mons[0]);
}


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

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

string s;
ll ans = 0;
void dfs(int pos, int cnt, ll total, int prev) {
    if (pos == s.size()) {
        if (cnt == 0) {
            ll num = atol(s.substr(prev, pos - prev).c_str());
            total += num;
            ans += total;
        }
        return ;
    }
    
    if (cnt > 0) {
        ll num = atol(s.substr(prev, pos - prev).c_str());
        dfs(pos + 1, cnt - 1, total + num, pos);
    }
    dfs(pos + 1, cnt, total, prev);
}

int main() {
    cin >> s;
    //dfs(1, 1, 0, 0);
    for (int i = 0; i < s.size(); i++) {
        dfs(1, i, 0, 0);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ITP1_9
{
    class Program
    {
        static void Main()
        {
            var b = Console.ReadLine();
            var c = 0;
            for(;;)
            {
                var l = Console.ReadLine();
                if (l == "END_OF_TEXT") break;
                foreach(var w in l.ToLower().Split())
                    if (b == w) c++;
            }
            Console.Write("{0}\n", c);
        }
    }
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

// {{{ Modint
// using mint = modint<1000000007>;
// mint x = 2;
// std::cout << x.a << std::endl;
template <std::int64_t M>
class modint {
 public:
  int64_t a;

  explicit constexpr modint(const int64_t x = 0) noexcept :
    a((x % M + M) % M) {}
  constexpr int64_t &value() noexcept { return a; }
  constexpr const int64_t &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= M) {
      a -= M;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += M;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % M;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    int64_t exp = M - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  constexpr modint pow(ll t) const {
    if (!t) return modint(1);
    modint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
// }}}
using mint = modint<998244353>;
ll N, S;
mint dp[5000][5000];
ll a[5000];

signed main() {
  cin >> N >> S;
  for (ll i = 1; i <= N; i++)
    cin >> a[i];
  rep(i, 5000) rep(j, 5000) dp[i][j] = mint(0);
  dp[0][0] = mint(1);
  rep(i, N) {
    ll ni = i+1;
    // ni番目から開始する
    dp[ni][0] += mint(1);
    rep(j, 5000) {
      // ni番目を追加しない
      dp[ni][j] += dp[i][j]; 
      // ni番目を追加する
      if (j + a[ni] < 5000)
        dp[ni][j + a[ni]] += dp[i][j];
    }
  }
  mint ans(0);
  for (ll i = 1; i <= N; i++){
    ans += dp[i][S];
  }
  cout << ans.value() << endl;
  return 0;
}


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

string s;
map<char, vector<int> > mp;

int main() {
	// your code goes here
	int i, j, n, ans, k;
	cin>>s;
	n=s.length();
	if(n<2) {
		cout<<-1<<" "<<-1;
		return 0;
	}
	if(n==2) {
		if(s[0]==s[1])	cout<<1<<" "<<2;
		else	cout<<-1<<" "<<-1;
		return 0;
	}
	for(i=0; i<n-2; ++i) {
		if(s[i]==s[i+1] || s[i]==s[i+2] || s[i+1]==s[i+2]) {
			cout<<i+1<<" "<<i+3;
			return 0;
		}
	}
	cout<<-1<<" "<<-1;
	return 0;
}

Measured memory_bytes: 512