akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)

void solve(){
	int n, alice=0, bob= 0;
	cin>>n;
	int A[n], j = 1;
	rep(i,0,n)cin>>A[i];
	sort(A, A+n);
	for(int i = n-1; i>=0 ;i--){
		if(j){alice += A[i];j=0;}
		else{bob+=A[i];j=1;}
	}
	cout<<alice-bob<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
char tr(char c){
  int a = c - 'A';
  int b = c - 'a';
  if(0 <= a && a < 26) return (char)(a + 'a');
  return c;
}
//-----------------------------------------

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

  int n;
  cin >> n ;
  int r = 0;
  int h = 0;
  REP(i,n){
    string s, t;
    cin >> s >> t;
    if(s < t) h += 3;
    else if(s > t) r += 3;
    else{
      r++;
      h++;
    }
  }
  cout << r <<" " << h <<endl;




  return 0;
}



Measured memory_bytes: 3232
#include <stdio.h>
int main(){
  int num,max,i,min;
  scanf("%d",&num);
  int a[num];
  for(i = 0 ;i<num ; i++){
    scanf("%d",&a[i]);
  }
  max = a[1] -a[0];
  min = a[0];
  for(i=1;i<=num-1;i++){
    if(max <a[i]-min) max = a[i]-min;
    if(min>a[i]) min = a[i];
   
}
  printf("%d\n",max);
  return 0;
}
    



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

int main(){
    int d;
    cin >> d;
    if(d == 25){
        cout << "Christmas" << endl;
    }
    else if (d == 24){
        cout << "Christmas Eve" << endl;
    }
    else if (d == 23){
        cout << "Christmas Eve Eve" << endl;
    }
    else if (d == 22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

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

Measured memory_bytes: 592
#include<stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int i,a[n];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  for(i=n-1;i!=-1;i--){
    printf("%d",a[i]);
    if(i!=0) printf(" ");
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long k=sc.nextLong();
		Map<Integer,Long> map= new HashMap<Integer,Long>();
		for (int i = 0; i < N; i++) {
			int res = sc.nextInt();
			int count = sc.nextInt();
			map.put(res, map.getOrDefault(res, (long) 0)+count);
		}
		List<Entry<Integer, Long>> l=new ArrayList<Entry<Integer, Long>>();
		
		for(Entry<Integer, Long> e:map.entrySet()){
			l.add(e);
		}
		Collections.sort(l,(a,b)->(a.getKey()-b.getKey()));
		
		for(Entry<Integer, Long> e:l){
			k-=e.getValue();
			if(k<=0) {
				System.out.println(e.getKey());
				break;
			}
		}
	}
}


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

from fractions import gcd
left = [a[0]]
right = [0]*n
right[-1] = a[-1]

for i in range(1,n):
    left.append(gcd(left[-1], a[i]))

for i in range(n-2,-1,-1):
    right[i] = gcd(a[i], right[i+1])

ans = 0
for i in range(n):
    if i == 0:
        ans = max(ans,right[i+1])
    elif i == n-1:
        ans = max(ans, left[i-1])
    else:
        ans = max(ans, gcd(left[i-1],right[i+1]))

print(ans)




Measured memory_bytes: 87776
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;


int lte(vector<int> &pos, vector<int> &neg, int val){
	int cnt = 0;
	for(auto x : pos){
		int l = 0, r = neg.size()-1;
		int ans = -1;
		while(l <= r){
			int mid = (l+r)/2;
			if(x*neg[mid] <= val){
				ans = mid;
				l = mid+1;
			}
			else
				r = mid-1;
		}
		cnt += ans+1;
	}
	return cnt;
} 

int rte(vector<int> &pos, vector<int> &neg, int val){
	int cnt = 0;
	int n = pos.size(), m = neg.size();
	for(int i = 0; i < n-1; i++){
		int l = i+1, r = n-1, ans = i;
		while(l <= r){
			int mid = (l+r)/2;
			if(pos[i]*pos[mid] <= val){
				ans = mid;
				l = mid+1;
			}
			else
				r = mid-1;
		}
		cnt += (ans - i);
	}
	
	for(int i = 0; i < m-1; i++){
		int l = i+1, r = m-1, ans = m;
		while(l <= r){
			int mid = (l+r)/2;
			if(neg[i]*neg[mid] <= val){
				ans = mid;
				r = mid-1;
			}
			else
				l = mid+1;
		}
		cnt += (m - ans);
	}
	return cnt;
}

int32_t main(){
	int n, k;
	cin >> n >> k;
	vector<int> neg, pos;
	map<int,int> m;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		m[x]++;
		if(x < 0)
			neg.push_back(x);
		else if(x > 0)
			pos.push_back(x);
	}
	sort(neg.begin(),neg.end());
	sort(pos.begin(),pos.end());
	
	
	int z = n - neg.size() - pos.size();
	int np = neg.size() * pos.size();
	//int pp = (pos.size() * ((int)pos.size()-1)) + (neg.size() * ((int)neg.size()-1)) ;
	int zp = z * neg.size() + z*pos.size() + z*(z-1)/2;

	if(k <= np){		// ans is neg
		int l = -2e18, r = -1;
		int ans = 0;
		while(l <= r){
			int mid = (l+r)/2;
			if(lte(pos,neg,mid) >= k){
				ans = mid;
				r = mid-1;
			}
			else
				l = mid+1;
		}
		cout << ans << endl;
	}
	else if(k <= np + zp){
		cout << 0;
	}
	else{	// ans is pos
		k = k - np - zp;
		int l = 1, r = 2e18;
		int ans = 0;
		while(l <= r){
			int mid = (l+r)/2;
			if(rte(pos,neg,mid) >= k){
				ans = mid;
				r = mid-1;
			}
			else
				l = mid+1;
		}
		cout << ans << endl;
	}
	
	

	return 0;
}



Measured memory_bytes: 13032
fun main(args: Array<String>) {
    val N = nextLong()
    val max = Math.sqrt(N.toDouble()).toLong()
    var ans = Int.MAX_VALUE
    var a = 1L
    for (a in 1 .. max) {
        if (N % a != 0L) continue
        val b = N / a
        ans = Math.min(ans, Math.max(D(a), D(b)))
    }
    println(ans)
}
fun D(d: Long) =
    if (d > 999999999L) 10 else
    if (d > 99999999L) 9 else
    if (d > 9999999L) 8 else
    if (d > 999999L) 7 else
    if (d > 99999L) 6 else
    if (d > 9999L) 5 else
    if (d > 999L) 4 else
    if (d > 99L) 3 else
    if (d > 9L) 2 else 1
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)


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

using namespace std;
typedef long long ll;


ll ans,mx,mn=1e8,sum;
int main(){
	string s;
	cin>>s;
	ll k;
	cin>>k;
	for(int i=0; i<s.size(); i++){
		if(s[i]!='1'){
			ans = i;
			break;
		}	
	}
	if(k-1 < ans) cout<<1;
	else cout<<s[ans];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int H,sum,i,j,n,m,k;
int main()
{
	scanf("%d%d",&H,&n);
	for (i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		sum+=x;
	}
	if (sum>=H) printf("Yes");else
	printf("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stdlib.h>
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int,int> P;

int N,M;
int ans[5000];

struct Node{
	bool ef;
	vector<int> et;
	int size;
}node[5000];

struct Team{
	int num;
	int score;
}team[5000];

int compare( const void *s1,const void *s2 ){
	int t1 = ((Team*)s1)->score;
	int t2 = ((Team*)s2)->score;
	return t1-t2;
}

void BFS( int st,int *cost ){
	queue<P> que;
	P now;
	int i;
	que.push( P(1,st) );
	while( !que.empty() )
	{
		now = que.front();
		que.pop();
		Node *no = &node[ now.second ];
		rep(i,no->size){
			if( cost[ no->et[i] ] < now.first+1 ){
				cost[no->et[i]] = now.first+1;
				que.push( P( now.first+1,no->et[i] ) ); 
			}			
		}
	}
}


int main(){
	int i,a,b;
	cin >> N >> M;
	rep(i,N){
		node[i].ef = false;
	}
	rep(i,M){
		cin >> a >> b;
		a--;b--;
		node[a].et.push_back( b );
		node[a].size++;
		node[b].ef = true;
	}
	rep(i,N){
		if(node[i].ef == false)
		{
			BFS( i,ans );
			continue;
		}
	}
	rep(i,N){
		team[i].num = i+1;
		team[i].score = ans[i];
	}
	qsort( team,N,sizeof(Team),compare );

	int flag = 0,j;
	rep(i,N){
		cout << team[i].num << endl;
		//if( team[i].score == 0 )
		//	flag++;
		rep(j,N){
			if( j <= i )
				continue;
			if( team[i].score == team[j].score )
				flag++;
		}
	}
	flag = (flag)?1:0;
	cout << flag << endl;
	return 0;
}

Measured memory_bytes: 2256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
// 1-D ?¨?????????????HelloWorld??¨????????????
class Main {
 
    // ????????°???????????¨?????????????????????
    public static void main(String[] args) {
 
        //1?????????60??????60
        final int intMinute  = 60;
 
        //?????????60?§????60
        final int intSecond = 60;
 
        //?§£????????????????????????
        int intAnswerHour = 0;
 
        //?§£?????????????????????
        int intAnswerMinute = 0;
 
        //?§£???????§?????????????
        int intAnswerSecond = 0;
 
 
        try{
            //??????????????????????????\?????????
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
            //??????????????????????????\?????????String?????§????????????
            String strLine = br.readLine();
 
            //??\???????????°????????´???
            int intLine = Integer.parseInt(strLine);
 
            //??????????¨????
            //3600??§?????£?????´??°
            intAnswerHour = intLine / (intMinute * intSecond);
 
            //???????¨????
            //3600?????°??????60??§?????£?????´??°
            intAnswerMinute = (intLine % (intMinute * intSecond)) / intSecond ;
 
            //?§?????¨????
            //60?????°???
            intAnswerSecond = intLine % intSecond;
 
            //???????????????
            System.out.println(intAnswerHour + ":" + intAnswerMinute + ":" + intAnswerSecond);
 
        //????????????
        }catch(IOException e) {
 
            //??????????????????
            System.out.println(e);
 
        //??°?????\????????????
        }catch(NumberFormatException e) {
 
            //??°?????\????????\????????§??????
            System.out.println("??°?????§??\??????????????????");
        }
    }
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

struct UnionFind{
    public:
        UnionFind(int n): _n(n), parent_or_size(n, -1){}

        void unite(int a, int b){
            int x = root(a), y = root(b);
            if(x == y) return;
            if(-parent_or_size[x] < -parent_or_size[y]) swap(x, y);
            parent_or_size[x] += parent_or_size[y];
            parent_or_size[y] = x;
            return;
        }

        bool same(int a, int b){
            return root(a) == root(b);
        }

        int root(int a){
            if(parent_or_size[a] < 0) return a;
            return parent_or_size[a] = root(parent_or_size[a]);
        }

        int get_size(int a){
            return -parent_or_size[root(a)];
        }

        std::vector<std::vector<int>> groups(){
            std::vector<int> leader_buf(_n), group_size(_n);
            for (int i = 0; i < _n; i++) {
                leader_buf[i] = root(i);
                group_size[leader_buf[i]]++;
            }
            std::vector<std::vector<int>> result(_n);
            for (int i = 0; i < _n; i++) {
                result[i].reserve(group_size[i]);
            }
            for (int i = 0; i < _n; i++) {
                result[leader_buf[i]].push_back(i);
            }
            result.erase(
                std::remove_if(result.begin(), result.end(),
                            [&](const std::vector<int>& v) { return v.empty(); }),
                result.end());
            return result;
        }

    private:
        int _n;
        //root node: -1*component size
        //otherwise: parent
        vector<int> parent_or_size;
};

int main()
{
    ll i,j;
    ll n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        --a;    --b;
        uf.unite(a, b);
    }
    int ans = -1;
    rep(i,n){
        ans = max(ans, uf.get_size(i));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4016
n = int(input())
a = [int(i) for i in input().split()]

a.sort()
M1, M2 = 0, 0
for i in range(n) :
    m = min(a[i], a[-1] - a[i])
    if m > M2 :
        M1, M2 = a[i], m
    
print(a[-1], M1)

Measured memory_bytes: 62832
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vector<pair<ll,ll>>pll(n);
  for(auto &a:pll)cin>>a.S>>a.F;
  ll now = llINF;
  sort(ALL(pll),greater<pair<ll,ll>>());
  for(auto a:pll){
    if(now > a.F){
      now = a.F;
    }
    now -= a.S;
  }
  if(now < 0)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

map<ll,ll> M;

ll ans;

ll compME(ll b, ll e, ll m){  // bのe乗のmod m を返す
    if (e == 0) return 1;
    ans = compME(b, e / 2, m);
    ans = (ans * ans) % m;
    if (e % 2 == 1) ans = (ans * b) % m;
    return ans;
}

int main(){
    ll N;
    vector<pair<ll,ll>> A,B;
    vector<ll> D,E;
    ll C[100007];
    cin >> N;
    rep(i,N){
        ll a,b;
        cin >> a;
        A.pb(mp(a,i));
        D.pb(a);
    }
    rep(i,N){
        ll a,b;
        cin >> b;
        B.pb(mp(b,i));
        E.pb(b);
    }
    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(D));
    sort(ALL(E));
    rep(i,N){
        if(E[i]<D[i]){
            cNo;
            return 0;
        }
    }
    rep(i,N){
        if(lower_bound(ALL(E),D[i])-E.begin()==i){
            C[A[i].second]=B[i].second;
        }
        else{
            cout << "Yes" << endl;
            return 0;
        }
    }
    ll X=C[0],K=0;
    while(1){
        if(X==0){
            break;
        }
        X=C[X];
        K++;
    }
    if(K==N-1){
        cNo;
    }
    else{
        cYes;
    }
}

Measured memory_bytes: 7024
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
 
int main(){
    int d, n, t[201], a[201], b[201], c[201], dp[201][201], ans = 0;
    bool can[201][201];
 
    memset(dp, 0, sizeof dp);
    memset(can, false, sizeof can);
    cin >> d >> n;
    for(int i = 1; i <= d; i++){
        cin >> t[i];
    }
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
 
    for(int i = 1; i <= d; i++){
        for(int j = 1; j <= n; j++){
            if(a[j] <= t[i] && t[i] <= b[j]){
                can[i][j] = 1;
            }
        }
    }
 
 
    for(int i = 1; i <= d; i++){
        for(int j = 1; j <= n; j++){
            if(can[i][j]){
                for(int l = 1; l <= n; l++){
                    if(can[i - 1][l]){
                        int x = ((c[j] > c[l])? c[j] - c[l]: c[l] - c[j]);
                        dp[i][j] = max(dp[i][j], x + dp[i - 1][l]);
                    }
                }
            }
            if(i == d){
                ans = max(ans, dp[i][j]);
            }
        }
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1368
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
//__builtin_popcountll()
int vis[500005];
vector<int>g[500005];

void edge()
{
    int u,v;
    cin>>u>>v;
    g[v].pb(u);
    g[u].pb(v);

}
int cnt;
void dfs(int s)
{
	
	vis[s]=1;
	cnt++;
	for(int i=0;i<g[s].size();i++)
	{
		if(!vis[g[s][i]])
		{
			dfs(g[s][i]);
		}
	}
}
int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int n,m,i,j;
    	cin>>n>>m;
    	for(i=0;i<=n;i++)
    	vis[i]=0;
    	for(i=0;i<m;i++)
    	{
    		edge();
		}
		int ans=0;
		for(i=1;i<=n;i++)
		{
			if(vis[i]==0)
			{
				cnt=0;
				dfs(i);
				ans=max(ans,cnt);
			}
		}
		cout<<ans;
    	
    	
		
    
    	

    }

}


Measured memory_bytes: 28516
using System;

class A {
  static void Main (string[] args) {
    int m = -1;
    string s = "";
    for (int c = 0; c < 5; c++) {
      if (c == 0) m = int.Parse(Console.ReadLine());
      if (c != 0 && c != 4) s = Console.ReadLine();
      if (c == 4) m = int.Parse(Console.ReadLine()) - m;
    }
    if (int.Parse(Console.ReadLine()) >= m) {
      Console.WriteLine("Yay!");
    }else{
      Console.WriteLine(":(");
    }
  }
}

Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>
#include<string>
#include<queue>
#include<set>
#include<stack>

using namespace std;

const int MAX_A=8000;
bool dp[MAX_A];

//「vの中身を足し合わせてAを作れるか？」という真偽値を返す
//vの要素を一つも使わないという解答もあり
bool solve(vector<int> v,int A){
    if(A<0) return false;
    if(A==0) return true;
    //真偽値を入れるダサいDP
    for(int i=0;i<MAX_A;i++){
        dp[i]=false;
    }
    dp[0]=true;
    //cout<<"debug"<<endl;
    for(int j=0;j<v.size();j++){
        for(int i=A-1;i>=0;i--){
            if( dp[i] && (i+v[j]<=A) ){
                dp[i+v[j]]=true;
            }
        }
    }
    return dp[A];
}

int main(){
    string str;
    int x,y;
    cin>>str;
    cin>>x>>y;
    //「最初の'T'までは直進する」をx--として表現
    int now=0;
    for(;now<str.size();now++){
        if(str[now]=='F'){
            x--;
        }else{
            break;
        }
    }
    //nowは現在最初のTを示している
    //以降の'F'はこれまで出てきたTの数の偶奇によって2つのグループに分ける．
    //'T'と'T'の間にある'F'は一かたまりとみなす
    int flip=0;
    int length=0;
    vector<int> even,odd;
    str+="T";//番兵の追加
    for(;now<str.size();now++){
        if(str[now]=='T'){
            if(length>0){
                if(flip%2==0){
                    even.push_back(length);
                }else{
                    odd.push_back(length);
                }
            }
            flip++;
            length=0;
        }else{
            length++;
        }
    }
    /*
    cout<<"even"<<endl;
    for(int i=0;i<even.size();i++){
        cout<<even[i]<<' ';
    }
    cout<<endl;
    cout<<"odd"<<endl;
    for(int i=0;i<odd.size();i++){
        cout<<odd[i]<<' ';
    }
    cout<<endl;
     */
    //vectorと目標値を調節
    int Xsum=0;
    for(int i=0;i<even.size();i++){
        Xsum+=even[i];
    }
    //cout<<"x Xsum"<<endl;
    //cout<<x<<' '<<Xsum<<endl;
    x=x+Xsum;
    if(x<0 || x%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    x=x/2;
    int Ysum=0;
    for(int i=0;i<odd.size();i++){
        Ysum+=odd[i];
    }\
    //cout<<"y Ysum"<<endl;
    //cout<<y<<' '<<Ysum<<endl;
    y=y+Ysum;
    if(y<0 || y%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    y=y/2;
    if(solve(even,x) && solve(odd,y)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;
constexpr int mo = 1000000007;
constexpr int  mod = mo;
constexpr ll inf = 1ll<<62;
int main(){
    int n;
    cin>>n;
    vector<ll> h(n);
    for(auto & a : h) cin>>a;
    bool ok = true;
    h[0]--;
    for(int i=1;i<n;++i){
        if(h[i-1] == h[i])continue;
        if(h[i-1] + 1 > h[i]){ok = false; break;}
        h[i]--;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 1024
#include<iostream>

int main(){
	int N, K;
	char *S;
	
	std::cin >> N;
	S = new char[N];
	for(int i=0; i < N; i++){
		std::cin >> S[i];
	}
	std::cin >> K;

	char ch = S[K - 1];

	for(int i=0;i<N;i++){
		if(ch != S[i]){
			S[i] = '*';
		}
	}

	std::cout << S << std::endl;

	delete[] S;

	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

vin par(100010);
vin deep(100010);
vin wei(100010);
void init(int n);
int root(int x);
void unite(int x,int y,int w);
bool same(int x,int y);
int weight (int x);
int diff(int x,int y);

int main(){
    int n,m;cin>>n>>m;
    vin l(m),r(m),d(m);
    rep(i,m)cin>>l[i]>>r[i]>>d[i];
    init(n);
    bool can=true;
    rep(i,m){
        if(same(l[i],r[i])&&diff(l[i],r[i])!=d[i]){
            can=false;
            break;
        }
        unite(l[i],r[i],d[i]);
    }
    if(can)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

void init(int n){
    rep(i,n){
        par[i]=i;
        deep[i]=0;
        wei[i]=0;
    }
}
int root(int x){
    if(par[x]==x)return x;
    else{
        int r=root(par[x]);
        wei[x]+=wei[par[x]];
        return par[x]=r;
    }
}
void unite(int x,int y,int w){
    w+=weight(x);w-=weight(y);
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(deep[x]<deep[y]){
        swap(x,y);
        w=-w;
    }
    if(deep[x]==deep[y])deep[x]++;
    par[y]=x;
    wei[y]=w;
}
bool same(int x,int y){
    return root(x)==root(y);
}
int weight(int x){
    root(x);
    return wei[x];
}
int diff(int x,int y){
    return weight(y)-weight(x);
}

Measured memory_bytes: 3712
n, d = (int(x) for x in input().split())
X = [[int(x) for x in input().split(" ")] for _ in range(n)]
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        s = 0
        for k in range(d):
            s += (X[i][k] - X[j][k]) ** 2
        if (s ** 0.5).is_integer(): ans += 1
print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,q;
  cin>>n;
  vector <int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  cin>>q;
  for(int i=0,k;i<q;i++){
    cin>>k;
    auto e=equal_range(a.begin(),a.end(),k);
    cout<<distance(a.begin(),e.first)<<" "<<distance(a.begin(),e.second)<<endl;
  }

  return 0;

}



Measured memory_bytes: 3104
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char prev;

        int n1 = 0;
        prev = '0';
        for (char s : S.toCharArray()) {
            if (prev != s) {
                n1 += 1;
            }
            prev = switchPrev(prev);
        }

        int n2 = 0;
        prev = '1';
        for (char s : S.toCharArray()) {
            if (prev != s) {
                n2 += 1;
            }
            prev = switchPrev(prev);
        }

        if (n1 < n2) {
            System.out.println(n1);
        } else {
            System.out.println(n2);
        }
    }

    private static char switchPrev(char prev) {
        if (prev == '0') {
            return '1';
        } else {
            return '0';
        }
    }

}


Measured memory_bytes: 26500
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define PI 3.14159265359
using namespace std;
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;}
template <class T> using V=vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007;
const ll MAX = 510000;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
vector<int> Eratosthenes(const int N)
{
    vector<bool> is_prime(N+1, true);
    vector<int> P;
    for(int i=2; i<=N; i++) {
        if (is_prime[i]) {
            for(int j=2*i; j<=N; j+=i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

int main() {
    int h,w;
    cin >> h >> w;
    vector<vector<char>> C(h,vector<char>(w));
    vector<vector<char>> CC(h*2,vector<char>(w,'0'));
    rep(i,h) {
        rep(j,w) {
            cin >> C[i][j];
        }
    }
    rep(i,h) {
        rep(j,w) {
            CC[2*i][j] = C[i][j];
            CC[2*i+1][j] = C[i][j];
        }
    }
    rep(i,h*2) {
        rep(j,w) {
            if (j<=w-2) {
                cout << CC[i][j];
            } else {
                cout << CC[i][j] << "\n";
            }
        }
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const ll mod = 998244353;
const int MAX = 510000;

ll fac[MAX], finv[MAX], inv[MAX];

ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod, n/2);
  else return x * Pow(x,n-1) % mod;
}

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i-1] * (ll)i % mod;
    inv[i] = mod - inv[mod%i] * (mod/(ll)i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}

ll COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main(){
  ll n, m, k;
  cin >> n >> m >> k;
  if(m == 1) {
    if(k == n-1) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
  }
  COMinit();
  ll ans = 0;
  rep(i,k+1) {
    ll c = (COM(n-1,i) * m) % mod;
    (c *= Pow(m-1,n-1-i)) %= mod;
    (ans += c) %= mod; 
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 15592
n=int(input())
xy_list=[list(map(int,input().split())) for _ in range(n)]
import itertools

seq_list = []
for i in range(n):
    seq_list.append(i)

pattern_list = list(itertools.permutations(seq_list))

distance = 0

for j in range(len(pattern_list)):
    distance_sum_tmp = 0
    for k in range(len(pattern_list[j])-1):
            index_from = pattern_list[j][k]
            index_to = pattern_list[j][k+1]
            distance_sum_tmp += (((xy_list[index_from][0] - xy_list[index_to][0]) ** 2 ) + ((xy_list[index_from][1] - xy_list[index_to][1]) ** 2 )) ** 0.5
    distance += distance_sum_tmp

print(distance / len(pattern_list))

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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); ++i)
#define REP(i,start,end) for(int i=(start);i<=(end);++i)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	int k,x;
	cin >> k >> x;
	if(k * 500 >= x) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

void fnInput(vector<int> &rvnElm, vector<int> &rvnTrg)
{
  int nElmCnt, nTrgCnt;
  cin >> nElmCnt;

  rvnElm.resize(nElmCnt);
  for (int i = 0; i < nElmCnt; i++)
    cin >> rvnElm[i];

  cin >> nTrgCnt;

  rvnTrg.resize(nTrgCnt);
  for (int i = 0; i < nTrgCnt; i++)
    cin >> rvnTrg[i];
}

int fnRcsSch(int nPos, int nTrg, const vector<int> &cnrvnElm, vector<vector<int>> &rvvnDP)
{
  if (!nTrg)                    return 1;
  if (nPos == cnrvnElm.size())  return 0;
  if (nTrg < 0)                 return 0;
  if (rvvnDP[nPos][nTrg] != -1) return rvvnDP[nPos][nTrg];

  if (fnRcsSch(nPos + 1, nTrg, cnrvnElm, rvvnDP))
    return (rvvnDP[nPos][nTrg] = 1);
  else if (fnRcsSch(nPos + 1, nTrg - cnrvnElm[nPos], cnrvnElm, rvvnDP))
    return (rvvnDP[nPos][nTrg] = 1);
  else
    return (rvvnDP[nPos][nTrg] = 0);
}

void fnExhSch(const vector<int> &cnrvnElm, const vector<int> &cnrvnTrg)
{
  vector<vector<int>> vvnDP(21, vector<int>(2001, -1));
  
  for (int i = 0; i < cnrvnTrg.size(); i++)
  {
    int nTrg = cnrvnTrg[i];
    int nRtn;

    if (nRtn = fnRcsSch(0, nTrg, cnrvnElm, vvnDP))
      cout << "yes" << endl;
    else
      cout << "no" << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnElm, vnTrg;

  fnInput(vnElm, vnTrg);
  fnExhSch(vnElm, vnTrg);

  return 0;
}

Measured memory_bytes: 3308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define vec(x) vector<x>
ll gcd(ll a,ll b){while(b){ll tmp = a % b;a = b;b = tmp;}return a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
#define rep(x, y) for(int x = 0; x < (y); x++)
#define rrep(x, y) for(int x = (y); x >= 0; x--)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define RREP(x, z, y) for(int x = (y); x >= (z); x--)
#define all(x) x.begin(), x.end()
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define out(x) for(auto i : x) cout << i << " "; cout << endl;
#define outln(x) for(auto i : x) cout << i << " " << endl;
#define vec_cpy(to,from) copy(all(to),back_inserter(from))
#define ary_cpy(to,from) memcpy(to, from, sizeof from)
#define MOD = 1000000007; 
#ifdef DEBUG
#define debug_echo(e) cout << "|" << __LINE__ << "| " << e << endl
#define debug_var(e) cout << "|" << __LINE__ << "| " << #e << ": " << e << endl
#define debug_echo_dp(dp, N) { cout << "[ "; rep(cnt, N) cout << dp[cnt] << " ";  cout << "]" << endl; }
#else
#define debug_echo(e)
#define debug_var(e)
#define debug_echo_dp(dp, N)
#endif

int main(){
  int C,n,d,r,c,ans = 0; cin >> C >> n;
  int harf = n / 2;
  int h_cnt = 0;
  int w_cnt = 0;
  vec(bool) h[harf],w[n],h_goal(n,true),w_goal(harf,true);
  str p[n];

  rep(i,n) cin >> p[i];

  //????????????????????¨
  rep(i,harf)
    rep(j,n){
      h[i].pb(p[i][j] == p[n - i - 1][j]);
      if(p[i][j] != p[n - i - 1][j]) h_cnt++;
    }

  //?¨??????????????????¨
  rep(i,n)
    rep(j,harf){
      w[i].pb(p[i][j] == p[i][n - j - 1]);
      if(p[i][j] != p[i][n - j - 1]) w_cnt++;
    }

  if(w_cnt == 0 && h_cnt == 0) ans++;

  rep(i,C - 1){
    cin >> d;
    rep(i,d){
      cin >> r >> c;
      r--; c--;

      if(h[(r >= harf ? n - r - 1 : r)][c]) h_cnt++;
      else h_cnt--;

      if(w[r][(c >= harf ? n - c - 1 : c)]) w_cnt++;
      else w_cnt--;

      //????????¨???????????????????????¢
      h[(r >= harf ? n - r - 1 : r)][c] = !h[(r >= harf ? n - r - 1 : r)][c];
      w[r][(c >= harf ? n - c - 1 : c)] = !w[r][(c >= harf ? n - c - 1 : c)];
    } 

    if(h_cnt == 0 && w_cnt == 0) ans++;
  }

  cout << ans << endl;
}

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

int main(){
  string s; cin >> s;
  int c = 0;
  long long int ans = 0;
  for(int i=0;i<s.length();i++){
    if(s[s.length()-1-i] == 'B'){
      ans += (long long)(i - c);
      c++;
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define H 1000000000
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    vector<int> h(n);
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    vector<int> dp(n,H);
    dp[0] = 0;
    for(int i=1;i<n;i++){
        for(int k=1;k<=2;k++){
            if(i>=k)
                dp[i] = min(dp[i],dp[i-k]+abs(h[i]-h[i-k]));
        }
    }
    printf("%d\n",dp[n-1]);
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#define n 10^100
char a[n], b[n];
using namespace std;
int main()
{
	int i, cnt = 0;
	scanf("%s",&a);
	scanf("%s",&b);
	if(strlen(a)>strlen(b))
		printf("GREATER\n");
	else if(strlen(a)<strlen(b))
		printf("LESS\n");
    else
	{
    	for(i = 0; i < strlen(a); i++)
	    {
	    	if(a[i]>b[i])
	    	{
		     	printf("GREATER\n");
		    	break;
	    	}
	     	else if(a[i]<b[i])
	     	{
	     		printf("LESS\n");
	     		break;
			}
			else
				cnt++;
		}
		if(cnt == strlen(a))
			printf("EQUAL\n");
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <map>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define INF 1e10
typedef long long ll;
typedef long double ld;
int main(){
    ll n;cin>>n;
    vector<ll> v(n);
    REP(i,n)cin>>v[i];
    ll l,r=0, sum=0;
    REP(i,n-1){
        l=v[i], r=v[i+1];
        if(l-r>0){
            sum+=l-r;
            v[i+1]+=l-r;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4760
import copy

a,b,c = map(int,input().split())

max_v = max(a,b,c)


if max_v == b:
    tmp = a
    a = b
    b = tmp
elif max_v == c:
    tmp = a
    a = c
    c = tmp

tmp_b = (a-b) // 2
tmp_c = (a-c) // 2

if a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 2:
    ans = tmp_b + tmp_c + 1
elif a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 0:
    ans = tmp_b + tmp_c
else:
    ans = tmp_b + tmp_c + 2

print(ans)

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	for(int i = 0; i < 3; ++i){
		int h1, m1, s1;
		cin >> h1 >> m1 >> s1;
		
		int h2, m2, s2;
		cin >> h2 >> m2 >> s2;
		
		int dis = (h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1);
		
		int h = dis / 3600;
		int m = (dis - h * 3600) / 60;
		int s = (dis - h * 3600) % 60;
		
		cout << h << " " << m << " " << s << endl;
	}
	
	return 0;
}

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

namespace AtCoder.Contests.ABC170
{
    /// <summary>
    /// 
    /// </summary>
    static class C
    {
        static void Main(string[] args)
        {
            var x = NextInt();
            var n = NextInt();
            if (n == 0)
            {
                Console.WriteLine(x);
                return;
            }

            var ps = new HashSet<int>(ReadIntArray());

            if (!ps.Contains(x))
            {
                Console.WriteLine(x);
                return;
            }


            for (int i = 1; i < 99; i++)
            {
                var y = x - i;
                if (!ps.Contains(y))
                {
                    Console.WriteLine(y);
                    return;
                }
                y = x + i;
                if (!ps.Contains(y))
                {
                    Console.WriteLine(y);
                    return;
                }
            }
        }

        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


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

int main()
{
	int n, three = 1;
	cin >> n;
	int a[10];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		three *= 3;
	}

	int ans = 1;
	for (int i = 0; i < n; i++) {
		if (a[i] % 2 == 0) {
			ans *= 2;
		}
		else {
			ans *= 1;
		}
	}

	cout << three - ans << endl;

	return 0;
}

Measured memory_bytes: 256
val = str(input())
alphabet_dic = {
    1: "a",
    2: "b",
    3: "c",
    4: "d",
    5: "e",
    6: "f",
    7: "g",
    8: "h",
    9: "i",
    10: "j",
    11: "k",
    12: "l",
    13: "m",
    14: "n",
    15: "o",
    16: "p",
    17: "q",
    18: "r",
    19: "s",
    20: "t",
    21: "u",
    22: "v",
    23: "w",
    24: "x",
    25: "y",
    26: "z"
}

key_num = 0
for k, v in alphabet_dic.items():
    if v == val:
        key_num = k
key_num = key_num + 1
print(alphabet_dic[key_num])


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int len = s.length();
        int count = 0;
        for(int i = 0; i < len; i++) {
            if(s.charAt(i) == '0') {
                count++;
            }
        }
        System.out.println(Math.min(len - count, count) * 2);
    }
}


Measured memory_bytes: 24404
import queue
n=int(input())
e=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  e[a]+=[b]
  e[b]+=[a]
q=queue.Queue()
q.put(1)
vif=[-1]*n
vif[0]=0
while not q.empty():
  now=q.get()
  for to in e[now]:
    if vif[to-1]==-1:
      q.put(to)
      vif[to-1]=vif[now-1]+1
q.put(n)
vis=[-1]*(n+1)
vis[n-1]=0
while not q.empty():
  now=q.get()
  for to in e[now]:
    if vis[to-1]==-1:
      q.put(to)
      vis[to-1]=vis[now-1]+1
ans=0
for i in range(n):
  if vif[i]<=vis[i]:ans+=1
print(['Snuke','Fennec'][ans>n//2])

Measured memory_bytes: 95876
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<queue>
using namespace std;

int main() {

	string t;
	cin >> t;

	int n;
	cin >> n;

	int ans = 0,jud=0;

	for (int i = 0; i < n; i++) {
		string r;
		cin >> r;
		jud = 0;
		for (int j = 0; j < 10; j++) {
			if (r[j] == t[0]) {
				bool b = true;
				for (int k = 0; k < t.size(); k++) {
					if (t[k] != r[(j + k)%10]) {
						b = false;
						break;
					}
				}
				if (b == true) {
					jud++;
				}
			}
		}
		if (jud != 0) {
			ans++;
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 3144
n, ma, mb = map(int,input().split())
INF = 10**6
abmax = 10
nmax = 40
medi = []
sumb = 0
suma = 0
for i in range(n):
    a, b, c = map(int,input().split())
    suma += a
    sumb += b
    medi.append([a,b,c])
dp = [[[INF for k in range(nmax*abmax+1)] for j in range(nmax*abmax+1)] for i in range(nmax+1)]
dp[0][0][0] = 0
for i in range(n):
    a, b, c = medi[i]
    for x in range(suma+1):
        for y in range(sumb+1):
            if dp[i][x][y] == INF:
                continue
            if x + a <= suma + 1 and y + b <= sumb + 1:
                dp[i + 1][x][y] = min(dp[i + 1][x][y], dp[i][x][y])
                dp[i + 1][x + a][y + b] = min(dp[i][x][y] + c, dp[i + 1][x + a][y + b])

t = 1
ok = False
ans = INF
for ca in range(1,nmax*abmax+1):
    for cb in range(1,nmax*abmax+1):
        if ma*cb == mb*ca:
            ans = min(ans, dp[n][ca][cb])
    
print(ans if ans != INF else -1)

Measured memory_bytes: 60016
#include <stdio.h>

#define N 200000

int main(){
  int n, i, j, maxi, maxj;
  scanf("%d", &n);
  int num[N];
  for(i = 0; i < n; i++) scanf("%d", &num[i]);
  int max = num[1] - num[0];
  maxj = num[1];
  maxi = num[0];
  for(i = 0; i <= n - 2; i++){
    if(num[i] > maxi) continue;
    for(j = i + 1; j <= n - 1; j++){
      int diff = num[j] - num[i];
      if(diff > max) {
        max = diff;
        maxi = num[i];
        maxj = num[j];
      }
    }
  }
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 3496
#include<bits/stdc++.h>
using namespace std;
vector<int> dp;
int solve(vector<int>&ar ,int k ,int i )
{
   if( i == 0)
   	  return 0;
    if(dp[i] != -1)
    	return dp[i];    // prevent re-cal
    int res =INT_MAX;
    for(int j =1 ; j<= k ;j++)
    	if( i - j >= 0)
          res = min(res, solve(ar, k , i - j) + abs(ar[i] - ar[i-j]));
    
     return dp[i] = res;    // store 
}
int main(){
	int n , k;
	cin >> n >> k;
    dp.clear();
    dp.resize(n, -1);
	vector<int > ar(n);
	for(int i =0 ; i<n; i++ )
		cin>> ar[i];
	cout<< solve(ar, k, n-1) << endl;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}

int main(){
  int N; cin>>N;
  int R; cin >> R;
  if(N<=10){ 
   cout<< R+100*(10-N) << endl;
  }else{
    cout << R << endl;
  }
  


}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
dp=[[0]*3 for _ in range(n+1)]
dp[0][0]=0
dp[0][1]=-10**10#i文字目,0反転してない,1反転してる

for i in range(n):
  dp[i+1][0]=max(dp[i][1]-a[i],dp[i][0]+a[i])
  dp[i+1][1]=max(dp[i][0]-a[i],dp[i][1]+a[i])
print(dp[n][0])



Measured memory_bytes: 32796