akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	// Code for A - Cookie Exchanges
	var A, B, C int
	fmt.Scanf("%d %d %d", &A, &B, &C)

	if A == B && B == C {
		if A%2 == 0 {
			fmt.Println("-1")
		} else {
			fmt.Println("0")
		}
	} else {
		var i int = 0
		for {
			if A%2 != 0 || B%2 != 0 || C%2 != 0 {
				fmt.Println(i)
				break
			}
			tempA := (B + C) / 2
			tempB := (A + C) / 2
			tempC := (A + B) / 2
			A = tempA
			B = tempB
			C = tempC
			i++
		}
	}
}


Measured memory_bytes: 1832
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private final static String NEGATIVE = "NO\n";
	private final static String AFFIRMATIVE = "YES\n";

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in),1024);
		int number = Integer.parseInt(br.readLine());
		int sides[] = new int[3];
		StringTokenizer tknz;
		StringBuilder builder = new StringBuilder();

		for (; 0 < number; number--) {
			tknz = new StringTokenizer(br.readLine());
			for (int i = 0; i < 3; i++) {
				sides[i] = Integer.parseInt(tknz.nextToken());
			}
			Arrays.sort(sides);
			if (sides[0] * sides[1] * sides[2] % 60 != 0) {
				builder.append(NEGATIVE);
			} else if (Math.pow(sides[0], 2) + Math.pow(sides[1], 2) != Math.pow(sides[2], 2)) {
				builder.append(NEGATIVE);
			} else {
				builder.append(AFFIRMATIVE);
			}
		}
		System.out.print(builder);
	}
}

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

int main() {
	int a, b, r;
	cin >>a>> b;
	if (a < b)swap(a, b);
	r = a%b;
	while (r != 0) {
		a = b;
		b = r;
		r = a%b;
	}
	cout << b << endl;
	return 0;
}

			

Measured memory_bytes: 3044
import math

class xx:
    val = 0
    num = 0

    def __init__(self,v,n):
        self.val,self.num = v,n

while True:
    try:
        n = eval(input().strip())

        arr = list(map(int,input().strip().split()))

        one = {}
        two = {}
        for i in range(0,n,2):
            if arr[i] in one.keys():
                one[arr[i]] = one[arr[i]] + 1
            else:
                one[arr[i]] = 1

        for i in range(1,n,2):
            if arr[i] in two.keys():
                two[arr[i]] = two[arr[i]] + 1
            else:
                two[arr[i]] = 1

        # print(one)
        # print(two)
        one = sorted(one.items(),key=lambda x:x[1],reverse=True)
        two = sorted(two.items(), key=lambda x: x[1], reverse=True)
        # print(one)
        # print(two)

        if one[0][0] != two[0][0]:
            sum = n // 2 - one[0][1]
            sum += n // 2 - two[0][1]
            print(sum)
        elif one[0][0] == two[0][0] and one[0][1] == two[0][1] and one[0][1] == n // 2:
            print(n // 2)
        elif one[0][0] == two[0][0]:
            len1 = len(one)
            len2 = len(two)

            if len1 >= 2 and len2 >= 2:
                sum = n // 2 - one[0][1]
                sum += n // 2 - two[1][1]

                sum2 = n // 2 - one[1][1]
                sum2 += n // 2 - two[0][1]

                print(min(sum,sum2))
            elif len1 == 1 and len2 >= 2:
                sum = n // 2 - one[0][1]
                sum += n // 2 - two[1][1]
                print(sum)
            elif len1 >= 2 and len2 == 1:
                sum = n // 2 - one[1][1]
                sum += n // 2 - two[0][1]
                print(sum)
    except:
        break

Measured memory_bytes: 19676
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		double r = scanner.nextDouble();
		double m=r*r*Math.PI;
		double e=2*r*Math.PI;
		System.out.printf( "%.7f %.7f",m,e  ) ;

	}

}



Measured memory_bytes: 28276
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<ll,ll> PII;
typedef vector<ll> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+5;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll n,x,y;
void solve(){
	cin>>n>>x>>y;
	vector<int> ans(n);
	rep(i,1,n)ans[i] = n-i;
	rep(i,1,x+1){
		for(int j=y;j<=n;j++){
			ans[j-i]--;
			ans[j-i-(y-x-1)]++;
		}
		for(int j=x+1;j<y;j++){
			if(x-i+1+y-j<j-i){
				ans[j-i]--;
				ans[x-i+1+y-j]++;
			}
		}
	}
	for(int i=x+1;i<y;i++){
		for(int j=i+1;j<=n;j++){
			if(i-x+1+abs(j-y)<j-i){
				ans[j-i]--;
				ans[i-x+1+abs(j-y)]++;
			}
		}
	}
	rep(i,1,n)cout<<ans[i]<<"\n";
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}




Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,k,ans=0,dis;
  cin >> n >>k;
  vector<ll> x(n);
  for(int i=0;i<n;i++){
    cin >> x[i];
    dis = min(x[i],k-x[i]);
    ans += dis*2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<numeric>
#include<climits>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<regex>
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }
using namespace std;

int main(void) {
	int N, A, B, C, D;
	string S;
	cin >> N >> A >> B >> C >> D >> S;
	A--; B--; C--; D--;

	auto can_reach = [&](int start, int end) {
		for (int i = start; i + 1 <= end; i++)
		{
			if (S[i] == '#' && S[i+1] == '#') {
				return false;
			}
		}
		return true;
	};

	if (!can_reach(A, C) || !can_reach(B, D)) {
		cout << "No" << endl;
		return 0;
	}

	if (C > D) {
		for (int i = B; i <= D; i++)
		{
			if (S[i-1] == '.' && S[i] == '.' && S[i+1] == '.') {
				cout << "Yes" << endl;
				return 0;
			}
		}

		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=205,INF=1<<30;

ll pat[MAX][MAX];

void make(){
    pat[0][0]=1;
    for(int i=1;i<=50;i++){
        for(int j=0;j<=i;j++){
            if(j) pat[i][j]+=pat[i-1][j-1];
            pat[i][j]+=pat[i-1][j];
        }
    }
}

ll comb(ll a,ll b){
    if(a<b) return 0;
    return pat[a][b];
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    make();
    
    int N,K,S,T;cin>>N>>K>>S>>T;
    
    if(S&(~T)){
        cout<<0<<endl;
        return 0;
    }
    vector<int> A;
    
    for(int i=0;i<N;i++){
        int a;cin>>a;
        
        if((S&a)!=S) continue;
        if((a|T)!=T) continue;
        
        A.push_back(a);
    }
    
    N=si(A);
    
    for(int a:A) a-=S;
    T-=S;
    S=0;
    
    vector<int> bi;
    for(int i=0;i<20;i++) if(T&(1<<i)) bi.push_back(i);
    for(int &a:A){
        int to=0;
        for(int i=0;i<si(bi);i++){
            if(a&(1<<bi[i])) to+=(1<<i);
        }
        a=to;
    }
    T=(1<<si(bi))-1;
    
    int L=si(bi);
    
    if(L==0){
        ll res=0;
        for(int j=1;j<=K;j++){
            res+=comb(N,j);
        }
        cout<<res<<endl;
        return 0;
    }
    
    if(K==1){
        cout<<0<<endl;
        return 0;
    }
    
    ll res=0;
    
    vector<ll> sum(L+1);
    
    for(int i=0;i<N;i++){
        for(int bit=0;bit<(1<<L);bit++){
            int cnt=0;
            for(int j=i+1;j<N;j++){
                if(((~(A[i]^A[j]))&bit)==bit) cnt++;
            }
            
            for(int j=0;j<K;j++){
                sum[__builtin_popcount(bit)]+=comb(cnt,j);
            }
        }
    }
    
    for(int j=0;j<=L;j++){
        if(j&1) res-=sum[j];
        else res+=sum[j];
    }
    
    cout<<res<<endl;
    
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n,k; cin >>n >> k;
  string s; cin >> s;
  s[k-1]+=32;
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <math.h>
#include <bits/stdc++.h>
#include <string>
#define pb          push_back
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353
#define PI          3.141592653589
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define MAX 1e18
#define MIN -1e9
#define ll long long
#define ull unsigned long long
#define ld long double
#define all(x) x.begin(),x.end()
#define rep(i, l, r) for (ll i = (l); i < (r); i++)
#define repb(i, r, l) for (ll i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define cl(x) (int)ceil((double)x/2);
#define fl(x) (int)floor((double)x/2);
#define watch(x) cout << (#x) << " is " << (x) << endl
using namespace std;
//cout << fixed << setprecision(13) << x;
bool cmp(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second < b.second);
}

bool mod(double a,double b)
{
    return a/b - floor(a/b);
}

int logb(int base, int x)
{
    return (log(x) / log(base));
}

void sortString(string &str)
{
    sort(str.begin(), str.end());
}

int lcm(int a,int b)
{
    return (a*b)/__gcd(a,b);
}

bool find(ll x,ll a[],ll n)
{
    rep(i,0,n)
    if(a[i]==x)
        return true;
    return false;
}

//floor(log10(N)) + 1;
//swap two no.		a ^= b; b ^= a; a ^= b;
// to_string(s)  to convert the string to int
//x ^ ( x & (x-1)) : Returns the rightmost 1 in binary representation of x.
//x&(-x) : Returns the rightmost 1 in binary representation of x.
//x | (1 << n) : Returns the number x with the nth bit set.
int btd(ll n)
{
    ull num = n,dec_value = 0,base = 1,temp = num;
    while (temp)
    {
        int last_digit = temp % 10;
        temp = temp / 10;

        dec_value += last_digit * base;

        base = base * 2;
    }
    return dec_value;
}

bool isPowerOfTwo (int x) { return x && (!(x&(x-1))); }


int main()
{
    FLASH
   ll n;
   cin>>n;
   if(n>=30)
    cout<<"Yes"<<endl;
   else
    cout<<"No";
   return 0;
}


Measured memory_bytes: 3640
import typing


class DSU:
    '''
    Implement (union by size) + (path compression)
    Reference:
    Zvi Galil and Giuseppe F. Italiano,
    Data structures and algorithms for disjoint set union problems
    '''

    def __init__(self, n: int = 0):
        self._n = n
        self.parent_or_size = [-1] * n

    def merge(self, a: int, b: int) -> int:
        assert 0 <= a < self._n
        assert 0 <= b < self._n

        x = self.leader(a)
        y = self.leader(b)

        if x == y:
            return x

        if -self.parent_or_size[x] < -self.parent_or_size[y]:
            x, y = y, x

        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x

        return x

    def same(self, a: int, b: int) -> bool:
        assert 0 <= a < self._n
        assert 0 <= b < self._n

        return self.leader(a) == self.leader(b)

    def leader(self, a: int) -> int:
        assert 0 <= a < self._n

        if self.parent_or_size[a] < 0:
            return a

        self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]

    def size(self, a: int) -> int:
        assert 0 <= a < self._n

        return -self.parent_or_size[self.leader(a)]

    def groups(self) -> typing.List[typing.List[int]]:
        leader_buf = [self.leader(i) for i in range(self._n)]

        result = [[] for _ in range(self._n)]
        for i in range(self._n):
            result[leader_buf[i]].append(i)

        return list(filter(lambda r: r, result))


# https://atcoder.jp/contests/practice2/tasks/practice2_a
def main() -> None:
    import sys

    n, q = map(int, sys.stdin.readline().split())
    dsu = DSU(n)

    for _ in range(q):
        t, u, v = map(int, sys.stdin.readline().split())
        if t == 0:
            dsu.merge(u, v)
        if t == 1:
            if dsu.same(u, v):
                print(1)
            else:
                print(0)


if __name__ == '__main__':
    main()

Measured memory_bytes: 13220
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nab = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ar = Array.ConvertAll(ReadLine().Split(' '), long.Parse);
        ar = ar.OrderByDescending(v => v).ToArray();
        var max = ar.Take(nab[1]).Average(v=>(double)v);
        WriteLine(max.ToString("0.#######"));
        var ct = ar.Count(v => v == ar[nab[1]-1]);
        var ctf = ar.Take(nab[1]).Count(v => v == ar[nab[1] - 1]);
        if (ctf != nab[1])
        {
            var r = ct;
            for(var i = 0; i < ctf-1; i++)
            {
                r *= ct - (i + 1);
                r /= (i + 2);
            }
            WriteLine(r);
            return;
        }
        var res = 0L;
        for(var i = nab[1]; i <= Min(ct,nab[2]); i++)
        {
            var pro = (long)ct;
            for(var j = 0; j < i-1; j++)
            {
                pro *= ct - (j + 1);
                pro /= (j + 2);
            }
            res += pro;
        }
        WriteLine(res);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13652
//*INDENT-OFF*
#include<bits/stdc++.h>
using namespace std;
template<typename V>
bool tomin(V&x,V y){if(y<x){x=y;return true;}return false;}
template<typename V>
bool tomax(V&x,V y){if(x<y){x=y;return true;}return false;}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
#pragma GCC optimize(3)
#define lowbit(x) ((x)&-(x))
//*INDENT-ON*
const int M=2e6+5;
int n,A[M],B;
bool vis[M];
int main(){
    ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>A[i];
	for(int i=n;i>=1;i--){
		int res=0;
		for(int j=i+i;j<=n;j+=i)res^=vis[j];
		vis[i]=(A[i]^res);
	}
	for(int i=1;i<=n;i++)B+=vis[i];
	cout<<B<<endl;
	for(int i=1;i<=n;i++){
		if(vis[i])
			cout<<i<<(i==n?'\n':' ');
	}
	return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n, k;
  cin>>n>>k;
  if(k==1) cout<<0<<endl;
  else cout<<(n-k)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n;
	cin >> n;
	int ac = 0, wa = 0, tle = 0, re = 0;
	zip(i, 0, n)
	{
		string s;
		cin >> s;
		if (s == "AC")
			ac++;
		else if (s == "TLE")
			tle++;
		else if (s == "WA")
			wa++;
		else
			re++;
	}
	cout << "AC x " << ac << en;
	cout << "WA x " << wa << en;
	cout << "TLE x " << tle << en;
	cout << "RE x " << re << en;


	return 0;
}



Measured memory_bytes: 3660
n = gets.to_i
bob, alice = [], []
cards = gets.chomp.split.map(&:to_i).sort

for i in 1..n do
    if i % 2 == 1
        bob.push(cards.pop)
    else
        alice.push(cards.pop)
    end
end

puts bob.inject(:+) - alice.inject(:+)

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

int main()
{
    string s;
    cin >> s;
    if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
int n,m;
int main(){
  cin>>n>>m;
  prin((n-1)*(m-1));

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,j,tmp;
  int mt[10];
  for(i=0;i<10;i++){
    scanf("%d",&mt[i]);
  }

  for(i=9;i>=0;i--){
    for(j=0;j<i;j++){
      if(mt[j]<mt[j+1]){
	tmp=mt[j];
	mt[j]=mt[j+1];
	mt[j+1]=tmp;
      }
    }
  }
  printf("%d\n%d\n%d\n",mt[0],mt[1],mt[2]);
  return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


int main() {
    ios_base::sync_with_stdio(false);

    int a,b;
    cin >> a >> b;
    if (b<a) cout << a-1 << endl;
    else cout << a << endl;

    return 0;   
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,w;
long long dp[100001];
int main(){
	cin>>n>>w;
	int ww[n+1],v[n+1];
	for(int i=1;i<=n;i++)
		cin>>ww[i]>>v[i];
	for(int i=1;i<=n;i++)
		for(int j=0;j+ww[i]<=w;j++)
			dp[j]=max(dp[j],dp[j+ww[i]]+v[i]);
	long long ans=-20;
	for(int i=0;i<=w;i++)ans=max(ans,dp[i]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
def sum_(a):
    ans=0
    while a!=0:
        ans+=a%10
        a//=10
    return ans

N,A,B=list(map(int,input().split()))

arr=[0 for i in range(37)]
for i in range(1,N+1):
    arr[sum_(i)]+=i

print(sum(arr[A:B+1]))

Measured memory_bytes: 3188
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long[] l = new long[n + 1];
			l[0] = 2;
			l[1] = 1;
			IntStream.rangeClosed(2, n).forEach(i -> l[i] = l[i - 1] + l[i - 2]);
			System.out.println(l[n]);
		}
	}
}


Measured memory_bytes: 28628
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
ll a[200000];
int main() {
  ll n, k, l, r, mid, cnt, left, right, mm;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  l = -1000000000000000010;
  r = 1000000000000000010;
  cnt = 0LL;
  while (l <= r) {
    cnt = 0LL;
    mid = (l + r) / 2LL;
    for (ll i = 0LL; i < n; i++) {
      left = i + 1LL;
      right = n - 1LL;
      if (a[i]) {
        while (left <= right) {
          mm = (left + right) / 2LL;
          if (mid > a[i] * a[mm]) {
            if (a[i] > 0) {
              left = mm + 1LL;
            } else {
              right = mm - 1LL;
            }
          } else if (a[i] > 0) {
            right = mm - 1LL;
          } else {
            left = mm + 1LL;
          }
        }
        if (a[i] > 0) {
          cnt += right - i;
        } else {
          cnt += n - left;
        }
      } else if (0 < mid) {
        cnt += n - i - 1LL;
      }
    }
    if (cnt < k) {
      l = mid + 1LL;
    } else {
      r = mid - 1LL;
    }
  }
  cout << r << endl;
}

Measured memory_bytes: 1792
using System;
using System.Linq;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] H = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int cnt = 0;
            int max = 0;
            for (int i = 0; i < n; i ++){
                if (H[i] >= max)
                {
                    cnt++;
                    max = H[i];
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 28084
#include <iostream>

long long int result(long long int input)
{
  long long int ans = input - 1, j, tmp;
  for (long long int i = 1; i * i <= input; i++)
  {
    if (input % i == 0)
    {
      j = input / i;
      tmp = i + j - 2;

      if (ans > tmp)
      {
        ans = tmp;
      }
    }
  }

  return ans;
}

int main()
{
  long long int a;
  scanf("%ld", &a);
  printf("%lld", result(a));
  return 0;
}


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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    char aa = a.at(0)-32;
    char bb = b.at(0)-32;
    char cc = c.at(0)-32;
    cout << aa << bb << cc << endl;

    return 0;
}

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

int main() {
	int h, w;
	cin >> h >> w;

	int c[10][10];
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
			}
		}
	}

	int a;
	int total_mc = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a;
			if (a >= 0) {
				total_mc += c[a][1];
			}
		}
	}
	
	cout << total_mc << endl;
	return 0;
}

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
//#define MOD 998244353

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

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

std::vector<int> linear_sieve_prime(int N) {

    std::vector<bool> is_prime(N, true);
    std::vector<int> primes;
    
    for (int i = 2; i < N; ++i) {
        if (is_prime[i]) {
            primes.push_back(i);
        }
        for (int p: primes) {
            int n = i * p;
            if (n >= N) {
                break;
            }
            is_prime[n] = false;
            if (i % p == 0) {
                break;
            }
        }
    }

    return primes;
}

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

    ll N;
    cin >> N;

    PRINT(N);

    ll result = 0;

    auto primes = linear_sieve_prime(1000000);

    PRINTA(primes, 0, 10);

    for (int p: primes) {
        int k = 0;
        while (N % p == 0) {
            PRINT(N);
            ++k;
            N /= p;
        }
        PRINT(p);
        PRINT(k);
        for (int i = 1; i <= k; ++i) {
            result++;
            k -= i;
        }
    }

    if (N > 1) {
        ++result;
    }

    cout << result << endl;
    return 0;
}


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



int main(){
    int n;

    cin >> n;
    int ord = 0;
    int i = 1;
    int cnt = 0;
    while(i <= n){
        if(pow(10,ord+1) <= i){
            ord ++;
        }
        if(ord%2==0){
            cnt ++;
        }
        i++;
    }
    cout << cnt << endl;

}


Measured memory_bytes: 384
# AOJ 1045: Split Up!
# Python3 2018.7.6 bal4u

while True:
	n = int(input())
	if n == 0: break
	t = list(map(int, input().split()))
	s = sum(t)
	ans = s >> 1
	if ans in t:
		print(s - 2*ans)
		continue
	a = [v for v in t if v < ans]
	S, f, Q, qlen = set(), True, [0], 1
	for v in a:
		i, k = 0, qlen
		while k:
			v2 = v + Q[i]
			k, i = k-1, i+1
			if v2 == ans:
				f = False
				break
			if v2 < ans and v2 not in S:
				S.add(v2)
				Q.append(v2)
				qlen += 1
	if f:
		while True:
			ans -= 1
			if ans == 0: break
			if ans in S: break;
	print(s - 2*ans)


Measured memory_bytes: 6788
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+8) + 9;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n;
	ld t, a; cin >> t >> a;
	ld mi = 1000000; int out = 0;
	rep1(i, n) {
		ld h; cin >> h;
		ld dif = abs(t - h * 0.006 - a);
		if (dif < mi) {
			mi = dif; out = i;
		}
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t a, b, c, d; cin >> a >> b >> c >> d;
	int64_t ans[4] = {};
	ans[0] = a * c;
	ans[1] = a * d;
	ans[2] = b * c;
	ans[3] = b * d;
	cout << max(max(ans[0], ans[1]), max(ans[2], ans[3])) << endl;

	return 0;
}

Measured memory_bytes: 3656
def update(fen, pos, value):
    size = len(fen)
    while pos < size:
        fen[pos] = max(fen[pos], value)
        pos = pos + (pos & -pos)

def query(fen, pos):
    ret  = 0
    while pos > 0:
        ret = max(ret, fen[pos])
        pos = pos - (pos & -pos)
    return ret

def main():
    N = int(input())
    H = list(map(int, input().split()))
    B = list(map(int, input().split()))
    fen = list(0 for i in range(0,N + 2))
    ans = 0
    for i in range( 0, N ):
        ret = query(fen, H[i] - 1) + B[i]
        ans = max(ans, ret)
        update(fen, H[i], ret)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 35972
#include<bits/stdc++.h>
using namespace std;
long long dp[100002][10],ans=0;
int n;
int mat[100005][3];
long long rec(int pos, int ant){
    if(dp[pos][ant]>0)return dp[pos][ant];
    if(pos==n){
        return 0;
    }
    for(int i=0;i<3;i++){
        if(ant!=i){
            dp[pos][ant]=max(rec(pos+1,i)+mat[pos][i],dp[pos][ant]);
        }

    }
    return dp[pos][ant];
}
int main(){
    cin>>n;
    memset(dp,0,sizeof dp);
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>mat[i][j];
        }
    }
    for(int i=0;i<3;i++)ans=max(rec(0,i),ans);
    cout<<ans;
}


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

int n, p, a[20020], b[20020];
pair<int, int> ps[20020];

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

  int val = 500000000;
  for(int i = 0; i < n; ++i) {
    cin >> p;
    ps[i].first = p;
    ps[i].second = val++;
  }
  sort(ps, ps + n);

  a[0] = 1;
  b[0] = ps[0].second - a[0];
  for(int i = 1; i < n; ++i) {
    int next_a = ps[i].second - b[i-1] + 1; 
    a[i] = (next_a > a[i-1] ? next_a : a[i-1] + 1);
    b[i] = ps[i].second - a[i];
  }
  for(int i = 0; i < n; ++i) cout << a[i] << (i==n-1?'\n':' ');
  for(int i = 0; i < n; ++i) cout << b[i] << (i==n-1?'\n':' ');
  return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include<string.h>
int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a==1)a=14;
    if(b==1)b=14;
    if(a>b)printf("Alice\n");
    else if(a==b)printf("Draw\n");
    else printf("Bob\n");
    return 0;
}


Measured memory_bytes: 128
n = int(input())
w = list(map(int,input().split()))
s = sum(w)
s_old = s
for i in range(n+1):
 s_new = abs(s-2*sum(w[:i]) )
 if s_new > s_old:
  print(s_old)
  exit()
 s_old = s_new
print(s_old)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    long double a, b, x, ans, pi = 3.14159265359;
    cin>>A>>B>>K;
    if(A*A*B == K){
        cout<<0<<endl;
        return 0;
    }
    a = A;
    b = B;
    x = K;
    x /= a;
    if(x*2 >= a * b){
        x = a * b - x;
        ans = atan2(a, (x * 2) / a) * 180 / pi;
        ans = 90 - ans;
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }else{
        //cout<<b<<' '<<(x * 2) / a<<endl;
        ans = atan2(b, (x * 2) / b) * 180 / pi;
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = max(a) + 1
ref = 0
ans = 10**9

while l + 1 < r:
    now = (l + r)//2
    for i in a:
        ref += 0 - -i//now - 1
        if ref > k:
            ref = 0
            l = now
            break
    else:
        ans = min(ans, now)
        ref = 0
        r = now
print(ans)

Measured memory_bytes: 30848
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N,H,W; cin>>N>>H>>W;
  int height = N - (H-1);
  int wide = N - (W-1);
  int ans = height * wide;
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();
        int[] b = new int[n-1];

        for (int i = 0; i < n - 1; i++) {
            b[i] = sc.nextInt();
        }

        int ans = b[0];
        for (int i = 1; i < n - 1; i++) {
            ans += Math.min(b[i], b[i - 1]);
        }
        ans += b[n - 2];
        System.out.println(ans);
    }
}



Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9
#define MAX_H 51
#define MAX_W 51

using namespace std;

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

int main() {
    int H, W;
    cin >> H >> W;
    bool s[MAX_H][MAX_W];
    int white_num = 0;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            char s_;
            cin >> s_;
            if (s_ == '.') {
                s[i][j] = true;
                ++white_num;
            } else {
                s[i][j] = false;
            }
        }
    }
    
    int d[4][2];
    d[0][0] = 0; d[0][1] = 1;
    d[1][0] = 1; d[1][1] = 0;
    d[2][0] = 0; d[2][1] = -1;
    d[3][0] = -1; d[3][1] = 0;
    
    int c[MAX_H][MAX_W];  // c[i][j]: (i, j)から(H, W)までの最短距離
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            c[i][j] = INF;
        }
    }
    c[H - 1][W - 1] = 0;
    
    for (int k = 0; k < H * W; ++k) {
        
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (!s[i][j]) continue;
                
                for (int t = 0; t < 4; ++t) {
                    int d_i = d[t][0], d_j = d[t][1];
                    
                    if (0 <= i + d_i && i + d_i < H &&
                        0 <= j + d_j && j + d_j < W ) {
                        c[i][j] = min(c[i][j], c[i + d_i][j + d_j] + 1);
                    }
                }
            }
        }
    }
    if (c[0][0] == INF) {
        cout << -1 << endl;
    } else {
        cout << white_num - (c[0][0] + 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define INF 1e8
typedef long long int ll;
const double PI = acos(-1);

using Graph = vector<vector<int>>;
int main() {
  double d, t, s;
  cin >> d >> t >> s;
  if (d / s <= t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main() {

  int a,b,c,d,sum;
  string s,t;
  cin>>a;
  vector<int> vec(a);
  sum=0;
  for(int i=0;i<a;i++){
  	cin>>vec.at(i);
    sum += vec.at(i);
  }
  
  b=*max_element(vec.begin(),vec.end());
  
  if(sum-b>b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

//===
struct UnionFind {
    int n;
    vector<int> parent;

    UnionFind() {}
    UnionFind(int nmemb) {
        init(nmemb);
    };

    void init(int nmemb) {
        parent.clear();
        parent.assign(nmemb, -1);
    };

    int root(int x) {
        if (parent[x] < 0) {
            return x;
        }
        return parent[x] = root(parent[x]);
    };

    void unite(int x, int y) {
        x = root(x);
        y = root(y);

        if (x == y) return;

        if (parent[y] < parent[x]) swap(x, y);

        parent[x] += parent[y];
        parent[y] = x;
        
        return;
    };
    
    bool same(int x, int y) {
        return root(x) == root(y);
    };
    int size(int x) {
        return -(parent[root(x)]);
    };
};
//===

llong n, m, k;
vector<vector<llong>> bl;
vector<vector<llong>> fr;

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

    UnionFind uf(n + 1);
    bl.resize(n + 1);
    fr.resize(n + 1);
    for (int i = 0; i < m; i++) {
        llong a, b;
        cin >> a >> b;
        uf.unite(a, b);
        fr[b].push_back(a);
        fr[a].push_back(b);
    }

    for (int i = 0; i < k; i++) {
        llong a, b;
        cin >> a >> b;
        bl[a].push_back(b);
        bl[b].push_back(a);
    }

    for (int i = 1; i <= n; i++) {
        llong ans = uf.size(i) - fr[i].size() - 1;
        for (auto u:bl[i]) {
            if (uf.same(u, i)) ans--;
        }

        cout << ans << ' ';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 13300
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

void solve(){
	string s;
	cin>>s;
	int avail =0 ;
	int score = 0;
	for(int i=0;i<s.size();i++){
		if(s[i] == 'g'){
			if(avail){
				score += 1;
				avail -= 1;
			}
			else{
				avail += 1;
			}
		}
		if(s[i] == 'p'){
			if(avail){
				avail -= 1;
			}
			else{
				avail += 1;
				score -= 1;
			}
		}
	}
	cout<<score<<endl;
}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 512
def gen(x):
    root = int(pow(x, 0.5))
    for k in range(1, root + 1):
        if x % k == 0:
            yield k
            if k != x // k:
                yield x // k


def main():
    N = int(input())

    # N%K!=0
    cnt = sum(1 for _ in filter(lambda x: x > 1, gen(N - 1)))

    # N%K==0
    for k in filter(lambda x: x > 1, gen(N)):
        x = N
        while x % k == 0:
            x //= k

        if x % k == 1:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
using System;
using System.Collections;
using System.Collections.Generic;
class Program
{
  public static int N;
  public static List<int>[] list = new List<int>[110];

  static void Main(string[] args)
  {
    int[] rx = new int[110];
    int[] ry = new int[110];
    int[] bx = new int[110];
    int[] by = new int[110];
    // スペース区切りの整数の入力
    N = int.Parse(Console.ReadLine());
    for (int i = 0; i < N; i++) {
      string[] input = Console.ReadLine().Split(' ');
      rx[i] = int.Parse(input[0]);
      ry[i] = int.Parse(input[1]);
    }
    for (int i = 0; i < N; i++) {
      string[] input = Console.ReadLine().Split(' ');
      bx[i] = int.Parse(input[0]);
      by[i] = int.Parse(input[1]);
    }

    int lastvalue = 0;

    for (int j = 0; j < N; j++) { //xでソート
      for (int i = 1; i < N; i++) {
        if (bx[i] < bx[i - 1]) {
          int tmp;
          tmp = bx[i - 1];
          bx[i - 1] = bx[i];
          bx[i] = tmp;
          tmp = by[i - 1];
          by[i - 1] = by[i];
          by[i] = tmp;
        }
      }
    }

    for (int j = 0; j < N; j++) { //yでソート
      for (int i = 1; i < N; i++) {
        if (ry[i] > ry[i - 1]) {
          int tmp = ry[i - 1];
          ry[i - 1] = ry[i];
          ry[i] = tmp;
          tmp = rx[i - 1];
          rx[i - 1] = rx[i];
          rx[i] = tmp;
        }
      }
    }

    // Console.WriteLine("rr");
    // for (int i = 0; i < N; i++) {
    //    Console.WriteLine(""+rx[i]+","+ry[i]);
    // }

    // Console.WriteLine("bb");
    // for (int i = 0; i < N; i++) {
    //    Console.WriteLine(""+bx[i]+","+by[i]);
    // }




    bool[] chked = new bool[110];

    int count = 0;

    for (int i = 0; i < N; i++) { //リスト追加
      for (int j = 0; j < N; j++) {
        if (rx[j] < bx[i] && ry[j] < by[i] && chked[j]==false) {
          count++;
          chked[j]=true;
          break;
        }
      }
    }







    //search( 0);
    Console.WriteLine(count);
  }

  // public static int ctr=0;
  // public static bool[] chk = new bool[110];
  // public static int maxv=0;
  // public static int[] lastAdd = new int[110];

  // public static void search( int b ) {
  //   if (ctr == N) {
  //     if (lastAdd[ctr-1]!=-1)chk[lastAdd[ctr-1]] = false;
  //     if (maxv<b)maxv=b;
  //     ctr--;
  //     return;
  //   }

  //   for (int i = 0; i < list[ctr].Count; i++) {
  //     if (list[ctr][i] != -1 && !chk[list[ctr][i]] ) {
  //       lastAdd[ctr] = list[ctr][i];
  //       chk[list[ctr][i]] = true;
  //       ctr++;
  //       search( b + 1);
  //     }else{
  //       lastAdd[ctr] = -1;
  //       ctr++;
  //       search( b );
  //     }
  //   }
  //   if (ctr>0)if (lastAdd[ctr-1]!=-1)chk[lastAdd[ctr-1]] = false;
  //   ctr--;
  //   return;
  // }
  

}

Measured memory_bytes: 13268
#include<stdio.h>
int main()
{
    int n,sum=0,m;
    scanf("%d",&n);
    m=n;
    while(m>0)
    {
        sum=sum+m%10;
        m=m/10;
    }
    if(n%sum==0)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
# input = sys.stdin.r/eadline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    A,B,C = MAP()
    if A==B==C:
        if A%2==1 or B%2==1 or C%2==1:
            print(0)
        else:
            print(-1)
        return
    answer = 0
    
    while A%2==0 and B%2==0 and C%2==0:
        x = A//2
        y = B//2
        z = C//2
        A = y+z
        B = x+z
        C = y+x
        answer += 1
    print(answer)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
// https://atcoder.jp/contests/abc123/tasks/abc123_c

package main

import "fmt"
import "math"

// 4 {5 5 2 5 5}
// 0 [4 0 0 0 0]
// 0 [0 4 0 0 0]
// 0 [0 2 2 0 0]
// 0 [0 0 2 2 0]
// 0 [0 0 0 2 2]
// 0 [0 0 0 0 4]

// 5 {2 5 5 5 5}
// 3 [2 0 0 0 0]
// 1 [2 2 0 0 0]
// 0 [1 2 2 0 0]
// 0 [0 1 2 2 0]
// 0 [0 0 1 2 2]
// 0 [0 0 0 1 4]
// 0 [0 0 0 0 5]

// 5 {5 5 5 5 2}
// 0 [5 0 0 0 0]
// 0 [0 5 0 0 0]
// 0 [0 0 5 0 0]
// 0 [0 0 0 5 0]
// 0 [0 0 0 3 2]
// 0 [0 0 0 1 4]
// 0 [0 0 0 0 5]

// 5 {5 2 5 5 5}
// 0 [5 0 0 0 0]
// 0 [3 2 0 0 0]
// 0 [1 2 2 0 0]
// 0 [0 1 2 2 0]
// 0 [0 0 1 2 2]
// 0 [0 0 0 1 4]
// 0 [0 0 0 0 5]

// 5 {3 2 4 3 5}
// 2 [3 0 0 0 0]
// 0 [3 2 0 0 0]
// 0 [1 2 2 0 0]
// 0 [0 1 2 2 0]
// 0 [0 0 1 2 2]
// 0 [0 0 0 1 4]
// 0 [0 0 0 0 5]

// 5 {1 1 5 1 1}
// 4 [1 0 0 0 0]
// 3 [1 1 0 0 0]
// 2 [1 1 1 0 0]
// 3 [1 1 1 0 0]
func min(n ...int64) int64 {
	m := n[0]
	for i := 1; i < len(n); i++ {
		if n[i] < m {
			m = n[i]
		}
	}
	return m
}

func main() {
	var N int64
	c := make([]int64, 5)
	fmt.Scanf("%d\n%d\n%d\n%d\n%d\n%d", &N, &c[0], &c[1], &c[2], &c[3], &c[4])

	bottleneck := min(c...)
	var delay int64
	if bottleneck < N {
		delay = int64(math.Ceil(float64(N) / float64(bottleneck)))
		fmt.Println(4 + delay)
	} else {
		fmt.Println(5)
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define inf 1000000000
#define maxs(x,y) (x = max(x , y))
#define mins(x,y) (x = min(x , y))
using namespace std;
typedef long long int ll;

int main(){

  int x1,y1,x2,y2,x3,y3,x4,y4,xx,yy;
  cin >> x1 >> y1 >> x2 >> y2;

  xx = x2-x1; 
  yy = y2-y1;

  x3 = x2 - yy;
  y3 = y2 + xx;

  x4 = x1 - yy;
  y4 = y1 + xx;

  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

}


Measured memory_bytes: 256