akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll n,sum=0;
    cin >> n;
    vll a(n+2);
    a[0]=0;
    a[n+1]=0;
    REP(i,1,n+1) cin >> a[i];
    rep(i,n+1) sum+=abs(a[i]-a[i+1]);
    REP(i,1,n+1){
        cout << sum-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]) << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
// https://atcoder.jp/contests/aising2020/tasks/aising2020_c
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin >> n;
    ll dp[100000]={0,};
    for(int x = 1;x<=100;x++){
        for(int y = 1;y<=100;y++){
            for(int z = 1;z<=100;z++){
                dp[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }   
        }   
    }
    for(int i = 1;i<=n;i++){
        cout << dp[i] << "\n";
    }

	return 0;
}


Measured memory_bytes: 4444
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

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;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

// index が条件を満たすかどうか

int main() {
	long long int n;
	cin >> n;
	map<long long int, long long int> s;
	for (int i = 0; i < n; i++) {
		long long int a;
		cin >> a;
		s[a]++;
	}
	long long int ans = 0;
	for (auto i : s) {
		if (i.second % 2 == 1) {
			ans++;
		}
	}
	cout << ans;
}

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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();

        for (int i = 0; i < 25; i++)
        {
            if ((N - (4 * i)) >= 0 && (N - (4 * i)) % 7 == 0)
            {
                Console.WriteLine("Yes");
                return;
            }
        }
        Console.WriteLine("No");
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define IFOR(k,a,b) for(int k=(a); k>=(b); --k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define IREP(k,a) for(int k=a-1; k>=(0);--k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define x first
#define y second
#define INF 1000000001
#define INFLONG 1000000000000000000
#define MOD 1000000007
#define MAX 100
#define ITERS 100
#define MAXM 200000
#define MAXN 1000000
#define PI 3.1415926535897932384626
#define ERR -987654321
#define MEM(a,b) memset(a,b,sizeof(a));
#define read1(a) scanf("%d",&a)
#define read2(a,b) scanf("%d%d",&a,&b)
#define read3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define readl1(a) scanf("%lld",&a)
#define readl2(a,b) scanf("%lld%lld",&a,&b)
#define readl3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)



int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	// int rn = uniform_int_distribution<int>(0, MAXN)(rng);

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n;
    string str;
    cin>>str;
    n = str.length();

    bool flag = false;
    for(int i=0,j=n-2;i<j;i++,j--) {
        if(str[i] != str[j]) flag = true;
    }

    if(str[n-1] != '0' || str[0] != '1' || str[n-2] != '1' || flag) {
        cout<<"-1";
        return 0;
    }

    int p = 1, q = 2;
    REP(i,n-1) {
        if(str[i] == '1') {
            cout<<p<<" "<<q<<endl;
            p = q; q += 1;
        } else {
            cout<<p<<" "<<q<<endl;
            q += 1;
        }
    }
	return 0;
}






Measured memory_bytes: 1616
import Data.List

solve :: Int -> [Int]
solve s = [s `div` 3600 , s `div` 60 `mod` 60 , s `mod` 60]

main :: IO ()
main  = readLn
    >>= return . solve
    >>= mapM_ putStr . intersperse ":" . map show
    >> putStrLn ""

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(N*A, B) << endl;
}

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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int res = 0;
    while (A > 0){
        A -= D;
        ++res;
    }
    int F = C - res * B;
    if (F > 0) cout << "No" << endl; 
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3644
/******************************************
* AUTHOR : AMAN SAXENA *
* "There's some good in this world, and it's worth fighting for." *
* INSTITUTION : KIET Group of Institutions *
******************************************/
#include <bits/stdc++.h>

const long long MODULO=1000000007;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FOR1(i,a,n) for(int i=a;i<=n;i++)
#define FOR2(i,a,n) for(int i=a;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pi 3.14159265359

using namespace std;
ll a, b, c, d;
template <typename TYPE> void in(TYPE &x){cin>>x;}

void solve()
{
    
    string s;
    cin >> s;
    if(s == "AC" )
        a++;
    else if(s == "WA" )
        b++;
    else if(s == "TLE" )
        c++;
    else
        d++;
}

void test()
{
    int t;
    cin>>t;
    while(t--) //for(int j=1;j<=t;j++) cout << "Case #" << j << ": ";
    {
        solve();
    }
    cout << "AC" << " x " << a << '\n';
    cout << "WA" << " x " << b << '\n';
    cout << "TLE" << " x " << c << '\n';
    cout << "RE" << " x " << d << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    test();
    // solve();
    
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h> //Stack size ~2'000'000(x4)
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = rbegin(arr)+(plus); x != rend(arr); ++x)
#define PRINT(arr) {copy(begin((arr)), end((arr)), ostream_iterator<int>(cout, " "));cout<<'\n';}
#define REE(s_) {cout<<s_<<'\n';exit(0);} //print s_ and terminate program
#define CONT(s_) {cout<<s_<<'\n';continue;} //print s_ and continue;
#define GETCIN(arr) for(auto &i: (arr)) cin>>i
#define GET(arr) for(auto &i: (arr)) sc(i)
#define GETSTR(arr) for(auto &i: (arr)) getstr(i)
#define INF 2139062143 //127 in memset -> memset(arr,127,size)
#define SINF 1061109567 //Safe INF, for graphs or 2d arrays 63 in memset(arr,63,size)
#define LL_INF 7234017283807667300 //100 in memset(arr,100,size) !!!must be LL
#define whatis(x) cerr << #x << " is " << x << endl;
#define e1 first
#define e2 second
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
#define umap unordered_map
#define uset unordered_set
using namespace std;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }//prnt vec
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }//prnt pair
template<typename T> inline void print_128(T num){ if(!num) return; print_128(num / 10); cout.put((num % 10) + '0'); }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,m;
    sc(n,m);
    cout << (n-1)*(m-1);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int b;
  cin >> a;
  cin >> b;
  int x;
  int y;
    for (int i = 0; i < a; i++) {
      x += i;
    }
    for (int i = 0; i < b; i++) {
      y += i;
    }
  x += y;
  cout << x;
}

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

long N, K, ans;
vector<long> p;

int main(void) {

    cin >> N >> K;
    p.resize(N);
    for (auto &e: p) cin >> e;

    sort(p.begin(), p.end());

    for (long i = 0; i < K; i++) ans += p[i];

    cout << ans << endl;

    return 0;
}

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

int main()
{
  int a[4][4];
  bool b[4][4]={false};
  
  for(int i=1; i<=3; i++)
    for(int j=1; j<=3; j++)
      cin>>a[i][j];
  
  int n;
  
  cin>>n;
  
  int c[n+1];
  
  for(int i=1; i<=n; i++)
    cin>>c[i];
  
  for(int i=1; i<=n; i++)
    for(int j=1; j<=3; j++)
      for(int k=1; k<=3; k++)
        if(c[i]==a[j][k])
          b[j][k]=true;
  
  if(b[1][1]==true && b[1][2]==true && b[1][3]==true)
    cout<<"Yes"<<endl;
  else if(b[2][1]==true && b[2][2]==true && b[2][3]==true)
    cout<<"Yes"<<endl;
  else if(b[3][1]==true && b[3][2]==true && b[3][3]==true)
    cout<<"Yes"<<endl;
  else if(b[1][1]==true && b[2][1]==true && b[3][1]==true)
    cout<<"Yes"<<endl;
  else if(b[1][2]==true && b[2][2]==true && b[3][2]==true)
    cout<<"Yes"<<endl;
  else if(b[1][3]==true && b[2][3]==true && b[3][3]==true)
    cout<<"Yes"<<endl;
  else if(b[1][1]==true && b[2][2]==true && b[3][3]==true)
    cout<<"Yes"<<endl;
  else if(b[1][3]==true && b[2][2]==true && b[3][1]==true)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  
  return 0;
}

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

int main(){
vector<int>A(5);
for(int i = 0;i <5;i++){
cin>>A.at(i);
}
for(int i =0;i <5;i++){
if(A.at(i)==0){
cout<<i+1<<endl;
break;
}
}
}

Measured memory_bytes: 3620
#if defined(LOCAL)
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#endif
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <iostream>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <limits>
#include <numeric>
#include <queue>
#include <memory>

using namespace std;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ii = pair<int,int>; using lu = unsigned long long; using l = long long;
using vs = vector<string>; using vii = vector<ii>;
using vl = vector<l>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>; using sl = unordered_set<l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; const double PI = M_PI;
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));

void solve(istream& in, ostream& out);
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  tst::test_init(argc, argv);
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  tst::maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}
const l MOD = e9 + 7; // end of template

void solve(istream& in, ostream& out) {
  string s, t; in >> s >> t;
  vl outgoing(26, -1), incoming(26, -1);
  bool ok = true;
  F(i, 0, s.size()) {
    l a = s[i] - 'a', b = t[i] - 'a';
    ok = ok and (outgoing[a] == -1 or outgoing[a] == b) and
      (incoming[b] == -1 or incoming[b] == a);
    outgoing[a] = b;
    incoming[b] = a;
  }
  out << (ok ? "Yes" : "No") << lf;
}


Measured memory_bytes: 1020
#include <stdio.h>
#include <math.h>

int main(void)
{
    double x, y, x_, y_, dx, dy;

    scanf("%lf %lf %lf %lf", &x, &y, &x_, &y_);

    dx = x_ - x;
    dy = y_ - y;
    printf("%lf\n", sqrt(dx * dx + dy * dy));

    return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
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; }

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;

int main(){
  int N,M;
  cin>>N>>M;
  vector<vector<int>> g(N);
  for(int i = 0;i<M;i++){
    int x,y;
    cin>>x>>y;
    g[x-1].push_back(y-1);
    g[y-1].push_back(x-1);
  }
  queue<int> bfs;
  vector<bool> seen(N,false);
  bfs.push(0);
  seen[0]=true;
  vector<int> ans(N);
  while(!bfs.empty()){
    int x = bfs.front();
    bfs.pop();
    for(auto nx:g[x]) {
      if(seen[nx]) continue;
      seen[nx]=true;
      ans[nx]=x;
      bfs.push(nx);
    }
  }
  cout<<"Yes"<<endl;
  for(int i = 1; i < N; i++){
    cout<<ans[i]+1<<endl;
  }
}

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

string s;
int n,k,d[1000],a[1000][1000],b[1000],ans;

int main(){
    cin>>n>>k;
    for(int i=0;i<k;i++){
        cin>>d[i];
        for(int u=0;u<d[i];u++){
            cin>>a[i][u];
            b[a[i][u]]=1;
        }
    }
    for(int i=1;i<n+1;i++){
        if(b[i]==0){
            ans++;
        }
    }
    cout<<ans<<endl;




}


Measured memory_bytes: 3992
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-9
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 300031;

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);

	int n;
	cin>>n;
	cout<<n*180-360<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 256
using System;

class lec01_C{
  public static void Main(){
    int n,x,i,count = 0;
    n = int.Parse(Console.ReadLine());
    for(i =  0;i < n;i++){
      x = int.Parse(Console.ReadLine());
      if(Sosu(x) == true) count++;
    }
    Console.WriteLine(count);
  }
  public static bool Sosu(int x){
    if(x < 2) return false;
    else if(x == 2) return true;
    else if(x % 2 == 0) return false;

    double sqrtx = Math.Sqrt(x);
    for(int i = 3;i <= sqrtx;i += 2){
      if(x % i == 0) return false;
    }
    return true;
  }
}



Measured memory_bytes: 9188
n = int(input())
P = list(map(int, input().split()))
P = [p-1 for p in P]

ans = 0
for i in range(n):
    if i != n-1:
        if P[i] == i:
            ans += 1
            P[i+1] = P[i]
    else:
        if P[i] == i:
            ans += 1
print(ans)

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

int main()
{
  long long n,k;
  while(cin>>n>>k){
    if (n == 0) break;
    vector<long long> a(n);
    vector<long long> s(n+1);
    for(long long i=0; i<n; i++){
      cin>>a[i];
    }
    for(long long i=0; i<n; i++){
      s[i+1]=s[i]+a[i];
    }
    long long ans=-1e9;
    
    for(long long i=0; i<=n-k; i++){
      long long val =s[i+k]-s[i];
      if(ans<val) ans=val;
    }
    cout<<ans<<endl;
  }
  
}


Measured memory_bytes: 4420
#include <iostream>
#include <vector>
#include <deque>
using namespace std; using P=pair<int,int>; using ll=long long;
const int mx=1e5; vector<vector<int>> v(mx); vector<int> c(mx); int n; bool noco=false;

int main() {
	int n; cin>>n;
	deque<int> que;
	for(int i=0;i<n;i++) {
		int a; cin>>a;
		if (i%2==0) que.push_back(a);
		else que.push_front(a);
	}
	int tp;
	for(int i=0;i<n;i++) {
		if (n%2==0) tp=que.front(), que.pop_front();
		else tp=que.back(), que.pop_back();
		cout<<tp<<" ";
	} cout<<endl;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
const int Nmax = 1e5;
ll X[Nmax];

int main(){
	cin >> N;
	for(int i=0; i<N; i++){
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		for(int k=0; k<10; k++){
			X[i] += ((ll)(s[k]-'a'))<<(6*k);
		}
	}

	map<ll, ll> cnt;
	for(int i=0; i<N; i++) cnt[X[i]]++;

	ll ans = 0;
	for(auto p: cnt){
		//cout << p.first << " " << p.second << endl;
		ans += p.second*(p.second-1)/2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 7296
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n,m;cin>>n>>m,n|m;){
		vi a(n+m);
		rep(i,n+m) cin>>a[i];
		a.push_back(0);
		sort(all(a));
		int res=0;
		repi(i,1,a.size())
			res=max(res,a[i]-a[i-1]);
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1312
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <cmath>
#include <utility>
#include <set>
using namespace std;
 
#define FOR(i, s, m) for(int i = s; i < m; i++)
#define pb push_back
#define mp make_pair
#define SORTVEC(vec) sort(vec.begin(), vec.end())
#define mset(arr) memset(arr, 0, sizeof(arr))
#define ri(x) scanf("%d", &x)
#define rii(x, y) scanf("%d %d", &x, &y)


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;


int main() {
    string str;
    int k;
    cin >> str >> k;
    set<string> s;
    FOR(i, 0, str.size()) {
        int m = min((int) str.size(), i + k);
        FOR(j, i, m) {
            s.insert(str.substr(i, j - i + 1));
        }
    }
    // cout << "HOla" << endl;
    // cout << s.size() << endl;
    string ans;
    for (auto it = s.begin(); it != s.end(); it++) {
        // cout << *it << endl;
        k--;
        if (!k) {
            ans = *it;
            break;
        }
    }
    //  cout << endl;
    cout << ans << endl;
}



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

inline bool isPrime(int x){
  for(int i=2;i*i<=x;i++){
    if(x%i == 0)return false;
  }
  return true;
}

int n,k;
vector<int> prime;
int memo[1200][20];

int main(){
  for(int i=2;i<=1120;i++){
    if(isPrime(i))prime.push_back(i);
  }
  while(cin >> n >> k,n){
    memset(memo,0,sizeof(memo));
    memo[0][0] = 1;

    for(int x=0;x<prime.size();x++){
      if(prime[x] > n)break;

      for(int j=k-1;j>=0;j--){
	for(int i=n-prime[x];i>=0;i--){
	  memo[i+prime[x]][j+1] += memo[i][j];
	}
      }
    }

    cout << memo[n][k] << endl;
  }
}

Measured memory_bytes: 1312
#include<stdio.h>
int main(void)
{
    int h,w,i,j;
    while(1){
        scanf("%d%d",&h,&w);
        if(h==0&&w==0) break;
        for(i=0; i<h; i++){
            for(j=0; j<w; j++){
                if(i==0||i==h-1) putchar('#');
                else{
                    if(j==0||j==w-1) putchar('#'); 
                    else putchar('.');
                }
            }
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


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

int main() {
	int n, x;
	while (cin >> n >> x && (n != 0 || x != 0)) {
		int count = 0;
		for (int i = 1; i <= n; i++)
			for (int j = i + 1; j <= n; j++)
				for (int k = j + 1; k <= n; k++)
					if (i + j + k == x)
						count++;
		cout << count << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 100000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define pi atan(1)*4
#define ALL(x) x.begin(),x.end()
#define int ll

int n,k;
int a[10000005][3];
int dp[10000005][3];

main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0]=dp[i][1]=dp[i][2]=0;
	}
	dp[1][0]=a[1][0];
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<=2;j++)
		{
			for(int k=0;k<=2;k++)
			{
				if(j==k) continue;
				dp[i+1][k]=max(dp[i+1][k],a[i+1][k]+dp[i][j]);
			}
		}
		//cout<<dp[i+1][0]<<" "<<dp[i+1][1]<<" "<<dp[i+1][2]<<endl; 
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}

Measured memory_bytes: 8448
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

int main()
{
	int n, i;
	bool f;
	long long int a, b, c;
	map<int, long long int> member;
	vector<int> order;
	vector<int>::iterator it;
	while (cin>>n, n) {
		member.clear();
		order.clear();
		for (i = 0; i < n; i++) {
			cin>>a>>b>>c;
			member[a] += b*c;
			if ( order.end() == find( order.begin(), order.end(), a ) ) {
				order.push_back(a);
			}
		}
		f = true;
		for (it = order.begin(); it != order.end(); it++) {
			if (member[*it] >= 1000000) {
				cout<<*it<<endl;
				f = false;
			}
		}
		if (f) cout<<"NA"<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	ll n;

	cin>>n;

	vll num(1001, 0);

	repr(i, 2, n+1){
		ll a=2, temp=i;
		while(temp>=a*a){
			if(temp%a==0){
				num[a]++;
				temp/=a;
			}else{
				a++;
			}
		}
		num[temp]++;
	}

	ll ans=1;
	repr(i, 2, 1001){
		ans=(ans*(num[i]+1))%MOD;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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;
}

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    vi www(N, 0);
    vi eee(N, 0);

    if (s[0] == 'W') {
        www[0]++;
    }
    REP(i, N - 1) {
        if (s[i + 1] == 'W') {
            www[i + 1] = www[i] + 1;
        } else {
            www[i + 1] = www[i];
        }
    }

    if (s[(N - 1)] == 'E') {
        eee[(N - 1)]++;
    }
    REP(i, N - 1) {
        if (s[(N - 1) - i - 1] == 'E') {
            eee[(N - 1) - i - 1] = eee[(N - 1) - i] + 1;
        } else {
            eee[(N - 1) - i - 1] = eee[(N - 1) - i];
        }
        debug(eee[(N - 1) - i - 1]);
    }

    int sum = eee[1];
    REP(i, N - 2) {
        chmin(sum, www[i] + eee[i + 2]);
        debug(sum, www[i], eee[i + 2]);
    }
    chmin(sum, www[N - 1]);

    cout << sum;
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 8180
#include <iostream>

void solve() {
    int n, k;
    std::cin >> n >> k;
    int ans = 0;
    while (n > 0) {
        n /= k;
        ++ans;
    }
    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
local x1,y1,x2,y2=io.read("n","n","n","n")
local dx,dy=x2-x1,y2-y1
local adx,ady=math.abs(dx),math.abs(dy)
local sdx,sdy=1,1
if dx<0 then
  sdx=-1
end
if dy<0 then
  sdy=-1
end
local x3=x2 - sdy*ady
local y3=y2 + sdx*adx
local x4=x3 - sdx*adx
local y4=y3 - sdy*ady
print(x3,y3,x4,y4)


Measured memory_bytes: 256
using System;
 class Program{
    static void Main(){
    string[] str = Console.ReadLine().Split(' ');
    int a=int.Parse(str[0]);
    int b=int.Parse(str[1]);
    if(a>-1000&&b<1000){
        if(a<b){
            Console.WriteLine("a < b");
        }else if(a>b)
        {
            Console.WriteLine("a > b");
        }else 
        {
        Console.WriteLine("a == b");
        }
    }
}
}



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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

const int N=110000;
typedef long long LL;
const LL mod=1e9+7;

int n;
int a[N],b[N];
struct node
{
	int id,w;
	friend bool operator < (node a,node b)
	{
		if (a.w!=b.w) return a.w<b.w;
		return a.id<b.id;
	}
}c[N],d[N];
int sum[N],psum[N],nsum[N];
int ys[N],pp[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		c[i].w=a[i];
		c[i].id=i;
	}
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
		d[i].w=b[i];
		d[i].id=i;
	}
	sort(c+1,c+1+n);
	sort(d+1,d+1+n);
	int flag=0;
	for (int i=1;i<=n;i++)
		ys[d[i].id]=i;
	for (int i=1;i<=n;i++)
		if (c[i].w>d[i].w)
		{
			flag=1;
			break;
		}
	if (flag)
	{
		printf("No\n");
		return 0;
	}
	flag=0;
	for (int i=2;i<=n;i++)
		if (c[i].w<=d[i-1].w)
		{
			flag=1;
			break;
		}
	if (flag)
	{
		printf("Yes\n");
		return 0;
	}
	int num=0,cur=1;
	while (!pp[cur])
	{
		num++,pp[cur]=1;
		cur=ys[c[cur].id];
	}
	if (num==n) printf("No\n");
	else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {
  	static Scanner scanner = new Scanner(System.in);
  
	public static void main(String[]$) {
      	int a1 = scanner.nextInt(), a2 = scanner.nextInt(), a3 = scanner.nextInt();
    	System.out.println(Math.max(Math.max(a1, a2), a3) - Math.min(Math.min(a1, a2), a3));
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;



int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);

ll n;
cin >> n;
ll dp[N];
ll arr[n];
for(int i=1;i<=n;i++){

	cin >> arr[i];
}
dp[2]= abs(arr[2]-arr[1]);
for(int i=3;i<=n;i++){

	dp[i]=min(dp[i-1]+abs( arr[i]- arr[i-1]), dp[i-2]+abs(arr[i]- arr[i-2]));
}
cout << dp[n] <<endl;

return 0;
}



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

const int M=100005;

bool is (int a,int b,int c)
{
	if(b+c<=a&&((b+c)%2)==(a%2))
	return true;
	else return false;
	
}

int main()
{
	int N;
	int t[M],x[M],Y[M];
	cin>>N;
	for(int i=0;i<N;i++)
	cin>>t[i]>>x[i]>>Y[i];
	bool k=true;
	for(int i=0;i<N;i++)
	{
		if(is(t[i],x[i],Y[i]))
		continue;
		else
		{k=false;
		break;}
	}
	if(k)
	cout<<"Yes";
	else
	cout<<"No";
	
	return 0;

}

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    string ans;
    char last;
    ans = "SS";
    last = (s[0] == 'o' ? 'S' : 'W');
    for(int i = 1; i < s.size(); ++i) {
        if(s[i] == 'o') {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }else {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }
        }else {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }else {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }
        }
    }
    if(ans[ans.size() - 2] == last && ans[ans.size() - 1] == ans[0]) {
        cout << ans.assign(ans.begin(), ans.begin() + ans.size() - 1) << endl;
        return 0;
    }

    ans = "SW";
    last = (s[0] == 'o' ? 'W' : 'S');
    for(int i = 1; i < s.size(); ++i) {
        if(s[i] == 'o') {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }else {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }
        }else {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }else {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }
        }
    }
    if(ans[ans.size() - 2] == last && ans[ans.size() - 1] == ans[0]) {
        cout << ans.assign(ans.begin(), ans.begin() + ans.size() - 1) << endl;
        return 0;
    }

    ans = "WS";
    last = (s[0] == 'o' ? 'W' : 'S');
    for(int i = 1; i < s.size(); ++i) {
        if(s[i] == 'o') {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }else {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }
        }else {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }else {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }
        }
    }
    if(ans[ans.size() - 2] == last && ans[ans.size() - 1] == ans[0]) {
        cout << ans.assign(ans.begin(), ans.begin() + ans.size() - 1) << endl;
        return 0;
    }

    ans = "WW";
    last = (s[0] == 'o' ? 'S' : 'W');
    for(int i = 1; i < s.size(); ++i) {
        if(s[i] == 'o') {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }else {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }
        }else {
            if(ans[i] == 'S') {
                ans += (ans[i - 1] == 'S' ? "W" : "S");
            }else {
                ans += (ans[i - 1] == 'S' ? "S" : "W");
            }
        }
    }
    if(ans[ans.size() - 2] == last && ans[ans.size() - 1] == ans[0]) {
        cout << ans.assign(ans.begin(), ans.begin() + ans.size() - 1) << endl;
        return 0;
    }
    cout << -1 << endl;
}


Measured memory_bytes: 640
D=int(input())
c=list(map(int,input().split()))
s=[]
for _ in range(D):
    ss=list(map(int,input().split()))
    s.append(ss)
for i in range(D):
    sss=s[i]
    a=sss.index(max(sss))
    print(a+1)
    

Measured memory_bytes: 9324
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

constexpr ll INF = 1e16;

#define rep(i, N) for(ll i=0; i<N; ++i)

ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  rep(i, N) cin >> p[i];
  
  //累積和を計算 (* 2した値)
  vector<ll> accsum(N+1);
  for(int i=0; i<N; ++i) {
    accsum[i+1] = accsum[i] + p[i] + 1;
  }
  
  //最大値を取得
  ll mv = 0;
  for(int i=K; i<=N; ++i) {
    mv = max(mv, accsum[i] - accsum[i-K]);
  }
  
  cout << fixed << setprecision(10) << (double)(mv)/2 << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
const ll mod=1e9+7;

int par[200000];
int ran[200000];
int num[200000];

void init(int n){
  rep(i,0,n){
    par[i]=i;
    ran[i]=0;
    num[i]=1;
  }
}

int find(int x){
  if(par[x]==x) return x;
  return par[x]=find(par[x]);
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(ran[x]<ran[y]){
    par[x]=y;
    num[y]+=num[x];
  }
  else{
    par[y]=x;
    num[x]+=num[y];
    if(ran[x]==ran[y]) ran[x]++;
  }
}

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

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

int main(){
  int n,m;
  cin>>n>>m;
  init(n);
  rep(i,0,m){
    int a,b;
    cin>>a>>b;
    unite(a-1,b-1);
  }
  int ans=0;
  rep(i,0,n){
    ans=max(ans,size(i));
  }
  cout<<ans<<endl;
}

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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b;
  cin >> a>> b;
  if(a == b) cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
w,h,n = map(int,input().split())
W = []
H = []

for _ in range(n):
  x,y,a = map(int,input().split())
  
  if a==1:
    W+=list(range(x))
  elif a==2:
    W+=list(range(x+1, w+1))
  elif a==3:
    H+=list(range(y))
  elif a==4:
    H+=list(range(y+1, h+1))

print(max(0, h-len(set(H)))*max(0, w-len(set(W))))

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

using namespace std;

int main(void) {
	int N, M;
	cin >> N;
	vector<int> D;
	for(int i = 0; i < N; ++i) {
		int d;
		cin >> d;
		D.push_back(d);
	}
	sort(D.begin(), D.end());
	cin >> M;
	vector<int> T;
	for(int i = 0; i < M; ++i) {
		int t;
		cin >> t;
		T.push_back(t);
	}
	sort(T.begin(), T.end());
	int c = -1;
	for(int i = 0; i < M; ++i) {
		++c;
		while(D[c] != T[i] && c < N) {
			++c;
		}
		if(c == N) {
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	return 0;
}



Measured memory_bytes: 2548
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>
#include <string.h>
//#include <>
//#define N 200

using namespace std;
struct shi
{
    int price;
    int weight;
    int d;
} h[1000000];
int cmp(shi a , shi b){
   return a.d>b.d;
}
int cmd(int a , int  b){
    return a > b;
}
int a[1000][1000];
int dp[1000][1000];
int main()
{
   string odd;
   string fu;
   while(cin >>odd >>fu){
    int leno = odd.length();
    int lenf = fu.length();
    int numo=0,numf=0;
    int flag=1;
    while(1){
        if(numo==leno&&numf==lenf)
            break;
        if(flag==1){
            cout<<odd[numo++];
            flag=2;
        }
        else if(flag==2){
            cout<<fu[numf++];
            flag=1;
        }

    }
    cout<<endl;
   }
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef pair<ll, double> PD;
//ll mod = 1000000007;
//ll mod = 998244353;

int main() {
	ll n;
	cin >> n;
	if (n % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	n /= 2;
	while (n > 0) {
		n /= 5;
		ans += n;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
mod = 10**9+7

def C(n, r, mod):
    x=y=1
    for i in range(r):
        x *= n; y *= r
        x %= mod; y %= mod
        n -= 1; r -= 1
    return x * pow(y, mod - 2, mod) % mod


res = pow(2,n,mod) - 1


comb_a = C(n,a,mod)
comb_b = C(n,b,mod)

print((res-(comb_a+comb_b))%mod)


Measured memory_bytes: 3064
from heapq import heapify,heappush,heappop#最小（最大）の値をlogNで取り出せる。（値の追加もlogN）
a = []
heapify(a)

dic = {}

N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    if not(A[i] in dic):
        dic[A[i]]=1
    elif dic[A[i]]==1:
        dic[A[i]]=0
        heappush(a,-A[i])
    elif dic[A[i]]==0:
        dic[A[i]]=1

if len(a)<2:
    print(0)
    exit()

w = heappop(a)
h = heappop(a)

print(w*h)

Measured memory_bytes: 100964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){
        a=b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){
        a=b;
        return true;
    }
    return false;
}

typedef bitset<6500> bs;

int main(){
    int H,W; cin >> H >> W;
    vector<vector<int>> A(H,vector<int>(W)),B(H,vector<int>(W)),C(H,vector<int>(W,0));
    rep(i,H) rep(j,W) cin >> A[i][j];
    rep(i,H) rep(j,W) cin >> B[i][j];
    rep(i,H) rep(j,W) C[i][j]=abs(A[i][j]-B[i][j]);
    bs dp[H][W];
    rep(i,H) rep(j,W) dp[i][j]=bs(0);
    dp[0][0].set(0);
    rep(i,H){
        rep(j,W){
            bs tmp=dp[i][j],pre=dp[i][j];
            tmp>>=C[i][j];
            dp[i][j]<<=C[i][j];
            dp[i][j]|=tmp;
            rep(k,6500) if (k-C[i][j]<0&&pre.test(k)) dp[i][j].set(C[i][j]-k);
            if (i+1<H) dp[i+1][j]|=dp[i][j];
            if (j+1<W) dp[i][j+1]|=dp[i][j];
        }
    }
    int ans=INF;
    rep(i,6500){
        if (dp[H-1][W-1].test(i)){
            ans=i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5376
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
char s[10];
int main() {
	cin >> s;
	for (int i = 0; i < 4; ++i) s[i] -= '0';
	int a = s[0] * 10 + s[1];
	int b = s[2] * 10 + s[3];
	int bja = 0, bjb = 0;
	if (1 <= a && a <= 12) bja = 1;
	if (1 <= b && b <= 12) bjb = 1;
	if (bja && bjb) cout << "AMBIGUOUS";
	else if (bja) cout << "MMYY";
	else if (bjb) cout << "YYMM";
	else cout << "NA";
	return 0;
}

Measured memory_bytes: 256