akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main () {
  char X, Y;
  cin >> X >> Y;
  int x, y;
  
  if (X == 'A') x = 10;
  else if (X == 'B') x = 11;
  else if (X == 'C') x = 12;
  else if (X == 'D') x = 13;
  else if (X == 'E') x = 14;
  else x = 15;
  
  if (Y == 'A') y = 10;
  else if (Y == 'B') y = 11;
  else if (Y == 'C') y = 12;
  else if (Y == 'D') y = 13;
  else if (Y == 'E') y = 14;
  else y = 15;
  
  if (x == y) cout << '=' << endl;
  else if (x > y) cout << '>' << endl;
  else cout << '<' << endl;
}

Measured memory_bytes: 256
n,p=map(int,input().split());s,n,N,c,d=map(int,list(input())),1,0,0,[0]*p
if p!=5:
 for i in s:N,a=(N*10+i)%p,pow(n,p-2,p);d[(i-N)*a%p]+=1;c+=d[-N*a%p];n=n*10%p
else:c=sum([j+1 for j,i in enumerate(s)if i%5==0])
print(c)

Measured memory_bytes: 12740
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define IN freopen("in.txt","r",stdin);
#define OUT freopen("out.txt","w",stdout);
#define sc scanf
#define itn int
#define STR clock_t startTime = clock();
#define END clock_t endTime = clock();cout << double(endTime - startTime) / CLOCKS_PER_SEC *1000<< "ms" << endl;
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const long long mod2=998244353;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int n,m;
int s[N],t[N];
ll dp[2005][2005]={0};
int main(){
    //IN
    cin>>n>>m;
    for(int i=1;i<=n;i++)sc("%d",&s[i]);
    for(int i=1;i<=m;i++)sc("%d",&t[i]);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i]==t[j])dp[i][j]=(dp[i-1][j]+dp[i][j-1]+1)%mod;
            else dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+mod)%mod;
        }
    }
    o((dp[n][m]+1+mod)%mod);
}


Measured memory_bytes: 35072
#include <stdio.h>

typedef struct {
	int end[2];
	long long cost;
} edge;

typedef struct List {
	struct List *next;
	edge *f;
} list;

int main()
{
	int i, N, Q, K, a[100001], b[100001], x[100001], y[100001];
	long long c[100001];
	scanf("%d", &N);
	for (i = 1; i <= N - 1; i++) scanf("%d %d %lld", &(a[i]), &(b[i]), &(c[i]));
	scanf("%d %d", &Q, &K);
	for (i = 1; i <= Q; i++) scanf("%d %d", &(x[i]), &(y[i]));
	
	edge e[100001];
	list *inc[100001] = {}, l[200001];
	for (i = 1; i <= N - 1; i++) {
		e[i].end[0] = a[i];
		e[i].end[1] = b[i];
		e[i].cost = c[i];
		l[(i-1)*2].f = &(e[i]);
		l[(i-1)*2+1].f = &(e[i]);
		l[(i-1)*2].next = inc[a[i]];
		l[(i-1)*2+1].next = inc[b[i]];
		inc[a[i]] = &(l[(i-1)*2]);
		inc[b[i]] = &(l[(i-1)*2+1]);
	}
	
	int flag[100001] = {}, q[100001] = {K}, head, tail;
	long long dist[100001] = {};
	flag[K] = 1;
	list *p;
	for (head = 0, tail = 1; head < tail; head++) {
		for (p = inc[q[head]]; p != NULL; p = p->next) {
			i = (p->f->end[0] == q[head])? p->f->end[1]: p->f->end[0];
			if (flag[i] == 0) {
				flag[i] = 1;
				dist[i] = dist[q[head]] + p->f->cost;
				q[tail++] = i;
			}
		}
	}
	
	for (i = 1; i <= Q; i++) printf("%lld\n", dist[x[i]] + dist[y[i]]);
	fflush(stdout);
	return 0;
}

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

ll a[51], p[51];
ll d(int n, ll x)
{
  if (n == 0)
    return 1;
  else if (x == 1)
    return 0;
  else if (x <= a[n - 1] + 1)
    return d(n - 1, x - 1);
  else if (x == a[n - 1] + 2)
    return p[n - 1] + 1;
  else if (x <= 2 * a[n - 1] + 2)
    return p[n - 1] + 1 + d(n - 1, x - 2 - a[n - 1]);
  else
    return p[n];
}

int main()
{
  int N;
  ll X;
  cin >> N >> X;
  a[0] = p[0] = 1;
  rep(i, N)
  {
    a[i + 1] = 2 * a[i] + 3;
    p[i + 1] = 2 * p[i] + 1;
  }
  cout << d(N, X) << endl;
  return 0;
}


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

int main(){
  string s;
  cin >> s;

  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(s== "Cloudy"){
    cout << "Rainy" << endl;
  }else if(s == "Rainy"){
    cout << "Sunny" << endl;
  }

  return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<double> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  for(int i=0; i<N; i++){
    vec.at(i)=1/vec.at(i);
  }
  double a = 0.0;
  for(int i=0; i<N; i++){
    a += vec.at(i);
  }
  
  cout << 1/a << endl;
  
  return 0;
}

Measured memory_bytes: 256
X, Y = map(int,input().split())

T = 0
C = 0

if Y > X * 4:
    print("No")

else:
    for i in range(X+1):
        T = X - i
        if Y == (T * 4) + (i * 2):
            print("Yes")
            break
    else:
        print("No")

Measured memory_bytes: 9184
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;

}

signed main() {
	ll h, w;

	cin >> h >> w;

	vector<string> v(h, "");

	REP(i, h) {
		cin >> v[i];
	}

	vector<vector<ll>> a(h, vector<ll>(w, 0));
	vector<vector<ll>> b(h, vector<ll>(w, 0));

	REP(i, h) {
		ll sum = 0;
		ll start = 0;
		REP(j, w) {
			if (v[i][j] == '#') {
				FOR(k, start, j) {
					a[i][k] = sum;
				}
				sum = 0;
				start = j + 1;
			}
			else if (j == w - 1) {
				sum++;
				FOR(k, start, j + 1) {
					a[i][k] = sum;
				}
			}
			else {
				sum++;
			}
		}
	}

	REP(i, w) {
		ll sum = 0;
		ll start = 0;
		REP(j, h) {
			if (v[j][i] == '#') {
				FOR(k, start, j) {
					b[k][i] = sum;
				}
				sum = 0;
				start = j + 1;
			}
			else if (j == h - 1) {
				sum++;
				FOR(k, start, j + 1) {
					b[k][i] = sum;
				}
			}
			else {
				sum++;
			}
		}
	}

	ll ans = 0;

	REP(i, h) {
		REP(j, w) {
			ans = max(ans, a[i][j] + b[i][j] - 1);
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 67072
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (win, osx, linux)
 * Author: step_by_step
 * Time: 2020-03-19 17:35:03
**/

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 300000 + 1;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("circus.in", "r", stdin);
    //freopen("circus.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n) {
        cin >> a[i];
    }
    ll dp[n][2][2];
    rep(i, 0, n) {
        rep(j, 0, 2) {
            rep(k, 0, 2) {
                dp[i][j][k] = -big;
            }
        }
    }
    dp[0][1][0] = a[0];
    dp[0][0][1] = 0;
    rep(i, 0, n - 1) {
        rep(j, 0, 2) {
            rep(k, 0, 2) {
                // not take i+1
                int have = (i + 2) / 2 - k;
                if ((i + 3) / 2 - have < 2) {
                    setmax(dp[i + 1][0][(i + 3) / 2 - have], dp[i][j][k]);
                }
                // take i+1
                if (j == 0) {
                    setmax(dp[i + 1][1][(i + 3) / 2 - (have + 1)], dp[i][j][k] + a[i + 1]);
                }
            }
        }
    }
    ll ans = -big;
    rep(j, 0, 2) {
        rep(k, 0, 2) {
            if ((n - 1 + 2) / 2 - k == n / 2) {
                setmax(ans, dp[n - 1][j][k]);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 10224
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
 
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 pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	int n,b,sum=0;
    vi l;
    cin >> n;
    rep(i,n){
        cin >> b;
        l.pb(b);
    }
    sort(l.begin(),l.end());
    rep(i,n-1){
        sum+=l[i];
    }
    cout << (sum>l[n-1]?"Yes\n":"No\n");
	return 0;
}


Measured memory_bytes: 256
using System;

class B{
  static void Main(){
    char[] s = Console.ReadLine().ToCharArray();
    int len = s.Length, A = 0, Z = -5;
    for (int i = 0; i < len; i++){
      if (s[i].ToString() == "A") {
        A = i + 1;
        break;
      }

    }
    for (int j = s.Length - 1; j > 0; j--){
      if (s[j].ToString() == "Z"){
        Z = j + 1;
        break;
      }
    }
    Console.WriteLine(Z - A + 1);
  }
}

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

// ある2つの配置の差の絶対値が何回足されるか
// N x Mの内Kが埋まり、ある2つが含まれる組み合わせは
// (N x M - 2) C (K - 2) 通り
// さらに行の差と列の差を分けてついて考えると上記にさらにM^2, N^2をそれぞれかける
// 例えば行の差の組み合わせの総和を上にかけると行の分の総和になる

long long mPow(long long x, long long n, const long long MOD)
{
    long long ans = 1;
    while (n != 0) {
        if (n & 1) ans = ans * x % MOD;
        x = x * x % MOD;
        n = n >> 1;
    }
    return ans;
}

long long mFact(const long long n, const long long MOD)
{
    long long fac = 1;
    for (long long i = 1; i <= n; ++i) {
        fac *= i;
        fac %= MOD;
    }
    return fac;
}

long long mComb(const long long n, long long r, const long long MOD)
{
    if (n < r || n < 0) return 0;
    if (r * 2 > n) r = n - r;

    return ((mFact(n, MOD) * mPow(mFact(r, MOD), MOD - 2, MOD) % MOD) * mPow(mFact(n - r, MOD), MOD - 2, MOD)) % MOD;
}

long long mRangeDiffSum(const long long n, const long long MOD)
{
    long long ans = 0;
    for (long long i = 1; i < n; ++i) {
        ans += i * (n - i) % MOD;
    }
    return ans;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    constexpr long long MOD = 1e9 + 7;

    int N, M, K;
    cin >> N >> M >> K;

    long long comb = mComb(N * M - 2, K - 2, MOD);
    long long x = ((mRangeDiffSum(N, MOD) * mPow(M, 2, MOD)) % MOD * comb) % MOD;
    long long y = ((mRangeDiffSum(M, MOD) * mPow(N, 2, MOD)) % MOD * comb) % MOD;
    cout << (x + y) % MOD << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a[3];
int k[3]{};
while(1){
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    if(a[0]+a[1]<=a[2])break;
    if(a[0]*a[0]+a[1]*a[1]<a[2]*a[2])k[0]++;
    else if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])k[1]++;
    else k[2]++;
    }
    printf("%d %d %d %d\n",k[0]+k[1]+k[2],k[1],k[2],k[0]);
}

Measured memory_bytes: 3224
#include <iostream>

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

using namespace std;

int H, W;
char A[10][10];
// #が全部でいくつあるか
int all_cost = 0;

//右か下に移動する
int dy[] = {0, 1};
int dx[] = {1, 0};

bool dfs(int nowy, int nowx, int cost){
  //cout<<nowy+1<<" "<<nowx+1<<" "<<cost<<endl;
  // 通ってきた道が#の数に等しい，かつ右下に到達している
  if(cost == all_cost && nowy==H-1 && nowx==W-1)
    return true;
  
  // 右か下に移動できるならする
  rep(k, 2){
    // 枠からはみ出したらスキップ
    if(nowy+dy[k]>=H || nowx+dx[k]>=W)
      continue;
    
    // 次の道があればそこからDFSを始める
    if(A[nowy + dy[k] ][nowx + dx[k] ] == '#'){
      if( dfs(nowy + dy[k], nowx + dx[k], cost+1) )
	return true;
    }
  }
  // 上でtrueを返さなければ失敗
  return false;
}


int main(){
  cin >> H >> W;
  rep(i, H)
    rep(j, W){
    cin >> A[i][j];
    if(A[i][j] == '#')
      all_cost++;
  }
  // 入力終了

  if( dfs(0, 0, 1) )
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k,i,x,y;
    cin>>n>>k;
    x=((n-1)*(n-2)/2);
    if(k>x)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<(n-1)+(x-k)<<endl;
    for(i=2;i<=n;i++)
    {
        cout<<"1 "<<i<<endl;
    }
    y=x-k;
    //cout<<y<<endl;
    ll c=2,d=c+1;
    while(y)
    {
        cout<<c<<" "<<d<<endl;
        //c++;
        d++;
        if(d>n)
        {
            c++;
            d=c+1;
        }
        y--;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ep emplace_back
#define st first
#define sc second

using namespace std;

const ll mod = 998244353;
const int e = 5e5 + 69;
const int base = 311;
// dung igt thay cho gt luc tinh giai thua
// 10
// cach tao hoan vi tu n so : n*(n+1)/2;
ll gt[e];
ll igt[e];
ll  b[e];
ll n;
ll a[e];

int main()
{
    ll n, m;
    cin >> n >> m;
    cout << m*(m - 1)/2  + n*(n - 1)/2;
}


Measured memory_bytes: 256
// =====================================================================================
//
//       Filename:  atcoder.cpp
//
//    Description:  
//
//        Version:  1.0
//        Created:  26/04/20 03:38:51 AM IST
//       Revision:  none
//       Compiler:  g++
//
//         Author:  Kiran Bhanushali (), kiranbhanushali143.kb143@gmail.com
//   Organization:  
//
// =====================================================================================

#include<bits/stdc++.h>


using namespace std;

#define int long long 
#define pb push_back
//#define _SHOW_TIME

void solve(){
    string s;
    cin>>s;
    int n = s.size()+1;
    vector<int> a(n,0);
    for(int i=0;i<n-1;i++){
        if(s[i]=='<'){
            a[i+1]  = a[i]+1;
        }
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='>'){
            a[i] = max(a[i],a[i+1]+1);
        }
    }
    int ans = 0 ; 
    for(int i=0;i<n;i++){
        ans+= a[i];
    }
    cout<<ans<<endl;

    
}
int32_t main(){
 /////////////////////////////////////
    #ifdef _SHOW_TIME
	int tt = (int) clock();
    #endif
    /////////////////////////////////////
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /////////////////////////////////////
    solve();
    /////////////////////////////////////
    #ifdef _SHOW_TIME
        cerr << "TIME = " << (double)(clock() - tt) / CLOCKS_PER_SEC << endl;
    #endif
    /////////////////////////////////////
    return 0;

}



Measured memory_bytes: 4764
#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
 
using namespace std;
 
#define BUF_SIZE 1024
#define ARRAY_SIZE 100
 
int main(){
 
    char buf[BUF_SIZE] = {0};
    int n = atoi(fgets(buf,BUF_SIZE,stdin));
 
    int array[ARRAY_SIZE] = {0};
 
    for(int i = 0; i < n; i++){
        cin >> array[i];
    }
 
    for(int k = 0;k < n; k++){
        if(k != n-1){
            printf("%d ",array[k]);
        }else{
            printf("%d\n",array[k]);
        }
    }
 
    int v = 0;
    int j = 0;
    for(int i = 1; i < n; i++){
        v = array[i];
        j = i-1;
        while(j >= 0 && array[j] > v){
            array[j+1] = array[j];
            j--;
        }
        array[j+1] = v;
        for(int k = 0;k < n; k++){
            if(k != n-1){
                printf("%d ",array[k]);
            }else{
                printf("%d\n",array[k]);
            }
        }
    }
 
}


Measured memory_bytes: 3236
#include "bits/stdc++.h"
using namespace std;

vector<int>primes(1000001);
void hurui(const int amax) {
	static bool flag = false;
	if (flag)return;
	vector<int>sos;
	sos = vector<int>(amax + 1, true);
	sos[0] = false; sos[1] = false;
	for (int i = 2; i <= amax; ++i) {
		if (sos[i]) {
			for (int j = 2 * i; j <= amax; j += i)sos[j] = false;
		}
	}
	for (int i = 0; i <= amax; ++i) {
		if (sos[i]) {
			primes[i] = true;
		}
	}
	flag = true;
}

int main() {
	hurui(1000000);
	while (1) {
		int N; cin >> N;
		if (!N)break;
		int ans = 0;
		for (int i = 2; i <= N / 2; ++i) {
			if (primes[i] && primes[N - i])ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 10468
num=int(input())
count_AC=0
count_WA=0
count_TLE=0
count_RE=0

def judge(x):
        global count_AC
        global count_WA
        global count_TLE
        global count_RE
        if x=='AC':
            count_AC+=1
        if x=='WA':
            count_WA+=1
        if x=='TLE':
            count_TLE+=1
        if x=='RE':
            count_RE+=1

for i in range(num):
        judge(input())

print('AC x',str(count_AC),'\nWA x',str(count_WA),'\nTLE x',str(count_TLE),'\nRE x',str(count_RE))



Measured memory_bytes: 9108
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long n;
  cin >> n;
  vector<long> p(n);
  rep (i, n) cin >> p[i];
  long count = 0;
  rep (i, n-2) {
    if (p[i+1] > p[i] and p[i+1] > p[i+2]) continue;
    if (p[i+1] < p[i] and p[i+1] < p[i+2]) continue;
    count ++;
  }
  cout << count << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
const int N=2e5+100;
int a[N],d[N],f[N];
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	int l=1,r=n,ans;
	while(l<=r){
		int mid=(l+r)>>1;
		d[0]=0;
		bool pd=true;
		for(int i=1;i<=n;i++){
			if(a[i]<=a[i-1]){
				while(d[0]&&d[d[0]]>a[i]) d[0]--;
				if(d[d[0]]!=a[i]) d[++d[0]]=a[i],f[d[0]]=0;
				f[d[0]]++;
				while(f[d[0]]==mid){
					if(d[d[0]]==1) {pd=false;break;}
					d[0]--;
					int t=d[d[0]+1]-1;
					if(d[d[0]]!=t) d[++d[0]]=t,f[d[0]]=0;
					f[d[0]]++; 
				}
				if(!pd) break;
			}
		}
		if(pd) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2524
import java.util.*;
import java.io.*;

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

        while(true) {
            String S = sc.next();
            int sum = 0;
            if (S.length() == 1 && Integer.parseInt(S) == 0) {
                break;
            }
            for (int i = 0; i < S.length(); i++) {
                sum += Integer.parseInt(S.substring(i, i+1));
            }
            out.printf("%d\n", sum);
        }
        out.flush();
    }
}


Measured memory_bytes: 26936
#include<stdio.h>
#include<iostream>
using namespace std;

int A,B,C,K;
int main (){
    cin >> A >> B >> C >> K;
    for(int i=0; i<K; i++){
        if( A >= B && A >= C ) A *= 2;
        else if( B >= A && B >= C ) B *= 2;
        else if( C >= A && C >= B ) C *= 2;
    }
    cout <<  A + B + C << endl;
    return 0;
}

Measured memory_bytes: 256
o=list(input())
e=list(input())

ans=[]
if len(o)==len(e):
    for i in range(len(o)):
        ans.append(o[i])
        ans.append(e[i])
    print(''.join(ans))
else:
    for i in range(len(e)):
        ans.append(o[i])
        ans.append(e[i])
    ans.append(o[-1])
    print(''.join(ans)) 


Measured memory_bytes: 3064
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	private static final String YES = "Yes";

	private static final String NO = "No";

	public static void main(String[] args) {

		int[][] arr = scan();
		System.out.println(process(arr) ? YES : NO);
	}

	private static int[][] scan() {

		Scanner sc = new Scanner(System.in);
		int[][] arr = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				arr[i][j] = sc.nextInt();
			}
		}
		sc.close();
		return arr;
	}

	private static boolean process(int[][] arr) {

		Map<String, Integer> map = new HashMap<>();

		return invoke(arr, map, 0);
	}

	private static boolean invoke(int[][] arr, Map<String, Integer> map, int j) {

		while (j < 3) {
			String aKey = "a" + j;
			int a = arr[0][j];
			if (map.get(aKey) == null) {
				map.put(aKey, a);
			} else {
				a = map.get(aKey);

				if (a < 0) {
					return false;
				}
			}

			int b;
			String bKey;
			for (int i = 0; i < arr.length; i++) {
				bKey = "b" + i;
				b = arr[i][j] - a;

				if (map.get(bKey) == null) {
					map.put(bKey, b);
				} else if (b != map.get(bKey)) {
					if (j > 0) {
						map.put(aKey, map.get(aKey) - 1);
						return invoke(arr, map, j);
					}
					map.put(bKey, b);
				} else {
					b = map.get(bKey);
				}

				if (b < 0 || arr[i][j] != (a + b)) {
					map.put(aKey, map.get(aKey) - 1);
					return invoke(arr, map, j);
				}
			}
			return invoke(arr, map, j + 1);
		}

		return true;
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <algorithm>
typedef long long ll;

int main(void) {
  ll i, j, k, n;
  scanf("%lld", &n);
  ll a[n], b[n];
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    b[i] = a[i];
  }
  std::sort(a, a + n);
  for(i = 0; i < n; ++i) {
    if(b[i] >= a[n / 2]) printf("%lld\n",a[n / 2 - 1]);
    else printf("%lld\n",a[n / 2]);
  }
  return 0;
}

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

bool isPrime(int X) {
    int bound = sqrt(X);
    for (int i = 2; i <= bound; i++) {
        if (X % i == 0)
            return false;
    }
    return true;
}

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

    int X;
    cin >> X;
    for (int i = X; ; i++) {
        if (isPrime(i)) {
            cout << i << '\n';
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
/// 11:57 AM 04/04/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

template<typename T>
void ContainerError(T &v);

ll powmod(ll base, ll exp, ll MOD);

ll mpow(ll base, ll exp);

ll gcd(ll a, ll b);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    if(c == 0) {
        ll cnt = 0;
        for(auto x:s) {
            if(x=='o') {
                cnt++;
            }
        }
        if(cnt == k) {
            for(ll i=0;i<n;i++) {
                if(s[i]=='o') {
                    cout<<i+1<<endl;
                }
            }
        }
        return 0;
    }
    vector<ll> v(n);
    for (ll i = n - 1; i >= 0; i--) {
        ll nextIn = i + c + 1;
        if (s[i] == 'x') {
            if (i == n - 1) {
                v[i] = 0;
            } else {
                v[i] = v[i + 1];
            }
        } else {
            if (i == n - 1) {
                v[i] = 1;
            } else {
                if (nextIn < n) {
                    v[i] = v[nextIn] + 1;
                } else {
                    v[i] = 1;
                }
            }
        }
    }
    map<ll, vector<ll> > m;
    for (ll i = 0; i < n; i++) {
        if (s[i] == 'o') {
            if(v[i] < k) {
                m[v[i]].pb(i);
            } else {
                m[k].pb(i);
            }
        }
    }
    ll prevB = -1;
    ll j = k+1;
    for (ll it = k; it >= 0; it--) {
        ll temp = INT_MAX;
        ll cnt = 0;
        for (auto &y:m[it]) {

            if (y >= prevB) {
                cnt++;
                temp = min(temp, y + c + 1);
            }
        }
        if (cnt == 1) {
            cout << temp - c << endl;
        }
        prevB = temp;
    }
    return 0;
}

template<typename T>
void ContainerError(T &v) {
    cout << "{";
    for (auto &x:v) { cout << x << ','; }
    cout << "}" << endl;
    return;
}

ll powmod(ll base, ll exp, ll MOD) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return (res % MOD);
}

ll mpow(ll base, ll exp) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base);
        base = (base * base);
        exp /= 2;
    }
    return (res);
}

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }



Measured memory_bytes: 5012
s = input()
if s == "SUN":
    print(7)
if s == "MON":
    print(6)
if s == "TUE":
    print(5)
if s == "WED":
    print(4)
if s == "THU":
    print(3)
if s == "FRI":
    print(2)
if s == "SAT":
    print(1)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    int N;
    cin >> N;
    ll a[N];
    REP(i, N) cin >> a[i];
    ll res = 0;
    while(1){
        bool flag = false;
        REP(i, N){
            if(a[i]>=N){
                flag = true;
                res += a[i]/N;
                REP(j, N){
                    if(j!=i){
                        a[j] += (a[i]/N);
                    }
                }
                a[i] = a[i]%N;
            }
        }
        if(!flag) break;
    }
    cout << res << endl;
    return 0;
}

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

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

int main()
{
    ll i,j;
    ll n,m,q;
    cin >> n >> m >> q;
    vector<vector<ll>> p(n+1,vector<ll>(n+1, 0));
    for(i = 0;i < m;++i){
        ll l,r;
        cin >> l >> r;
        ++p.at(l).at(r);
    }
    for(i = 0;i <= n;++i){
        rep(j,n){
            p.at(i).at(j+1) += p.at(i).at(j);
        }
    }
    for(i = 0;i < n;++i){
        rep(j,n+1){
            p.at(i+1).at(j) += p.at(i).at(j);
        }
    }
    for(i = 0;i < q;++i){
        ll l,r;
        cin >> l >> r;
        cout << p.at(r).at(r) - p.at(r).at(l-1) - p.at(l-1).at(r) + p.at(l-1).at(l-1) << endl;
    }

    return 0;
}

Measured memory_bytes: 2944
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.nextLine());
		String line = scanner.nextLine();
		String[] split = line.split(" ");
		List<Integer> intList = new ArrayList<Integer>();

		for(String s : split){
			intList.add(Integer.parseInt(s));
		}
		int cnt = 1;
		int min = intList.get(0);
		for(int i = 1; i < intList.size(); i++){
			int target = intList.get(i);
			if(target <= min){
				cnt++;
				min=target;
			}
		}
		int result = cnt;
		System.out.println(result);
	}

}


Measured memory_bytes: 56300
#include <iostream>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
using namespace std;

int main ()
{
	int a, b;
	cin >> a >> b;

	cout << a * b << " " << 2 * (a + b) << endl;
	
	return 0;
}


Measured memory_bytes: 3068
using System;
using System.Collections.Generic;

namespace AOJ.Volume1
{
    public class PacketTransportation
    {
        // ルータの接続情報
        // node[1,2]はルータ1からルータ2に接続できるかを表す
        // 0→接続不可,1→接続可能
        private static int[,] edge;

        private struct Rooter
        {
            public int No;
            public int Cost;
            public bool Confirm;
        }

        private static Rooter[] node;

        private static void Calc(int n, int start)
        {
            // ダイクストラ法で各ルータの距離を計算
            // 配列を初期化
            node = new Rooter[n + 1];
            for (int i = 1; i <= n; i++)
            {
                node[i].No = i;
                node[i].Cost = -1;
                node[i].Confirm = false;
            }

            node[start].Cost = 0;
            node[start].Confirm = true;

            var que = new Queue<Rooter>();
            que.Enqueue(node[start]);
            while (que.Count > 0)
            {
                var r = que.Dequeue();
                for (int i = 1; i <= n; i++)
                {
                    if ((edge[r.No, i] == 1) && (node[i].Confirm == false))
                    {
                        // 今回はすべてのルータ間の距離が同じなので発見次第確定
                        node[i].Cost = r.Cost + 1;
                        node[i].Confirm = true;
                        que.Enqueue(node[i]);
                    }
                }
            }

            return;
        }

        public static int Main()
        {
            int n = int.Parse(Console.ReadLine());
            // 接続情報初期化
            edge = new int[n + 1, n + 1];
            for (int i = 0; i < n; i++)
            {
                var input = Console.ReadLine().Split(' ');
                int no = int.Parse(input[0]);
                int node_cnt = int.Parse(input[1]);
                for (int j = 2; j < node_cnt + 2; j++) { edge[no, int.Parse(input[j])] = 1; }
            }

            int packet_cnt = int.Parse(Console.ReadLine());
            for (int i = 0; i < packet_cnt; i++)
            {
                var input = Console.ReadLine().Split(' ');
                int start = int.Parse(input[0]);
                int goal = int.Parse(input[1]);
                int ttl = int.Parse(input[2]);

                // 距離を計算
                Calc(n, start);
                if (node[goal].Confirm == false) { Console.WriteLine("NA"); }
                else if (node[goal].Cost >= ttl) { Console.WriteLine("NA"); }
                else { Console.WriteLine(node[goal].Cost + 1); }
            }
            return 0;
        }
    }
}

Measured memory_bytes: 10576
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String[] inputs = input.split(" ");
        float worldBTime = Integer.valueOf(inputs[0]);
        float x  = Integer.valueOf(inputs[1]);
        float output = worldBTime/x;
        System.out.println(output);
    }
}


Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
int main(){
  int n;cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  //高さが全部0になるまでやる
  int res = 0;
  while(1){
    //最高たかさが0だったらおしまい　
    if(*max_element(h.begin(),h.end())==0) break;
    //区間分割する
    int i=0;
    while(i<n){
      if(h[i]==0) ++i;
      else{
        ++res;
        while(i<n&&h[i]>0){
          --h[i];
          ++i;
        }
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
signed main(){
  int H,W;
  cin>>H>>W;
  queue<pair<int,int>> Q;
  vector<vector<char>> A(H,vector<char>(W));
  vector<vector<int>> B(H,vector<int>(W,-1));
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++){
      cin>>A[i][j];
      if(A[i][j]=='#'){
        Q.push({i,j});
        B[i][j]=0;
      }
    }
  int ans=0;
  while(!Q.empty()){
    pair<int,int> p=Q.front();
    Q.pop();
    for(int i=0;i<4;i++){
      int x=p.first+dx[i],y=p.second+dy[i];
      if(0<=x && x<H && 0<=y && y<W && B[x][y]==-1){
        B[x][y]=B[p.first][p.second]+1;
        Q.push({x,y});
        ans=max(ans,B[x][y]);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 28280
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc107_a.cpp
 * time   : Thu Apr 30 22:22:24 2020
 * quest  : A - Train
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, i;
  cin >> n >> i;
  cout << ++n - i << "\n";
  return 0;
}


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

using ll = long long;

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 200000;
int v[5 + nmax];
int nxt[5 + nmax];
int nxt2[5 + nmax];
int scuba[5 + nmax];

int fixed(int pos, int k) {
  if(scuba[pos] <= pos - k + 1)
    return 1;
  return 0;
}

int main() {
  int n, k;
  std::cin >> n >> k;
  v[0] = n + 1;
  v[n + 1] = -1;
  for(int i = 1; i <= n; i++)
    std::cin >> v[i];
  scuba[1] = 1;
  for(int i = 2;i <= n; i++) {
    if(v[i - 1] < v[i])
      scuba[i] = scuba[i - 1];
    else
      scuba[i] = i;
  }

  for(int i = 1; i <= n; i++) {
    nxt[i] = i - 1;
    while(v[nxt[i]] < v[i])
      nxt[i] = nxt[nxt[i]];
  }
  for(int i = n; 1 <= i; i--) {
    nxt2[i] = i + 1;
    while(v[i] < v[nxt2[i]])
      nxt2[i] = nxt2[nxt2[i]];
  }
  int result = n - k + 1;
  int total = 0;
  for(int i = k; i <= n; i++)
    total += fixed(i, k);

  for(int i = k + 1; i <= n; i++) {
    if(fixed(i - 1, k) == 0 && fixed(i, k) == 0)
      if(nxt[i] <= i - k && i <= nxt2[i - k])
        result--;
  }
  std::cout << result - std::max(0, (total - 1));
  return 0;
}


Measured memory_bytes: 6700
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int n;
    cin>>n;
    int b=0;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    REP(i,n){
        b+=a[i];
    }
    cout<<b-n;
    return 0;
}


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

const int MAX = 100000;
vector<int> friends[MAX + 1];
int groups[MAX + 1];

void dfs(int id, int gid) {
  if (groups[id] != -1) return;
  groups[id] = gid;

  int l = friends[id].size();
  for (int i = 0; i < l; i++) {
    dfs(friends[id][i], gid);
  }
}

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

  int n, m;
  cin >> n >> m;

  int a, b, q;
  int gid = 0;

  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    friends[a].push_back(b);
    friends[b].push_back(a);
  }

  for (int i = 0; i < n; i++) groups[i] = -1;

  for (int i = 0; i < n; i++) {
    if (groups[i] == -1) dfs(i, gid++);
  }

  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    if (groups[a] == groups[b]) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }

  return 0;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int i##_to_ = (t), i = (f); i <= i##_to_; i++)
#define uptil(f, t, i)   for(int i##_to_ = (t), i = (f); i <  i##_to_; i++)
#define downto(f, t, i)  for(int i##_to_ = (t), i = (f); i >= i##_to_; i--)
#define downtil(f, t, i) for(int i##_to_ = (t), i = (f); i >  i##_to_; i--)
typedef long double LD;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define ln << endl
#else
#define debug false
#define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '



signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    int N; scanf("%d", &N);
    int c1 = 0, c2 = 0, c4 = 0;

    times(N, i) {
        int A; scanf("%d", &A);
        if(A & 1) ++c1;
        else if(A & 2) ++c2;
        else ++c4;
    }

    cout << (c1 <= c4 || c1 == c4 + 1 && c2 == 0 ? "Yes" : "No");

    return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


int main() {
    ll n; cin >> n;
    if(n % 2 == 0) cout << n << endl;
    else cout << 2 * n << endl;

    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define MP make_pair
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> P;

int main(){
	int N, M;
	while(cin >> N >> M, N|M){
		vector<int> rec(N);
		vector<vi> stu(M, vi(1300, 0));
		int r;
		cin >> r;
		while(r--){
			int t, n, m, s;
			cin >> t >> n >> m >> s;
			n--, m--;
			if(s){
				rec[n] = t;
			}else{
				for(int i = rec[n]; i < t; i++){
					stu[m][i] = 1;
				}
			}
		}
		int q;
		cin >> q;
		while(q--){
			int t1, t2, m;
			cin >> t1 >> t2 >> m;
			m--;
			int ans = 0;
			for(int i = t1; i < t2; i++){
				ans += stu[m][i];
			}
			//cout << "***";
			cout << ans << endl;
		}

	}

	return 0;
}

Measured memory_bytes: 50740
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans, N, M;

/*
 * x z y
 * 2 0 2
 * 2 1 1
 * 2 0 2
 * 2 1 1
 * */


struct UnionFind {
	vector<int> par;
	vector<int> rank;

	UnionFind(int n) : par(n), rank(n) { 
		for(int i = 1; i <= n; i++) {par[i] = i; rank[i] = 0;}
	}

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

		if (rank[x]>rank[y]) par[y] = x;
		else {par[x] = y; if (rank[x]==rank[y]) rank[y]++;}
	}
	bool same(int x, int y) {return find(x)==find(y);}
};

int main(void) {
    scanf("%d %d", &N, &M);
    UnionFind uf(N+1);
    for (int i=0; i<M; i++) {
        int x, y, z;
        scanf("%d %d %d", &x, &y, &z);
        uf.unite(x, y);
    }

    for(int i=1; i<=N; i++) {
        if (uf.par[i]==i) ans++;
    }
   

  
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#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>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

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

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    vc<pi> p;
    rep(i,N){
        int a; cin >> a;
        p.eb(a,i+1);
    }
    sort(all(p));
    rep(i,N){
        cout << p[i].se << (i==N-1?"":" ");
    }
}

Measured memory_bytes: 2544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s;
  ll n;
  cin >> s >> n;
  rep(i, s.size()-1) {
    if (s.at(i) == 'a') continue;
    ll num = 'z' - s.at(i);
    if (n >= num+1) {
      s.at(i) = 'a';
      n -= num+1;
    }
  }
  ll num = s.at(s.size()-1) - 'a';
  n += num;
  n %= 26;
  char c = 'a' + n;
  s.at(s.size()-1) = c;
  cout << s << endl;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main() {
	int a, b, c, x, y;
	scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
	int ans = 1e9;
	for (int i = 0; i <= max(x, y) * 2; i++) {
		int now = c * i + max(0, (x - i / 2) * a) + max(0, (y - i / 2) * b);
		ans = min(ans, now);
	}
	printf("%d\n", ans);
	return 0;
}

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

int N;
int A[210];
bool t = true;      
int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int res = 0;
    while(t){
        for(int i=0;i<N;i++){
            if (A[i]%2==0) A[i]=A[i]/2;
            else t = false;
        }
        if(t) ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int W,H,r,x,y;
     scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
     if(H >= r + y && W >= r + x && 0 <= x - r && 0 <= y - r){
         printf("Yes\n");
     }
     else{
         printf("No\n");
     }
     return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, K, Ans=0;
  cin >> N >> K;
  vector<int> l(N);
  rep(i, N) cin >> l.at(i);
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());
  rep(i, K) Ans+=l.at(i);
  cout << Ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

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

using namespace std;
string S;
int main(){
  cin >> S;
  if(S[5]=='0'){
    if(S[6]=='1'||S[6]=='2'||S[6]=='3'||S[6]=='4'){
    cout << "Heisei" << endl;
      return 0;
    }
  }
  cout << "TBD" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int inf = 100100;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  int sum=0;
  for(int i=0;i<n;i++){
    sum ^= a.at(i);
  }
  
  //cout << sum << endl;
  
  for(int i=0;i<n;i++){
    cout << (sum^a.at(i)) << " ";
  }
  
  cout << endl;

  return(0);
}

Measured memory_bytes: 3988
'use strict';
var Main = function(stdin) {
  var line = stdin.split('\n');
  var result = (function(sec) {
    return [
    	~~(sec / (60 * 60))
    	,~~((sec % (60 * 60)) / 60)
    	,(sec % 60)
    ].join(':');
  }(
  	parseInt(line[0],10)
  ));
  console.log(result);
};

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7648
#include<iostream>

int main(){
	//入力機構
	int a,b;
	std::cin>>a>>b;
	//解答
	//a+b,a*bが15に等しいか判定する
	if(a+b==15){
		std::cout<<"+"<<std::endl;
	} else if(a*b==15){
		std::cout<<"*"<<std::endl;
	} else{
		std::cout<<"x"<<std::endl;
	}

	//結果出力

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
bool p[5001][5001];
bool c(int a){
  return 0<=a&&a<=5000;
}
int main(){
  while(cin>>n&&n){
    int x[5000],y[5001],an=0;
    for(int i=0;i<n;i++)cin>>x[i]>>y[i],p[x[i]][y[i]]=1;
    for(int i=0;i<n;i++)
      for(int j=i;j<n;j++){
    int dx=x[i]-x[j],dy=y[i]-y[j];
    int x1=x[i]-dy,y1=y[i]+dx,x2=x[j]-dy,y2=y[j]+dx;
    int x3=x[i]-dy,y3=y[i]+dx,x4=x[j]+dy,y4=y[j]-dx;
    if(c(x1)&&c(y1)&&p[x1][y1]&&c(x2)&&c(y2)&&p[x2][y2])
      an=max(an,dx*dx+dy*dy);
    if(c(x3)&&c(y3)&&p[x3][y3]&&c(x4)&&c(y4)&&p[x4][y4])
      an=max(an,dx*dx+dy*dy);
      }
    cout<<an<<endl;
  }
  return 0;
}

Measured memory_bytes: 22676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////


int main(){fastio
    
    string s;cin>>s;
    rep(i,0,s.size()-1){
        if(s[i]==',')cout<<" ";
        else cout<<s[i];
    }cout<<endl;
    
    return 0;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,m,n) for(int i=(m);i<(n);i++)
#define rrep(i,m,n) for(int i=(m);i>=(n);i--)
#define printa(x,n) for(int i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
vector<int> divisor(int M){
    vector<int> dd;
    for(int i = 1; i * i <= M; i++){
        if(M % i == 0){
            dd.push_back(i);
            if(i * i != M) dd.push_back(M / i);
        }
    }
    sort(dd.begin(), dd.end());
    return dd;
}

int num[1000010] = {};

void solve(){
    int N;
    cin >> N;
    int A[200010];
    rep(i,0,N) cin >> A[i];
    int ans = 0;
    rep(i,0,N) num[A[i]]++;
    rep(i,0,N){
        vector<int> div = divisor(A[i]);
        bool ok = true;
        for(auto &e: div){
            if(e == A[i]){
                if(num[e] > 1){
                    ok = false;
                    break;
                }
            }else{
                if(num[e] > 0){
                    ok = false;
                    break;
                }
            }
        }
        if(ok) ans++;
    }
    print(ans);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 8236