akhauriyash/Code-Regression huggingface dataset:
/**
 * File    : F.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-3-12 16:05:13
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int grundy(int a, int k)
{
  if (a < k)
    return 0;
  if (a % k == 0)
    return a / k;
  int d = a / k;
  if (a % k % (d + 1) == 0)
    return d;
  return grundy(d * k - (d + 1) + a % k % (d + 1), k);
}

int main()
{
  int N;
  int A[210];
  int K[210];
  int g[210];
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> A[i] >> K[i];
    g[i] = grundy(A[i], K[i]);
  }
  int x = 0;
  for (auto i = 0; i < N; i++)
  {
    x = x ^ g[i];
  }
  if (x != 0)
  {
    cout << "Takahashi" << endl;
  }
  else
  {
    cout << "Aoki" << endl;
  }
}

Measured memory_bytes: 384
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto s = readln.chomp;

  auto f = true;
  foreach (i; 0..s.length/2) {
    if (s[i] != s[$-i-1]) {
      f = false;
    }
  }

  foreach (i; 0..s.length/4) {
    if (s[i] != s[$/2-1-i]) {
      f = false;
    }
    if (s[$/2+1+i] != s[$-1-i]) {
      f = false;
    }
  }

  if (f) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}


Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define RREPS(i,x) for(int i=((int)(x));i>=0;i--)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

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

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	retur5n a * (b / g);
}*/

int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

int main() {
	vector<int> a(5);
	rep(i, 5)cin >> a[i];

	int k;
	cin >> k;

	int mem, cnt = 0;
	rep(i, 5) {
		mem = a[i];
		rep(j, 5) {
			if (abs(mem - a[j]) > k) cnt++;
		}
	}

	if (cnt == 0) cout << "Yay!" << endl;
	else cout << ":(" << endl;
}

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

int main(void) {
    int64_t N,K;
    int64_t cur = 1;
    cin >> N >> K;

    for(int i=0;i<N;i++) {
        if(cur < K) {
            cur <<= 1;
        } else {
            cur += K;
        }
    }

    cout << cur << "\n";
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp;

#[fastout]
fn main() {
  input! {
    n: usize,
    m: usize,
    x: i64,
    book: [(i64, [i64; m]); n],
  }
  let mut ans = 1 << 60;
  for pat in 0..1 << n {
    let mut und = vec![0; m];
    let mut price = 0;
    for b in 0..n {
      if (pat >> b) & 1 != 0 {
        price += book[b].0;
        for algo in 0..m {
          und[algo] += book[b].1[algo];
        }
      }
    }
    if und.iter().all(|&u| u >= x) {
      ans = cmp::min(price, ans)
    }
  }
  if ans == 1 << 60 {
    ans = -1;
  }

  println!("{}", ans);
}


Measured memory_bytes: 2208
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#define mymalloc(p,n) {p = malloc((n)*sizeof(*p));if ((p)==NULL) {printf("not enough memory?\n"); exit(1);};}


void merge(long *A,long left,long mid,long right,long *swap){
	long n1,n2,i,j,k;
	long *L,*R;
	n1=mid-left;
	n2=right-mid;
	mymalloc(L,n1+1);
	mymalloc(R,n2+1);
	for(i=0;i<n1;i++){
		L[i]=A[left+i];
	}
	for(j=0;j<n2;j++){
		R[j]=A[mid+j];
	}
	L[n1]=LONG_MAX;R[n2]=LONG_MAX;
	i=0;j=0;
	for(k=left;k<right;k++){
		if(L[i]<=R[j]){
			A[k]=L[i];
			i++;
		}
		else{
			A[k]=R[j];
			j++;
			*swap+=n1-i;
		}
	}
	free(L);free(R);
}

void mergeSort(long *A,long left,long right,long *swap){
	long mid;
	if(left+1<right){
		mid=(right-left)/2+left;
		mergeSort(A,left,mid,swap);
		mergeSort(A,mid,right,swap);
		merge(A,left,mid,right,swap);
	}
}

main(){
	long i,j,n;
	long swap;
	long *A;
	scanf("%ld",&n);
	mymalloc(A,n);
	for(i=0;i<n;i++){
		scanf(" %ld",&(A[i]));
	}
	swap=0;
	mergeSort(A,0,n,&swap);
	printf("%ld\n",swap);
	free(A);
	return 0;
}

Measured memory_bytes: 3560
#include<iostream>
#include<string>
using namespace std;
int main(){
int a, v = 0, z=0 , c=0; string s; cin>>s;
a = s.size();
if(s[0] == 'A'){
    for(int i=0; i< a; i++){
     if(s[i] == 'C'){
         z++;
         if(i>=2 && i<a-1)
        v++;
     }
    if (s[i] != 'A' || s[i] != 'C'){
        if(s[i] >= 97 && s[i] <= 122){
            c++;
        }
    }
}
if(v == 1 && z == 1 && c == s.size()-2){
    cout<<"AC";
}
else
    cout<<"WA";
}
else
    cout<<"WA";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=200100;
int n;
vector<int> ver[maxn],A,B,T;
inline void dfs(int x,int fat,int v)
{
	if(v) A.push_back(x);else B.push_back(x);
	for(int i=0;i<(int)ver[x].size();i++)
	{
		int y=ver[x][i];if(y==fat) continue;
		dfs(y,x,v^1);
	}
}
int vis[maxn],ans[maxn];
int main()
{
	cin>>n;
	for(int i=1,a,b;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		ver[a].push_back(b);
		ver[b].push_back(a);
	}
	dfs(1,0,0);
	if(A.size()>B.size()) swap(A,B);
	if(A.size()<=n/3)
	{
		for(int i=0;i<(int)A.size();i++) vis[i*3+3]=1,ans[A[i]]=i*3+3;
		for(int i=1;i<=n;i++) if(!vis[i]) T.push_back(i);
		for(int i=0;i<(int)B.size();i++) ans[B[i]]=T[i];
	}
	else
	{
		int nowa=1,nowb=2,nowc=3;
		for(int i=0;i<(int)A.size();i++) if(nowa<=n) ans[A[i]]=nowa,nowa+=3;else ans[A[i]]=nowc,nowc+=3;
		for(int i=0;i<(int)B.size();i++) if(nowb<=n) ans[B[i]]=nowb,nowb+=3;else ans[B[i]]=nowc,nowc+=3;
	}
	for(int i=1;i<=n;i++) printf("%d ",ans[i]);
	return 0;
}

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

template<class T> struct QueueAggregation {
    using F = function<T(T, T)>;
private :
    struct node {
        T val, sum;
        node (const T &v, const T &s) : val(v), sum(s) { }
    };
    F op;
    stack<node> front_stack, back_stack;
public :
    QueueAggregation (const F &op)
        : op(op), front_stack(), back_stack() { }

    bool empty() const { return front_stack.empty() && back_stack.empty(); }

    size_t size() const { return front_stack.size() + back_stack.size(); }

    T fold_all() const {
        assert(!empty());
        if (front_stack.empty()) {
            return back_stack.top().sum;
        } else if (back_stack.empty()) {
            return front_stack.top().sum;
        } else {
            return op(front_stack.top().sum, back_stack.top().sum);
        }
    }

    void push(const T &x) {
        if (back_stack.empty()) {
            back_stack.emplace(x, x);
        } else {
            T s{op(back_stack.top().sum, x)};
            back_stack.emplace(x, s);
        }
    }

    void pop() {
        assert(!empty());
        if (front_stack.empty()) {
            front_stack.emplace(back_stack.top().val, back_stack.top().val);
            back_stack.pop();
            while (!back_stack.empty()) {
                T s{op(back_stack.top().val, front_stack.top().sum)};
                front_stack.emplace(back_stack.top().val, s);
                back_stack.pop();
            }
        }
        front_stack.pop();
    }

};

int cont (const vector<int>& a, int k) {
    int n = a.size(), cnt = 0;
    vector<int> s(n, 1);
    for (int i = 0; i < n-1; i++) {
        if (a[i] < a[i+1]) s[i+1] += s[i];
    }
    for (auto e : s) if (e == k) cnt++;
    if (cnt < 2) return 1;
    else return -(cnt-1) + 1;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto& e : a) cin >> e;
    
    auto f = [](int a, int b) { return max(a, b); };
    auto g = [](int a, int b) { return min(a, b); };
    QueueAggregation<int> qa1(f), qa2(g);
    
    int ans = cont(a, k);
    for (int i = 0; i < k; i++) { qa1.push(a[i]); qa2.push(a[i]); }
    for (int i = k; i < n; i++) {
        qa1.push(a[i]); qa2.push(a[i]);
        int next = a[i], last = a[i-k];
        int nax = qa1.fold_all(), nin = qa2.fold_all();
        if (next != nax || last != nin) ans++;
        qa1.pop(); qa2.pop();
    }

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

Measured memory_bytes: 4336
#include<iostream>
using namespace std;
int main() {
    int n;
    char s[100002];
    cin >>n >>s;
    int i, ct = 0;
    char tmp = '\0';
    for(i = 0; s[i] != '\0'; i++) {
        if(s[i] == tmp) {
            while(s[i] == tmp){
                i ++;
            }
        }
        if(s[i] == '\0') {break;}
        ct ++;
        tmp = s[i];
    }
    cout << ct << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MAXN 100010
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x<n and y >=0 and y<n)
using namespace std;
const int mod = 1e9 + 7;

int main(){
     int a, b;
     cin >> a >> b;
     if (a < b) cout << "0";
     else cout << "10";
     cout << endl;
     return 0;
}

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

int main()
{
    int n, l = 0, r = l, ans = 0;
    cin >> n;

    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h[i];

    while (l < n)
    {
        if (h[l] == 0)
            l++;
        else if (h[l] > 0)
        {
            r = l;
            while (h[r] > 0 && r < n)
            {
                h[r]--;
                r++;
            }
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cctype>
#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 M_PI
 
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;
typedef string::const_iterator State;

int expression(State&);
int term(State&);
int factor(State&);
int number(State&);

int expression(State &begin){
	int ret = term(begin);
	while (1){
		if (*begin == '+'){
			begin++;
			ret += term(begin);
		}else if (*begin == '-'){
			begin++;
			ret -= term(begin);
		}else{
			break;
		}
	}
	return ret;
}

int term(State &begin){
	int ret = factor(begin);
	while (1){
		if (*begin == '*'){
			begin++;
			ret *= factor(begin);
		}else if (*begin == '/'){
			begin++;
			ret /= factor(begin);
		}else{
			break;
		}
	}
	return ret;
}

int factor(State &begin){
	if (*begin == '('){
		begin++;
		int ret = expression(begin);
		begin++;
		return ret;
	}else{
		return number(begin);
	}
}

int number(State &begin){
	int ret = 0;
	while (isdigit(*begin)){
		ret *= 10;
		ret += *begin - '0';
		begin++;
	}
	return ret;
}

int main() {
	int n;
	cin >> n;
	cin.ignore();
	while (n--){
		string s;
		getline(cin,s);
		State begin = s.begin();
		int ans = expression(begin);
		cout << ans << endl;
	}

    return 0;
}

Measured memory_bytes: 3180
import java.util.*;

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

      int k = sc.nextInt();

      long sum = 0;

      for (int j = 1; j < k + 1; j++) {
         for (int i = 1; i < k + 1; i++) {
            for (int h = 1; h < k + 1; h++) {
               int s = gcd(j, i);
               int t = gcd(s, h);
               sum = sum + t;
            }
         }
      }
      System.out.println(sum);

   }
   
   private static int gcd(int m, int n) {
      if (m < n)
         return gcd(n, m);
      if (n == 0)
         return m;
      return gcd(n, m % n);
   }

}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

//int(E)->to
template<class N,class E>
struct treedp{
	const vvc<E>& g;
	vvc<N> dp1,dp2;
	vc<N> res;
	N dfs1(int v,int p){
		N tmp;tmp.init(v);
		dp1[v].pb(tmp);
		E up;
		for(auto e:g[v])
			if(e!=p)
				dp1[v].pb(dfs1(e,v));
			else
				up=e;
		dp2[v]=dp1[v];
		rng(i,1,dp2[v].size())
			dp2[v][i]=dp2[v][i-1]+dp2[v][i];
		if(p==-1)return N();
		else return dp2[v].back().up(up);
	}
	void dfs2(int v,int p,N cur){
		res[v]=cur+dp2[v].back();
		per(i,g[v].size()){
			auto e=g[v][i];
			if(e==p)continue;
			dp2[v].pop_back();
			dfs2(e,v,(cur+dp2[v].back()).up(e));
			cur=cur+dp1[v].back();
			dp1[v].pop_back();
		}
	}
	treedp(const vvc<E>&gg):g(gg),dp1(g.size()),dp2(g.size()),res(g.size()){
		dfs1(0,-1);
		N tmp;tmp.init(0);
		dfs2(0,-1,tmp);
	}
};

vi cnt;

struct N{
	int v,a,b,c;
	pi mx;
	void init(int vv){
		v=vv;
		a=cnt[v];
		b=c=0;
		mx=pi(0,0);
	}
	N up(int to)const{
		return N{to,a+cnt[to],b+a,c+a,pi(b+a,c+a)};
	}
	N operator+(const N&r)const{
		assert(v==r.v);
		int sum=b+r.b;
		int mn;
		pi z=max(mx,r.mx);
		if(z.b>=sum-z.a)
			mn=z.b-(sum-z.a);
		else
			mn=sum%2;
		return N{v,a+r.a-cnt[v],sum,mn,z};
	}
};

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	
	int n;cin>>n;
	string s;cin>>s;
	rep(i,n)cnt.pb(s[i]-'0');
	vvc<int> g(n);
	rep(i,n-1){
		int a,b;cin>>a>>b;
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	
	auto dp=treedp<N,int>(g).res;
	const int inf=LLONG_MAX/3;
	int ans=inf;
	rep(i,n)if(dp[i].c==0)
		chmin(ans,dp[i].b);
	if(ans==inf)cout<<-1<<endl;
	else cout<<ans/2<<endl;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int x,y,l,r;
    cin>>x>>y;
    l=-abs(y);
    r=abs(y);
    if(x==y)
      cout<<0<<endl;
    else if(abs(x)==abs(y))
      cout<<1<<endl;
    else if((x==0)||(y==0))
    {
      if(x==0)
      {
        if(y>0)
        cout<<y<<endl;
        else
        cout<<abs(y)+1<<endl;
      }
      if(y==0)
      {
        if(x>0)
        cout<<x+1<<endl;
        else
        cout<<abs(x)<<endl;
      }
    }
    else if(x<=l)
    {
      if(y==l)
        cout<<l-x<<endl;
      if(y==r)
        cout<<l-x+1<<endl;
    }
    else if((x>l)&&(x<0))
    {
      if(y==l)
        cout<<r+x+2<<endl;
      if(y==r)
        cout<<r+x+1<<endl;
    }
    else if((x>0)&&(x<=r))
    {
      if(y==l)
        cout<<r-x+1<<endl;
      if(y==r)
        cout<<r-x<<endl;
    }
    else
    {
      if(y==l)
        cout<<l+x+1<<endl;
      if(y==r)
        cout<<l+x+2<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int x;
    scanf("%d",&x);

    //printf("%d %d ",(x + 99) / 100 * 100,(x + 104) / 105 * 105);
    if((x / 100) * 100 <= x && x <= (x / 100) * 105) 
    {
        printf("1");
    }
    else
    {
        printf("0");
    }
    
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#define ll long long
using namespace std;;
int main(){
     vector<ll> A(5);
     ll result;
     long double N;
     cin >> N;
     for(int i = 0; i < 5; i++){
          cin >> A[i];
     }
     sort(A.begin(),A.end());
     result = ceil(N / A[0]) + 4;
     cout << result << endl;
     return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
   int a,b;
   scanf("%d%d",&a,&b);
   int ara[3];
   ara[0]=a+b;
   ara[1]=a-b;
   ara[2]=a*b;
   for(int y=1;y<3;y++){
    if(ara[0]<ara[y]){
        ara[0]=ara[y];
    }
   }
   printf("%d\n",ara[0]);
   return 0;
}


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

#define int            long long int
#define float          long double
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define inf            1e18
#define set_pre(x,y)   fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
using namespace std;
int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int modi(int a, int m)
{
    return power(a, m - 2, m);
}
int32_t main()
{
    int n;
    cin>>n;
    vector<int>a(n,0);
    vector<int>b(n,0);
    vector<int>c(n,0);
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    vector<vector<int>>dp(n,vector<int>(3));
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 8064
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

struct UnionFind {
    vector<int> v;
    UnionFind(int size) : v( size, -1){}

    void add(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) {
            return;
        }

        int na = -v[a];
        int nb = -v[b];
        if (na > nb) {
            v[b] = a;
            v[a] = -(na + nb);
        } else {
            v[a] = b;
            v[b] = -(na + nb);
        }
    }

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

int main()
{
    int n, m;
    cin >> n >> m;
    auto uf = UnionFind(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        uf.add(a, b);
    }
    auto size = 0;
    for (auto p = 0; p < n; ++p) {
        auto r = uf.root(p);
        size = max(size, -uf.v[r]);
    }

    cout << size << endl;
    return 0;
}


Measured memory_bytes: 4052
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int n = s.length();
    int count = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) == 'A' || s.charAt(i) == 'C' || s.charAt(i) == 'G' || s.charAt(i) == 'T') {
        count++;
      } else {
        ans = Math.max(ans, count);
        count = 0;
      }
    }
    ans = Math.max(ans, count);
    System.out.println(ans);
  }
}


Measured memory_bytes: 35732
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }

constexpr lint MOD = 998244353;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    sort(A.begin(), A.end());
    lint ret = A[0];
    FOR(i, 1, N) ret = ret * __gcd(i, A[i]) % MOD;
    cout << ret << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using P = pair<int,int>;

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int MAX_N = 10;

int main()
{
    int N, M; cin >> N >> M;
    vector<int> S[M];
    int p[M];
    rep(i,M){
        int k; cin >> k;
        rep(j,k){
            int s; cin >> s; s--;
            S[i].push_back(s);
        }
    }
    rep(i,M) cin >> p[i];
    int sum = 0;
    for(int tmp=0; tmp<(1 << N); tmp++){
        bitset<MAX_N> bit(tmp);
        bool isOK = true;
        // cout << bit << endl;
        rep(i,M){
            int on = 0;
            for(int Si: S[i]){
                if(bit.test(Si)){
                    on++;
                }
            }
            if(on%2 != p[i]){
                isOK = false;
                // break;
            }
        }
        if(isOK) sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import sys
import string

count = {}

for key in list(string.ascii_lowercase):
    count[key] = 0

for line in sys.stdin:
    for case in line:
        case = case.lower()
        if count.get(case) != None:
            count[case] += 1

keys = list(count.keys())

keys.sort()
for key in keys:
    print ("%s : %s"%(key,count[key]))

Measured memory_bytes: 7932
N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

P = []


def dfs(dmax, now):
    if len(now) == N:
        P.append(now)
        return
    for n in range(dmax, M+1):
        dfs(n, now+[n])


dfs(1, [])

ans = 0
for A in P:
    score = 0
    for a, b, c, d in ABCD:
        if A[b-1] - A[a-1] == c:
            score += d
    ans = max(ans, score)

print(ans)


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

int main()
{
	int a, b, c, d, e, f;
 	cin>>a>>b>>c;
  	d = a;
  	e = b;
   	f = c;
  	a = f;
  	b = d;
  	c = e;
  
  	cout<<a<<" "<<b<<" "<<c;
  
  	return 0;
  	
  	
}

Measured memory_bytes: 256
import java.io.*;

import java.util.*;

import java.math.*;



class Main{

	public static int dfs(int currs, int currd, int j,int n, int s){

		int count = 0;

		int i;

		

		if(currd == n){

			if(currs == s)return 1;

			else return 0;

		}

		

		for(i = Math.min(j,s);i>=0;--i){

			count += dfs(currs+i, currd+1,i-1, n,s);

		}

		return count;	

	

	}

	

	public static void sum_int(ArrayList<Integer> list){

		int n,s,res;

		

		for(int i=0;i<list.size()/2;i++){

			n = list.get(i*2);

			s = list.get(i*2+1);

			if(n == 0 && s == 0)

				break;

				res = dfs(0,0,9,n,s);

				System.out.println(res);

		}

	}

		

	public static void main(String args[]) throws IOException{

		String str;

		ArrayList <Integer> inp = new ArrayList<Integer>();



		Scanner scan = new Scanner(System.in);

		

		while(scan.hasNext()){

			

			str = scan.next();

			int x = Integer.valueOf(str).intValue();

			inp.add(x);

		}

		sum_int(inp);

	}

}

Measured memory_bytes: 12000
// Numeric

// 整数論

#include<vector>
#include<set>

// 素因数分解：力任せ
std::vector<int> prime_factor(const int n) {
  int tmp = n;
  std::vector<int> result;
  for(int i = 2; i * i <= n; ++i) {
    while(!(tmp % i)) {
      tmp /= i;
      result.push_back(i);
    }
  }
  if(tmp != 1) result.push_back(tmp);
  return result;
}

// 素数判定表：Sieve of Eratosthenes
std::vector<bool> Eratosthenes(const int n) {
  std::vector<bool> is_prime(n + 1, true);
  is_prime[0] = is_prime[1] = false;
  for(int i = 2; is_prime[i] && i * i <= n; ++i)
    for(int j = i * i; j <= n; j += i)
      is_prime[j] = false;
  return is_prime;
}

// べき乗：繰り返し二乗法/二進累乗アルゴリズム
int power(const int m, const int n) {
  if(!n) return 1;
  if(n & 1) return power(m * m, n >> 1) * m;
  return power(m * m, n >> 1);
}

int mod_power(const long long int m, const long long int n, const int mod) {
  if(!n) return 1;
  if(n & 1) return mod_power(m * m % mod, n >> 1, mod) * m % mod;
  return mod_power(m * m % mod, n >> 1, mod) % mod;
}

// 乗算
int mod_multiply(const long long int m, const long long int n, const int mod) {
  if(!n) return 0;
  if(n & 1) return (m + mod_multiply((m << 1) % mod, n >> 1, mod)) % mod;
  return mod_multiply((m << 1) % mod, n >> 1, mod);
}

int mod_multiply(std::vector<long long int> n, const int mod) {
  if(n.size() == 1) return 1;
  return mod_multiply(std::vector<long long int>(n.begin() + 1, n.end()), mod);
}

// 最大公約数：Euclidean algorithm
int gcd(const int m, const int n) {
  return n ? gcd(n, m % n) : m;
}

// 最小公倍数
int lcm(const long long int m, const long long int n) {
  return m * n / gcd(m, n);
}

// m x + n y = gcd(m, n) であるような x, y, gcd を求める：Extended Euclidean algorithm
struct ExtendedGCD {int x, y, gcd;};
ExtendedGCD extended_gcd(const int m, const int n, const int x = 1, const int xx = 0, const int y = 0, const int yy = 1) {
  if(!n) return {x, y, m};
  return extended_gcd(n, m % n, xx, x - m / n * xx, yy, y - m / n * yy);
}

// 自然数 n と互いに素な n 以下の自然数の個数：Euler's totient function
int phi(const int n) {
  int answer = n;
  auto list = prime_factor(n);
  for(auto i: std::set<int>(list.begin(), list.end())) answer -= answer / i;
  return answer;
}

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

#include<iostream>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << mod_power(a, b, 1000000007) << endl;
}

Measured memory_bytes: 1164
S=''.join(list(reversed(input())))
T=''.join(list(reversed(input())))
for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j]!="?" and T[j]!=S[i+j]:break
    else:
        print(''.join(list(reversed((S[:i]+T+S[i+j+1:]).replace("?","a")))))
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
while 1:
    try:
        num = list(input())
    except EOFError:
        break

    for _ in range(9):
        nextlist = []
        for i in range(len(num)-1):
            tmp = (int(num[i]) + int(num[i+1])) % 10
            nextlist.append(tmp)

        num = nextlist

    print(num[0])


Measured memory_bytes: 5600
#include <iostream>
using namespace std;
int main(){
    // int A,B,C,D,X,Y,N,L,M,P,Q;
    char c[10];
    int ans = 0;
    cin>>c;
    char a = c[0];
    char b = 0;
    for(int i=0;i<4;i++){
        if(a!=c[i]){
            b=c[i];
            break;
        }
    }
    
    int ac=0,bc=0;

    for(int i=0;i<4;i++){
        if(a==c[i]){
            ac++;            
        }else if(b==c[i]){
            bc++;
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }

    if(ac==2&&bc==2){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define IOS {ios :: sync_with_stdio(false); cin.tie(0);cout.tie(0); }
#define F first
#define S second
#define pb push_back
typedef long double ld;
#define deci(n) cout << fixed << setprecision(n);
typedef long long ll;

#define mem0(x)  memset(x,0,sizeof(x));
#define mem1(x)  memset(x,1,sizeof(x));
#define memm1(x) memset(x,-1,sizeof(x));
#define all(a) a.begin(), a.end()
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define fori2(n) for(ll i=1;i<=n;i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define forj2(n) for(ll j=1;j<=n;j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define fork2(n) for(ll k=1;k<=n;k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
const ll md = 1e9 + 7;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))
// const ll N = 100005;
// ll fac[N] = {1};
// #define calfac for(ll i=1  ;i<N;i++) fac[i] = (fac[i-1]*i)%md;
// ll C[N+1][M+1]; 
// void  ncr(){
//     ll n = N,k = M; 
//     for (ll i = 0; i <= n; i++) { 
//         for (ll j = 0; j <= min(i, k); j++) { 
//             if (j == 0 || j == i)  C[i][j] = 1; 
//             else C[i][j] = C[i - 1][j - 1] +  C[i - 1][j]; 
//         } 
//     } 
// } 


#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
ll modInv(ll a)
{
    return pow(a,md-2);
}
 
// ll nCr(ll n,ll r)
// {
//     return (fac[n]*modInv((fac[r]*fac[n-r])%md))%md;
// }

 
ll po(ll x,ll n){
    if(n==0) return 1;
    if(n%2==1) return (x*po(x,n-1));
    else {
        ll k=po(x,n/2);
        return (k*k);
    }
}
 
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}
 
ll n,m,q,mx = 0;
ll a[51][4];

void cal(vll v){
    ll s =0 ,i;
    for(i=0;i<q;i++){
        ll l = a[i][0] - 1;
        ll r = a[i][1] - 1;
        ll c = a[i][2];
        ll d = a[i][3];
        if(v[r] - v[l] == c){
            s += d;
        }
    }
    mx = max(mx,s);
}


void sol(vll v,ll val,ll idx){
    if(idx==n){
        cal(v);
        return ;
    }
    ll i;
    for(i=val;i<=m;i++){
        v[idx] = i;
        sol(v,i,idx+1);
    }
}



int32_t main(){
    IOS;
    ll i,j,k;
    mx = 0;
    cin >> n >> m >> q;
    fori(q){
        cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    }
    vector<ll > v;
    v.resize(n);
    sol(v,1,0);
    cout << mx <<"\n";

} 

Measured memory_bytes: 3676
import numpy as np
def resolve():
    n,k= map(int,input().split())
    h = np.array(list(map(int,input().split())))
    d = np.array([0]*n)
    d[0] = 0
    for i in range(1,n):
        j=max(0,i-k)
        d[i] = (d[j:i]+np.abs(h[i]-h[j:i])).min()
    print(d[-1])

resolve()


Measured memory_bytes: 22780
from collections import Counter

n = int(input())
a = Counter(map(int, input().split()))
xy = []
a = sorted(a.items(), key=lambda x: x[0], reverse=True)
for i in a:
    if len(xy) == 2:
        break
    if i[1] >= 4:
        xy.append(i[0])
        xy.append(i[0])
        break
    if i[1] >= 2:
        xy.append(i[0])

    else:
        pass
print(xy[0] * xy[1]) if len(xy) >= 2 else print(0)

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

bool o[200][200];
bool reached[200][200];

int search(int sx, int sy, int t);

typedef struct{
	int x;
	int y;
	int r;
}node;

int main(void){
	int t, n;
	int sx, sy;
	while(1){
		for(int i=0; i<200; i++){
			for(int j=0; j<200; j++){
				o[i][j]=false;
				reached[i][j]=false;
			}
		}
		
		cin >> t >> n;
		if(t==0 && n==0) break;
		for(int k=0; k<n; k++){
			int x, y;
			cin >> x >> y;
			o[x+100][y+100]=true;
		}
		cin >> sx >> sy;
		
		int count = search(sx, sy, t);
		cout << count << endl;
	}
	
	return 0;
}

int search(int sx, int sy, int t){
	int count = 0;
	
	node s = {sx, sy, t};
	reached[s.x+100][s.y+100] = true;
	count++;
	queue<node> qu;
	qu.push(s);
	
	while(!qu.empty()){
		node n = qu.front();
		int x, y, r;
		x = n.x;
		y = n.y;
		r = n.r;
		qu.pop();
		
		node no[6]={{x+1,y+1,r-1}, {x+1,y,r-1}, {x,y+1,r-1}, {x,y-1,r-1}, {x-1,y,r-1}, {x-1,y-1,r-1}};
		for(int i=0; i<6; i++){
			if(!reached[no[i].x+100][no[i].y+100] && !o[no[i].x+100][no[i].y+100]){
				reached[no[i].x+100][no[i].y+100] = true;
				count++;
				if(no[i].r>0){
					qu.push(no[i]);
				}
			}
		}
	}
	return count;
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);
 
int32_t main(){
	fast;
	int n;
	cin >> n;
	string s;
	map<string, int> m;
	int ans = 0;
	f(i,0,n)
	{
		cin >> s;
		sort(s.begin() , s.end());
		ans += m[s];
		m[s]++;
	}
	cout << ans;
}
 
 

Measured memory_bytes: 11264
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

// 繰り返し2乗法,  a^n mod を計算する
func modpow(a, n int) int {
	res := 1
	for n > 0 {
		if n&1 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n >>= 1
	}
	return res
}

var mod = int(1e9) + 7
var n int
var k = int(1e5*2 + 1)
var inv = make([]int, k)
var comb = make([]int, k)

func initComb() {
	inv[1] = 1
	for i := 2; i < k; i++ {
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
	}

	comb[0] = 1
	for i := 1; i < k; i++ {
		comb[i] = comb[i-1] * ((n - i + 1) * inv[i] % mod) % mod
	}
}

func main() {
	n = readInt()
	a, b := readInt(), readInt()

	a = min(a, n-a)
	b = min(b, n-b)

	initComb()

	ans := modpow(2, n) - 1 - comb[a] - comb[b] + 3*mod
	fmt.Println(ans % mod)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 4352
from math import floor
from fractions import gcd
N,M = map(int,input().split())

def prime_decomposition(n):
  i = 2
  d = {2:0}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d
A = list(map(int,input().split()))
for i in range(N):
    A[i] //= 2

l = A[0]
for i in range(1,N):
    l = (l*A[i])//gcd(l,A[i])
    if l>M:
        break
ans = floor((M/l+1)/2)
n = prime_decomposition(l)[2]
p2 = 2**n
for i in range(N):
    if A[i]%p2 != 0:
        ans = 0
        break
print(ans)

Measured memory_bytes: 89580
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
static const int INFTY = (1 << 21);

class Edge{
public:
	int from, to, cost;
	Edge(int from = 0, int to = 0, int cost = 0) :
			from(from), to(to), cost(cost){}

	bool operator < (const Edge &e) const{
		return cost < e.cost;
	}
	bool operator >(const Edge &e) const{
		return cost > e.cost;
	}

};

class Node{
public:
	vector<Edge> edges;
	int dist;
	int color;
	int back;
	Node(){
		dist = INFTY;
		color = INFTY;
		back = INFTY;
	}
};

class Graph{
public:
	vector<Node> nodes;
	Graph(int n) {
		rep(i, n) { Node n;  nodes.push_back(n); }
	}
	Node& operator[](int i){
		return nodes[i];
	}
};

class Data{

public:
	int dist;
	Edge *edge;
	Data(int dist, Edge *edge) {
		this->dist = dist;
		this->edge = edge;
	}

	bool operator < (const Data &d) const{
		return dist < d.dist;
	}
	bool operator >(const Data &d) const{
		return dist > d.dist;
	}
};

Graph G(0);

int main() {

	int V;
	cin >> V;
	G = Graph(V);

	rep(i, V-1){
		int from, to;
		int cost = 1;
		cin >> from >> to;
		from--; to--;
		G[from].edges.push_back(Edge(from, to, cost));
		G[to].edges.push_back(Edge(to, from, cost));
	}

	// shortest path
    {
        queue<Edge> q;
        q.push(Edge(-1, 0, 1));
        while(!q.empty()){
            Edge e = q.front(); q.pop();
            int nd = e.to;
            if(G[nd].dist != INFTY) continue;
            G[nd].dist = 0;
            G[nd].back = e.from;
            for(auto &ee: G[nd].edges){
                q.push(ee);
            }
        }
    }

    // shortest path
	vint path;
	{
		int nd = V-1;
        path.push_back(nd);
		while(nd != 0){
			nd = G[nd].back;
            path.push_back(nd);
		}
	}

    reverse(path.begin(), path.end());
    for(auto p: path) {fprintf(stderr, "%d ,", p);}
    fprintf(stderr, "\n");

    // color
    rep(i, path.size()){
        int n = path.size();
        int nn = (n+1) / 2;
        if(i < nn) G[path[i]].color = 1;
        else G[path[i]].color = -1;
    }

    // color check
    {
        rep(i, V) G[i].dist = INFTY;

        queue<Edge> q;
        q.push(Edge(-1, 0, 1));
        while(!q.empty()){
            Edge e = q.front(); q.pop();
            int nd = e.to;
            if(G[nd].dist != INFTY) continue;
            G[nd].dist = 0;
            G[nd].back = e.from;
            if(G[nd].color == INFTY) G[nd].color = G[G[nd].back].color;
            for(auto &ee: G[nd].edges){
                q.push(ee);
            }
        }
    }

    int ret = 0;
    rep(i, V) ret += G[i].color;
    rep(i, V){
        fprintf(stderr, "%d %d\n", i, G[i].color);
    }
    cout << (ret > 0 ? "Fennec" : "Snuke") << endl;

}

Measured memory_bytes: 9836
N, M = map(int,input().split())
edges = [list(map(int,input().split())) for i in range(M)]
ans = 0
for x in edges:
  l = list(range(N))
  for y in edges:
    if y!=x:
      l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(N)]
  if len(set(l))!=1:
    ans+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std ;
int main()
{
int a,b;
a>=-100;
b<=100;
	cin>>a>>b;
	if((a+b)>(a-b)&&(a+b)>(a*b))
		cout<<a+b;
	else if ((a-b)>(a+b)&&(a-b)>(a*b))
		cout<<a-b;
	else if((a*b)>=(a-b)&&(a*b)>=(a+b))
		cout<<a*b;
	else if (a==0||b==0)
		cout<<a+b;
	else if(a==b)
		cout<<a*b;
	return 0;
}

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

using namespace std;
vector<int> n;

int main(void)
{
    int count,temp,ans=0,rant=0;

    cin>>count;
    for(int i=0;i<count;i++)
    {
        cin>>temp;
        rant=rant>temp?rant:temp;
        n.push_back(temp);
    }

  vector<bool> pri(++rant,0);

   for(int i=2;i*i<rant;i++)
  {
      if(!pri.at(i))
         {

             for(int j=i;j*i<rant;j++)
                {
                   pri[i*j]=true;
                }
         }
  }

    for(int i=0;i<count;i++)
    {
        if(!pri.at(n.at(i)))
            ans++;
    }

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

Measured memory_bytes: 15104
#include <iostream>
#include <string>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main()
{
	int x;
	cin >> x;
	ll ans = x / 500;
	x -= 500*ans;
	ans = ans*ll(1000);
	ans += 5*(x / 5);
	cout << ans << endl;
	return 0;
}

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

int main() {
    
    int A;
    int B;
    
    cin >> A >> B;
    
    if(A > 8 || B > 8) {
        cout << string(":(")+"\n";
    }
    else {
        cout << string("Yay!")+"\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    int N;
    cin >> N;
    unordered_map<ll, bool> A;
    for (int i = 0; i < N; i++) {
        ll tmp;
        cin >> tmp;
        auto itr = A.find(tmp);
        if (itr != A.end()) {
            cout << "NO";
            return 0;
        } else {
            A[tmp] = true;
        }
    }
    cout << "YES";

    return 0;
}


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

int n, m;
vector<int> coins;

const int MAX_N = 50010;
const int MAX_M = 21;

int memo[MAX_N][MAX_M];

int solve(int n, int i)
{
  if (n == 0) return 0;
  if (i >= m) return MAX_N; 
  if (memo[n][i] != -1)
    return memo[n][i];

  int ans = solve(n, i+1);
  if (coins[i] <= n)
    ans = min(ans, solve(n-coins[i], i)+1);
  return memo[n][i] = ans;
}

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

  coins = vector<int>(m);
  for (int i = 0; i < m; i++)
    cin >> coins[i];

  memset(memo, -1, sizeof(memo));
  cout << solve(n, 0) << endl;
  return EXIT_SUCCESS;
}




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

int main() {
    string s;
    cin >> s;
    for(int i=0;i<3;i++){
        if(s[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3596
#include<iostream>
#define int long long
using namespace std;
signed main()
{
	int n,k,ans=0;
	cin>>n>>k;
	for(int b=k+1;b<=n;b++)
	{
		int x=(n+1)/b;
		ans+=x*(b-k);
		if(x*b+k<=n)ans+=(n-k-x*b+1);
		if(!k)ans--;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
n=input()
if n[-1]=='2' or n[-1]=='4' or n[-1]=='5' or n[-1]=='7' or n[-1]=='9':
  print('hon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
  print('pon')
else:
  print('bon')

Measured memory_bytes: 9116
import java.util.Scanner;

public class Main {
	static int n;
	static int pre[][];
	static int jpx[][];
	static int jpy[][];

	public static boolean mark(int x, int y, int mark) {
		if (0 < pre[y][x]) {
			if (pre[y][x] == mark) {
				return true;
			} else {
				return false;
			}
		}
		pre[y][x] = mark;
		int nx = jpx[y][x];
		int ny = jpy[y][x];
		return mark(nx, ny, mark);
	}

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

		while (true) {
			n = sc.nextInt();
			if (n == 0) {
				break;
			}

			pre = new int[n][n];
			jpx = new int[n][n];
			jpy = new int[n][n];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					jpx[i][j] = sc.nextInt();
					jpy[i][j] = sc.nextInt();
				}
			}

			int cnt = 0;
			int mark = 1;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (pre[i][j] == 0) {
						if (mark(j, i, mark)) {
							cnt++;
						}
						mark++;
					}
				}
			}
			
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 61936
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=200050;
const int mod=1e9+7;
ll dp[N];
void add(int &a, int b)
{ a+=b;if(a>=mod) a-=mod;}
void sub(int &a, int b)
{ a-=b;if(a<0) a+=mod;}
void mul(int &a, int b)
{ a=(ll)a*b%mod;}
ll mx[N];
void Set(int i, ll f)
{ for(;i<N;i+=i&-i) mx[i]=max(mx[i],f);}
ll Get(int i)
{ 
ll ans=0;
for(;i;i-=i&-i) ans=max(ans,mx[i]);
return ans;
}
int a[N],h[N];
int main()
{
int n,u,v;
scanf("%i",&n);
for(int i=1;i<=n;i++) scanf("%i",&h[i]);
for(int i=1;i<=n;i++) scanf("%i",&a[i]);
ll ans=0;
for(int i=1;i<=n;i++)
{
dp[i]=Get(h[i])+a[i];
Set(h[i],dp[i]);
ans=max(ans,dp[i]);
}
printf("%lld",ans);
return 0;
}

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

int main(){

    int N,Y; cin >> N >> Y;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=(N-i);j++){
            if(i * 10000 + j * 5000 + (N-i-j) * 1000 == Y) {cout << i << " " << j << " " << N-i-j << endl; return 0; }
        }
    }
    
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 3644
Q = input().split(" ")
N = int(Q[0])
K = int(Q[1])
A = {}
ss = 0
for i in range (N):
  A[str(i +1)] = 0
for i in range(K):
  a = int(input())
  b = input().split(" ")
  for j in range(a):
    A[b[j]] = 1
    #print(b[j])

#print(A)

for v in A.values():
  #print(v)
  if v == 0:
    ss += 1
print(ss)

Measured memory_bytes: 9204
#include <iostream>

int main(){
	int m,mf=0,ms=0,mt=0;
	for(int a=0;a<10;a++){
		std::cin>>m;
		if(m>mf){
			mt=ms;
			ms=mf;
			mf=m;
			m=0;
	    }
		if(m>ms){
			mt=ms;
			ms=m;	
			m=0;
		}
			
		if(m>mt){
			mt=m;
			
		}
			
		
	}
	std::cout<<mf<<std::endl<<ms<<std::endl<<mt<<std::endl;
	return 0;
}

Measured memory_bytes: 3076