akhauriyash/Code-Regression huggingface dataset:
#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>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
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-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
int n; string s;
ll dp[3001][3001];
int main() {
	cin >> n >> s;
	dp[0][0] = 1;
	rep(i, n - 1) {
		vector<ll> v = { 0 };
		ll sum = 0;
		rep(j, i + 1) {
			sum += dp[i][j]; sum %= mod;
			v.push_back(sum);
		}
		rep(j, i + 2) {
			if (s[i] == '<') {
				dp[i + 1][j] += v[j]; dp[i + 1][j] %= mod;
			}
			else {
				dp[i + 1][j] += v[v.size() - 1] - v[j];
				dp[i + 1][j] = (dp[i + 1][j] + mod) % mod;
			}
		}
	}
	ll ans = 0;
	rep(i, n) {
		ans += dp[n - 1][i]; ans %= mod;
	}
	cout << ans << endl;
	//stop
	return 0;
}

Measured memory_bytes: 68992
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int max = 0;
        int[] arr = new int[5];
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            arr[i] = sc.nextInt();
            sum += arr[i];
            int shortAmount = 10 - arr[i] % 10;
            if(shortAmount != 10) {
                sum +=shortAmount;
                max = Math.max(max, shortAmount);
            }
        }
        System.out.println(sum - max);
    }
}

Measured memory_bytes: 21716
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;
int m[10];

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

	m[a] = 1;
	m[b] = 1;
	if(m[1] == 0){
		cout<<1<<endl;
	}else if(m[2] == 0){
		cout<<2<<endl;
	}else{
		cout<<3<<endl;
	}

	

	return 0;
}

Measured memory_bytes: 3500
import java.util.Arrays;
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(), k = scanner.nextInt();
			int[] p = IntStream.range(0, n).map(i -> scanner.nextInt()).toArray();
			System.out.println(Arrays.stream(p).sorted().limit(k).sum());
		}
	}
}


Measured memory_bytes: 39440
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

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

    int n; cin>>n;
    vi l = readVector<int>(n);

    int ans=0;
    sort(ALL(l));
    FOR(i,n) {
        FOR(j,i) {
            int d = l[i]-l[j];
            if(d>=l[j])
                continue;
            auto it = upper_bound(l.begin(), l.end(), d);
            int no = (it-l.begin());
            if(no<j)
                ans += j - no;
        }
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define inf 1e9
typedef long long ll;
int dp[41][401][401];
int main(){
    int N,Ma,Mb;
    cin >> N >> Ma >> Mb;
    int a[41],b[41],c[41];
    REP1(i,N){
        cin >> a[i] >> b[i] >> c[i];
    }
    REP(i,N+1){
        REP(j,N*10+1){
            REP(k,N*10+1){
                dp[i][j][k] = inf;
            }
        }
    }
    dp[0][0][0] = 0;
    REP1(i,N){
        REP(j,N*10+1){
            REP(k,N*10+1){
                if(j >= a[i] && k >= b[i]) dp[i][j][k] = min(dp[i-1][j][k],dp[i-1][j-a[i]][k-b[i]]+c[i]);
                else dp[i][j][k] = dp[i-1][j][k];
            }
        }
    }
    int ans = inf;
    int k = 1;
    while(Ma*k <= N*10 && Mb*k <= N*10){
        if(ans > dp[N][Ma*k][Mb*k]) ans = dp[N][Ma*k][Mb*k];
        k++;
    }
    if(ans == inf) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    string s;
    cin >> n >> s >> k;
    k--;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == s[k]) cout << s[i];
        else cout << "*";
    }
}


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

dst :: (Int, Int) -> (Int, Int) -> Int
dst (x1, y1) (x2, y2) = abs (x2 - x1) + abs (y2 - y1)

f1 :: (Int, Int, Int) -> [(Int, Int, Int)]
f1 (x, y, h) =
    [(cx, cy, h + dst (x, y) (cx, cy)) | cx <- [0 .. 100] , cy <- [0 .. 100]]

f2 :: [(Int, Int, Int)] -> (Int, Int, Int) -> Bool
f2 xyhs cxyh = and $ fmap (f3 cxyh) xyhs
  where
    f3 (cx, cy, ch) (x, y, h)
        = (max (ch - dst (cx, cy) (x, y)) 0) == h

main :: IO ()
main = do
    n <- readLn
    xyhs <- replicateM n $ do
        [x, y, h] <- fmap read . words <$> getLine :: IO [Int]
        return (x, y, h)
    let xyh = head $ filter (\(_, _, h) -> h > 0) xyhs
    let cxyhs = f1 xyh
    let (ax, ay, ah) = head $ filter (f2 xyhs) cxyhs
    putStrLn $ unwords $ fmap show [ax, ay, ah]

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

class DisjointSet {
public:
	vector<int> rank, p;

	DisjointSet() {}
	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++)makeSet(i);
	}

	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
	}

	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}

};

int main() {
	int n, a, b, q;
	int t;

	cin >> n >> q;
	DisjointSet ds = DisjointSet(n);

	for (int i = 0; i < q; i++) {
		cin >> t >> a >> b;
		if (t == 0)ds.unite(a, b);
		else if (t == 1) {
			if (ds.same(a, b))cout << 1 << endl;
			else cout << 0 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3fLL
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
multiset<int>s;
int main(){
    int n; scanf("%d", &n);
    for (int i = 0; i < n; i++){
        int a; scanf("%d", &a); s.insert(a);
    }
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        int a; scanf("%d", &a);
        multiset<int>::iterator it = s.find(a);
        if (it == s.end()){cout << "NO" << endl; return 0;}
        else s.erase(it);
    }
    cout << "YES" << endl;
    return 0;
}


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

int main(){
	int i, j, n, ans = 0;
	cin >> n;
	int cnt[2][105] = {0};
	for(i = 0; i < 2; ++i){
		for( j = 1; j <= n; ++j ){
			cin >> cnt[i][j];
			cnt[i][j] += cnt[i][j-1];
		}
	}
	for(i = 1; i <= n; ++i){
		ans = max(ans, cnt[0][i] + cnt[1][n] - cnt[1][i-1]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}

int EditDistance(string s,string t){
  vector<vi> dp(s.size()+1,vi(t.size()+1,inf));
  rep(i,s.size()+1) dp[i][0]=i;
  rep(j,t.size()+1) dp[0][j]=j;

  FOR(i,1,s.size()+1){
    FOR(j,1,t.size()+1){
      dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
      dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
      dp[i][j]=min(dp[i][j],dp[i-1][j-1]+(s[i-1]!=t[j-1]));
    }
  }

  return dp[s.size()][t.size()];
}



signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  string s,t;
  cin>>s>>t;

  cout<<EditDistance(s,t)<<endl;


}


Measured memory_bytes: 10716
N = int(input())
K = int(input())
xs = list(map(int, input().split()))

dist_sum = 0
for i in range(N):
	y = i + 1
	x = xs[i]
	
	if x > K - x:
		dist_sum += (K - x) * 2
	else:
		dist_sum += x * 2
		
print(dist_sum)
	
	

Measured memory_bytes: 9168
#include <iostream>
#include <set>
using namespace std;
typedef long long ll;

int a,b,q;
set<ll> s,t;



int main(void){
    cin>>a>>b>>q;
    for(int i=0;i<a;i++){
        ll x;
        cin>>x;
        s.insert(x);
    }
    for(int i=0;i<b;i++){
        ll x;
        cin>>x;
        t.insert(x);
    }
    s.insert(1e18);
    s.insert(-1e18);
    t.insert(1e18);
    t.insert(-1e18);
    
    for(int i=0;i<q;i++){
        ll x;
        cin>>x;
        auto v=s.upper_bound(x);
        auto w=t.upper_bound(x);
        ll m=max((*v), (*w))-x;
        
        w--;
        ll y=(*v)-x, z=x-(*w);
        m=min(m, y+z+min(y, z));
        
        v--;
        m=min(m, x-min((*v), (*w)));
        
        w++;
        y=x-(*v), z=(*w)-x;
        m=min(m, y+z+min(y, z));
        cout<<m<<endl;
    }
}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    string s;
    cin >> s;
    sort(all(s));
    if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <set>
#include <cassert> //assart
using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
const int  MOD=1e9+7;
const int  INF=2000000000;
const int INF2=  10000000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INF2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}

int printintN(int array[],const int num){
    for(int i=0;i<num;i++){printf("%d ",array[i]);}
    br;
    return 0;
}


//#define int long long int

/*
 1.困った時こそ冷静に問題文を見直す！制約条件を見ろ！乱択アルゴリズムとかO(N^3)とか！
 2.一度に大量のことをやろうとしない。デバッグしやすいように細かく！
 3.プログラミングは半分数学だし、もう半分は数学ではない！
 4.できない問題はできない！！！！！
 */

int experiment(){
    int N;
    cin>>N;
    int V[N];
    FOR(i, 0, N){
        cin>>V[i];
    }
    //printintN(V, N);
    int C;
    FOR(i, 0, N){
        cin>>C;
        V[i]-=C;
    }
    //printintN(V, N);
    sort(V,V+N,greater<int>());
    int ans=0;
    FOR(i, 0, N){
        if(V[i]>0)ans+=V[i];
    }
    OutputAndReturn0(ans);
    return 0;
}
signed main(){
    assert(1);
    experiment();
    return 0;
}


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

using namespace std;
#define LL long long

const int MAXN = 112345;

char s[MAXN];

int main () {

	scanf("%s", s);

	stack <char> x;
	x.push (s[0]);

	int n = strlen (s);

	long long ans = 0;

	for (int i = 1; i < n; ++i) {
		if (!x.empty() && s[i] != x.top()) {
			x.pop();
			ans += 2;
		}
		else x.push (s[i]);
	}

	printf("%lld\n", ans);


	return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    int N=sc.nextInt();
    double s[]=new double[N];
    double total=0;
    for(int i=0;i<N;i++){
      s[i]=sc.nextDouble();
      total=total+1/s[i];
    }
    System.out.println(1/total);
   }
}

Measured memory_bytes: 25300
# your code goes here

class Dice
	
	def initialize(aryDice)
    	@dice = aryDice;
    end
    
    #???????¢????
    def checkOperation(operation)
    	case operation
    	when "E" then
    		moveE;
    	when "N" then
    		moveN;
    	when "S" then
    		moveS;
    	when "W" then
    		moveW;
    	end
    end
    
    def searchRightNum(top,front)
    	
    	for countMoveN in 0..3 do
    		if @dice[0] == top then
    			break;
    		end
    		moveN;
    	end
    	
    	for countMoveE in 0..3 do
    		if @dice[0] == top then
    			break;
    		end
    		moveE;
    	end
    	
    	for countMoveR in 0..3 do
    		if @dice[1] == front then
    			break;
    		end
    		moveR;
    	end
    	
    end
    
    #E???????????????????§????
    def moveE
    	tmp = @dice[0];
        @dice[0] = @dice[3];
        @dice[3] = @dice[5];
        @dice[5] = @dice[2];
        @dice[2] = tmp;
    end
    
    #N???????????????????§????
    def moveN
    	tmp = @dice[0];
        @dice[0] = @dice[1];
        @dice[1] = @dice[5];
        @dice[5] = @dice[4];
        @dice[4] = tmp;
    end
    
    #S???????????????????§????
    def moveS
    	tmp = @dice[0];
        @dice[0] = @dice[4];
        @dice[4] = @dice[5];
        @dice[5] = @dice[1];
        @dice[1] = tmp;
    end
    
    #W???????????????????§????
    def moveW
    	tmp = @dice[0];
        @dice[0] = @dice[2];
        @dice[2] = @dice[5];
        @dice[5] = @dice[3];
        @dice[3] = tmp;
    end
    
    #R???????????????????§????
    def moveR
    	tmp = @dice[1];
        @dice[1] = @dice[2];
        @dice[2] = @dice[4];
        @dice[4] = @dice[3];
        @dice[3] = tmp;
    end
    
    #???????????????????????????????????¨???
    def dispTopDice
    	puts @dice[0];
    end
    
    def dispRigthDice
    	puts @dice[2];
    end
    
end


aryDice = gets.split(' ').map(&:to_i);
countSearch = gets.to_i;
insDice = Dice.new(aryDice);

for index in 0..countSearch - 1 do
	arySearchNum = gets.split(' ').map(&:to_i);
	insDice.searchRightNum(arySearchNum[0],arySearchNum[1]);
	insDice.dispRigthDice;
end

Measured memory_bytes: 8656
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

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

int main()
{
    long N; cin >> N;
    string S; cin >> S;

    long count_white = 0;
    for(int i = 0; i < S.size(); i++)
    {
        if (S[i] == '.')
            count_white++;
    }
    
    long count_black = 0;
    long count_min = count_white;
    for(long borderline = 0; borderline < S.size(); borderline++)
    {
        if (S[borderline] == '.')
        {
            count_white--;
        }
        else if (S[borderline] == '#')
        {
            count_black++;
        }

        if (count_min > (count_white + count_black))
        {
            count_min = count_white + count_black;
        }

    }
    cout << count_min << endl;
}

Measured memory_bytes: 640
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        PriorityQueue pQueue = new PriorityQueue<Long>(Collections.reverseOrder());

        for (int i = 0; i < N; i++) {
            pQueue.add(sc.nextLong());
        }

        long tmp;
        for (int i = 0; i < M; i++) {
            tmp = (long) pQueue.poll() / 2;
            pQueue.add(tmp);
        }

        long all = 0;
        for (int i = 0; i < N; i++) {
            all += (long) pQueue.poll();
        }

        System.out.println(all);
        
    }
}

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

int main()
{
	cin>>n;
	sum=(n+1)*n/2;
	for(int i=1;i<=n;i++)
	  {
	    if(i%3==0) sum-=i;
	   if(i%5==0) sum-=i;
	   if(i%15==0) sum+=i;}
	cout<<sum;



return 0;
}


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

int main() {
	string a,b,c,d;
	cin>>a;
	if(a[0]==a[1]&&a[1]==a[2]){
	cout<<"Yes"<<endl;
	}
	else if(a[1]==a[2]&&a[2]==a[3]){
	cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  if(S=="SUN")cout<<"7"<<endl;
  if(S=="MON")cout<<"6"<<endl;
  if(S=="TUE")cout<<"5"<<endl;
  if(S=="WED")cout<<"4"<<endl;
  if(S=="THU")cout<<"3"<<endl;
  if(S=="FRI")cout<<"2"<<endl;
  if(S=="SAT")cout<<"1"<<endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        
        int S = sc.nextInt();
        int h = 0, m = 0,s = 0;
        h = S/3600;
        m = S%3600/60;
        s = S%3600%60;
        
        System.out.println(h+":"+m+":"+s);
        sc.close();
    }
}


Measured memory_bytes: 26248
N,M=map(int,input().split())

class UnionFind():
    def __init__(self,n): #n:要素数
        self.n=n
        self.parents = [-1]*n 
        #parents:各要素の親要素番号を格納
        #要素が根である場合、-(そのグループの要素数)を格納する
    
    def find(self,x): #xが属する根を返す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    
    def union(self,x,y): #xのグループとyのグループを併合する
        x = self.find(x)
        y = self.find(y)
        
        if x==y:
            return
        
        if self.parents[x] > self.parents[y]: #|xのグループ|<|yのグループ|
            x,y=y,x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        #よりグループ数が多い方の根にもう一方のグループを接続
        
    def size(self,x): #xの属するグループのサイズ
        return -self.parents[self.find(x)]

uf=UnionFind(N)
for i in range(M):
    a,b=map(lambda x:int(x)-1,input().split())
    uf.union(a,b)

ans=0

for i in range(N):
    if uf.size(i) > ans:
        ans=uf.size(i)
        
print(ans)

Measured memory_bytes: 81340
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
#define SIZE 524288
class BIT
{
public:
	int bit[SIZE + 1];
	void add(int a, int b)
	{
		a++;
		for (;;)
		{
			bit[a] += b;
			a += a&-a;
			if (a > SIZE)return;
		}
	}
	int get(int a)
	{
		a++;
		int ret = 0;
		for (;;)
		{
			ret += bit[a];
			a -= a&-a;
			if (a == 0)return ret;
		}
	}
};
BIT bi;
vector<int>dat[200000];
int ans[200000];
vector<int>q1[200000],q2[200000];
int main()
{
	int query, num;
	scanf("%d%d", &query, &num);
	for (int i = 1; i <= num; i++)for (int j = i; j <= num; j += i)dat[j].push_back(i);
	for (int i = 0; i < query; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		q1[za].push_back(-1);
		q2[zb].push_back(za);
	}
	for (int i = 1; i <= num; i++)
	{
		for (int j = 0; j < q1[i].size(); j++)bi.add(i, 1);
		for (int j = 0; j < dat[i].size(); j++)ans[dat[i][j]] += bi.get(i) - bi.get(max(0, i - dat[i][j]));
		for (int j = 0; j < q2[i].size(); j++)bi.add(q2[i][j], -1);
	}
	for (int i = 1; i <= num; i++)printf("%d\n", ans[i]);
}

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

int T,N;
ll A[200];
string S;

int main(){
	cin>>T;
	while(T--){
		cin>>N;
		for(int i=0;i<N;i++){
			cin>>A[i];
		}
		cin>>S;
		ll B[60];
		for(int i=0;i<60;i++){
			B[i]=0;
		}
		bool f=false;
		for(int i=N-1;i>=0;i--){
			if(S[i]=='1'){
				for(int j=59;j>=0;j--){
					if((A[i]>>j)&1){
						A[i]^=B[j];
					}
				}
				if(A[i]){
					f=true;
					break;
				}
			}
			else{
				for(int j=59;j>=0;j--){
					if((A[i]>>j)&1){
						if(B[j])A[i]^=B[j];
						else{
							B[j]=A[i];
							break;
						}
					}
				}
			}
		}
		cout<<f<<endl;
	}
}

Measured memory_bytes: 3632
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let k = scan.read::<i64>();
    let mut a = scan.readn::<i64>(n);
    let mut f = scan.readn::<i64>(n);
    a.sort();
    f.sort();
    f.reverse();

    let mut ok = 1i64<<60;
    let mut ng = -1i64;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        let mut delta = 0;
        for i in 0..n {
            if a[i] * f[i] > mid {
                delta += ceil_div(a[i] * f[i] - mid, f[i]);
            }
        }
        if delta <= k {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    println!("{}", ok);
}

#[allow(dead_code)]
fn ceil_div(x: i64, y: i64) -> i64 {
    (x + y - 1) / y
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 10492
digits = gets.chomp

table = [0, 1]
digits.each_char do |d|
    n = d.to_i
    m = 10 - n
    t0, t1 = table
    table = [[t0 + n, t1 + m], [t0 + n + 1, t1 + m - 1]].map(&:min)
end

t0, t1 = table
puts [t0, t1 + 1].min

load __FILE__ until $stdin.eof?


Measured memory_bytes: 3972
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String w = sc.next().toLowerCase();
        int count = 0;

        while(true){
            String t = sc.next();
            if(t.equals("END_OF_TEXT")){
                break;
            }else if(t.toLowerCase().equals(w)){
                count++;
            }else{
            }
        }
        System.out.println(count);
    }
}



Measured memory_bytes: 26224
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int a,b,c;
    long long ans = 0;
    cin >> a >> b >> c;
    if(a+b >= c-1) ans = (b+c);
    if(a+b < c-1) ans = (a+2*b+1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
import queue
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, A):
    A.sort()

    s = 0
    ans = N
    for i in range(N-1, -1, -1):
        if s + A[i] < K:
            s += A[i]
        else:
            ans = min(ans, i)
    return ans


def main():
    N, K = read_int_n()
    A = read_int_n()
    print(slv(N, K, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 70380
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
// constexpr long long int INF = LLONG_MAX;
#define int long long int

void solve() {
  // int x;
  // cout << endl;
}

signed main() {
  int n;
  cin >> n;
  int res = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= (i + 1);
  }
  sort(a.begin(), a.end());
  int b = a[a.size() / 2];
  res = 0;
  for (auto x : a) {
    res += abs(x - b);
  }
  cout << res << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <bitset>
#include <functional>
#include <queue>
#include <utility>
#include <map>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<string, PII> PSI;
typedef pair<vector<int>, vector<int>> PVV;
const int INF = 1 << 29;	// 十分大きい値にする, INT_MAX にしないのはオーバーフロー対策

class VVI
{
public:
	vector<int> D;
	vector<int> hand;
	int value;
	VVI() {

	}
	VVI(vector<int> D, vector<int> hand, int value) {
		this->D = D;
		this->hand = hand;
		this->value = value;
	}
};

void solve()
{
	const int MAX_N = 50;
	const int MAX_K = 100;
	int N, K;
	vector<int> V;
	cin >> N >> K;
	FOR(i, 0, N) {
		int tmp;
		cin >> tmp;
		V.push_back(tmp);
	}

	int ans = 0;
	int minNK = min(N, K);
	int sum1 = 0;
	priority_queue<int, vector<int>, greater<int>> que1;
	for (int i = 0; i <= minNK; i++) {
		if (i > 0) {
			sum1 += V[i - 1];
			que1.push(V[i - 1]);
		}

		int sum2 = sum1;
		priority_queue<int, vector<int>, greater<int>> que2 = que1;
		for (int j = 0; j + i <= minNK; j++) {
			if (j > 0) {
				sum2 += V[N - j];
				que2.push(V[N - j]);
			}

			int tmp = sum2;
			priority_queue<int, vector<int>, greater<int>> que3 = que2;
			for (int k = 1; i + j + k <= K; k++) {
				if (!que3.empty() && que3.top() < 0) {
					tmp -= que3.top();
					que3.pop();
				}
				else {
					break;
				}
			}

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

	cout << ans << endl;
}

int main(void)
{
	solve();

	return 0;
}


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

int main() {
  	int a,b,c,d,e,f;
  	cin >> a >> b >> c >> d;
  	e = a + b;
  	f = c + d;
  	/*eとfをくらべて */
  	if (e == f) {
      cout << "Balanced" << endl;
    }
  	else if (e < f) {
      cout << "Right" << endl;
    }
  	else {
      cout << "Left" << endl;
    }
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#define rep(i, s, n) for (int i = s; i < (n); ++i)
using namespace std;

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

    string ans = "No";

    rep(i, 1, 10)
    {
        if (n == i)
        {
            ans = "Yes";
            break;
        }
        if (i != 1 && n % i == 0 && n / i < 10)
        {
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int a,b,c;
    cin >> a >> b >> c;
    cout << (b+c)/c - (a-1+c)/c << endl;
}

Measured memory_bytes: 3612
#include<stdio.h>
 
int main(void)
 
{
 
int a, b, c;
 
int d;
 
 
scanf("%d %d %d", &a, &b, &c);
 
if(a > b)
 
 
{
 
 
d = a;
 
 
a = b;
 
 
b = d;
 
 
}
 
 
 
 
 
if(a > c)
 
 
{
 
 
d = a;
 
 
a = c;
 
 
c = d;
 
 
}
 
 
 
 
 
if(b > c)
 
 
{
 
 
d = b;
 
 
b = c;
 
 
c = d;
 
 
}
 
 
printf("%d %d %d\n", a, b, c);
 
 
 
 
 
 
 
 
 
 
 
return 0;
 
}

Measured memory_bytes: 596
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(Scanner sc = new Scanner(System.in)){
			
			final char[] S = sc.next().toCharArray();
			final char[] T = sc.next().toCharArray();
			
			long[] S_A = new long[S.length + 1];
			long[] S_B = new long[S.length + 1];
			for(int i = 0; i < S.length; i++){
				if(S[i] == 'A'){
					S_A[i + 1]++;
				}else{
					S_B[i + 1]++;
				}
				
				S_A[i + 1] += S_A[i];
				S_B[i + 1] += S_B[i];
			}
				
			int[] T_A = new int[T.length + 1];
			int[] T_B = new int[T.length + 1];
			for(int i = 0; i < T.length; i++){
				if(T[i] == 'A'){
					T_A[i + 1]++;
				}else{
					T_B[i + 1]++;
				}
				
				T_A[i + 1] += T_A[i];
				T_B[i + 1] += T_B[i];
			}
			
			final int Q = sc.nextInt();
			for(int q = 0; q < Q; q++){
				final int a = sc.nextInt() - 1;
				final int b = sc.nextInt() - 1;
				final int c = sc.nextInt() - 1;
				final int d = sc.nextInt() - 1;
				
				final long S_num = ((S_A[b + 1] - S_A[a]) * 2 + (S_B[b + 1] - S_B[a])) % 3;
				final long T_num = ((T_A[d + 1] - T_A[c]) * 2 + (T_B[d + 1] - T_B[c])) % 3;
				
				//System.out.println(S_num + " " + T_num);
				System.out.println(S_num == T_num ? "YES" : "NO");
				
			}
		}
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

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

int main() {
  std::vector<int> v(3);
  cin>>v[0]>>v[1]>>v[2];
  sort(v.begin(),v.end());
  int k;
  cin>>k;
  while(k--)v[2]*=2;
  cout<<v[0]+v[1]+v[2]<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 101

typedef struct{
  int u;
  int k;
  int v[N];
  int c[N];
}Graph;

Graph data[N];

int main()
{

  int u, k, i, j, n;

  scanf("%d", &n);

  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      data[i].c[j] = 0;
    }
  }

  for(i = 1; i <= n; i++){
    scanf("%d%d", &data[i].u, &data[i].k);
    for(j = 1; j <= data[i].k; j++){
      scanf("%d", &data[i].v[j]);
      data[i].c[data[i].v[j]] = 1;
    }
  }

  for(i = 1; i <= n; i++){
    for(j = 1; j < n; j++) printf("%d ", data[i].c[j]);
    printf("%d\n", data[i].c[n]);
  }

  return 0;
}

Measured memory_bytes: 676
#include<bits/stdc++.h>
using namespace std;
long long int lucas(int n)
{
  long long  int a,b,c;
  int lu[n+2];
  a=2;
  b=1;
  int i;
  if(n==1)
  return 1;
  if(n==0)
  return 2;
  for(i=2;i<=n;i++)
  {
    c=a+b;
    a=b;
    b=c;
  }
  return c;
}
int main()
{
 int n;
  cin>>n;
  long long int k=lucas(n);
  cout<<k;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define ll long long
using namespace std;
ll mod = 1e9+7;
ll res[104][104];
ll multiply(ll m1[104][104], ll m2[104][104], int m)
{

	for(int i=0;i<m;i++)
	{
		for(int j=0;j<m;j++)
		{
			ll row = 0;
			for(int k=0;k<m;k++)
			{
				row+=(m1[i][k]*m2[k][j])%mod;
				row = row%mod;
			}
			res[i][j] = row;
		}
	}

}
void cp(ll m1[104][104], int m)
{
	for(int i=0;i<m;i++)
		for(int j=0;j<m;j++)
			m1[i][j] = res[i][j];

}
ll mat_expo(ll n, ll mat[104][104], int m)
{
	ll idn[104][104];
	for(int i=0;i<m;i++)
		for(int j=0;j<m;j++)
			idn[i][j] = mat[i][j];
	while(n)
	{
		if(n%2)
		{
			multiply(idn ,mat, m);
			cp(idn, m);
		}
		n/=2;
		multiply(mat, mat, m);
		cp(mat, m);
	}
	ll ans = 0;
	for(int i=0;i<m;i++)
		for(int j=0;j<m;j++)
			ans = (ans+idn[i][j])%mod;
	return ans%mod;
}
int main()
{
	ll n, k;
	ll mat[104][104];
	cin>>n>>k;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin>>mat[i][j];

		cout<<mat_expo(k-1, mat, n);
	

}


Measured memory_bytes: 384
/* Tuan Kkura */
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define PROB "text"
#define MAXN 200005

ii a[MAXN];

bool check(ll val)
{
    for(ll i = 2; i*i <= val; i++)
        if(val%i == 0)  return false;
    return true;
}

int main()
{
    _io
    ll A, B;
    cin >> A >> B;
    vector <ll> res;
    for(ll i = 1; i*i <= A; i++)
    {
        if(A%i == 0)
        {
            if(B%i == 0)
                res.pb(i);
            ll v = A/i;
            if(v != i && B%v == 0)
                res.pb(v);
        }
    }
    int cnt = 0;
    REP(i, 0, res.size())
        cnt += check(res[i]);
    cout << cnt << '\n';
}


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int amount = sc.nextInt();
		int numOfCoin = sc.nextInt();
		int[] coins = new int[numOfCoin];
		for(int i = 0; i < numOfCoin; i++){
			coins[i] = sc.nextInt();
		}
		sc.close();
		int[][] dp = new int[numOfCoin + 1][amount + 1];
		Arrays.fill(dp[0], Integer.MAX_VALUE);
		for(int i = 1; i <= numOfCoin; i++){
			for(int j = 1; j <= amount; j++){
				int k = j - coins[i - 1];
				int num = Integer.MAX_VALUE;
				if(k >= 0){
					int num2 = Math.min(dp[i - 1][k], dp[i][k]);
					if(num2 < Integer.MAX_VALUE){
						num = num2 + 1;
					}
				}
				dp[i][j] = Math.min(num, dp[i - 1][j]);
			}
		}
		System.out.println(dp[numOfCoin][amount]);
	}

}

Measured memory_bytes: 25004
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll ans = 0;
    string S;
    cin >> S;
    int N = sz(S);
    rep(i, 1<<(N-1)){
        bool used[N];
        fill(used, used+N, false);
        rep(j, N-1) if(i&(1<<j)) used[j+1] = true;
        int now = 0; ll sum = 0;
        while(now < N){
            if(used[now]) ans += sum, sum = 0, used[now] = false;
            else sum = sum*10 + (S[now++]-'0');
        }
        ans += sum;
    }
    cout << ans << endl;
}

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

int main() {

    int n;
    double x;
    char u[4];
    scanf("%d", &n);

    double mysum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%lf %s", &x, u);

        if (u[0] == 'J') {
            mysum += x;
        } else {
            mysum += x * 380000.0;
        }
    }

    printf("%f\n", mysum);
    return 0;


}

Measured memory_bytes: 128
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	int A, B;
	cin >> A >> B;
	char S = 'x';
	if (A + B == 15) {
		S = '+';
	}
	else if (A * B == 15) {
		S = '*';
	}
	cout << S << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

    if(D == 25) {
        cout << "Christmas";
    }
    else if(D == 24) {
        cout << "Christmas" << " " << "Eve";
    }
    else if(D == 23) {
        cout << "Christmas" << " " << "Eve" << " " << "Eve";
    }
    else {
        cout << "Christmas" << " " << "Eve" << " " << "Eve" << " " << "Eve";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  ll A,V,B,W,T;
  cin >> A >> V >> B >> W >> T;
  ll d = abs(A - B);
  if (d <= (V - W) * T) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

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

int main() {
	ll n,k;
	cin>>n>>k;
	ll count=0,count2=0;
	if(k%2){
		for(ll i=1;i<=n;i++){
			if((i%k)==0)
			++count;
		}
		cout<<count*count*count;
	}
	else{
		for(ll i=1;i<=n;i++){
			if((i%k)==0)
			++count2;
			else if((i%k)==k/2)
			++count;
		}
		cout<<(count*count*count)+(count2*count2*count2);
	}
	
	return 0;
}

Measured memory_bytes: 256
def main():
    import numpy as np
    n = int(input())
    a = np.full((n, n), ".", dtype=str)
    a3 = np.array([[".", "a", "a"], ["b", ".", "."], ["b", ".", "."]], dtype=str)
    a4 = np.array([["a", "a", "b", "c"], ["d", "d", "b", "c"],
                   ["a", "c", "d", "d"], ["a", "c", "b", "b"]], dtype=str)
    a5 = np.array([["c", "c", "d", "d", "e"],
                   ["j", ".", "a", "a", "e"],
                   ["j", "b", ".", ".", "f"],
                   ["i", "b", ".", ".", "f"],
                   ["i", "h", "h", "g", "g"]], dtype=str)
    a7 = np.array([[".", "c", "c", "d", "d", "c", "c"],
                   ["c", ".", "a", "a", ".", "a", "a"],
                   ["c", "b", ".", ".", "b", ".", "."],
                   ["d", "b", ".", ".", "b", ".", "."],
                   ["d", ".", "a", "a", ".", "a", "a"],
                   ["c", "b", ".", ".", "b", ".", "."],
                   ["c", "b", ".", ".", "b", ".", "."]], dtype=str)
    a6 = np.full((6, 6), ".", dtype=str)
    for i in range(2):
        a6[3*i:3*i+3, 3*i:3*i+3] = a3
    a11 = np.full((11, 11), ".", dtype=str)
    a11[:4, :4] = a4
    a11[4:, 4:] = a7

    if n == 2:
        print(-1)
        return
    elif n == 3:
        a = a3
    elif n == 6:
        a = a6
    elif n == 7:
        a = a7
    elif n == 11:
        a = a11
    else:
        for p in range(n):
            q = n-4*p
            if q % 5 == 0:
                q //= 5
                break
        for i in range(p):
            a[4*i:4*i+4, 4*i:4*i+4] = a4
        p = 4*p
        for i in range(q):
            a[p+5*i:p+5*i+5, p+5*i:p+5*i+5] = a5

    a = a.tolist()
    for i in a:
        print("".join(i))


main()


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

#define nl '\n'
#define F fisrt
#define S second
#define pb push_back
#define mp make_pair
#define REP(i,a,b) for(int i = a; i <= b; i++)

#define Fizz -1
#define Buzz -2
#define FizzBuzz -3

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef stack<int> si;
typedef deque<int> di;
typedef pair<int,int> pi;

int gcd(int n1, int n2){
	while(n1 != n2)
    {
        if(n1 > n2)
            n1 -= n2;
        else
            n2 -= n1;
    }
    return n1;
}

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

	//your code here
	int k; cin >> k;
	ll sum = 0;
	REP(i,1,k){
		REP(j,1,k){
			REP(l,1,k){
				sum += gcd(gcd(i,j),l);
			}
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define rand rund
#define pb push_back
#define eb emplace_back

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef unsigned long long int ull;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w)
{
	cout<<w.size()<<endl;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<endl;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rand();
	a*=RAND_MAX;
	a+=rand();
    return a;
}

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

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

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

ll has(string x)
{
	ll h1=0,h2=0;
	x=to_lower(x);
	for (char a: x)
	{
		h1*=bases[0];
		h1+=a-'a';
		h1%=bases[3];
		h2*=bases[1];
		h2+=a-'a';
		h2%=bases[4];
	}
	return h1*(MOD+13893829)+h2;
}

const int N=300010;
ll k;
ll e,a[N];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back((raand()%MOD+13893829)%MOD);
	cin>>k;
	e=10;
	e*=1000;
	e*=1000;
	e*=1000;
	e*=1000;
	e*=1000;
	for (int n=2;n<=50;++n) if (k<=e*n)
	{
		ll z=(k+n-1)/n;
		for (int i=0;i<n-1;++i) a[i]=z+n-1;
		a[n-1]=z;
		int imp=z*n-k;
		if (imp)
		{
			--a[n-1];
			--imp;
		}
		int st=n-2;
		while (imp)
		{
			a[st]-=st+1;
			--imp;
			--st;
		}
		cout<<n<<endl;
		for (int i=0;i<n;++i) cout<<a[i]<<' ';
		break;
	}
}



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

int main()
{
    int n;
    cin>>n;
    switch(n%10){
        
        case 3:
            cout<<"bon";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout<<"pon";
            break;
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout<<"hon";
            break;
    }

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  if(B % A == 0) cout << A+B <<endl;
  else cout << B-A <<endl;
  return 0;
}

Measured memory_bytes: 256