akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define Debug(x) cerr << #x << " = " << x << endl
#define Debug22(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl;
#define Debug2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define Debug3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<")\n";
#define Debug_arr(v,n) for(int i=0;i<n;++i) cerr<<#v<<"["<<i<<"]"<<" = "<<v[i]<<endl;
#define SET(p,v) fill((__typeof(**p)*)p,(__typeof(**p)*)p+sizeof(p),v);
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define prl cerr << "called: " << __LINE__ << endl
#define all(s) s.begin(),s.end()
//#define FILE_JUDGE
//#define TIMES
//#define LINES
//#define home
//#define multitests
//#define not_only_test
int n,cnt[100005];
int main()
{
	scanf("%d",&n);
	for (int i=0;i<n;++i)
	{
		int x;
		scanf("%d",&x);
		cnt[x]++;
		cnt[x-1]++;
		cnt[x+1]++;
	}
	int ans=0;
	for (int i=0;i<100005;++i)
	{
		ans=max(ans,cnt[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def resolve():
    N = int(input())
    a = list(map(int, input().split()))
    ans = 0
    for i in a:
        ans += prime_factorize(i).count(2)

    print(ans)

    return

resolve()

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

using namespace std;

using ll = long long;
using vi = vector<int>;

const ll linf = 1LL << 62;
const int inf = 999999;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll atcoder = int(1e9 + 7);

#define Endl endl
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define all(x) x.begin(),x.end()
#define atcoder(int)1e9+7
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)


ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int  main() {
	
	int  h, w;
	cin >> w >> h;
	char c[10][10];
	int cnt = 0;

	rep(i, h) rep(j,w) cin >> c[i][j];
	rep(i, h) rep(j, w) if (c[i][j] == '#')cnt++;

	if (h + w - 1 == cnt)pr("Possible");
	else pr("Impossible");

	return 0;

}

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

int main()
{
    map<string, int> hash;
    map<string, int>::iterator it;
    int n;
    string name;
    cin>>n;
    while(cin>>name>>n) {
        hash[name] += n;
    }
    for(unsigned int i=1; i<=5; i++) {
        for(it=hash.begin(); it!=hash.end(); it++) {
            if(it->first.size() != i) continue;
            cout<<it->first<<" "<<it->second<<endl;
        }
    }
}

Measured memory_bytes: 1224
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define LL long long

const LL maxn(1000005), mod(1e9 + 7);
LL Jc[maxn];


// const ll mod = 1e9+7;
void calJc()	//求maxn以内的数的阶乘
{
    Jc[0] = Jc[1] = 1;
    for(LL i = 2; i < maxn; i++)
        Jc[i] = Jc[i - 1] * i % mod;
}
/*
//拓展欧几里得算法求逆元
void exgcd(LL a, LL b, LL &x, LL &y)	//拓展欧几里得算法
{
    if(!b) x = 1, y = 0;
    else
    {
        exgcd(b, a % b, y, x);
        y -= x * (a / b);
    }
}

LL niYuan(LL a, LL b)	//求a对b取模的逆元
{
    LL x, y;
    exgcd(a, b, x, y);
    return (x + b) % b;
}
*/

//费马小定理求逆元
LL pow(LL a, LL n, LL p)	//快速幂 a^n % p
{
    LL ans = 1;
    while(n)
    {
        if(n & 1) ans = ans * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return ans;
}

LL niYuan(LL a, LL b)	//费马小定理求逆元
{
    return pow(a, b - 2, b);
}

LL C(LL a, LL b)	//计算C(a, b)
{
    if(a < b) return 0;
    return Jc[a] * niYuan(Jc[b], mod) % mod
        * niYuan(Jc[a - b], mod) % mod;
}

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

    ll x,y; cin >> x >> y;
    if (x < y) swap(x,y);
    
    ll c = 2*x - y;
    if (c % 3) {
        cout << 0 << endl;
        return 0;
    }
    c /= 3;
    if (x - 2*c < 0 || y - c < 0) {
        cout << 0 << endl;
        return 0;
    }

    ll d = x - 2*c;
    if (c > d) swap(c,d);

    ll s = c + d;
    ll ans = 1;
    calJc();

    // for (int i = 1; i <= c; i++) {
    //     ans = m( m(ans * (s - i + 1)) / i);
    //     cout << ans << endl;
    //     // if (ans > mod) ans-=mod;
    // }

    cout << C(s,c)%mod << endl;

    
}


Measured memory_bytes: 8064
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstdlib>

using namespace std;


long long int db[100005];
int vis[100005];

int main()
{
	int n,ans = 0;
	long long int maxn = 0;
	cin >> n;
	for(int i = 1 ;i <= n ; i++){
		cin >> db[i];
		if(db[i] > 100000){
			ans++;
			db[i] = 0;
			continue;
		}
		vis[db[i]]++;
		maxn = maxn > db[i] ? maxn:db[i];
	}
	for(int i = 1 ; i <= maxn ;i++){
		if(vis[i] > i){
		ans	+= vis[i] - i;
		}
		else if(vis[i] < i && vis[i] != 0){
			ans += vis[i];
		}
	}
	cout << ans <<endl;
}
	


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int a,b;
    string s;
    cin>>a>>b>>s;
    for(int i=0;i<s.length();i++){
        if(i==a){
            if(s[i]!='-'){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            if(s[i]=='-'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int N = 5100;

ll MOD;

int n;
int c[N];

ll dp[N][N];

void add(ll& a, ll b) {
	a += b;
	if (a >= MOD) {
		a -= MOD;
	}
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	cin >> n >> MOD;
	--n;
	int k = n / 2;
	int cc = 0;
	for (int i = 0; i < k; ++i) {
		c[cc++] = i;
		c[cc++] = i;
	}
	c[cc++] = k;
	if (n % 2 == 1) {
		c[cc++] = k;
	} 
	++n;

	for (int i = 1; i <= n; ++i) {
		dp[n - 1 - (i - 1)][i] = 1;
	}
	int mx = n - 1;

	for (int i = 0; i < cc; ++i) {
		while (mx >= 0 && mx * c[i] > n) {
			--mx;
		}

		for (int j = mx; j > 0; --j) {
			for (int k = j * c[i]; k <= n; ++k) {
				add(dp[j - 1][k - c[i]], dp[j][k]);
			}
		}
	}
	ll ans = 0;
	for (int i = 1; i <= n; ++i) {
		add(ans, dp[0][i]);
	}
	cout << ans << "\n";
	return 0;
}




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

class Program {
    static void Main(string[] args) {
        var head = Console.ReadLine().Split(' ');
        var n = int.Parse(head[0]);
        var dim = int.Parse(head[1]);
        var dataList = new List<int[]>();
        for (int i = 0; i < n; i++) {
            dataList.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToArray());
        }

        int answer = 0;
        for(int i= 0; i<n-1; i++) {
            for(int j =i+1; j<n; j++) {
                int[] x = dataList[i];
                int[] y = dataList[j];
                if(IsIntegerDistance(x, y)) {
                    answer++;
                }
            }
        }
        Console.WriteLine(answer);
    }

    static Boolean IsIntegerDistance(int[] x, int[] y) {
        double distance = 0;
        for(int i =0; i<x.Length; i++) {
            distance += (x[i] - y[i]) * (x[i] - y[i]);
        }
        distance = Math.Sqrt(distance);
        return distance == (int)distance;
    }
}


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


typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;


#define F first
#define S second
#define pb push_back
#define mp make_pair

// don't edit before this line 



const ll mod = (ll)1e9 + 7; 



ll n,w;
vpll arr;
ll memo[101][100001];

ll func(int x,int ww){
	if(w==0)
		return 0;
	if(x==n-1)
	{
		if(arr[x].F<=ww)
			return arr[x].S;
		else
			return 0;
	}
	if(memo[x][ww]!=-1)
		return memo[x][ww];
	if(arr[x].F<=ww)
		return memo[x][ww]=max(arr[x].S + func(x+1,ww-arr[x].F),func(x+1,ww));
	else
		return memo[x][ww]=func(x+1,ww);
	
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//cout.setf(ios::fixed), cout.precision(20);

	cin >> n >> w;
	arr.resize(n);

	for(int i=0;i<n;i++)
	{
		cin >> arr[i].F >> arr[i].S;
	}

	for(int i=0;i<101;i++)
		for(int j=0;j<100001;j++){
			memo[i][j]=-1;
		}
	cout<<func(0,w)<<"\n";
	
	return 0;
}


Measured memory_bytes: 79232
def main():
    N = int(input())
    A = [0]
    for _ in range(N):
        A.append(int(input()))
    i = 1
    for j in range(N):
        i = A[i]
        if i == 2:
            return j + 1
    return -1

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 7080
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, k;
    cin >> n >> k;
    map<int, int> cnt;
    fore(i,1,n+1) {
        int m = i%k;
        if (m == (-m+k)%k) {
            cnt[m]++;
        }
    }
    ll ans = 0;
    for (auto &x : cnt) {
        ans += 1ll*x.S*x.S*x.S;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
 
    int i;
    for(i=1;i<=n;i++){
        int x=i;
 
        if(x%3==0){
            printf(" %d",i);
        }else{
            while(x){
                if(x%10==3){
                    printf(" %d",i);
                    break;
                }else{
                    x/=10;
                }
            }
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace AtCoderCS
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string moji = Console.ReadLine();
                if (moji == null || moji.Length < 1) break;
                int[] cards = moji.Split(',').Select(x => int.Parse(x)).ToArray();
                if (cards != null && cards.Length == 5)
                {
                    int[] index = new int[13];
                    foreach (int num in cards)
                    {
                        index[num - 1]++;
                    }
                    int renzoku = 0;
                    bool zenkaiflg = false;
                    int pair2 = 0;
                    int pair3 = 0;
                    string ans = null;
                    foreach (int a in index)
                    {
                        if (a == 2)
                        {
                            pair2++;
                        }
                        else if (a == 3)
                        {
                            pair3++;
                        }
                        else if (a == 4)
                        {
                            ans = "four card";
                        }
                        else if (a == 1)
                        {
                            if (zenkaiflg) renzoku++;
                            else renzoku = 1;
                            zenkaiflg = true;
                        }
                        else
                        {
                            zenkaiflg = false;
                        }
                    }
                    if (ans == null)
                    {
                        if (pair2 == 1 && pair3 == 1)
                        {
                            ans = "full house";
                        }
                        else if (pair2 == 2)
                        {
                            ans = "two pair";
                        }
                        else if (pair3 == 1)
                        {
                            ans = "three card";
                        }
                        else if (pair2 == 1)
                        {
                            ans = "one pair";
                        }
                        else if (renzoku == 5)
                        {
                            ans = "straight";
                        }
                        else
                        {
                            if (index[0] == 1 && index[9] == 1 && index[10] == 1 && index[11] == 1 && index[12] == 1)
                            {
                                ans = "straight";
                            }
                            else
                            {
                                ans = "null";
                            }
                        }
                    }
                    Console.Out.WriteLine(ans);
                }
                else break;
            }

        }
    }
}

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

void solve()
{
    int h, w; cin >> h >> w;
    int ans[2];
    rep(i, h)rep(j, w)
    {
        string tmp;
        cin >> tmp;
        if(tmp == "snuke")
        {
            ans[0] = i;
            ans[1] = j;
        }
    }
    cout << char('A'+ ans[1]) << ans[0]+1 << endl;
    return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL              long long
#define ll              long long
#define SL(n)           scanf("%lld",&n)
#define LF              double
#define SF(n)           scanf("%lf",&n)

#define pb              push_back
#define ff              first
#define ss              second
#define mp              make_pair

#define ON(n,i)         (n|(1LL<<i))
#define OFF(n,i)        (n&(~(1LL<<i)))
#define CHK(n,i)        (n&(1LL<<i))

#define SET(arr)        memset( arr , -1 , sizeof arr)
#define RESET(arr)      memset( arr,0,sizeof arr)

#define srt(v)          sort(v.begin(),v.end())
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define found( s,d )    (s.find(d) != s.end())

#define FOR(i,s,e)      for( LL i = s ; i<=e ; i++ )

#define FILEIN          freopen("in.txt","r",stdin)
#define FILEOUT         freopen("out.txt","w",stdout)

/// DEBUG
#define deb             printf("OKA\n")
/// DEBUG ENDSk

using namespace std;



int main(){

    LL N,K;
    SL(N); SL(K);
    cout<<min( N%K , abs(N%K - K)) <<endl;

   
return 0;}

Measured memory_bytes: 256
N = int(input())
S = []

import collections

for n in range(N):
  S.append(input())

C = collections.Counter(S)
C = C.most_common()

c_max = C[0][1]
ans = []
for i, c in enumerate(C):
  if c[1] == c_max:
    ans.append(c[0])
  else:
    break

ans = sorted(ans)
for a in ans:
  print(a)

Measured memory_bytes: 45052
#include <iostream>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int t=m;
    int now=1;
    int k=m/n;
    if(n==1)
        now=m;
    else
    for(int i=k;i>=2;i--)
        if(m%i==0&&t/(now*i)>=n)
            m=m/i,now*=i,i++;
    cout<<now<<'\n';
    return 0;
}


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

ll bigmod(int a,int n,int mod)
{
    ll res=1;
    ll x=a;
    while(n>0)
    {
        if(n%2==1)res=(res*x)%mod;
        x=(x*x)%mod;
        n/=2;
    }
    return res;
}
int ara[100005];
int main()
{
    int mod=1e9+7;
    int n;cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;cin>>a;
        ara[a]++;
    }
    bool f=true;
    if(n%2==0)
    {
        for(int i=1;i<n;i+=2)
        {
            if(ara[i]!=2){
                f=false;
                break;
            }
        }
    }
    else
    {
        ara[0]++;
        for(int i=0;i<n;i+=2)
        {
            if(ara[i]!=2)
            {
                f=false;
                break;
            }
        }
    }
    if(f==false)cout<<0<<endl;
    else cout<<bigmod(2,n/2,mod)<<endl;
}


Measured memory_bytes: 640
N = int(input())

ans = [0] * (N+1)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n < (N+1):
                ans[n] += 1

for i in range(1, N+1):
    print(ans[i])


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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N;
    cin >> N;
    vector<unsigned long> a(N + 1);
    for(unsigned long i = 1, A; i <= N; ++i){
        cin >> A;
        a[i] = a[i - 1] ^ A;
    }
    auto A = a.back();
    if(A){
        unsigned long z = 1, b = 0;
        for(const auto i : a){
            if(i == A)(b += z) %= MOD;
            if(i == 0)(z += b) %= MOD;
        }
        cout << z << endl;
    }else{
        vector<pair<pair<unsigned long, unsigned long>, unsigned long>> tapi(1048576, {{1, 0}, 0});
        vector<unsigned long> zeros(N + 2);
        zeros[0] = 0;
        unsigned long ans{0};
        for(unsigned long i = 0; i <= N; ++i){
            zeros[i + 1] = zeros[i] + !a[i];
            if(a[i]){
                auto k = zeros[i + 1] - zeros[tapi[a[i]].second];
                (tapi[a[i]].first.first += tapi[a[i]].first.second * k) %= MOD;
                (tapi[a[i]].first.second += tapi[a[i]].first.first) %= MOD;
                tapi[a[i]].second = i + 1;
                ans += tapi[a[i]].first.first;
            }
        }

        {
            auto t = count(a.begin() + 1, a.end() - 1, 0);
            unsigned long tapitapi = 1, pitapita = 2;
            while(t){
                if(t & 1)(tapitapi *= pitapita) %= MOD;
                (pitapita *= pitapita) %= MOD;
                t >>= 1;
            }
            ans += tapitapi;
        }

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

Measured memory_bytes: 32640
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};


map<ll,ll>MAP;

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    
    ll n,x;
    sfl(n);
    FOR(i,n){
        sfl(x);
        MAP[x]++;
    }
    ll ans = 0;
    for(auto it:MAP){
        if(it.f1==it.f2) continue;
        else{
            if(it.f1>it.f2){
                ans += it.f2;
            }
            else{
                ans += it.f2-it.f1;
            }
        }
    }
    pfl(ans);
    return 0;
}

Measured memory_bytes: 9784
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

LL div_cnt(LL a, LL b, LL d){
    LL x = a / d;
    LL y = b / d;
    LL z = y - x;
    if(a % d == 0){
        z++;
    }
    return z;
}

LL gcd(LL a, LL b){
    if(a > b) swap(a, b);
    LL t;
    while(a != 0){
        t = b % a;
        b = a;
        a = t;
    }
    return b;
}

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

int main(){
    LL a, b, c, d;
    cin >> a >> b >> c >> d;
    LL codo = div_cnt(a, b, lcm(c, d));
    LL cok = div_cnt(a, b, c);
    LL dok = div_cnt(a, b, d);
    cout << b - a + 1 - (cok + dok - codo) << endl;

}

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

int main()
{
	int Count = 0;
	int n;
	cin >> n;
	vector<int> S;
	for(int i = 0; i < n; i++){
		int s;
		cin >> s;
		S.push_back(s);
	}
	int q;
	cin >> q;
	for(int i = 0; i < q; i++){
		int t;
		cin >> t;
		vector<int>::iterator it = find(S.begin(), S.end(), t);
		if(it != S.end()){
			Count++;
		}
	}
	cout << Count << endl;
	return 0;
}

Measured memory_bytes: 1320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;cin>>s;
    int ans;
    if(s=="SUN")ans=7;
    if(s=="MON")ans=6;
    if(s=="TUE")ans=5;
    if(s=="WED")ans=4;
    if(s=="THU")ans=3;
    if(s=="FRI")ans=2;
    if(s=="SAT")ans=1;
    cout<<ans<<endl;
    return 0;
}

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

bool is_prime(int n){
    int k = (int)pow(n, 0.5) + 2;
    for (int i = 2; i < k; i++){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}


int main(){
    int N;
    cin >> N;
    vector<int> primes = vector<int>();
    for (int i = 6; i <= 55555; i+=5){
        if(is_prime(i)){
            cout << i;
            N -= 1;
            if (N > 0){
                cout << " ";
            }else{
                break;
            }
        }
    }
    return 0;
}

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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ABallDistribution {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N, K;
        cin >> N >> K;
        if (K == 1) {
            cout << 0 << endl;
            return;
        }
        cout << (N - (K - 1)) - 1 << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ABallDistribution solver;
    solver.solve(in, out);
    return 0;
}


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

using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<int>> hoge(h,vector<int>(w));
    vector<bool> tate(w,false);
    vector<bool> yoko(h,false);
    vector<string> maps(h);
    
    for(int i=0;i<h;i++){
        string tmp;
        cin>>tmp;
        for(int k=0;k<w;k++){
            if(tmp.at(k)=='#'){
                tate.at(k)=true;
                yoko.at(i)=true;
            }
        }
        maps.at(i)=tmp;
    }
    
    for(int i=0;i<h;i++){
        bool ok=false;
        for(int k=0;k<w;k++){
            if(tate.at(k)==true && yoko.at(i)==true) {cout<<maps.at(i).at(k);ok=true;}
        }
        if(ok) cout<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> pint;
typedef map <int,int> mapii;
typedef map <char,int> mapci;
typedef map <string,int> mapsi;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <char> vc;
typedef set <int> si;
typedef set <ll> sll;
typedef set <char> sc;
#define pb(i) push_back(i) ;
#define ms(arr) memset(arr,0,sizeof(arr))
#define deb(x) cout<< #x <<" "<< x<<endl;
#define loop(i,n) for(int i=0;i<n;i++)
#define Loop(i,k,n) for(int i=k;i<=n;i++)
#define testcase int t;cin>>t; while(t--)

int main() {
    int n;
    cin >> n;
    int arr[n], arr1[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        arr1[i] = arr[i];
    }
    sort(arr1, arr1 + n);
    int ctr = 0;
    for (int j = 0; j < n; j++) {
        if (arr[j] != arr1[j])
            ctr++;
    }
    ctr = ctr - 1;
    if (ctr <= 1)
        cout << "YES";
    else
        cout << "NO";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#include <tuple>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<tuple<string,double,int>> s(n);
	rep(i,0,n){
		double tmp;
		cin >> get<0>(s[i]) >> tmp;
		get<1>(s[i]) = (double)(1/tmp);
		get<2>(s[i]) = i+1;
	}
	sort(all(s));

	rep(i,0,n){
		cout << get<2>(s[i]) << endl;
	}



}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
int main() {
  RL(A);
  std::vector<i8t> hist(26, 0);
  for(auto c:A){
    auto k = c - 'a';
    hist[k]++;
  }
  i8t ans=1;
  for(int i=0;i<A.size();i++){
    auto k = A[i]-'a';
    hist[k]--;
    auto nj = A.size()-1-i-hist[k];
    ans+=nj;
  }
  P(ans);
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>

int const MAXN = 500000;
int const MAXNN = 1<<19;
int N, Q;
std::string S;

struct seg_tree {
  char dat_[MAXNN*2-1];
  int NN_;
  void init() {
    for(NN_ = 2; NN_ < N; NN_<<=1);
    std::fill_n(dat_, NN_*2-1, 0);
  }
  void update(int k, int v) {
    k += NN_-1;
    dat_[k] = v;
    while(k > 0) {
      k = (k-1)/2;
      dat_[k] = std::max(dat_[k*2+1], dat_[k*2+2]);
    }
  }
  int query_in(int a, int b, int k, int l, int r) const {
    if(b <= l || r <= a) return 0;
    if(a <= l && r <= b) return dat_[k];
    int m = (l+r)/2;
    int vl = query_in(a, b, k*2+1, l, m);
    int vr = query_in(a, b, k*2+2, m, r);
    return std::max(vl, vr);
  }
  int query(int a, int b) const { return query_in(a, b, 0, 0, NN_); }
};

seg_tree s[26];

int main() {
  std::cin >> N >> S >> Q;
  for(int i = 0; i < 26; ++i) s[i].init();
  for(int i = 0; i < N; ++i) s[S[i]-'a'].update(i, 1);
  for(int i = 0; i < Q; ++i) {
    int t; std::cin >> t;
    if(t == 1) {
      int k; char c; std::cin >> k >> c; --k;
      for(int i = 0; i < 26; ++i) s[i].update(k, (c-'a'==i)? 1: 0);
    } else {
      int l, r; std::cin >> l >> r; --l; --r;
      int count = 0;
      for(int i = 0; i < 26; ++i) count += s[i].query(l, r+1);
      std::cout << count << std::endl;
    }
  }
  return 0;
}


Measured memory_bytes: 27524
rc = [int(i) for i in input().split()]
data = []
 
for i in range(rc[0]):
    sum_c = [int(i) for i in input().split()]
    sum_c.append(sum(sum_c))
    data += [sum_c]
    print(" ".join(map(str,sum_c)))
 
hoge = [[row[i] for row in data] for i in range(rc[1])]
 
sum_r = [sum(hoge[i]) for i in range(rc[1])]
sum_r.append(sum(sum_r))
print(" ".join(map(str,sum_r)))

Measured memory_bytes: 7852
import sys
input = sys.stdin.buffer.readline

def main():
	
	class BinaryIndexedTree:
		
		# 初期化
		def __init__(self, size, default):
			self.size = size
			self.default = default
			self.BIT = [default]*(self.size+1)

		# function(max, min, plus, minus, etc...)
		def BIT_segfunc(self, x, y):
			return max(x, y)

		def BIT_query(self, idx):
			ret = self.default
			while idx > 0:
				ret = self.BIT_segfunc(ret, self.BIT[idx])
				idx -= idx&(-idx)
			return ret

		# update
		def BIT_update(self, idx, x):
			while idx <= self.size:
				self.BIT[idx] = self.BIT_segfunc(self.BIT[idx], x)
				idx += idx&(-idx)
			return

		def BIT_range(self, x, y):
			return self.BIT_query(y)-self.BIT_query(x)

		# seg確認用
		def BIT_print(self):
			print(self.BIT)
		
	N = int(input())
	a = list(map(int,input().split()))
	l = [0]*N;r = [0]*N
	left_bit = BinaryIndexedTree(N, 0)
	for i, num in enumerate(a):
	    l[num-1] = i + 1 - left_bit.BIT_query(num)
	    left_bit.BIT_update(num, i+1)
	right_bit = BinaryIndexedTree(N, 0)
	for i, num in enumerate(a[::-1]):
	    r[num-1] = i + 1 - right_bit.BIT_query(num)
	    right_bit.BIT_update(num, i+1)
	
	print(sum(l[i]*r[i]*(i+1) for i in range(N)))

if __name__ == "__main__":
	main()


Measured memory_bytes: 69488
#include <iostream>
#include <string.h>
#include <string>
using namespace std;

int main() {
	
	string table = "abcdefghijklmnopqrstuvwxyz.?! ",s,t;
	int i,l;
	
	while(cin>>s){
		l=s.length();
		t="";
		
		if(l%2)
			cout<<"NA";
		else{
			for(i=0;i<l;i+=2){
				if(s[i]<=54 && s[i]>=49 && s[i+1]<=53 && s[i+1]>=49)
					t += table[(s[i]-49)*5+s[i+1]-49];
				else{
					t="NA";break;
				}
			}
			cout<<t;
		}
			
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 1005
#define INF 1001001001

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int h, w;
vector<string> s;
int d[MAX][MAX];
int di[]={0, -1, 0, 1}, dj[]={-1, 0, 1, 0};
queue<P> que;

int bfs(int i, int j, int gi, int gj){
  queue<P> que;
  rep(i, h)rep(j, w){
    d[i][j]=INF;
  }
  que.push(P(i, j));
  d[i][j]=0;

  while(que.size()){
    P p=que.front(); que.pop();
    if(p.first==gi && p.second==gj)break;
    rep(k, 4){
      int ni=p.first+di[k], nj=p.second+dj[k];
      if(ni>=0 && ni<h && nj>=0 && nj<w && s[ni][nj]!='#' && d[ni][nj]==INF){
        d[ni][nj]=d[p.first][p.second]+1;
        que.push(P(ni,nj));
      }
    }
  }
  return d[gi][gj];
}


int main(){
  cin >> h >> w;
  s.resize(h);
  rep(i, h)rep(j, w){
    d[i][j]=INF;
  }
  rep(i, h){
    cin >> s[i];
    rep(j, w){
      if(s[i][j]=='#'){
        que.push(P(i, j));
        d[i][j]=0;
      }
    }
  }
  while(que.size()){
    P p=que.front(); que.pop();
    rep(k, 4){
      int ni=p.first+di[k], nj=p.second+dj[k];
      if(ni>=0 && ni<h && nj>=0 && nj<w && d[ni][nj]==INF){
        d[ni][nj]=d[p.first][p.second]+1;
        que.push(P(ni,nj));
      }
    }
  }
  int ans=0;
  rep(i, h)rep(j, w){
    ans=max(ans, d[i][j]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13456
a=int(input())
if a<105:
  print(0)
if 105<=a<135:
  print(1)
if 135<=a<165:
  print(2)
if 165<=a<189:
  print(3)
if 189<=a<195:
  print(4)
if 195<=a:
  print(5)

Measured memory_bytes: 8924
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    vector<int> A(3);
    for(int i=0; i < 3; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    int ans = 0;
    for(int i=0; i < 2; i++) {
        ans += abs(A[i] - A[i+1]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <climits>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#define ll long long
#define REP(a,b) for(int a=0; a<b; a++)
using namespace std;

int H, W;
int grid[1005][1005];
queue<pair<int, int>> q;
int mx[4] = {-1, 0, 1, 0};
int my[4] = {0, -1, 0, 1};

bool inside(int r, int c){
return r >= 0 && r < H && c >= 0 && c < W;
}

int main() {
  ios_base::sync_with_stdio(false);
  memset(grid, -1, sizeof(grid));
  cin >> H >> W;
  REP(i, H){
    string temp;
    cin >> temp;
    REP(j, W){
      if(temp[j] == '#'){
        grid[i][j] = 0;
        q.emplace(i, j);
      }
    }
  }
  while(!q.empty()){
    pair<int, int> coord = q.front();
    q.pop();
    REP(i, 4){
      int xx = coord.first+mx[i];
      int yy = coord.second+my[i];
      if(inside(xx, yy))if(grid[xx][yy] == -1){
        grid[xx][yy] = grid[coord.first][coord.second]+1;
        q.emplace(xx, yy);
      }
    }
  }
  int mxm = 0;
  REP(i, H){
    REP(j, W){
      if(grid[i][j] > mxm) mxm = grid[i][j];
    }
  }
  cout << mxm << endl;
}

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

using namespace std;

#define N 100

int a[N + 1];

int main(){
	int sum, n, i, j;

	scanf("%d", &n);
	sum = 0;

	for (i = 0; i < n; i++){
		scanf("%d", a + i);
		sum += a[i];
	}

	for (j = 0, i = 1; i < n; i++){
		if (abs(n * a[i] - sum) < abs(n * a[j] - sum)){
			j = i;
		}
	}

	printf("%d\n", j);

	return 0;
}

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();
		for(int i=1;i<n+1;i++){
			int x=i;
			if(x%3==0){
				System.out.print(" "+i);
			}else{
				while(x!=0){
					if(x%10==3){
						System.out.print(" "+i);
						break;
					}
				x/=10;
				}
			}
		}
		System.out.println("");
	}	
}

Measured memory_bytes: 28816
#include<bits/stdc++.h>
using namespace std;
char a[50][50];
int c,d,b[55][55];
int main(){
    cin>>c>>d;
    for(int i=0;i<c;i++)
    cin>>a[i];
    for(int i=0;i<c;i++)
    for(int j=0;j<d;j++)
    if(a[i][j]=='#')
    b[i][j]++,b[i][j+1]++,b[i][j+2]++,
    b[i+1][j]++,b[i+1][j+1]++,b[i+1][j+2]++,
    b[i+2][j]++,b[i+2][j+1]++,b[i+2][j+2]++;
    for(int i=0;i<c;i++){
        for(int j=0;j<d;j++)
        if(a[i][j]=='#') cout<<'#';
        else cout<<b[i+1][j+1];
        cout<<endl;
    }

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main() {
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    rep(i, c) rep(j, c) cin >> d[i][j];
    vector<vector<int>> modcnt(3, vector<int>(c, 0));
    rep(i, n) rep(j, n) {
        int tmp_c;
        cin >> tmp_c;
        --tmp_c;
        modcnt[(i+j+2)%3][tmp_c]++;
    }
    vector<vector<int>> ans(3, vector<int>(c, 0));
    rep(i, 3) rep(j, c) rep(k, c) {
        ans[i][j] += modcnt[i][k] * d[k][j];
    }
    int ans_min = 1e9;
    rep(i, c) rep(j, c) rep(k, c) {
        if ( i == j || j == k || k == i ) continue;
        ans_min = min(ans_min, ans[0][i] + ans[1][j] + ans[2][k] );
    }
    cout << ans_min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <cmath>
#include <climits>
using namespace std;

#define rep(i,beg,end)   for (int i=(beg);i<(end);i++)
#define rrep(i,beg,end)   for (int i=(beg);i>=(end);i--)
#define all(cont)           begin(cont), end(cont)
#define INFMAX                   LLONG_MAX
#define INFMIN                   LLONG_MIN
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef list<ll> li;
typedef pair<ll, ll> pii;
typedef pair<ll, string> pis;
typedef pair<string, ll> psi;

string gets(bool skipnewline);
vi get_n_array(int n);


ll right(ll d[], int n, int k, ll v)
{
    if (k < 0) return 0;
    else if (k == 0 || n == 0) return v;

    ll m = v;
    ll t = d[n - 1];
    m = max(right(d, n - 1, k - 1, v + t), m);
    if (t < 0) m = max(right(d, n - 1, k - 2, v), m);
    return m;
}

ll left(ll d[], int n, int k, ll v)
{
    if (k < 0) return 0;
    else if (k == 0 || n == 0) return v;

    ll m = v;
    ll t = d[0];
    m = max(left(d+1, n - 1, k - 1, v + t), m);
    if (t < 0) m = max(left(d+1, n - 1, k - 2, v), m);
    return max(right(d, n, k, v), m);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char s[4];
    rep(i, 0, 4) { cin >> s[i]; }
    sort(s, s + 4);
    if (s[0] == s[1] && s[2] == s[3] && s[0]!=s[2]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

string gets(bool skipToNextline)
{
    if (skipToNextline) gets(false);
    const int BUFF_MAX = 1024;
    char buf[BUFF_MAX];
    cin.getline(buf, sizeof(buf));
    return buf;
}

vi get_n_array(int n)
{
    vi v;
    while (n-- > 0) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    return v;
}

Measured memory_bytes: 764
program test
implicit none
integer :: n,x(200000),y(200000),a(2),i,j,k,l,t

read(*,*) n
read(*,*) (x(i),i=1,n)

y = x

l = n/2+1
k = n
do while(k /= 1)
  if(l > 1) then
    l = l-1
    t = y(l)
  else
    t = y(k)
    y(k) = y(1)
    k = k-1
    if(k == 1) then
      y(1) = t
      exit
    endif
  endif
  i = l
  j = l+l
  do while(j <= k)
    if(j < k) then
      if(y(j) < y(j+1)) j = j+1
    endif
    if (t < y(j)) then
      y(i) = y(j)
      i = j
      j = j+j
    else
      j = k+1
    endif
  enddo
  y(i) = t
enddo

a(1) = y(n/2+1)
a(2) = y(n/2)

do i= 1, n
if (x(i) >= a(1)) then
  write(*,*) a(2)
  else
  write(*,*) a(1)
endif
enddo

end program

Measured memory_bytes: 4864
import math
W, H, x, y, r = map(int, input().split())

nag = math.sqrt(x**2 + y**2)

if x-r < 0 or x+r > W:
    print("No")
elif y - r < 0 or y+r > H:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 5664
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  while(true){
	int x, y, s; cin >> x >> y >> s;
	if(x == 0) break;
	int ans = 0;
	for(int a=1;a<s;++a)
	  for(int b=1;b<s;++b)
		if(a*(100+x)/100 + b*(100+x)/100 == s)
		  ans = max(ans, a*(100+y)/100 + b*(100+y)/100);
	cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[25],b[25],c[25];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<n;i++) cin>>c[i];
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=b[a[i]];
        if(i>=2&&a[i-1]+1==a[i]) ans+=c[a[i-1]];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n, x = map(int,input().split())
tmp = list(map(int,input().split()))
tmp.append(x)
se = list(sorted(set(tmp)))
lis = []
for si,s in enumerate(se):
    lis.append(se[si]-se[si-1])

import fractions
a = lis
ans = a[0]
for i in range(1, len(a)):
    ans = fractions.gcd(ans, a[i])
print(ans)

Measured memory_bytes: 14508
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x;
	cin >> x;
	long long A[6209];
	for (int i = 0; i < 6209; i++)
	{
		A[i] = pow(i, 5);
	}
	for (int i = 0; i < 6209; i++)
	{
		for (int j = 0; j < 6209; j++)
		{
			if (A[i] + A[j] == (long long)x)
			{
				cout << i << " -" << j << endl;
				return 0;
			}
			else if (A[i] - A[j] == (long long)x)
			{
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4268
#include <iostream>
using namespace std;
int main(){
    string s, t;
    cin >> s >> t;
    int l;
    l = s.length();
    for(int i=0;i<l;i++){
        if(s[i] != t[i]){
            cout << "No";
            break;
        }else if(i == l-1){
            cout << "Yes";
        }
    }

    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int n,mx;
int a[100010];
map<int,int> tong;
 int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	for (int i=1;i<=n;++i)
		++tong[a[i]],++tong[a[i]+1],++tong[a[i]-1];
	mx=0;
	for (int i=0;i<=100000;++i) 
	{
		if (tong[i]>mx) mx=tong[i];
	}
	printf("%d\n",mx);
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

int N;
lint x;
vector<lint> a;

int main()
{
    cin >> N >> x;
    a.push_back(0LL);
    for (int i = 0; i<N; i++)
    {
        lint tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    lint ans = 0;
    for (int i=1; i<=N; i++)
    {
        lint y = a[i] + a[i-1] - x;
        if (y > 0)
        {
            ans += y;
            a[i] -= y;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
using System;

namespace ITP1_1_A
{
    class Program
    {   
        static void Main(string[] args)
        {
            while (true)
            {
                char[] num = Console.ReadLine().ToCharArray();
                if (num[0] == '0') break;
                int sum = 0;

                for (int i = 0; i < num.Length; i++)
                {
                    sum += int.Parse(num[i].ToString());
                }

                Console.WriteLine(sum);
            }
        }
    }
}



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

int V, E;
std::vector< int > graph[112345];

const int INF = (1 << 30);

int dfnum[112345];

const uint32_t FLAG_ROOT = 0x00000001;

std::vector<int> res;

template<uint32_t flags = 0>
int dfs(int prev, int id, int depth) {
  dfnum[id] = depth;
  int lowest = dfnum[id];
  int n = graph[id].size();
  bool isArticulationPoint = false;
  int children_count = 0;
  for(int i = 0; i < n; ++i) {
    int next = graph[id][i];
    if( next == prev ) continue;
    if( dfnum[next] != INF ) {
      lowest = std::min(lowest, dfnum[next]);
      continue;
    }
    int lowest_child = dfs<>(id, next, depth + 1);
    lowest = std::min(lowest, lowest_child);
    if( not (flags & FLAG_ROOT) and dfnum[id] <= lowest_child ) {
      isArticulationPoint = true;
    }
    children_count += 1;
  }
  if( (flags & FLAG_ROOT ) and children_count >= 2 ) {
    isArticulationPoint = true;
  }
  if( isArticulationPoint ) {
    res.push_back(id);
  }
  return lowest;  
}

int main() {
  for(int& I : dfnum) I = INF;
  scanf("%d %d", &V, &E);
  for(int i = 0; i < E; ++i) {
    int s, t;
    scanf("%d %d", &s, &t);
    graph[s].push_back(t);
    graph[t].push_back(s);
  }

  dfs<FLAG_ROOT>(-1, 0, 1);

  std::sort(res.begin(), res.end());
  for(int I : res) {
    printf("%d\n", I);
  }
  
  return 0;
}

Measured memory_bytes: 7768