akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class AtCoderCS {
    static void Main(string[] args) {
        int X, Y, A, B, C;
        int[] p, q, r;
        ReadInt32(out X, out Y, out A, out B, out C);
        ReadInt32(out p);
        ReadInt32(out q);
        ReadInt32(out r);

        List<int> all = new List<int>();
        all.AddRange(p.OrderByDescending(i => i).Take(X));
        all.AddRange(q.OrderByDescending(i => i).Take(Y));
        all.AddRange(r);

        Console.WriteLine(all.OrderByDescending(i => i).Take(X + Y).Sum(i => (long)i));
    }

    static void ReadInt32(out int arg1, out int arg2, out int arg3, out int arg4, out int arg5) {
        IEnumerator<int> e = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).GetEnumerator();
        e.MoveNext();
        arg1 = e.Current;
        e.MoveNext();
        arg2 = e.Current;
        e.MoveNext();
        arg3 = e.Current;
        e.MoveNext();
        arg4 = e.Current;
        e.MoveNext();
        arg5 = e.Current;
    }
    static void ReadInt32(out int[] arg1) {
        arg1 = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
    }
}

Measured memory_bytes: 38900
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define ME0(x) memset(x,0,sizeof(x))
using namespace std;
bool isprime(int x)
{
    if(x==2)
        return true;
    if(x<2||x%2==0)
        return false;
    int i=3;
    while(i<=sqrt(x))
    {
        if(x%i==0)
            return false;
        i+=2;
    }
    return true;
}
int n;
int main()
{
    int total=0;
    int m;
    cin>>n;
    while(n--)
    {
        cin>>m;
        if(isprime(m))
          total++;
    }
    cout<<total<<endl;
}



Measured memory_bytes: 3104
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cctype>
#define REP(i,a,b) for(register int i=(a); i<(b); i++)
#define REPE(i,a,b) for(register int i=(a); i<=(b); i++)
using namespace std;
typedef long long ll;
char buf[1<<21], *p1=buf, *p2=buf;
//#define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <class T> inline void read(T&x) {
	x=0; char ch; do ch=getchar(); while(ch<=' ');
	while(ch>' ') {x=x*10+ch-'0'; ch=getchar();}
}
#define MAXN 17
char s[MAXN], t[MAXN], u[MAXN]; 
int a,b;
int main() {
	scanf("%s%s", s, t);
	scanf("%d%d", &a, &b);
	scanf("%s", u);
	if(strcmp(u,s)==0) a--;
	else b--;
	printf("%d %d\n", a, b);
}



Measured memory_bytes: 128
// 自分より小さい分をすべて喰って2倍しても自分よりひとつ大きいのに届かなければ終了
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		var V int
		fmt.Scan(&V)
		A[i] = V
	}
	B := make([]int, N)

	sort.Ints(A)
	B[0] = A[0]
	for i := 1; i < N; i++ {
		B[i] = A[i] + B[i-1]
	}
	ans := 1
	for i := N - 2; i >= 0; i-- {
		if B[i]*2 >= A[i+1] {
			ans++
		} else {
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <cstdio>
#pragma GCC diagnostic error "-std=c++14"             //±©Á¦¿ªC++14
#pragma GCC optimize ("O3")  
int mx,mn=1<<30,a,n;
int main(void){
    scanf ("%d",&n);
    while (n--){
        scanf ("%d",&a);
        if (a>mx)mx=a;
        if (a<mn)mn=a;
    }
    printf ("%d\n",mx-mn);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, a[123456];
void ans(int k) {
	cout << k * 2;
	for (int i = 0; i < n - 1; i++) {
		k = a[i] - k;
		cout << ' ' << k * 2;
	}
	cout << endl;
}
signed main() {
	cin >> n; for (int i = 0; i < n; i++)cin >> a[i];
	int cnt = 0;
	for (int i = 0; i < n - 2; i += 2)cnt += a[i + 1] - a[i];
	ans((a[n - 1] - cnt) / 2);
	cin >> n;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll e=c/__gcd(c,d)*d;
  ll xa=(a-1)/c,xb=b/c,ya=(a-1)/d,yb=b/d,za=(a-1)/e,zb=b/e;
  xb-=xa;
  yb-=ya;
  zb-=za;
  pr(b-a+1-(xb+yb-zb));
}

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


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

int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    int n,x,s=0;
    cin>>n;

    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
            s=s+a[i]*a[j];
    }
    cout<<s<<"\n";

}


Measured memory_bytes: 256
process.stdin.setEncoding('utf-8');
process.stdin.on('data', input => {
  var whrxy = input.split(' ').map(Number);
  const w = parseInt(whrxy[0]);
  const h = parseInt(whrxy[1]);
  const x = parseInt(whrxy[2]);
  const y = parseInt(whrxy[3]);
  const r = parseInt(whrxy[4]);

  if (w < x+r || h < y+r || x < 0 || y < 0) {
    console.log('No');
  } else {
    console.log('Yes');
  }
})



Measured memory_bytes: 17304
import sys
import math

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    if n%2:
        print(0)
        exit()
    ans=0
    d=10
    for _ in range(26):
        ans+=n//d
        d*=5
    print(ans)

main()

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

int main(){
	int n, m;
	cin >> n >> m;
	dsu d(n);
	rep(i, m){
		int a,b;
		cin >> a >> b;
		d.merge(a-1,b-1);
	}
	vector<vector<int>> g = d.groups();
	int ans = g.size() - 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9000
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigDecimal a = sc.nextBigDecimal();
        BigDecimal b = sc.nextBigDecimal();
        BigDecimal c = sc.nextBigDecimal();
        BigDecimal aa = sqrt(a, 50);
        BigDecimal bb = sqrt(b, 50);
        BigDecimal cc = sqrt(c, 50);
        if (aa.add(bb).compareTo(cc) == -1){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    public static BigDecimal sqrt(BigDecimal a, int scale){
        BigDecimal x = new BigDecimal(
                Math.sqrt(a.doubleValue()), MathContext.DECIMAL64);
        if(scale < 17) return x;
        BigDecimal b2 = new BigDecimal(2);
        for (int tempScale = 16; tempScale < scale; tempScale *= 2){
            x = x.subtract(
                    x.multiply(x).subtract(a).divide(
                            x.multiply(b2), scale, BigDecimal.ROUND_HALF_EVEN));
        }
        return x;
    }
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#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())

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

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

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int n = 0, c = 0, C = 0;
  string s;

  cin >> s;
  int size = s.size();
  REP(i, size) {
    if('0' <= s[i] && s[i] <= '9') n++;
    else if(islower(s[i])) c++;
    else if(isupper(s[i])) C++;
  }

  if(size >= 6 && n > 0 && c > 0 && C >0) cout << "VALID" << endl;
  else cout << "INVALID" << endl; 
}

Measured memory_bytes: 1180
#include<stdio.h>

int main(){
    int a,b;
    
    scanf("%d %d",&a,&b);

    if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
        printf("Possible\n");
    }
    else{
        printf("Impossible\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n, p;

    cin >> n >> p;

    if (n == 1) {
        cout << p << endl;
        return 0;
    }

    int64_t ans = 1;
    vector<bool> is_prime(pow(p, 1.0/n) + 2, true);
    // cerr << is_prime.size() << endl;
    for (int64_t m = 2; m < is_prime.size(); ++m) {
        if (!is_prime[m]) {
            continue;
        }

        int64_t x = pow(m, n);
        /// assert(x % m == 0);
        auto q = p;
        while (q % x == 0) {
            ans *= m;
            // cerr << m << " " << ans << endl;
            q /= x;
        }

        for (int64_t k = 2 * m; k < is_prime.size(); k += m) {
            is_prime[k] = false;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
n=int(input())
A=list(map(int,input().split()))
baiA=[2*i for i in A]
difA=[]
for i in range(n):
    if i==0:
        difA.append(baiA[0])
    else:
        difA.append(baiA[i]-difA[-1])
# print(difA)    
ans=[]
ans.append(difA[-1]//2)
for i in range(n-1):
    if i%2==0:
        ans.append(difA[i]-ans[0])
    else:
        ans.append(difA[i]+ans[0])
print(' '.join(map(str, ans)))

Measured memory_bytes: 87396
n, x, y = map(int, input().split())
x -= 1
y -= 1
GRAPH = [[0]*n for _ in range(n)]

def shortest_path(i, j):
    return min(j-i, abs(x-i)+abs(y-j)+1)

ans = [0]*(n-1)
for i in range(n):
    for j in range(i+1, n):
        path = shortest_path(i, j)-1
        ans[path] += 1
print(*ans, sep="\n")

Measured memory_bytes: 34932
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  int l,a,b,c,d;
  cin>>l>>a>>b>>c>>d;
  int t1=ceil((double)a/c),t2=ceil((double)b/d);
  if(t1>t2)
    cout<<l-t1<<endl;
  else
    cout<<l-t2<<endl;
}

Measured memory_bytes: 1164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int input = Integer.parseInt(reader.readLine());
        long[] ryuka = new long[87];
        ryuka[0] = 2;
        ryuka[1] = 1;
        for (int i = 2; i < 87; i++) {
            ryuka[i] = ryuka[i - 1] + ryuka[i - 2];
        }

        System.out.println(ryuka[input]);
    }
}


Measured memory_bytes: 21076
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

void solve(long long N, long long M, long long X, std::vector<long long> A){
    map<int, int> m;
    REP(i, N + 1)
        m.insert(make_pair(i, 0));
    REP(i, M)
        m[A[i]] = 1;

    long long ans1 = 0;
    REP(i, X)
        ans1 += m[i];

    long long ans2 = 0;
    for (int i = X; i < N; i++)
        ans2 += m[i];

    cout << min(ans1, ans2) << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long X;
    scanf("%lld",&X);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, X, std::move(A));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
int main()
{
	FOR(i, 1, 10)FOR(j, 1, 10)
	{
		cout << i << "x" << j << "=" << i*j << endl;
	}
	return 0;
}

Measured memory_bytes: 1112
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
	char a[1010];
	bool tot=false;
	cin>>a;
	for(int i=0;i<strlen(a);i++)
		if(a[i]=='C'&&!tot) tot++;
		else if(a[i]=='F'&&tot) {printf("Yes\n"); return 0;}
	printf("No\n");
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

typedef pair<int,int> ii;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(ALL(a));
  ll answer = 0;
  rep(i,n) {
    REP(j,i+1,n) {
      int cb = a[j] - a[i];
      int ub = upper_bound(ALL(a),cb) - a.begin();
      if( ub < i ) {
	answer += ( i - ub );
      }
    }
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
/* winners never quit and quitters never win.
      #swap                                 */
      
#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;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    /*rlimit rlim;
    if (getrlimit(RLIMIT_STACK, &rlim)) return 1;
    rlim.rlim_cur = rlim.rlim_max;
    if (setrlimit(RLIMIT_STACK, &rlim)) return 2;*/
    if(nxt()>=30)
        cout<<"Yes\n";
    else
        cout<<"No\n";
	printclock;
	return 0;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,a,b;
    cin >> n >> m;
    vector <int> dp(n+1,0);
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        dp[a]++;
        dp[b]++;
    }
    for(int i = 1; i <= n; i++){
        cout << dp[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
    int  N, M;
    int* foods;
    int  K;
    int  n;
    char buffer[1000];
    if (fgets(buffer, 1000, stdin) != NULL) {
        N = atoi(strtok(buffer, " "));
        M = atoi(strtok(NULL, " "));
        foods = calloc(M, sizeof(int));
        for (int i = 0; i < N; i++) {
            if (fgets(buffer, 1000, stdin) != NULL) {
                K = atoi(strtok(buffer, " "));
                for (int j = 0; j < K; j++) {
                    n = atoi(strtok(NULL, " "));
                    foods[n-1] += 1;
                }
            } else {
                return 1;
            }
        }
    } else {
        return 1;
    }
    int sum = 0;
    for (int i = 0; i < M; i++) {
        if (N == foods[i]) {
            sum += 1;
        }
    }
    printf("%d", sum);
    return 0;
}

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

int main() {
  int count;
  string S;
  cin >> count;
  
  int P=0, Y=0, G=0, W=0;
  for (int i=0; i<count; i++){
    cin >> S;
    if (S == "P") P = 1;
    if (S == "W") W = 1;
    if (S == "G") G = 1;
    if (S == "Y") Y = 1;
  }
  if (P + W + G + Y == 3) cout << "Three" << endl;
  if (P + W + G + Y == 4) cout << "Four" << endl;
}


Measured memory_bytes: 256
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x48, 0xc7, 0xc0, 0x00, 0x00, 0x00, 0x40,
	0x48, 0x83, 0xef, 0x01,
	0x48, 0x8b, 0x0c, 0xbe,
	0x48, 0xc7, 0xc2, 0x00, 0x00, 0x00, 0x00,
	0x48, 0x29, 0xca,
	0x48, 0x21, 0xd1,
	0x48, 0x39, 0xc1,
	0x73, 0x03,
	0x48, 0x89, 0xc8,
	0x48, 0x83, 0xff, 0x00,
	0x75, 0xdd,
	0x48, 0x83, 0xe8, 0x01,
	0xf3, 0x48, 0x0f, 0xb8, 0xc0,
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(int, int[]) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	int n, a[210];
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) scanf("%d", a + i);
	printf("%d\n", solve(n, a));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}


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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

int a,b;

int main(){
  cin >> a >> b;
  if(a<=b){cout << "unsafe";}
  else{cout << "safe";}
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> x(n);
  for (int i=0; i<n; i++){
    cin >> x[i];
  }
  ll ans = LINF;
  for (int i=0; i<n-k+1; i++){
     ll r = abs(x[i]-x[i+k-1]) + min(abs(x[i]), abs(x[i+k-1]));
    ans = min(ans, r);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    string S,T;
    cin>>S>>T;
    int cnt=0;
    rep(i,3){
        if(S[i]==T[i]) cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
int64_t univMod = 1000000007;
int64_t factnum = 100000;
vector<int64_t> modfact(factnum);
vector<int64_t> modinvfact(factnum);

void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n,a,b;
  cin >> n >> a >> b;
  int64_t beki = 1,nca=1,ncb=1;
  beki = calcmodpower(2,n);
  rep(i,a){
    nca = (nca * (n-i))%univMod;
    nca = (nca * calcinverse(i+1))%univMod;
  }
  rep(i,b){
    ncb = (ncb * (n-i))%univMod;
    ncb = (ncb * calcinverse(i+1))%univMod;
  }
  //cout << beki << "," << nca << ","<< ncb << endl;
  cout << (beki + 2*univMod - nca - ncb-1)%univMod << endl; 
  
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <cstring>
 
typedef long long ll;

#define rep(i,n) for(ll i = 0; i < n; i++)
 
using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

vector<vector<int> > tree(200001);
vector<int> ans(200001), seen(200001);

void dfs(int s){
  seen[s] = 1;  
  for(auto v: tree[s]){
    if(seen[v]) continue;
    ans[v] += ans[s];
    dfs(v);
  }
}

int main(){
  int N,Q;
  cin >> N >> Q;
  rep(i,N-1){
    int a,b;
    cin >> a >> b;
    tree[a].push_back(b);
    tree[b].push_back(a);    
  }
  rep(i,Q){
    int p, x;
    cin >> p >> x;
    ans[p] += x;
  }
  dfs(1);
  rep(i,N){
    if(i+1 == N) cout << ans[i+1] << endl;
    else cout << ans[i+1] << " ";
  }
}


Measured memory_bytes: 21120
from itertools import takewhile
primes = [0, 0] + [1] * (2**15)
for i in range(2, 182):
    if primes[i]:
        for j in range(i*i, 2**15 + 2, i):
            primes[j] = 0

while True:
    n = int(input())
    if n == 0:
        break
    prime_values = [i for i in range(len(primes[:n])) if primes[i]]
    print(sum(n-p1 in prime_values for p1 in takewhile(lambda x: x < n//2+1, prime_values)))

Measured memory_bytes: 8312
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<long long, long long>
#define ff first
#define ss second

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a; cin >> a;
    cout << a + a*a + a*a*a;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define int long long

using namespace std;

vector<vector<int> >adj;

int vis[500];
bool flag=true;
int h[500];
int mx=0;
void bfs(int ver)
{
    flag=true;
    queue<pair<int,int> > q;
    q.push({ver,0});
    vis[ver]=1;
    while (!q.empty())
    {
        pair<int,int> s=q.front();
        q.pop();
        for(auto i:adj[s.first])
        {
            if(vis[i]==1)
            {
                if(((abs(h[i]-s.second))%2==0))
                {
                    flag=false;
                    return;
                }
            }
            else
            {
                vis[i]=1;
                h[i]=s.second+1;
                q.push({i,h[i]});
            }
        }
        mx=max(mx,h[s.first]);
    }
}


signed main()
{
    int n;
    cin>>n;
    string s[n];
    for (int k = 0; k < n; ++k) {
        cin>>s[k];
    }

    int z[n][n]={};
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if(s[i][j]=='1')
            {
                z[i][j]=1;
            }
        }
    }

    adj.resize(n+1);
    for (int i = 0; i < n; ++i) {
        for(int j=0;j<n;j++)
        {
            if(z[i][j])
            {
                adj[i].push_back(j);
            }
        }
    }

    int ans=0;
    for (int i = 0; i < n; ++i) {
        fill_n(vis,500,0);
        fill_n(h,500,0);
        mx=0;
        bfs(i);
        if(flag)
        {
            ans=max(ans,mx+1);
        }
    }

    if(ans==0)
        cout<<-1;
    else
        cout<<ans;
}

Measured memory_bytes: 1024
import numpy as np
N,K,Q=map(int,input().split())
A=[0]*N
P=[K-Q]*N
for i in range(Q):
    a=int(input())
    A[a-1]=A[a-1]+1
A=np.array(A)
P=np.array(P)
for i in range(N):
    if A[i]+P[i]>0:
        print('Yes')
    else:
        print('No')

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

typedef long long ll;

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int cur = -1;
	for (int i = 0; i < n; i++) {
		if (cur == -1 and arr[i] == 1) {
			cur = 1;
		} else if (arr[i] == cur+1) {
			cur++;
		}
	}
	cout << (cur != -1 ? n-cur : -1) << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  int count = 0;
  for (int i = 0; i < N - 1; i++){
    if(vec.at(i) == vec.at(i+1)){
      count++;
    }
  }
  cout << vec.size() - count <<endl;
}

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

int main(){
  int h,n;
  long long sum;
  cin >> h >> n;
  int arr[n];
  for(int i=0;i<n;i++){
    cin >> arr[i];
  }
  sum = accumulate(arr,arr+n,0LL);
  if(h<=sum){
    cout << "Yes";
  }else{
    cout << "No";
  }
	return 0;
}

Measured memory_bytes: 640
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = mapint()
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

Cs = list(mapint())
Cs.sort(reverse=True)
from collections import deque
Q = deque([0])

checked = [0]*N
checked[0] = Cs[0]
cur = 1
ans = 0
while Q:
    v = Q.pop()
    for nx in graph[v]:
        if checked[nx]:
            continue
        checked[nx] = Cs[cur]
        ans += Cs[cur]
        cur += 1
        Q.append(nx)
print(ans)
print(*checked)
        

Measured memory_bytes: 70444
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector< vector<pair<int, int> > > xy(n);

  for(int i = 0; i < n; i++){
    cin >> a[i];
    for(int j = 0; j < a[i]; j++){
      int s,t;
      cin >> s >> t;
      xy[i].push_back({s,t});
    }
  }
  int maxi = 0;
  for(int i = 0; i < (1 << 15) ; i++){
    int flag = 1;
    int tmp = 0;
    for(int j = 0; j < n; j++){
      if(!(i & (1<<j))) continue;
      tmp++;
      for(int k = 0; k < a[j]; k++){
        if(i & (1<<(xy[j][k].first-1)) ){
          if(!xy[j][k].second) flag = 0;
        }
        else{
          if(xy[j][k].second) flag = 0;
        }
      }
    }
    if(flag) maxi = max(maxi, tmp);
  }

  cout << maxi << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;


void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a == b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    solve();
    return 0;
}


Measured memory_bytes: 256
n,t = map(int,input().split())
ct = [list(map(int,input().split())) for i in range(n)]
min_cost = float("inf")
cnt = 0
for i in range(n):
  if ct[i][1] <= t:
    min_cost = min(min_cost,ct[i][0])
    cnt += 1
if cnt != 0:
  print(min_cost)
else:
  print("TLE")

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			char[] S = sc.next().toCharArray();
			char[] ans = "AKIHABARA".toCharArray();
			int ai = 0;
			for(int i = 0; i < S.length; i++) {
				if(ai == ans.length) {
					System.out.println("NO");
					return;
				}
				char c = S[i];
				do{
					if(ans[ai] == c) break;
					if(ans[ai] == 'A' && ai < (ans.length - 1) &&  ans[ai + 1] == c) {
						ai++;
						break;
					}
					System.out.println("NO");
					return;
				} while(false);
				ai++;
			}
			if(ai == ans.length) {
				System.out.println("YES");
			} else if(ai == ans.length - 1 && ans[ai] == 'A'){
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
	using namespace std; 
	#define max(a, b) (a < b ? b : a) 
	#define min(a, b) ((a > b) ? b : a) 
	#define mod 1e9 + 7 
	#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++) 
	#define FORL(a, b, c) for (int(a) = (b); (a) < (c); (a)++) 
	#define FORR(a, b, c) for (int(a) = (b); (a) > (c); (a)--) 
	#define INF 1000000000000000003 
	typedef long long int ll; 
	typedef vector<int> vi; 
	typedef vector<long long int> vl; 
	typedef pair<int, int> pi; 
	typedef pair<long long int, long long int> pl; 
	#define F first 
	#define S second 
	#define pb push_back 
	#define POB pop_back 
	#define mp make_pair 
	

	int main()
	 {ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
		ll n,c;
		cin>>n;
		vl dp(n);
		dp[0]=0;
		dp[1]=1;
		if(n>2)
		{for(int i=2;i<n;i++)
		{	c=0;
			for(int j=1;j<=sqrt(i);j++)
			{
				if(i%j==0 && j!=(i/j))
				c+=2;
				if(i%j==0 && j==(i/j))
				c+=1;
			}
			dp[i]=dp[i-1]+c;
		}}
		cout<<dp[n-1];

		
	return 0;
	}


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

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if ((a * b) % 2 == 0)
        cout << "Even";
    else
        cout << "Odd";

    return 0;
}


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

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}

fn main() {
    let n: String = read();
    let mut m: String = read();
    m.push_str(&n);
    println!("{}", m);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

int main () {
    long long s;

    string v;
    cin >> s >> v;

    int x = (v[0] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0');

    s *= x;

    cout << s / 100;

}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#define SIZE 100000

typedef struct node *link;
struct node{ 
	int v; link next; 
};

typedef struct{
	int par;
	int dep;
	link x;
}tree;


link NEW(int v, link n){
	link x = malloc(sizeof(*x));
	x->v = v; x->next = n;
	return x;
}

int check(int a[],int n){
	int i;
	for(i=0;i<n;i++){
		if(a[i]==0)return 0;
	}
	return 1;
} 

void search(int v[],int id,tree a[],int p,int d){
	link t;
	v[id]=1;
	if(a[id].par<p)a[id].par=p;
	if(a[id].dep<d)a[id].dep=d;
	if(a[id].x==NULL)return;
	for(t=a[id].x;t!=NULL;t=t->next){
		search(v,t->v,a,id,d+1);
	}
}

link reverse(link x){
	link t,y=x,r=NULL;
	while(y!=NULL){
		t=y->next;
		y->next=r;
		r=y;
		y=t;
	}
	return r;
}

void printNode(int key,tree temp){
	link t;
	printf("node %d: parent = %d, depth = %d, ",key,temp.par,temp.dep);
	if(temp.par==-1)printf("root, [");
	else if(temp.x==NULL)printf("leaf, [");
	else printf("internal node, [");
	temp.x=reverse(temp.x);
	for(t=temp.x;t!=NULL;t=t->next){
		if(t->next==NULL)break;
		printf("%d, ",t->v);
	}
	if(t==NULL)printf("]\n");
	else printf("%d]\n",t->v);
}



int main(void){
	tree a[SIZE];
	int visit[SIZE];
	int i,j;
	int n,id,k,c;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		a[i].x=NULL;
		a[i].par=-1;
		a[i].dep=-1;
		visit[i]=0;
	}
	for(i=0;i<n;i++){
		scanf("%d",&id);
		
		scanf("%d",&k);
		for(j=0;j<k;j++){
			scanf("%d",&c);
			a[id].x=NEW(c,a[id].x);
		}
		
	}
	for(i=0;i<n;i++){
		if(visit[i]==1)continue;
		search(visit,i,a,-1,0);
		if(check(visit,n)==1){
			break;
		}
	}
	
	for(i=0;i<n;i++){
		printNode(i,a[i]);
	}
	return 0;
}

Measured memory_bytes: 6828
n = int(input())
a = list(map(str, (range(1, 10))))
total = a[:]
cnt = 9
while cnt < n:
    new = []
    for i in a:
        if i[-1] == "0":
            new.append(i + "0")
            new.append(i + "1")
            cnt += 2
            if cnt >= n:
                break
        elif i[-1] == "9":
            new.append(i + "8")
            new.append(i + "9")
            cnt += 2
            if cnt >= n:
                break
        else:
            new.append(i + str(int(i[-1]) -1))
            new.append(i + str(int(i[-1])))
            new.append(i + str(int(i[-1]) + 1))
            cnt += 3
            if cnt >= n:
                break
    total += new[:]
    a = new[:]
                
print(total[n-1])

Measured memory_bytes: 50652
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long 
#define sort(v) sort(v.begin(),v.end()) 
#define pb push_back
/*

ll ar[1000000+9]={0}; 
void seiv() { 
ll n=1000000,i,j; 
ar[1]=1; 
for(i=4;i<=n;i+=2)ar[i]=1; 
for(i=3;i<=n;i+=2) 
{ if(ar[i]==0) 
{ for(j=i*i;j<=n;j+=i*2)ar[j]=1; }
 }
 
 }
*/
 int main(){
ll a,b,d,e,i,j,k,c,x, y=1,l=0;
string s;cin>>a>>s;
j=s.size()-1;
for(i=0;i<=j;i++)
{
if(s[i]=='W')
  {
    xx:
      if(s[j]=='R'){j--;l++;}
      else if(j>i){j--;goto xx;}
  }
 
}
       // if(l==0&&s[0]=='W')l++;
        cout<<l<<endl;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int infI=1e9+5;
const long long infL=1e16;
const int MOD=1e9+7;
const int MAX=2e5+5;

#define mp make_pair
#define in &
#define pb push_back
#define ii pair<int,int>
#define iii pair<ii,int>
#define ll long long
#define pll pair<ll,ll>
#define vvl vector<vector<ll> >
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define eb emplace_back
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define popb pop_back()
#define se second
#define fi first
#define debug(x) cerr<<x<<endl
#define test(t) int t;cin>>t;while(t--)
#define fordebug(x) cerr<<x<<" "

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    if(b==1){
        return a;
    }
    ll temp=power(a,b/2);
    temp=(temp*temp)%MOD;
    if(b%2){
        temp=(temp*a)%MOD;
    }
    return temp;
}

//only use if mod is prime
ll mod_inv(ll a,ll mod){
    a%=mod;
    return power(a,mod-2);
}

void extended_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return;
    }
    ll x1,y1;
    extended_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-((a/b)*y1);
    return;
}

//TLE can also occur if vectors are not passed by reference

ll dp[MAX][2];
vvi adj;

ll solve(int u,int p,int col){//col = 0->black
    if(dp[u][col]!=-1){
        return dp[u][col];
    }
    ll &cnt = dp[u][col];
    cnt = 1;
    for(auto x:adj[u]){
        if(x==p){
            continue;
        }
        ll temp = solve(x,u,1);
        if(col!=0){
            temp += solve(x,u,0);
        }
        cnt *= temp;
        cnt%=MOD;
    }
    return cnt;
}

int main(){
    int n;
    cin>>n;
    adj.resize(n+1);
    forn(i,1,n+1){
        dp[i][0]=dp[i][1]=-1;
    }
    forn(i,0,n-1){
        int s,d;
        cin>>s>>d;
        adj[s].pb(d);
        adj[d].pb(s);
    }
    ll ans = solve(1,-1,0);
    ans = (ans + solve(1,-1,1))%MOD;
    cout<<ans;
    return 0;
}

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

int group(int x){
    if( x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x== 10 || x== 12){
        return 1;
    }
    if( x == 4 || x == 6 || x == 9 || x == 11 ){
        return 2;
    }
    if( x ==  2 ){
        return 3;
    }

    return 0;
}

int main(){
    int x, y;
    cin >> x >> y;
    int xgroup, ygroup;

    xgroup=group(x);
    ygroup=group(y);
    
    if( xgroup==ygroup ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val t = sc.nextInt() - 1
    val a = sc.nextInt() - 1
    val adj = Array(n) { mutableSetOf<Int>() }
    for (i in 0 until n - 1) {
        val u = sc.nextInt() - 1
        val v = sc.nextInt() - 1
        adj[u].add(v)
        adj[v].add(u)
    }
    val dist_a = Array(n) { 0 }
    val dist_t = Array(n) { 0 }
    val que:Queue<Pair<Int,Int>> = ArrayDeque()
    val visited = BitSet(n)
    visited[t] = true
    que.add(t to 0)
    while (que.count() > 0) {
        val (v, step) = que.poll()
        dist_t[v] = step
        for (w in adj[v]) {
            if (!visited[w]) {
                visited[w] = true
                que.add(w to step + 1)
            }
        }
    }
    que.clear()
    visited.clear()
    visited[a] = true
    que.add(a to 0)
    while (que.count() > 0) {
        val (v, step) = que.poll()
        dist_a[v] = step
        for (w in adj[v]) {
            if (!visited[w]) {
                visited[w] = true
                que.add(w to step + 1)
            }
        }
    }
    var ans = 0
    for (i in 0 until n) {
        if (dist_a[i] <= dist_t[i]) continue
        ans = maxOf(ans, dist_a[i] - 1)
    }
    println(ans)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

using namespace std;

int N, M;
string s, sol;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> s;
    sol += s[0];
    
    int cnt = 0;
    for (int i = 1; i < s.size() - 1; ++i) {
        ++cnt;
    }
    
    if (cnt < 10) {
        sol += (char)(cnt + '0');
    } else {
        sol += (char)((cnt / 10) + '0'); 
        sol += (char)((cnt % 10) + '0'); 
    }
    
    sol += s[s.size() - 1];
    cout << sol << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    int x,y;
    cin >> N;
    x=N/4;
    y=N/7;
    for(int i=0;i<=x;i++){
        for(int j=0;j<=y;j++){
            if (4*i + 7*j == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

namespace AtCoder.ABC067
{
    class Program
    {
        static HashSet<int>[] edge;
        static int[] distanceFromFennec;
        static int[] distanceFromSnuke;
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var a = new int[n];
            var b = new int[n];
            edge = Enumerable.Range(0, n).Select(i => new HashSet<int>()).ToArray();
            distanceFromFennec = new int[n];
            distanceFromSnuke = new int[n];
            for (int i = 0; i < n - 1; i++)
            {
                int[] inputs = Console.ReadLine().Split(' ')
                            .Select(elem => int.Parse(elem) - 1)
                            .ToArray();
                a[i] = inputs[0];
                b[i] = inputs[1];
                edge[a[i]].Add(b[i]);
                edge[b[i]].Add(a[i]);
                // for (int j = 0; j < n; j++) Console.Error.WriteLine("edge[{0}]: {1}", j, string.Join(" ", edge[j]));
            }

            DistanceFrom(0, 1, distanceFromFennec);
            DistanceFrom(n - 1, 1, distanceFromSnuke);
            // Console.Error.WriteLine("from Fennec: {0}", string.Join(" ", distanceFromFennec));
            // Console.Error.WriteLine("from Snuke: {0}", string.Join(" ", distanceFromSnuke));
            int cnt1 = 0, cnt2 = 0;
            for (int i = 0; i < n; i++)
            {
                if (distanceFromFennec[i] <= distanceFromSnuke[i]) cnt1++;
                else cnt2++;
            }
            // Console.Error.WriteLine("cnt1:{0}, cnt2:{1}", cnt1, cnt2);
            Console.WriteLine(cnt1 > cnt2 ? "Fennec" : "Snuke");
        }

        static void DistanceFrom(int n, int d, int[] dp)
        {
            if (dp[n] != 0) return;
            dp[n] = d++;
            // Console.Error.WriteLine("{0}:{1} {2}", n, d - 1, string.Join(" ", edge[n]));
            foreach (var item in edge[n])
            {
                DistanceFrom(item, d, dp);
            }
        }
    }
}

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

int main() {
    int x;
    cin >> x;
    int ans = 1;
    for(int i = 2; i*i <= x; ++i){
        for(int j = i*i; j <= x; j*=i){
            ans = max(ans, j);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import math
from itertools import combinations
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
def enc(i,j,k):
  a,b = i
  c,d = j
  e,f = k
  aa = a*a
  bb = b*b
  cc = c*c
  dd = d*d
  ee = e*e
  ff = f*f
  if (2*(e-a)*(b-d)-2*(c-a)*(b-f)) == 0:
    ymax = max(b,d,f)
    ymin = min(b,d,f)
    xmax = max(a,c,e)
    xmin = min(a,c,e)
    (px,py) = ((xmax-xmin)/2,(ymax-ymin)/2)
    r = math.hypot(xmax-xmin,ymax-ymin)/2
  else:
    py = ((e-a)*(aa+bb-cc-dd)-(c-a)*(aa+bb-ee-ff))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
    px = (2*(b-f)*py-aa-bb+ee+ff)/(2*(e-a))\
      if (c == a) else (2*(b-d)*py-aa-bb+cc+dd)/(2*(c-a))
    r = math.hypot(px-a, py-b)
  return (r,px,py)
def judge(r,px,py):
  ls = [math.hypot(px-x,py-y) for x,y in xy]
  if max(ls) <= r+10**-7:
    return True
  else:
    return False
ans = 10**18
for i,j in combinations(xy,2):
  x1,y1 = i
  x2,y2 = j
  px = (x1+x2)/2
  py = (y1+y2)/2
  r = math.hypot(x1-x2,y1-y2)/2
  if judge(r,px,py):
    ans = min(ans,r)
for i,j,k in combinations(xy,3):
  r,px,py = enc(i,j,k)
  if judge(r,px,py):
    ans = min(ans,r)
print(ans)

Measured memory_bytes: 49116
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
int main(void){
    int n;
    cin>>n;
    long long int a[100001][3];
    long long int dp[100001][3];
    for (int i=0;i<n;i++) {
        for (int j=0;j<3;j++) {
            cin>>a[i][j];
        }
    }
    for (int i=0;i<100001;i++) {
        for (int j=0;j<3;j++) {
            dp[i][j]=0;
        }
    }
    for (int i=0;i<n;i++) {
        for (int j=0;j<3;j++) {
            for (int k=0;k<3;k++) {
                if (j==k) {
                    continue;
                } else {
                    chmax(dp[i+1][k],dp[i][j]+a[i][k]);
                }
            }
        }
    }
    long long int ans=0;
    for (int i=0;i<3;i++) {
        chmax(ans,dp[n][i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8280
#include<bits/stdc++.h>
using namespace std; 
typedef long long int ll;
int main() { 
string ch,cht;
cin>>ch>>cht;
ll c=0;
for(int i=0;i<= ch.size();i++)
{ if(ch[i]!=cht[i])
     c++; 
} 
cout<<c;
}

Measured memory_bytes: 3872
def main():
    import sys
    import collections
    input = sys.stdin.readline
    N = int(input())
    S = []
    for i in range(N):
        S.append(input())
    c = collections.Counter(S)
    max_num = c.most_common(1)[0][1]
    ss = []
    for cc in c.most_common():
        if cc[1] == max_num:
            ss.append(cc[0])
    ss.sort()
    print("".join(ss))

if __name__ == "__main__":
    main()

Measured memory_bytes: 122152