akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

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

  int p[2] = {0,0};
  rep(i,n){
    p[0] = p[0] + a[i];
    p[1] = max(p[0] + b[i], p[1] + b[i]);
  }

  cout << p[1] << endl;

  return 0;
}


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

long long n, ans = 0;

int main() {
  cin >> n;
  switch(n) {
    case 0: ans = 1; break;
    case 1: ans = 2; break;
    case 2: ans = 1; break;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int n,j;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
  cin>>n;
  vector<int>ans;
  for(int i=0;j<n;i++){
    if(IsPrime(5*i+1)==1){
      ans.push_back(5*i+1);
      j++;
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<' ';
  }
  cout<<endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int sec = stdIn.nextInt();

		int h, m;

		h = sec / (60 * 60);
		sec %= (60 * 60);

		m = sec / 60;
		sec %= 60;

		System.out.println(h + ":" + m + ":" + sec);
	}

}

Measured memory_bytes: 26208
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0047
Cup Game
"""
import sys


def main(args):
    ball_position = 'A'
    for line in sys.stdin:
        exchanged_cups = line.strip().split(',')
        if ball_position in exchanged_cups:
            exchanged_cups.remove(ball_position)
            ball_position = exchanged_cups[0]
    print(ball_position)


if __name__ == '__main__':
    main(sys.argv[1:])

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

const int Maxn = 100005;
const int mod = 1000000007;

int dp[Maxn];
int n, m;
bool block[Maxn];

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++) {
        int a; scanf("%d", &a);
        block[a] = true;
    }
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        if (!block[i + 1]) dp[i + 1] = (dp[i + 1] + dp[i]) % mod;
        if (!block[i + 2]) dp[i + 2] = (dp[i + 2] + dp[i]) % mod;
    }
    printf("%d\n", dp[n]);
    return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<math.h>
#include <iomanip>

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

using namespace std;

const int INF = 1 << 21;

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

	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			if (i * j == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i, a, b) for(int i = (a); i<(b); ++i)
#define pb push_back
#define INF 10000000005
#define MOD 1000000007
#define all(v) v.begin(), v.end()

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

ll power(ll x, ll y, ll p = MOD){  
    ll res = 1LL; 
    x = x % p;
    if (x == 0) return 0;
    while (y > 0){
        if (y & 1LL)  
            res = (res*x) % p;
        y = y>>1LL; 
        x = (x*x) % p;  
    }  
    return res;  
}  

int main(){
	IO
	int n, w;
	cin >> n >> w;
	vll prev(100005, INF), curr(100005, INF);

	ll value, weight;
	cin >> weight >> value;

	prev[0] = 0; prev[value] = weight;
	rep(i, 0, n-1){
		cin >> weight >> value;
		for(int val = 0; val<= 100000 ; ++val){
			if(val < value) curr[val] = prev[val];
			else curr[val] = min(prev[val], prev[val - value] + weight);
		}
		prev = curr;	
	}
	ll ans = -1;
	rep(i, 0, 100001){
		if(prev[i]<=w)
			ans = max(ans, i*1LL);
	}

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

Measured memory_bytes: 1792
#include <iostream>

// Greatest common divisor
size_t gcd(size_t m, size_t n) {
    if (m < n) std::swap(m, n);
    size_t r = 1;
    while (r != 0) {
        r = m%n;
        m = n;
        n = r;
    }
    return m;
}

// Least common multiple
size_t lcm(size_t m, size_t n) {
    return (m/gcd(m, n))*n;
}

// Number of dividable numbers less than or equal to n.
size_t num_dividable(size_t n, size_t a, size_t b, size_t ab) {
    return n - n/a - n/b + n/ab;
}

int main() {
    size_t A, B, C, D;
    std::cin >> A >> B >> C >> D;

    const auto CD = lcm(C, D);
    const auto n1 = num_dividable(B, C, D, CD);
    const auto n2 = num_dividable(A - 1, C, D, CD);
    std::cout << n1 - n2 << std::endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		char c;
		int tim;

		// ??????1~6???????????????????????????????????°????????\??????
		int num_top = scan.nextInt();
		int num_S = scan.nextInt();
		int num_E = scan.nextInt();
		int num_W = scan.nextInt();
		int num_N = scan.nextInt();
		int num_bot = scan.nextInt();

		// ??????1~6????????????????????????????????????????????\??????
		String str_top = "top";
		String str_S = "S";
		String str_E = "E";
		String str_W = "W";
		String str_N = "N";
		String str_bot = "bot";

		// ?????¶???????????????
		String str = scan.next();

		// ?????¶??°???????????????
		for (int count = 0; count < str.length(); count++) {
			c = str.charAt(count);
			String s = String.valueOf(c);
			switch (s) {
			case "S":
				// ??°????????????????¨???¶????????????
				tim = num_S;

				num_S = num_top;
				str_S = str_top;

				num_top = num_N;
				str_top = str_N;
				
				num_N = num_bot;
				str_N = str_bot;
				
				num_bot = tim;
				str_bot = "S";

				break;
			case "E":
				tim = num_E;

				num_E = num_top;
				str_E = str_top;

				num_top = num_W;
				str_top = str_W;
				
				num_W = num_bot;
				str_W = str_bot;
				
				num_bot = tim;
				str_bot = "E";

				break;
			case "W":
				tim = num_W;

				num_W = num_top;
				str_W = str_top;

				num_top = num_E;
				str_top = str_E;
				
				num_E = num_bot;
				str_E = str_bot;
				
				num_bot = tim;
				str_bot = "W";

				break;
			case "N":
				tim = num_N;

				num_N = num_top;
				str_N = str_top;

				num_top = num_S;
				str_top = str_S;
				
				num_S = num_bot;
				str_S = str_bot;
				
				num_bot = tim;
				str_bot = "N";
				break;
			}
		}
		System.out.println(num_top);

	}
}

Measured memory_bytes: 26348
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	for (int i = 1; i <= 1000; i++) {
    		if (100 * i <= X && X <= 105 * i) {
    			System.out.println(1);
    			System.exit(0);
    		}
    	}
    	System.out.println(0);
    }
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <string.h>
int main(void){
    int x,x2,a;
    a = 0;
    scanf("%d\n",&x);
    scanf("%d\n",&x2);
    if (x > x2){
        a = x + (x - 1);
    }else if (x < x2){
        a = x2 + (x2 - 1);
    }else if (x == x2){
        a = x * 2;
    }
    printf("%d",a);
    return 0;
}

Measured memory_bytes: 128
def resolve():
    '''
    code here
    '''

    N, M = [int(item) for item in input().split()]
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]

    is_found = False
    for i in range(N-M+1):
        temp_line = A[i:i+M]
        for j in range(N-M+1):
            temp_grid = [line[j:j+M] for line in temp_line]
            # print(temp_grid)
            if B == temp_grid:
                is_found = True
                break
        if is_found:
            break

    print('Yes') if is_found else print('No')

if __name__ == "__main__":
    resolve()


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

const int N = 100;
int a[N];


inline bool isT(int a, int b, int c)
{
	if(a <= 0 || b <= 0 || c <= 0) return false;
	if((a + b) <= c || (b + c) <= a || (a + c) <= b)
		return false;
	return true;
}

int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	int ans = 0;
	for(int i = 0; i < n; i++)
		for(int j = i + 1; j < n; j++)
			for(int k = j + 1; k < n; k++)
				ans += (a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) 
					? 0 : isT(a[i], a[j], a[k]);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3788
#include<stdio.h>
#include<string.h>
int main ()
{
    char s[11],s2[11];
    scanf ("%s",s);
    int i,j;
    for (i = 0 ,j=0; i <strlen (s); i++)
    {
            if(s[i]!='B')
            {
                    s2[j]=s[i];
                    j++;
            }
            else{
                if(i!=0&&j!=0)
                {
                    j--;
                    s2[j]='\0';
                }
            }
    }
    s2[j]='\0';
    puts(s2);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}/*
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
int solve(){
    int n;
    cin>>n;
    ll cnt=0;
	rep(i,1,n+1){
		if(i%3!=0&&i%5!=0)cnt+=i;
	}
	cout<<cnt<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int now = 0, ans = 0;
    string s;
    cin >> s;
    rep(i, 0, s.size()){
        if(s[i] == 'S') now++;
        else{
            if(now <= 0) ans += 2;
            if(now > 0) now--;
        }
    }
    cout << ans << endl;
}

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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if(B/A < C) C = B / A;
    cout << C << endl;
}

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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) cin >> s[i];

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                bool f = true;
                if (i != 0) if (s[i-1][j] == '#') f = false;
                if (i != h-1) if (s[i+1][j] == '#') f = false;
                if (j != 0) if (s[i][j-1] == '#') f = false;
                if (j != w-1) if (s[i][j+1] == '#') f = false;
                if (f) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3612
class Main {
    public static void main(String args[]) {
        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[][] adjacency = new int[n][n];

        for(int i=0; i<n; i++){
            int vIndex = Integer.parseInt(sc.next())-1;
            int nAdj = Integer.parseInt(sc.next());
            for(int j=0; j<nAdj; j++){
                int connectTo = Integer.parseInt(sc.next())-1;
                adjacency[vIndex][connectTo] = 1;
            }
        }
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                if(j== n-1)  System.out.println(adjacency[i][j]);
                else  System.out.print(adjacency[i][j]+" ");
            }
        }
        
    }
}



Measured memory_bytes: 34480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 312
ll g[N][N];
#define M (2*N)
int a[M][M];

int main(){
	int n, m; ll l; scanf("%d%d%lld", &n, &m, &l);

	REP(i, N) REP(j, N) g[i][j] = LLONG_MAX / 100;
	REP(i, m){
		int a, b; ll c; scanf("%d%d%lld", &a, &b, &c); a--; b--;
		g[a][b] = g[b][a] = c;
	}
	REP(k, n){
		REP(i, n) REP(j, n) SML(g[i][j], g[i][k] + g[k][j]);
	}

	REP(i, M) REP(j, M) a[i][j] = 114514;
	REP(i, n) a[i+N][i] = 1;
	REP(i, n) REP(j, n) {
		if(g[i][j] <= l) a[i][j+N] = 0;
	}
	REP(k, M){
		REP(i, M) REP(j, M) SML(a[i][j], a[i][k] + a[k][j]);
	}

	int q; scanf("%d", &q);
	REP(i, q){
		int s, t; scanf("%d%d", &s, &t); s--; t--;
		int ans = a[s][t+N];
		if(ans >= 114514) ans = -1;
		printf("%d\n", ans);
	}
}


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

ll n, m, mod=1e9+7, f[500010], dp[500010];

ll po(ll a, ll b) {
	if (b==0) return 1;
	ll ans=po(a, b/2);
	ans*=ans;
	ans%=mod;
	if (b%2==1) ans*=a;
	ans%=mod;
	return ans;
}

ll comb(ll a, ll b) {
	if (a==0||b==0) return 1;
	ll ans=f[a]*po(f[b], mod-2);
	ans%=mod;
	ans*=po(f[a-b], mod-2);
	ans%=mod;
	return ans;
}

int main() {
	cin>>n>>m;
	f[0]=1;
	for (int i=1; i<500010; i++) {
		f[i]=i*f[i-1];
		f[i]%=mod;
	}
	ll ans=comb(m, n)*f[n];
	ans%=mod;
	//cout<<comb(n, n)<<endl;
	for (int i=n; i>0; i--) {
		//cout<<i<<" "<<comb(m-i, n-i)<<endl;
		dp[i]=comb(n, i)*comb(m-i, n-i);
		dp[i]%=mod;
		dp[i]*=f[n-i];
		dp[i]%=mod;
		dp[i]*=ans;
		dp[i]%=mod;
		if (i<n) dp[i]-=dp[i+1];
		if (dp[i]<0) dp[i]+=mod;
	}
	ans*=ans;
	ans%=mod;
	ans-=dp[1];
	if (ans<0) ans+=mod;
	cout<<ans<<endl;
}



Measured memory_bytes: 11348
import static java.lang.System.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);

        String s = sc.next();
		int a = Integer.parseInt(s.substring(0,2));
		int b = Integer.parseInt(s.substring(2,4));
		
		if(0 < a && a <= 12) {
			if(0 < b && b <= 12) out.println("AMBIGUOUS");
			else out.println("MMYY");
		}
		else {
			if(0 < b && b <= 12) out.println("YYMM");
			else out.println("NA");
		}
    }
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<Job> jobs = new List<Job>();
            for (int i = 0; i < N; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                jobs.Add(new Job(long.Parse(input[0]), long.Parse(input[1])));
            }
            jobs.Sort();
            long ElapsedTime = 0;
            for (int i = 0; i < N; i++)
            {
                ElapsedTime += jobs[i].A;
                if (ElapsedTime > jobs[i].B)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }

        private class Job : System.IComparable<Job>
        {
            public long A { get; set; }
            public long B { get; set; }
            public Job(long _A, long _B)
            {
                this.A = _A;
                this.B = _B;
            }
            public int CompareTo(Job i_other)
            {
                if (this.B == i_other.B)
                {
                    return 0;
                }
                if (this.B > i_other.B)
                {
                    return 1;
                }
                return -1;
            }
        }
    }
}   

Measured memory_bytes: 29088
import math
n=int(input())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
lists=[]
listt=[]
sums=0
sumt=0

def rank(n,l):
  for i in range(len(l)):
    if n==l[i]:
      l.remove(l[i])
      return i+1
    
for i in range(n):
  lists.append(i+1)
  listt.append(i+1)
for i in range(n):
  sums+=(rank(s[i],lists)-1)*(math.factorial(n-1-i))
  sumt+=(rank(t[i],listt)-1)*(math.factorial(n-1-i))
if sums<sumt:
  tmp=sums
  sums=sumt
  sumt=tmp
print(sums-sumt)

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	vector<int> a(3); rep(i, 3) cin>>a[i]; sort(all(a)); UNIQUE(a);
  cout<<a.size()<<endl;
	return 0;
}


Measured memory_bytes: 256
# C
a, b, h, m = map(int, input().split())

import math
short = 30 * h 
long = 6 * m 
short = 30 * h + m*30/60
ans = (a**2 + b**2 - 2*a*b*math.cos(math.radians(abs(short-long))))**(1/2)
print(ans)

Measured memory_bytes: 9572
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  ll N = s.size();
  vll num(N);
  for(int i = 0; i < N; i++){
    num.at(i) = s.at(i) - 'a';
  }

  ll K;
  cin >> K;
  for(int i = 0; i < N; i++){
    if(num.at(i) == 0) continue;
    ll d = 26 - num.at(i);
    if(d <= K){
      K -= d;
      s.at(i) = 'a';
    }
  }
  num.at(N-1) = s.at(N-1) - 'a';
  num.at(N-1) += K;
  num.at(N-1) %= 26;
  s.at(N-1) = (char)(num.at(N-1) + 'a');
  cout << s << endl;
}

Measured memory_bytes: 1360
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << x << "\n"
#define endwith return
constexpr int mod = 1000000007;
using namespace std;
int input() { int t; cin >> t; return t; }
signed main() {
	int a, b, c, d, e; cin >> a >> b >> c >> d >> e;
	if (!a)puts(1);
	if (!b)puts(2);
	if (!c)puts(3);
	if (!d)puts(4);
	if (!e)puts(5);
}

Measured memory_bytes: 3520
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
before = sum(A)

for i in range(N):
    b = B[i]
    tmp = abs(A[i] - b)
    if A[i] > b:
        A[i] -= b
    else:
        A[i] = 0
        if A[i+1] > tmp:
            A[i+1] -= tmp
        else:
            A[i+1] = 0

after = sum(A)
print(before - after)
        

Measured memory_bytes: 24128
#include<iostream>
#include<cstring>
#include<queue>
#include<algorithm>
#include<cstdio>
using namespace std;
long long dp[60][60][2551];
int main(){
	dp[0][0][0]=1;
	int n,a,x[60],i,j,k;
	cin>>n>>a;
	for(i=0;i<n;i++) scanf("%lld",x+i);
	for(i=1;i<=n;i++){
		for(j=i;j>=0;j--){
			for(k=a*n+1;k>=0;k--){
				dp[i][j][k]+=dp[i-1][j][k];
                if(k>=x[i-1] && j>=1)
                    dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]];
			}
		}
	}
	long long ans=0;
	for(int i=1;i<=n;i++) ans+=dp[n][i][a*i];
	printf("%lld",ans);
	return 0;
}

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

const int INF = 1e9 + 5;
const int N = 1e5;
signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n, w;
	cin >> n >> w;

	vector<pair<int, int>> items(n);
	for (int i = 0; i < n; i++)
	{
		cin >> items[i].first >> items[i].second;
	}

	vector<long long> dp(N + 1, INF);
	dp[0] = 0;
	for (int i = 0; i < n; i++)
	{
		vector<long long > new_dp(N + 1, INF);
		for (int curr_val = N; curr_val >= 0; curr_val--)
		{
			if (curr_val - items[i].second >= 0)
				new_dp[curr_val] = dp[curr_val - items[i].second] + items[i].first;
			new_dp[curr_val] = min(new_dp[curr_val], dp[curr_val]);
		}
		dp = new_dp;
	}
	int ans = 0;
	for (int curr_val = N; curr_val >= 0; curr_val--)
	{
		if (dp[curr_val] <= w)
		{
			ans = curr_val; 
			break;
		}
	}
	cout << ans << "\n";
}

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

int main()
{
	vector<vector<int>> A( 3, vector<int>( 3 ) );
	for( int i = 0; i < 3; i++ ) {
		for( int j = 0; j < 3; j++ ) {
			cin >> A[i][j];
		}
	}
	int N;
	cin >> N;
	vector<int> b( N );
	for( int i = 0; i < N; i++ ) {
		cin >> b[i];
	}

	for( int i = 0; i < N; i++ ) {
		int bb = b[i];
		for( int j = 0; j < 3; j++ ) {
			for( int k = 0; k < 3; k++ ) {
				if( A[j][k] == bb ) {
					A[j][k] = -1;
					bb = -1;
					break;
				}
			if( bb < 0 ) break;
			}
		}
	}

	string ans = "No";
	for( int i = 0; i < 3; i++ ) {
		int flag = 0;
		for( int j = 0; j < 3; j++ ) {
			if( A[i][j] >= 0 ) {
				flag = 1;
			}
		}
		if( flag == 0 ) {
			ans = "Yes";
			break;
		}
	}
	for( int i = 0; i < 3; i++ ) {
		int flag = 0;
		for( int j = 0; j < 3; j++ ) {
			if( A[j][i] >= 0 ) {
				flag = 1;
			}
		}
		if( flag == 0 ) {
			ans = "Yes";
			break;
		}
	}
	int flag = 0;
	for( int i = 0; i < 3; i++ ) {
		if( A[i][i] >= 0 ) {
			flag = 1;
		}
	}
	if( flag == 0 ) {
			ans = "Yes";
	}
	flag = 0;
	for( int i = 0; i < 3; i++ ) {
		if( A[i][2 - i] >= 0 ) {
			flag = 1;
		}
	}
	if( flag == 0 ) {
			ans = "Yes";
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

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

vector<vector<int>> Edge(100005);
vector<long long> directly_parent(100005);
vector<long long> directly_parent_child(100005);
vector<bool> have_parent(100005);
vector<bool> seen(100005);
long long ans = 1;

void dfs(int from,int parent,long long K){
    seen.at(from) = true;
    if(have_parent.at(parent)) directly_parent.at(parent) = 2;
    //if(have_parent.at(from)) directly_parent.at(parent) = 1;
    if(parent != -1) ans *= K-directly_parent.at(parent)-directly_parent_child.at(parent);
    else ans = K;
    //cout << from << " " << parent << " " << ans << endl;
    ans %= MOD;
    for(int to : Edge.at(from)){
        if(seen.at(to)) continue;
        have_parent.at(to) = true;
        directly_parent.at(parent) = 1;
        
        dfs(to,from,K);
        directly_parent_child.at(from)++;
    }
}


int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;long long K;cin >> N >> K;
    for(int i = 0;i<N-1;i++){
        int a,b;cin >> a >> b;
        a--;b--;
        Edge.at(a).push_back(b);
        Edge.at(b).push_back(a);
    }

    dfs(0,0,K);

    cout << ans % MOD << endl;

}


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

int main(int argc, char** argv){
	int N, M;
  	cin >> N >> M;
  	int K[N][M];
  
    for(int cnt0=0; cnt0<N; cnt0++){
      for(int cnt1=0; cnt1 < M; cnt1++){
      	K[cnt0][cnt1] = 0; 
      }
    }
  
  	for(int cnt0=0; cnt0<N; cnt0++){
      int tmp_K = 0;
      cin >> tmp_K;
      for(int cnt1=0; cnt1 < tmp_K; cnt1++){
      	cin >> K[cnt0][cnt1]; 
      }
    }
/*
  	for(int cnt0=0; cnt0<N; cnt0++){
      for(int cnt1=0; cnt1 < M; cnt1++){
      	cout << K[cnt0][cnt1] << " "; 
      }
      cout <<endl;
    }
	 cout <<endl;
*/	
  	int flag[M+1];
	for(int cnt0=0; cnt0<M+1; cnt0++) flag[cnt0] = 0; 
/*
  	for(int cnt0=0; cnt0<M+1; cnt0++) cout << flag[cnt0] << " ";
  	cout << endl;
  	cout <<endl;
*/  
  	for(int cnt0=0; cnt0<N; cnt0++){
      for(int cnt1=0; cnt1 < M; cnt1++){
      	flag[K[cnt0][cnt1]]++; 
      }
    }  
/*
  	for(int cnt0=0; cnt0<M+1; cnt0++) cout << flag[cnt0] << " ";
  	cout << endl;
   cout <<endl;
*/
  	int ans=0;
	for(int cnt0=1; cnt0<M+1; cnt0++) if(flag[cnt0] == N) ans++; 

  	printf("%d", ans);
	return 0;
}

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

#define N 100001
typedef long long ll;
const int MOD = 1e9 + 7;

inline int read() {
  int s = 0; char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return s;
}

int n;
int a[N];
ll fac[N], Inv[N];

inline void init() {
  Inv[1] = 1;
  for (int i = 2; i <= n; i++) {
    Inv[i] = (MOD - MOD / i) * Inv[MOD % i] % MOD;
  }
  for (int i = 2; i <= n; i++) {
    (Inv[i] += Inv[i - 1]) % MOD;
  }
}

int main() {
  n = read();
  init();
  for (int i = 1; i <= n; i++) a[i] = read();
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ll tmp = (Inv[i] + Inv[n - i + 1] - 1) % MOD;
    tmp *= a[i];
    tmp %= MOD;
    ans = (ans + tmp) % MOD;
  }
  ll res = 1;
  for (int i = 1; i <= n; i++) res = res * i % MOD;
  printf("%lld\n", ans * res % MOD);
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main(void){
    string s;
    int a, b;
    stack<int> st;

    while(cin >> s){
        if(s == "+"){
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(a + b);
        } else if(s == "-"){
            b = st.top(); st.pop();
            a = st.top(); st.pop();
            st.push(a - b);
        } else if(s == "*"){
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(a * b);
        } else {
            st.push(atoi(s.c_str()));
        }
    }
    cout << st.top() << endl;
}

Measured memory_bytes: 3164
while True:
    n=int(input())
    m,smin,smax=0,1000,-1
    if n==0:break
    for i in range(n):
        s=int(input())
        smin=min(smin,s)
        smax=max(smax,s)
        m += s
    print((m-smin-smax)//(n-2))


Measured memory_bytes: 5600
def pow_mod(n, k, m):
    if k == 0:
        return 1
    if k & 1:
        return (pow_mod(n, k - 1, m) * n % m) % m
    else:
        return (pow_mod(n, k // 2, m) ** 2) % m

n = int(input())
aaa = list(map(int, input().split()))
mod = 10 ** 9 + 7
aaa.sort()
if n % 2 == 0:
    for i in range(0, n, 2):
        if aaa[i] != aaa[i + 1]:
            print(0)
            exit()
    print(pow_mod(2, (n // 2), mod))
else:
    for i in range(1, n, 2):
        if aaa[i] != aaa[i + 1]:
            print(0)
            exit()
    print(pow_mod(2, ((n - 1) // 2), mod))

Measured memory_bytes: 20528
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n, k = MAP()
a = LIST()

def mpow(a, n):
    if n == 0:return 1
    if n == 1:return a%MOD
    if n%2 == 1:return (a%MOD * mpow(a, n-1)%MOD)%MOD
    t = mpow(a, n//2)
    return (t*t)%MOD

fac = [1]*(n+1)
inv_fac = [1]*(n+1)
for i in range(n):
    fac[i+1] = (fac[i]*(i+1))%MOD
inv_fac[n] = mpow(fac[n], MOD-2)
for i in range(n, 0, -1):
    inv_fac[i-1] = (inv_fac[i]*i)%MOD

def cmb(n, r):
    if n == 0 and r == 0:return 1
    if n<r or n<0:return 0
    return (fac[n]*(inv_fac[r]*inv_fac[n-r])%MOD)%MOD
 
a.sort(reverse = True)
res = 0
for i in range(n-k+1):
    res += (a[i]*cmb(n-i-1, k-1))%MOD
    res = res%MOD
 
a.reverse()
for i in range(n-k+1):
    res -= (a[i]*cmb(n-i-1, k-1))%MOD
    res = res%MOD
 
print(res)

Measured memory_bytes: 88940
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()


int main(void){
  int m, n ;
  while(cin >> m >> n , m + n ){
    vi ans(m+n+1);
    rep(i,n+m)cin>>ans[i];
    ans[n+m]=0;
    sort(all(ans));
    int md = 0;
    rep(i,n+m)md = max(md,ans[i+1]-ans[i]);
    cout << md << endl;
  }
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	string str;
	std::cin >> str;
	for (size_t i = 0; i < str.size(); i++) {
		if (str[i] == '1') {
			std::cout << "9";
		}
		else {
			std::cout << "1";
		}
	}
	std::cout << '\n';
	return 0;
}


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

int main()
{
	std::vector<long long> A;
	std::vector<long long> B;
	int N = 0, M = 0, K = 0;

	std::cin >> N >> M >> K;;

	A.resize(N + 1);
	B.resize(M + 1);

	int readingTime = 0;

	// A.at(index)にはindex冊目までの合計時間を記録する
	for (size_t index = 1; index < A.size(); ++index)
	{
		std::cin >> readingTime;
		A.at(index) = A.at(index - 1) + readingTime;
	}

	// B.at(index)もAと同様
	for (size_t index = 1; index < B.size(); ++index)
	{
		std::cin >> readingTime;
		B.at(index) = B.at(index - 1) + readingTime;
	}

	// 答えを表す変数answer
	size_t answer = 0;

	// Aを0番目のコンテナからKを超える値があるコンテナの直前まで走査する。
	// B.at(j) <= K - A.at(index)が成り立つような整数jの最大値を探す。
	// index + j の最大値が求める値となる。
	for (size_t index = 0; index < A.size(); ++index)
	{
		if (A.at(index) > K)
		{
			break;
		}

		while (B.at(M) > K - A.at(index))
		{
			--M;
		}

		answer = std::max(answer, index + M);
	}
	
	std::cout << answer << std::endl;
}

Measured memory_bytes: 6020
let rec p = function
  |[]->false|"the"::_->true|"this"::_->true|"that"::_->true|_::t->p t

let encode l =
  List.map (fun s -> String.map (fun c -> if c>='a'&&c<='z' then char_of_int (((int_of_char c - 97 + 1) mod 26) + 97) else c) s) l

let () =
  let rec doit () =
    let l = Str.split (Str.regexp " ") (read_line ()) in
    let rec g l =
      if p l then print_endline (String.concat " " l)
      else g (encode l)
    in
    doit(g l)
  in
  try doit () with _ -> ()

Measured memory_bytes: 2052
#include <iostream>
#include <string>

using namespace std;

struct Process {
	string name;
	int time;
};

Process queue[200000];
int front;
int rear;

bool isEmpty() {
	return front == rear;
}

void enqueue(Process p) {
	queue[rear] = p;
	if (rear == 200000 - 1) {
		rear = 0;
	}
	else {
		rear++;
	}
}

Process dequeue() {
	Process temp;
	temp = queue[front];
	if (front == 200000 - 1) {
		front = 0;
	}
	else {
		front++;
	}
	return temp;
}

int main() {
	front = 0;
	rear = 0;

	int n;
	int q;
	Process p;

	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		cin >> p.name >> p.time;
		enqueue(p);
	}

	int timeElapsed = 0;

	while (isEmpty() == false) {
		p = dequeue();
		if (p.time <= q) {
			timeElapsed += p.time;
			cout << p.name << " " << timeElapsed << endl;
		}
		else {
			timeElapsed += q;
			p.time -= q;
			enqueue(p);
		}
	}

	return 0;
}

Measured memory_bytes: 6676
// 参考: https://atcoder.jp/contests/abc161/submissions/12499845
// Kagemekaさんのおかげでfmt.Scan()でスライスを活用できることを知れました！

package main

import (
	"fmt"
)

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

	var things []float64 = make([]float64, requires[0])
	var sumNum float64 = 0
	for i := 0; i < requires[0]; i++ {
		fmt.Scan(&things[i])
		sumNum += things[i]
	}

	var popularNum int = 0
	// なんか条件は小数点切り捨てじゃいけないらしい
	// 急がば回れ
	var requirement float64 = sumNum / float64(4*requires[1])
	for _, num := range things {
		if num >= requirement {
			popularNum++
		}
	}

	if popularNum >= requires[1] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define re register int
#define F(x,y,z) for(re x=y;x<=z;x++)
#define FOR(x,y,z) for(re x=y;x>=z;x--)
typedef long long ll;
#define I inline void
#define IN inline int
#define C(x,y) memset(x,y,sizeof(x))
#define STS system("pause")
template<class D>I read(D &res){
	res=0;register D g=1;register char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')g=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		res=(res<<3)+(res<<1)+(ch^48);
		ch=getchar();
	}
	res*=g;
}
char c[1010000];
int n,m,x,a[1010000],b[1010000],s[1010000],ans;
int main(){
	read(n);
	cin>>c+1;
	F(i,1,n)a[i]=c[i]-'0';
	if(n==1){
		cout<<c[1];return 0;
	}
	F(i,1,n-1)b[i]=abs(a[i]-a[i+1]);
	n--;
	F(i,1,n)a[i]=b[i];
	m=0;
	F(i,1,n)if(a[i]==1)m=1;
	if(!m){
		F(i,1,n)a[i]>>=1;
	}
	F(i,1,n){
		x=i;
		while(!(x&1))s[i]++,x>>=1;
		s[i]+=s[i-1];
	}
	ans=0;
	F(i,1,n){
		ans^=(s[n-1]-s[i-1]-s[n-i])?0:(a[i]&1);
	}
	if(!m)ans<<=1;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 13056
N=raw_input()
N = [int(i) for i in N.split()]
m,n = (N[1],N[0]) if N[1] > N[0] else (N[0],N[1])
def gcd(m, n):
    if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n)
print gcd(m,n)

Measured memory_bytes: 4648
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)

def main():
    N = int(input())
    edge = [[] for _ in range(N)]
    MOD = 10**9+7
    
    for _ in range(N-1):
        a,b = map(int,input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
        
    dp = [[1]*2 for _ in range(N)] 
    
    def col(now,prev):
        for fol in edge[now]:
            if fol == prev:
                continue
            col(fol,now)
            dp[now][0] *= (dp[fol][0]+dp[fol][1])
            dp[now][0] %= MOD
            dp[now][1] *= dp[fol][0]
            dp[now][1] %= MOD
        return
    
    col(0,-1)
    print(sum(dp[0])%MOD)

if __name__ == "__main__":
    main()


Measured memory_bytes: 129432
#include <bits/stdc++.h>
using namespace std;
vector<int> dx= {1, 0, -1, 0};
vector<int> dy = {0, 1, 0, -1};
vector<int> fr(100001,0);
vector<int> bl(100001,0);
vector<int> siz(100001,1);
void init(int n){
    for(int i=0; i<n+1; i++){
        fr[i]=i;
    }
    return;
}
int find(int x){
    if(fr.at(x)==x){
        return x;
    }
    return fr[x]=find(fr[x]);
}
void unite(int x, int y){
    x=find(x);
    y=find(y);
    if(x!=y){
        fr[x]=y;
        siz.at(y) += siz.at(x);
    }
    return;
}
int main(){
    int n, m, k;
    cin>>n>>m>>k;
    init(n);
    vector<int> fin(n+1);
    vector<int> block(n+1);
    for(int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        unite(a,b);
        fin.at(a)++;
        fin.at(b)++;
    }
    for(int i=0; i<k; i++){
        int c,d;
        cin>>c>>d;
        if(find(c)==find(d)){
            block.at(c)++;
            block.at(d)++;
        }
    }
    for(int i=1; i<n+1; i++){
        cout<<siz.at(find(i))-1-fin.at(i)-block.at(i);
        cout<<(i!=n ?" ":"\n");
    }
}

Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  if(a[0]==5&&a[1]==5&&a[2]==7)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
/***     
 * When I wrote this
 * only God & I understood
 * what I was doing
 * Now, God only knows 
 /***/ 
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
typedef long long ll;
#define rep(i,a,n) for (int i=a;i<=n;i++)/*i为循环变量，a为初始值，n为界限值，递增*/
#define per(i,a,n) for (int i=a;i>=n;i--)/*i为循环变量， a为初始值，n为界限值，递减*/
const int mod = 1e9+7;
using namespace std;
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
//fixed<< setprecision(2)
ll p[200005];
ll powmod(ll x,ll n)
{
    ll ans=1;
    while(n)
    {
        if(n&1)ans=(ans*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }return ans;
}
ll ccc(ll n,ll m)
{
    ll x=p[n];
    ll y=(p[m]*p[n-m])%mod;
    return (x*powmod(y,mod-2))%mod;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    p[0]=1;
    for(int i=1;i<200005;i++)p[i]=(p[i-1]*i)%mod;
    ll n,m,a,b;
    while(cin>>n>>m>>a>>b)
    {
       ll ans=0;
       for(int i=b+1;i<=m;i++)
       {
           ll tmp=(ccc(i-1+n-a-1,n-a-1)*ccc(m-i+a-1,m-i))%mod;
           ans=(ans+tmp)%mod;
       }cout<<ans<<'\n';
    }
}

Measured memory_bytes: 4764
package main

import "fmt"

func main() {
	var n, t int
	fmt.Scan(&n)
	c := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&t)
		if i%2 == 1 {
			continue
		}
		if t%2 == 1 {
			c++
		}
	}
	fmt.Println(c)

}


Measured memory_bytes: 1768
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int h=sc.nextInt();
        int n=sc.nextInt();
  		int b=0;

  		int[] a=new int[n];
		for(int c=0;c<n;c++){
    		a[c]=sc.nextInt();
          	b+=a[c];
    	}
    
 	if(b>=h){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }

    
    }
}

Measured memory_bytes: 49064
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <stdlib.h>
#include <numeric>


int main(){
	int h, w, be[2000] = {}, en[2000] = {}, wbe = 0, wen = 0, max = 0;
	std::string str[2000];
	std::cin >> h >> w;
	for(int i = 0; i < h; i++){
		std::cin >> str[i];
	}
	for(int i = 0; i < h; i++){
		wbe = 0;
		wen = 0;
		for(int j = 0; j < w; j++){
			if(str[i][j] == '#'){
				continue;
			}
			if(en[j] == 0 || en[j] < i){
				be[j] = i;
				en[j] = i;
				for(int k = i; k < h; k++){
					if(str[k][j] == '#'){
						break;
					}else{
						en[j] = k;
					}
				}
			}
			if(wen == 0 || wen < j){
				wbe = j;
				wen = j;
				for(int k = j; k < w; k++){
					if(str[i][k] == '#'){
						break;
					}else{
						wen = k;
					}
				}
			}
			max = std::max(wen - wbe + 1 + en[j] - be[j], max);
		}
	}
	std::cout << max << std::endl;
	return 0;
}


Measured memory_bytes: 4352
import math
A,B,H,M = map(int, input().split())

AngA = 30*H + 0.5*M
AngB = 6*M

AngC = AngA - AngB

C = math.sqrt(A*A + B*B - 2*A*B* math.cos(math.radians(AngC)))
print(C)

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

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);
const ll MOD = 1e9 + 7;

int main() {
    fastio;

    ll a, b;
    cin >> a >> b;
    cout << (a-1) * (b-1) << "\n";
    return 0;
}


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

int main(void)
{
	int n,k,i,j;
	cin>>n>>k;
	vector<int> A(n);
	for(i=0;i<n;i++)
	cin>>A[i];
	vector <bool> dp(k+1);
	for(i=0;i<=k;i++)
	{
		for(j=0;j<n;j++)
		{
			if(i>=A[j] && dp[i-A[j]]==false)
			dp[i]=true;
		}
		
	}
		if(dp[k]==true)
		cout<<"First";
		else cout<<"Second";
	
}

Measured memory_bytes: 3608
/*-In the name of God-
 
Author : Syed Mujtaba
Seek knowledge from the Cradle to the Grave !!
https://www.linkedin.com/in/syed-mujtaba
*/

#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
#define MAXN            200064
// #define mod             1000000007  //998244353 // 1e9 + 7
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL
#define mt              make_tuple
#define eps             1e-6
#define endl            '\n'
#define test            int T_T; cin>>T_T; while(T_T--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int mod;
int xyp(int x,int y){int res=1;while(y>0){if(y%2==1) res=(res*x)%mod;x=(x*x)%mod;y/=2;}return res%mod;}

signed main()
{
   fast_io
   int n;
   cin >> n;
   string s;
   cin >> s;
   int u = 0;
   for(auto z : s)
   {
      if(z == '1')
      {
         u++;
      }
   }
   mod = u+1;
   int mo1, mo2;
   // int x[100] = {'\0'};
   int mo = 0;
   for(int i = 0; i < n; i++)
   {
         if(s[i] == '1')
            mo = (mo + xyp(2, (n - 1 - i)))%mod;
   }
   mo1 = mo;
   mod = u - 1;
   mo = 0;
   // cout << mod << "!!\n";
   if(mod != 0)
   for(int i = 0; i < n; i++)
   {
         if(s[i] == '1')
            mo = (mo + xyp(2, (n - 1 - i)))%mod;
         mo2 = mo;
   }
   else 
      mo2 = 0;
   // cout << mo2 << "!!\n";
   
   for(int i = 0; i < n; i++)
   {
      int bits = u;
      int mo;
      if(s[i] == '1')
      {  
         bits--;
         mo = mo2;
         if(bits == 0){
            cout << 0 << endl;
         }
         else
         {
            mod = bits;
            mo = (mo + bits + bits - xyp(2, (n - 1 - i)))%bits;
         
         int ac = 1;
         while(mo > 0)
         {
            mo %= __builtin_popcountll(mo);
            ac++;
         }
         cout << ac << endl;
         }
         
      }
      else
      {
         bits++;
         mo = mo1;
         mod = bits;
         mo = (mo + xyp(2, n - i - 1))%bits;
         int ac = 1;
         while(mo > 0)
         {
            mo %= __builtin_popcountll(mo);
            ac++;
         }
         cout << ac << endl;

         
      }

   }





}


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

int main(){
  int a,b;
  cin >> a >> b;
  int ans = (b+a-3)/(a-1);
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
  double v,a,b;
  int N;
  cin>>N;
  priority_queue<double> Q;

  for(int i=0;i<N;i++){
    cin>>v;
    Q.push(v*(-1));
  }

  while(Q.size()!=1){
    a=Q.top(); Q.pop();
    b=Q.top(); Q.pop();
    Q.push((a+b)/2);
  }
  cout<<Q.top()*(-1)<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
 
using namespace std;
typedef long long ll;
int n;
int a[1505][1505];
char ss[1505];
int L[1505][1505],R[1505][1505];
int f[1505][1505];
ll ans;
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%s",&ss[1]);
		for(int j=1;j<=n;j++) {
			a[i][j] = (ss[j]=='#'?0:ss[j]-'0');
		}
	}
	for(int i=n;i>=1;i--) {
		for(int j=n;j>=1;j--) {
			if(a[i][j]) {
				bool mk1 = a[i+1][j] , mk2 = a[i][j+1];
				if( (!mk1) && (!mk2) ) {
					L[i][j] = R[i][j] = j;
					f[i][j] = 0;
					for(int k=i+1;k<=n;k++) L[k][j] = n+1,R[k][j] = 0;
				} else if(!mk1) {
					f[i][j] = f[i][j+1];
					L[i][j] = j; R[i][j] = R[i][j+1];
					for(int k=i+1;k<=n;k++) L[k][j] = L[k][j+1] , R[k][j] = R[k][j+1];
				} else if(!mk2) {
					f[i][j] = f[i+1][j];
					L[i][j] = R[i][j] = j;
				} else {
					int msr = 0;
					int yoo = f[i][j+1] + f[i+1][j];
					L[i][j] = j; R[i][j] = R[i][j+1];
					for(int k=i+1;k<=n;k++) {
						if( (L[k][j+1]>msr) && (L[k][j+1]<=R[k][j])  ) yoo -= f[k][L[k][j+1]];
						msr = max(msr,R[k][j]);
						L[k][j] = min(L[k][j],L[k][j+1]);
						R[k][j] = max(R[k][j],R[k][j+1]);
					}
					f[i][j] = yoo;
				}
				ans += 1ll * f[i][j] * a[i][j];
				f[i][j] += a[i][j];
			} else L[i][j] = n+1,R[i][j] = 0;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 35584