akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i] << " "
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int32_t main(){
    SPEED;
    int n;
    cin >> n;
    string s;
    cin >> s;
    int x = 0, ans = 0;
    for(char c: s){
        if(c == 'I') x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans;
}


Measured memory_bytes: 3572
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	map<int, int> mp;
	int m = 0;
	REP(i, n) {
		int a;
		cin >> a;
		mp[a]++;
		m = max(m, a + 1);
	}
	int ans = 0;
	REP(i, m + 3) {
		ans = max(ans, mp[i] + mp[i + 1] + mp[i + 2]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std; 
int main(){
	char a[3][60];
	int n;
	long long s=1;
	cin>>n;
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++){
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=1;i++){
		for(int j=1;j<=n;j++){
			if(j==1){
				if(a[i][j]==a[i+1][j]){
				    s*=3;
				    if(s>1000000007) s=s%1000000007;
			    }else{
			    	s*=6;
			    	j++;
				}
			}else{
				if(a[i][j]==a[i+1][j]&&a[i][j-1]==a[i+1][j-1]){
					s*=2;
					if(s>1000000007) s=s%1000000007;
				}else if(a[i][j]==a[i+1][j]&&a[i][j-1]!=a[i+1][j-1]){
					s*=1;
				}else if(a[i][j]!=a[i+1][j]&&a[i][j-1]==a[i+1][j-1]){
					s*=2;
					if(s>1000000007) s=s%1000000007;
					j++;
				}else{
					s*=3;
					if(s>1000000007) s=s%1000000007;
					j++;
				}
			}
			
		}
	}
	cout<<s<<endl;
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    int p[4], t[4];
    for(int i = 0; i < 4; i++)  cin >> p[i];
    for(int i = 0; i < 4; i++)  cin >> t[i];

    vector<int> dp(300, 1<<29);
    dp[0] = 0;
    for(int i = 0; i < 4; i++){
        for(int j = 0; j+t[i] < 300; j++){
            dp[j+t[i]] = min(dp[j+t[i]], dp[j]+p[i]);
        }
    }

    int ans = 1<<29;
    for(int i = n; i <= 200; i++)   ans = min(ans, dp[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>
typedef struct _Res{
	int a;
	int b;
	int c;
	int PF;
}Res;



int main(){

	int a0,b0,c0;
	int a,b,c,t;
	int N;
	int SN[303];
	Res testRes[1000];
	int i;
	int cnt;

	while(1){
		scanf("%d %d %d\n",&a0,&b0,&c0);
		if( a0==0 && b0==0 && c0==0)break;
		for(i=0;i<a0+b0+c0;i++)SN[i]=2;
		scanf("%d\n",&N);
		
		for(i=0;i<N;i++){
			scanf("%d %d %d %d\n",&a,&b,&c,&t);
			testRes[i].a=a;
			testRes[i].b=b;
			testRes[i].c=c;
			testRes[i].PF=t;
		}
		
		//first ;
		for(i=0;i<N;i++){
			if(testRes[i].PF==1){
				SN[testRes[i].a-1]=1;
				SN[testRes[i].b-1]=1;
				SN[testRes[i].c-1]=1;
			}
		}
		// loop until No newer result is made
		
		cnt=1;
		while(cnt){
			cnt=0;
			for(i=0;i<N;i++){
				if(testRes[i].PF==0){
					if(SN[testRes[i].a-1]==1 && SN[testRes[i].b-1]==1){
						SN[testRes[i].c-1]=0;
						cnt++;
						testRes[i].PF=10;
					}
					if(SN[testRes[i].b-1]==1 && SN[testRes[i].c-1]==1){
						SN[testRes[i].a-1]=0;
						cnt++;
						testRes[i].PF=10;
					}
					if(SN[testRes[i].c-1]==1 && SN[testRes[i].a-1]==1){
						SN[testRes[i].b-1]=0;
						cnt++;
						testRes[i].PF=10;
					}
				}
			}
		}


		for(i=0;i<a0+b0+c0;i++)printf("%d\n",SN[i]);
	}
	
	return 0;
}

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

int main(){
    string s,ans="";
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]!='B') ans.insert(ans.end(),s[i]);
        else if(!ans.empty()) ans.pop_back();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair< int , int >
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(auto x : c )cout << x << " ";
#define ol(c , s , e ) for(int pos=s; pos<e ; pos++) cout << c[pos] << " ";
#define inf 1e18;
#define PI acos(-1)
const int M = 1000000007;
const int N=1e5+5;

#define rohit
#ifdef rohit
template<typename... T >
void bug(T... __VA_ARGS__) {
    ((cerr << __VA_ARGS__ << " ") , ...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__) , cerr << endl;
#endif
void solve() {
    int n, m;
    cin >> n >> m;
    int a[n+1];
    for(int i=1 ; i<=n ; i++){
        cin >> a[i];
    }
    set< int , greater<> > v[n+1];
    while(m--){
        int l , r;
        cin >> l>> r;
        v[l].insert(a[r]);
        v[r].insert(a[l]);
    }
    int goods = 0;
    for(int i=1 ; i<=n ;i++){
        if(v[i].empty() || *v[i].begin() < a[i]){
            goods++;
//            debug(i , *v[i].begin() , a[i]);
        }
    }
    cout << goods << endl;

}
signed main()
{
    FAST;
    //TODO:  check test cases are there or not?
    int tc=1;
//    cin >> tc;
    for(int t = 1 ; t <= tc ; t++)
    {
        solve();
    }
}

Measured memory_bytes: 18384
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;


const int N = 105;
char str[N];
string s = "AKIHABARA";


int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    scanf("%s", str);

    int len = strlen(str);
    int pos = 0;
    for (int i = 0; i < len; i++)
    {
        while (pos < (int) s.length() && str[i] != s[pos] && s[pos] == 'A')
            pos++;
        if (pos == (int) s.length() || str[i] != s[pos] )
        {
            printf("NO\n");
            return 0;
        }
        pos++;
    }
    while (pos < (int) s.length() && s[pos] == 'A')
        pos++;
    if (pos != (int) s.length() )
        printf("NO\n");
    else
        printf("YES\n");

	return 0;
}



Measured memory_bytes: 256
A,B,Q = list(map(int,input().split()))
s = []
for i in range(A):
    s.append(int(input()))
t = []
for i in range(B):
    t.append(int(input()))

s.sort()
t.sort()

from bisect import bisect

for i in range(Q):
    q=int(input())
    a=bisect(s,q)
    b=bisect(t,q)
    if a==0:
        sl = -10**27
    else:
        sl = s[a-1]
    if b==0:
        tl = -10**27
    else:
        tl = t[b-1]
    if a==A:
        sr = 10**27
    else:
        sr = s[a]
    if b==B:
        tr = 10**27
    else:
        tr = t[b]
    c1 = max(sr,tr)-q
    c2 = q-min(sl,tl)
    c3 = min(2*(sr-q)+(q-tl),2*(tr-q)+(q-sl),(tr-q)+2*(q-sl),(sr-q)+2*(q-tl))
    print(min(c1,c2,c3))


Measured memory_bytes: 12120
//https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_a
//A - Regular Triangle
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    vector<ll> abc(3);
    for(auto&& e:abc){
        cin>>e;
    }
    if(abc[0]==abc[1]&&abc[1]==abc[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double PI=3.14159265358979323846;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double r; cin >> r;
    cout << 2 * PI * r << endl;
    
}




Measured memory_bytes: 3796
#include<iostream>
#include<vector>
#include<string>
#include<map>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N - 1);
    for (auto& a : A) {
        cin >> a;
    }
    map<int, int> cnt;
    for (auto& a : A) {
        ++cnt[a - 1];
    }
    rep(i, 0, N) {
        cout << cnt[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13536
S = gets.chomp
T = gets.chomp

list = Hash.new { |h, k| h[k] = [] }

S.each_char.with_index do |s, i|
  list[s] << i + 1
end

idx = 0
loop_cnt = 0

T.each_char do |t|
  if list[t].empty?
    puts -1
    exit
  end

  i = list[t].bsearch { |x| x > idx }

  if i.nil?
    idx = list[t].first
    loop_cnt += 1
  else
    idx = i
  end
end

puts loop_cnt * S.size + idx


Measured memory_bytes: 3324
#include <stdio.h>
#include <string.h>
int main(void){
    int n,a,b;
    char x[1000000];
    while(~scanf("%d",&n)){
        memset(x,0,sizeof(x));
        for(a=2;a<=n/2;a++)for(b=a*2;b<=n;b+=a)x[b]=1;
        for(a=2,b=0;a<=n;a++)if(!x[a])b++;
        printf("%d\n",b);
    }
    return 0;
}

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

using namespace std;

int main(void) {
	int num, i, j, ans[26] = { 0 };
	string s;
	cin >> num >> s;
	for (i = 0; i < s.size(); i++)
		ans[s[i] - 'a']++;
	for (i = 1; i < num; i++) {
		cin >> s;
		vector<int> buf(26, 0);
		for (j = 0; j < s.size(); j++)
			buf[s[j] - 'a']++;
		for (j = 0; j < 26; j++)
			ans[j] = min(ans[j], buf[j]);
	}
	for (i = 0; i < 26; i++) {
		for (j = 0; j < ans[i]; j++)
			printf("%c", i + 'a');
	}
	return 0;
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    
    int comparison = 2 * N;
    int temp = 0;
    for(int i = 1; i <= N; ++i){
        if(i * (i + 1) < comparison)        continue;
        
        temp = i;
        break;
    }

    int remove = temp * (temp + 1) / 2 - N;
    for(int i = 1; i <= temp; ++i){
        if(i == remove)     continue;
        
        cout << i << endl;
    }
}

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

int main(){
  int a,b,c,d;
  cin >>a >>b>>c>>d;
  int count=0;
  while(a>0&&c>0){
    if(count%2==0){
      c-=b;
      count+=1;
    }else{
      a-=d;
      count+=1;
    }
  }
  if(a<=0){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <list>
#include <string>

using namespace std;

int main(){
    list<int> lst;

    int N;
    cin >> N;

    string command;
    int num;
    for(int i=0; i<N; i++){
        cin >> command;
        if( command == "insert" ){
            cin >> num;
            lst.push_front(num);
        }else if( command == "delete"){
            cin >> num;
            for( auto itr = lst.begin(); itr != lst.end(); itr++){
                if(*itr == num){
                    lst.erase(itr);
                    break;
                }
            } 
        }else if( command == "deleteLast"){
            lst.pop_back();
        }else if( command == "deleteFirst"){
            lst.pop_front();
        }
    }

    for(auto itr = lst.begin(); itr != lst.end(); itr++){
        if(itr == lst.begin()){
            cout << *itr;
        }else{
            cout << " " << *itr;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 34280
#!/usr/bin/env python3

def main():
    x = int(input())
    primes = furui(300000)
    for p in primes:
        if x <= p:
            print(p)
            return
    raise ValueError

def furui(nmax):
    assert nmax > 2
    p = 2
    primes = list(range(2, nmax + 1))
    while True:
        if p ** 2 > nmax:
            break
        primes_next = []
        for x in primes:
            if x <= p or x % p != 0:
                primes_next.append(x)
        primes = primes_next
        p = primes[primes.index(p) + 1]
    return primes

if __name__ == "__main__":
    main()


Measured memory_bytes: 16408
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    if i*500>x:
        break
    for j in range(b+1):
        if i*500+j*100>x:
            break
        if (x-(i*500+j*100))%50==0 and (x-(i*500+j*100))//50<=c:
            ans+=1
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int K,X;
  cin >> K >> X;
  for(int i=-199;i<200;i++)
  {
    if(i>X-K&&i<X+K-1)
    {
      cout << i << " ";
    }
    else if(i==X+K-1)
    {
      cout << i;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		
		boolean flag = false;
		for(int i = 0; i < s.length(); i++) {
			if (s.equals(t)){
				flag = true;
				break;
			}
			Character c = s.charAt(0);
			s = s.substring(1, s.length()) + c;
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21844
A, B, C, X, Y = map(int, input().split())
if A + B > 2 * C:
    if X < Y:
        print(X * 2 * C + min((Y - X) * B, (Y - X) * 2 * C))
    else:
        print(Y * 2 * C + min((X - Y) * A, (X - Y) * 2 * C))
else:
    print(X * A + Y * B)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            for(int i = 0; i < S.Length; i++)
            {
                string str = S.Substring(i, 1);
                int cnt = 0;
                for(int j = 0; j < S.Length; j++)
                {
                    if(str == S.Substring(j, 1))
                    {
                        cnt++;
                    }
                    if(1 < cnt)
                    {
                        Console.WriteLine("no");
                        return;
                    }
                }
            }
            Console.WriteLine("yes");

        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);

Measured memory_bytes: 25780
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18)*2;
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
    ll n,x;
    cin>>n>>x;
    V<ll> a(n),b(n,inf);
    for(int i=0;i<n;i++)cin>>a[i];
    ll ans=inf;
    for(ll i=0;i<n;i++){
        ll c=i*x,sum=0;
        for(ll j=0;j<n;j++){
            chmin(b[j],a[(j-i+n)%n]);
            sum+=b[j];
        }
        chmin(ans,sum+c);
    }
     cout<<ans<<"\n";
}


Measured memory_bytes: 3664
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int sum = a+b;

        if (sum%(sum/2) == 0)
            System.out.println(sum/2);
        else
            System.out.println((sum/2)+1);
    }
}


Measured memory_bytes: 35596
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A, B;
	cin >> A >> B;
	cout << max(0LL, A - B * 2) << endl;
	return 0;
}



Measured memory_bytes: 256
import sys

class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, 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 = self.find(x)
        y = self.find(y)

        if x == y:
            return False
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
        return True

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)


def solve():
    readline = sys.stdin.readline
    N, M = map(int, input().split())
    uf = UnionFind(N)
    for _ in range(M):
        A, B = map(int, readline().split())
        A -= 1
        B -= 1
        uf.union(A, B)
    print(-min(uf.parents))


if __name__ == '__main__':
    solve()

Measured memory_bytes: 73012
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	int n,a[105],s,s1,x;
	while(scanf("%d",&n)!=EOF)
	{
		s=0,s1=0;
		for(int i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
			s+=a[i];
			s1+=(a[i]*a[i]);
		}
		double t=(double)n/2;
		if(s%n>=t)
		{
			x=s/n+1;
		}
		else
		x=s/n;
		int y=s1+n*x*x-2*s*x;
		printf("%d\n",y);
	}
	return 0;
}

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

int main() {
    int mix_weight = 0;
    int n, x, m;
    std::cin >> n >> x;
    std::vector<int> vec;
    for (int i = 0; i < n; ++i) {
        std::cin >> m;
        vec.push_back(m);
        mix_weight += m;
    }
    std::sort(vec.begin(), vec.end());
    int rest_mix = x - mix_weight;
    int minimum_donut = vec[0];

    int donut_num = (rest_mix - (rest_mix % minimum_donut)) / minimum_donut;
    std::cout << n + donut_num << std::endl;
}


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

int main(){
    int c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> c[i][j];
        }
    }
    int d1,d2;
    d1=c[0][0]-c[0][1];
    d2=c[0][1]-c[0][2];

    if(c[1][0]-c[1][1]==d1 && c[2][0]-c[2][1]==d1 && c[1][1]-c[1][2]==d2 && c[2][1]-c[2][2]==d2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    int x, n; cin >> x >> n;
    vi p(n); REP(i, n) cin >> p[i];

    int m = 1000;
    int idx = -1;
    int diff;
    REPS(i, x-300, x+300) {
        bool in = false;
        REP(j, n) {
            if (p[j] == i) {
                in = true;
                break;
            }
        }
        if (!in) {
            diff = abs(x-i);
            if (diff < m) {
                m = diff;
                idx = i;
            }
        }
    }

    print(idx);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3632
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    dp=[0]*(N+1)
    dp[0]=1
    a=[0]*M
    for i in range(M):
        a[i]=I()
        
    a.append(10**6)
    cur=0#aの場所
    
    for i in range(1,N+1):
        if i==a[cur]:
            cur+=1
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
            
    print(dp[-1])
    

main()


Measured memory_bytes: 75712
#include <iostream>
#include <string>
#include <algorithm>
#include <tuple>
#include <vector>
#include <limits>

using namespace std;

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

const int N_MAX = 100005;
int n;
int d[N_MAX] = {};

void solve() {
    cin >> n;
    REP(i,n) { cin >> d[i];}
    
    if (n % 2 == 1) {
        cout << "0" << endl;
        return;
    }
    // n % 2 == 0
    sort(d, d + n);
    int l = d[n/2 - 1];
    int r = d[n/2];
    cout << r - l << endl;
}

int main() {
    solve();
    
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())    //昇順
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>()) //降順
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define INF 1000000000000000000


using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;
int main()
{

    ll N;
    cin >> N;
    vec L(N);
    REP(i, N) {
        cin >> L[i];
    }

    SORT(L);

    ll ans = 0;
    REP(i, N - 2) {
        FOR(j, i + 1, N - 1) {
            // debug(L[i]);
            // debug(L[j]);
            // debug(Upper_bound(L, L[i] + L[j]));
            ans += Upper_bound(L, L[i] + L[j] - 1) - j - 1;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){
    int k,n,l = 0;
    cin >> k >> n;
    vector<int>v(n);

    for(int i = 0;i < n;i++){
        cin >> v[i];
    }
    v.push_back(v[0]+k);
    
    for(int i = 0;i < n;i++){
        l = max(l,v[i+1]-v[i]);
    }
    
    cout << k-l << endl;

    return 0;
}

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

int gcd2(int a, int b) {
  if (b == 0) {
    return a;
  }
  else {
    return gcd2(b, a%b);
  }
}

int gcd3(int a, int b, int c) {
  return gcd2(gcd2(a, b), c);
}


int main() {
  int K;
  cin >> K;
  int sum = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j<= K; j++) {
      for (int k = 1; k <= K; k++) {
        sum += gcd3(i, j, k);
      }
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

int main() {
	int w, a, b;
	int ans=0;
	cin >> w >> a >> b;
	if ((a + w) <= b) {
		ans = b - (a + w);
	}else if ((b + w) < a) {
		ans = a - (b + w);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
void swap(int *, int *);
int main(){
  int n;
  scanf("%d", &n);
  int *A;
  A = (int *)malloc(sizeof(int) * n);
  int i;
  for(i = 0; i < n; i++)
    scanf("%d", &A[i]);
  int j;
  for(i = 0, j = 0; i < n - 1; i++)
    if(A[i] <= A[n - 1]){
      swap(&A[i], &A[j]);
      j++;
    }
  swap(&A[n - 1], &A[j]);
  for(i = 0; i < j; i++)
    printf("%d ", A[i]);
  printf("[%d] ", A[i]);
  i++;
  for(; i < n - 1; i++)
    printf("%d ", A[i]);
  printf("%d\n", A[i]);
  free(A);
  return 0;
}

void swap(int *a, int *b){
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

Measured memory_bytes: 888
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    long a, b;
    cin >> a >> b;
    if (a <= 0 && b >= 0) {
        cout << "Zero";
    } else if (a > 0 && b > 0) {
        cout << "Positive";
    } else if (a < 0 && b < 0) {
        ((a-b)%2 == 0)? cout << "Negative" : cout << "Positive";
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int N, M;
vector<int> RG[100005];
int dist[100005];
int ans[100005];

int dfs(int v) {
  if(dist[v] != -1) return dist[v];
  if(RG[v].size() == 0) {
    ans[v] = 0;
    return dist[v] = 0;
  }
  int mxi = 0, mx = -1;
  for(int i = 0; i < RG[v].size(); i++) {
    int d = dfs(RG[v][i]);
    //cout << "v: " << v+1 << " to: " << RG[v][i]+1 << " d: " << d << endl;
    if(mx < d) {
      mx = d;
      mxi = RG[v][i];
    }
  }
  ans[v] = mxi + 1;
  return dist[v] = mx + 1;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  FOR(i,0,N-1+M) {
    int a, b;
    cin >> a >> b;
    a--;b--;
    RG[b].push_back(a);
  }
  FOR(i,0,N) dist[i] = -1;
  FOR(i,0,N) {
    dfs(i);
    cout << ans[i] << endl;
  }

}

Measured memory_bytes: 11008
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner scan_ = new Scanner(System.in);
        
        while(scan_.hasNext()) {
        int a_ = scan_.nextInt();
        int b_ = scan_.nextInt();
       if(a_ != 0 | b_ != 0){
       if(a_ <= b_){
            System.out.println(a_ + " " + b_);
        }else{
            System.out.println(b_ + " " + a_);
        }
        }
    }
    }
}



Measured memory_bytes: 36684
import java.awt.Event;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.channels.FileChannel;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.IntStream;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new TestA().doIt();
//		new TestB().doIt();
		new TestC().doIt();
	}
	class TestA{
		void doIt() {
			String str = sc.next();
			if(str.equals("AAA") || str.equals("BBB")) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}
	}
	class TestB{
		void doIt() {
			long N = Long.parseLong(sc.next());
			long A = Long.parseLong(sc.next());
			long B = Long.parseLong(sc.next());
			long Loop = N / (A + B);
			N = N % (A + B);
			
			long Acount = Loop * A;
			if(N < A)Acount += N;
			else if(N >= A)Acount += A;
			
			System.out.println(Acount);
		}
	}
	class TestC{
		void doIt() {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int num = 0;
			while(true) {
				int numA = (int)(num * 0.08);
				int numB = (int)(num * 0.10);
				if(numA == A && numB == B)break;
				if(numA > A) {
					num = -1;
					break;
				}
				num++;
			}
			System.out.println(num);
		}
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define N 1010
using namespace std;
int n,m;
int a[N];
vector<int> s,w;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d",&a[i]);
		if(a[i]&1) s.push_back(a[i]);
		else w.push_back(a[i]);
	}
	if(s.size()>2) puts("Impossible");
	else if(m==1){
		if(s.size()){
			if(s[0]==1) printf("1\n1\n1\n");
			else printf("%d\n2\n%d %d\n",s[0],s[0]/2,s[0]-s[0]/2);
		}
		else printf("%d\n2\n%d %d\n",w[0],w[0]/2+1,w[0]-w[0]/2-1);
	}
	else if(s.size()==0){
		for(int i=0;i<m;i++) printf("%d ",a[i]);
		puts("");
		printf("%d\n",m);
		a[0]--;a[m-1]++;
		for(int i=0;i<m;i++) printf("%d ",a[i]);
		puts("");
	}
	else if(s.size()==1){
		printf("%d ",s[0]);
		for(int i=0;i<w.size();i++) printf("%d ",w[i]);
		puts("");
		printf("%d\n",m);
		printf("%d ",s[0]+1);
		w[w.size()-1]--;
		for(int i=0;i<w.size();i++) printf("%d ",w[i]);
		puts("");
	}
	else if(s.size()==2){
		printf("%d ",s[0]);
		for(int i=0;i<w.size();i++) printf("%d ",w[i]);
		printf("%d\n",s[1]);
		s[0]--,s[1]++;
		m-=(s[0]==0);
		printf("%d\n",m);
		if(s[0]) printf("%d ",s[0]);
		for(int i=0;i<w.size();i++) printf("%d ",w[i]);
		printf("%d\n",s[1]);
	}
	else while(1);
	return 0;
}

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

int check(set<char> &S) {
    for (int i = (int)'a'; i <= (int)'z'; i++) {
        if (!S.count((char)i)) {
            return i;
        }
    }
    return -1;
}

    int main()
{
    set<char> S;
    string c;

    // cout << (int)'a' << " " << (char)(int)'a' << endl;
    cin >> c;
    for (int i = 0; i < c.size(); i++)
    {
        S.insert(c[i]);
    }

    int result = check(S);
    if (result != -1) {
        cout << (char)result << endl;
    }
    else
    {
        cout << "None" << endl;
    }
}

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

string binary(int a){
	string s = "";
	while(a > 0){
		s = (char)((a%2)+'0') + s;
		a /= 2;
	}
	while(s.size() < 5)s = '0' + s;
	return s;
}

int main(){
	map<char, string> input;
	map<string, char> output;
	
	output["101"] = ' ';
    output["000000"] = '\'';
    output["000011"] = ',';
    output["10010001"] = '-';
    output["010001"] = '.';
    output["000001"] = '?';
    output["100101"] = 'A';
    output["10011010"] = 'B';
    output["0101"] = 'C';
    output["0001"] = 'D';
    output["110"] = 'E';
    output["01001"] = 'F';
    output["10011011"] = 'G';
    output["010000"] = 'H';
    output["0111"] = 'I';
    output["10011000"] = 'J';
    output["0110"] = 'K';
    output["00100"] = 'L';
    output["10011001"] = 'M';
    output["10011110"] = 'N';
    output["00101"] = 'O';
    output["111"] = 'P';
    output["10011111"] = 'Q';
    output["1000"] = 'R';
    output["00110"] = 'S';
    output["00111"] = 'T';
    output["10011100"] = 'U';
    output["10011101"] = 'V';
    output["000010"] = 'W';
    output["10010010"] = 'X';
    output["10010011"] = 'Y';
    output["10010000"] = 'Z';
	
	for(char a = 'A';a <= 'Z';a++)input[a] = binary(a-'A');
	input[' '] = "11010";
    input['.'] = "11011";
    input[','] = "11100";
    input['-'] = "11101";
    input['\''] = "11110";
    input['?'] = "11111";
	
	string s;
	while(getline(cin, s)){
		string code;
		for(int i = 0;i < s.size();i++){
			code += input[s[i]];
		}
		
		string res = "", tmp = "";
		for(int i = 0;i < code.size();i++){
			tmp += code[i];
			if(output[tmp]){
				res += output[tmp];
				tmp = "";
			}
		}
		cout << res << endl;
	}
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


const int MOD = 1000000007;
int main() {
    int N; cin >> N;
    ll dp[120][5][5][5];//0->A 1->C 2->G 3->T  4-> No

    REP(n,N){
        REP(i,5){
            REP(j,5){
                REP(k,5){
                    dp[n][i][j][k] = 0;
                }
            }
        }
    }

    dp[0][4][4][4] = 1;

    REP(n,N){
        REP(i,5){
            REP(j,5){
                REP(k,5){
                    REP(next,4){
                        if(j==0 && k==2 && next==1) continue;//AGC
                        if(j==0 && k==1 && next==2) continue;//ACG
                        if(j==2 && k==0 && next==1) continue;//GAC
                        if(i==0 && k==2 && next==1) continue;//A?GC
                        if(i==0 && j==2 && next==1) continue;//AG?C
                        dp[n+1][j][k][next] += dp[n][i][j][k];
                        dp[n+1][j][k][next] %= MOD;
                    }
                }
            }
        }
    }

    ll ans = 0;
    REP(i,4){
        REP(j,4){
            REP(k,4){
                ans += dp[N][i][j][k];
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
    int n,m,x;
    cin>>n>>m>>x;
    int l=0,r=0;
    int a;
    for(int i=1;i<=m;i++){
        cin>>a;
        if(a>x)
            r++;
        else
            l++;
    }
    if(l>r)
        cout<<r<<endl;
    else
        cout<<l<<endl;
    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int N;cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  typedef pair<int,int> P;
  std::vector<P> d(N+1,P(-1,0));
  d[0]=P(LINF,0);
  for(int i=N-1;i>=0;i--){
    int l=0;int r=N+1;
    while(r-l>1){
      int m=(l+r)/2;
      if(d[m].first<=v[i])r=m;
      else l=m;
    }
    d[r]=P(v[i],d[r-1].second+v[i]);
  }
  int ans;
  for(int i=0;i<=N;i++)if(d[i].first>=0)ans=d[i].second;
  cout<<ans<<endl;
}



Measured memory_bytes: 5208
#include <iostream>

using namespace std;
const int MAXN = 100;
int n, m;

int k[MAXN];
int s[MAXN][MAXN];
int p[MAXN];

bool check(int mask) {
  for (int i=0;i<m;i++) {
    int cnt = 0;
    for (int j=0;j<k[i];j++) {
      if ((mask >> (s[i][j]- 1)) & 1) {
        cnt++;
      }
    }
    if (p[i] != cnt % 2) {
      return false;
    }
  }
  return true;
}

void solve() {
  int cnt = 0;
  for (int i=0;i<1<<n;i++) {
    if (check(i)) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

int main() {
  cin >> n >> m;
  for (int i=0;i<m;i++) {
    cin >> k[i];
    for (int j=0;j<k[i];j++) {
      cin >> s[i][j];
    }
  }
  for (int i=0;i<m;i++) {
    cin >> p[i];
  }
  solve();
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mxn=524288,md=924844033;
int power(int x,int p){
	int ret=1;
	for (;p;p>>=1,x=1ll*x*x%md)
		if (p&1) ret=1ll*ret*x%md;
	return ret;
}
bool check(int x){
	int num=md-1;
	for (int i=2;i*i<=num;++i)
		if (num%i==0){
			if (power(x,(md-1)/i)==1) return 0;
			for (;num%i==0;num/=i);
		}
	if (num>1&&power(x,(md-1)/num)==1) return 0;
	return 1;
}
int len,ln,invn,rev[mxn],w[21][mxn];
void NTT(int *a,int flg){
	for (int i=0;i<len;++i)
		if (i<rev[i]) swap(a[i],a[rev[i]]);
	for (int i=1,p=0;i<=len>>1;i<<=1,++p)
		for (int j=0,k,t,x,y;j<len;j+=i<<1)
			for (k=j,t=i;k<j+i;++k,t+=flg){
				x=a[k],y=1ll*w[p][t]*a[k+i]%md;
				a[k]=(x+y)%md,a[k+i]=(x-y)%md;
			}
	if (flg==-1)
		for (int i=0;i<len;++i)
			a[i]=1ll*a[i]*invn%md;
}
void NTT_init(int n){
	for (len=1,ln=0;len<n;len<<=1,++ln);
	for (int i=0;i<len;rev[i]=rev[i>>1]>>1|((i&1)<<(ln-1)),++i);
	invn=power(len,md-2);
}
void W_init(int n){
	NTT_init(n);
	for (int i=1,p=0;i<=len>>1;i<<=1,++p){
		w[p][i]=1;
		int x=power(5,(md-1)/(i<<1));
		for (int j=1;j<i;++j) w[p][i+j]=1ll*x*w[p][i+j-1]%md;
		x=power(x,md-2);
		for (int j=1;j<i;++j) w[p][i-j]=1ll*x*w[p][i-j+1]%md;
	}
}
int fct[mxn],ifc[mxn];
void init(int n){
	fct[0]=ifc[0]=1;
	for (int i=1;i<=n;++i) fct[i]=1ll*fct[i-1]*i%md;
	ifc[n]=power(fct[n],md-2);
	for (int i=n-1;i;--i) ifc[i]=ifc[i+1]*(i+1ll)%md;
}
int n,m,head[mxn],cnt[mxn],a[mxn],b[mxn];
struct ed{int to,nxt;}edge[mxn<<1];
void addedge(int u,int v){
	edge[++m]=(ed){v,head[u]},head[u]=m;
	edge[++m]=(ed){u,head[v]},head[v]=m;
}
int dfs(int u,int fa){
	int siz=1;
	for (int i=head[u],v;i;i=edge[i].nxt)
		if ((v=edge[i].to)!=fa) siz+=dfs(v,u);
	if (u>1) ++cnt[siz];
	++cnt[n-siz];
	return siz;
}
int main()
{
	scanf("%d",&n);
	init(n);
	W_init(n<<1);
	for (int i=1,x,y;i<n;++i)
		scanf("%d%d",&x,&y),addedge(x,y);
	dfs(1,0);
	for (int i=0;i<n;++i)
		a[i]=1ll*cnt[n-i]*fct[n-i]%md,b[i]=ifc[i];
	NTT(a,1),NTT(b,1);
	for (int i=0;i<len;++i)
		a[i]=1ll*a[i]*b[i]%md;
	NTT(a,-1);
	for (int i=1;i<=n;++i)
		printf("%lld\n",((1ll*fct[n]*ifc[n-i]%md*n%md-a[n-i])*ifc[i]%md+md)%md);
	return 0;
}

Measured memory_bytes: 69376
function main(arg) {
	arg  = arg.split("\n")
	var tmp = arg[0].split(" ").map((e) => Number(e))
	var x = tmp[2]
	var y = tmp[3]
	var xi = arg[1].split(" ").map((e) => Number(e))
	var yi = arg[2].split(" ").map((e) => Number(e))

	xi.push(x)
	yi.push(y)

	var xi_max = Math.max.apply(null, xi);
	var yi_min = Math.min.apply(null, yi);

	var i = 0
	var flag = false
	for (i = yi_min; i > xi_max; i--) {
		flag = true
		if (flag) {
			break
		}
	}

	if (flag) {
		console.log('No War')
	} else {
		console.log('War')
	}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int a[60];
int b[60];

int c[60];
int d[60];

int main(void){
    // Here your code !
    int n,m;
    cin >> n >> m;
    
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    for(int i = 0; i < m; i++){
        cin >> c[i] >> d[i];
    }
    
    for(int i = 0; i < n; i++){
        
        int pos = 0,dis = 1000000000;
        
        for(int j = 0; j < m; j++){
            
            if( dis > abs(a[i] - c[j]) + abs(b[i] - d[j]) ){
                pos = j+1;
                dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            }
            
        }
        
        cout << pos << endl;
    }
    
    
    
}


Measured memory_bytes: 256
while True:
    n = int(input())  ## n = len(S)
    if (n==0):
        break
    S = list(map(int, input().split()))
    C = []
    for s in S:
        num = S.count(s)
        C.append(num)
    c = 0
    #print(c,C)
    if (C == S):
        print(c)
        print(*C)
    else:
        while True:
            copy = C[:]
            for i in range(n):
                ci = C[i]
                num = copy.count(ci)
                C[i] = num
            c += 1
            #print(c,C)
            if (C == copy):
                print(c)
                print(*C)
                break
        


Measured memory_bytes: 5596
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    nkeep=n
    sn=0
    while n>0:
        sn+=n%10
        n=n//10
    if nkeep%sn==0:
        print('Yes')
    else:
        print('No')
resolve()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << ele << endl
#define print10(ele) cout << fixed << setprecision(10) << ele << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int n, m;
  cin >> n >> m;
  ivec s(m);
  vector<char> c(m);
  REP(i, m) { cin >> s[i] >> c[i]; }

  REP(i, pow(10, n + 1)) {
    string num = to_string(i);
    if (num.size() == n) {
      bool ok = true;
      REP(j, m) {
        if (num[s[j] - 1] != c[j]) ok = false;
      }
      if (ok) {
        print(num);
        return 0;
      }
    }
  }
  print(-1);
  return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if( A == 5 && B == 5 && C == 7 ){
    cout << "YES" << endl;
  }else if( A == 5 && B == 7 && C == 5 ){
    cout << "YES" << endl;
  }else if( A == 7 && B == 5 && C == 5 ){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string a,b,c;
class game
{
private:
  string a,b,c;
public:
  game(string x,string y,string z)
  {
    a=x;b=y;c=z;
  }
  void charlie_chance()
  {
    if(c.empty())
    {cout<<"C\n";return;}
    char ch=c[0];
    c.erase(c.begin(),next(c.begin()));
    switch(ch)
    {
      case 'a': alice_chance(); break;
      case 'b' : bob_chance(); break;
      case 'c' : charlie_chance(); break;
    }

  }
  void bob_chance()
  {
    if(b.empty())
    {cout<<"B\n";return;}
    char ch=b[0];
    b.erase(b.begin(),next(b.begin()));
    switch(ch)
    {
      case 'a': alice_chance(); break;
      case 'b' : bob_chance(); break;
      case 'c' : charlie_chance(); break;
    }

  }
  void alice_chance()
  {
    //cout<<"ASD";
    if(a.empty())
    {cout<<"A\n";return;}
    char ch=a[0];
    a.erase(a.begin(),next(a.begin()));
    switch(ch)
    {
      case 'a': alice_chance(); break;
      case 'b' : bob_chance(); break;
      case 'c' : charlie_chance(); break;
    }

  }

};
int main()
{
  string x,y,z;
  cin>>x>>y>>z;
  game d(x,y,z);
  d.alice_chance();
  return 0;
}


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

int main()
{
        ll N; cin >> N;
        vector<ll> A(N, 0);
        map<ll, ll, greater<ll>> m;
        for (int i = 0; i < N; ++i) {
                cin >> A[i];
                m[A[i]]++;
        }
        int cnt = 0;
        ll a = 0;
        ll b = 0;
        for (auto i : m) {
                if (i.second > 1) {
                        if (cnt == 0) {
                                a = i.first;
                                if (i.second > 3) {
                                        b = i.first;
                                        break;
                                }
                                cnt++;
                        }
                        else {
                                b = i.first;
                                break;
                        }
                }
        }
        cout << a * b << endl;



}


Measured memory_bytes: 7296