akhauriyash/Code-Regression huggingface dataset:
import static jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType.S;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        if(S.charAt(2)==S.charAt(3) && S.charAt(4)==S.charAt(5)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  
  long long sum = 0;
  unsigned long long cnt_1 = 0;
  for(int i = 0; i < n; i++){
    sum += a[i];
    if(i % 2 == 0 && sum <= 0){
      cnt_1 += (1-sum);
      sum = 1;
    }else if(i % 2 == 1 && sum >= 0){
      cnt_1 += (sum + 1);
      sum = -1;
    }
  }
  unsigned long long cnt_2 = 0;
  sum = 0;
  for(int i = 0; i < n; i++){
    sum += a[i];
    if(i % 2 == 0 && sum >= 0){
      cnt_2 += (sum + 1);
      sum = -1;
    }else if(i % 2 == 1 && sum <= 0){
      cnt_2 += (1 - sum);
      sum = 1;
    }
  }
  cout << min(cnt_1, cnt_2) << endl;
}


Measured memory_bytes: 640
Option Strict On

Module Module1
    Const m As Int32 = 2
    Dim N, A, tmp(m - 1) As Long

    Sub Main()
        For i As Int32 = 0 To m - 1
            tmp(i) = CLng(Console.ReadLine())
        Next

        'let'
        N = tmp(0) : A = tmp(1)

        Console.WriteLine _
        (New String() {"Yes", "No"}(Convert.ToInt32(A < N Mod 500)))

    End Sub

End Module


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  ll K; scanf("%lld", &K);
  vector<ll> freqs(1e5 + 5, 0);
  int a, b;
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &a, &b);
    freqs[a] += b;
  }
  for (int i = 1; i <= 1e5; ++i) {
    freqs[i] += freqs[i - 1];
  }
  int ans = -1;
  for (int i = 1; i <= 1e5; ++i) {
    if (K <= freqs[i]) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
const int Maxn = 1e9 + 10;
const int N = 1e5 + 10;
const int INF=(0x7fffffff)/2;
const int MOD = 1000000007;

int main(){
	ll a, b, c;
	while(~scanf("%lld %lld %lld", &a, &b, &c)){
		if(a % 2 == 0 || b % 2 == 0 || c % 2 ==0)
			printf("0\n");
		else
			//d = min(a * b, min(a * c, b *c));
			printf("%lld\n",min(a * b, min(a * c, b *c)));
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
#include <queue>
#include <type_traits>
#include<cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
    unsigned long long MOD =1000000007;
    unsigned long long N,M;
    cin >> N >> M;
    vector<unsigned long long> vec(M+1);
    for(int i=0;i<M;i++){
        unsigned long long x;
        cin >> x;
        vec[i]=x;
    }
    vector<unsigned long long> kaidan(N+2);
    int j=0;
    kaidan[0]=1;
    if(vec[0]==1){
        kaidan[1]=0;
        j++;
    }else{
        kaidan[1]=1;
    }
    for(unsigned long long i=2;i<N+1;i++){
        if(vec[j]==i){
            if(j==M-1){
                kaidan[i]=0;
                continue;
            }else{
            j++;
            kaidan[i]=0;
            continue;
            }
        }else{
            kaidan[i]=(kaidan[i-1]%MOD+kaidan[i-2] % MOD) % MOD;
        }
    }
    cout << kaidan[N] % MOD<< endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int N=200200;

void GG(){
	puts("-1");
	exit(0);
}

vector<int> qaq;

void ae(int i,int j){
	printf("%d %d\n",i,j);
}

char s[N];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	if(s[n]=='1')GG();
	if(s[1]=='0'||s[n-1]=='0')GG();
	for(int i=1;i<=n-1;i++){
		if(s[i]!=s[n-i])GG();
	}

	s[n]=1;

	qaq.push_back(1);
	for(int i=2;i<=n;i++){
		if(s[i]=='0'){
			qaq.push_back(i);
		}else{
			for(vector<int>::iterator it=qaq.begin();it!=qaq.end();it++){
				ae(*it,i);
			}
			qaq.clear();
			qaq.push_back(i);
		}
	}
	return 0;
}

Measured memory_bytes: 2040
while(1):
    N,Q=tuple(map(int,input().split()))
    if not(N or Q):
        break
    data=[]
    temp=[]
    for i in range(N):
        temp=list(map(int,input().split()))
        temp.pop(0)
        data.append(temp) 

    sum=0
    max=0
    index=0
    for i in range(100):
        sum=0
        for j in range(N):
            sum=sum+int((i in data[j]))
            if sum >= Q and sum > max:
                max = sum
                index=i

    print(index)

        
    



Measured memory_bytes: 5616
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main(){
   int n;
   cin >> n;
   int b[n];
   REP(i,n-1) cin >> b[i];
   
   int a=0;
   REP(i,n){
      if(i==0) a+=b[i];
      else if(i==n-1) a+=b[i-1];
      else a+=min(b[i-1],b[i]);
   }
   
   cout << a << endl;
   
   
   
   return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define debg(a) cout<<#a<<" "<<a<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl;
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple

typedef long long ll;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef string str;
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  
  str s;
  cin>>s;
  int res=0;
  for(auto&c:s)if(c=='o')res++;
  int n=15-(int)s.size();
  int ans=n+res;
  cout<<(ans>=8?"YES":"NO")<<endl;
   
  
  
  return 0;
}


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

int main(void) {
    int n;
    cin >> n;
    vector<string> w(n);
    map<string, int> m;
    for (int i = 0; i < n; i++) {
        cin >> w.at(i);
        m[w.at(i)]++;
    }
    for (int i = 1; i < n; i++) {
        if (m[w.at(i)] > 1) {
            cout << "No" << endl;
            return 0;
        }
        if (w.at(i - 1).back() != w.at(i).front()) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    string s;
    cin >> s;
    int a = 0;
    REP(i,s.length()){
        if (a == 0 && s[i] == 'C')
            a++;
        else if (a == 1 && s[i] == 'F')
            a++;
    }

    if (a == 2){
        cout << "Yes" << endl;
    }else
    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))

dp = [0] * N

for i in range(1,N):
    if i == 1:
        dp[i] = dp[i-1] + abs(H[i] - H[i-1])
    else:
        dp[i] = min(dp[i-1] + abs(H[i] - H[i-1]),dp[i-2] + abs(H[i] - H[i-2]))
print(dp[-1])

Measured memory_bytes: 20620
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int> gate(n+1);
  rep(i,m){
    int a;
    cin>>a;
    gate[a]++;
  }
  int cost1=0;
  int cost2=0;
  rep(i,x){
    if(gate[i]==1) cost1++;
  }
  rep2(i,x,n){
    if(gate[i]==1) cost2++;
  }
  cout<<min(cost1,cost2)<<endl;
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>

const int kN = 100000 + 5;
int n, m;
std::vector<int> edges[kN];
int color[kN];
bool odd;
int cnt[2];

void dfs(int u, int c)
{
    if (color[u] != -1) {
        if (color[u] != c)
            odd = true;
        return ;
    }
    color[u] = c;
    cnt[c] ++;
    for (int v : edges[u])
        dfs(v, c ^ 1);
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; ++ i) {
        int a, b;
        scanf("%d%d", &a, &b);
        edges[a].emplace_back(b);
        edges[b].emplace_back(a);
    }
    memset(color, -1, sizeof(color));
    long long result = -m;
    for (int i = 1; i <= n; ++ i) if (color[i] == -1) {
        odd = false;
        cnt[0] = cnt[1] = 0;
        dfs(i, 0);
        int sz = cnt[0] + cnt[1];
        if (sz >= 4) {
            if (odd) {
                result += (sz - 1) * 1LL * sz / 2;
            } else {
                result += cnt[0] * 1LL * cnt[1];
            }
        }
    }
    printf("%lld\n", result);
}


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

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

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

const int N = 100000 + 1;
const int inf = (int)1e8 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MAX_INT = (1 << 31) - 1;
const double eps = 1e-6;
const double pi = atan2(0, -1);

/*void print(vector<auto> &a)
{
    for (auto i : a)
        cout << i << " ";
    cout << endl;
}*/

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("calc.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n)
        cin >> a[i];
    ll ans[n];
    rep(i, 0, n)
        ans[i] = 0;
    map<int, set<int> > m;
    rep(i, 0, n)
        m[a[i]].insert(i);
    while (sz(m))
    {
        auto curr = --m.end();
        int pos = *(curr->se.begin());
        if (pos == 0)
        {
            for (auto it : m)
                ans[pos] += 1LL * it.fi * sz(it.se);
            break;
        }
        auto curr1 = --(--m.end());
        ans[pos] += 1LL * (curr->fi - curr1->fi) * sz(curr->se);
        if (sz(curr->se) > sz(curr1->se))
            curr1->se.swap(curr->se);
        for (auto x : curr->se)
            curr1->se.insert(x);
        m.erase(curr->fi);
    }
    rep(i, 0, n)
        cout << ans[i] << "\n";
    return 0;
}


Measured memory_bytes: 16384
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdio>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<


typedef long long ll;
typedef pair <int, int> P;
#define X first
#define Y second

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c); // why it use & address operator ??

  int rje=0;
  for(; rje < 100000000; rje++) {
    if (a % 2 || b %2 || c %2) break;
    int a2 = a/2, b2 = b/2, c2 = c/2;
    a = b2 + c2;
    b = c2 + a2;
    c = a2 + b2;
  }

  printf("%d\n", rje < 1000000 ? rje : -1);

  return 0;
}

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


int main()
{


     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    
    int t=1;
    while(t--)
    {
      
      int a;
      cin>>a;
      cout<<2*pi*a<<endl;


      }

return 0;

}

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

int main() {
  int N, A, B;
  int planA, planB;
  
  cin >> N >> A >> B;
  planA = N * A;
  planB = B;
  int x;
  x = (planA <= planB) ? planA : planB;
  
  cout << x << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
using ll = long long ;
int n;
pair<int, int> a[nax];

ll dp[2048][2048];

int main () {

    scanf("%d", &n);

    for (int i = 1 ; i <= n ; ++ i) {
        scanf("%d", &a[i].first);
        a[i].second = i;
    }

    sort(a + 1, a + 1 + n, greater<pair <int, int>> ());


    for (int i = 0 ; i <= n ; ++ i)
        for (int j = 0 ; j <= n ; ++ j)
        dp[i][j] = LLONG_MIN;

    dp[0][0] = 0;

    for (int i = 0 ; i < n ; ++ i) {
        for (int j = 0 ; j <= i ; ++ j) {

            int val = a[i + 1].first;
            int idx = a[i + 1].second;

            int d1 = abs(idx - (j + 1));
            int d2 = abs(n - (i - j) - idx);

            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1LL * val * d1);
            dp[i + 1][j]     = max(dp[i + 1][j], dp[i][j] + 1LL * val * d2);
        }
    }

    ll ans = LLONG_MIN;

    for (int i = 0 ; i <= n ; ++ i) {
        ans = max(ans, dp[n][i]);
    }

    printf("%lld\n", ans);
}
/*
    Good Luck
        -Lucina
*/


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    rep(i,100){
        if(a*(i+1)%b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

#define ll long long 
using namespace std;


int main(){
    int N, cnt = 0;
    cin >> N;
    vector <ll> p(N);
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }
    for(int i = 0; i < N-2; i++){
        if( (p[i] > p[i+1] && p[i+1] > p[i+2]) || (p[i] < p[i+1] && p[i+1] < p[i+2] ) ){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using ll = long long;
using namespace std;
#define modmod 1000000007

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


int main(){
    int N;
    cin >> N;
    int A[N]={0};
    int a;
    for(int i = 0; i < N; i++){
        cin >> a;
        A[a/2]++;
    }

    int limit;
    if(N%2 == 0){
        limit = N/2-1;
    }else{
        limit = N/2;
    }

    //printf("limit : %d\n",limit);

    for(int i = 0; i <= limit; i++){
        //printf("A[%d] : %d\n",i,A[i]);
        if(i == 0){
            if(N%2 == 1 and A[0] != 1){
                cout << 0 << endl;
                return 0;
            }
            if(N%2 == 0 and A[0] != 2){
                cout << 0 << endl;
                return 0;
            }
        }else{
            if(A[i]!=2){
            cout << 0 << endl;
            return 0;
            }
        }
    }
    ll result = 1;
    for(int i = 0; i < N; i++){
        if(A[i]!=0){
            result = ((result%modmod) * (A[i]%modmod)) % modmod;
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int N,Y;
    cin>>N>>Y;

    for(int i=0;i<=N;i++){
        for(int j=0;j<=N-i;j++){
            int k=N-i-j;
            if(Y==10000*i+5000*j+1000*k){
                cout<<i<<' '<<j<<' '<<k<<' ';
                return 0;
            }
        }
    }
    cout<<-1<<' '<<-1<<' '<<-1<<' ';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;
typedef long long ll;

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

	ll* val = new ll[N];
	ll* dp = new ll[21*(N-1)]; fill(dp, dp+(21*(N-1)), 0LL);

	for(int i=0; i<N; i++){ cin >> val[i];}
	dp[val[0]]=1LL;
	
	for(int i=0; i<N-2; i++){
		for(int j=0; j<21; j++){
			if(dp[ 21*i+j ] != 0LL){
				if(j+val[i+1] <= 20LL){ dp[ 21*(i+1)+j+val[i+1] ] += dp[ 21*i+j ];}
				if(j-val[i+1] >= 0LL){ dp[ 21*(i+1)+j-val[i+1] ] += dp[ 21*i+j ];}
			}
		}
	}

	cout << dp[21*(N-2) + val[N-1]] << endl;

	delete[] val; delete[] dp;
	return 0;
}

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

public static partial class Program
{
    //テンプレここから
    public static int ToInt(this string str)
    {
        return int.Parse(str);
    }

    public static long ToLong(this string str)
    {
        return long.Parse(str);
    }
    public static IEnumerable<int> ToInt(this string[] strs)
    {
        return strs.Select(x => x.ToInt());
    }

    public static IEnumerable<long> ToLong(this string[] strs)
    {
        return strs.Select(x => x.ToLong());
    }
    public static IEnumerable<int> SplToInt(this string str, char opr = ' ')
    {
        return str.Split(opr).ToInt();
    }

    public static IEnumerable<long> SplToLong(this string str, char opr = ' ')
    {
        return str.Split(opr).ToLong();
    }
    public static string CRL()
    {
        return Console.ReadLine();
    }
    public static void CWL(object obj)
    {
        Console.WriteLine(obj);
    }
    public static int Diff(int a, int b)
    {
        return Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    }
    public static long Diff(long a, long b)
    {
        return Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    }
    public static int Sign(this int i)
    {
        return Math.Sign(i);
    }
    //テンプレここまで
}

public static partial class Program
{
    static void Main()
    {
        var str = CRL();
        var k = CRL().ToLong();
        var len = Math.Min(str.Length, k);
        for (int i = 0; i < len; i++)
        {
            if (str[i] != '1')
            {
                CWL(str[i]);
                return;
            }
        }

        CWL(1);
    }
}

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

struct DisjointSets
{
    vector<int> representatives, sizes;

    DisjointSets(const int N) : representatives(N), sizes(N, 1)
    {
        iota(begin(representatives), end(representatives), 0);
    }

    int find(const int x)
    {
        if (representatives[x] != x)
            representatives[x] = find(representatives[x]);
        return representatives[x];
    }

    void merge(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x != y)
        {
            representatives[x] = y;
            sizes[y] += sizes[x];
        }
    }

    int size(const int x) { return sizes[find(x)]; }
};

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

    int N, K, L; cin >> N >> K >> L;

    auto road_components = DisjointSets(N);
    for (auto i = 0; i < K; i++)
    {
        int p, q; cin >> p >> q;
        p--; q--;
        road_components.merge(p, q);
    }

    auto railway_components = DisjointSets(N);
    for (auto i = 0; i < L; i++)
    {
        int r, s; cin >> r >> s;
        r--; s--;
        railway_components.merge(r, s);
    }

    auto counts = map<pair<int, int>, int>();
    for (auto i = 0; i < N; i++)
        counts[{road_components.find(i), railway_components.find(i)}]++;

    for (auto i = 0; i < N; i++)
        cout << counts[{road_components.find(i), railway_components.find(i)}] << " ";
    cout << endl;
}


Measured memory_bytes: 15104
// Code for B - Product Max
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define MOD 1000000007
#define mod(x) ( (x) % MOD + MOD ) % MOD

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T, typename U> void view(const std::map<T, U>& m){ for(const auto& e : m){ std::cout << e.first << "=>" << e.second << " "; } std::cout << std::endl; }

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  cout << max(max(a * c, a * d), max(b * c, b * d)) << endl;
  return 0;
}


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

using namespace std;



int main() {

	int N;
	cin >> N;

	vector<long long> vec(N, 0);
	for (int i=0; i < N; i++) {
		cin >> vec[i];
	}

	long long a = -1;
	long long b = -1;
	long long c = -1;

	a = vec[0];
	int res = 0;

	for (int j = 1; j < N; j++) {
		if (b == -1 && vec[j] != a) {
			b = vec[j];
		}
		else if (c == -1 && vec[j] != a && vec[j] != b) {
			c = vec[j];
		}
		else if (c != -1 && vec[j] != a && vec[j] != b && vec[j] != c) {
			res++;
			break;
		}
	}

	long long count1 = 0;
	long long count2 = 0;

	for (int k = 0; k < N; k++) {
		if (vec[k] > 0) {
			count2++;
		}
		else {
			count1++;

		}
	}


	int check = 0;



	if (a == 0 || b == 0) {
		if (c == -1 && count1 * 2 == count2) {

		}
		else {
			res++;
		}
	}
	else {
		if ((a ^ b) == c && N % 3 == 0) {
			int check1 = 0;
			int check2 = 0;
			for (int k = 0; k < N; k++) {
				if (vec[k] == a) {
					check1++;
				}
				else if (vec[k] == b) {
					check2++;
				}
			}

			if (check1 == N / 3 && check2 == N / 3) {

			}
			else {
				res++;
			}
		}
		else {
			res++;
		}
	}

	if (count2 == 0) {
		res = 0;


	}


	string ans;

	if (res == 0) {
		ans = "Yes";
	}
	else {
		ans = "No";
	}

	cout << ans << endl;


}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,i;
	
	cin>>n;
	long long int a[n+10];
	long long int ans[n+10];
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	ans[1]=0;
	ans[2]=abs(a[2]-a[1]);
	for(i=3;i<=n;i++)
	{
		ans[i]=min(ans[i-1]+abs(a[i]-a[i-1]),ans[i-2]+abs(a[i]-a[i-2]));
	//	cout<<ans[i]<<endl;
	}
//	cout<<endl;
	cout<<ans[n]<<endl;
}

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

int main(){
  int n;
  cin>>n;
  int h[n],a[n];
  for(int i=0;i<n;i++)
    cin>>h[i];
  for(int i=0;i<n;i++)
    cin>>a[i];
  
  int base=1;
  while(base<=n)
  {
    base*=2;
  }
  long tree[2*base]={0};
  long dp[n+1]={0},ans=0;
  for(int i=0;i<n;i++)
  {
    long cnt=0;
    int x=h[i]+base;
    while(x>1)
    {
      if(x%2==1)
        cnt=max(cnt,tree[x-1]);
      x/=2;
    }
    dp[h[i]]=cnt+a[i];
    for(int j=base+h[i];j>=1;j/=2)
      tree[j]=max(tree[j],dp[h[i]]);
    
    //for(int j=0;j<h[i];j++)
      //dp[h[i]]=max(dp[h[i]],dp[j]+a[i]);
    ans=max(ans,dp[h[i]]);
  }
  cout<<ans;

}

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

int main()
{
    string s;
    string t;
    cin>>s;
    cin>>t;
    int ans=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i]) {
            ans++;
        }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 3900
import java.util.*;
// . >
class Main{
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		
		// String a = in.nextLine();
		int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
		Set<Integer> set = new HashSet<>();
		set.add(a);
		set.add(b);
		set.add(c);
		// 125
		// 12 5
		// 1 25
		// 1 2 5
		// 125
		// 
		System.out.println(set.size());
		
	}

}


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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

int32_t main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(!a[i]){
            cout << 0;
            return 0;
        }
    }
    ll p = 1;
    ll lmt = 1000000000000000000;
    for(int i = 0; i < n; i++){
        if(a[i] > lmt/p or a[i]>lmt){
            cout << "-1";
            return 0;
        }
        p *= a[i];
    }
    cout << p;

    return 0;
}

Measured memory_bytes: 4052
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

// 解答
function main(inputs:Array<string>) : void {

    // 1辺の長さ
    let length: number = Number.parseInt(inputs[0]) / 3;

    let volume: number = length * length * length;  
    
    console.log(volume);
}



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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  ll;
#define endl '\n'


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


const int MOD = 1000000007;

//////////////////////////////////////////


int r, x, D;
void Input() {

    cin >> r >> D >> x;
}

void Solve() {


    for(int i = 1; i <= 10; i++) {

        x = r*x - D;
        cout << x << endl;
    }
}

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();
  return 0;

}



Measured memory_bytes: 256
cookie = list(map(int,input().split()))
odd = False
cnt = 0
if cookie[0]%2==1 or cookie[1]%2== 1 or cookie[2]%2==1:
    print(0)
elif len(list(set(cookie))) == 1:
    print('-1')
else:
    while not odd:
        tmp = [0 for i in range(3)]
        for i in range(3):
            ix = list(set([0,1,2]) - set([i]))
            tmp[ix[0]] += cookie[i] / 2
            tmp[ix[1]] += cookie[i] / 2
        for i in tmp:
            if not i % 2 == 0:
                odd = True
        cookie = tmp
        cnt += 1
    print(cnt)

Measured memory_bytes: 9296
//
//  main.cpp
//  E - Frequency
//
//  Created by teddywang on 2017/2/18.
//  Copyright © 2017年 teddywang. All rights reserved.
//

#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,s[100010];
ll t[100010];
ll p[100010];
ll c[100010],r[100010];
ll tims[100010];
ll tt[100010];
ll sum[100010];
struct node {
    ll num,pos;
}q[100010];

bool cmp(node &a,node &b)
{
    if(a.num==b.num)
        return a.pos<b.pos;
    else return a.num>b.num;
}

ll lowbit(ll x)
{
    return x&(-x);
}

void update(ll x,ll num)
{
    while(x<=n)
    {
        c[x]+=num;
        x+=lowbit(x);
    }
}

ll getsum(ll x)
{
    ll ans=0;
    while(x>0)
    {
        ans+=c[x];
        x-=lowbit(x);
    }
    return ans;
}

int main()
{
    while(cin>>n)
    {
        ll ans=0;
        memset(t,-1,sizeof(t));
        memset(c,0,sizeof(c));
        memset(tt,0,sizeof(tt));
        ll premax=0;
        ll cmax=0,p1=0,p2=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%lld",&s[i]);
            q[i].num=s[i];
            ans+=s[i];
            q[i].pos=i;
            /*if(premax==0)
            {
                premax=s[1];
                p2=1;
                t[1]=s[1];
            }
            else if(s[i]<premax)
            {
                t[i]=0;
                if(s[i]>cmax)
                {
                    tt[p2]+=s[i]-cmax;
                }
            }
            else
            {
                t[i]=s[i]-premax;
                cmax=premax;
                p1=p2;
                premax=s[i];
                p2=i;
            }
             */
        }
        sort(q+1,q+n+1,cmp);
        q[0].num=0;
        ll cnt=0;
        for(int i=1;i<=n;i++)
        {
            if(q[i-1].num!=q[i].num)
            {
                cnt++;
                s[cnt]=q[i].pos;
                tims[cnt]=1;
                t[cnt]=q[i].num;
            }
            else tims[cnt]++;
        }
        for(int i=1;i<cnt;i++)
        {
            tt[s[i]]+=1ll*tims[i]*(t[i]-t[i+1]);
            s[i+1]=min(s[i],s[i+1]);
            tims[i+1]+=tims[i];
        }
        tt[s[cnt]]+=1ll*tims[cnt]*t[cnt];
        /*
        for(int i=1;i<=n;i++)
        {
            s[q[i].pos]=i;
        }
        for(int i=n;i>=1;i--)
        {
            r[s[i]]=getsum(s[i]);
            tims[i]=1+n-i-r[s[i]];
            update(s[i],1);
        }
        for(int i=2;i<=n;i++)
        {
            tt[i]+=1ll*tims[i]*t[i];
            ans-=tt[i];
        }
        tt[1]=ans;
         */
        for(int i=1;i<=n;i++)
            printf("%lld\n",tt[i]);
        
    }
}

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

const int inf = 1e8;
int n,k,a[8888],dp[8888];

int main(){
  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++)scanf("%d",&a[i]);

  int ans = 0;
  for(int i=0;i<n;i++){
    for(int j=0;j<=a[i]-i+1;j++)dp[j] = inf;
    for(int j=i;j<a[i]-1;j++){
      if(a[i]<a[j])*lower_bound(dp,dp+j-i+1,a[j]) = a[j];
    }
    int arg = lower_bound(dp,dp+a[i]-i+1,inf) - dp;
    if(ans < arg){
      ans = arg;
      if(ans+1+k>=n/2){ printf("%d\n",n/2); return 0; }
    }
  }
  printf("%d\n",ans+1+k);
}

Measured memory_bytes: 1260
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)

int main() {
	ll n,cnt=0,ans=0;
	in(n);
	vll h(n);
	in(h[0]);
	rep(i, 1, n) {
		in(h[i]);
		if (h[i] <= h[i - 1]) {
			cnt++;
		}
		else {
			if (ans < cnt) {
				ans = cnt;
			}
			cnt = 0;
		}
	}

	if (ans < cnt) {
		ans = cnt;
	}
	outn(ans);
	return 0;

}

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

int main(void){
   int N;
   cin>>N;
   vector<long long>A(N);
   for(int i=0;i<N;i++){
      cin>>A[i];
   }
   int ans=0;
   while(1){
      int count=0;
      for(int i=0;i<N;i++){
         if(A[i]%2==0) count++;
      }
      if(count==N){
         for(int i=0;i<N;i++){
            A[i]=A[i]/2;
         }
         ans++;
      }else{
         break;
      }
   }
   cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 256
// Example program
#include <iostream>
#include <string>
using namespace std;


int main()
{
 int c, d;
 cin >> c >> d;
 if ( c < d ){
     cout << "a < b" << endl;
 }else if ( c > d ){
     cout << "a > b" << endl;
 }else if ( c == d ){
     cout << "a == b"<< endl;
 }
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> cnt(1 << 26, 1 << 29);
    cnt[0]  = 0;
    ll curr = 0;
    for (int i = 0; i < n; ++i) {
        int t = 1 << 29;
        curr ^= 1 << (s[i] - 'a');
        for (int j = 0; j < 27; ++j) {
            ll temp = curr ^ (1 << j);
            if (j == 26)
                temp = curr;
            chmin(t, 1 + cnt[temp]);
        }
        chmin(cnt[curr], t);
    }
    if (curr == 0)
        cout << 1 << "\n";
    else
        cout << cnt[curr] << "\n";
    return 0;
}

Measured memory_bytes: 262660
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<cmath>
#include<set>
#include<stack>
#include<cstdio>
#include<sstream>
#include<vector>
#include<bitset>
#include<algorithm>

using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define gc(x)  scanf(" %c",&x);
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define ll long long
const ll mod =  998244353;
const int N = 1e5;
const int M = 2e6 + 1005;
int main()
{
    int a;
    cin>>a;
    double b = a / 1.08;
    int x = b;
    for(int i = x;i<=x+10;++i){
        int d = i*1.08;
        if(d == a) return cout<<i,0;
    }
    puts(":(");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  set<int>a,b;
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    a.insert(x);
  }
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    b.insert(x);
  }
  vector<int>c;
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
  for(int i=0;i<c.size();i++)cout<<c[i]<<endl;
}



Measured memory_bytes: 21984
import java.util.*;
public class Main {
 
    public static void main(String[] args) {
        // write your code here
        /*
        System.out.println(ruijou(33));
        System.exit(0);
 
        */
        Scanner scanner = new Scanner(System.in);
        long x=scanner.nextLong();
        long y=scanner.nextLong();
        long z=y/x;
        System.out.println(ruijou(z)+1);
    }
    public static long ruijou(long n){
        if(n<2){
            return 0;
        }else{
            return ruijou(n/2)+1;
        }
    }
}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;

int main(){
	int n;
	while(cin>>n,n){
		vector<int> a(n); FOR(i,n) cin>>a[i];
		int m = 35;
		int i = 0;
		while(m){
			int x = (m-1)%5;
			m -= x;
			cout << m<< endl;
			x = a[(i++)%sz(a)];
			x = min(x,m);
			m-=x;
			cout<<m<<endl;
		}
	}

	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

int main(){
    ll x,n;
    cin >> x >> n;
    bool forbiddenlist[110] = {};

    rep(i,0,n){
        ll p;
        cin >> p;
        forbiddenlist[p] = true;
    }

    ll dist = INF,ans = 0;
    rep(i,0,110){
        if(dist > abs(x - i) && forbiddenlist[i] == false){
            dist = abs(x-i);
            ans = i;
        }
    }

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


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


int main(int argc, char const *argv[])
{
	
	 int n,m;
	 cin>>n>>m;

	 int l[100000];
	 int r[100000];

	 int id[100001]={0};
	 int sum=0;
	 int ans=0;

	 
	 for(int i=0;i<m;i++)
	 {
	 	cin>>l[i];
	 	id[l[i]-1]++;
	 	cin>>r[i];
	 	id[r[i]]--;
	 }

	 

	 for(int j=0;j<n;j++)
	 {	sum=sum+id[j];
	 	
	 	if(sum==m)
	 	{
	 		ans++;
	 	}


	 }

	 cout<<ans;
	return 0;
}	

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n, d;
	cin >> n >> d;
	if (d <= n){
		lld count = 0;
		lld i;
		for(i = d+1; i <= n; i++){
			i += (2*d);
			count += 1;
		}
		lld j = i-(2*d)-1;
		if (j+d < n){
			count += 1;
		}
		cout << count;
	}
	else{
		cout << "1";
	}
	return 0;
}

Measured memory_bytes: 256
import itertools

n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

nums = [x for x in range(1, m+1)]
num_list = list(itertools.combinations_with_replacement(nums, n))

result_lst = []
for num in num_list:
    result = 0
    for i in abcd:
        a, b, c, d = i[0], i[1], i[2], i[3]
        x = num[b-1] - num[a-1]
        if x == c:
            result += d
    result_lst.append(result)
print(max(result_lst))


Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

int main() 
{
	fastIO;
	int n;
	string s;
	map<string, int> ans;
	cin >> n;
	
	while(n--){
		cin >> s;
		ans[s]++;
	}
		
	cout << "AC x " << ans["AC"] << endl;
	cout << "WA x " << ans["WA"] << endl;
	cout << "TLE x " << ans["TLE"] << endl;
	cout << "RE x " << ans["RE"] << endl;
	
	return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

// https://pyteyon.hatenablog.com/entry/2019/03/11/200000 より
// union by size + path having
class UnionFind {
  public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
	
	// Constructor
	UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	
	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}
	
	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}
	
	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}
	
	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};

int main()
{
	int N, M;
	cin >> N >> M;
	UnionFind uf(N);
	for(int i = 0; i < M; i++){
		int A, B;
		cin >> A >> B;
		uf.merge(A-1, B-1);
	}
	
	ll ans = 0;
	for(int i = 0; i < N; i++){
		ans = max(ans, uf.size(i));
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 6424
import numpy as np
import difflib
S,T = [input() for i in range(2)]
lent=len(T)
lens=len(S)
min=10000
for i in range (0,lens-lent+1):
  now=S[i:i+lent]
  curnum=0
  for j in range(0,lent):
    if now[j]!=T[j]:
      curnum=curnum+1
  if curnum<min:
    min=curnum
print(min)
   

Measured memory_bytes: 27276
N = int(input())
A = list(map(int, input().split()))

l = 0
r = 1
all_xor = A[0]
all_sum = A[0]
count = 0

while True:
    count += r-l
    while r < N:
        # print("l:"+str(l)+" r:"+str(r)+" xor:"+str(all_xor)+" sum:"+str(all_sum))
        all_sum += A[r]
        all_xor = all_xor ^ A[r]
        r += 1
        if all_xor == all_sum:
            count += r-l
        else:
            break
    else:
        break
    while l < r-1:
        all_sum -= A[l]
        all_xor = all_xor ^ A[l]
        l += 1
        if all_sum == all_xor:
            break
else:
    count += l-r
print(count)


Measured memory_bytes: 77900
#include <stdio.h>
int main()
{

  int a,b,i;
  scanf("%d %d",&a,&b);
  if(a>=b) 
    for(i=0;i<a;i++) 
      printf("%d",b);
  else
    for(i=0;i<b;i++) 
      printf("%d",a);
    
 return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

a,b=map(int,input().split())
for i in range(a,b+1):
    if str(i)==str(i)[::-1]:
        count+=1
print(count)

Measured memory_bytes: 40428
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<string>


using namespace std;

int main(void)
{
	int a, b, c;
	int count;
	count = 0;
	cin >> a >> b >> c;
	if (a == b)
	{
		count++;
	}
	if (a == c)
	{
		count++;
	}
	if (b == c)
	{
		count++;
	}
	if (count == 3)
	{
		cout << 1 << endl;
	}
	else
	{
		cout << 3 - count << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
int main(){
  Int l,r;cin >> l >> r;
  Int ans = INF;
  if(r-l>2020){cout << 0 << endl;return 0;}
  for(Int i=l;i<r;i++){
    for(Int j=i+1;j<=r;j++){
      chmin(ans,i*j%2019);
    }
  }
  cout << ans << endl;
}


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

namespace atcoder.abc166.b
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] paramArray = getIntParams();
            int N = paramArray[0];
            int K = paramArray[1];

            List<int> pool = new List<int>();
            for (int i = 0; i < K; i++)
            {
                int d = getIntParam();
                int[] A = getIntParams();

                for (int x = 0; x < A.Length; x++)
                {
                    if (!pool.Contains(A[x]))
                    {
                        pool.Add(A[x]);
                    }
                }
            }
            Console.WriteLine(N - pool.Count);
        }
        static int getIntParam()
        {
            return int.Parse(Console.ReadLine());
        }
        static int[] getIntParams()
        {
            return Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
        }
        static long getLongParam()
        {
            return long.Parse(Console.ReadLine());
        }
        static long[] getLongParams()
        {
            return Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
        }
        static string getStringParam()
        {
            return Console.ReadLine();
        }
        static string[] getStringParams()
        {
            return Console.ReadLine().Split(' ');
        }
        static decimal getDecimalParam()
        {
            return decimal.Parse(Console.ReadLine());
        }
        static decimal[] getDecimalParams()
        {
            return Console.ReadLine().Split(' ').Select(i => decimal.Parse(i)).ToArray();
        }
    }
}


Measured memory_bytes: 28724
import fractions
A,B,C,D=map(int,input().split())
c=B//C-(A-1)//C
d=B//D-(A-1)//D
lm=C*D//fractions.gcd(C,D)
cd=B//lm-(A-1)//lm

print(B-A+1-c-d+cd)

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

int main() {
	char weather[10];

	cin >> weather;

	if (weather[0] == 'S')
		cout << "Cloudy" << endl;
	else if (weather[0] == 'R')
		cout << "Sunny" << endl;
	else
		cout << "Rainy" << endl;

	return 0;
}

Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let t = Array.init n (fun _ -> Scanf.scanf " %d" (fun t -> t)) in
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun t -> t)) in
    let mi = Array.make n 0 in
    let ma = Array.make n 0 in
    
    let rec loop i mx =
        if i < n then (
            if t.(i) > mx then (
                mi.(i) <- t.(i);
                ma.(i) <- t.(i);
                loop (i + 1) t.(i)
            ) else (
                mi.(i) <- 1;
                ma.(i) <- t.(i);
                loop (i + 1) t.(i)
            )
        )
    in
    loop 0 0;

    let rec loop i mx =
        if i >= 0 then (
            if a.(i) > mx then (
                if mi.(i) <= a.(i) &&
                   ma.(i) >= a.(i) then (
                       mi.(i) <- a.(i);
                       ma.(i) <- a.(i);
                ) else (
                    mi.(i) <- 0;
                    ma.(i) <- -1;
                );
                loop (i - 1) a.(i)
            ) else (
                ma.(i) <- min ma.(i) mx;
                loop (i - 1) a.(i)
            )
        )
    in
    loop (n - 1) 0;

    let m = 1_000_000_007 in
    let ( -@) a b = (a - b + m) mod m in
    let ( *@) a b = ((a mod m) * (b mod m)) mod m in

    let rec loop i acc =
        if i = n then acc else
            loop (i + 1) (acc *@ (ma.(i) -@ mi.(i) + 1))
    in
    loop 0 1 |> Printf.printf "%d\n"
)

Measured memory_bytes: 6400
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  int n;
  string s,t;
  cin >> n >> s >> t;
  int ans = n*2;
  rep(i,n){
    if(s.substr(n-i)==t.substr(0,i)){
      ans = n+n-i;
    }
  }
  if(s==t) ans = n;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int A,B;
    cin >> A >> B;
    if(A==B) cout << 2*A << endl;
    else cout << max(A,B)*2-1 << endl;
}

Measured memory_bytes: 256