akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define rep(i,n) for (int i=0; i<(n);++i)
using namespace std;
using ll=long long;
using P =pair<ll, ll>;
const ll INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


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

	//訪れた頂点
	vector<int>s;
	//頂点の番号
	vector<int>ord(n+1, -1);
	int c = 1, l = 0;
	{
		int v = 1;
		while (ord[v] == -1) {
			ord[v] = s.size();
			s.push_back(v);
			v = a[v - 1];
		}
		//周期ｃ
		 c = s.size() - ord[v];
		 l = ord[v];
	}

	if (k < l) cout<< s[k] << endl;
	else {
		k -= l;
		k %= c;
		cout << s[l + k] << endl;
	}
	return 0;
}

Measured memory_bytes: 5400
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

// size-base union-find
class UF {
public:
    ll node_size;
    vll siz;
    vll par;
    UF(ll sz) : par(sz), siz(sz, 1LL) {
        REP(i, sz) par[i] = i;
        node_size = sz;
    }
    // 再初期化
    void initialize(ll sz) {
        par.resize(sz);
        siz.assign(sz, 1LL);
        REP(i, sz) par[i] = i;
        node_size = sz;
    }
    ll root(ll x) {
        while(par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) return false;
        if(siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }
    bool find(ll x, ll y) {
        return root(x) == root(y);
    }
    ll size(ll x) {
        return siz[root(x)];
    }
    map<ll, ll> islands() {
        set<ll> st;
        REP(i, node_size) {
            st.insert(root(i));
        }
        map<ll, ll> ret;
        for(auto &s:st) {
            ret[s] = size(s);
        }
        return ret;
    }
};

void solve() {
    ll N, K, L;
    cin >> N >> K >> L;
    UF uf1(N), uf2(N);
    REP(i, K) {
        ll a, b;
        cin >> a >> b;
        uf1.unite(a - 1, b - 1);
    }
    REP(i, L) {
        ll a, b;
        cin >> a >> b;
        uf2.unite(a - 1, b - 1);
    }
    vpll vp;
    map<pll, ll> mp;
    REP(i, N) {
        vp.push_back({uf1.root(i), uf2.root(i)});
        mp[{uf1.root(i), uf2.root(i)}]++;
    }
    REP(i, N) {
        cout << mp[vp[i]] << (i == N-1 ? endl : " ");
    }
}

int main() {
    fast_io;
    solve();
    return 0;
}


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

typedef long long int64;
#define REP(i,n) for(int64 i=0;i<(int64)(n);i++)
#define REPD(i,n) for(int64 i=(int64)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int64 i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int64)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define GSORT(x) sort(ALL(x), greater<int64>());
#define SUM(x) accumulate(ALL(A), 0);
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 namespace std;

void Main()
{
    int64 N;
    //cin >> N;
    N=3;
    vector<int64> A(N,0);
    for(int64 i=0;i<N;i++){
        cin >> A[i];
    }
    REP(i,N-1) {
		if (A[i + 1] <= A[i]){
			cout << "No" << "\n";
			return;
		}
	}
    cout << "Yes" << "\n";
    return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}



Measured memory_bytes: 3184
#include<stdio.h>

int main(){
  int h,i,j,k,l,m;
  int AP[100][100];

  scanf("%d",&h);

  for(i=0;i<h;i++){
    for(j=0;j<h;j++){
      AP[i][j]=0;
    }
  }
  for(i=0;i<h;i++){
    scanf("%d%d",&k,&l);
    k--;
    for(j=0;j<l;j++){
      scanf("%d",&m);
      m--;
      AP[k][m]=1;
    }
  }
 for(i=0;i<h;i++){
   for(j=0;j<h;j++){
     if(j>0)printf(" ");
     printf("%d",AP[i][j]);
   }
   printf("\n");
 }
 return 0;
}




Measured memory_bytes: 2108
parseBig(x) = parse(BigInt, x)

const MOD=1000000007
function modcmb(n,r)
    res::BigInt=1
    d::Int=min(r,n-r)
    for i in 0:d-1
        res=res*(n-i)*powermod(d-i,MOD-2,MOD)%MOD
    end
    return res%MOD
end

function main()
    n,a,b=parseBig.(split(readline()))
    ans::BigInt=mod(powermod(2,n,MOD)-1-modcmb(n,a)-modcmb(n,b),MOD)
    println(ans%MOD)
end
main()

Measured memory_bytes: 298040
#include <iostream>
#include <algorithm>

using namespace std;
int main(){
  int b[10];
  int a;
  for(int i=0; i < 10; i++){
    cin >> a;
    b[i] = a;
  }
  sort(b,b+10);
  for(int j=10; j > 7; j--){
    cout  << b[j-1]  << endl;
  }
}

Measured memory_bytes: 0
///  5 7 5 5 7 5 5 7 5
///  5 5 7 5 5 7          7 5 5 7 5 5
#include<stdio.h>

int main(){
  int a,b,c;
  int count;
  int format[7];
  scanf("%d%d%d",&a,&b,&c);
  for(int i = 0;i < 6;i++){
     if(i % 3 == 0)
        format[i] = a;
     else if(i % 3 == 1)
        format[i] = b;
     else format[i] = c;
  }
  count = 0;

  for(int i = 0;i < 6;i++){
    //printf("format[%d]:%d\n",i,format[i]);
    if(format[i] == 5&&format[i+1] == 7&&format[i+2] == 5){
        count = 1;
    }
  }
  if(count == 1)
    printf("YES\n");
  else
    printf("NO\n");

 return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b,c;
    cin>>a>>b>>c;
    cout1((a+b)*c/2)
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

// #include "competitive_helper.cpp"

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

LL n;

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    cin >> n;
    if (n == 0 || n % 2 == 1) {
        cout << 0 << endl;
    }
    else {
        n /= 2;
        LL ans = 0;
        while (n) {
            ans += n / 5;
            n /= 5;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;


string s, t;

signed main() {
    cin >> s >> t;
    bool f = false;
    for (int i=0;i<s.size() && !f;i++) {
        rotate(s.begin(), s.begin()+1, s.end());
        if (t == s) f = true;
    }

    cout << (f? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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 pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N;
	cin >> N;
	map<int, int>m;
	vector<int>A(N);
	rep(i, N)cin >> A[i];
	rep(i, N)m[A[i]]++;
	int sum = 0;
	rep(i, N)sum += A[i];
	int Q;
	cin >> Q;
	vector<int>ans;
	rep(i, Q) {
		int B, C;
		cin >> B >> C;
		if (m[B])
		sum = sum - m[B] * B + m[B] * C;
		ans.push_back(sum);
		int b = m[B];
		m[B] = 0;
		m[C] += b;
	}
	rep(i, ans.size())cout << ans[i] << endl;
}

Measured memory_bytes: 10872
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int num = s.nextInt();
		
		int right = num % 10;
		int mid = (num / 10) % 10;
		int left = (num / 10) / 10;
		
		if (right == 7 || mid == 7 || left == 7)
			System.out.println("Yes");
		else 
			System.out.println("No");
		
		

	}
}


Measured memory_bytes: 35748
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int a[203][3];
    int n,i,j,x,y,z,sum,t,s,w,flag;
    cin>>n;
    for(i=0; i<2*n; i++)
    {
        cin>>a[i][0]>>a[i][1];
        if(i<n)
        {
            a[i][2]=0;
        }
        else
        {
            a[i][2]=1;
        }
    }
    for(i=0; i<(2*n); i++)
    {
        for(j=i+1; j<(2*n); j++)
        {
            if(a[j][0]<a[i][0])
            {
                x=a[i][0];
                y=a[i][1];
                z=a[i][2];
                a[i][0]=a[j][0];
                a[i][1]=a[j][1];
                a[i][2]=a[j][2];
                a[j][0]=x;
                a[j][1]=y;
                a[j][2]=z;
            }
        }
    }
    sum=0;
    for(i=0; i<(2*n); i++)
    {
        t=500;
        w=-2;
        flag=0;
        if(a[i][2]==1)
        {
            if(i>0)
            {
                for(j=i-1; j>=0; j--)
                {
                    if(a[j][1]<a[i][1]&&a[j][2]==0)
                    {
                        s=a[i][1]-a[j][1];
                        if(s<t&&w==-2)
                        {
                           flag=1;
                           a[j][2]=2;
                           w=j;
                           t=s;
                        }
                        if(s<t&&w!=-2)
                        {
                            flag=1;
                            a[w][2]=0;
                            a[j][2]=2;
                            w=j;
                            t=s;
                        }
                    }
                    if(j==0&&flag==1)
                    {
                        sum++;
                    }
                }
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


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

using namespace std;

#define ll long long
#define FOR(x,z,y) for(ll x=z; x < (ll)y; x++)



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

    int n,m, temp;
    cin >> n >> m;
    vector<int> a(m);
    FOR(i,0,m){
        cin >> temp;
        n -= temp;
    }

    if(n<0){
        cout << "-1";
    }
    else{
        cout << n;
    };

}


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

using namespace std;

int main(){
        int a[3];
        cin>>a[0]>>a[1]>>a[2];
        sort(a, a+3);
        int cnt0=0, cnt1=0;
        for(int i=0;i<3;i++){
                if(a[i]%2==0){
                        cnt0++;
                }
                else{
                        cnt1++;
                }
        }
        int res=0;
        //cout<<cnt0<<" "<<cnt1<<endl;
        if(cnt0==1||cnt1==1){
                res++;
                //cout<<res<<endl;
                for(int i=0;i<3;i++){
                        //cout<<i<<endl;
                        if(cnt0==1){
                                if(a[i]%2!=0){
                                        a[i]++;
                                        //cout<<a[i]<<endl;
                                }
                        }
                        else if(cnt1==1){
                                if(a[i]%2==0){
                                        a[i]++;
                                        //cout<<a[i]<<endl;
                                }
                        }
                }
        }
        sort(a, a+3);
        //cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
        cout<<(a[2]-a[0])/2+(a[2]-a[1])/2+res<<endl;
        return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/04/30  Problem: AOJ 2306 / Link: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2306  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;



void dfs(int v, VI &vs, VVI &G) {
	if (v == N) {
		LL ret = 0;
		if (SZ(vs) < 2)return;
		FOR(i, 0, SZ(vs)) {
			int u = vs[i];
			int t = INF;
			FOR(j, 0, SZ(vs)) {
				int n = vs[j];
				if (n != u) {
					t = min(t, G[u][n]);
				}
			}
			ret += t;
		}
		ans = max(ans, ret);
		return;
	}

	dfs(v + 1, vs,G);

	FOR(i, 0, SZ(vs)) {
		int u = vs[i];
		if (G[v][u] == 0)return;
	}
	vs.push_back(v);
	dfs(v + 1, vs, G);
	vs.pop_back();

}

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

	int M; cin >> N >> M;
	VVI G(N, VI(N, 0));
	FOR(i, 0, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		G[a][b] = G[b][a] = c;
	}
	VI v;
	dfs(0, v, G);
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 3276
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    string a,b;
    cin >> a >> b;
    if (a[2]==b[0] && a[0]==b[2] && a[1]==b[1]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


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

int main()
{
    long long int a , b , c , k ;
    cin>>a>>b>>c>>k;
    
    if ( k % 2 == 0 )
    {
        cout<<a-b<<endl;
    }
    else if ( k % 2 == 1 )
    {
        cout<<b-a<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

#define ll unsigned long long
void solve()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	rep(i,n)cin>>a[i];
	rep(i,n){
		if(a[i]==0){
			cout<<0;
			return;
		}
	}
	ll m=1000000000000000000;
	ll pre=1;
	ll mul=1;
	rep(i,n){
		pre=mul;
		string s=to_string(mul);
		string t=to_string(a[i]);
		if(s.size()+t.size()>20){
			cout<<-1;
			return;
		}
		mul*=a[i];
		if(mul>m){
			cout<<-1;
			return;
		}
		if(mul<pre){
			cout<<-1;
			return;
		}
	}
	cout<<mul;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3992
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  string rgb = "";
  REP(_, 3) {
    char c; cin >> c;
    rgb += c;
  }
  cout << (stoi(rgb) % 4 == 0 ? "YES\n" : "NO\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll> > v;
    for (int i = 0; i < n; ++i)
    {
        ll a, b;
        cin >> a >> b;
        v.emplace_back(a, b);
    }
    sort(all(v));
    ll sol = 0;
    for (pair<ll, ll> p : v)
    {
        ll b = min(m, p.second);
        sol += b * p.first;
        m -= b;
    }
    cout << sol;
}


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

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	string s;
	
	cin >> s;
	
	cout << s.substr(0, 3);
}
signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3636
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    auto a = aryread();
    a.sort();
    writeln((a[0] * a[1]) / 2);
}


Measured memory_bytes: 256
N = int(input())
A = list(int(input()) for _ in range(N))

S = [A[0]]
for i in range(1, N):
    if A[i] <= S[0]:
        S.insert(0, A[i])
        continue
    ok = 0
    ng = len(S)
    tmp = (ok+ng)
    while ok+1 < ng:
        tmp = (ok+ng)//2
        if A[i] > S[tmp]:
            ok = tmp
        else:
            ng = tmp
    S[ok] = A[i]
print(len(S))


Measured memory_bytes: 13564
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
#define MAXN 100010
int x[MAXN],fa[MAXN][20],step[MAXN];
vector<int>G[MAXN];
void dfs(int u,int p)
{
	step[u]=step[p]+1;
	for(int i=1,j=2;j<step[u];i++,j<<=1)
		fa[u][i]=fa[fa[u][i-1]][i-1];
	for(int i=0;i<G[u].size();i++)
		dfs(G[u][i],u);
}
int Solve(int a,int b)
{
	if(a>b) swap(a,b);
	int d=step[a]-step[b];
	int ret=0;
	for(int i=0;(1<<i)<=d;i++)
		if(d&(1<<i))
			a=fa[a][i];
	if(a>=b) return d;
	else if(a<b) return d+1;
}
int main()
{
	int n,L,q,a,b;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	scanf("%d",&L);
	int l=1,r=1;
	while(l<n)
	{
		while(r<=n&&x[r]-x[l]<=L) r++;
		fa[l][0]=r-1;
		G[r-1].push_back(l);
		l++;
	}
	dfs(n,0);
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d",&a,&b);
		printf("%d\n",Solve(a,b));
	}
}

Measured memory_bytes: 19584
def main(istr, ostr):
    n, k = list(map(int, istr.readline().strip().split()))
    ls = list(map(int, istr.readline().strip().split()))
    ls.sort()
    result = sum(ls[:k])
    print(result, file=ostr)


if __name__ == "__main__":
    import sys

    main(sys.stdin, sys.stdout)



Measured memory_bytes: 9244
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

// graph template
template<typename T>
class edge{
    public:
        int src, to; T cost;

        edge(int to, T cost): src(-1), to(to), cost(cost){}
        edge(int src, int to, T cost): src(src), to(to), cost(cost){}
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using AdjacencyList = vector<Edges<T>>;
template<typename T>
using Matrix = vector<vector<T>>;

template<typename T>
vector<T> bellman_ford(Edges<T> &es, int V, int s){
    const auto INF = numeric_limits<T>::max();
    vector<T> dist(V, INF);
    dist[s] = 0;

    for(int i = 0; i < V - 1; i++){
        for(auto &e: es){
            if(dist[e.src] == INF) continue;
            dist[e.to] = min(dist[e.to], dist[e.src] + e.cost);
        }
    }

    for(auto &e: es){
        if(dist[e.src] == INF) continue;
        if(dist[e.to] > dist[e.src] + e.cost) return vector<T>();
    }

    return dist;
}

int main(void){
    int V, E, R;
  scanf("%d %d %d", &V, &E, &R);
  Edges< int > es;
  for(int i = 0; i < E; i++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    es.emplace_back(a, b, c);
  }
  auto dists = bellman_ford(es, V, R);
  if(dists.empty()) puts("NEGATIVE CYCLE");
  for(auto &dist : dists) {
    if(dist == numeric_limits< int >::max()) puts("INF");
    else printf("%d\n", dist);
  }

    return 0;
}


Measured memory_bytes: 3248
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll x,y;
	cin >> x >> y;
	ll ans = 0;
	while(x <=y){
		x *= 2;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	string S[3];
	cin >> S[0] >> S[1] >> S[2];
	char mark = S[0][0];
	char temp;
	while (true) {
		if ((int)S[mark - 'a'].size() == 0) break;
		else {
			temp = S[mark - 'a'][0];
			S[mark - 'a'].erase(0, 1);
			mark = temp;
		}
	}

	mark = toupper(mark);
	cout << mark << endl;
}

Measured memory_bytes: 256
from collections import Counter


if __name__ == "__main__":
    N = int(input())
    C = Counter()
    march = ["M", "A", "R", "C", "H"]
    for _ in range(N):
        s = input()
        if s[0] in march:
            C[s[0]] += 1
    ans = 0
    for i in range(3):
        for j in range(i+1, 4):
            for k in range(j+1, 5):
                ans += C[march[i]] * C[march[j]] * C[march[k]]
    print(ans)


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int x; cin >> x;
    int a = x / 100, b = x % 100;
    cout << (b <= 5 * a) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000000
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto c:v) cout<<" "<<c; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int gcd(int a,int b){
	if(!a)
		return b;
	return gcd(b%a,a);
}
void solve(){
	//seive();
	int n;
	cin>>n;
	int a[n],gc=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		gc=gcd(gc,a[i]);
	}
	/*if(n>80000){
		if(gc!=1)
			cout<<"not coprime\n";
		else
			cout<<"setwise coprime\n";
	}
	* */
	//else{
		int pri[1000005]={0},f=0;
		for(ll i=0;i<n;i++){
			int t=a[i];
			for(ll j=2;j*j<=t;j++){
				if(a[i]%j==0){
					while(a[i]%j==0&&a[i]>1)
						a[i]/=j;
					if(!pri[j])
						pri[j]++;
					else{
						f=1;
						break;
					}
				}
				if(f)break;
			}
			if(a[i]>1){
				if(!pri[a[i]])
					pri[a[i]]++;
				else
					f=1;
			}
			if(f)break;
		}
		if(f){
			if(gc!=1)
				cout<<"not coprime\n";
			else
				cout<<"setwise coprime\n";

		}
		else
			cout<<"pairwise coprime\n";
	//}
	
}

int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--)
		solve();
}



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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,ll> P;
typedef pair<ll,P> PP;

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

int n,a,b;

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

	cin>>n>>a>>b;
	if(a+b>n+1||(ll)a*b<(ll)n) {
		cout<<-1<<endl;
		return 0;
	}
	for(int i=n-a+1;i<=n;i++) cout<<i<<' ';
	if(b==1) {
		cout<<endl;
		return 0;
	}
	int times=(n-a)/(b-1);
	int amari=(n-a)%(b-1);
	int cur=n-a;
	for(int i=1;i<b;i++) {
		if(amari>0) {
			for(int i=times;i>=0;i--) {
				cout<<cur-i<<' ';
			}
			cur-=times+1;
			amari--;
		}
		else {
			for(int i=times-1;i>=0;i--) {
				cout<<cur-i<<' ';
			}
			cur-=times;
		}
	}
	cout<<endl;

	//cout<<times<<' '<<amari<<endl;

	return 0;
}


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

int main(){
  map<int,int> mp;
  for(int i=0;i<3;i++){
    int a;
    cin>>a;
    mp[a]++;
  }
  for(auto p:mp){
    if(p.second==1) cout<<p.first<<endl;
  }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef pair<ll, P> P1;

//#define int long long

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (ll i = 0; i < x; i++)
#define rep1(i, x) for (ll i = 1; i <= x; i++)
#define rrep(i, x) for (ll i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (ll i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const ll INF = 10000000000000000;
const ll M = 100000000;
const ll dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const ll dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                        {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

int main() {
    ll a[5], n;
    scanf("%lld%lld%lld%lld%lld%lld", &n, &a[0], &a[1], &a[2], &a[3], &a[4]);
    ll m = INF;
    rep(i, 5) {
        m = min(m, a[i]);
    }
    if (n <= m) {
        printf("%d", 5);
        printf("\n");
        return 0;
    }
    ll ret = 0;
    if (n % m == 0) {
        ret = n / m;
    } else {
        ret = n / m + 1;
    }
    ret += 4;
    printf("%lld", ret);

    /* --------------------------------- */
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  
  val n = sc.nextInt()
  val m = sc.nextInt()
  
  val counts = new Array[Int](m)
  
  for (i <- 1 to n) {
    val k = sc.nextInt()
    for (j <- 1 to k) {
      counts(sc.nextInt() - 1) += 1
    }
  }
  
  println {
    counts.count(_ == n)
  }
}

Measured memory_bytes: 25788
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
using ll = long long;

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  
  vector<ll> s(n + 1);
  s[0] = 0;
  for (ll i = 0; i < n; i++) {
    s[i + 1] = s[i] + a[i];
  }
  for (ll i = 0; i < n + 1; i++) {
    s[i] = (s[i] - i) % k;
  }

  ll ans = 0;
  unordered_map<ll, ll> mp;
  for (ll i = 0; i < n + 1; i++) {
    // cout << s[i] << " " << mp[s[i]] << endl;
    ans += mp[s[i]];
    mp[s[i]]++;
    if (k - 1 <= i) mp[s[i - k + 1]]--;
  }

  cout << ans << endl;
}


Measured memory_bytes: 11592
N = int(input())
numbers = [int(input()) for i in range(N)]
ans = []

def check_prime(n):
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return 0
    else:
        return 1
    
for n in numbers:
    ans.append(check_prime(n))

print(sum(ans))

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


typedef pair<ll,ll> pll;


ll n;
ll a[100005];
set<pll> S;
int main()
{
        cin >> n;
        for(ll i=1;i<=n;i++) {
                cin >> a[i];
                if(S.empty()) S.insert(make_pair(a[i], i));
                else {

                        auto it = S.lower_bound(make_pair(a[i], -1));
                        if(it == S.begin()) S.insert(make_pair(a[i], i));
                        else {
                                        it--;
                                pll X = *it;
                                S.erase(it);
                                S.insert(make_pair(a[i], i));
                        }
                }
        }
        cout << S.size() << endl;
        return 0;
}


Measured memory_bytes: 7296
#include<iostream>
using namespace std;
int selectionSort(int a[],int n)
{
    int i,j,minj,num=0;
    for(i=0;i<n;i++)
    {
        minj=i;
        for(j=i;j<n;j++)
        {
            if(a[j]<a[minj])
            {
                minj=j;
            }
        }
        swap(a[i],a[minj]);
        if(i==minj)
            continue;
        num++;
    }
    return num;
}
int main()
{
    int N,A[101];
    cin>>N;
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
    }
    int num=selectionSort(A,N);
    for(int i=0;i<N;i++)
    {
        if(i)
            cout<<" ";
        cout<<A[i];
    }
    cout<<endl<<num<<endl;
    return 0;
}



Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int A,B,K,cnt=0;
  cin>>A>>B>>K;
  for(int i=100;i>0;i--){
    if(A%i==0 && B%i==0) cnt++;
    if(cnt==K){
      cout<< i <<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll zenbu[900000];
ll tmp[900001];
void pakuri_sort(int N, ll A[]) {
	const int b = 16;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int H = getint(), W = getint(), N = getint();
	int k = 0;
	rep(i, N) {
		int a = getint(), b = getint();
		for (int i = max(2, a - 1); i <= min(H - 1, a + 1); i++) {
			for (int j = max(2, b - 1); j <= min(W - 1, b + 1); j++) {
				zenbu[k++] = ((ll)i << 30) + j;
			}
		}
	}

	pakuri_sort(k, zenbu);

	ll kotae[10] = {};
	int total = -1;
	ll mae = -1;
	int kazu = 0;
	rep(i, k) {
		if (mae == zenbu[i]) kazu++;
		else {
			kotae[kazu]++;
			total++;
			mae = zenbu[i];
			kazu = 1;
		}
	}
	kotae[kazu]++;
	total++;
	kotae[0] = (ll)(H - 2) * (W - 2) - total;

	rep(i, 10) printf("%lld\n", kotae[i]);

	Would you please return 0;
}

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

int main() {
  int a,b,c;
  cin >> a >> b;
  if( a%2 != 0 && b%2 != 0 ){
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<limits>
#include<cstdio>
#include<queue>
#include<map>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
#define MOD 1e+7
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
using namespace std;

int main() {
	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<int> temp_a(A), temp_b(B);

	for (int i = 0; i < A; i++) {
		cin >> temp_a[i];
	}
	for (int j = 0; j < B; j++) {
		cin >> temp_b[j];
	}
	sort(ALL(temp_a),greater<int>());
	sort(ALL(temp_b),greater<int>());

	priority_queue<int, vector<int>,greater<int>> a, b;
	priority_queue<int> c;

	for (int i = 0; i < X; i++) {
		a.push(temp_a[i]);
	}
	for (int j = 0; j < Y; j++) {
		b.push(temp_b[j]);
	}
	for (int k = 0; k < C; k++) {
		int r; cin >> r;
		c.push(r);
	}
	
	for (int k = 0; k < C; k++){
		int mini = min(a.top(), b.top());

		if (mini < c.top()) {
			if (a.top() < b.top()) {
				a.pop();
				a.push(c.top());
				c.pop();
			}
			else {
				b.pop();
				b.push(c.top());
				c.pop();
			}
		}
		else {
			break;
		}
	}
	

	a.push(int_INF);
	b.push(int_INF);
	
	ll ans = 0;

	for (int i = 0; i < X; i++) {
		ans += a.top();
		a.pop();
	}

	for (int j = 0; j < Y; j++) {
		ans += b.top();
		b.pop();
	}

	cout << ans << endl;
}


Measured memory_bytes: 2552
N = int(input())
D = list(map(int,input().split()))
D.sort()
M = int(input())
T = list(map(int,input().split()))
T.sort()

dindex = 0
for i in range(M):
  while 1:
    dindex += 1
    if T[i] == D[dindex-1]:
      break
    elif dindex == N:
      print('NO')
      exit()
print('YES')

Measured memory_bytes: 35408
#ABC151C
n,m=list(map(int,input().split()))

chk = [False]*n
wa = [0]*n
c_ac = 0;
c_wa = 0;

for i in range(m):
    _p,_s=input().split()
    j=int(_p)-1
        
    if _s == "WA":
      if chk[j] == False:
        wa[j]+=1
    
    elif _s == "AC":
      if chk[j] == False:
        c_ac += 1
        c_wa += wa[j]
        chk[j] =True

print(c_ac,c_wa,sep= ' ')

Measured memory_bytes: 4596
use std::io::prelude::*;
use std::io;

fn main() {
    let mut stdin = io::stdin();
    let mut buf = String::new();

    stdin.read_to_string(&mut buf).unwrap();

    let mut line = buf.trim().split(' ');

    let (x, y) = {
        let x: i32 = line.next().unwrap().parse().unwrap();
        let y: i32 = line.next().unwrap().parse().unwrap();
        (x, y)
    };
    
    println!("{}", x + y/2);

}

Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
#define CL fclose(stdin),fclose(stdout)
namespace io
{
	int F()
	{
		int n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
	long long G()
	{
		long long n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
}
char s[5555];
const int M=1000000007;
int f[5005][5005];
int g[5005][5005];
int h[5005];
int main()
{
	int n=io::F();
	scanf("%s",s+1); 
	int m=strlen(s+1);
	g[1][1]=2;
	for(register int i=1;i<5000;++i)
		for(register int j=1;j<=5000;++j)
			g[i+1][j+1]=(g[i+1][j+1]+2ll*g[i][j])%M,g[i+1][j-1]=(g[i+1][j-1]+g[i][j])%M;
	h[0]=1;
	for(register int i=1;i<=5000;++i)
	{
		h[i]=h[i-1];
		for(register int j=i-2;j>=0;j-=2)h[i]=(h[i]+(long long)h[j]*g[i-j][0])%M;
	}
	f[1][1]=1;
	for(register int i=1;i<5000;++i)
		for(register int j=1;j<=5000;++j)
			f[i+1][j+1]=(f[i+1][j+1]+f[i][j])%M,f[i+1][j-1]=(f[i+1][j-1]+2ll*f[i][j])%M;
	int ans=0;
	for(register int k=0;k<n;++k)
		ans=(ans+(long long)h[k]*f[n-k][m])%M;
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 195840
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from itertools import groupby
    n=int(input())
    s=input()
    G=groupby(s)
    ans=0
    for key,it in G:
        ans+=1
    print(ans)
resolve()

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

using namespace std;

typedef long long ll;

int main(){
    int n, b, c;
    cin >> n;
    int x[100001] = {};
    int y[100001] = {};
    for(int a = 0; a < n/2; a++){
        cin >> b >> c;
        x[b]++; y[c]++;
    }
    int x1 = 0;
    int x2 = 0;
    int y1 = 0;
    int y2 = 0;
    int e, f;
    for(int d = 0; d < 100001; d++){
        int t;
        if(x1 < x[d]){
            t = x1;
            x1 = x[d];
            x2 = t;
            e = d;
        }
        else if(x2 < x[d]){
            x2 = x[d];
        }
        if(y1 < y[d]){
            t = y1;
            y1 = y[d];
            y2 = t;
            f = d;
        }
        else if(y2 < y[d]){
            y2 = y[d];
        }       
    }
    if(e == f){
        if(x2 > y2)y2 = x2;
        cout << n-x1-y2 << endl;
        return 0;
    }
    cout << n-x1-y1 << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int A, B, C, D; cin >> A >> B >> C >> D;
    
    while(1){
      C -= B;
      if (C<=0) {
        cout << "Yes" << endl;
        break;
      }
      A -= D;
      if (A<=0){
        cout << "No" << endl;
        break;
      }
    }
    return 0;
    
}

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

long double dp[303][303][303];

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

 int c1=0, c2=0, c3=0;
 for(int i=0, x; i<n; i++)
 {
  cin >> x;
  if(x == 1) c1++;
  if(x == 2) c2++;
  if(x == 3) c3++;
 }

 long double pi,pj,pk,wt;
 for(int i=0; i<=n; i++)
 {
  for(int j=0; i+j<=n; j++)
  {
    for(int k=0; i+j+k<=n; k++)
    {
      if(i==0 && j==0 && k==0)
      continue;

      pi = 1.0*i/(i+j+k);
      pj = 1.0*j/(i+j+k);
      pk = 1.0*k/(i+j+k);
      wt = 1.0*n/(i+j+k);

      if(k)
        dp[k][j][i] += dp[k-1][j][i]*1.0*pk;
      if(j)
        dp[k][j][i] += dp[k+1][j-1][i]*1.0*pj;
      if(i)
        dp[k][j][i] += dp[k][j+1][i-1]*1.0*pi;

      dp[k][j][i] += wt;
    }
  }
 }
  
 cout<<setprecision(17)<<dp[c1][c2][c3];

  return 0;
}


Measured memory_bytes: 432384
#include<stdio.h>
#define max 10000
#define nil -1

struct Node{int p,l,r;};
struct Node T[max];
int n;

void pP(int u){
  if(u==nil)return;
  printf(" %d",u);
  pP(T[u].l);
  pP(T[u].r);
}

void iP(int u){
  if(u==nil)return;
  iP(T[u].l);
  printf(" %d",u);
  iP(T[u].r);
}

void posP(int u){
  if(u==nil)return;
  posP(T[u].l);
  posP(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=nil;
  }
  for(i=0;i<n;i++){
  scanf("%d%d%d",&v,&l,&r);
  T[v].l=l;
  T[v].r=r;
  if(l!=nil)T[l].p=v;
  if(r!=nil)T[r].p=v;
  }
  for(i=0;i<n;i++)if(T[i].p==nil)root=i;
  printf("Preorder\n");
  pP(root);
  printf("\n");
  printf("Inorder\n");
  iP(root);
  printf("\n");
  printf("Postorder\n");
  posP(root);
  printf("\n");
  return 0;
}



Measured memory_bytes: 2096
S = input()
X = [('g' if i % 2 == 0 else 'p') for i in range(len(S))]

ans = 0
for s, x in zip(S, X):
    if s == 'g' and x == 'p':
        ans += 1

    if s == 'p' and x == 'g':
        ans -= 1

print(ans)


Measured memory_bytes: 3956
using AtCoderBeginnerContest145.Questions;
using AtCoderBeginnerContest145.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest145.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var r = inputStream.ReadInt();
            yield return r * r;
        }
    }
}


namespace AtCoderBeginnerContest145
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest145.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest145.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13140