akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define inf (1<<29)

int N,M,R;
int r[9];bool used[9];
long long int res;
long long int dp[201][201];


void dfs(int c,int las,int dist){
	
	if(c==R+1){
		if(res>dist)res=dist;
		return;
	}
	for(int i=1;i<=R;++i)if(!used[i]){
		used[i]=true;
		if(las==-1)dfs(c+1,i,0);
		else dfs(c+1,i,dist+dp[r[las]][r[i]]);
		used[i]=false;
	}
}

int main(){
  cin>>N>>M>>R;
  for(int i=1;i<=R;++i){
  	cin>>r[i];
  }
  for(int i=1;i<=N;++i){
  	for(int j=1;j<=N;++j){
			if(i!=j)dp[i][j]=inf;
  	}
  }
  for(int i=1;i<=M;++i){
  	int a,b,c;
  	cin>>a>>b>>c;
  	if(dp[a][b]>c)dp[a][b]=dp[b][a]=c;
  }

  for(int k=1;k<=N;++k){
  	for(int i=1;i<=N;++i){
  		for(int j=1;j<=N;++j){
  				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
  			}
  		}
  	}
  res=inf;
  dfs(1,-1,0);
  cout<<res<<endl;
}


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

ll N = pow(10,9)+7;

ll pow_mod(ll x, ll y){
    if(y==0) return 1;
    else{
        ll z = pow_mod(x, y/2);
        ll k = (z*z)%N;
        if(y%2==0) return k;
        else return (k*x)%N;
    }
}

int main(){
    ll n;
    cin >> n;
    /*
    ll zero,nine,both,all;
    all = pow_mod(10,n);
    zero = (all - pow_mod(9,n))%N;
    if(zero < 0) zero += N;
    nine = zero;
    both = (all - pow_mod(8,n))%N;
    if(both < 0) both += N;
    ll ans = (zero + nine - both)%N;
    if(ans < 0) ans += N;
    cout << ans << endl;
    */
   ll ans;
   ans = (pow_mod(10,n)+pow_mod(8,n)-2*pow_mod(9,n))%N;
   if(ans < 0) ans += N;
   cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define LL long long

using namespace std;
const int N=105,NN=N<<1,M=N*N;
const LL inf=1ll<<55;
LL rd()
{
    LL x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
struct node
{
	LL x,y;
	node(LL nx=0,LL ny=0){x=nx,y=ny;}
	bool operator < (const node &bb) const {return x!=bb.x?x<bb.x:y<bb.y;}
	node operator + (const node &bb) const {return (node){x+bb.x,y+bb.y};}
}w[M],di[NN];
int to[M],nt[M],c[M],hd[NN],tot=1,ps,pt,fw[NN],pr[NN],v[NN];
LL s1,s2,ans;
void adde(int x,int y,int z,LL z1,LL z2)
{
	++tot,to[tot]=y,nt[tot]=hd[x],c[tot]=z,w[tot]=(node){+z1,+z2},hd[x]=tot;
	++tot,to[tot]=x,nt[tot]=hd[y],c[tot]=0,w[tot]=(node){-z1,-z2},hd[y]=tot;
	s1-=z*z1;
}
void csfl()
{
	queue<int> q;
	while(1)
	{
		for(int i=1;i<=pt;++i) di[i]=(node){-inf,-inf};
		di[ps]=(node){0,0},fw[ps]=1<<30,v[ps]=1,q.push(ps);
		fw[pt]=0;
		while(!q.empty())
		{
			int x=q.front();
			q.pop();
			for(int i=hd[x];i;i=nt[i])
			{
				int y=to[i];
				if(c[i]>0&&di[y]<di[x]+w[i])
				{
					di[y]=di[x]+w[i];
					pr[y]=i,fw[y]=min(fw[x],c[i]);
					if(!v[y]) v[y]=1,q.push(y);
				}
			}
			v[x]=0;
		}
		if(!fw[pt]) return;
		s1+=di[pt].x*fw[pt],s2+=di[pt].y*fw[pt];
		int x=pt;
		while(x!=ps)
		{
			int i=pr[x];
			c[i]-=fw[pt],c[i^1]+=fw[pt];
			x=to[i^1];
		}
	}
}
int n,m,t=100;
char cc[2];
LL a[N][3],b[N<<2][3],px[N][2],py[N][2];
map<char,int> id;

int main()
{
//////
	id['L']=0,id['R']=1,id['D']=2,id['U']=3;
	n=rd();
	for(int i=1;i<=n;++i)
		for(int j=0;j<=2;++j)
			a[i][j]=rd();
	m=rd();
	for(int i=1;i<=m;++i)
	{
		scanf("%s",cc),b[i][0]=id[cc[0]];
		b[i][1]=rd(),b[i][2]=rd();
	}
	ps=0,pt=203;
	int yyb=201,zsy=202;
	for(int h=1;h<=n;++h)
	{
		memset(hd,0,sizeof(int)*(pt+1)),tot=1,s1=s2=0;
		for(int i=1;i<=t;++i) px[i][0]=0,px[i][1]=1<<30;
		for(int i=1;i<=t;++i) py[i][0]=0,py[i][1]=1<<30;
		for(int i=1;i<=m;++i)
		{
			if(b[i][0]==0) px[b[i][1]][1]=min(px[b[i][1]][1],b[i][2]);
			if(b[i][0]==1) px[b[i][1]-1][0]=max(px[b[i][1]-1][0],h-b[i][2]);
			if(b[i][0]==2) py[b[i][1]][1]=min(py[b[i][1]][1],b[i][2]);
			if(b[i][0]==3) py[b[i][1]-1][0]=max(py[b[i][1]-1][0],h-b[i][2]);
		}
		adde(ps,yyb,h,1,0);
		bool o=1;
		int np=yyb;
		for(int i=t;i;--i)
		{
			if(px[i][0]>px[i][1]){o=0;break;}
			adde(np,i,px[i][0],1,0),adde(np,i,px[i][1]-px[i][0],0,0);
			np=i;
		}
		np=zsy;
		for(int i=t;i;--i)
		{
			if(py[i][0]>py[i][1]){o=0;break;}
			adde(i+t,np,py[i][0],1,0),adde(i+t,np,py[i][1]-py[i][0],0,0);
			np=i+t;
		}
		adde(zsy,pt,h,1,0);
		if(!o) continue;
		for(int i=1;i<=n;++i) adde(a[i][0],a[i][1]+t,1,0,a[i][2]);
		csfl();
		if(s1>=0) ans=max(ans,s2);
	}
	printf("%lld\n",ans);
    return 0;
}


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

using namespace std;
using i64 = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const i64 INFL = (1LL << 62);
const i64 MOD = 1000000007;
void print() { std::cout << std::endl; }
template <typename T, typename... A>
void print(const T& first, const A&... rest) {
  cout << sizeof...(rest) << endl;
  std::cout << first;
  if (sizeof...(rest)) std::cout << " ";
  print(rest...);
}
template <typename... A>
void print(const A&... rest) {
  print(rest...);
}
template <typename A>
void print(const std::vector<A>& v) {
  std::for_each(v.begin(), v.end(), [](A x) { std::cout << x << " "; });
  std::cout << std::endl;
}
int divs_num(int n) {
  vector<int> divs(0);
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      divs.push_back(i);
      if (i != n / i) divs.push_back(n / i);
    }
  }
  return (int)(divs.size());
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i += 2) {
    if (divs_num(i) == 8) ++cnt;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

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



Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
const ll mo=1000000007;
ll ans=0;
ll dp[0][0];

int main()
{ 
ll n;
cin >> n; 
ll table[n]={};
rep(i,n) {
    cin >> table [i];
}
sort(table, table+n);
cout << table[n-1] << ' ';
ll te=abs(table[n-1]/2+1-table[0]);
ll tem;
rep1(i,n-1){
    if(table[n-1]%2){
    tem=abs(table[n-1]/2+1-table[i]);
    if(tem<te){te=tem;ans=i;}
    }
    else{
        tem=abs(table[n-1]/2-table[i]);
        if(tem<te){te=tem;ans=i;}
    }
}

cout << table[ans] << endl;
return 0;
} 

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)

using ll = long long;

signed main() {
    //my-code
    int N; cin >> N;
    vector<ll> a(N); REP(i, N) cin >> a[i];
    map<ll, ll> mp1, mp2;
    REP(i, N) {
        mp1[i+1+a[i]]++;
        mp2[i+1-a[i]]++;
    }
    ll ans = 0;
    REPS(x, 2, N) {
        ans += mp1[x]*mp2[x];
    }
    cout << ans << endl;

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 47500
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);

//main function
int main() {
    char c = cin();
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') stout("vowel");
    else stout("consonant");
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}


Measured memory_bytes: 128
/*input
4 3
-1000000000 -1000000000
1000000000 1000000000
-999999999 999999999
999999999 -999999999
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define YY cout<<"YES\n"
#define NN cout<<"NO\n"
#define yy cout<<"Yes\n"
#define nn cout<<"No\n"
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=105;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll x[maxn],y[maxn];
ll ans=INF64;
int main()
{
	int n,k;
	cin>>n>>k;
	REP(i,n) cin>>x[i]>>y[i];

	REP(l,n) REP(u,n) REP(d,n){
		vector<int> v;
		REP(i,n) if(x[i]>=x[l]&&y[i]>=y[d]&&y[i]<=y[u]) v.pb(x[i]);
		if(SZ(v)<k) continue;
		sort(ALL(v));
		ans=min(ans,(v[k-1]-x[l])*(y[u]-y[d]));
	}
	cout<<ans<<'\n';
	return 0;
}


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

using namespace std;
const int N = 102;

int a[N], b[N];

int main(){

    int n; cin >> n;
    for(int i = 0; i < n - 1; i++) cin >> a[i];

    if(n==2){
        cout << a[0] + a[0];
        return 0;
    }
    b[0] = a[0];
    for(int i = 0; i < n - 1; i++){
        if(i + 1== n - 1){
            b[n - 1] = a[i];
            continue;
        }
        if(a[i] <= a[i + 1]){
            b[i + 1] = a[i];
        }
        else{
            b[i + 1] = a[i + 1];
        }
    }
    int res = 0;
    for(int i = 0; i < n; i++) res += b[i];
    cout << res;
}


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

int main()
{
	ios::sync_with_stdio(false);
	string s,ss;
	string a,b;
	cin>>s;
	int q,cnt=0;
	cin >>q;
	while(q--)
	{
		int t;
		cin >>t;
		if(t==1) cnt++;
		else
		{
			int f;
			cin >>f>>ss;
			if(f==1)
			{
				if(cnt%2) b+=ss;
				else a=ss+a; 
			}
			else
			{
				if(cnt%2) a=ss+a;
				else b+=ss;
			}
		}
	}
	int x=a.size(),y=b.size(),z=s.size();
	if(cnt%2)
	{
		
		for(int i=y-1;i>=0;i--) cout <<b[i];
		for(int i=z-1;i>=0;i--) cout <<s[i];
		for(int i=x-1;i>=0;i--) cout <<a[i];
		
	}
	else
	{
		for(int i=0;i<x;i++) cout <<a[i];
		for(int i=0;i<z;i++) cout <<s[i];
		for(int i=0;i<y;i++) cout <<b[i];
	}
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    cin >> n >> m;
    int a[n],b[n],c[m],d[m];
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i=0;i<m;i++){
        cin >> c[i] >> d[i];
    }
    for(int i=0;i<n;i++){
        int x = a[i];
        int y = b[i];
        int dis=INT_MAX,index = 0;
        for(int i=0;i<m;i++){
            int v = abs(x-c[i]) + abs(y-d[i]);
            if(dis > v){
                dis = v;
                index = i;
            }
        }
        cout << index + 1 << endl;
    }

    return 0;
}


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

string S;
int d[12];

long long dfs(int i, long long s, long long b){
    if (i == S.length()) return s + b;
    return 
        dfs(i+1, s + b, d[i]) 
        + dfs(i+1, s, 10*b+d[i]);
}

int main() {
    cin >> S;
    for (int i = 0; i < S.length(); ++i){
        d[i] = S[i] - 48;
    }
    cout << dfs(1, 0, d[0]) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

void funcB() {
  int n;
  int d1, d2;
  int cnt = 0;
  bool zoro = false;
  std::cin >> n;
  for (int i = 0; i < n;i++) {
    std::cin >> d1 >> d2;
    if (d1 == d2) cnt++;
    else cnt = 0;
    if (cnt >= 3) zoro = true;
  }
  std::cout << (zoro ? "Yes" : "No");
}

int main(void) {
  funcB();
  return 0;
}

Measured memory_bytes: 3132
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
    s.append(list(map(int, input().split())))
t = []
for i in range(d):
    t.append(int(input()))
last = [0] * 26
score = 0
for i in range(d):
    contest = t[i] - 1
    score += s[i][contest]
    last = [last[i] + 1 for i in range(26)]
    last[contest] = 0
    for j in range(26):
        score -= c[j] * last[j]
    print(score)

Measured memory_bytes: 9372
[n,m] = [int(i) for i in input().split()]
ka = []
for i in range(n):
    ka.append([int(j) for j in input().split()])
dic = {}

for i in range(n):
    for j in range(1,len(ka[i])):
        if ka[i][j] not in dic.keys():
            dic[ka[i][j]] = 1
        else:
            dic[ka[i][j]] += 1
count = 0
for i in range(1,m+1):
    if i in dic.keys() and dic[i] == n:
        count += 1

print(count)


Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int n, m;
	vector<string> arr;
	string str;
	char input[4000];
	int i, j;
	int left[2000][2000], right[2000][2000], up[2000][2000], down[2000][2000];
	int lmax = 0;

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

	scanf("%d %d", &n, &m);
	
	for (i = 0; i < n; i++)
	{
		scanf("%s", input);

		str = input;

		arr.push_back(input);
	}

	for (i = 0; i < n; i++)
	{
		if (arr[i][0] == '#')
		{
			left[i][0] = 0;
		}

		else
		{
			left[i][0] = 1;
		}

		for (j = 1; j < m; j++)
		{
			if (arr[i][j] == '#')
			{
				left[i][j] = 0;
			}

			else
			{
				left[i][j] = left[i][j - 1] + 1;
			}
		}
	}

	for (i = 0; i < n; i++)
	{
		if (arr[i][m - 1] == '#')
		{
			right[i][m - 1] = 0;
		}

		else
		{
			right[i][m - 1] = 1;
		}

		for (j = 1; j < m; j++)
		{
			if (arr[i][m - j - 1] == '#')
			{
				right[i][m - j - 1] = 0;
			}

			else
			{
				right[i][m - j - 1] = right[i][m - j] + 1;
			}
		}
	}

	for (i = 0; i < m; i++)
	{
		if (arr[0][i] == '#')
		{
			up[0][i] = 0;
		}

		else
		{
			up[0][i] = 1;
		}

		for (j = 1; j < n; j++)
		{
			if (arr[j][i] == '#')
			{
				up[j][i] = 0;
			}

			else
			{
				up[j][i] = up[j - 1][i] + 1;
			}
		}
	}

	for (i = 0; i < m; i++)
	{
		if (arr[n - 1][i] == '#')
		{
			down[n - 1][i] = 0;
		}

		else
		{
			down[n - 1][i] = 1;
		}

		for (j = 1; j < n; j++)
		{
			if (arr[n - j - 1][i] == '#')
			{
				down[n - j - 1][i] = 0;
			}

			else
			{
				down[n - j - 1][i] = down[n - j][i] + 1;
			}
		}
	}

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			if (arr[i][j] != '#' && left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3 > lmax)
			{
				lmax = left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3;
			}
		}
	}

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

	return 0;
}

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

int main(){
  int N,spos,spos2,spos3;
  string S,ans,s1,s2,s3;
  set<string> result;
  cin >>N>>S;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      for(int l=0;l<10;l++){
        
        ans=S;
        s1=to_string(l);
        s2=to_string(j);
        s3=to_string(i);
        spos=ans.find_last_of(s1);
        if(spos == std::string::npos)
         continue;
        else{
          ans.erase(spos);
          //cout<<ans<<"a"<<endl;
        }
        spos=ans.find_last_of(s2);
        if(spos == std::string::npos)
          continue;
        else{
          ans.erase(spos);
          //cout<<ans<<"b"<<endl;
        }
        spos=ans.find_last_of(s3);
        if(spos == std::string::npos)
          continue;
        else{
          ans.erase(spos);
          //cout<<ans<<"c"<<endl;
        }
        ans=s3+s2+s1;
        //cout <<ans<<"d"<<endl;
        result.insert(ans);
      }
      //cout<<endl;
    }
    //cout<<endl;
  }
    cout <<result.size()<<endl;
}


Measured memory_bytes: 384
def main():
    n, m = map(int, input().split())

    cnt = [0] * n
    not_solved = [True] * n

    ac = 0
    wa = 0
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if s == 'AC':
            if not_solved[p]:
                not_solved[p] = False
                ac += 1
                wa += cnt[p]
        else:
            if not_solved[p]:
                cnt[p] += 1

    print(ac, wa)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()

# int(input())
# map(int, input().split())


Measured memory_bytes: 4596
use proconio::input;
use std::cmp::{max, min};

const MAX_L: usize = 100_000;
const BASE_SIZE: usize = 1 << 10;

fn main() {
    input! {
        n: usize,
        vw: [(usize, usize); n],
        q: usize,
        vl: [(usize, usize); q],
    }
    let dp = make_base(&vw);
    for vlq in vl {
        println!("{}", calc(&vw, vlq.0 - 1, vlq.1, &dp));
    }
}

fn make_base(vw: &Vec<(usize, usize)>) -> Vec<Vec<usize>> {
    let mut dp = Vec::<Vec<usize>>::new();

    dp.push(
        (0..=MAX_L)
        .map(|i| if i < vw[0].1 { 0 } else { vw[0].0 })
        .collect()
    );

    let n = min(vw.len(), BASE_SIZE);
    for c in 1..n {
        let p = (c - 1) / 2;
        dp.push(
            (0..=MAX_L)
            .map(|i| {
                let w = vw[c].1;
                let v = if i < w { 0 } else { dp[p][i - w] + vw[c].0 };
                max(dp[p][i], v)
            })
            .collect()
        );
    }

    dp
}

fn calc(
    vw: &Vec<(usize, usize)>,
    u: usize, 
    l: usize,
    dp: &Vec<Vec<usize>>
) -> usize {
    if u < dp.len() {
        dp[u][l]
    } else {
        let p  = (u - 1) / 2;
        let w = vw[u].1;
        let pv1 = calc(vw, p, l, dp);
        let pv2 = if l < w { 0 } else { calc(vw, p, l - w, dp) + vw[u].0 };
        max(pv1, pv2)
    }
}


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

const long long inf = 100000000000000037;
const long long yens = 1000000000000000;
const int maxn = 100005;

int n, m, s, t, u, v, w, a, b;
vector < pair < int, int > > ga[maxn];
vector < pair < int, int > > gb[maxn];
long long da[maxn], db[maxn], ans[maxn];
set < pair < long long, int > > dset;

signed main () {
	scanf("%d %d %d %d", &n, &m, &s, &t);
	for (int i = 0; i < m; ++i) {
		scanf("%d %d %d %d", &u, &v, &a, &b);
		ga[u].push_back(make_pair(v, a));
		ga[v].push_back(make_pair(u, a));
		gb[u].push_back(make_pair(v, b));
		gb[v].push_back(make_pair(u, b));
	}
	for (int i = 1; i <= n; ++i)
		da[i] = db[i] = inf;
	da[s] = 0LL;
	dset.insert(make_pair(da[s], s));
	while (!dset.empty()) {
		u = dset.begin() -> second;
		dset.erase(dset.begin());
		for (auto pr: ga[u]) {
			v = pr.first, w = pr.second;
			if (da[v] > da[u] + w) {
				dset.erase(make_pair(da[v], v));
				da[v] = da[u] + w;
				dset.insert(make_pair(da[v], v));
			}
		}
	}
	db[t] = 0LL;
	dset.insert(make_pair(db[t], t));
	while (!dset.empty()) {
		u = dset.begin() -> second;
		dset.erase(dset.begin());
		for (auto pr: gb[u]) {
			v = pr.first, w = pr.second;
			if (db[v] > db[u] + w) {
				dset.erase(make_pair(db[v], v));
				db[v] = db[u] + w;
				dset.insert(make_pair(db[v], v));
			}
		}
	}
	ans[n + 1] = inf;
	for (int i = n; i; --i) 
		ans[i] = min(ans[i + 1], da[i] + db[i]);
	for (int i = 1; i <= n; ++i)
		printf("%lld\n", yens - ans[i]);
}


Measured memory_bytes: 20240
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int x;
	cin >> x;
	if (x >= 400 && x <= 599)
		cout << 8 << endl;
	else if (x >= 600 && x <= 799)
		cout << 7 << endl;
	else if (x >= 800 && x <= 999)
		cout << 6 << endl;
	else if (x >= 1000 && x <= 1199)
		cout << 5 << endl;
	else if (x >= 1200 && x <= 1399)
		cout << 4 << endl;
	else if (x >= 1400 && x <= 1599)
		cout << 3 << endl;
	else if (x >= 1600 && x <= 1799)
		cout << 2 << endl;
	else if (x >= 1800 && x <= 1999)
		cout << 1 << endl;
	return 0;
}

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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 58;


int main() {
  int N, L[10];
  cin >> N;
  int l = 0, sum = 0;
  for(int i = 0; i < N; i++) {
    cin >> L[i];
    l = max(l, L[i]);
    sum += L[i];
  }
  sum -= l;
  if(l < sum) puts("Yes");
  else puts("No");
}




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


int main(){
  int x ;
  cin >>x;
  if (x==2){
    cout <<x<<endl;
    return 0;
  }
  bool check = false;
  for (int i = 2;i<x;i++){
    if((x%i)==0){
      check =true;
      break;
    }
  }

  while(check){
    bool ans =false;
    x+=1;
    for(int i = 2;i<x;i++){
      if ((x%i)==0){
        ans =true;
        break;
      }
    }
    check = ans;
  }
  cout<<x<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;
}E[MAXN * 2];
int sumE,head[MAXN],N;
int dis[MAXN];
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
void dfs(int u,int fa) {
    dis[u] = dis[fa] + 1;
    for(int i = head[u] ; i ; i = E[i].next) {
        int v = E[i].to;
        if(v != fa) {
            dfs(v,u);
        }
    }
}
void Solve() {
    read(N);
    if(N == 1) {
        puts("First");return;
    }
    int a,b;
    for(int i = 1 ; i < N ; ++i) {
        read(a);read(b);
        add(a,b);add(b,a);
    }
    dfs(1,0);
    int u = 1;
    for(int i = 1 ; i <= N ; ++i) {
        if(dis[i] > dis[u]) u = i;
    }
    dfs(u,0);
    u = 1;
    for(int i = 1 ; i <= N ; ++i) {
        if(dis[i] > dis[u]) u = i;
    }
    if(dis[u] % 3 == 2) {puts("Second");}
    else puts("First");
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

const int MOD = 1e9 + 7;

int main() {
  int n; cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end());
  for (int i = 0; i < n; ++i) {
    if (n % 2 == 0 and arr[i] != 1 + (i / 2) * 2) {
        cout << 0 << endl;
        return 0;
    }
    if (n % 2 == 1 and arr[i] != ((i + 1) / 2) * 2) {
      cout << 0 << endl;
      return 0;
    }
  }
  int res = 1;
  for (int i = 0; i < n / 2; ++i) {
    res *= 2;
    res %= MOD;
  }
  cout << res << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main(){
    int n;
    cin >> n;
    vi p(n);
    rep(i, n) cin >> p[i];
    int cnt = 0;
    int min = INF;
    rep(i, n){
        if(p[i] <= min) {
            cnt++;
            min = p[i];
        }
        //cout << min << endl;
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int        long long
#define MOD        1000000007
#define MAX        100005
#define pb         push_back
#define mp         make_pair
#define pii        pair<int,int>
#define mii        map<int,int>
#define vi         vector<int>
#define ff         first
#define ss         second
#define T          int t;cin>>t;while(t--)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define umi        unordered_map<int,int>
#define maxheap    priority_queue<int>
#define minheap    priority_queue<int,vector<int>,greater<int> >
#define inp(n)     for(int i=0;i<n;i++)
#define N          200005
#define mxN		   2000005
#define all(v)		v.begin(),v.end()
#define lb(v,val)  (int)(lower_bound(v.begin(),v.end(),val)-v.begin())
#define ub(v,val)  (int)(upper_bound(v.begin(),v.end(),val)-v.begin())
using namespace std;
using namespace std::chrono;

int v[N];

void solve(){
	string s;
	cin >> s;
	if(s.length()<6){
		cout << "Yes";
	}
	else{
		if(s[2]==s[3] && s[4]==s[5])cout<<"Yes";
		else cout<<"No";
	}
}

signed main(){
/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif   */ 
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int t = 1,tt=0; 
	//cin >> t;
	while(t--){
	tt++;
	//cout << "Case #" <<tt<<": ";
	solve(); 
	cout << "\n";
	}
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  if(a+b>=24) cout<<a+b-24<<endl;
  else cout<<a+b<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>

#define ff first
#define ss second

using namespace std;
using pii=pair<int,int>;
using ll=long long;

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin>>v[i];
    sort(v.begin(),v.end());
    int answer=0;
    for(int i=0; i<k; i++) answer+=v[i];
    cout<<answer;

    return 0;
}


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

int main() {
  while (true) {
    int e, max = 0;
    cin >> e;
    if (e == 0) break;
    for (int z = 0; z <= 100; z++) {
      if (z * z * z > e) break;
      for (int y = 0; y <= 1000; y++) {
        if (y * y + z * z * z > e) break;
        else if (max < y * y - y + z * z * z - z) max = y * y - y + z * z * z - z;
      }
    }
    cout << e - max << endl;
  }
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF INT_MAX/3

int ame[2][101];

int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, 2)repl(j, 1, n + 1) cin >> ame[i][j];
    rep(i, 2)repl(j, 1, n + 1) ame[i][j] += ame[i][j - 1];
    int maxi = 0;
    repl(i, 1, n + 1) maxch(maxi, ame[0][i] + ame[1][n] - ame[1][i - 1]);
    cout << maxi << endl;
    return 0;
}

Measured memory_bytes: 256
class Dice
    # constructor
    def initialize(line)
        @figures = line.chomp.split(" ").map(&:to_i)
    end
    
    # Rotate in any direction
    def rotate(direction)
        array = Array.new(6)
        
        case direction
        when "N"
            array[0] = @figures[1]
            array[1] = @figures[5]
            array[2] = @figures[2]
            array[3] = @figures[3]
            array[4] = @figures[0]
            array[5] = @figures[4]
        when "S"
            array[0] = @figures[4]
            array[1] = @figures[0]
            array[2] = @figures[2]
            array[3] = @figures[3]
            array[4] = @figures[5]
            array[5] = @figures[1]
        when "W"
            array[0] = @figures[2]
            array[1] = @figures[1]
            array[2] = @figures[5]
            array[3] = @figures[0]
            array[4] = @figures[4]
            array[5] = @figures[3]
        when "E"
            array[0] = @figures[3]
            array[1] = @figures[1]
            array[2] = @figures[0]
            array[3] = @figures[5]
            array[4] = @figures[4]
            array[5] = @figures[2]
        end
        @figures = Marshal.load(Marshal.dump(array))
    end
    
    # Rotate horizontally
    def turnClockwise()
        array = Array.new(6)
        array[0] = @figures[0]
        array[1] = @figures[2]
        array[2] = @figures[4]
        array[3] = @figures[1]
        array[4] = @figures[3]
        array[5] = @figures[5]
        @figures = Marshal.load(Marshal.dump(array))
    end
    
    def showTop()
        return @figures[0]
    end
    
    def showBottom
        return @figures[5]
    end
    
    def showFront()
        return @figures[1]
    end
    
    def showBack()
        return @figures[4]
    end
    
    def showRight()
        return @figures[2]
    end
    
    def showLeft()
        return @figures[3]
    end
    
    def showLabel()
        return @figures.join(" ")
    end
end

dice1 = Dice.new(gets.chomp)
dice2 = Dice.new(gets.chomp)

for i in 1..4
    for j in 1..4
        if dice1.showTop() == dice2.showTop()
            for k in 1..4
                if dice1.showLabel() == dice2.showLabel()
                    puts "Yes"
                    exit
                else
                    dice1.turnClockwise()
                end
            end
        else
            dice1.rotate("N")
        end
    end
    dice1.rotate("W")
end
puts "No"


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

//const Long N=;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int d[]={a,b,c};
  sort(d,d+3);
  while(k--)
  {
    d[2]*=2;
  }
  cout<<d[0]+d[1]+d[2];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

struct process{
    string name;
    int time;
};

template <typename T>
class queue{
    T d[100000];
    int head, tail;
public:
    queue():head(0), tail(0){};
    bool isempty() {return (head==tail);}
    void enqueue(const T &data) {
        if(tail==100000) tail=0;
        d[tail++] = data;
    }
    T& dequeue() {
        if(head==100000) head=0;
        return d[head++];
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    queue<process> qu;
    int n, q, t=0;
    cin>>n>>q;
    process p;
    for(int i=0; i<n; i++) {
        cin>>p.name>>p.time;
        qu.enqueue(p);
    }
    while(!qu.isempty()) {
        process& cp = qu.dequeue();
        if(cp.time <= q) {
            t+=cp.time;
            cout<<cp.name<<' '<<t<<'\n';
        } else {
            cp.time -=q;
            t+=q;
            qu.enqueue(cp);
        }
    }
    return 0;
}

Measured memory_bytes: 5120
using System;
using System.Text;

class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            if (s.Length < 2)
            {
                Console.WriteLine(0);
                return;
            }

            int count = 0;
            StringBuilder newS = new StringBuilder(s);
            for (int i = 0; i < s.Length - 1; i++)
            {
                if (newS[i].Equals(newS[i+1]))
                {
                    newS[i+1] = (newS[i] == '0' ? '1' : '0');
                    count++;
                }
            }
            Console.WriteLine(count);
            return;
        }
    }

Measured memory_bytes: 13536
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define LL long long
#define pii pair<int,int>
#define MEM(x) memset(x,0,sizeof(x))
using namespace std;
void solve(){
    int n,x,t;
    scanf("%d %d %d",&n,&x,&t);
    printf("%d\n",(n+x-1)/x*t);
}
int main()
{
    int t=1;
    //scanf("%d",&t);
    int T=1;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
typedef long long ll;
typedef long double lld;
typedef long long int lli;
using namespace std;
const int N = 1000001;
const bool DEBUG = 1;
#define sd(x) scanf("%d", &x)
#define sd2(x, y) scanf("%d%d", &x, &y)
#define sd3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define LET(x, a) __typeof(a) x(a)
#define foreach(it, v) for (LET(it, v.begin()); it != v.end(); it++)
#define MEMS(a, b) memset(a, b, sizeof(a))
#define _			\
    ios_base::sync_with_stdio(false);			\
    cin.tie(NULL);			\
    cout.tie(NULL);
#define __ 			\
    freopen("input.txt", "r", stdin);			\
    freopen("output.txt", "w", stdout);
#define all(c) c.begin(), c.end()
#define inf 1000000000000000001
#define epsilon 1e-6
#define RUN_T			 \
    int _t; 			 \
    cin >> _t;			 \
    while (_t--)			 
#define tr(...)				\
if (DEBUG) {				\
cout << __FUNCTION__ << ' ' << __LINE__ << " = ";				\
trace(#__VA_ARGS__, __VA_ARGS__);				\
}
template <typename S, typename T>
ostream &operator<<(ostream &out, pair<S, T> const &p) {
    out << '(' << p.fi << ", " << p.se << ')';
    return out;
}
template <typename T>
ostream &operator<<(ostream &out, set<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T, typename V>
ostream &operator<<(ostream &out, map<T, V> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << "\n" << (i->first) <<  ":"  << (i->second);
    return out;
}
template <typename T, typename V>
ostream &operator<<(ostream &out, unordered_map<T, V> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << "\n" << (i->first) <<  ":"  << (i->second);
    return out;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T>
ostream &operator<<(ostream &out, unordered_set<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T>
ostream &operator<<(ostream &out, unordered_multiset<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T> ostream &operator<<(ostream &out, vector<T> const &v) {
    ll l = v.size();
    for (ll i = 0; i < l - 1; i++)
        out << v[i] << ' ';
    if (l > 0)
        out << v[l - 1];
    return out;
}
template <typename T> void trace(const char *name, T &&arg1) {
    cout << name <<  ":"  << arg1 << endl;
}
template <typename T, typename... Args>
void trace(const char *names, T &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) <<  ":"  << arg1 <<  "|" ;
    trace(comma + 1, args...);
}
int gcd(int a, int b) {
     if (b == 0)
        return a;
    return gcd(b, a % b);
}
#define int ll
int32_t main() {
    int k;
    int x;
    cin>>k>>x;
    if(k*500>=x){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int64 a, b, k; cin >> a >> b >> k;
	if (a == 0 && b == 0) {
		cout << 0 << " " << 0 << endl;
		return;
	}
	if (a - k < 0) {
		k = k - a;
		a = 0;
		if (b - k >= 0) {
			b = b - k;
		} else {
			b = 0;
		}
	} else {
		a = a - k;
	}
	cout << a << " " << b << endl;
	return;
}

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

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

const ll logx=30;
const ll N=4e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

int main()
{
  ll n;
  cin>>n;
  ll a[n],pre[n],suf[n],gcx=0;
  for(ll i=0;i<n;i++){cin>>a[i];}
  for(ll i=0;i<n;i++)
  {
    gcx=GCD(gcx,a[i]);
    pre[i]=gcx;
  }
  gcx=0;
  for(ll i=n-1;i>=0;i--)
  {
    gcx=GCD(gcx,a[i]);
    suf[i]=gcx;
  }
  ll maxi=0;
  for(ll i=0;i<n;i++)
  {
    if(i==0)
    {
      maxi=max(maxi,suf[i+1]);
    }
    else if(i==n-1)
    {
      maxi=max(maxi,pre[i-1]);
    }
    else
    {
      maxi=max(maxi,GCD(pre[i-1],suf[i+1]));
    }
    //trace2(i,maxi);
  }
  cout<<maxi<<endl;
}


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

typedef long long ll;


struct hoge{
    ll id, solved, penalty, team;
    hoge(ll id, ll solved, ll penalty, ll team) : id(id), solved(solved), penalty(penalty), team(team) { }
};
bool operator < (const hoge &a, const hoge &b){
    return a.solved == b.solved ? (a.penalty == b.penalty ? a.id < b.id : a.penalty < b.penalty) : a.solved > b.solved;
}

int main(void){
    while(true){
        ll n;
        cin >> n;
        if(n==0) break;
        vector<hoge> v;
        for(ll i=0; i<n; i++){
            ll id, u, a, p;
            cin >> id >> u >> a >> p;
            v.push_back(hoge(id, a, p, u));
        }
        sort(v.begin(), v.end());
        
        ll unity[1010];
        ll count=0;
        fill(unity, unity+1010, 0);
        for(ll i=0; i<v.size(); i++){
            unity[v[i].team]++;
            //cout << "i="<<i<<" unity[" <<v[i].team << "]=" << unity[v[i].team] << "\n";
            if(count<10){
                if(unity[v[i].team]<=3){
                    cout << v[i].id << "\n";
                    count++;
                }
            }else if(count<20){
                if(unity[v[i].team]<=2){
                    cout << v[i].id << "\n";
                    count++;
                }
            }else if(count<26){
                //cout << "here" << "\n";
                if(unity[v[i].team]<=1){
                    cout << v[i].id << "\n";
                    count++;
                }
            }
            
        }
        
    }
     
     
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  string s; cin >> s;
  int ans = 0;
  for (int i=1; i<s.size(); ++i) if (s[i] != s[i-1]) ++ans;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

ll calc(int W, vector<ll>& dp, ll mod)
{
	if (W <= 1)
	{
		dp[W] = 1;
	}
	else if(dp[W] <= 0)
	{
		dp[W] += calc(W - 1, dp, mod);
		dp[W] += calc(W - 2, dp, mod);
		dp[W] %= mod;
	}

	return dp[W];
}

int main()
{
	int H, W, K;
	cin >> H >> W >> K;
	--K;

	auto mod = (ll)1e9 + 7;
	vector<ll> dp((H + 1) * W);
	vector<ll> dp2(W + 1);
	calc(W, dp2, mod);
	dp2[0] = 1;

	dp[0] = 1;
	for (auto h = 0; h < H; ++h)
	{
		for (auto w = 0; w < W; ++w)
		{
			auto current = dp[W * h + w];
			auto mul = dp2[w] * dp2[W - w - 1];
			dp[W * (h + 1) + w] = (dp[W * (h + 1) + w] + current * mul) % mod;
			if (w < W - 1)
			{
				mul = dp2[w] * dp2[W - w - 2];
				dp[W * (h + 1) + w + 1] = (dp[W * (h + 1) + w + 1] + current * mul) % mod;
			}
			if (w > 0)
			{
				mul = dp2[w - 1] * dp2[W - w - 1];
				dp[W * (h + 1) + w - 1] = (dp[W * (h + 1) + w - 1] + current * mul) % mod;
			}
		}
	}

	cout << dp[W * H + K] << endl;

	return 0;
}

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

int main()
{
    string S;
    cin >> S;
    if (S[0] != 'A')
    {
        cout << "WA";
        return 0;
    }
    bool flag = false;
    for (int i = 1; i < S.size(); i++)
    {
        if (isupper(S[i]))
        {
            if (i >= 2 && S.size() - 2 >= i)
            {
                if (S[i] == 'C')
                {
                    if (flag)
                    {
                        cout << "WA";
                        return 0;
                    }
                    flag = true;
                }
                else
                {
                    cout << "WA";
                    return 0;
                }
            }
            else
            {
                cout << "WA";
                return 0;
            }
        }
    }
    if (flag)
    {
        cout << "AC";
    }
    else
    {
        cout << "WA";
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define pi 3.1415926535
#define ll long long

int main() {
	ll n;
	ll st;
	ll i;
	ll data[200010] = { 0 };
	cin >> n;
	for (i = 2; i <= n; i++) {
		cin >> st;
		data[st]++;
	}
	for (i = 1; i <= n; i++) {
		cout << data[i] << endl;
	}
	return 0;

}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, Ans = 30;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int A_i, count= 0;
    cin >> A_i;
    while (A_i % 2 == 0) {
      A_i /= 2;
      count++;
    }
    if (Ans > count) {
      Ans = count;
    }
  }
  cout << Ans << endl;
  
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

type Sword struct {
	a int64
	b int64
}

type Swords []Sword

func (a Swords) Len() int {
	return len(a)
}

func (a Swords) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func (a Swords) Less(i, j int) bool {
	return a[i].b > a[j].b
}

func main() {
	var N int
	var H int64

	fmt.Scanf("%d %d", &N, &H)

	swords := make(Swords, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d", &swords[i].a, &swords[i].b)
	}

	sort.Sort(swords)

	max := swords[0].a
	for i := 0; i < N; i++ {
		if swords[i].a > max {
			max = swords[i].a
		}
	}

	attack := 0
	damage := int64(0)
	for i := 0; i < N; i++ {
		if damage >= H || swords[i].b < max {
			break
		}

		damage += swords[i].b
		attack++
	}

	if damage < H {
		more := int((H - damage + (max - 1)) / max)
		attack += more
		damage += max * int64(more)
	}

	fmt.Println(attack)
}


Measured memory_bytes: 4992
#include<stdio.h>
int main(void){
  int r;
  
  scanf("%d",&r);
  if(r<1200){
    printf("ABC");
  }
  else if((r>=1200)&&(r<2800)){
    printf("ARC");
  }
  else{
    printf("AGC");
  }
  
  return 0;
}

Measured memory_bytes: 128